(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_org_jetbrains_kotlinx_atomicfu, kotlin_io_github_aakira_napier, kotlin_app_cash_paging_paging_common, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core, kotlin_io_ktor_ktor_http, kotlin_io_ktor_ktor_utils, kotlin_io_ktor_ktor_client_core, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var protoOf = kotlin_kotlin.$_$.wc;
  var classMeta = kotlin_kotlin.$_$.lb;
  var setMetadataFor = kotlin_kotlin.$_$.xc;
  var THROW_CCE = kotlin_kotlin.$_$.hi;
  var isInterface = kotlin_kotlin.$_$.gc;
  var Long = kotlin_kotlin.$_$.ai;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var CoroutineImpl = kotlin_kotlin.$_$.va;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ha;
  var VOID = kotlin_kotlin.$_$.f;
  var indexOf = kotlin_kotlin.$_$.df;
  var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.e1;
  var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.u2;
  var objectMeta = kotlin_kotlin.$_$.vc;
  var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2;
  var getKClassFromExpression = kotlin_kotlin.$_$.d;
  var Exception = kotlin_kotlin.$_$.wh;
  var CancellationException = kotlin_kotlin.$_$.ga;
  var callbackFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i1;
  var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1;
  var ProducerScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a1;
  var BufferOverflow_DROP_OLDEST_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a;
  var Channel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z;
  var launch = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m2;
  var awaitClose = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b;
  var joinToString = kotlin_kotlin.$_$.a8;
  var atomic$boolean$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.c;
  var Napier_getInstance = kotlin_io_github_aakira_napier.$_$.g;
  var LoadResult = kotlin_app_cash_paging_paging_common.$_$.h;
  var PagingSource = kotlin_app_cash_paging_paging_common.$_$.i;
  var atomic$int$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.f;
  var Dispatchers_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.v;
  var withContext = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m;
  var removeAll = kotlin_kotlin.$_$.c9;
  var listOf = kotlin_kotlin.$_$.k8;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.n6;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l;
  var checkIndexOverflow = kotlin_kotlin.$_$.l6;
  var listOf_0 = kotlin_kotlin.$_$.l8;
  var plus = kotlin_kotlin.$_$.z8;
  var flatten = kotlin_kotlin.$_$.s7;
  var toList = kotlin_kotlin.$_$.u9;
  var get = kotlin_kotlin.$_$.ra;
  var fold = kotlin_kotlin.$_$.qa;
  var minusKey = kotlin_kotlin.$_$.sa;
  var plus_0 = kotlin_kotlin.$_$.ua;
  var Element = kotlin_kotlin.$_$.ta;
  var toSet = kotlin_kotlin.$_$.aa;
  var toLong = kotlin_kotlin.$_$.zc;
  var withTimeout = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m;
  var NonCancellable_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y;
  var Mutex = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.s1;
  var Job = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a2;
  var CoroutineScope_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y1;
  var interfaceMeta = kotlin_kotlin.$_$.xb;
  var to = kotlin_kotlin.$_$.nj;
  var mapOf = kotlin_kotlin.$_$.o8;
  var toMap = kotlin_kotlin.$_$.w9;
  var IntCompanionObject_instance = kotlin_kotlin.$_$.y4;
  var numberToLong = kotlin_kotlin.$_$.tc;
  var delay = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.k;
  var atomic$long$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d;
  var numberToInt = kotlin_kotlin.$_$.sc;
  var LazyThreadSafetyMode_NONE_getInstance = kotlin_kotlin.$_$.h;
  var lazy = kotlin_kotlin.$_$.ej;
  var ensureNotNull = kotlin_kotlin.$_$.zi;
  var KProperty1 = kotlin_kotlin.$_$.vd;
  var getPropertyCallableRef = kotlin_kotlin.$_$.ub;
  var RuntimeException = kotlin_kotlin.$_$.gi;
  var RuntimeException_init_$Init$ = kotlin_kotlin.$_$.n2;
  var captureStack = kotlin_kotlin.$_$.fb;
  var getStringHashCode = kotlin_kotlin.$_$.vb;
  var getBooleanHashCode = kotlin_kotlin.$_$.rb;
  var PluginGeneratedSerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u2;
  var LongSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.v;
  var UnknownFieldException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.f;
  var typeParametersSerializers = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p2;
  var GeneratedSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q2;
  var throwMissingFieldException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.z2;
  var objectCreate = kotlin_kotlin.$_$.uc;
  var emptyList = kotlin_kotlin.$_$.i7;
  var Enum = kotlin_kotlin.$_$.uh;
  var contentEquals = kotlin_kotlin.$_$.q6;
  var hashCode = kotlin_kotlin.$_$.wb;
  var toString = kotlin_kotlin.$_$.bd;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1;
  var Application_getInstance = kotlin_io_ktor_ktor_http.$_$.b;
  var TextContent = kotlin_io_ktor_ktor_http.$_$.q;
  var JsType_instance = kotlin_io_ktor_ktor_utils.$_$.b;
  var getKClass = kotlin_kotlin.$_$.e;
  var arrayOf = kotlin_kotlin.$_$.wi;
  var createKType = kotlin_kotlin.$_$.b;
  var typeInfoImpl = kotlin_io_ktor_ktor_utils.$_$.k;
  var OutgoingContent = kotlin_io_ktor_ktor_http.$_$.p;
  var NullBody_instance = kotlin_io_ktor_ktor_http.$_$.a;
  var header = kotlin_io_ktor_ktor_client_core.$_$.l;
  var parameter = kotlin_io_ktor_ktor_client_core.$_$.m;
  var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.h2;
  var enumEntries = kotlin_kotlin.$_$.za;
  var Refresh = kotlin_app_cash_paging_paging_common.$_$.c;
  var Prepend = kotlin_app_cash_paging_paging_common.$_$.b;
  var Append = kotlin_app_cash_paging_paging_common.$_$.a;
  var takeFrom = kotlin_io_ktor_ktor_http.$_$.l1;
  var get_encodedPath = kotlin_io_ktor_ktor_http.$_$.e1;
  var set_encodedPath = kotlin_io_ktor_ktor_http.$_$.f1;
  var get_jsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.v;
  var JsonNull = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.i;
  var get_boolean = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.p;
  var get_double = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.q;
  var get_float = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.r;
  var get_long = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.w;
  var get_int = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.s;
  var toShort = kotlin_kotlin.$_$.ad;
  var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.l;
  var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.m;
  var JsonNull_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.d;
  var mapCapacity = kotlin_kotlin.$_$.m8;
  var coerceAtLeast = kotlin_kotlin.$_$.jd;
  var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.u;
  var JsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j;
  var JsonPrimitive_1 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.k;
  var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1;
  var MutableStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e1;
  var onStart = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o1;
  var NullPointerException_init_$Create$ = kotlin_kotlin.$_$.i2;
  var LogLevel_VERBOSE_getInstance = kotlin_io_github_aakira_napier.$_$.e;
  var LogLevel_DEBUG_getInstance = kotlin_io_github_aakira_napier.$_$.b;
  var LogLevel_INFO_getInstance = kotlin_io_github_aakira_napier.$_$.d;
  var LogLevel_WARNING_getInstance = kotlin_io_github_aakira_napier.$_$.f;
  var LogLevel_ERROR_getInstance = kotlin_io_github_aakira_napier.$_$.c;
  var LogLevel_ASSERT_getInstance = kotlin_io_github_aakira_napier.$_$.a;
  var noWhenBranchMatchedException = kotlin_kotlin.$_$.gj;
  var ArrayListSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.n2;
  var IntSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u;
  var equals = kotlin_kotlin.$_$.ob;
  var MutableSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d1;
  var asSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g1;
  var toLong_0 = kotlin_kotlin.$_$.xg;
  var Comparator = kotlin_kotlin.$_$.rh;
  var compareValues = kotlin_kotlin.$_$.fa;
  var plus_1 = kotlin_kotlin.$_$.a9;
  var minus = kotlin_kotlin.$_$.p8;
  var asStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h1;
  var sortedWith = kotlin_kotlin.$_$.o9;
  var cancel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g2;
  var Page = kotlin_app_cash_paging_paging_common.$_$.g;
  var Invalid = kotlin_app_cash_paging_paging_common.$_$.f;
  var toBoolean = kotlin_kotlin.$_$.ng;
  var abs = kotlin_kotlin.$_$.dd;
  var until = kotlin_kotlin.$_$.rd;
  var get_request = kotlin_io_ktor_ktor_client_core.$_$.r;
  var toList_0 = kotlin_kotlin.$_$.t9;
  var first = kotlin_kotlin.$_$.p7;
  var Companion_getInstance = kotlin_io_ktor_ktor_http.$_$.i;
  var bodyAsText = kotlin_io_ktor_ktor_client_core.$_$.a;
  var JsonObjectSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.e;
  var toString_0 = kotlin_kotlin.$_$.mj;
  var List = kotlin_kotlin.$_$.w5;
  var Collection = kotlin_kotlin.$_$.p5;
  var get_isActive = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.k2;
  var HttpRequestBuilder = kotlin_io_ktor_ktor_client_core.$_$.j;
  var Companion_getInstance_0 = kotlin_io_ktor_ktor_http.$_$.g;
  var HttpStatement = kotlin_io_ktor_ktor_client_core.$_$.q;
  var contentType = kotlin_io_ktor_ktor_http.$_$.c1;
  var Default_getInstance = kotlin_kotlin.$_$.b5;
  var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.u1;
  var numberRangeToNumber = kotlin_kotlin.$_$.oc;
  var trimIndent = kotlin_kotlin.$_$.gh;
  var charArrayOf = kotlin_kotlin.$_$.gb;
  var split = kotlin_kotlin.$_$.yf;
  var joinToString_0 = kotlin_kotlin.$_$.b8;
  var ChannelResult__getOrThrow_impl_od1axs = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.p;
  var _ChannelResult___get_isSuccess__impl__odq1z9 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q;
  var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.e;
  var Factory_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r;
  var GlobalScope_instance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.w;
  var startsWith = kotlin_kotlin.$_$.ag;
  var substringAfter = kotlin_kotlin.$_$.fg;
  var get_js = kotlin_kotlin.$_$.kc;
  var copyToArray = kotlin_kotlin.$_$.e7;
  var compareTo = kotlin_kotlin.$_$.mb;
  var addAll = kotlin_kotlin.$_$.d6;
  var Json = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.n;
  var plus_2 = kotlin_kotlin.$_$.u8;
  var putAll = kotlin_kotlin.$_$.b9;
  var Exception_init_$Init$ = kotlin_kotlin.$_$.o1;
  var NotImplementedError = kotlin_kotlin.$_$.ci;
  var newThrowable = kotlin_kotlin.$_$.nc;
  var json = kotlin_kotlin.$_$.lc;
  var toInt = kotlin_kotlin.$_$.ug;
  var Exception_init_$Create$ = kotlin_kotlin.$_$.n1;
  var isByteArray = kotlin_kotlin.$_$.ac;
  var ClosedRange = kotlin_kotlin.$_$.gd;
  var contains = kotlin_kotlin.$_$.nd;
  var indexOf_0 = kotlin_kotlin.$_$.v7;
  var first_0 = kotlin_kotlin.$_$.r7;
  var toShort_0 = kotlin_kotlin.$_$.yg;
  var toDouble = kotlin_kotlin.$_$.rg;
  //endregion
  //region block: pre-declaration
  setMetadataFor(DoorSqlDatabaseConnectionImpl, 'DoorSqlDatabaseConnectionImpl', classMeta);
  setMetadataFor(EntityInsertionAdapter$insertAsync$slambda, 'EntityInsertionAdapter$insertAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(EntityInsertionAdapter$insertAndReturnIdAsync$slambda, 'EntityInsertionAdapter$insertAndReturnIdAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(EntityInsertionAdapter$insertListAsync$slambda, 'EntityInsertionAdapter$insertListAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(EntityInsertionAdapter, 'EntityInsertionAdapter', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(PreparedStatement, 'PreparedStatement', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]);
  setMetadataFor(PreparedStatementArrayProxyCommon, 'PreparedStatementArrayProxyCommon', classMeta, VOID, [PreparedStatement], VOID, VOID, VOID, [0, 1]);
  setMetadataFor(prepareAndUseStatementAsync$slambda, 'prepareAndUseStatementAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($prepareAndUseStatementAsyncCOROUTINE$1, '$prepareAndUseStatementAsyncCOROUTINE$1', classMeta, CoroutineImpl);
  setMetadataFor(InvalidationTrackerObserver, 'InvalidationTrackerObserver', classMeta);
  setMetadataFor(doorFlow$1$invalidationTrackerObserver$1, VOID, classMeta, InvalidationTrackerObserver);
  setMetadataFor(doorFlow$slambda$slambda, 'doorFlow$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(doorFlow$slambda, 'doorFlow$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($onBeforeTransactionAsyncCOROUTINE$2, '$onBeforeTransactionAsyncCOROUTINE$2', classMeta, CoroutineImpl);
  setMetadataFor($onAfterTransactionAsyncCOROUTINE$3, '$onAfterTransactionAsyncCOROUTINE$3', classMeta, CoroutineImpl);
  setMetadataFor($onTransactionCommittedAsyncCOROUTINE$4, '$onTransactionCommittedAsyncCOROUTINE$4', classMeta, CoroutineImpl);
  setMetadataFor(NodeEventJdbcImplListenerSqlite, 'NodeEventJdbcImplListenerSqlite', classMeta, VOID, VOID, VOID, VOID, VOID, [3]);
  setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [2]);
  setMetadataFor(InvalidationTracker, 'InvalidationTracker', classMeta, InvalidationTrackerObserver);
  setMetadataFor(DoorLimitOffsetPagingSource$load$slambda, 'DoorLimitOffsetPagingSource$load$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorLimitOffsetPagingSource$nonInitialLoad$slambda, 'DoorLimitOffsetPagingSource$nonInitialLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [2]);
  setMetadataFor($nonInitialLoadCOROUTINE$5, '$nonInitialLoadCOROUTINE$5', classMeta, CoroutineImpl);
  setMetadataFor(DoorLimitOffsetPagingSource, 'DoorLimitOffsetPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [2, 0, 1]);
  setMetadataFor(Companion_0, 'Companion', objectMeta);
  setMetadataFor($findChangedTablesOnConnectionAsyncCOROUTINE$7, '$findChangedTablesOnConnectionAsyncCOROUTINE$7', classMeta, CoroutineImpl);
  setMetadataFor(InvalidationTracker_0, 'InvalidationTracker', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(TransactionElement, 'TransactionElement', classMeta, VOID, [Element]);
  setMetadataFor(Key, 'Key', objectMeta);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($useNewConnectionAsyncInternalCOROUTINE$8, '$useNewConnectionAsyncInternalCOROUTINE$8', classMeta, CoroutineImpl);
  setMetadataFor(RoomDatabaseJdbcImplHelperCommon, 'RoomDatabaseJdbcImplHelperCommon', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 2, 1]);
  setMetadataFor(RoomJdbcImpl, 'RoomJdbcImpl', interfaceMeta);
  setMetadataFor($dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9, '$dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9', classMeta, CoroutineImpl);
  setMetadataFor($getSqliteDoorTriggerNamesCOROUTINE$10, '$getSqliteDoorTriggerNamesCOROUTINE$10', classMeta, CoroutineImpl);
  setMetadataFor($getSqliteDoorReceiveViewNamesCOROUTINE$11, '$getSqliteDoorReceiveViewNamesCOROUTINE$11', classMeta, CoroutineImpl);
  setMetadataFor(DoorConstants, 'DoorConstants', objectMeta);
  setMetadataFor(DoorDatabaseCallbackStatementList, 'DoorDatabaseCallbackStatementList', interfaceMeta);
  setMetadataFor(DoorDatabaseCallbackSync, 'DoorDatabaseCallbackSync', interfaceMeta);
  setMetadataFor(DoorDatabaseJdbc, 'DoorDatabaseJdbc', interfaceMeta);
  setMetadataFor(DoorDatabaseRepository, 'DoorDatabaseRepository', interfaceMeta);
  setMetadataFor(DoorDatabaseWrapper, 'DoorDatabaseWrapper', interfaceMeta);
  setMetadataFor(Companion_1, 'Companion', objectMeta);
  setMetadataFor($nextIdAsyncCOROUTINE$12, '$nextIdAsyncCOROUTINE$12', classMeta, CoroutineImpl);
  setMetadataFor(TablePrimaryKeyManager, 'TablePrimaryKeyManager', classMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(Companion_2, 'Companion', objectMeta);
  setMetadataFor(DoorPrimaryKeyManager, 'DoorPrimaryKeyManager', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(Array_0, 'Array', interfaceMeta);
  setMetadataFor(JdbcArrayProxyCommon, 'JdbcArrayProxyCommon', classMeta, VOID, [Array_0]);
  setMetadataFor(NotSupportedException, 'NotSupportedException', classMeta, RuntimeException, VOID, NotSupportedException);
  setMetadataFor(Companion_3, 'Companion', objectMeta);
  setMetadataFor(PreparedStatementConfig, 'PreparedStatementConfig', classMeta);
  setMetadataFor(RepositoryHelper, 'RepositoryHelper', classMeta);
  setMetadataFor(Companion_4, 'Companion', objectMeta);
  setMetadataFor($serializer, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
  setMetadataFor(SyncNode, 'SyncNode', classMeta, VOID, VOID, SyncNode, VOID, {0: $serializer_getInstance});
  setMetadataFor(SyncNodeIdCallback, 'SyncNodeIdCallback', classMeta, VOID, [DoorDatabaseCallbackStatementList]);
  setMetadataFor(RemoteInsertStrategy, 'RemoteInsertStrategy', classMeta, Enum);
  setMetadataFor(Event, 'Event', classMeta, Enum);
  setMetadataFor(Order, 'Order', classMeta, Enum);
  setMetadataFor(On, 'On', classMeta, Enum);
  setMetadataFor(Companion_5, 'Companion', objectMeta);
  setMetadataFor(Trigger, 'Trigger', classMeta);
  setMetadataFor(NodeIdAndAuth, 'NodeIdAndAuth', classMeta);
  setMetadataFor(OutgoingReplication, 'OutgoingReplication', classMeta, VOID, VOID, OutgoingReplication);
  setMetadataFor(Companion_6, 'Companion', objectMeta);
  setMetadataFor(DoorDatabaseMetadata, 'DoorDatabaseMetadata', classMeta);
  setMetadataFor(Companion_7, 'Companion', objectMeta);
  setMetadataFor(Companion_8, 'Companion', objectMeta);
  setMetadataFor(LoadParamType, 'LoadParamType', classMeta, Enum);
  setMetadataFor(Status, 'Status', classMeta, Enum);
  setMetadataFor(FlowLoadingState, 'FlowLoadingState', classMeta, VOID, VOID, FlowLoadingState);
  setMetadataFor(RepoDaoFlowHelper$asRepoFlow$slambda$slambda, 'RepoDaoFlowHelper$asRepoFlow$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RepoDaoFlowHelper$asRepoFlow$slambda, 'RepoDaoFlowHelper$asRepoFlow$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RepoDaoFlowHelper, 'RepoDaoFlowHelper', classMeta);
  setMetadataFor(ConnectionAsync, 'ConnectionAsync', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1, 0]);
  setMetadataFor(StatementConstantsKmp, 'StatementConstantsKmp', objectMeta);
  setMetadataFor(TypesKmp, 'TypesKmp', objectMeta);
  setMetadataFor(DoorLogLevel, 'DoorLogLevel', classMeta, Enum);
  setMetadataFor(NapierDoorLogger, 'NapierDoorLogger', classMeta, VOID, VOID, NapierDoorLogger);
  setMetadataFor(DefaultDoorMessageCallback, 'DefaultDoorMessageCallback', classMeta, VOID, VOID, DefaultDoorMessageCallback, VOID, VOID, [2]);
  setMetadataFor(Companion_9, 'Companion', objectMeta);
  setMetadataFor($serializer_0, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
  setMetadataFor(DoorMessage, 'DoorMessage', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_0});
  setMetadataFor(DoorMigration, 'DoorMigration', classMeta);
  setMetadataFor(DoorMigrationAsync, 'DoorMigrationAsync', classMeta, DoorMigration);
  setMetadataFor(DoorMigrationStatementList, 'DoorMigrationStatementList', classMeta, DoorMigration);
  setMetadataFor(DoorMigrationSync, 'DoorMigrationSync', classMeta, DoorMigration);
  setMetadataFor(NodeEvent, 'NodeEvent', classMeta);
  setMetadataFor($createNodeEventTableAndTriggerCOROUTINE$14, '$createNodeEventTableAndTriggerCOROUTINE$14', classMeta, CoroutineImpl);
  setMetadataFor(NodeEventConstants, 'NodeEventConstants', objectMeta);
  setMetadataFor(NodeEventManagerCommon$onIncomingMessageReceived$slambda, 'NodeEventManagerCommon$onIncomingMessageReceived$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($onIncomingMessageReceivedCOROUTINE$15, '$onIncomingMessageReceivedCOROUTINE$15', classMeta, CoroutineImpl);
  setMetadataFor(NodeEventManagerCommon, 'NodeEventManagerCommon', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(NodeEventSseClient$onMessage$slambda, 'NodeEventSseClient$onMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(NodeEventSseClient, 'NodeEventSseClient', classMeta);
  setMetadataFor(DelegatedInvalidationPagingSource, 'DelegatedInvalidationPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(OffsetLimitRange, 'OffsetLimitRange', classMeta);
  setMetadataFor(OffsetLimitMediatorState, 'OffsetLimitMediatorState', classMeta, VOID, VOID, OffsetLimitMediatorState);
  setMetadataFor(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', classMeta, VOID, [Comparator]);
  setMetadataFor(DoorOffsetLimitRemoteMediator$onLoad$slambda, 'DoorOffsetLimitRemoteMediator$onLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorOffsetLimitRemoteMediator, 'DoorOffsetLimitRemoteMediator', classMeta);
  setMetadataFor($queryDatabaseCOROUTINE$16, '$queryDatabaseCOROUTINE$16', classMeta, CoroutineImpl);
  setMetadataFor(DoorRepositoryPagingSource, 'DoorRepositoryPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(Companion_10, 'Companion', objectMeta);
  setMetadataFor(PagingSourceWithHttpLoader, 'PagingSourceWithHttpLoader', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicatePullPagingSource, 'DoorRepositoryReplicatePullPagingSource', classMeta, DoorRepositoryPagingSource, [DoorRepositoryPagingSource, PagingSourceWithHttpLoader], VOID, VOID, VOID, [1]);
  setMetadataFor(FilterPagingSource, 'FilterPagingSource', classMeta, DelegatedInvalidationPagingSource, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(PagingSourceInterceptor, 'PagingSourceInterceptor', classMeta, FilterPagingSource, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(PagingSourceLoadState, 'PagingSourceLoadState', classMeta, VOID, VOID, PagingSourceLoadState);
  setMetadataFor(ReplicateEntityPrimaryKeys, 'ReplicateEntityPrimaryKeys', classMeta);
  setMetadataFor(acknowledgeReceivedReplications$slambda, 'acknowledgeReceivedReplications$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(selectPendingOutgoingReplicationsByDestNodeId$slambda, 'selectPendingOutgoingReplicationsByDestNodeId$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(insertEntitiesFromMessage$slambda, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(insertEntitiesFromMessage$slambda_1, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(insertEntitiesFromMessage$slambda_3, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda, 'selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_1, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_3, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_5, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(withRepoChangeMonitorAsync$slambda, 'withRepoChangeMonitorAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17, '$selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17', classMeta, CoroutineImpl);
  setMetadataFor($insertEntitiesFromMessageCOROUTINE$18, '$insertEntitiesFromMessageCOROUTINE$18', classMeta, CoroutineImpl);
  setMetadataFor($onClientRepoDoorMessageHttpResponseCOROUTINE$20, '$onClientRepoDoorMessageHttpResponseCOROUTINE$20', classMeta, CoroutineImpl);
  setMetadataFor(Companion_11, 'Companion', objectMeta);
  setMetadataFor($serializer_1, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
  setMetadataFor(DoorReplicationEntity, 'DoorReplicationEntity', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_1});
  setMetadataFor(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($invokeCOROUTINE$21, '$invokeCOROUTINE$21', classMeta, CoroutineImpl);
  setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($invokeCOROUTINE$22, '$invokeCOROUTINE$22', classMeta, CoroutineImpl);
  setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(ClientState, 'ClientState', classMeta, VOID, VOID, ClientState);
  setMetadataFor(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications, 'DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications', classMeta, VOID, VOID, VOID, VOID, VOID, [3]);
  setMetadataFor(DefaultOnStartPendingSession, 'DefaultOnStartPendingSession', classMeta, VOID, VOID, VOID, VOID, VOID, [2]);
  setMetadataFor(DefaultOnPendingSessionResolved, 'DefaultOnPendingSessionResolved', classMeta, VOID, VOID, VOID, VOID, VOID, [2]);
  setMetadataFor(Companion_12, 'Companion', objectMeta);
  setMetadataFor(sam$kotlinx_coroutines_flow_FlowCollector$0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', classMeta, VOID, [FlowCollector], VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda_1, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda_3, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorRepositoryReplicationClient$slambda_5, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($runSendLoopCOROUTINE$23, '$runSendLoopCOROUTINE$23', classMeta, CoroutineImpl);
  setMetadataFor($runFetchLoopCOROUTINE$24, '$runFetchLoopCOROUTINE$24', classMeta, CoroutineImpl);
  setMetadataFor(DoorRepositoryReplicationClient, 'DoorRepositoryReplicationClient', classMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(ReplicationConstants, 'ReplicationConstants', objectMeta);
  setMetadataFor(ReplicationEntityMetaData, 'ReplicationEntityMetaData', classMeta);
  setMetadataFor(ReplicationFieldMetaData, 'ReplicationFieldMetaData', classMeta);
  setMetadataFor(Companion_13, 'Companion', objectMeta);
  setMetadataFor($serializer_2, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
  setMetadataFor(ReplicationReceivedAck, 'ReplicationReceivedAck', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_2});
  setMetadataFor(Companion_14, 'Companion', objectMeta);
  setMetadataFor(Companion_15, 'Companion', objectMeta);
  setMetadataFor(DoorServerSentEvent, 'DoorServerSentEvent', classMeta);
  setMetadataFor(TriggerConstants, 'TriggerConstants', objectMeta);
  setMetadataFor(DoorEventCollator$receiveEvent$slambda$slambda, 'DoorEventCollator$receiveEvent$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorEventCollator$receiveEvent$slambda, 'DoorEventCollator$receiveEvent$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(DoorEventCollator, 'DoorEventCollator', classMeta);
  setMetadataFor(NodeIdAuthCache, 'NodeIdAuthCache', classMeta, VOID, VOID, VOID, VOID, VOID, [2]);
  setMetadataFor(TransactionMode, 'TransactionMode', classMeta, Enum);
  setMetadataFor(Companion_16, 'Companion', objectMeta);
  setMetadataFor($buildCOROUTINE$28, '$buildCOROUTINE$28', classMeta, CoroutineImpl);
  setMetadataFor($build$execSqlAsyncCOROUTINE$29, '$build$execSqlAsyncCOROUTINE$29', classMeta, CoroutineImpl);
  setMetadataFor(DatabaseBuilder, 'DatabaseBuilder', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]);
  setMetadataFor(DatabaseBuilderOptions, 'DatabaseBuilderOptions', classMeta);
  setMetadataFor(Companion_17, 'Companion', objectMeta);
  setMetadataFor(DoorUri, 'DoorUri', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(JdbcArrayProxy, 'JdbcArrayProxy', classMeta, JdbcArrayProxyCommon);
  setMetadataFor(PreparedStatementArrayProxy, 'PreparedStatementArrayProxy', classMeta, PreparedStatementArrayProxyCommon, VOID, VOID, VOID, VOID, [0, 1]);
  setMetadataFor(Builder, 'Builder', classMeta);
  setMetadataFor(Companion_18, 'Companion', objectMeta);
  setMetadataFor(RepositoryConfig, 'RepositoryConfig', classMeta);
  setMetadataFor(SaveToIndexedDbChangeListener$eventCollator$slambda, 'SaveToIndexedDbChangeListener$eventCollator$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(SaveToIndexedDbChangeListener$1, VOID, classMeta, InvalidationTrackerObserver);
  setMetadataFor(SaveToIndexedDbChangeListener, 'SaveToIndexedDbChangeListener', classMeta);
  setMetadataFor(withDoorTransactionAsync$slambda, 'withDoorTransactionAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(Connection, 'Connection', interfaceMeta);
  setMetadataFor(ResultSet, 'ResultSet', interfaceMeta);
  setMetadataFor(SQLException, 'SQLException', classMeta, Exception);
  setMetadataFor(NodeEventManagerJs, 'NodeEventManagerJs', classMeta, NodeEventManagerCommon, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RoomDatabase, 'RoomDatabase', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]);
  setMetadataFor(RoomDatabaseJdbcImplHelper, 'RoomDatabaseJdbcImplHelper', classMeta, RoomDatabaseJdbcImplHelperCommon, VOID, VOID, VOID, VOID, [0, 2, 1]);
  setMetadataFor(IndexedDb, 'IndexedDb', objectMeta, VOID, VOID, VOID, VOID, VOID, [1, 4, 3]);
  setMetadataFor(Companion_19, 'Companion', objectMeta);
  setMetadataFor($setAutoCommitAsyncCOROUTINE$32, '$setAutoCommitAsyncCOROUTINE$32', classMeta, CoroutineImpl);
  setMetadataFor($commitAsyncCOROUTINE$33, '$commitAsyncCOROUTINE$33', classMeta, CoroutineImpl);
  setMetadataFor($rollbackAsyncCOROUTINE$34, '$rollbackAsyncCOROUTINE$34', classMeta, CoroutineImpl);
  setMetadataFor(SQLiteConnectionJs, 'SQLiteConnectionJs', classMeta, VOID, [Connection, ConnectionAsync], VOID, VOID, VOID, [1, 0]);
  setMetadataFor(SQLiteDatabaseMetadataJs, 'SQLiteDatabaseMetadataJs', classMeta, VOID, VOID, VOID, VOID, VOID, [4]);
  setMetadataFor(Companion_20, 'Companion', objectMeta);
  setMetadataFor(SQLiteDatasourceJs$sendQuery$slambda, 'SQLiteDatasourceJs$sendQuery$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(SQLiteDatasourceJs$sendUpdate$slambda, 'SQLiteDatasourceJs$sendUpdate$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda, 'SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($sendMessageCOROUTINE$36, '$sendMessageCOROUTINE$36', classMeta, CoroutineImpl);
  setMetadataFor($withTransactionLockCOROUTINE$37, '$withTransactionLockCOROUTINE$37', classMeta, CoroutineImpl);
  setMetadataFor($exportDatabaseToFileCOROUTINE$38, '$exportDatabaseToFileCOROUTINE$38', classMeta, CoroutineImpl);
  setMetadataFor($saveDatabaseToIndexedDbCOROUTINE$39, '$saveDatabaseToIndexedDbCOROUTINE$39', classMeta, CoroutineImpl);
  setMetadataFor(SQLiteDatasourceJs, 'SQLiteDatasourceJs', classMeta, VOID, VOID, VOID, VOID, VOID, [1, 2, 3, 4, 0]);
  setMetadataFor($executeUpdateAsyncCOROUTINE$40, '$executeUpdateAsyncCOROUTINE$40', classMeta, CoroutineImpl);
  setMetadataFor(SQLiteStatementJs, 'SQLiteStatementJs', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(SQLitePreparedStatementJs, 'SQLitePreparedStatementJs', classMeta, SQLiteStatementJs, [SQLiteStatementJs, PreparedStatement], VOID, VOID, VOID, [0, 1]);
  setMetadataFor(SQLiteResultSet, 'SQLiteResultSet', classMeta, VOID, [ResultSet]);
  setMetadataFor($executeUpdateAsyncJsCOROUTINE$41, '$executeUpdateAsyncJsCOROUTINE$41', classMeta, CoroutineImpl);
  setMetadataFor(UpdateResult, 'UpdateResult', classMeta);
  setMetadataFor(WorkerResult, 'WorkerResult', classMeta);
  setMetadataFor(DoorEventSource, 'DoorEventSource', classMeta);
  setMetadataFor(DoorJsImplClasses, 'DoorJsImplClasses', classMeta);
  setMetadataFor(KmpUuid, 'KmpUuid', classMeta);
  setMetadataFor(WeakMapJs, 'WeakMapJs', classMeta, VOID, VOID, WeakMapJs);
  setMetadataFor(WeakRefJs, 'WeakRefJs', classMeta);
  //endregion
  function DoorSqlDatabaseConnectionImpl(connection, dbTypeInt) {
    this.w5e_1 = connection;
    this.x5e_1 = dbTypeInt;
  }
  function getGeneratedKey($this, stmt) {
    var generatedKeyRs = (null == null ? true : isInterface(null, ResultSet)) ? null : THROW_CCE();
    var generatedKey = new Long(0, 0);
    try {
      generatedKeyRs = stmt.y5e();
      if (generatedKeyRs.e())
        generatedKey = generatedKeyRs.z5e(1);
    }finally {
      var tmp0_safe_receiver = generatedKeyRs;
      if (tmp0_safe_receiver == null)
        null;
      else {
        tmp0_safe_receiver.n();
      }
    }
    return generatedKey;
  }
  function EntityInsertionAdapter$insertAsync$slambda(this$0, $entity, resultContinuation) {
    this.i5f_1 = this$0;
    this.j5f_1 = $entity;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(EntityInsertionAdapter$insertAsync$slambda).l5f = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(EntityInsertionAdapter$insertAsync$slambda).he = function (p1, $completion) {
    return this.l5f((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(EntityInsertionAdapter$insertAsync$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.i5f_1.p5f(this.k5f_1, this.j5f_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.k5f_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(EntityInsertionAdapter$insertAsync$slambda).m5f = function (stmt, completion) {
    var i = new EntityInsertionAdapter$insertAsync$slambda(this.i5f_1, this.j5f_1, completion);
    i.k5f_1 = stmt;
    return i;
  };
  function EntityInsertionAdapter$insertAsync$slambda_0(this$0, $entity, resultContinuation) {
    var i = new EntityInsertionAdapter$insertAsync$slambda(this$0, $entity, resultContinuation);
    var l = function (stmt, $completion) {
      return i.l5f(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this$0, $entity, resultContinuation) {
    this.y5f_1 = this$0;
    this.z5f_1 = $entity;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).b5g = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).he = function (p1, $completion) {
    return this.b5g((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$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.y5f_1.p5f(this.a5g_1, this.z5f_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.a5g_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return getGeneratedKey(this.y5f_1, this.a5g_1);
          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(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).m5f = function (stmt, completion) {
    var i = new EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this.y5f_1, this.z5f_1, completion);
    i.a5g_1 = stmt;
    return i;
  };
  function EntityInsertionAdapter$insertAndReturnIdAsync$slambda_0(this$0, $entity, resultContinuation) {
    var i = new EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this$0, $entity, resultContinuation);
    var l = function (stmt, $completion) {
      return i.b5g(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function EntityInsertionAdapter$insertListAsync$slambda($entities, this$0, resultContinuation) {
    this.k5g_1 = $entities;
    this.l5g_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(EntityInsertionAdapter$insertListAsync$slambda).l5f = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(EntityInsertionAdapter$insertListAsync$slambda).he = function (p1, $completion) {
    return this.l5f((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(EntityInsertionAdapter$insertListAsync$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            this.m5g_1.r5g().s5g(false);
            var tmp_0 = this;
            tmp_0.n5g_1 = this.k5g_1;
            this.o5g_1 = this.n5g_1.w();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!this.o5g_1.f()) {
              this.hd_1 = 3;
              continue $sm;
            }

            this.p5g_1 = this.o5g_1.e();
            var tmp_1 = this;
            tmp_1.q5g_1 = this.p5g_1;
            this.l5g_1.p5f(this.m5g_1, this.q5g_1);
            this.hd_1 = 2;
            suspendResult = executeUpdateAsyncKmp(this.m5g_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 1;
            continue $sm;
          case 3:
            this.m5g_1.r5g().t5g();
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(EntityInsertionAdapter$insertListAsync$slambda).m5f = function (stmt, completion) {
    var i = new EntityInsertionAdapter$insertListAsync$slambda(this.k5g_1, this.l5g_1, completion);
    i.m5g_1 = stmt;
    return i;
  };
  function EntityInsertionAdapter$insertListAsync$slambda_0($entities, this$0, resultContinuation) {
    var i = new EntityInsertionAdapter$insertListAsync$slambda($entities, this$0, resultContinuation);
    var l = function (stmt, $completion) {
      return i.l5f(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function EntityInsertionAdapter(db) {
    this.n5f_1 = db;
    this.o5f_1 = dbType_1(this.n5f_1);
  }
  protoOf(EntityInsertionAdapter).v5g = function (entity, $completion) {
    var tmp = this.u5g(false);
    return prepareAndUseStatementAsync_0(this.n5f_1, tmp, VOID, EntityInsertionAdapter$insertAsync$slambda_0(this, entity, null), $completion);
  };
  protoOf(EntityInsertionAdapter).w5g = function (entity, $completion) {
    var stmtConfig = new PreparedStatementConfig(this.u5g(true), VOID, StatementConstantsKmp_instance.x5g_1);
    return prepareAndUseStatementAsync(this.n5f_1, stmtConfig, EntityInsertionAdapter$insertAndReturnIdAsync$slambda_0(this, entity, null), $completion);
  };
  protoOf(EntityInsertionAdapter).z5g = function (entities, $completion) {
    var tmp = this.u5g(false);
    return prepareAndUseStatementAsync_0(this.n5f_1, tmp, VOID, EntityInsertionAdapter$insertListAsync$slambda_0(entities, this, null), $completion);
  };
  function getNthIndexOf(_this__u8e3s4, $this, char, n) {
    var foundCount = 0;
    var pos = 0;
    $l$loop: while (true) {
      var tmp;
      var tmp0 = foundCount;
      foundCount = tmp0 + 1 | 0;
      if (tmp0 < n) {
        tmp = !(pos === -1);
      } else {
        tmp = false;
      }
      if (!tmp) {
        break $l$loop;
      }
      pos = indexOf(_this__u8e3s4, char, pos + 1 | 0);
    }
    return pos;
  }
  function makeArrayPlaceholders($this, numPlaceholders) {
    // Inline function 'kotlin.math.max' call
    var b = imul(2, numPlaceholders) - 1 | 0;
    var tmp$ret$0 = Math.max(0, b);
    var sb = StringBuilder_init_$Create$(tmp$ret$0);
    var inductionVariable = 0;
    if (inductionVariable < numPlaceholders)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        if (!(i === 0)) {
          sb.z5(_Char___init__impl__6a9atx(44));
        }
        sb.z5(_Char___init__impl__6a9atx(63));
      }
       while (inductionVariable < numPlaceholders);
    return sb.toString();
  }
  function Companion() {
    this.a5h_1 = -5000;
    this.b5h_1 = -5001;
  }
  var Companion_instance;
  function Companion_getInstance_1() {
    return Companion_instance;
  }
  function PreparedStatementArrayProxyCommon(query, connectionInternal) {
    this.c5h_1 = query;
    this.d5h_1 = connectionInternal;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.e5h_1 = LinkedHashMap_init_$Create$();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.f5h_1 = LinkedHashMap_init_$Create$();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.g5h_1 = LinkedHashMap_init_$Create$();
    this.h5h_1 = -1;
  }
  protoOf(PreparedStatementArrayProxyCommon).i5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.k5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).t5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.q5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).u5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.j5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).v5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.m5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).w5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.n5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).x5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.p5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).y5h = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value_0 = TypesKmp_instance.l5h_1;
    this_0.s(index, value_0);
  };
  protoOf(PreparedStatementArrayProxyCommon).z5h = function (index, array) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, array);
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.f5h_1;
    var value = TypesKmp_instance.s5h_1;
    this_0.s(index, value);
  };
  protoOf(PreparedStatementArrayProxyCommon).a5i = function (index, value) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(index, value);
    // Inline function 'kotlin.collections.set' call
    this.f5h_1.s(index, -5000);
  };
  protoOf(PreparedStatementArrayProxyCommon).b5i = function (parameterIndex, sqlType) {
    // Inline function 'kotlin.collections.set' call
    this.e5h_1.s(parameterIndex, null);
    // Inline function 'kotlin.collections.set' call
    this.f5h_1.s(parameterIndex, -5001);
    // Inline function 'kotlin.collections.set' call
    this.g5h_1.s(parameterIndex, sqlType);
  };
  protoOf(PreparedStatementArrayProxyCommon).c5i = function (seconds) {
    this.h5h_1 = seconds;
  };
  protoOf(PreparedStatementArrayProxyCommon).d5i = function () {
    var arrayOffset = 0;
    // Inline function 'kotlin.collections.mutableMapOf' call
    var paramValues = LinkedHashMap_init_$Create$();
    // Inline function 'kotlin.collections.mutableMapOf' call
    var paramTypes = LinkedHashMap_init_$Create$();
    var adjustedQuery = this.c5h_1;
    var tmp0_iterator = this.e5h_1.o2().w();
    while (tmp0_iterator.f()) {
      var paramIndex = tmp0_iterator.e();
      var value = this.e5h_1.q(paramIndex);
      if (!(value == null) ? isInterface(value, Array_0) : false) {
        var arrayProxy = value instanceof JdbcArrayProxy ? value : THROW_CCE();
        var objects = arrayProxy.f5i_1;
        var arrayParamPos = getNthIndexOf(adjustedQuery, this, _Char___init__impl__6a9atx(63), paramIndex + arrayOffset | 0);
        // Inline function 'kotlin.text.substring' call
        // Inline function 'kotlin.js.asDynamic' call
        var tmp = adjustedQuery.substring(0, arrayParamPos) + makeArrayPlaceholders(this, objects.length);
        // Inline function 'kotlin.text.substring' call
        var this_0 = adjustedQuery;
        var startIndex = arrayParamPos + 1 | 0;
        // Inline function 'kotlin.js.asDynamic' call
        adjustedQuery = tmp + this_0.substring(startIndex);
        var inductionVariable = 0;
        var last = objects.length - 1 | 0;
        if (inductionVariable <= last)
          do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var paramPos = (paramIndex + arrayOffset | 0) + i | 0;
            // Inline function 'kotlin.collections.set' call
            var value_0 = objects[i];
            paramValues.s(paramPos, value_0);
            // Inline function 'kotlin.collections.set' call
            var value_1 = arrayProxy.h5i();
            paramTypes.s(paramPos, value_1);
          }
           while (inductionVariable <= last);
        arrayOffset = arrayOffset + (objects.length - 1 | 0) | 0;
      } else {
        // Inline function 'kotlin.collections.set' call
        var key = paramIndex + arrayOffset | 0;
        paramValues.s(key, value);
        // Inline function 'kotlin.collections.set' call
        var key_0 = paramIndex + arrayOffset | 0;
        var tmp2_elvis_lhs = this.f5h_1.q(paramIndex);
        var tmp_0;
        if (tmp2_elvis_lhs == null) {
          throw IllegalStateException_init_$Create$('PreparedStatementArrayProxy: Cannot find query param type at index ' + paramIndex);
        } else {
          tmp_0 = tmp2_elvis_lhs;
        }
        var value_2 = tmp_0;
        paramTypes.s(key_0, value_2);
      }
    }
    var stmt = null;
    try {
      stmt = this.d5h_1.i5i(adjustedQuery);
      // Inline function 'kotlin.takeIf' call
      var this_1 = stmt;
      // Inline function 'kotlin.contracts.contract' call
      var tmp_1;
      // Inline function 'com.ustadmobile.door.PreparedStatementArrayProxyCommon.prepareStatement.<anonymous>' call
      if (this.h5h_1 > 0) {
        tmp_1 = this_1;
      } else {
        tmp_1 = null;
      }
      var tmp3_safe_receiver = tmp_1;
      if (tmp3_safe_receiver == null)
        null;
      else {
        tmp3_safe_receiver.c5i(this.h5h_1);
      }
      var tmp4_iterator = paramValues.o2().w();
      while (tmp4_iterator.f()) {
        var paramIndex_0 = tmp4_iterator.e();
        var value_3 = paramValues.q(paramIndex_0);
        var tmp5_elvis_lhs = paramTypes.q(paramIndex_0);
        var paramType = tmp5_elvis_lhs == null ? 0 : tmp5_elvis_lhs;
        if (paramType === -5001) {
          var tmp_2 = stmt;
          var tmp7_elvis_lhs = this.g5h_1.q(paramIndex_0);
          tmp_2.b5i(paramIndex_0, tmp7_elvis_lhs == null ? 0 : tmp7_elvis_lhs);
        } else if (paramType === TypesKmp_instance.j5h_1) {
          var tmp_3 = stmt;
          tmp_3.u5h(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE());
        } else if (paramType === TypesKmp_instance.k5h_1) {
          var tmp_4 = stmt;
          tmp_4.i5h(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'boolean' : false) ? value_3 : THROW_CCE());
        } else if (paramType === TypesKmp_instance.l5h_1 ? true : paramType === TypesKmp_instance.r5h_1) {
          var tmp_5 = stmt;
          tmp_5.y5h(paramIndex_0, (value_3 == null ? true : typeof value_3 === 'string') ? value_3 : THROW_CCE());
        } else if (paramType === TypesKmp_instance.m5h_1) {
          var tmp_6 = stmt;
          tmp_6.v5h(paramIndex_0, value_3 instanceof Long ? value_3 : THROW_CCE());
        } else if (paramType === TypesKmp_instance.n5h_1) {
          var tmp_7 = stmt;
          tmp_7.w5h(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE());
        } else if (paramType === -5000) {
          stmt.a5i(paramIndex_0, value_3);
        }
      }
    } catch ($p) {
      if ($p instanceof SQLException) {
        var e = $p;
        var tmp8_safe_receiver = stmt;
        if (tmp8_safe_receiver == null)
          null;
        else {
          tmp8_safe_receiver.n();
        }
        throw e;
      } else {
        throw $p;
      }
    }
    return stmt;
  };
  function createArrayOrProxyArrayOf(_this__u8e3s4, arrayType, objects) {
    var tmp;
    var tmp_0 = dbType(_this__u8e3s4);
    Companion_getInstance_3();
    if (tmp_0 === 2) {
      tmp = _this__u8e3s4.m5i(arrayType, objects);
    } else {
      tmp = new JdbcArrayProxy(arrayType, objects);
    }
    return tmp;
  }
  function dbType(_this__u8e3s4) {
    return Companion_getInstance_3().u5i(_this__u8e3s4.n5i().o5i());
  }
  function get_doorPrimaryKeyManager(_this__u8e3s4) {
    var tmp = get_rootDatabase(_this__u8e3s4);
    return (isInterface(tmp, DoorDatabaseJdbc) ? tmp : THROW_CCE()).v5i();
  }
  function get_sourceDatabase(_this__u8e3s4) {
    var tmp;
    if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) {
      tmp = null;
    } else {
      if (isInterface(_this__u8e3s4, DoorDatabaseRepository)) {
        tmp = _this__u8e3s4.x5i();
      } else {
        if (isInterface(_this__u8e3s4, DoorDatabaseWrapper)) {
          tmp = _this__u8e3s4.w5i();
        } else {
          throw IllegalStateException_init_$Create$('SourceDatabase : Not a recognized implementation: ' + getKClassFromExpression(_this__u8e3s4));
        }
      }
    }
    return tmp;
  }
  function prepareAndUseStatementAsync(_this__u8e3s4, stmtConfig, block, $completion) {
    var tmp = new $prepareAndUseStatementAsyncCOROUTINE$1(_this__u8e3s4, stmtConfig, block, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function get_nodeIdAuthCache(_this__u8e3s4) {
    var tmp;
    if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) {
      tmp = _this__u8e3s4.l5j();
    } else {
      tmp = get_nodeIdAuthCache(get_rootDatabase(_this__u8e3s4));
    }
    return tmp;
  }
  function prepareAndUseStatementAsync$slambda$lambda($jdbcImpl, $stmtConfig) {
    return function () {
      return '[prepareAndUseStatementAsync - ' + $jdbcImpl.a5k().o5j_1 + '] - prepare "' + $stmtConfig.b5k_1 + '"';
    };
  }
  function prepareAndUseStatementAsync$slambda($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation) {
    this.p5k_1 = $logger;
    this.q5k_1 = $this_prepareAndUseStatementAsync;
    this.r5k_1 = $stmtConfig;
    this.s5k_1 = $block;
    this.t5k_1 = $jdbcImpl;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(prepareAndUseStatementAsync$slambda).a5l = function (connection, $completion) {
    var tmp = this.b5l(connection, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(prepareAndUseStatementAsync$slambda).he = function (p1, $completion) {
    return this.a5l((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(prepareAndUseStatementAsync$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 12;
            v(this.p5k_1, VOID, prepareAndUseStatementAsync$slambda$lambda(this.t5k_1, this.r5k_1));
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.w5k_1 = prepareStatement(this.u5k_1, this.q5k_1, this.r5k_1);
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.hd_1 = 4;
            continue $sm;
          case 4:
            this.id_1 = 9;
            this.id_1 = 8;
            var tmp_1 = this;
            tmp_1.y5k_1 = this.w5k_1;
            var tmp_2 = get_rootDatabase(this.q5k_1);
            this.y5k_1.c5i((isInterface(tmp_2, DoorDatabaseJdbc) ? tmp_2 : THROW_CCE()).c5l());
            this.z5k_1 = systemTimeInMillis();
            this.hd_1 = 5;
            suspendResult = this.s5k_1(this.y5k_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 5:
            var this_0 = suspendResult;
            var blockTime = systemTimeInMillis().mc(this.z5k_1);
            if (blockTime.c7(new Long(1000, 0)) > 0) {
              w_0(this.p5k_1, '[prepareAndUseStatementAsync - ' + this.t5k_1.a5k().o5j_1 + '] query ' + this.r5k_1.b5k_1 + ' took ' + blockTime.toString() + 'ms');
            }

            this.x5k_1 = this_0;
            this.id_1 = 12;
            this.hd_1 = 6;
            var tmp_3 = this;
            continue $sm;
          case 6:
            var tmp_4 = this.x5k_1;
            this.id_1 = 12;
            this.w5k_1.n();
            return tmp_4;
          case 7:
            this.id_1 = 12;
            var tmp_5 = this;
            this.w5k_1.n();
            tmp_5.v5k_1 = Unit_instance;
            this.hd_1 = 11;
            continue $sm;
          case 8:
            this.id_1 = 9;
            var tmp_6 = this.kd_1;
            if (tmp_6 instanceof Exception) {
              var e = this.kd_1;
              var tmp_7 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 9:
            this.id_1 = 12;
            var t = this.kd_1;
            this.w5k_1.n();
            throw t;
          case 10:
            this.id_1 = 12;
            this.w5k_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 11;
            continue $sm;
          case 11:
            return this.v5k_1;
          case 12:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 12) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  protoOf(prepareAndUseStatementAsync$slambda).b5l = function (connection, completion) {
    var i = new prepareAndUseStatementAsync$slambda(this.p5k_1, this.q5k_1, this.r5k_1, this.s5k_1, this.t5k_1, completion);
    i.u5k_1 = connection;
    return i;
  };
  function prepareAndUseStatementAsync$slambda_0($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation) {
    var i = new prepareAndUseStatementAsync$slambda($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation);
    var l = function (connection, $completion) {
      return i.a5l(connection, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $prepareAndUseStatementAsyncCOROUTINE$1(_this__u8e3s4, stmtConfig, block, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.g5j_1 = _this__u8e3s4;
    this.h5j_1 = stmtConfig;
    this.i5j_1 = block;
  }
  protoOf($prepareAndUseStatementAsyncCOROUTINE$1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            var tmp_0 = this;
            var tmp_1 = get_rootDatabase(this.g5j_1);
            tmp_0.j5j_1 = isInterface(tmp_1, RoomJdbcImpl) ? tmp_1 : THROW_CCE();
            this.k5j_1 = this.j5j_1.a5k().p5j_1;
            this.id_1 = 2;
            this.hd_1 = 1;
            var tmp_2 = this.j5j_1.a5k();
            suspendResult = tmp_2.d5l(this.h5j_1.g5k_1, prepareAndUseStatementAsync$slambda_0(this.k5j_1, this.g5j_1, this.h5j_1, this.i5j_1, this.j5j_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            this.id_1 = 3;
            var tmp_3 = this.kd_1;
            if (tmp_3 instanceof Exception) {
              var e_0 = this.kd_1;
              if (!(e_0 instanceof CancellationException)) {
                e(this.k5j_1, '[prepareAndUseStatementAsync - ' + this.j5j_1.a5k().o5j_1 + '] - Exception running ' + this.h5j_1.b5k_1, e_0);
              }
              throw e_0;
            } else {
              throw this.kd_1;
            }

          case 3:
            throw this.kd_1;
          case 4:
            this.id_1 = 3;
            return Unit_instance;
        }
      } catch ($p) {
        var e_1 = $p;
        if (this.id_1 === 3) {
          throw e_1;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_1;
        }
      }
     while (true);
  };
  function doorFlow(_this__u8e3s4, tables, block) {
    return callbackFlow(doorFlow$slambda_0(_this__u8e3s4, tables, block, null));
  }
  function doorFlow$1$invalidationTrackerObserver$1($tables, $invalidationEventChannel) {
    this.f5l_1 = $invalidationEventChannel;
    InvalidationTrackerObserver.call(this, $tables);
  }
  protoOf(doorFlow$1$invalidationTrackerObserver$1).g5l = function (tables) {
    this.f5l_1.w19(true);
  };
  function doorFlow$slambda$slambda($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation) {
    this.p5l_1 = $this_callbackFlow;
    this.q5l_1 = $block;
    this.r5l_1 = $invalidationEventChannel;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(doorFlow$slambda$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(doorFlow$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(doorFlow$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 6;
            this.hd_1 = 1;
            suspendResult = this.q5l_1(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.t5l_1 = suspendResult;
            this.p5l_1.w19(this.t5l_1);
            this.u5l_1 = this.r5l_1.w();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            suspendResult = this.u5l_1.t16(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            if (!suspendResult) {
              this.hd_1 = 5;
              continue $sm;
            }

            this.v5l_1 = this.u5l_1.e();
            this.hd_1 = 4;
            suspendResult = this.q5l_1(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var ARGUMENT = suspendResult;
            this.p5l_1.w19(ARGUMENT);
            this.hd_1 = 2;
            continue $sm;
          case 5:
            return Unit_instance;
          case 6:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 6) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(doorFlow$slambda$slambda).v1m = function ($this$launch, completion) {
    var i = new doorFlow$slambda$slambda(this.p5l_1, this.q5l_1, this.r5l_1, completion);
    i.s5l_1 = $this$launch;
    return i;
  };
  function doorFlow$slambda$slambda_0($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation) {
    var i = new doorFlow$slambda$slambda($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function doorFlow$slambda$lambda($invalidationEventChannel, $this_doorFlow, $invalidationTrackerObserver) {
    return function () {
      $invalidationEventChannel.e1a();
      $this_doorFlow.w5l().a5m($invalidationTrackerObserver);
      return Unit_instance;
    };
  }
  function doorFlow$slambda($this_doorFlow, $tables, $block, resultContinuation) {
    this.j5m_1 = $this_doorFlow;
    this.k5m_1 = $tables;
    this.l5m_1 = $block;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(doorFlow$slambda).h1m = function ($this$callbackFlow, $completion) {
    var tmp = this.i1m($this$callbackFlow, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(doorFlow$slambda).he = function (p1, $completion) {
    return this.h1m((!(p1 == null) ? isInterface(p1, ProducerScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(doorFlow$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.n5m_1 = Channel(1, BufferOverflow_DROP_OLDEST_getInstance());
            var tmp_0 = this;
            tmp_0.o5m_1 = new doorFlow$1$invalidationTrackerObserver$1(this.k5m_1, this.n5m_1);
            this.j5m_1.w5l().p5m(this.o5m_1);
            launch(this.m5m_1, VOID, VOID, doorFlow$slambda$slambda_0(this.m5m_1, this.l5m_1, this.n5m_1, null));
            this.hd_1 = 1;
            suspendResult = awaitClose(this.m5m_1, doorFlow$slambda$lambda(this.n5m_1, this.j5m_1, this.o5m_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(doorFlow$slambda).i1m = function ($this$callbackFlow, completion) {
    var i = new doorFlow$slambda(this.j5m_1, this.k5m_1, this.l5m_1, completion);
    i.m5m_1 = $this$callbackFlow;
    return i;
  };
  function doorFlow$slambda_0($this_doorFlow, $tables, $block, resultContinuation) {
    var i = new doorFlow$slambda($this_doorFlow, $tables, $block, resultContinuation);
    var l = function ($this$callbackFlow, $completion) {
      return i.h1m($this$callbackFlow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this$0) {
    return function () {
      return this$0.v5m_1 + ' creating SQLite triggers';
    };
  }
  function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda(results) {
    return mapRows(results, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda$lambda);
  }
  function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda$lambda(it) {
    return new NodeEvent(it.x5m('what'), it.y5m('toNode'), it.x5m('tableId'), it.y5m('key1'), it.y5m('key2'), it.y5m('key3'), it.y5m('key4'));
  }
  function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this$0, $events) {
    return function () {
      return this$0.v5m_1 + ' found ' + $events.u() + ' new events = ' + joinToString($events);
    };
  }
  function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this$0, $events) {
    return function () {
      return this$0.v5m_1 + ' emitting ' + $events.u() + ' events ' + joinToString($events) + ' ';
    };
  }
  function $onBeforeTransactionAsyncCOROUTINE$2(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.h5n_1 = _this__u8e3s4;
    this.i5n_1 = readOnly;
    this.j5n_1 = connection;
    this.k5n_1 = transactionId;
  }
  protoOf($onBeforeTransactionAsyncCOROUTINE$2).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            if (this.i5n_1)
              return Unit_instance;
            if (this.h5n_1.s5m_1) {
              v(this.h5n_1.t5m_1, VOID, NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this.h5n_1));
              this.hd_1 = 1;
              suspendResult = createNodeEventTableAndTrigger(this.j5n_1, this.h5n_1.q5m_1, VOID, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 2;
              continue $sm;
            }

          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            return Unit_instance;
          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 $onAfterTransactionAsyncCOROUTINE$3(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.t5n_1 = _this__u8e3s4;
    this.u5n_1 = readOnly;
    this.v5n_1 = connection;
    this.w5n_1 = transactionId;
  }
  protoOf($onAfterTransactionAsyncCOROUTINE$3).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 19;
            if (this.u5n_1)
              return Unit_instance;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.y5n_1 = this.v5n_1.i5i('\n        SELECT NodeEvent.what AS what,\n               NodeEvent.toNode AS toNode,\n               NodeEvent.tableId AS tableId,\n               NodeEvent.key1 AS key1,\n               NodeEvent.key2 AS key2,\n               NodeEvent.key3 AS key3,\n               NodeEvent.key4 AS key4\n          FROM NodeEvent\n    ');
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 7;
            this.id_1 = 6;
            var tmp_1 = this;
            tmp_1.a5o_1 = this.y5n_1;
            this.hd_1 = 4;
            suspendResult = executeQueryAsyncKmp(this.a5o_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            this.b5o_1 = suspendResult;
            var tmp_2 = this;
            tmp_2.z5n_1 = useResults(this.b5o_1, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda);
            this.id_1 = 19;
            this.hd_1 = 5;
            var tmp_3 = this;
            continue $sm;
          case 5:
            this.c5o_1 = this.z5n_1;
            this.id_1 = 19;
            this.y5n_1.n();
            this.x5n_1 = this.c5o_1;
            this.hd_1 = 9;
            continue $sm;
          case 6:
            this.id_1 = 7;
            var tmp_4 = this.kd_1;
            if (tmp_4 instanceof Exception) {
              this.d5o_1 = this.kd_1;
              var tmp_5 = this;
              throw this.d5o_1;
            } else {
              throw this.kd_1;
            }

          case 7:
            this.id_1 = 19;
            this.e5o_1 = this.kd_1;
            this.y5n_1.n();
            throw this.e5o_1;
          case 8:
            this.id_1 = 19;
            this.y5n_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 9;
            continue $sm;
          case 9:
            this.f5o_1 = this.x5n_1;
            v(this.t5n_1.t5m_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this.t5n_1, this.f5o_1));
            this.hd_1 = 10;
            continue $sm;
          case 10:
            var tmp_6 = this;
            tmp_6.h5o_1 = this.v5n_1.i5i('\n        DELETE FROM NodeEvent\n    ');
            this.hd_1 = 11;
            continue $sm;
          case 11:
            this.hd_1 = 12;
            continue $sm;
          case 12:
            this.id_1 = 16;
            this.id_1 = 15;
            var tmp_7 = this;
            tmp_7.j5o_1 = this.h5o_1;
            this.hd_1 = 13;
            suspendResult = executeUpdateAsyncKmp(this.j5o_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 13:
            this.i5o_1 = suspendResult;
            this.id_1 = 19;
            this.hd_1 = 14;
            var tmp_8 = this;
            continue $sm;
          case 14:
            var tmp_9 = this.i5o_1;
            this.id_1 = 19;
            this.h5o_1.n();
            this.g5o_1 = tmp_9;
            this.hd_1 = 18;
            continue $sm;
          case 15:
            this.id_1 = 16;
            var tmp_10 = this.kd_1;
            if (tmp_10 instanceof Exception) {
              var e = this.kd_1;
              var tmp_11 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 16:
            this.id_1 = 19;
            var t = this.kd_1;
            this.h5o_1.n();
            throw t;
          case 17:
            this.id_1 = 19;
            this.h5o_1.n();
            if (false) {
              this.hd_1 = 10;
              continue $sm;
            }

            this.hd_1 = 18;
            continue $sm;
          case 18:
            if (!this.f5o_1.c1()) {
              d_0(this.t5n_1.t5m_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this.t5n_1, this.f5o_1));
              var this_0 = this.t5n_1.w5m_1;
              var key = this.w5n_1;
              var value = this.f5o_1;
              this_0.s(key, value);
            }

            return Unit_instance;
          case 19:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 19) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function $onTransactionCommittedAsyncCOROUTINE$4(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.s5o_1 = _this__u8e3s4;
    this.t5o_1 = readOnly;
    this.u5o_1 = connection;
    this.v5o_1 = transactionId;
  }
  protoOf($onTransactionCommittedAsyncCOROUTINE$4).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            if (this.t5o_1)
              return Unit_instance;
            this.w5o_1 = this.s5o_1.w5m_1.u2(this.v5o_1);
            if (this.w5o_1 == null) {
              this.x5o_1 = null;
              this.hd_1 = 2;
              continue $sm;
            } else {
              var tmp_0 = this;
              tmp_0.y5o_1 = this.w5o_1;
              var tmp_1 = this;
              tmp_1.z5o_1 = this.y5o_1;
              this.hd_1 = 1;
              suspendResult = this.s5o_1.r5m_1.t1d(this.z5o_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            this.x5o_1 = this.y5o_1;
            this.hd_1 = 2;
            continue $sm;
          case 2:
            return Unit_instance;
          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 NodeEventJdbcImplListenerSqlite(hasOutgoingReplicationTable, outgoingEvents, createTmpEvtTableAndTriggerOnBeforeTransaction, logger, dbName) {
    createTmpEvtTableAndTriggerOnBeforeTransaction = createTmpEvtTableAndTriggerOnBeforeTransaction === VOID ? true : createTmpEvtTableAndTriggerOnBeforeTransaction;
    this.q5m_1 = hasOutgoingReplicationTable;
    this.r5m_1 = outgoingEvents;
    this.s5m_1 = createTmpEvtTableAndTriggerOnBeforeTransaction;
    this.t5m_1 = logger;
    this.u5m_1 = dbName;
    this.v5m_1 = '[NodeEventJdbcImplListenerSqlite - ' + this.u5m_1 + ']';
    this.w5m_1 = concurrentSafeMapOf([]);
  }
  protoOf(NodeEventJdbcImplListenerSqlite).a5p = function (readOnly, connection, transactionId, $completion) {
    var tmp = new $onBeforeTransactionAsyncCOROUTINE$2(this, readOnly, connection, transactionId, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(NodeEventJdbcImplListenerSqlite).b5p = function (readOnly, connection, transactionId, $completion) {
    var tmp = new $onAfterTransactionAsyncCOROUTINE$3(this, readOnly, connection, transactionId, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(NodeEventJdbcImplListenerSqlite).c5p = function (readOnly, connection, transactionId, $completion) {
    var tmp = new $onTransactionCommittedAsyncCOROUTINE$4(this, readOnly, connection, transactionId, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this$0, resultContinuation) {
    this.l5p_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).o5p = function (limit, offset, $completion) {
    var tmp = this.p5p(limit, offset, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).um = function (p1, p2, $completion) {
    var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE();
    return this.o5p(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion);
  };
  protoOf(DoorLimitOffsetPagingSource$initialLoad$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.l5p_1.w5p(this.m5p_1, this.n5p_1, 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(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).p5p = function (limit, offset, completion) {
    var i = new DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this.l5p_1, completion);
    i.m5p_1 = limit;
    i.n5p_1 = offset;
    return i;
  };
  function DoorLimitOffsetPagingSource$initialLoad$slambda$slambda_0(this$0, resultContinuation) {
    var i = new DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this$0, resultContinuation);
    var l = function (limit, offset, $completion) {
      return i.o5p(limit, offset, $completion);
    };
    l.$arity = 2;
    return l;
  }
  function InvalidationTracker($outer) {
    this.z5p_1 = $outer;
    InvalidationTrackerObserver.call(this, $outer.s5p_1);
    this.y5p_1 = atomic$boolean$1(false);
  }
  protoOf(InvalidationTracker).a5q = function () {
    if (!this.y5p_1.atomicfu$getAndSet(true)) {
      this.z5p_1.r5p_1.w5l().b5q(this);
    }
  };
  protoOf(InvalidationTracker).g5l = function (tables) {
    if (!this.z5p_1.u5p_1.atomicfu$getAndSet(true)) {
      Napier_getInstance().i5e('DoorLimitOffsetPagingSource: invalidated tables=' + joinToString(tables));
      this.z5p_1.k54();
    }
  };
  function initialLoad($this, params, $completion) {
    var tmp = TransactionMode_READ_ONLY_getInstance();
    return withDoorTransactionAsync($this.r5p_1, tmp, DoorLimitOffsetPagingSource$initialLoad$slambda_0($this, params, null), $completion);
  }
  function nonInitialLoad($this, params, tempCount, $completion) {
    var tmp = new $nonInitialLoadCOROUTINE$5($this, params, tempCount, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function DoorLimitOffsetPagingSource$load$slambda(this$0, $params, resultContinuation) {
    this.w5q_1 = this$0;
    this.x5q_1 = $params;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorLimitOffsetPagingSource$load$slambda).b5r = function ($this$withContext, $completion) {
    var tmp = this.v1m($this$withContext, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorLimitOffsetPagingSource$load$slambda).he = function (p1, $completion) {
    return this.b5r((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorLimitOffsetPagingSource$load$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            this.w5q_1.v5p_1.a5q();
            this.z5q_1 = this.w5q_1.t5p_1.kotlinx$atomicfu$value;
            if (this.z5q_1 === get_INITIAL_ITEM_COUNT()) {
              this.hd_1 = 2;
              suspendResult = initialLoad(this.w5q_1, this.x5q_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 1;
              suspendResult = nonInitialLoad(this.w5q_1, this.x5q_1, this.z5q_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            this.a5r_1 = suspendResult;
            this.hd_1 = 3;
            continue $sm;
          case 2:
            this.a5r_1 = suspendResult;
            this.hd_1 = 3;
            continue $sm;
          case 3:
            return this.a5r_1;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(DoorLimitOffsetPagingSource$load$slambda).v1m = function ($this$withContext, completion) {
    var i = new DoorLimitOffsetPagingSource$load$slambda(this.w5q_1, this.x5q_1, completion);
    i.y5q_1 = $this$withContext;
    return i;
  };
  function DoorLimitOffsetPagingSource$load$slambda_0(this$0, $params, resultContinuation) {
    var i = new DoorLimitOffsetPagingSource$load$slambda(this$0, $params, resultContinuation);
    var l = function ($this$withContext, $completion) {
      return i.b5r($this$withContext, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorLimitOffsetPagingSource$initialLoad$slambda(this$0, $params, resultContinuation) {
    this.k5r_1 = this$0;
    this.l5r_1 = $params;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).o5r = function (it, $completion) {
    var tmp = this.p5r(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).he = function (p1, $completion) {
    return this.o5r(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).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 = this.k5r_1.q5r(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.n5r_1 = suspendResult;
            this.k5r_1.t5p_1.kotlinx$atomicfu$value = this.n5r_1;
            this.hd_1 = 2;
            suspendResult = queryDatabase(this.l5r_1, DoorLimitOffsetPagingSource$initialLoad$slambda$slambda_0(this.k5r_1, null), this.n5r_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return suspendResult;
          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);
  };
  protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).p5r = function (it, completion) {
    var i = new DoorLimitOffsetPagingSource$initialLoad$slambda(this.k5r_1, this.l5r_1, completion);
    i.m5r_1 = it;
    return i;
  };
  function DoorLimitOffsetPagingSource$initialLoad$slambda_0(this$0, $params, resultContinuation) {
    var i = new DoorLimitOffsetPagingSource$initialLoad$slambda(this$0, $params, resultContinuation);
    var l = function (it, $completion) {
      return i.o5r(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this$0, resultContinuation) {
    this.z5r_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).o5p = function (limit, offset, $completion) {
    var tmp = this.p5p(limit, offset, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).um = function (p1, p2, $completion) {
    var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE();
    return this.o5p(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion);
  };
  protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$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.z5r_1.w5p(this.a5s_1, this.b5s_1, 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(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).p5p = function (limit, offset, completion) {
    var i = new DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this.z5r_1, completion);
    i.a5s_1 = limit;
    i.b5s_1 = offset;
    return i;
  };
  function DoorLimitOffsetPagingSource$nonInitialLoad$slambda_0(this$0, resultContinuation) {
    var i = new DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this$0, resultContinuation);
    var l = function (limit, offset, $completion) {
      return i.o5p(limit, offset, $completion);
    };
    l.$arity = 2;
    return l;
  }
  function $nonInitialLoadCOROUTINE$5(_this__u8e3s4, params, tempCount, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.k5q_1 = _this__u8e3s4;
    this.l5q_1 = params;
    this.m5q_1 = tempCount;
  }
  protoOf($nonInitialLoadCOROUTINE$5).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            if (this.k5q_1.u5p_1.kotlinx$atomicfu$value) {
              var tmp_0 = this;
              var tmp_1 = get_INVALID();
              tmp_0.n5q_1 = tmp_1 instanceof LoadResult ? tmp_1 : THROW_CCE();
              this.hd_1 = 2;
              continue $sm;
            } else {
              this.hd_1 = 1;
              suspendResult = queryDatabase(this.l5q_1, DoorLimitOffsetPagingSource$nonInitialLoad$slambda_0(this.k5q_1, null), this.m5q_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            this.n5q_1 = suspendResult;
            this.hd_1 = 2;
            continue $sm;
          case 2:
            return this.n5q_1;
          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 DoorLimitOffsetPagingSource(db, tableNames) {
    PagingSource.call(this);
    this.r5p_1 = db;
    this.s5p_1 = tableNames;
    this.t5p_1 = atomic$int$1(get_INITIAL_ITEM_COUNT());
    this.u5p_1 = atomic$boolean$1(false);
    this.v5p_1 = new InvalidationTracker(this);
  }
  protoOf(DoorLimitOffsetPagingSource).c5s = function (params, $completion) {
    var tmp = Dispatchers_getInstance().p12_1;
    return withContext(tmp, DoorLimitOffsetPagingSource$load$slambda_0(this, params, null), $completion);
  };
  protoOf(DoorLimitOffsetPagingSource).p54 = function (params, $completion) {
    return this.c5s(params, $completion);
  };
  function fireChanges($this, listToFire) {
    var tmp = Napier_getInstance();
    tmp.e5e(VOID, 'DoorLog', InvalidationTracker$fireChanges$lambda(listToFire));
    // Inline function 'kotlin.collections.filter' call
    // Inline function 'kotlin.collections.filterTo' call
    var this_0 = $this.y5l_1;
    var destination = ArrayList_init_$Create$();
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>' call
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.any' call
        var indexedObject = element.d5s_1;
        var inductionVariable = 0;
        var last = indexedObject.length;
        while (inductionVariable < last) {
          var element_0 = indexedObject[inductionVariable];
          inductionVariable = inductionVariable + 1 | 0;
          // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>.<anonymous>' call
          if (listToFire.a1(element_0)) {
            tmp$ret$1 = true;
            break $l$block;
          }
        }
        tmp$ret$1 = false;
      }
      if (tmp$ret$1) {
        destination.i1(element);
      }
    }
    var affectedObservers = destination;
    // Inline function 'kotlin.collections.forEach' call
    var tmp0_iterator_0 = affectedObservers.w();
    while (tmp0_iterator_0.f()) {
      var element_1 = tmp0_iterator_0.e();
      // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>' call
      element_1.g5l(listToFire);
    }
    // Inline function 'kotlin.collections.mapNotNull' call
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var this_1 = $this.z5l_1;
    var destination_0 = ArrayList_init_$Create$();
    // Inline function 'kotlin.collections.forEach' call
    var tmp0_iterator_1 = this_1.w();
    while (tmp0_iterator_1.f()) {
      var element_2 = tmp0_iterator_1.e();
      // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
      // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>' call
      var observer = element_2.lz();
      var tmp_0;
      var tmp_1;
      if (!(observer == null)) {
        var tmp$ret$6;
        $l$block_0: {
          // Inline function 'kotlin.collections.any' call
          var indexedObject_0 = observer.d5s_1;
          var inductionVariable_0 = 0;
          var last_0 = indexedObject_0.length;
          while (inductionVariable_0 < last_0) {
            var element_3 = indexedObject_0[inductionVariable_0];
            inductionVariable_0 = inductionVariable_0 + 1 | 0;
            // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>.<anonymous>' call
            if (listToFire.a1(element_3)) {
              tmp$ret$6 = true;
              break $l$block_0;
            }
          }
          tmp$ret$6 = false;
        }
        tmp_1 = tmp$ret$6;
      } else {
        tmp_1 = false;
      }
      if (tmp_1) {
        tmp_0 = observer;
      } else {
        tmp_0 = null;
      }
      var tmp0_safe_receiver = tmp_0;
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        // Inline function 'kotlin.contracts.contract' call
        destination_0.i1(tmp0_safe_receiver);
      }
    }
    var affectedWeakObservers = destination_0;
    // Inline function 'kotlin.collections.forEach' call
    var tmp0_iterator_2 = affectedWeakObservers.w();
    while (tmp0_iterator_2.f()) {
      var element_4 = tmp0_iterator_2.e();
      // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.<anonymous>' call
      element_4.g5l(listToFire);
    }
    removeAll($this.z5l_1, InvalidationTracker$fireChanges$lambda_0);
  }
  function Companion_0() {
    this.e5s_1 = 'door_update_mods';
    this.f5s_1 = 'tableId';
    this.g5s_1 = 'invalidated';
    this.h5s_1 = 'CREATE TEMP TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)';
    this.i5s_1 = 'CREATE TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)';
    this.j5s_1 = 'SELECT tableId FROM door_update_mods WHERE invalidated = 1';
    this.k5s_1 = '\n            UPDATE door_update_mods \n               SET invalidated = 0 \n             WHERE invalidated = 1\n        ';
  }
  protoOf(Companion_0).l5s = function (tableNames, temporary) {
    var tempStr = temporary ? 'TEMP' : '';
    var createTableSql = temporary ? 'CREATE TEMP TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)' : 'CREATE TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)';
    var tmp = listOf(createTableSql);
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tableNames, 10));
    var index = 0;
    var tmp0_iterator = tableNames.w();
    while (tmp0_iterator.f()) {
      var item = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.room.Companion.generateCreateTriggersSql.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var tableId = checkIndexOverflow(tmp1);
      var tmp_0 = listOf('INSERT OR IGNORE INTO door_update_mods (tableId, invalidated) ' + ('VALUES (' + tableId + ', 0)'));
      // Inline function 'kotlin.collections.map' call
      var this_0 = listOf_0(['UPDATE', 'INSERT', 'DELETE']);
      // Inline function 'kotlin.collections.mapTo' call
      var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
      var tmp0_iterator_0 = this_0.w();
      while (tmp0_iterator_0.f()) {
        var item_0 = tmp0_iterator_0.e();
        // Inline function 'com.ustadmobile.door.room.Companion.generateCreateTriggersSql.<anonymous>.<anonymous>' call
        var tmp$ret$0 = 'CREATE ' + tempStr + ' TRIGGER IF NOT EXISTS door_mod_trigger_' + item + '_' + item_0 + ' \n                   AFTER ' + item_0 + '\n                   ON ' + item + ' \n                   BEGIN \n                   UPDATE door_update_mods\n                      SET invalidated = 1 \n                    WHERE tableId = ' + tableId + '\n                      AND invalidated = 0;\n                    END \n                    ';
        destination_0.i1(tmp$ret$0);
      }
      var tmp$ret$3 = plus(tmp_0, destination_0);
      destination.i1(tmp$ret$3);
    }
    return plus(tmp, flatten(destination));
  };
  var Companion_instance_0;
  function Companion_getInstance_2() {
    return Companion_instance_0;
  }
  function InvalidationTracker$fireChanges$lambda($listToFire) {
    return function () {
      return '' + ('InvalidationTracker: tables invalidated: ' + joinToString($listToFire));
    };
  }
  function InvalidationTracker$fireChanges$lambda_0(it) {
    return it.lz() == null;
  }
  function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0) {
    return function (it) {
      return this$0.x5l_1.v(it.m5s(1));
    };
  }
  function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this$0) {
    return function (results) {
      return mapRows(results, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0));
    };
  }
  function $findChangedTablesOnConnectionAsyncCOROUTINE$7(_this__u8e3s4, connection, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.v5s_1 = _this__u8e3s4;
    this.w5s_1 = connection;
  }
  protoOf($findChangedTablesOnConnectionAsyncCOROUTINE$7).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 17;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.y5s_1 = this.w5s_1.i5i('SELECT tableId FROM door_update_mods WHERE invalidated = 1');
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 7;
            this.id_1 = 6;
            var tmp_1 = this;
            tmp_1.a5t_1 = this.y5s_1;
            this.hd_1 = 4;
            suspendResult = executeQueryAsyncKmp(this.a5t_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            this.b5t_1 = suspendResult;
            var tmp_2 = this;
            tmp_2.z5s_1 = useResults(this.b5t_1, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this.v5s_1));
            this.id_1 = 17;
            this.hd_1 = 5;
            var tmp_3 = this;
            continue $sm;
          case 5:
            this.c5t_1 = this.z5s_1;
            this.id_1 = 17;
            this.y5s_1.n();
            this.x5s_1 = this.c5t_1;
            this.hd_1 = 9;
            continue $sm;
          case 6:
            this.id_1 = 7;
            var tmp_4 = this.kd_1;
            if (tmp_4 instanceof Exception) {
              this.d5t_1 = this.kd_1;
              var tmp_5 = this;
              throw this.d5t_1;
            } else {
              throw this.kd_1;
            }

          case 7:
            this.id_1 = 17;
            this.e5t_1 = this.kd_1;
            this.y5s_1.n();
            throw this.e5t_1;
          case 8:
            this.id_1 = 17;
            this.y5s_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 9;
            continue $sm;
          case 9:
            this.f5t_1 = this.x5s_1;
            this.hd_1 = 10;
            continue $sm;
          case 10:
            var tmp_6 = this;
            tmp_6.h5t_1 = this.w5s_1.i5i('\n            UPDATE door_update_mods \n               SET invalidated = 0 \n             WHERE invalidated = 1\n        ');
            this.hd_1 = 11;
            continue $sm;
          case 11:
            this.hd_1 = 12;
            continue $sm;
          case 12:
            this.id_1 = 16;
            this.id_1 = 15;
            var tmp_7 = this;
            tmp_7.j5t_1 = this.h5t_1;
            this.hd_1 = 13;
            suspendResult = executeUpdateAsyncKmp(this.j5t_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 13:
            this.i5t_1 = suspendResult;
            this.id_1 = 17;
            this.hd_1 = 14;
            var tmp_8 = this;
            continue $sm;
          case 14:
            var tmp_9 = this.i5t_1;
            this.id_1 = 17;
            this.h5t_1.n();
            this.g5t_1 = tmp_9;
            this.hd_1 = 19;
            continue $sm;
          case 15:
            this.id_1 = 16;
            var tmp_10 = this.kd_1;
            if (tmp_10 instanceof Exception) {
              var e = this.kd_1;
              var tmp_11 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 16:
            this.id_1 = 17;
            var t = this.kd_1;
            this.h5t_1.n();
            throw t;
          case 17:
            throw this.kd_1;
          case 18:
            this.id_1 = 17;
            this.h5t_1.n();
            if (false) {
              this.hd_1 = 10;
              continue $sm;
            }

            this.hd_1 = 19;
            continue $sm;
          case 19:
            return this.f5t_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 17) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function InvalidationTracker_0(tables) {
    this.x5l_1 = toList(tables);
    this.y5l_1 = concurrentSafeListOf([]);
    this.z5l_1 = concurrentSafeListOf([]);
  }
  protoOf(InvalidationTracker_0).p5m = function (observer) {
    // Inline function 'kotlin.collections.plusAssign' call
    this.y5l_1.i1(observer);
  };
  protoOf(InvalidationTracker_0).a5m = function (observer) {
    // Inline function 'kotlin.collections.minusAssign' call
    this.y5l_1.j1(observer);
  };
  protoOf(InvalidationTracker_0).b5q = function (observer) {
    // Inline function 'kotlin.collections.plusAssign' call
    var this_0 = this.z5l_1;
    var element = weakRefOf(observer);
    this_0.i1(element);
  };
  protoOf(InvalidationTracker_0).k5t = function (tableNames) {
    fireChanges(this, tableNames);
  };
  protoOf(InvalidationTracker_0).l5t = function (connection, $completion) {
    var tmp = new $findChangedTablesOnConnectionAsyncCOROUTINE$7(this, connection, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function InvalidationTrackerObserver(tables) {
    this.d5s_1 = tables;
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda($connectionLogPrefix, $t, $transactionStartTime) {
    return function () {
      return $connectionLogPrefix + ' : cancelled ' + $t.message + ' after ' + systemTimeInMillis().mc($transactionStartTime).toString() + 'ms';
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda($block, $transactionContext, resultContinuation) {
    this.u5t_1 = $block;
    this.v5t_1 = $transactionContext;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).x5t = function ($this$withContext, $completion) {
    var tmp = this.v1m($this$withContext, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).he = function (p1, $completion) {
    return this.x5t((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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.u5t_1(this.v5t_1.z5t_1, 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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).v1m = function ($this$withContext, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda(this.u5t_1, this.v5t_1, completion);
    i.w5t_1 = $this$withContext;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_0($block, $transactionContext, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda($block, $transactionContext, resultContinuation);
    var l = function ($this$withContext, $completion) {
      return i.x5t($this$withContext, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this$0, $readOnly, $block, resultContinuation) {
    this.k5u_1 = this$0;
    this.l5u_1 = $readOnly;
    this.m5u_1 = $block;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).x5t = function ($this$withTimeout, $completion) {
    var tmp = this.v1m($this$withTimeout, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).he = function (p1, $completion) {
    return this.x5t((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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 = 6;
            var tmp_0 = this;
            tmp_0.o5u_1 = this.k5u_1.v5j_1;
            var tmp_1 = this;
            tmp_1.p5u_1 = null;
            this.hd_1 = 1;
            suspendResult = this.o5u_1.a24(this.p5u_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.id_1 = 5;
            this.hd_1 = 3;
            suspendResult = useNewConnectionAsyncInternal(this.k5u_1, this.l5u_1, this.m5u_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.q5u_1 = suspendResult;
            this.id_1 = 6;
            this.hd_1 = 4;
            continue $sm;
          case 4:
            var tmp_2 = this.q5u_1;
            this.id_1 = 6;
            this.o5u_1.l23(this.p5u_1);
            return tmp_2;
          case 5:
            this.id_1 = 6;
            var t = this.kd_1;
            this.o5u_1.l23(this.p5u_1);
            throw t;
          case 6:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 6) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).v1m = function ($this$withTimeout, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this.k5u_1, this.l5u_1, this.m5u_1, completion);
    i.n5u_1 = $this$withTimeout;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_2(this$0, $readOnly, $block, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this$0, $readOnly, $block, resultContinuation);
    var l = function ($this$withTimeout, $completion) {
      return i.x5t($this$withTimeout, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this$0, $readOnly, $block, resultContinuation) {
    this.z5u_1 = this$0;
    this.a5v_1 = $readOnly;
    this.b5v_1 = $block;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).x5t = function ($this$withTimeout, $completion) {
    var tmp = this.v1m($this$withTimeout, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).he = function (p1, $completion) {
    return this.x5t((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).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 = useNewConnectionAsyncInternal(this.z5u_1, this.a5v_1, this.b5v_1, 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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).v1m = function ($this$withTimeout, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this.z5u_1, this.a5v_1, this.b5v_1, completion);
    i.c5v_1 = $this$withTimeout;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_4(this$0, $readOnly, $block, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this$0, $readOnly, $block, resultContinuation);
    var l = function ($this$withTimeout, $completion) {
      return i.x5t($this$withTimeout, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function TransactionElement(key, connection, transactionId, readOnly) {
    transactionId = transactionId === VOID ? 0 : transactionId;
    this.y5t_1 = key;
    this.z5t_1 = connection;
    this.a5u_1 = transactionId;
    this.b5u_1 = readOnly;
  }
  protoOf(TransactionElement).s2 = function () {
    return this.y5t_1;
  };
  function useNewConnectionAsyncInternal($this, readOnly, block, $completion) {
    var tmp = new $useNewConnectionAsyncInternalCOROUTINE$8($this, readOnly, block, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function Key() {
  }
  var Key_instance;
  function Key_getInstance() {
    return Key_instance;
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda($connectionLogPrefix, $readOnly) {
    return function () {
      return $connectionLogPrefix + ' - start readOnly=' + $readOnly;
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_0($connectionLogPrefix) {
    return function () {
      return $connectionLogPrefix + ': creating SQLite change triggers ';
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda($block, $transactionElement, resultContinuation) {
    this.t5w_1 = $block;
    this.u5w_1 = $transactionElement;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).x5t = function ($this$withContext, $completion) {
    var tmp = this.v1m($this$withContext, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).he = function (p1, $completion) {
    return this.x5t((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$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.t5w_1(this.u5w_1.z5t_1, 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(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).v1m = function ($this$withContext, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda(this.t5w_1, this.u5w_1, completion);
    i.v5w_1 = $this$withContext;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_0($block, $transactionElement, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda($block, $transactionElement, resultContinuation);
    var l = function ($this$withContext, $completion) {
      return i.x5t($this$withContext, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_1($connectionLogPrefix, $changes) {
    return function () {
      return $connectionLogPrefix + ': SQLite Change Tracker: Changed tables=[' + joinToString($changes) + ']';
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_2($connectionLogPrefix) {
    return function () {
      return $connectionLogPrefix + ' committed changes';
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this$0, $changedTables, resultContinuation) {
    this.e5x_1 = this$0;
    this.f5x_1 = $changedTables;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        if (tmp === 0) {
          this.id_1 = 1;
          this.e5x_1.r5j_1.k5t(toSet(this.f5x_1));
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).v1m = function ($this$launch, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this.e5x_1, this.f5x_1, completion);
    i.g5x_1 = $this$launch;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_2(this$0, $changedTables, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this$0, $changedTables, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation) {
    this.p5x_1 = $t;
    this.q5x_1 = this$0;
    this.r5x_1 = $connectionLogPrefix;
    this.s5x_1 = $connection;
    this.t5x_1 = $readOnly;
    this.u5x_1 = $connectionId;
    this.v5x_1 = $transactionStartTime;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).u1m = function ($this$withContext, $completion) {
    var tmp = this.v1m($this$withContext, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            var tmp_0 = this.p5x_1;
            if (tmp_0 instanceof CancellationException) {
              v(this.q5x_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda(this.r5x_1, this.p5x_1, this.v5x_1));
            } else {
              e(this.q5x_1.p5j_1, this.r5x_1 + ' exception ', this.p5x_1);
            }

            if (!this.s5x_1.z5x() ? !this.t5x_1 : false) {
              i(this.q5x_1.p5j_1, this.r5x_1 + ' Attempting to rollback transaction #' + this.u5x_1);
              var tmp_1 = this.s5x_1;
              if (isInterface(tmp_1, ConnectionAsync)) {
                this.hd_1 = 1;
                suspendResult = this.s5x_1.y5x(this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.s5x_1.x5x();
                this.hd_1 = 2;
                continue $sm;
              }
            } else {
              this.hd_1 = 3;
              continue $sm;
            }

          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            i(this.q5x_1.p5j_1, this.r5x_1 + ' Rolled back changes');
            this.hd_1 = 3;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 4) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).v1m = function ($this$withContext, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3(this.p5x_1, this.q5x_1, this.r5x_1, this.s5x_1, this.t5x_1, this.u5x_1, this.v5x_1, completion);
    i.w5x_1 = $this$withContext;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_4($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation);
    var l = function ($this$withContext, $completion) {
      return i.u1m($this$withContext, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3($connectionLogPrefix, $connectionId) {
    return function () {
      return $connectionLogPrefix + ': end transaction #' + $connectionId;
    };
  }
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this$0, $readOnly, $block, resultContinuation) {
    this.i5y_1 = this$0;
    this.j5y_1 = $readOnly;
    this.k5y_1 = $block;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).x5t = function ($this$withContext, $completion) {
    var tmp = this.v1m($this$withContext, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).he = function (p1, $completion) {
    return this.x5t((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 5;
            this.m5y_1 = this.l5y_1.cq().pd(Key_instance);
            var tmp_0 = this;
            var tmp_1 = get_rootDatabase(this.i5y_1.n5j_1);
            tmp_0.n5y_1 = toLong(imul((isInterface(tmp_1, DoorDatabaseJdbc) ? tmp_1 : THROW_CCE()).c5l(), 1000));
            if (!(this.m5y_1 == null)) {
              if (this.m5y_1.b5u_1 ? !this.j5y_1 : false) {
                throw IllegalStateException_init_$Create$('Current transaction context is read-only');
              }
              this.hd_1 = 3;
              suspendResult = withContext(this.m5y_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_0(this.k5y_1, this.m5y_1, null), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              Companion_getInstance_3();
              if (this.i5y_1.s5j_1 === 1) {
                this.hd_1 = 2;
                suspendResult = withTimeout(this.n5y_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_2(this.i5y_1, this.j5y_1, this.k5y_1, null), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 1;
                suspendResult = withTimeout(this.n5y_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_4(this.i5y_1, this.j5y_1, this.k5y_1, null), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              }
            }

          case 1:
            this.o5y_1 = suspendResult;
            this.hd_1 = 4;
            continue $sm;
          case 2:
            this.o5y_1 = suspendResult;
            this.hd_1 = 4;
            continue $sm;
          case 3:
            this.o5y_1 = suspendResult;
            this.hd_1 = 4;
            continue $sm;
          case 4:
            return this.o5y_1;
          case 5:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 5) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).v1m = function ($this$withContext, completion) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this.i5y_1, this.j5y_1, this.k5y_1, completion);
    i.l5y_1 = $this$withContext;
    return i;
  };
  function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda_0(this$0, $readOnly, $block, resultContinuation) {
    var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this$0, $readOnly, $block, resultContinuation);
    var l = function ($this$withContext, $completion) {
      return i.x5t($this$withContext, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $useNewConnectionAsyncInternalCOROUTINE$8(_this__u8e3s4, readOnly, block, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.l5v_1 = _this__u8e3s4;
    this.m5v_1 = readOnly;
    this.n5v_1 = block;
  }
  protoOf($useNewConnectionAsyncInternalCOROUTINE$8).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 28;
            this.l5v_1.p5y();
            this.o5v_1 = this.l5v_1.m5j_1.r5g();
            this.p5v_1 = this.l5v_1.t5j_1.atomicfu$incrementAndGet();
            this.q5v_1 = this.l5v_1.y5j_1 + ' - useNewConnectionAsyncInternal connection #' + this.p5v_1 + ' ';
            v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda(this.q5v_1, this.m5v_1));
            if (!this.m5v_1) {
              var tmp_0 = this.o5v_1;
              if (isInterface(tmp_0, ConnectionAsync)) {
                this.hd_1 = 1;
                suspendResult = this.o5v_1.q5y(false, this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.o5v_1.s5g(false);
                this.hd_1 = 2;
                continue $sm;
              }
            } else {
              this.hd_1 = 3;
              continue $sm;
            }

          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.r5v_1 = systemTimeInMillis();
            this.s5v_1 = mutableLinkedListOf_0([]);
            this.hd_1 = 4;
            continue $sm;
          case 4:
            this.hd_1 = 5;
            continue $sm;
          case 5:
            this.id_1 = 27;
            this.id_1 = 24;
            var tmp_1;
            if (!this.m5v_1) {
              Companion_getInstance_3();
              tmp_1 = this.l5v_1.s5j_1 === 1;
            } else {
              tmp_1 = false;
            }

            if (tmp_1) {
              v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_0(this.q5v_1));
              this.hd_1 = 6;
              suspendResult = this.l5v_1.r5y(this.o5v_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 7;
              continue $sm;
            }

          case 6:
            this.hd_1 = 7;
            continue $sm;
          case 7:
            this.u5v_1 = new TransactionElement(Key_instance, this.o5v_1, this.p5v_1, this.m5v_1);
            var this_0 = this.l5v_1.u5j_1;
            var key = this.p5v_1;
            var value = this.u5v_1;
            this_0.s(key, value);
            var tmp_2 = this;
            tmp_2.v5v_1 = this.l5v_1.w5j_1;
            this.w5v_1 = this.v5v_1.w();
            this.hd_1 = 8;
            continue $sm;
          case 8:
            if (!this.w5v_1.f()) {
              this.hd_1 = 10;
              continue $sm;
            }

            this.x5v_1 = this.w5v_1.e();
            var tmp_3 = this;
            tmp_3.y5v_1 = this.x5v_1;
            this.hd_1 = 9;
            suspendResult = this.y5v_1.a5p(this.m5v_1, this.o5v_1, this.p5v_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 9:
            this.hd_1 = 8;
            continue $sm;
          case 10:
            this.hd_1 = 11;
            suspendResult = withContext(this.u5v_1, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_0(this.n5v_1, this.u5v_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 11:
            this.z5v_1 = suspendResult;
            var tmp_4;
            if (!this.m5v_1) {
              Companion_getInstance_3();
              tmp_4 = this.l5v_1.s5j_1 === 1;
            } else {
              tmp_4 = false;
            }

            if (tmp_4) {
              this.hd_1 = 12;
              suspendResult = this.l5v_1.r5j_1.l5t(this.o5v_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 13;
              continue $sm;
            }

          case 12:
            this.a5w_1 = suspendResult;
            d_0(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_1(this.q5v_1, this.a5w_1));
            this.s5v_1.m1(this.a5w_1);
            this.hd_1 = 13;
            continue $sm;
          case 13:
            var tmp_5 = this;
            tmp_5.b5w_1 = this.l5v_1.w5j_1;
            this.c5w_1 = this.b5w_1.w();
            this.hd_1 = 14;
            continue $sm;
          case 14:
            if (!this.c5w_1.f()) {
              this.hd_1 = 16;
              continue $sm;
            }

            this.d5w_1 = this.c5w_1.e();
            var tmp_6 = this;
            tmp_6.e5w_1 = this.d5w_1;
            this.hd_1 = 15;
            suspendResult = this.e5w_1.b5p(this.m5v_1, this.o5v_1, this.p5v_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 15:
            this.hd_1 = 14;
            continue $sm;
          case 16:
            if (!this.m5v_1) {
              var tmp_7 = this.o5v_1;
              if (isInterface(tmp_7, ConnectionAsync)) {
                this.hd_1 = 17;
                suspendResult = this.o5v_1.s5y(this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.o5v_1.t5g();
                this.hd_1 = 18;
                continue $sm;
              }
            } else {
              this.hd_1 = 19;
              continue $sm;
            }

          case 17:
            this.hd_1 = 18;
            continue $sm;
          case 18:
            v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_2(this.q5v_1));
            this.hd_1 = 19;
            continue $sm;
          case 19:
            var tmp_8 = this;
            tmp_8.f5w_1 = this.l5v_1.w5j_1;
            this.g5w_1 = this.f5w_1.w();
            this.hd_1 = 20;
            continue $sm;
          case 20:
            if (!this.g5w_1.f()) {
              this.hd_1 = 22;
              continue $sm;
            }

            this.h5w_1 = this.g5w_1.e();
            var tmp_9 = this;
            tmp_9.i5w_1 = this.h5w_1;
            this.hd_1 = 21;
            suspendResult = this.i5w_1.c5p(this.m5v_1, this.o5v_1, this.p5v_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 21:
            this.hd_1 = 20;
            continue $sm;
          case 22:
            var this_1 = this.l5v_1.z5j_1;
            var tmp_10;
            if (!this.s5v_1.c1()) {
              tmp_10 = this_1;
            } else {
              tmp_10 = null;
            }

            var tmp0_safe_receiver = tmp_10;
            if (tmp0_safe_receiver == null)
              null;
            else {
              launch(tmp0_safe_receiver, VOID, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_2(this.l5v_1, this.s5v_1, null));
            }

            this.t5v_1 = this.z5v_1;
            this.id_1 = 28;
            this.hd_1 = 23;
            var tmp_11 = this;
            continue $sm;
          case 23:
            this.j5w_1 = this.t5v_1;
            this.id_1 = 28;
            this.o5v_1.n();
            this.l5v_1.u5j_1.u2(this.p5v_1);
            v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.q5v_1, this.p5v_1));
            if (!this.l5v_1.u5j_1.c1()) {
              w_0(this.l5v_1.p5j_1, 'useConnectionAsync: close transaction ' + this.p5v_1 + ' (took ' + systemTimeInMillis().mc(this.r5v_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.l5v_1.u5j_1.o2()) + '] pending async transactions still open.'));
            }

            return this.j5w_1;
          case 24:
            this.id_1 = 27;
            var tmp_12 = this.kd_1;
            if (tmp_12 instanceof Error) {
              this.k5w_1 = this.kd_1;
              this.hd_1 = 25;
              var tmp_13 = NonCancellable_getInstance();
              suspendResult = withContext(tmp_13, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_4(this.k5w_1, this.l5v_1, this.q5v_1, this.o5v_1, this.m5v_1, this.p5v_1, this.r5v_1, null), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              throw this.kd_1;
            }

          case 25:
            var tmp_14 = this;
            throw this.k5w_1;
          case 26:
            this.id_1 = 28;
            this.o5v_1.n();
            this.l5v_1.u5j_1.u2(this.p5v_1);
            v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.q5v_1, this.p5v_1));
            if (!this.l5v_1.u5j_1.c1()) {
              w_0(this.l5v_1.p5j_1, 'useConnectionAsync: close transaction ' + this.p5v_1 + ' (took ' + systemTimeInMillis().mc(this.r5v_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.l5v_1.u5j_1.o2()) + '] pending async transactions still open.'));
            }

            return Unit_instance;
          case 27:
            this.id_1 = 28;
            var t = this.kd_1;
            this.o5v_1.n();
            this.l5v_1.u5j_1.u2(this.p5v_1);
            v(this.l5v_1.p5j_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.q5v_1, this.p5v_1));
            if (!this.l5v_1.u5j_1.c1()) {
              w_0(this.l5v_1.p5j_1, 'useConnectionAsync: close transaction ' + this.p5v_1 + ' (took ' + systemTimeInMillis().mc(this.r5v_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.l5v_1.u5j_1.o2()) + '] pending async transactions still open.'));
            }

            throw t;
          case 28:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 28) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function RoomDatabaseJdbcImplHelperCommon(dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType, dispatcher) {
    var tmp;
    if (dbType === VOID) {
      Companion_getInstance_3();
      tmp = 1;
    } else {
      tmp = dbType;
    }
    dbType = tmp;
    dispatcher = dispatcher === VOID ? Dispatchers_getInstance().p12_1 : dispatcher;
    this.m5j_1 = dataSource;
    this.n5j_1 = db;
    this.o5j_1 = dbName;
    this.p5j_1 = logger;
    this.q5j_1 = tableNames;
    this.r5j_1 = invalidationTracker;
    this.s5j_1 = dbType;
    this.t5j_1 = atomic$int$1(0);
    this.u5j_1 = concurrentSafeMapOf([]);
    this.v5j_1 = Mutex();
    this.w5j_1 = concurrentSafeListOf([]);
    this.x5j_1 = atomic$boolean$1(false);
    this.y5j_1 = '[RoomJdbcImplHelper - ' + this.o5j_1 + ']';
    this.z5j_1 = CoroutineScope_0(dispatcher.lj(Job()));
  }
  protoOf(RoomDatabaseJdbcImplHelperCommon).p5y = function () {
    if (this.x5j_1.kotlinx$atomicfu$value)
      throw IllegalStateException_init_$Create$('' + this + ' is closed!');
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon).d5l = function (readOnly, block, $completion) {
    var tmp = this.z5j_1.cq();
    return withContext(tmp, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda_0(this, readOnly, block, null), $completion);
  };
  protoOf(RoomDatabaseJdbcImplHelperCommon).t5y = function (listener) {
    // Inline function 'kotlin.collections.plusAssign' call
    this.w5j_1.i1(listener);
  };
  function RoomJdbcImpl() {
  }
  function dropDoorTriggersAndReceiveViewsSqlite(_this__u8e3s4, $completion) {
    var tmp = new $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function getSqliteDoorTriggerNames(_this__u8e3s4, $completion) {
    var tmp = new $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function getSqliteDoorReceiveViewNames(_this__u8e3s4, $completion) {
    var tmp = new $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function getSqliteDoorTriggerNames$lambda(results) {
    return mapRows(results, getSqliteDoorTriggerNames$lambda$lambda);
  }
  function getSqliteDoorTriggerNames$lambda$lambda(resultSet) {
    return resultSet.x60(1);
  }
  function getSqliteDoorReceiveViewNames$lambda(results) {
    return mapRows(results, getSqliteDoorReceiveViewNames$lambda$lambda);
  }
  function getSqliteDoorReceiveViewNames$lambda$lambda(resultSet) {
    return resultSet.x60(1);
  }
  function $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.c5z_1 = _this__u8e3s4;
  }
  protoOf($dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 25;
            this.hd_1 = 1;
            suspendResult = getSqliteDoorTriggerNames(this.c5z_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.d5z_1 = suspendResult;
            this.hd_1 = 2;
            continue $sm;
          case 2:
            var tmp_0 = this;
            tmp_0.f5z_1 = this.c5z_1.y60();
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.hd_1 = 4;
            continue $sm;
          case 4:
            this.id_1 = 10;
            this.id_1 = 9;
            var tmp_1 = this;
            tmp_1.h5z_1 = this.f5z_1;
            var tmp_2 = this;
            tmp_2.i5z_1 = this.d5z_1;
            this.j5z_1 = this.i5z_1.w();
            this.hd_1 = 5;
            continue $sm;
          case 5:
            if (!this.j5z_1.f()) {
              this.hd_1 = 7;
              continue $sm;
            }

            this.k5z_1 = this.j5z_1.e();
            var tmp_3 = this;
            tmp_3.l5z_1 = this.k5z_1;
            this.hd_1 = 6;
            suspendResult = executeUpdateAsync(this.h5z_1, 'DROP TRIGGER ' + this.l5z_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 6:
            this.hd_1 = 5;
            continue $sm;
          case 7:
            this.g5z_1 = Unit_instance;
            this.id_1 = 25;
            this.hd_1 = 8;
            var tmp_4 = this;
            continue $sm;
          case 8:
            this.id_1 = 25;
            var tmp_5 = this;
            this.f5z_1.n();
            tmp_5.e5z_1 = Unit_instance;
            this.hd_1 = 12;
            continue $sm;
          case 9:
            this.id_1 = 10;
            var tmp_6 = this.kd_1;
            if (tmp_6 instanceof Exception) {
              this.m5z_1 = this.kd_1;
              var tmp_7 = this;
              throw this.m5z_1;
            } else {
              throw this.kd_1;
            }

          case 10:
            this.id_1 = 25;
            this.n5z_1 = this.kd_1;
            this.f5z_1.n();
            throw this.n5z_1;
          case 11:
            this.id_1 = 25;
            this.f5z_1.n();
            if (false) {
              this.hd_1 = 2;
              continue $sm;
            }

            this.hd_1 = 12;
            continue $sm;
          case 12:
            this.hd_1 = 13;
            suspendResult = getSqliteDoorReceiveViewNames(this.c5z_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 13:
            this.o5z_1 = suspendResult;
            this.hd_1 = 14;
            continue $sm;
          case 14:
            var tmp_8 = this;
            tmp_8.q5z_1 = this.c5z_1.y60();
            this.hd_1 = 15;
            continue $sm;
          case 15:
            this.hd_1 = 16;
            continue $sm;
          case 16:
            this.id_1 = 22;
            this.id_1 = 21;
            var tmp_9 = this;
            tmp_9.s5z_1 = this.q5z_1;
            var tmp_10 = this;
            tmp_10.t5z_1 = this.o5z_1;
            this.u5z_1 = this.t5z_1.w();
            this.hd_1 = 17;
            continue $sm;
          case 17:
            if (!this.u5z_1.f()) {
              this.hd_1 = 19;
              continue $sm;
            }

            this.v5z_1 = this.u5z_1.e();
            var tmp_11 = this;
            tmp_11.w5z_1 = this.v5z_1;
            this.hd_1 = 18;
            suspendResult = executeUpdateAsync(this.s5z_1, 'DROP VIEW ' + this.w5z_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 18:
            this.hd_1 = 17;
            continue $sm;
          case 19:
            this.r5z_1 = Unit_instance;
            this.id_1 = 25;
            this.hd_1 = 20;
            var tmp_12 = this;
            continue $sm;
          case 20:
            this.id_1 = 25;
            var tmp_13 = this;
            this.q5z_1.n();
            tmp_13.p5z_1 = Unit_instance;
            this.hd_1 = 24;
            continue $sm;
          case 21:
            this.id_1 = 22;
            var tmp_14 = this.kd_1;
            if (tmp_14 instanceof Exception) {
              var e = this.kd_1;
              var tmp_15 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 22:
            this.id_1 = 25;
            var t = this.kd_1;
            this.q5z_1.n();
            throw t;
          case 23:
            this.id_1 = 25;
            this.q5z_1.n();
            if (false) {
              this.hd_1 = 14;
              continue $sm;
            }

            this.hd_1 = 24;
            continue $sm;
          case 24:
            return Unit_instance;
          case 25:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 25) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.f60_1 = _this__u8e3s4;
  }
  protoOf($getSqliteDoorTriggerNamesCOROUTINE$10).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 8;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.h60_1 = this.f60_1.i5i("\n        SELECT name\n                  FROM sqlite_master\n                 WHERE type = 'trigger'\n                   AND name LIKE ?\n    ");
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 7;
            this.id_1 = 6;
            var tmp_1 = this;
            tmp_1.j60_1 = this.h60_1;
            this.j60_1.y5h(1, '_d' + '%');
            this.hd_1 = 4;
            suspendResult = executeQueryAsyncKmp(this.j60_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var ARGUMENT = suspendResult;
            var tmp_2 = this;
            tmp_2.i60_1 = useResults(ARGUMENT, getSqliteDoorTriggerNames$lambda);
            this.id_1 = 8;
            this.hd_1 = 5;
            var tmp_3 = this;
            continue $sm;
          case 5:
            var tmp_4 = this.i60_1;
            this.id_1 = 8;
            this.h60_1.n();
            this.g60_1 = tmp_4;
            this.hd_1 = 10;
            continue $sm;
          case 6:
            this.id_1 = 7;
            var tmp_5 = this.kd_1;
            if (tmp_5 instanceof Exception) {
              var e = this.kd_1;
              var tmp_6 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 7:
            this.id_1 = 8;
            var t = this.kd_1;
            this.h60_1.n();
            throw t;
          case 8:
            throw this.kd_1;
          case 9:
            this.id_1 = 8;
            this.h60_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 10;
            continue $sm;
          case 10:
            var this_0 = this.g60_1;
            var destination = ArrayList_init_$Create$();
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var element = tmp0_iterator.e();
              if (element == null)
                null;
              else {
                destination.i1(element);
              }
            }

            return destination;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 8) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.s60_1 = _this__u8e3s4;
  }
  protoOf($getSqliteDoorReceiveViewNamesCOROUTINE$11).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 8;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.u60_1 = this.s60_1.i5i("\n        SELECT name\n          FROM sqlite_master\n         WHERE type = 'view'\n           AND name LIKE ?\n    ");
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 7;
            this.id_1 = 6;
            var tmp_1 = this;
            tmp_1.w60_1 = this.u60_1;
            this.w60_1.y5h(1, '%' + '_ReceiveView');
            this.hd_1 = 4;
            suspendResult = executeQueryAsyncKmp(this.w60_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var ARGUMENT = suspendResult;
            var tmp_2 = this;
            tmp_2.v60_1 = useResults(ARGUMENT, getSqliteDoorReceiveViewNames$lambda);
            this.id_1 = 8;
            this.hd_1 = 5;
            var tmp_3 = this;
            continue $sm;
          case 5:
            var tmp_4 = this.v60_1;
            this.id_1 = 8;
            this.u60_1.n();
            this.t60_1 = tmp_4;
            this.hd_1 = 10;
            continue $sm;
          case 6:
            this.id_1 = 7;
            var tmp_5 = this.kd_1;
            if (tmp_5 instanceof Exception) {
              var e = this.kd_1;
              var tmp_6 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 7:
            this.id_1 = 8;
            var t = this.kd_1;
            this.u60_1.n();
            throw t;
          case 8:
            throw this.kd_1;
          case 9:
            this.id_1 = 8;
            this.u60_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 10;
            continue $sm;
          case 10:
            var this_0 = this.t60_1;
            var destination = ArrayList_init_$Create$();
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var element = tmp0_iterator.e();
              if (element == null)
                null;
              else {
                destination.i1(element);
              }
            }

            return destination;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 8) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function DoorConstants() {
    this.z60_1 = 'text/plain';
    this.a61_1 = 'application/json';
    this.b61_1 = 'door-dbversion';
    this.c61_1 = 'door-node';
    this.d61_1 = 'door-node-id';
    this.e61_1 = '_doorwayinfo';
    this.f61_1 = '/*psql';
    this.g61_1 = '--notpsql';
    this.h61_1 = '--endnotpsql';
    this.i61_1 = '_ReceiveView';
    this.j61_1 = 'door-paging-end-reached';
  }
  var DoorConstants_instance;
  function DoorConstants_getInstance() {
    return DoorConstants_instance;
  }
  function DoorDatabaseCallbackStatementList() {
  }
  function DoorDatabaseCallbackSync() {
  }
  function DoorDatabaseJdbc() {
  }
  function DoorDatabaseRepository() {
  }
  function DoorDatabaseWrapper() {
  }
  function Companion_1() {
    Companion_instance_1 = this;
    this.p5i_1 = 1;
    this.q5i_1 = 2;
    this.r5i_1 = listOf_0([1, 2]);
    this.s5i_1 = mapOf([to('PostgreSQL', 2), to('SQLite', 1)]);
    var tmp = this;
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.s5i_1.o2();
    // Inline function 'kotlin.collections.mapTo' call
    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();
      // Inline function 'com.ustadmobile.door.Companion.PRODUCT_INT_TO_NAME_MAP.<anonymous>' call
      var tmp$ret$0 = to(Companion_getInstance_3().s5i_1.q(item), item);
      destination.i1(tmp$ret$0);
    }
    tmp.t5i_1 = toMap(destination);
  }
  protoOf(Companion_1).u5i = function (productName) {
    var tmp0_elvis_lhs = this.s5i_1.q(productName);
    return tmp0_elvis_lhs == null ? -1 : tmp0_elvis_lhs;
  };
  var Companion_instance_1;
  function Companion_getInstance_3() {
    if (Companion_instance_1 == null)
      new Companion_1();
    return Companion_instance_1;
  }
  function unwrapTime(_this__u8e3s4, $this) {
    return _this__u8e3s4.sc(32);
  }
  function unwrapSeqNum(_this__u8e3s4, $this) {
    return _this__u8e3s4.uc(toLong(IntCompanionObject_instance.MAX_VALUE));
  }
  function generateId($this, currentTimestamp, nodeId, seqNum) {
    return currentTimestamp.rc(32).vc(nodeId.rc(12)).vc(seqNum);
  }
  function $nextIdAsyncCOROUTINE$12(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.x61_1 = _this__u8e3s4;
  }
  protoOf($nextIdAsyncCOROUTINE$12).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            var tmp_0 = this;
            this.x61_1.b62_1;
            var this_0 = this.x61_1.a62_1;
            var tmp$ret$0;
            l$ret$1: do {
              while (true) {
                var cur = this_0.kotlinx$atomicfu$value;
                var lastTimestamp = cur.sc(32);
                var lastSeq = cur.uc(toLong(IntCompanionObject_instance.MAX_VALUE));
                var this_1 = systemTimeInMillis().bb(toLong(1000));
                var other = 1577836800;
                var newTimestamp = this_1.mc(toLong(other));
                var tmp_1;
                if (newTimestamp.c7(lastTimestamp) > 0) {
                  tmp_1 = new Long(0, 0);
                } else {
                  tmp_1 = lastSeq.lc(toLong(1));
                }
                var newSeq = tmp_1;
                var upd = newTimestamp.rc(32).vc(newSeq);
                if (this_0.atomicfu$compareAndSet(cur, upd)) {
                  tmp$ret$0 = upd;
                  break l$ret$1;
                }
              }
            }
             while (false);
            tmp_0.y61_1 = tmp$ret$0;
            this.z61_1 = unwrapSeqNum(this.y61_1, this.x61_1);
            if (this.z61_1.c7(toLong(Companion_getInstance_4().j62_1)) < 0) {
              return generateId(this.x61_1, unwrapTime(this.y61_1, this.x61_1), toLong(this.x61_1.b62_1.o61()), this.z61_1);
            } else {
              this.hd_1 = 1;
              var this_2 = systemTimeInMillis();
              suspendResult = delay(numberToLong(1001).mc(this_2.nc(toLong(1000))), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            return this.x61_1.l62();
          case 2:
            return Unit_instance;
          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 TablePrimaryKeyManager($outer) {
    this.b62_1 = $outer;
    this.a62_1 = atomic$long$1(new Long(0, 0));
  }
  protoOf(TablePrimaryKeyManager).l62 = function () {
    // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum' call
    this.b62_1;
    var this_0 = this.a62_1;
    var tmp$ret$5;
    $l$block: {
      // Inline function 'kotlinx.atomicfu.updateAndGet' call
      while (true) {
        var cur = this_0.kotlinx$atomicfu$value;
        // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum.<anonymous>' call
        var lastTimestamp = cur.sc(32);
        var lastSeq = cur.uc(toLong(IntCompanionObject_instance.MAX_VALUE));
        // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.timestamp' call
        // Inline function 'kotlin.Long.minus' call
        // Inline function 'kotlin.Long.div' call
        var this_1 = systemTimeInMillis().bb(toLong(1000));
        var other = 1577836800;
        var newTimestamp = this_1.mc(toLong(other));
        var tmp;
        if (newTimestamp.c7(lastTimestamp) > 0) {
          tmp = new Long(0, 0);
        } else {
          // Inline function 'kotlin.Long.plus' call
          tmp = lastSeq.lc(toLong(1));
        }
        var newSeq = tmp;
        var upd = newTimestamp.rc(32).vc(newSeq);
        if (this_0.atomicfu$compareAndSet(cur, upd)) {
          tmp$ret$5 = upd;
          break $l$block;
        }
      }
    }
    var nextWrappedId = tmp$ret$5;
    var seqNum = unwrapSeqNum(nextWrappedId, this);
    if (seqNum.c7(toLong(Companion_getInstance_4().j62_1)) < 0) {
      return generateId(this, unwrapTime(nextWrappedId, this), toLong(this.b62_1.o61()), seqNum);
    } else {
      // Inline function 'kotlin.Long.rem' call
      var tmp$ret$7 = systemTimeInMillis().nc(toLong(1000));
      waitBlocking(numberToLong(1001).mc(tmp$ret$7));
      return this.l62();
    }
  };
  protoOf(TablePrimaryKeyManager).m62 = function ($completion) {
    var tmp = new $nextIdAsyncCOROUTINE$12(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function Companion_2() {
    Companion_instance_2 = this;
    this.e62_1 = 1;
    this.f62_1 = 31;
    this.g62_1 = 20;
    this.h62_1 = 12;
    var tmp = this;
    // Inline function 'kotlin.math.pow' call
    var tmp$ret$0 = Math.pow(2.0, 20);
    tmp.i62_1 = numberToInt(tmp$ret$0);
    var tmp_0 = this;
    // Inline function 'kotlin.math.pow' call
    var tmp$ret$1 = Math.pow(2.0, 12);
    tmp_0.j62_1 = numberToInt(tmp$ret$1);
    this.k62_1 = 1577836800;
  }
  var Companion_instance_2;
  function Companion_getInstance_4() {
    if (Companion_instance_2 == null)
      new Companion_2();
    return Companion_instance_2;
  }
  function DoorPrimaryKeyManager$nodeId$delegate$lambda() {
    return generateDoorNodeId(Companion_getInstance_4().i62_1);
  }
  function DoorPrimaryKeyManager(tableIdList) {
    Companion_getInstance_4();
    this.c62_1 = threadSafeMapOf([]);
    var tmp = this;
    var tmp_0 = LazyThreadSafetyMode_NONE_getInstance();
    tmp.d62_1 = lazy(tmp_0, DoorPrimaryKeyManager$nodeId$delegate$lambda);
    // Inline function 'kotlin.collections.forEach' call
    var tmp0_iterator = tableIdList.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.<anonymous>' call
      // Inline function 'kotlin.collections.set' call
      var this_0 = this.c62_1;
      var value = new TablePrimaryKeyManager(this);
      this_0.s(element, value);
    }
  }
  protoOf(DoorPrimaryKeyManager).o61 = function () {
    // Inline function 'kotlin.getValue' call
    var this_0 = this.d62_1;
    nodeId$factory();
    return this_0.t2();
  };
  protoOf(DoorPrimaryKeyManager).n62 = function (tableId) {
    return ensureNotNull(this.c62_1.q(tableId)).l62();
  };
  protoOf(DoorPrimaryKeyManager).o62 = function (tableId, $completion) {
    return ensureNotNull(this.c62_1.q(tableId)).m62($completion);
  };
  function nodeId$factory() {
    return getPropertyCallableRef('nodeId', 1, KProperty1, function (receiver) {
      return receiver.o61();
    }, null);
  }
  function JdbcArrayProxyCommon(typeName, objects) {
    this.e5i_1 = typeName;
    this.f5i_1 = objects;
    switch (this.e5i_1) {
      case 'INTEGER':
        this.g5i_1 = TypesKmp_instance.j5h_1;
        break;
      case 'VARCHAR':
        this.g5i_1 = TypesKmp_instance.l5h_1;
        break;
      case 'BIGINT':
        this.g5i_1 = TypesKmp_instance.m5h_1;
        break;
      case 'SHORT':
        this.g5i_1 = TypesKmp_instance.q5h_1;
        break;
      case 'BOOLEAN':
        this.g5i_1 = TypesKmp_instance.k5h_1;
        break;
      case 'TEXT':
        this.g5i_1 = TypesKmp_instance.r5h_1;
        break;
      default:
        throw IllegalStateException_init_$Create$('JdbcArrayProxyCommon: Unsupported type: ' + this.e5i_1);
    }
  }
  protoOf(JdbcArrayProxyCommon).h5i = function () {
    return this.g5i_1;
  };
  function NotSupportedException(message, cause) {
    message = message === VOID ? null : message;
    cause = cause === VOID ? null : cause;
    RuntimeException_init_$Init$(message, cause, this);
    captureStack(this, NotSupportedException);
  }
  function Companion_3() {
    this.p62_1 = 10;
  }
  var Companion_instance_3;
  function Companion_getInstance_5() {
    return Companion_instance_3;
  }
  function PreparedStatementConfig(sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly) {
    hasListParams = hasListParams === VOID ? false : hasListParams;
    generatedKeys = generatedKeys === VOID ? StatementConstantsKmp_instance.y5g_1 : generatedKeys;
    timeoutSeconds = timeoutSeconds === VOID ? 10 : timeoutSeconds;
    postgreSql = postgreSql === VOID ? null : postgreSql;
    readOnly = readOnly === VOID ? false : readOnly;
    this.b5k_1 = sql;
    this.c5k_1 = hasListParams;
    this.d5k_1 = generatedKeys;
    this.e5k_1 = timeoutSeconds;
    this.f5k_1 = postgreSql;
    this.g5k_1 = readOnly;
  }
  protoOf(PreparedStatementConfig).toString = function () {
    return 'PreparedStatementConfig(sql=' + this.b5k_1 + ', hasListParams=' + this.c5k_1 + ', generatedKeys=' + this.d5k_1 + ', timeoutSeconds=' + this.e5k_1 + ', postgreSql=' + this.f5k_1 + ', readOnly=' + this.g5k_1 + ')';
  };
  protoOf(PreparedStatementConfig).hashCode = function () {
    var result = getStringHashCode(this.b5k_1);
    result = imul(result, 31) + getBooleanHashCode(this.c5k_1) | 0;
    result = imul(result, 31) + this.d5k_1 | 0;
    result = imul(result, 31) + this.e5k_1 | 0;
    result = imul(result, 31) + (this.f5k_1 == null ? 0 : getStringHashCode(this.f5k_1)) | 0;
    result = imul(result, 31) + getBooleanHashCode(this.g5k_1) | 0;
    return result;
  };
  protoOf(PreparedStatementConfig).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof PreparedStatementConfig))
      return false;
    var tmp0_other_with_cast = other instanceof PreparedStatementConfig ? other : THROW_CCE();
    if (!(this.b5k_1 === tmp0_other_with_cast.b5k_1))
      return false;
    if (!(this.c5k_1 === tmp0_other_with_cast.c5k_1))
      return false;
    if (!(this.d5k_1 === tmp0_other_with_cast.d5k_1))
      return false;
    if (!(this.e5k_1 === tmp0_other_with_cast.e5k_1))
      return false;
    if (!(this.f5k_1 == tmp0_other_with_cast.f5k_1))
      return false;
    if (!(this.g5k_1 === tmp0_other_with_cast.g5k_1))
      return false;
    return true;
  };
  function RepositoryHelper(db, repoConfig) {
    this.q62_1 = db;
    this.r62_1 = repoConfig;
    this.s62_1 = atomic$int$1(0);
    this.t62_1 = concurrentSafeListOf([]);
    this.u62_1 = CoroutineScope_0(Dispatchers_getInstance().p12_1.lj(Job()));
    this.v62_1 = get_doorWrapper(this.q62_1).n61();
    this.w62_1 = DoorRepositoryReplicationClient_init_$Create$(this.q62_1, this.r62_1, this.u62_1, this.v62_1, 1000);
    this.x62_1 = new NodeEventSseClient(this.r62_1, this.v62_1, this.u62_1);
  }
  protoOf(RepositoryHelper).m61 = function () {
    return this.w62_1.m61();
  };
  function Companion_4() {
    this.w63_1 = '\n            (SELECT COALESCE(\n                    (SELECT nodeClientId \n                       FROM SyncNode \n                      LIMIT 1), 0))\n        ';
  }
  var Companion_instance_4;
  function Companion_getInstance_6() {
    return Companion_instance_4;
  }
  function $serializer() {
    $serializer_instance = this;
    var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.SyncNode', this, 1);
    tmp0_serialDesc.t4f('nodeClientId', true);
    this.x63_1 = tmp0_serialDesc;
  }
  protoOf($serializer).q44 = function () {
    return this.x63_1;
  };
  protoOf($serializer).k4g = function () {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return [LongSerializer_getInstance()];
  };
  protoOf($serializer).s44 = function (decoder) {
    var tmp0_desc = this.x63_1;
    var tmp1_flag = true;
    var tmp2_index = 0;
    var tmp3_bitMask0 = 0;
    var tmp4_local0 = new Long(0, 0);
    var tmp5_input = decoder.i48(tmp0_desc);
    if (tmp5_input.x48()) {
      tmp4_local0 = tmp5_input.o48(tmp0_desc, 0);
      tmp3_bitMask0 = tmp3_bitMask0 | 1;
    } else
      while (tmp1_flag) {
        tmp2_index = tmp5_input.y48(tmp0_desc);
        switch (tmp2_index) {
          case -1:
            tmp1_flag = false;
            break;
          case 0:
            tmp4_local0 = tmp5_input.o48(tmp0_desc, 0);
            tmp3_bitMask0 = tmp3_bitMask0 | 1;
            break;
          default:
            throw UnknownFieldException_init_$Create$(tmp2_index);
        }
      }
    tmp5_input.j48(tmp0_desc);
    return SyncNode_init_$Create$(tmp3_bitMask0, tmp4_local0, null);
  };
  protoOf($serializer).y63 = function (encoder, value) {
    var tmp0_desc = this.x63_1;
    var tmp1_output = encoder.i48(tmp0_desc);
    if (tmp1_output.e4a(tmp0_desc, 0) ? true : !value.z63_1.equals(new Long(0, 0))) {
      tmp1_output.s49(tmp0_desc, 0, value.z63_1);
    }
    tmp1_output.j48(tmp0_desc);
  };
  protoOf($serializer).r44 = function (encoder, value) {
    return this.y63(encoder, value instanceof SyncNode ? value : THROW_CCE());
  };
  var $serializer_instance;
  function $serializer_getInstance() {
    if ($serializer_instance == null)
      new $serializer();
    return $serializer_instance;
  }
  function SyncNode_init_$Init$(seen1, nodeClientId, serializationConstructorMarker, $this) {
    if (!(0 === (0 & seen1))) {
      throwMissingFieldException(seen1, 0, $serializer_getInstance().x63_1);
    }
    if (0 === (seen1 & 1))
      $this.z63_1 = new Long(0, 0);
    else
      $this.z63_1 = nodeClientId;
    return $this;
  }
  function SyncNode_init_$Create$(seen1, nodeClientId, serializationConstructorMarker) {
    return SyncNode_init_$Init$(seen1, nodeClientId, serializationConstructorMarker, objectCreate(protoOf(SyncNode)));
  }
  function SyncNode(nodeClientId) {
    nodeClientId = nodeClientId === VOID ? new Long(0, 0) : nodeClientId;
    this.z63_1 = nodeClientId;
  }
  protoOf(SyncNode).toString = function () {
    return 'SyncNode(nodeClientId=' + this.z63_1.toString() + ')';
  };
  protoOf(SyncNode).hashCode = function () {
    return this.z63_1.hashCode();
  };
  protoOf(SyncNode).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof SyncNode))
      return false;
    var tmp0_other_with_cast = other instanceof SyncNode ? other : THROW_CCE();
    if (!this.z63_1.equals(tmp0_other_with_cast.z63_1))
      return false;
    return true;
  };
  function generateSetSyncNodeSql($this) {
    return listOf_0(['DELETE FROM SyncNode', '\n            INSERT INTO SyncNode(nodeClientId)\n                    VALUES (' + $this.a64_1.toString() + ') \n            ']);
  }
  function SyncNodeIdCallback(nodeId) {
    this.a64_1 = nodeId;
  }
  protoOf(SyncNodeIdCallback).k61 = function (db) {
    return generateSetSyncNodeSql(this);
  };
  protoOf(SyncNodeIdCallback).l61 = function (db) {
    // Inline function 'kotlin.collections.listOf' call
    return emptyList();
  };
  var RemoteInsertStrategy_CALLBACK_instance;
  var RemoteInsertStrategy_INSERT_instance;
  var RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance;
  var RemoteInsertStrategy_entriesInitialized;
  function RemoteInsertStrategy_initEntries() {
    if (RemoteInsertStrategy_entriesInitialized)
      return Unit_instance;
    RemoteInsertStrategy_entriesInitialized = true;
    RemoteInsertStrategy_CALLBACK_instance = new RemoteInsertStrategy('CALLBACK', 0);
    RemoteInsertStrategy_INSERT_instance = new RemoteInsertStrategy('INSERT', 1);
    RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance = new RemoteInsertStrategy('INSERT_INTO_RECEIVE_VIEW', 2);
  }
  function RemoteInsertStrategy(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance() {
    RemoteInsertStrategy_initEntries();
    return RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance;
  }
  var Event_INSERT_instance;
  var Event_UPDATE_instance;
  var Event_DELETE_instance;
  var Event_entriesInitialized;
  function Event_initEntries() {
    if (Event_entriesInitialized)
      return Unit_instance;
    Event_entriesInitialized = true;
    Event_INSERT_instance = new Event('INSERT', 0, 'INSERT');
    Event_UPDATE_instance = new Event('UPDATE', 1, 'UPDATE');
    Event_DELETE_instance = new Event('DELETE', 2, 'DELETE');
  }
  var Order_AFTER_instance;
  var Order_BEFORE_instance;
  var Order_INSTEAD_OF_instance;
  var Order_entriesInitialized;
  function Order_initEntries() {
    if (Order_entriesInitialized)
      return Unit_instance;
    Order_entriesInitialized = true;
    Order_AFTER_instance = new Order('AFTER', 0, 'AFTER');
    Order_BEFORE_instance = new Order('BEFORE', 1, 'BEFORE');
    Order_INSTEAD_OF_instance = new Order('INSTEAD_OF', 2, 'INSTEAD OF');
  }
  var On_ENTITY_instance;
  var On_RECEIVEVIEW_instance;
  var On_entriesInitialized;
  function On_initEntries() {
    if (On_entriesInitialized)
      return Unit_instance;
    On_entriesInitialized = true;
    On_ENTITY_instance = new On('ENTITY', 0);
    On_RECEIVEVIEW_instance = new On('RECEIVEVIEW', 1);
  }
  function Event(name, ordinal, sqlKeyWord) {
    Enum.call(this, name, ordinal);
    this.d64_1 = sqlKeyWord;
  }
  function Order(name, ordinal, sqlStr) {
    Enum.call(this, name, ordinal);
    this.g64_1 = sqlStr;
  }
  function On(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function Companion_5() {
    this.h64_1 = '_d';
  }
  var Companion_instance_5;
  function Companion_getInstance_7() {
    return Companion_instance_5;
  }
  function Event_INSERT_getInstance() {
    Event_initEntries();
    return Event_INSERT_instance;
  }
  function Order_AFTER_getInstance() {
    Order_initEntries();
    return Order_AFTER_instance;
  }
  function Order_INSTEAD_OF_getInstance() {
    Order_initEntries();
    return Order_INSTEAD_OF_instance;
  }
  function On_ENTITY_getInstance() {
    On_initEntries();
    return On_ENTITY_instance;
  }
  function On_RECEIVEVIEW_getInstance() {
    On_initEntries();
    return On_RECEIVEVIEW_instance;
  }
  function Trigger(name, order, events, on, sqlStatements, postgreSqlStatements, conditionSql, conditionSqlPostgres) {
    on = on === VOID ? On_ENTITY_getInstance() : on;
    postgreSqlStatements = postgreSqlStatements === VOID ? [] : postgreSqlStatements;
    conditionSql = conditionSql === VOID ? '' : conditionSql;
    conditionSqlPostgres = conditionSqlPostgres === VOID ? '' : conditionSqlPostgres;
    this.i64_1 = name;
    this.j64_1 = order;
    this.k64_1 = events;
    this.l64_1 = on;
    this.m64_1 = sqlStatements;
    this.n64_1 = postgreSqlStatements;
    this.o64_1 = conditionSql;
    this.p64_1 = conditionSqlPostgres;
  }
  protoOf(Trigger).equals = function (other) {
    if (!(other instanceof Trigger))
      return false;
    var tmp0_other_with_cast = other instanceof Trigger ? other : THROW_CCE();
    if (!(this.i64_1 === tmp0_other_with_cast.i64_1))
      return false;
    if (!this.j64_1.equals(tmp0_other_with_cast.j64_1))
      return false;
    if (!contentEquals(this.k64_1, tmp0_other_with_cast.k64_1))
      return false;
    if (!this.l64_1.equals(tmp0_other_with_cast.l64_1))
      return false;
    if (!contentEquals(this.m64_1, tmp0_other_with_cast.m64_1))
      return false;
    if (!contentEquals(this.n64_1, tmp0_other_with_cast.n64_1))
      return false;
    if (!(this.o64_1 === tmp0_other_with_cast.o64_1))
      return false;
    if (!(this.p64_1 === tmp0_other_with_cast.p64_1))
      return false;
    return true;
  };
  protoOf(Trigger).hashCode = function () {
    var result = imul(getStringHashCode('name'), 127) ^ getStringHashCode(this.i64_1);
    result = result + (imul(getStringHashCode('order'), 127) ^ this.j64_1.hashCode()) | 0;
    result = result + (imul(getStringHashCode('events'), 127) ^ hashCode(this.k64_1)) | 0;
    result = result + (imul(getStringHashCode('on'), 127) ^ this.l64_1.hashCode()) | 0;
    result = result + (imul(getStringHashCode('sqlStatements'), 127) ^ hashCode(this.m64_1)) | 0;
    result = result + (imul(getStringHashCode('postgreSqlStatements'), 127) ^ hashCode(this.n64_1)) | 0;
    result = result + (imul(getStringHashCode('conditionSql'), 127) ^ getStringHashCode(this.o64_1)) | 0;
    result = result + (imul(getStringHashCode('conditionSqlPostgres'), 127) ^ getStringHashCode(this.p64_1)) | 0;
    return result;
  };
  protoOf(Trigger).toString = function () {
    return '@com.ustadmobile.door.annotation.Trigger(name=' + this.i64_1 + ', order=' + this.j64_1 + ', events=' + toString(this.k64_1) + ', on=' + this.l64_1 + ', sqlStatements=' + toString(this.m64_1) + ', postgreSqlStatements=' + toString(this.n64_1) + ', conditionSql=' + this.o64_1 + ', conditionSqlPostgres=' + this.p64_1 + ')';
  };
  function NodeIdAndAuth(nodeId, auth) {
    this.q64_1 = nodeId;
    this.r64_1 = auth;
  }
  protoOf(NodeIdAndAuth).toString = function () {
    return 'NodeIdAndAuth(nodeId=' + this.q64_1.toString() + ', auth=' + this.r64_1 + ')';
  };
  protoOf(NodeIdAndAuth).hashCode = function () {
    var result = this.q64_1.hashCode();
    result = imul(result, 31) + getStringHashCode(this.r64_1) | 0;
    return result;
  };
  protoOf(NodeIdAndAuth).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof NodeIdAndAuth))
      return false;
    var tmp0_other_with_cast = other instanceof NodeIdAndAuth ? other : THROW_CCE();
    if (!this.q64_1.equals(tmp0_other_with_cast.q64_1))
      return false;
    if (!(this.r64_1 === tmp0_other_with_cast.r64_1))
      return false;
    return true;
  };
  function OutgoingReplication(orUid, destNodeId, orTableId, orPk1, orPk2, orPk3, orPk4) {
    orUid = orUid === VOID ? new Long(0, 0) : orUid;
    destNodeId = destNodeId === VOID ? new Long(0, 0) : destNodeId;
    orTableId = orTableId === VOID ? 0 : orTableId;
    orPk1 = orPk1 === VOID ? new Long(0, 0) : orPk1;
    orPk2 = orPk2 === VOID ? new Long(0, 0) : orPk2;
    orPk3 = orPk3 === VOID ? new Long(0, 0) : orPk3;
    orPk4 = orPk4 === VOID ? new Long(0, 0) : orPk4;
    this.s64_1 = orUid;
    this.t64_1 = destNodeId;
    this.u64_1 = orTableId;
    this.v64_1 = orPk1;
    this.w64_1 = orPk2;
    this.x64_1 = orPk3;
    this.y64_1 = orPk4;
  }
  function get_rootDatabase(_this__u8e3s4) {
    var db = _this__u8e3s4;
    $l$loop: while (true) {
      var tmp0_elvis_lhs = get_sourceDatabase(db);
      var tmp;
      if (tmp0_elvis_lhs == null) {
        break $l$loop;
      } else {
        tmp = tmp0_elvis_lhs;
      }
      db = tmp;
    }
    return db;
  }
  function prepareAndUseStatementAsync_0(_this__u8e3s4, sql, readOnly, block, $completion) {
    readOnly = readOnly === VOID ? false : readOnly;
    return prepareAndUseStatementAsync(_this__u8e3s4, new PreparedStatementConfig(sql, VOID, VOID, VOID, VOID, readOnly), block, $completion);
  }
  function Companion_6() {
    this.z64_1 = '_DoorMetadata';
  }
  var Companion_instance_6;
  function Companion_getInstance_8() {
    return Companion_instance_6;
  }
  function DoorDatabaseMetadata() {
  }
  protoOf(DoorDatabaseMetadata).b65 = function () {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.a65().p2();
    // Inline function 'kotlin.collections.mapTo' call
    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();
      // Inline function 'com.ustadmobile.door.ext.DoorDatabaseMetadata.<get-replicateTableNames>.<anonymous>' call
      var tmp$ret$0 = item.d65_1;
      destination.i1(tmp$ret$0);
    }
    return destination;
  };
  protoOf(DoorDatabaseMetadata).m65 = function (tableId) {
    var tmp0_elvis_lhs = this.a65().q(tableId);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('No metadata for table id ' + tableId);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  function Companion_7() {
    this.o65_1 = 1;
    this.p65_1 = 2;
    this.q65_1 = 4;
    this.r65_1 = 'DoorLog';
  }
  var Companion_instance_7;
  function Companion_getInstance_9() {
    return Companion_instance_7;
  }
  function setBodyJson(_this__u8e3s4, json, serializer, value, contentType) {
    contentType = contentType === VOID ? Application_getInstance().v2r_1 : contentType;
    // Inline function 'io.ktor.client.request.setBody' call
    var body = new TextContent(json.r45(serializer, value), contentType);
    if (body == null) {
      _this__u8e3s4.y38_1 = NullBody_instance;
      // Inline function 'io.ktor.util.reflect.typeInfo' call
      var tmp = JsType_instance;
      var tmp_0 = getKClass(TextContent);
      // Inline function 'io.ktor.util.reflect.tryGetType' call
      var tmp_1;
      try {
        tmp_1 = createKType(getKClass(TextContent), arrayOf([]), false);
      } catch ($p) {
        var tmp_2;
        if ($p instanceof Error) {
          var cause = $p;
          tmp_2 = null;
        } else {
          throw $p;
        }
        tmp_1 = tmp_2;
      }
      var tmp$ret$0 = tmp_1;
      var tmp$ret$1 = typeInfoImpl(tmp, tmp_0, tmp$ret$0);
      _this__u8e3s4.v3e(tmp$ret$1);
    } else {
      if (body instanceof OutgoingContent) {
        _this__u8e3s4.y38_1 = body;
        _this__u8e3s4.v3e(null);
      } else {
        _this__u8e3s4.y38_1 = body;
        // Inline function 'io.ktor.util.reflect.typeInfo' call
        var tmp_3 = JsType_instance;
        var tmp_4 = getKClass(TextContent);
        // Inline function 'io.ktor.util.reflect.tryGetType' call
        var tmp_5;
        try {
          tmp_5 = createKType(getKClass(TextContent), arrayOf([]), false);
        } catch ($p) {
          var tmp_6;
          if ($p instanceof Error) {
            var cause_0 = $p;
            tmp_6 = null;
          } else {
            throw $p;
          }
          tmp_5 = tmp_6;
        }
        var tmp$ret$2 = tmp_5;
        var tmp$ret$3 = typeInfoImpl(tmp_3, tmp_4, tmp$ret$2);
        _this__u8e3s4.v3e(tmp$ret$3);
      }
    }
  }
  function doorNodeIdHeader(_this__u8e3s4, repo) {
    header(_this__u8e3s4, 'door-node', repo.j39().v65_1.toString() + '/' + repo.j39().u65_1);
  }
  function doorNodeIdHeader_0(_this__u8e3s4, nodeId, auth) {
    header(_this__u8e3s4, 'door-node', nodeId.toString() + '/' + auth);
  }
  function setRepoUrl(_this__u8e3s4, repoEndpoint, repoPath) {
    _this__u8e3s4.b3v(setRepoUrl$lambda(repoEndpoint, repoPath));
  }
  function setRepoUrl_0(_this__u8e3s4, repositoryConfig, repoPath) {
    return setRepoUrl(_this__u8e3s4, repositoryConfig.t65_1, repoPath);
  }
  function pagingSourceLoadParameters(_this__u8e3s4, json, keySerializer, loadParams) {
    var loadParamType = Companion_instance_8.a66(getKClassFromExpression(loadParams));
    parameter(_this__u8e3s4, 'pagingLoadParamType', loadParamType.ya_1);
    parameter(_this__u8e3s4, 'pagingKey', json.r45(keySerializer, loadParams.s2()));
    parameter(_this__u8e3s4, 'pagingBatchSize', loadParams.h54_1);
  }
  function doorNodeAndVersionHeaders(_this__u8e3s4, repo) {
    dbVersionHeader(_this__u8e3s4, repo.x5i());
    doorNodeIdHeader(_this__u8e3s4, repo);
  }
  var LoadParamType_REFRESH_instance;
  var LoadParamType_PREPEND_instance;
  var LoadParamType_APPEND_instance;
  function Companion_8() {
  }
  protoOf(Companion_8).a66 = function (paramClass) {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.first' call
      var tmp0_iterator = get_entries().w();
      while (tmp0_iterator.f()) {
        var element = tmp0_iterator.e();
        // Inline function 'com.ustadmobile.door.ext.Companion.paramTypeFor.<anonymous>' call
        if (element.d66_1.equals(paramClass)) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.');
    }
    return tmp$ret$1;
  };
  var Companion_instance_8;
  function Companion_getInstance_10() {
    return Companion_instance_8;
  }
  function values() {
    return [LoadParamType_REFRESH_getInstance(), LoadParamType_PREPEND_getInstance(), LoadParamType_APPEND_getInstance()];
  }
  function get_entries() {
    if ($ENTRIES == null)
      $ENTRIES = enumEntries(values());
    return $ENTRIES;
  }
  var LoadParamType_entriesInitialized;
  function LoadParamType_initEntries() {
    if (LoadParamType_entriesInitialized)
      return Unit_instance;
    LoadParamType_entriesInitialized = true;
    LoadParamType_REFRESH_instance = new LoadParamType('REFRESH', 0, getKClass(Refresh));
    LoadParamType_PREPEND_instance = new LoadParamType('PREPEND', 1, getKClass(Prepend));
    LoadParamType_APPEND_instance = new LoadParamType('APPEND', 2, getKClass(Append));
  }
  var $ENTRIES;
  function LoadParamType(name, ordinal, paramClass) {
    Enum.call(this, name, ordinal);
    this.d66_1 = paramClass;
  }
  function dbVersionHeader(_this__u8e3s4, db) {
    header(_this__u8e3s4, 'door-dbversion', dbSchemaVersion(db));
  }
  function setRepoUrl$lambda($repoEndpoint, $repoPath) {
    return function ($this$url, it) {
      takeFrom($this$url, $repoEndpoint);
      set_encodedPath($this$url, get_encodedPath($this$url) + $repoPath);
      return Unit_instance;
    };
  }
  function LoadParamType_REFRESH_getInstance() {
    LoadParamType_initEntries();
    return LoadParamType_REFRESH_instance;
  }
  function LoadParamType_PREPEND_getInstance() {
    LoadParamType_initEntries();
    return LoadParamType_PREPEND_instance;
  }
  function LoadParamType_APPEND_getInstance() {
    LoadParamType_initEntries();
    return LoadParamType_APPEND_instance;
  }
  function toUrlQueryString(_this__u8e3s4) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _this__u8e3s4.q2();
    // Inline function 'kotlin.collections.mapTo' call
    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();
      // Inline function 'com.ustadmobile.door.ext.toUrlQueryString.<anonymous>' call
      var tmp$ret$0 = urlEncode(item.s2()) + '=' + urlEncode(item.t2());
      destination.i1(tmp$ret$0);
    }
    return joinToString(destination, '&');
  }
  function setAllFromJsonObject(_this__u8e3s4, jsonObject, entityFieldsMetaData, startIndex) {
    startIndex = startIndex === VOID ? 1 : startIndex;
    // Inline function 'kotlin.collections.forEachIndexed' call
    var index = 0;
    var tmp0_iterator = entityFieldsMetaData.w();
    while (tmp0_iterator.f()) {
      var item = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var index_0 = checkIndexOverflow(tmp1);
      var fieldType = item.f66_1;
      var tmp = index_0 + startIndex | 0;
      // Inline function 'kotlin.collections.getOrElse' call
      var key = item.e66_1;
      var tmp0_elvis_lhs = jsonObject.q(key);
      var tmp_0;
      if (tmp0_elvis_lhs == null) {
        // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject.<anonymous>.<anonymous>' call
        tmp_0 = defaultJsonPrimitive(fieldType, item.g66_1);
      } else {
        tmp_0 = tmp0_elvis_lhs;
      }
      var tmp$ret$1 = tmp_0;
      setJsonPrimitive(_this__u8e3s4, tmp, item.f66_1, get_jsonPrimitive(tmp$ret$1));
    }
  }
  function setJsonPrimitive(_this__u8e3s4, index, type, jsonPrimitive) {
    if (jsonPrimitive instanceof JsonNull) {
      _this__u8e3s4.a5i(index, null);
      return Unit_instance;
    }
    if (type === TypesKmp_instance.j5h_1) {
      _this__u8e3s4.u5h(index, get_int(jsonPrimitive));
    } else if (type === TypesKmp_instance.q5h_1) {
      _this__u8e3s4.t5h(index, toShort(get_int(jsonPrimitive)));
    } else if (type === TypesKmp_instance.m5h_1) {
      _this__u8e3s4.v5h(index, get_long(jsonPrimitive));
    } else if (type === TypesKmp_instance.n5h_1) {
      _this__u8e3s4.w5h(index, get_float(jsonPrimitive));
    } else if (type === TypesKmp_instance.o5h_1) {
      _this__u8e3s4.w5h(index, get_float(jsonPrimitive));
    } else if (type === TypesKmp_instance.p5h_1) {
      _this__u8e3s4.x5h(index, get_double(jsonPrimitive));
    } else if (type === TypesKmp_instance.k5h_1) {
      _this__u8e3s4.i5h(index, get_boolean(jsonPrimitive));
    } else if (type === TypesKmp_instance.l5h_1) {
      _this__u8e3s4.y5h(index, jsonPrimitive.g3b());
    } else if (type === TypesKmp_instance.r5h_1) {
      _this__u8e3s4.y5h(index, jsonPrimitive.g3b());
    }
  }
  function defaultJsonPrimitive(type, nullable) {
    return nullable ? JsonNull_getInstance() : (type === TypesKmp_instance.l5h_1 ? true : type === TypesKmp_instance.r5h_1) ? JsonNull_getInstance() : type === TypesKmp_instance.k5h_1 ? JsonPrimitive_0(false) : JsonPrimitive(0);
  }
  function rowToJsonObject(_this__u8e3s4, columns) {
    // Inline function 'kotlin.collections.associate' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(columns, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination = LinkedHashMap_init_$Create$_0(capacity);
    var tmp0_iterator = columns.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'kotlin.collections.plusAssign' call
      // Inline function 'com.ustadmobile.door.ext.rowToJsonObject.<anonymous>' call
      var pair = to(element.h66(), getJsonPrimitive(_this__u8e3s4, element));
      destination.s(pair.w6_1, pair.x6_1);
    }
    return new JsonObject(destination);
  }
  function getJsonPrimitive(_this__u8e3s4, fieldInfo) {
    var colName = fieldInfo.h66();
    var tmp;
    if (fieldInfo.n66()) {
      var tmp0_subject = fieldInfo.i66();
      var tmp_0;
      if (tmp0_subject === TypesKmp_instance.q5h_1) {
        tmp_0 = JsonPrimitive(getShortNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.j5h_1) {
        tmp_0 = JsonPrimitive(getIntNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.m5h_1) {
        tmp_0 = JsonPrimitive(getLongNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.o5h_1) {
        tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.n5h_1) {
        tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.p5h_1) {
        tmp_0 = JsonPrimitive(getDoubleNullable(_this__u8e3s4, colName));
      } else if (tmp0_subject === TypesKmp_instance.l5h_1) {
        tmp_0 = JsonPrimitive_1(_this__u8e3s4.rz(colName));
      } else if (tmp0_subject === TypesKmp_instance.r5h_1) {
        tmp_0 = JsonPrimitive_1(_this__u8e3s4.rz(colName));
      } else if (tmp0_subject === TypesKmp_instance.k5h_1) {
        tmp_0 = JsonPrimitive_0(getBooleanNullable(_this__u8e3s4, colName));
      } else {
        throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.i66());
      }
      tmp = tmp_0;
    } else {
      var tmp1_subject = fieldInfo.i66();
      var tmp_1;
      if (tmp1_subject === TypesKmp_instance.q5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.m66(colName));
      } else if (tmp1_subject === TypesKmp_instance.j5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.x5m(colName));
      } else if (tmp1_subject === TypesKmp_instance.m5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.y5m(colName));
      } else if (tmp1_subject === TypesKmp_instance.o5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.l66(colName));
      } else if (tmp1_subject === TypesKmp_instance.n5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.l66(colName));
      } else if (tmp1_subject === TypesKmp_instance.p5h_1) {
        tmp_1 = JsonPrimitive(_this__u8e3s4.k66(colName));
      } else if (tmp1_subject === TypesKmp_instance.l5h_1) {
        tmp_1 = JsonPrimitive_1(_this__u8e3s4.rz(colName));
      } else if (tmp1_subject === TypesKmp_instance.r5h_1) {
        tmp_1 = JsonPrimitive_1(_this__u8e3s4.rz(colName));
      } else if (tmp1_subject === TypesKmp_instance.k5h_1) {
        tmp_1 = JsonPrimitive_0(_this__u8e3s4.j66(colName));
      } else {
        throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.i66());
      }
      tmp = tmp_1;
    }
    return tmp;
  }
  function get_doorWrapperNodeId(_this__u8e3s4) {
    return get_doorWrapper(_this__u8e3s4).o61();
  }
  function get_doorWrapper(_this__u8e3s4) {
    var tmp;
    if (isInterface(_this__u8e3s4, DoorDatabaseWrapper)) {
      tmp = isInterface(_this__u8e3s4, DoorDatabaseWrapper) ? _this__u8e3s4 : THROW_CCE();
    } else {
      if (isInterface(_this__u8e3s4, DoorDatabaseRepository)) {
        var tmp_0 = _this__u8e3s4.x5i();
        tmp = isInterface(tmp_0, DoorDatabaseWrapper) ? tmp_0 : THROW_CCE();
      } else {
        throw IllegalArgumentException_init_$Create$('Cannot get doorWrapper for ' + _this__u8e3s4 + ' : it is not a wrapper or repository');
      }
    }
    return tmp;
  }
  var Status_INACTIVE_instance;
  var Status_LOADING_instance;
  var Status_DONE_instance;
  var Status_FAILED_instance;
  var Status_entriesInitialized;
  function Status_initEntries() {
    if (Status_entriesInitialized)
      return Unit_instance;
    Status_entriesInitialized = true;
    Status_INACTIVE_instance = new Status('INACTIVE', 0);
    Status_LOADING_instance = new Status('LOADING', 1);
    Status_DONE_instance = new Status('DONE', 2);
    Status_FAILED_instance = new Status('FAILED', 3);
  }
  function Status(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function Status_INACTIVE_getInstance() {
    Status_initEntries();
    return Status_INACTIVE_instance;
  }
  function Status_LOADING_getInstance() {
    Status_initEntries();
    return Status_LOADING_instance;
  }
  function Status_DONE_getInstance() {
    Status_initEntries();
    return Status_DONE_instance;
  }
  function Status_FAILED_getInstance() {
    Status_initEntries();
    return Status_FAILED_instance;
  }
  function FlowLoadingState(status) {
    status = status === VOID ? Status_INACTIVE_getInstance() : status;
    this.o66_1 = status;
  }
  protoOf(FlowLoadingState).p66 = function (status) {
    return new FlowLoadingState(status);
  };
  protoOf(FlowLoadingState).toString = function () {
    return 'FlowLoadingState(status=' + this.o66_1 + ')';
  };
  protoOf(FlowLoadingState).hashCode = function () {
    return this.o66_1.hashCode();
  };
  protoOf(FlowLoadingState).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof FlowLoadingState))
      return false;
    var tmp0_other_with_cast = other instanceof FlowLoadingState ? other : THROW_CCE();
    if (!this.o66_1.equals(tmp0_other_with_cast.o66_1))
      return false;
    return true;
  };
  function RepoDaoFlowHelper$asRepoFlow$slambda$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) {
    this.y66_1 = $statusFlow;
    this.z66_1 = $onMakeHttpRequest;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            this.id_1 = 2;
            l$ret$1: do {
              var this_0 = this.y66_1;
              while (true) {
                var prevValue = this_0.t2();
                var nextValue = prevValue.p66(Status_LOADING_getInstance());
                if (this_0.y1k(prevValue, nextValue)) {
                  break l$ret$1;
                }
              }
            }
             while (false);
            this.hd_1 = 1;
            suspendResult = this.z66_1(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            l$ret$3: do {
              var this_1 = this.y66_1;
              while (true) {
                var prevValue_0 = this_1.t2();
                var nextValue_0 = prevValue_0.p66(Status_DONE_getInstance());
                if (this_1.y1k(prevValue_0, nextValue_0)) {
                  break l$ret$3;
                }
              }
            }
             while (false);
            this.id_1 = 3;
            this.hd_1 = 4;
            continue $sm;
          case 2:
            this.id_1 = 3;
            var tmp_0 = this.kd_1;
            if (tmp_0 instanceof Exception) {
              var e = this.kd_1;
              l$ret$5: do {
                var this_2 = this.y66_1;
                while (true) {
                  var prevValue_1 = this_2.t2();
                  var nextValue_1 = prevValue_1.p66(Status_FAILED_getInstance());
                  if (this_2.y1k(prevValue_1, nextValue_1)) {
                    break l$ret$5;
                  }
                }
              }
               while (false);
              this.hd_1 = 4;
              continue $sm;
            } else {
              throw this.kd_1;
            }

          case 3:
            throw this.kd_1;
          case 4:
            this.id_1 = 3;
            return Unit_instance;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 3) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).v1m = function ($this$launch, completion) {
    var i = new RepoDaoFlowHelper$asRepoFlow$slambda$slambda(this.y66_1, this.z66_1, completion);
    i.a67_1 = $this$launch;
    return i;
  };
  function RepoDaoFlowHelper$asRepoFlow$slambda$slambda_0($statusFlow, $onMakeHttpRequest, resultContinuation) {
    var i = new RepoDaoFlowHelper$asRepoFlow$slambda$slambda($statusFlow, $onMakeHttpRequest, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RepoDaoFlowHelper$asRepoFlow$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) {
    this.j67_1 = $statusFlow;
    this.k67_1 = $onMakeHttpRequest;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).g1n = function ($this$onStart, $completion) {
    var tmp = this.h1n($this$onStart, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).he = function (p1, $completion) {
    return this.g1n((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        if (tmp === 0) {
          this.id_1 = 1;
          var requestScope = CoroutineScope_0(this.od().lj(Job()));
          launch(requestScope, VOID, VOID, RepoDaoFlowHelper$asRepoFlow$slambda$slambda_0(this.j67_1, this.k67_1, null));
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).h1n = function ($this$onStart, completion) {
    var i = new RepoDaoFlowHelper$asRepoFlow$slambda(this.j67_1, this.k67_1, completion);
    i.l67_1 = $this$onStart;
    return i;
  };
  function RepoDaoFlowHelper$asRepoFlow$slambda_0($statusFlow, $onMakeHttpRequest, resultContinuation) {
    var i = new RepoDaoFlowHelper$asRepoFlow$slambda($statusFlow, $onMakeHttpRequest, resultContinuation);
    var l = function ($this$onStart, $completion) {
      return i.g1n($this$onStart, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RepoDaoFlowHelper(repo) {
    this.m67_1 = repo;
    this.n67_1 = weakMapOf();
  }
  protoOf(RepoDaoFlowHelper).o67 = function (dbFlow, onMakeHttpRequest) {
    var statusFlow = MutableStateFlow(new FlowLoadingState());
    var wrappedFlow = onStart(dbFlow, RepoDaoFlowHelper$asRepoFlow$slambda_0(statusFlow, onMakeHttpRequest, null));
    this.n67_1.p67(wrappedFlow, statusFlow);
    return wrappedFlow;
  };
  function ConnectionAsync() {
  }
  function StatementConstantsKmp() {
    this.x5g_1 = 1;
    this.y5g_1 = 2;
  }
  var StatementConstantsKmp_instance;
  function StatementConstantsKmp_getInstance() {
    return StatementConstantsKmp_instance;
  }
  function TypesKmp() {
    this.j5h_1 = 4;
    this.k5h_1 = 16;
    this.l5h_1 = 12;
    this.m5h_1 = -5;
    this.n5h_1 = 6;
    this.o5h_1 = 7;
    this.p5h_1 = 8;
    this.q5h_1 = 5;
    this.r5h_1 = -1;
    this.s5h_1 = 2003;
  }
  var TypesKmp_instance;
  function TypesKmp_getInstance() {
    return TypesKmp_instance;
  }
  function setFloatNullable(_this__u8e3s4, index, value) {
    var sqlType = TypesKmp_instance.n5h_1;
    var tmp;
    if (!(value == null)) {
      _this__u8e3s4.w5h(index, value);
      tmp = Unit_instance;
    } else {
      _this__u8e3s4.b5i(index, sqlType);
      tmp = Unit_instance;
    }
    return tmp;
  }
  function setBooleanNullable(_this__u8e3s4, index, value) {
    var sqlType = TypesKmp_instance.k5h_1;
    var tmp;
    if (!(value == null)) {
      _this__u8e3s4.i5h(index, value);
      tmp = Unit_instance;
    } else {
      _this__u8e3s4.b5i(index, sqlType);
      tmp = Unit_instance;
    }
    return tmp;
  }
  function setLongNullable(_this__u8e3s4, index, value) {
    var sqlType = TypesKmp_instance.m5h_1;
    var tmp;
    if (!(value == null)) {
      _this__u8e3s4.v5h(index, value);
      tmp = Unit_instance;
    } else {
      _this__u8e3s4.b5i(index, sqlType);
      tmp = Unit_instance;
    }
    return tmp;
  }
  function setIntNullable(_this__u8e3s4, index, value) {
    var sqlType = TypesKmp_instance.j5h_1;
    var tmp;
    if (!(value == null)) {
      _this__u8e3s4.u5h(index, value);
      tmp = Unit_instance;
    } else {
      _this__u8e3s4.b5i(index, sqlType);
      tmp = Unit_instance;
    }
    return tmp;
  }
  function useResults(_this__u8e3s4, block) {
    try {
      return block(_this__u8e3s4);
    }finally {
      _this__u8e3s4.n();
    }
  }
  function mapRows(_this__u8e3s4, block) {
    var mappedResults = mutableLinkedListOf_0([]);
    while (_this__u8e3s4.e()) {
      // Inline function 'kotlin.collections.plusAssign' call
      var element = block(_this__u8e3s4);
      mappedResults.i1(element);
    }
    return mappedResults;
  }
  function mapNextRow(_this__u8e3s4, defaultVal, block) {
    return _this__u8e3s4.e() ? block(_this__u8e3s4) : defaultVal;
  }
  function getShortNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getShortNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.m66(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function getIntNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getIntNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.x5m(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function getLongNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getLongNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.y5m(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function getFloatNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getFloatNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.l66(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function getDoubleNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getDoubleNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.k66(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function getBooleanNullable(_this__u8e3s4, columnName) {
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call
    // Inline function 'kotlin.let' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getBooleanNullable.<anonymous>' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.<anonymous>' call
    var it = _this__u8e3s4.j66(columnName);
    return _this__u8e3s4.q67() ? null : it;
  }
  function mapNextRow_0(_this__u8e3s4, block) {
    var tmp;
    if (_this__u8e3s4.e()) {
      tmp = block(_this__u8e3s4);
    } else {
      throw NullPointerException_init_$Create$('mapNextRow: no row and no default value provided');
    }
    return tmp;
  }
  function getStringNonNull(_this__u8e3s4, columnName) {
    var tmp0_elvis_lhs = _this__u8e3s4.rz(columnName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalStateException_init_$Create$('Column ' + columnName + ' was supposed to be non-null, got null');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  var DoorLogLevel_VERBOSE_instance;
  var DoorLogLevel_DEBUG_instance;
  var DoorLogLevel_INFO_instance;
  var DoorLogLevel_WARNING_instance;
  var DoorLogLevel_ERROR_instance;
  var DoorLogLevel_ASSERT_instance;
  var DoorLogLevel_entriesInitialized;
  function DoorLogLevel_initEntries() {
    if (DoorLogLevel_entriesInitialized)
      return Unit_instance;
    DoorLogLevel_entriesInitialized = true;
    DoorLogLevel_VERBOSE_instance = new DoorLogLevel('VERBOSE', 0);
    DoorLogLevel_DEBUG_instance = new DoorLogLevel('DEBUG', 1);
    DoorLogLevel_INFO_instance = new DoorLogLevel('INFO', 2);
    DoorLogLevel_WARNING_instance = new DoorLogLevel('WARNING', 3);
    DoorLogLevel_ERROR_instance = new DoorLogLevel('ERROR', 4);
    DoorLogLevel_ASSERT_instance = new DoorLogLevel('ASSERT', 5);
  }
  function DoorLogLevel(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function DoorLogLevel_VERBOSE_getInstance() {
    DoorLogLevel_initEntries();
    return DoorLogLevel_VERBOSE_instance;
  }
  function DoorLogLevel_DEBUG_getInstance() {
    DoorLogLevel_initEntries();
    return DoorLogLevel_DEBUG_instance;
  }
  function DoorLogLevel_INFO_getInstance() {
    DoorLogLevel_initEntries();
    return DoorLogLevel_INFO_instance;
  }
  function DoorLogLevel_WARNING_getInstance() {
    DoorLogLevel_initEntries();
    return DoorLogLevel_WARNING_instance;
  }
  function DoorLogLevel_ERROR_getInstance() {
    DoorLogLevel_initEntries();
    return DoorLogLevel_ERROR_instance;
  }
  function d(_this__u8e3s4, message, throwable) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.r67(DoorLogLevel_DEBUG_getInstance(), message, throwable);
  }
  function v(_this__u8e3s4, throwable, message) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.s67(DoorLogLevel_VERBOSE_getInstance(), throwable, message);
  }
  function w(_this__u8e3s4, throwable, message) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.s67(DoorLogLevel_WARNING_getInstance(), throwable, message);
  }
  function d_0(_this__u8e3s4, throwable, message) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.s67(DoorLogLevel_DEBUG_getInstance(), throwable, message);
  }
  function i(_this__u8e3s4, message, throwable) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.r67(DoorLogLevel_INFO_getInstance(), message, throwable);
  }
  function e(_this__u8e3s4, message, throwable) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.r67(DoorLogLevel_ERROR_getInstance(), message, throwable);
  }
  function w_0(_this__u8e3s4, message, throwable) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.r67(DoorLogLevel_WARNING_getInstance(), message, throwable);
  }
  function e_0(_this__u8e3s4, throwable, message) {
    throwable = throwable === VOID ? null : throwable;
    _this__u8e3s4.s67(DoorLogLevel_ERROR_getInstance(), throwable, message);
  }
  function toNapierLogLevel(_this__u8e3s4, $this) {
    var tmp;
    switch (_this__u8e3s4.za_1) {
      case 0:
        tmp = LogLevel_VERBOSE_getInstance();
        break;
      case 1:
        tmp = LogLevel_DEBUG_getInstance();
        break;
      case 2:
        tmp = LogLevel_INFO_getInstance();
        break;
      case 3:
        tmp = LogLevel_WARNING_getInstance();
        break;
      case 4:
        tmp = LogLevel_ERROR_getInstance();
        break;
      case 5:
        tmp = LogLevel_ASSERT_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    return tmp;
  }
  function NapierDoorLogger(tag) {
    var tmp;
    if (tag === VOID) {
      tmp = 'DoorLog';
    } else {
      tmp = tag;
    }
    tag = tmp;
    this.t67_1 = tag;
  }
  protoOf(NapierDoorLogger).r67 = function (level, message, throwable) {
    Napier_getInstance().b5e(toNapierLogLevel(level, this), this.t67_1, throwable, message);
  };
  protoOf(NapierDoorLogger).s67 = function (level, throwable, message) {
    var logLevel = toNapierLogLevel(level, this);
    if (Napier_getInstance().t5d(logLevel, this.t67_1)) {
      Napier_getInstance().b5e(logLevel, this.t67_1, throwable, message());
    }
  };
  function DefaultDoorMessageCallback() {
  }
  protoOf(DefaultDoorMessageCallback).u67 = function (db, eventMessage, $completion) {
    return eventMessage;
  };
  protoOf(DefaultDoorMessageCallback).v67 = function (db, eventMessage, $completion) {
    return Unit_instance;
  };
  function Companion_9() {
    Companion_instance_9 = this;
    var tmp = this;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp.w67_1 = [null, null, null, new ArrayListSerializer($serializer_getInstance_1())];
    this.x67_1 = 1;
    this.y67_1 = 2;
  }
  protoOf(Companion_9).n4r = function () {
    return $serializer_getInstance_0();
  };
  var Companion_instance_9;
  function Companion_getInstance_11() {
    if (Companion_instance_9 == null)
      new Companion_9();
    return Companion_instance_9;
  }
  function $serializer_0() {
    $serializer_instance_0 = this;
    var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.message.DoorMessage', this, 4);
    tmp0_serialDesc.t4f('what', false);
    tmp0_serialDesc.t4f('fromNode', false);
    tmp0_serialDesc.t4f('toNode', false);
    tmp0_serialDesc.t4f('replications', false);
    this.z67_1 = tmp0_serialDesc;
  }
  protoOf($serializer_0).q44 = function () {
    return this.z67_1;
  };
  protoOf($serializer_0).k4g = function () {
    var tmp0_cached = Companion_getInstance_11().w67_1;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return [IntSerializer_getInstance(), LongSerializer_getInstance(), LongSerializer_getInstance(), tmp0_cached[3]];
  };
  protoOf($serializer_0).s44 = function (decoder) {
    var tmp0_desc = this.z67_1;
    var tmp1_flag = true;
    var tmp2_index = 0;
    var tmp3_bitMask0 = 0;
    var tmp4_local0 = 0;
    var tmp5_local1 = new Long(0, 0);
    var tmp6_local2 = new Long(0, 0);
    var tmp7_local3 = null;
    var tmp8_input = decoder.i48(tmp0_desc);
    var tmp9_cached = Companion_getInstance_11().w67_1;
    if (tmp8_input.x48()) {
      tmp4_local0 = tmp8_input.n48(tmp0_desc, 0);
      tmp3_bitMask0 = tmp3_bitMask0 | 1;
      tmp5_local1 = tmp8_input.o48(tmp0_desc, 1);
      tmp3_bitMask0 = tmp3_bitMask0 | 2;
      tmp6_local2 = tmp8_input.o48(tmp0_desc, 2);
      tmp3_bitMask0 = tmp3_bitMask0 | 4;
      tmp7_local3 = tmp8_input.u48(tmp0_desc, 3, tmp9_cached[3], tmp7_local3);
      tmp3_bitMask0 = tmp3_bitMask0 | 8;
    } else
      while (tmp1_flag) {
        tmp2_index = tmp8_input.y48(tmp0_desc);
        switch (tmp2_index) {
          case -1:
            tmp1_flag = false;
            break;
          case 0:
            tmp4_local0 = tmp8_input.n48(tmp0_desc, 0);
            tmp3_bitMask0 = tmp3_bitMask0 | 1;
            break;
          case 1:
            tmp5_local1 = tmp8_input.o48(tmp0_desc, 1);
            tmp3_bitMask0 = tmp3_bitMask0 | 2;
            break;
          case 2:
            tmp6_local2 = tmp8_input.o48(tmp0_desc, 2);
            tmp3_bitMask0 = tmp3_bitMask0 | 4;
            break;
          case 3:
            tmp7_local3 = tmp8_input.u48(tmp0_desc, 3, tmp9_cached[3], tmp7_local3);
            tmp3_bitMask0 = tmp3_bitMask0 | 8;
            break;
          default:
            throw UnknownFieldException_init_$Create$(tmp2_index);
        }
      }
    tmp8_input.j48(tmp0_desc);
    return DoorMessage_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, null);
  };
  protoOf($serializer_0).a68 = function (encoder, value) {
    var tmp0_desc = this.z67_1;
    var tmp1_output = encoder.i48(tmp0_desc);
    var tmp2_cached = Companion_getInstance_11().w67_1;
    tmp1_output.r49(tmp0_desc, 0, value.b68_1);
    tmp1_output.s49(tmp0_desc, 1, value.c68_1);
    tmp1_output.s49(tmp0_desc, 2, value.d68_1);
    tmp1_output.y49(tmp0_desc, 3, tmp2_cached[3], value.e68_1);
    tmp1_output.j48(tmp0_desc);
  };
  protoOf($serializer_0).r44 = function (encoder, value) {
    return this.a68(encoder, value instanceof DoorMessage ? value : THROW_CCE());
  };
  var $serializer_instance_0;
  function $serializer_getInstance_0() {
    if ($serializer_instance_0 == null)
      new $serializer_0();
    return $serializer_instance_0;
  }
  function DoorMessage_init_$Init$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker, $this) {
    if (!(15 === (15 & seen1))) {
      throwMissingFieldException(seen1, 15, $serializer_getInstance_0().z67_1);
    }
    $this.b68_1 = what;
    $this.c68_1 = fromNode;
    $this.d68_1 = toNode;
    $this.e68_1 = replications;
    return $this;
  }
  function DoorMessage_init_$Create$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker) {
    return DoorMessage_init_$Init$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker, objectCreate(protoOf(DoorMessage)));
  }
  function DoorMessage(what, fromNode, toNode, replications) {
    Companion_getInstance_11();
    this.b68_1 = what;
    this.c68_1 = fromNode;
    this.d68_1 = toNode;
    this.e68_1 = replications;
  }
  protoOf(DoorMessage).toString = function () {
    return 'DoorMessage(what=' + this.b68_1 + ', fromNode=' + this.c68_1.toString() + ', toNode=' + this.d68_1.toString() + ', replications=' + this.e68_1 + ')';
  };
  protoOf(DoorMessage).hashCode = function () {
    var result = this.b68_1;
    result = imul(result, 31) + this.c68_1.hashCode() | 0;
    result = imul(result, 31) + this.d68_1.hashCode() | 0;
    result = imul(result, 31) + hashCode(this.e68_1) | 0;
    return result;
  };
  protoOf(DoorMessage).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof DoorMessage))
      return false;
    var tmp0_other_with_cast = other instanceof DoorMessage ? other : THROW_CCE();
    if (!(this.b68_1 === tmp0_other_with_cast.b68_1))
      return false;
    if (!this.c68_1.equals(tmp0_other_with_cast.c68_1))
      return false;
    if (!this.d68_1.equals(tmp0_other_with_cast.d68_1))
      return false;
    if (!equals(this.e68_1, tmp0_other_with_cast.e68_1))
      return false;
    return true;
  };
  function DoorMigration() {
  }
  function DoorMigrationAsync() {
  }
  function DoorMigrationStatementList(startVersion, endVersion, migrateStmts) {
    DoorMigration.call(this);
    this.h68_1 = startVersion;
    this.i68_1 = endVersion;
    this.j68_1 = migrateStmts;
  }
  protoOf(DoorMigrationStatementList).f68 = function () {
    return this.h68_1;
  };
  protoOf(DoorMigrationStatementList).g68 = function () {
    return this.i68_1;
  };
  function DoorMigrationSync() {
  }
  function NodeEvent(what, toNode, tableId, key1, key2, key3, key4) {
    this.k68_1 = what;
    this.l68_1 = toNode;
    this.m68_1 = tableId;
    this.n68_1 = key1;
    this.o68_1 = key2;
    this.p68_1 = key3;
    this.q68_1 = key4;
  }
  function createNodeEventTableAndTrigger(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion) {
    temporary = temporary === VOID ? true : temporary;
    var tmp = new $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.z68_1 = _this__u8e3s4;
    this.a69_1 = hasOutgoingReplicationTable;
    this.b69_1 = temporary;
  }
  protoOf($createNodeEventTableAndTriggerCOROUTINE$14).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 10;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.d69_1 = this.z68_1.y60();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 9;
            this.id_1 = 8;
            var tmp_1 = this;
            tmp_1.f69_1 = this.d69_1;
            this.hd_1 = 4;
            var tmp_2;
            if (this.b69_1) {
              tmp_2 = '\n            CREATE TEMP \n        TABLE IF NOT EXISTS NodeEvent (\n                   eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                   what INTEGER NOT NULL, \n                   toNode BIGINT NOT NULL,\n                   tableId INTEGER NOT NULL,\n                   key1 BIGINT NOT NULL,\n                   key2 BIGINT NOT NULL,\n                   key3 BIGINT NOT NULL,\n                   key4 BIGINT NOT NULL\n            )\n    \n        ';
            } else {
              tmp_2 = '\n        CREATE \n        TABLE IF NOT EXISTS NodeEvent (\n                   eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                   what INTEGER NOT NULL, \n                   toNode BIGINT NOT NULL,\n                   tableId INTEGER NOT NULL,\n                   key1 BIGINT NOT NULL,\n                   key2 BIGINT NOT NULL,\n                   key3 BIGINT NOT NULL,\n                   key4 BIGINT NOT NULL\n            )\n    \n    ';
            }

            suspendResult = executeUpdateAsync(this.f69_1, tmp_2, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var tmp_3 = this;
            var this_0 = this.f69_1;
            var tmp_4;
            if (this.a69_1) {
              tmp_4 = this_0;
            } else {
              tmp_4 = null;
            }

            tmp_3.g69_1 = tmp_4;
            if (this.g69_1 == null) {
              this.h69_1 = null;
              this.hd_1 = 6;
              continue $sm;
            } else {
              this.hd_1 = 5;
              var tmp_5;
              if (this.b69_1) {
                tmp_5 = '\n            CREATE TEMP \n        TRIGGER IF NOT EXISTS _door_event_trig\n             AFTER INSERT\n                ON OutgoingReplication\n             BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n                   VALUES (1, \n                           NEW.destNodeId, \n                           NEW.orTableId,\n                           NEW.orPk1,\n                           NEW.orPk2,\n                           NEW.orPK3,\n                           NEW.orPk4\n                          );\n                   END      \n    \n        ';
              } else {
                tmp_5 = '\n        CREATE \n        TRIGGER IF NOT EXISTS _door_event_trig\n             AFTER INSERT\n                ON OutgoingReplication\n             BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n                   VALUES (1, \n                           NEW.destNodeId, \n                           NEW.orTableId,\n                           NEW.orPk1,\n                           NEW.orPk2,\n                           NEW.orPK3,\n                           NEW.orPk4\n                          );\n                   END      \n    \n    ';
              }
              suspendResult = executeUpdateAsync(this.g69_1, tmp_5, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 5:
            this.h69_1 = suspendResult;
            this.hd_1 = 6;
            continue $sm;
          case 6:
            this.e69_1 = this.h69_1;
            this.id_1 = 10;
            this.hd_1 = 7;
            var tmp_6 = this;
            continue $sm;
          case 7:
            var tmp_7 = this.e69_1;
            this.id_1 = 10;
            this.d69_1.n();
            this.c69_1 = tmp_7;
            this.hd_1 = 12;
            continue $sm;
          case 8:
            this.id_1 = 9;
            var tmp_8 = this.kd_1;
            if (tmp_8 instanceof Exception) {
              var e = this.kd_1;
              var tmp_9 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 9:
            this.id_1 = 10;
            var t = this.kd_1;
            this.d69_1.n();
            throw t;
          case 10:
            throw this.kd_1;
          case 11:
            this.id_1 = 10;
            this.d69_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 12;
            continue $sm;
          case 12:
            return Unit_instance;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 10) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function NodeEventConstants() {
    this.i69_1 = 'OutgoingReplication';
    this.j69_1 = '\n        TABLE IF NOT EXISTS NodeEvent (\n                   eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                   what INTEGER NOT NULL, \n                   toNode BIGINT NOT NULL,\n                   tableId INTEGER NOT NULL,\n                   key1 BIGINT NOT NULL,\n                   key2 BIGINT NOT NULL,\n                   key3 BIGINT NOT NULL,\n                   key4 BIGINT NOT NULL\n            )\n    ';
    this.k69_1 = '\n            CREATE TEMP \n        TABLE IF NOT EXISTS NodeEvent (\n                   eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                   what INTEGER NOT NULL, \n                   toNode BIGINT NOT NULL,\n                   tableId INTEGER NOT NULL,\n                   key1 BIGINT NOT NULL,\n                   key2 BIGINT NOT NULL,\n                   key3 BIGINT NOT NULL,\n                   key4 BIGINT NOT NULL\n            )\n    \n        ';
    this.l69_1 = '\n        CREATE \n        TABLE IF NOT EXISTS NodeEvent (\n                   eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                   what INTEGER NOT NULL, \n                   toNode BIGINT NOT NULL,\n                   tableId INTEGER NOT NULL,\n                   key1 BIGINT NOT NULL,\n                   key2 BIGINT NOT NULL,\n                   key3 BIGINT NOT NULL,\n                   key4 BIGINT NOT NULL\n            )\n    \n    ';
    this.m69_1 = '\n        TRIGGER IF NOT EXISTS _door_event_trig\n             AFTER INSERT\n                ON OutgoingReplication\n             BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n                   VALUES (1, \n                           NEW.destNodeId, \n                           NEW.orTableId,\n                           NEW.orPk1,\n                           NEW.orPk2,\n                           NEW.orPK3,\n                           NEW.orPk4\n                          );\n                   END      \n    ';
    this.n69_1 = '\n            CREATE TEMP \n        TRIGGER IF NOT EXISTS _door_event_trig\n             AFTER INSERT\n                ON OutgoingReplication\n             BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n                   VALUES (1, \n                           NEW.destNodeId, \n                           NEW.orTableId,\n                           NEW.orPk1,\n                           NEW.orPk2,\n                           NEW.orPK3,\n                           NEW.orPk4\n                          );\n                   END      \n    \n        ';
    this.o69_1 = '\n        CREATE \n        TRIGGER IF NOT EXISTS _door_event_trig\n             AFTER INSERT\n                ON OutgoingReplication\n             BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n                   VALUES (1, \n                           NEW.destNodeId, \n                           NEW.orTableId,\n                           NEW.orPk1,\n                           NEW.orPk2,\n                           NEW.orPK3,\n                           NEW.orPk4\n                          );\n                   END      \n    \n    ';
    this.p69_1 = '\n        SELECT NodeEvent.what AS what,\n               NodeEvent.toNode AS toNode,\n               NodeEvent.tableId AS tableId,\n               NodeEvent.key1 AS key1,\n               NodeEvent.key2 AS key2,\n               NodeEvent.key3 AS key3,\n               NodeEvent.key4 AS key4\n          FROM NodeEvent\n    ';
    this.q69_1 = '\n        DELETE FROM NodeEvent\n    ';
  }
  var NodeEventConstants_instance;
  function NodeEventConstants_getInstance() {
    return NodeEventConstants_instance;
  }
  function NodeEventManagerCommon$onIncomingMessageReceived$lambda(this$0, $message) {
    return function () {
      return this$0.w69_1 + ' receiveMessage with ' + $message.e68_1.u() + ' replications: run inserts';
    };
  }
  function NodeEventManagerCommon$onIncomingMessageReceived$slambda(this$0, $message, resultContinuation) {
    this.l6a_1 = this$0;
    this.m6a_1 = $message;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).p6a = function (it, $completion) {
    var tmp = this.q6a(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).he = function (p1, $completion) {
    return this.p6a(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion);
  };
  protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            this.hd_1 = 1;
            suspendResult = this.l6a_1.s69_1.u67(this.l6a_1.r69_1, this.m6a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.o6a_1 = suspendResult;
            this.hd_1 = 2;
            suspendResult = insertEntitiesFromMessage(this.l6a_1.r69_1, this.o6a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 3;
            suspendResult = this.l6a_1.s69_1.v67(this.l6a_1.r69_1, this.o6a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).q6a = function (it, completion) {
    var i = new NodeEventManagerCommon$onIncomingMessageReceived$slambda(this.l6a_1, this.m6a_1, completion);
    i.n6a_1 = it;
    return i;
  };
  function NodeEventManagerCommon$onIncomingMessageReceived$slambda_0(this$0, $message, resultContinuation) {
    var i = new NodeEventManagerCommon$onIncomingMessageReceived$slambda(this$0, $message, resultContinuation);
    var l = function (it, $completion) {
      return i.p6a(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this$0, $message) {
    return function () {
      return this$0.w69_1 + ' receiveMessage with ' + $message.e68_1.u() + ' replications: inserts done/transaction finished';
    };
  }
  function $onIncomingMessageReceivedCOROUTINE$15(_this__u8e3s4, message, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.z6a_1 = _this__u8e3s4;
    this.a6b_1 = message;
  }
  protoOf($onIncomingMessageReceivedCOROUTINE$15).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 5;
            this.z6a_1.p5y();
            this.id_1 = 3;
            var tmp_0 = this.z6a_1.b6b();
            v(tmp_0, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda(this.z6a_1, this.a6b_1));
            this.hd_1 = 1;
            suspendResult = withDoorTransactionAsync(this.z6a_1.r69_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$slambda_0(this.z6a_1, this.a6b_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var tmp_1 = this.z6a_1.b6b();
            d_0(tmp_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this.z6a_1, this.a6b_1));
            this.hd_1 = 2;
            suspendResult = this.z6a_1.a6a_1.t1d(this.a6b_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.id_1 = 5;
            this.hd_1 = 4;
            continue $sm;
          case 3:
            this.id_1 = 5;
            var tmp_2 = this.kd_1;
            if (tmp_2 instanceof Exception) {
              var e = this.kd_1;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 4:
            this.id_1 = 5;
            return Unit_instance;
          case 5:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 5) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function NodeEventManagerCommon(db, messageCallback, logger, dbName, dispatcher) {
    dispatcher = dispatcher === VOID ? Dispatchers_getInstance().p12_1 : dispatcher;
    this.r69_1 = db;
    this.s69_1 = messageCallback;
    this.t69_1 = logger;
    this.u69_1 = dbName;
    this.v69_1 = dispatcher;
    this.w69_1 = '[NodeEventManager - ' + this.u69_1 + ']';
    this.x69_1 = doorDatabaseMetadata(getKClassFromExpression(this.r69_1)).n65().a1('OutgoingReplication');
    this.y69_1 = MutableSharedFlow();
    this.z69_1 = asSharedFlow(this.y69_1);
    this.a6a_1 = MutableSharedFlow();
    this.b6a_1 = asSharedFlow(this.a6a_1);
    this.c6a_1 = atomic$boolean$1(false);
  }
  protoOf(NodeEventManagerCommon).b6b = function () {
    return this.t69_1;
  };
  protoOf(NodeEventManagerCommon).c6b = function () {
    return this.u69_1;
  };
  protoOf(NodeEventManagerCommon).d6b = function () {
    return this.z69_1;
  };
  protoOf(NodeEventManagerCommon).e6b = function () {
    return this.b6a_1;
  };
  protoOf(NodeEventManagerCommon).p5y = function () {
    if (this.c6a_1.kotlinx$atomicfu$value)
      throw IllegalStateException_init_$Create$('NodeEventManager is closed!');
  };
  protoOf(NodeEventManagerCommon).f6b = function (message, $completion) {
    var tmp = new $onIncomingMessageReceivedCOROUTINE$15(this, message, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function NodeEventSseClient$onOpen$lambda(this$0) {
    return function () {
      return this$0.l6b_1 + ' : open';
    };
  }
  function NodeEventSseClient$onMessage$lambda(this$0) {
    return function () {
      return this$0.l6b_1 + ' : onMessage : INIT: remoteNodeId = ' + this$0.m6b_1.toString();
    };
  }
  function NodeEventSseClient$onMessage$lambda_0(this$0) {
    return function () {
      return this$0.l6b_1 + ' : onMessage : pending replication';
    };
  }
  function NodeEventSseClient$onMessage$slambda(this$0, resultContinuation) {
    this.w6b_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(NodeEventSseClient$onMessage$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(NodeEventSseClient$onMessage$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(NodeEventSseClient$onMessage$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;
            Companion_getInstance_11();
            suspendResult = this.w6b_1.h6b_1.f6b(new DoorMessage(1, this.w6b_1.m6b_1, this.w6b_1.g6b_1.v65_1, emptyList()), 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(NodeEventSseClient$onMessage$slambda).v1m = function ($this$launch, completion) {
    var i = new NodeEventSseClient$onMessage$slambda(this.w6b_1, completion);
    i.x6b_1 = $this$launch;
    return i;
  };
  function NodeEventSseClient$onMessage$slambda_0(this$0, resultContinuation) {
    var i = new NodeEventSseClient$onMessage$slambda(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function NodeEventSseClient$onError$lambda(this$0) {
    return function () {
      return this$0.l6b_1 + ' : onError';
    };
  }
  function NodeEventSseClient(repoConfig, nodeEventManager, scope) {
    this.g6b_1 = repoConfig;
    this.h6b_1 = nodeEventManager;
    this.i6b_1 = scope;
    var tmp = this;
    tmp.k6b_1 = this.g6b_1.t65_1 + 'replication/sse?' + 'door-node' + '=' + urlEncode(this.g6b_1.v65_1.toString() + '/' + this.g6b_1.u65_1);
    this.l6b_1 = '[NodeEventSseClient localNodeId=' + this.g6b_1.v65_1.toString() + ' remoteEndpoint=' + this.g6b_1.t65_1 + ']';
    this.m6b_1 = new Long(0, 0);
    this.n6b_1 = false;
    this.j6b_1 = new DoorEventSource(this.g6b_1, this.k6b_1, this);
  }
  protoOf(NodeEventSseClient).y6b = function () {
    var tmp = Napier_getInstance();
    tmp.e5e(VOID, 'DoorLog', NodeEventSseClient$onOpen$lambda(this));
  };
  protoOf(NodeEventSseClient).z6b = function (message) {
    var tmp0_subject = message.b6c_1;
    if (tmp0_subject === 'init') {
      this.m6b_1 = toLong_0(message.c6c_1);
      var tmp = Napier_getInstance();
      tmp.e5e(VOID, 'DoorLog', NodeEventSseClient$onMessage$lambda(this));
    } else {
      if (tmp0_subject === 'pending-replication') {
        var tmp_0 = Napier_getInstance();
        tmp_0.e5e(VOID, 'DoorLog', NodeEventSseClient$onMessage$lambda_0(this));
        launch(this.i6b_1, VOID, VOID, NodeEventSseClient$onMessage$slambda_0(this, null));
      }
    }
  };
  protoOf(NodeEventSseClient).d6c = function (e) {
    if (!this.n6b_1) {
      Napier_getInstance().n5e(e, 'DoorLog', NodeEventSseClient$onError$lambda(this));
    }
  };
  function onSrcInvalidated($this) {
    $this.f6c_1.o54($this.i6c_1);
    if (!$this.h6c_1.atomicfu$getAndSet(true)) {
      $this.k54();
    }
  }
  function DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this$0) {
    return function () {
      onSrcInvalidated(this$0);
      return Unit_instance;
    };
  }
  function DelegatedInvalidationPagingSource(invalidationDelegate) {
    PagingSource.call(this);
    this.f6c_1 = invalidationDelegate;
    this.g6c_1 = atomic$boolean$1(false);
    this.h6c_1 = atomic$boolean$1(false);
    var tmp = this;
    tmp.i6c_1 = DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this);
  }
  protoOf(DelegatedInvalidationPagingSource).j6c = function () {
    if (!this.g6c_1.atomicfu$getAndSet(true)) {
      this.f6c_1.n54(this.i6c_1);
    }
  };
  function OffsetLimitRange(offset, limit, time) {
    this.k6c_1 = offset;
    this.l6c_1 = limit;
    this.m6c_1 = time;
  }
  protoOf(OffsetLimitRange).n6c = function (offset, limit, time) {
    return new OffsetLimitRange(offset, limit, time);
  };
  protoOf(OffsetLimitRange).o6c = function (offset, limit, time, $super) {
    offset = offset === VOID ? this.k6c_1 : offset;
    limit = limit === VOID ? this.l6c_1 : limit;
    time = time === VOID ? this.m6c_1 : time;
    return $super === VOID ? this.n6c(offset, limit, time) : $super.n6c.call(this, offset, limit, time);
  };
  protoOf(OffsetLimitRange).toString = function () {
    return 'OffsetLimitRange(offset=' + this.k6c_1 + ', limit=' + this.l6c_1 + ', time=' + this.m6c_1.toString() + ')';
  };
  protoOf(OffsetLimitRange).hashCode = function () {
    var result = this.k6c_1;
    result = imul(result, 31) + this.l6c_1 | 0;
    result = imul(result, 31) + this.m6c_1.hashCode() | 0;
    return result;
  };
  protoOf(OffsetLimitRange).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof OffsetLimitRange))
      return false;
    var tmp0_other_with_cast = other instanceof OffsetLimitRange ? other : THROW_CCE();
    if (!(this.k6c_1 === tmp0_other_with_cast.k6c_1))
      return false;
    if (!(this.l6c_1 === tmp0_other_with_cast.l6c_1))
      return false;
    if (!this.m6c_1.equals(tmp0_other_with_cast.m6c_1))
      return false;
    return true;
  };
  function OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted) {
    loadingRangesInProgress = loadingRangesInProgress === VOID ? emptyList() : loadingRangesInProgress;
    loadingStarted = loadingStarted === VOID ? false : loadingStarted;
    this.p6c_1 = loadingRangesInProgress;
    this.q6c_1 = loadingStarted;
  }
  protoOf(OffsetLimitMediatorState).r6c = function (loadingRangesInProgress, loadingStarted) {
    return new OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted);
  };
  protoOf(OffsetLimitMediatorState).s6c = function (loadingRangesInProgress, loadingStarted, $super) {
    loadingRangesInProgress = loadingRangesInProgress === VOID ? this.p6c_1 : loadingRangesInProgress;
    loadingStarted = loadingStarted === VOID ? this.q6c_1 : loadingStarted;
    return $super === VOID ? this.r6c(loadingRangesInProgress, loadingStarted) : $super.r6c.call(this, loadingRangesInProgress, loadingStarted);
  };
  protoOf(OffsetLimitMediatorState).toString = function () {
    return 'OffsetLimitMediatorState(loadingRangesInProgress=' + this.p6c_1 + ', loadingStarted=' + this.q6c_1 + ')';
  };
  protoOf(OffsetLimitMediatorState).hashCode = function () {
    var result = hashCode(this.p6c_1);
    result = imul(result, 31) + getBooleanHashCode(this.q6c_1) | 0;
    return result;
  };
  protoOf(OffsetLimitMediatorState).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof OffsetLimitMediatorState))
      return false;
    var tmp0_other_with_cast = other instanceof OffsetLimitMediatorState ? other : THROW_CCE();
    if (!equals(this.p6c_1, tmp0_other_with_cast.p6c_1))
      return false;
    if (!(this.q6c_1 === tmp0_other_with_cast.q6c_1))
      return false;
    return true;
  };
  function sam$kotlin_Comparator$0(function_0) {
    this.t6c_1 = function_0;
  }
  protoOf(sam$kotlin_Comparator$0).pa = function (a, b) {
    return this.t6c_1(a, b);
  };
  protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
    return this.pa(a, b);
  };
  function DoorOffsetLimitRemoteMediator$onLoad$lambda(a, b) {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp = a.k6c_1;
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp$ret$1 = b.k6c_1;
    return compareValues(tmp, tmp$ret$1);
  }
  function DoorOffsetLimitRemoteMediator$onLoad$lambda_0() {
    return 'DoorOffsetLimitRemoteMediator: already loaded everything required.';
  }
  function DoorOffsetLimitRemoteMediator$onLoad$lambda_1(a, b) {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp = b.k6c_1;
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp$ret$1 = a.k6c_1;
    return compareValues(tmp, tmp$ret$1);
  }
  function DoorOffsetLimitRemoteMediator$onLoad$lambda_2(a, b) {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp = b.k6c_1;
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp$ret$1 = a.k6c_1;
    return compareValues(tmp, tmp$ret$1);
  }
  function DoorOffsetLimitRemoteMediator$onLoad$lambda_3(a, b) {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp = a.k6c_1;
    // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
    var tmp$ret$1 = b.k6c_1;
    return compareValues(tmp, tmp$ret$1);
  }
  function DoorOffsetLimitRemoteMediator$onLoad$slambda($loadOffset, $loadLimit, this$0, resultContinuation) {
    this.c6d_1 = $loadOffset;
    this.d6d_1 = $loadLimit;
    this.e6d_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 5;
            this.g6d_1 = new OffsetLimitRange(this.c6d_1._v, this.d6d_1, systemTimeInMillis());
            this.hd_1 = 1;
            continue $sm;
          case 1:
            this.id_1 = 4;
            this.id_1 = 3;
            l$ret$1: do {
              var this_0 = this.e6d_1.n6d_1;
              while (true) {
                var prevValue = this_0.t2();
                var nextValue = prevValue.r6c(plus_1(prevValue.p6c_1, this.g6d_1), true);
                if (this_0.y1k(prevValue, nextValue)) {
                  break l$ret$1;
                }
              }
            }
             while (false);
            this.hd_1 = 2;
            suspendResult = this.e6d_1.k6d_1.p6d(this.c6d_1._v, this.d6d_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var tmp_0 = this;
            this.e6d_1.m6d_1.i1(this.g6d_1.o6c(VOID, VOID, systemTimeInMillis()));
            tmp_0.h6d_1 = Unit_instance;
            this.id_1 = 5;
            this.hd_1 = 6;
            continue $sm;
          case 3:
            this.id_1 = 4;
            var tmp_1 = this.kd_1;
            if (tmp_1 instanceof Error) {
              var e = this.kd_1;
              var tmp_2 = this;
              Napier_getInstance().m5e('Attempted to load from offset=' + this.c6d_1._v + ' limit=' + this.d6d_1 + ' faled ', e);
              tmp_2.h6d_1 = Unit_instance;
              this.id_1 = 5;
              this.hd_1 = 6;
              continue $sm;
            } else {
              throw this.kd_1;
            }

          case 4:
            this.id_1 = 5;
            var t = this.kd_1;
            l$ret$5: do {
              var this_1 = this.e6d_1.n6d_1;
              while (true) {
                var prevValue_0 = this_1.t2();
                var nextValue_0 = prevValue_0.s6c(minus(prevValue_0.p6c_1, this.g6d_1));
                if (this_1.y1k(prevValue_0, nextValue_0)) {
                  break l$ret$5;
                }
              }
            }
             while (false);
            throw t;
          case 5:
            throw this.kd_1;
          case 6:
            this.id_1 = 5;
            l$ret$7: do {
              var this_2 = this.e6d_1.n6d_1;
              while (true) {
                var prevValue_1 = this_2.t2();
                var nextValue_1 = prevValue_1.s6c(minus(prevValue_1.p6c_1, this.g6d_1));
                if (this_2.y1k(prevValue_1, nextValue_1)) {
                  break l$ret$7;
                }
              }
            }
             while (false);
            return Unit_instance;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 5) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).v1m = function ($this$launch, completion) {
    var i = new DoorOffsetLimitRemoteMediator$onLoad$slambda(this.c6d_1, this.d6d_1, this.e6d_1, completion);
    i.f6d_1 = $this$launch;
    return i;
  };
  function DoorOffsetLimitRemoteMediator$onLoad$slambda_0($loadOffset, $loadLimit, this$0, resultContinuation) {
    var i = new DoorOffsetLimitRemoteMediator$onLoad$slambda($loadOffset, $loadLimit, this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorOffsetLimitRemoteMediator(prefetchDistance, prefetchThreshold, onRemoteLoad) {
    prefetchDistance = prefetchDistance === VOID ? 100 : prefetchDistance;
    prefetchThreshold = prefetchThreshold === VOID ? prefetchDistance / 2 | 0 : prefetchThreshold;
    this.i6d_1 = prefetchDistance;
    this.j6d_1 = prefetchThreshold;
    this.k6d_1 = onRemoteLoad;
    this.l6d_1 = CoroutineScope_0(Dispatchers_getInstance().p12_1.lj(Job()));
    this.m6d_1 = concurrentSafeListOf([]);
    this.n6d_1 = MutableStateFlow(new OffsetLimitMediatorState());
    this.o6d_1 = asStateFlow(this.n6d_1);
  }
  protoOf(DoorOffsetLimitRemoteMediator).q6d = function (params) {
    var tmp0_elvis_lhs = params.s2();
    var pagingOffset = getOffset(params, tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs, IntCompanionObject_instance.MAX_VALUE);
    var tmp1_elvis_lhs = params.s2();
    var pagingLimit = getLimit(params, tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs);
    // Inline function 'kotlin.comparisons.maxOf' call
    var b = pagingOffset - this.i6d_1 | 0;
    var rangeOffset = Math.max(0, b);
    var rangeLimit = (pagingLimit + (pagingOffset - rangeOffset | 0) | 0) + this.i6d_1 | 0;
    var loadOffset = {_v: rangeOffset};
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.sortedBy' call
    var this_0 = this.m6d_1;
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp = DoorOffsetLimitRemoteMediator$onLoad$lambda;
    var tmp$ret$1 = new sam$kotlin_Comparator$0(tmp);
    var tmp0_iterator = sortedWith(this_0, tmp$ret$1).w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
      if (element.k6c_1 <= rangeOffset ? (element.k6c_1 + element.l6c_1 | 0) > loadOffset._v : false) {
        loadOffset._v = element.k6c_1 + element.l6c_1 | 0;
      }
    }
    if (loadOffset._v >= (rangeOffset + rangeLimit | 0)) {
      var tmp_0 = Napier_getInstance();
      tmp_0.k5e(VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$lambda_0);
      return Unit_instance;
    }
    var loadEnd = rangeOffset + rangeLimit | 0;
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.sortedByDescending' call
    var this_1 = this.m6d_1;
    // Inline function 'kotlin.comparisons.compareByDescending' call
    var tmp_1 = DoorOffsetLimitRemoteMediator$onLoad$lambda_1;
    var tmp$ret$3 = new sam$kotlin_Comparator$0(tmp_1);
    var tmp0_iterator_0 = sortedWith(this_1, tmp$ret$3).w();
    while (tmp0_iterator_0.f()) {
      var element_0 = tmp0_iterator_0.e();
      // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
      if (element_0.k6c_1 < loadEnd ? (element_0.k6c_1 + element_0.l6c_1 | 0) > loadEnd : false)
        loadEnd = element_0.k6c_1;
    }
    var loadLimit = loadEnd - loadOffset._v | 0;
    // Inline function 'kotlin.comparisons.minOf' call
    var a = pagingOffset + pagingLimit | 0;
    var b_0 = loadOffset._v + loadLimit | 0;
    var tmp_2 = Math.min(a, b_0);
    // Inline function 'kotlin.comparisons.maxOf' call
    var b_1 = loadOffset._v;
    var loadPagingOverlap = tmp_2 - Math.max(pagingOffset, b_1) | 0;
    var tmp_3;
    if (loadPagingOverlap > 0) {
      tmp_3 = -1;
    } else {
      var alreadyLoadedStart = pagingOffset;
      // Inline function 'kotlin.collections.forEach' call
      // Inline function 'kotlin.collections.sortedByDescending' call
      var this_2 = this.m6d_1;
      // Inline function 'kotlin.comparisons.compareByDescending' call
      var tmp_4 = DoorOffsetLimitRemoteMediator$onLoad$lambda_2;
      var tmp$ret$7 = new sam$kotlin_Comparator$0(tmp_4);
      var tmp0_iterator_1 = sortedWith(this_2, tmp$ret$7).w();
      while (tmp0_iterator_1.f()) {
        var element_1 = tmp0_iterator_1.e();
        // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
        if (element_1.k6c_1 < alreadyLoadedStart ? (element_1.k6c_1 + element_1.l6c_1 | 0) >= alreadyLoadedStart : false)
          alreadyLoadedStart = element_1.k6c_1;
      }
      var alreadyLoadedEnd = pagingOffset + pagingLimit | 0;
      // Inline function 'kotlin.collections.forEach' call
      // Inline function 'kotlin.collections.sortedBy' call
      var this_3 = this.m6d_1;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp_5 = DoorOffsetLimitRemoteMediator$onLoad$lambda_3;
      var tmp$ret$9 = new sam$kotlin_Comparator$0(tmp_5);
      var tmp0_iterator_2 = sortedWith(this_3, tmp$ret$9).w();
      while (tmp0_iterator_2.f()) {
        var element_2 = tmp0_iterator_2.e();
        // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.<anonymous>' call
        if (element_2.k6c_1 <= alreadyLoadedEnd ? (element_2.k6c_1 + element_2.l6c_1 | 0) > alreadyLoadedEnd : false) {
          alreadyLoadedEnd = element_2.k6c_1 + element_2.l6c_1 | 0;
        }
      }
      tmp_3 = (rangeOffset - alreadyLoadedStart | 0) + ((rangeOffset + rangeLimit | 0) - alreadyLoadedEnd | 0) | 0;
    }
    var prefetchSize = tmp_3;
    if (loadPagingOverlap > 0 ? true : prefetchSize > this.j6d_1) {
      launch(this.l6d_1, VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$slambda_0(loadOffset, loadLimit, this, null));
    }
  };
  protoOf(DoorOffsetLimitRemoteMediator).k54 = function () {
    this.m6d_1.n1();
  };
  protoOf(DoorOffsetLimitRemoteMediator).r6d = function () {
    cancel(this.l6d_1);
  };
  function get_INVALID() {
    _init_properties_DoorPagingUtil_kt__xv2bfg();
    return INVALID;
  }
  var INVALID;
  function getOffset(params, key, itemCount) {
    _init_properties_DoorPagingUtil_kt__xv2bfg();
    var tmp;
    if (params instanceof Prepend) {
      var tmp_0;
      if (key < params.h54_1) {
        tmp_0 = 0;
      } else {
        tmp_0 = key - params.h54_1 | 0;
      }
      tmp = tmp_0;
    } else {
      if (params instanceof Append) {
        tmp = key;
      } else {
        if (params instanceof Refresh) {
          var tmp_1;
          if (key >= itemCount) {
            // Inline function 'kotlin.comparisons.maxOf' call
            var b = itemCount - params.h54_1 | 0;
            tmp_1 = Math.max(0, b);
          } else {
            tmp_1 = key;
          }
          tmp = tmp_1;
        } else {
          throw IllegalStateException_init_$Create$('Not really possible - Just here because compiler does not fully understand expect/actual');
        }
      }
    }
    return tmp;
  }
  function getLimit(params, key) {
    _init_properties_DoorPagingUtil_kt__xv2bfg();
    var tmp;
    if (params instanceof Prepend) {
      var tmp_0;
      if (key < params.h54_1) {
        tmp_0 = key;
      } else {
        tmp_0 = params.h54_1;
      }
      tmp = tmp_0;
    } else {
      tmp = params.h54_1;
    }
    return tmp;
  }
  function get_INITIAL_ITEM_COUNT() {
    return INITIAL_ITEM_COUNT;
  }
  var INITIAL_ITEM_COUNT;
  function queryDatabase(params, loadRows, itemCount, $completion) {
    var tmp = new $queryDatabaseCOROUTINE$16(params, loadRows, itemCount, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function $queryDatabaseCOROUTINE$16(params, loadRows, itemCount, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.a6e_1 = params;
    this.b6e_1 = loadRows;
    this.c6e_1 = itemCount;
  }
  protoOf($queryDatabaseCOROUTINE$16).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            var tmp_0 = this;
            var tmp0_elvis_lhs = this.a6e_1.s2();
            tmp_0.d6e_1 = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
            this.e6e_1 = getLimit(this.a6e_1, this.d6e_1);
            this.f6e_1 = getOffset(this.a6e_1, this.d6e_1, this.c6e_1);
            this.hd_1 = 1;
            suspendResult = this.b6e_1(this.e6e_1, this.f6e_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var data = suspendResult;
            var nextPosToLoad = this.f6e_1 + data.u() | 0;
            var tmp_1;
            if ((data.c1() ? true : data.u() < this.e6e_1) ? true : nextPosToLoad >= this.c6e_1) {
              tmp_1 = null;
            } else {
              tmp_1 = nextPosToLoad;
            }

            var nextKey = tmp_1;
            var prevKey = (this.f6e_1 <= 0 ? true : data.c1()) ? null : this.f6e_1;
            var b = this.c6e_1 - nextPosToLoad | 0;
            var tmp_2 = new Page(data, prevKey, nextKey, this.f6e_1, Math.max(0, b));
            return tmp_2 instanceof LoadResult ? tmp_2 : THROW_CCE();
          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);
  };
  var properties_initialized_DoorPagingUtil_kt_2vglj6;
  function _init_properties_DoorPagingUtil_kt__xv2bfg() {
    if (!properties_initialized_DoorPagingUtil_kt_2vglj6) {
      properties_initialized_DoorPagingUtil_kt_2vglj6 = true;
      INVALID = new Invalid();
    }
  }
  function DoorRepositoryPagingSource() {
    PagingSource.call(this);
    this.h6e_1 = MutableStateFlow(new PagingSourceLoadState());
    this.i6e_1 = asStateFlow(this.h6e_1);
  }
  function onDbInvalidated($this) {
    Napier_getInstance().c5e('DoorRepositoryReplicatePullPagingSource: onDbInvalidated');
    $this.o6e_1.o54($this.t6e_1);
    if (!$this.r6e_1.atomicfu$getAndSet(true)) {
      Napier_getInstance().c5e('DoorRepositoryReplicatePullPagingSource: call invalidate');
      $this.k54();
    }
  }
  function Companion_10() {
    this.u6e_1 = 'pagingBatchSize';
    this.v6e_1 = 'pagingKey';
    this.w6e_1 = 'pagingLoadParamType';
  }
  var Companion_instance_10;
  function Companion_getInstance_12() {
    return Companion_instance_10;
  }
  function DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this$0) {
    return function () {
      onDbInvalidated(this$0);
      return Unit_instance;
    };
  }
  function DoorRepositoryReplicatePullPagingSource(repo, repoPath, dbPagingSource, onLoadHttp) {
    DoorRepositoryPagingSource.call(this);
    this.m6e_1 = repo;
    this.n6e_1 = repoPath;
    this.o6e_1 = dbPagingSource;
    this.p6e_1 = onLoadHttp;
    this.q6e_1 = atomic$boolean$1(false);
    this.r6e_1 = atomic$boolean$1(false);
    this.s6e_1 = null;
    var tmp = this;
    tmp.t6e_1 = DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this);
  }
  protoOf(DoorRepositoryReplicatePullPagingSource).c5s = function (params, $completion) {
    Napier_getInstance().c5e('DoorRepositoryReplicatePullPagingSource: load key=' + params.s2());
    this.s6e_1 = params;
    if (!this.q6e_1.atomicfu$getAndSet(true)) {
      Napier_getInstance().c5e('DoorRepositoryReplicatePullPagingSource: register db invalidate callback');
      this.o6e_1.n54(this.t6e_1);
    }
    return this.o6e_1.p54(params, $completion);
  };
  protoOf(DoorRepositoryReplicatePullPagingSource).p54 = function (params, $completion) {
    return this.c5s(params, $completion);
  };
  protoOf(DoorRepositoryReplicatePullPagingSource).x6e = function (params, $completion) {
    return this.p6e_1(params, $completion);
  };
  protoOf(DoorRepositoryReplicatePullPagingSource).y6e = function (params, $completion) {
    return this.x6e(params, $completion);
  };
  function FilterPagingSource(src) {
    DelegatedInvalidationPagingSource.call(this, src);
    this.e6f_1 = src;
  }
  protoOf(FilterPagingSource).p54 = function (params, $completion) {
    this.j6c();
    return this.e6f_1.p54(params, $completion);
  };
  function endOfPaginationReached(_this__u8e3s4) {
    var tmp = _this__u8e3s4.k2x();
    var tmp0_safe_receiver = tmp.ba('door-paging-end-reached');
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toBoolean(tmp0_safe_receiver);
    return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs;
  }
  function PagingSourceInterceptor(src, onLoad) {
    FilterPagingSource.call(this, src);
    this.l6f_1 = onLoad;
  }
  protoOf(PagingSourceInterceptor).p54 = function (params, $completion) {
    this.l6f_1(params);
    return protoOf(FilterPagingSource).p54.call(this, params, $completion);
  };
  function PagingSourceLoadState(activeRequests, failedRequests, completedRequests) {
    activeRequests = activeRequests === VOID ? emptyList() : activeRequests;
    failedRequests = failedRequests === VOID ? emptyList() : failedRequests;
    completedRequests = completedRequests === VOID ? emptyList() : completedRequests;
    this.m6f_1 = activeRequests;
    this.n6f_1 = failedRequests;
    this.o6f_1 = completedRequests;
  }
  protoOf(PagingSourceLoadState).toString = function () {
    return 'PagingSourceLoadState(activeRequests=' + this.m6f_1 + ', failedRequests=' + this.n6f_1 + ', completedRequests=' + this.o6f_1 + ')';
  };
  protoOf(PagingSourceLoadState).hashCode = function () {
    var result = hashCode(this.m6f_1);
    result = imul(result, 31) + hashCode(this.n6f_1) | 0;
    result = imul(result, 31) + hashCode(this.o6f_1) | 0;
    return result;
  };
  protoOf(PagingSourceLoadState).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof PagingSourceLoadState))
      return false;
    var tmp0_other_with_cast = other instanceof PagingSourceLoadState ? other : THROW_CCE();
    if (!equals(this.m6f_1, tmp0_other_with_cast.m6f_1))
      return false;
    if (!equals(this.n6f_1, tmp0_other_with_cast.n6f_1))
      return false;
    if (!equals(this.o6f_1, tmp0_other_with_cast.o6f_1))
      return false;
    return true;
  };
  function PagingSourceWithHttpLoader() {
  }
  function acknowledgeReceivedReplications(_this__u8e3s4, nodeId, receivedUids, $completion) {
    return prepareAndUseStatementAsync_0(_this__u8e3s4, '\n        DELETE FROM OutgoingReplication\n              WHERE orUid = ?\n                AND destNodeId = ?\n        ', false, acknowledgeReceivedReplications$slambda_0(receivedUids, nodeId, null), $completion);
  }
  function selectPendingOutgoingReplicationsByDestNodeId(_this__u8e3s4, nodeId, limit, $completion) {
    limit = limit === VOID ? 1000 : limit;
    var tmp = new $selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17(_this__u8e3s4, nodeId, limit, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function insertEntitiesFromMessage(_this__u8e3s4, message, $completion) {
    var tmp = new $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(_this__u8e3s4, tableId, primaryKeysList, $completion) {
    var entityMetaData = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4)).m65(tableId);
    var tmp = entityMetaData.a6h();
    return prepareAndUseStatementAsync_0(_this__u8e3s4, tmp, true, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0(primaryKeysList, entityMetaData, tableId, null), $completion);
  }
  function ReplicateEntityPrimaryKeys(pk1, pk2, pk3, pk4, orUid) {
    this.b6h_1 = pk1;
    this.c6h_1 = pk2;
    this.d6h_1 = pk3;
    this.e6h_1 = pk4;
    this.f6h_1 = orUid;
  }
  protoOf(ReplicateEntityPrimaryKeys).toString = function () {
    return 'ReplicateEntityPrimaryKeys(pk1=' + this.b6h_1.toString() + ', pk2=' + this.c6h_1.toString() + ', pk3=' + this.d6h_1.toString() + ', pk4=' + this.e6h_1.toString() + ', orUid=' + this.f6h_1.toString() + ')';
  };
  protoOf(ReplicateEntityPrimaryKeys).hashCode = function () {
    var result = this.b6h_1.hashCode();
    result = imul(result, 31) + this.c6h_1.hashCode() | 0;
    result = imul(result, 31) + this.d6h_1.hashCode() | 0;
    result = imul(result, 31) + this.e6h_1.hashCode() | 0;
    result = imul(result, 31) + this.f6h_1.hashCode() | 0;
    return result;
  };
  protoOf(ReplicateEntityPrimaryKeys).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof ReplicateEntityPrimaryKeys))
      return false;
    var tmp0_other_with_cast = other instanceof ReplicateEntityPrimaryKeys ? other : THROW_CCE();
    if (!this.b6h_1.equals(tmp0_other_with_cast.b6h_1))
      return false;
    if (!this.c6h_1.equals(tmp0_other_with_cast.c6h_1))
      return false;
    if (!this.d6h_1.equals(tmp0_other_with_cast.d6h_1))
      return false;
    if (!this.e6h_1.equals(tmp0_other_with_cast.e6h_1))
      return false;
    if (!this.f6h_1.equals(tmp0_other_with_cast.f6h_1))
      return false;
    return true;
  };
  function withRepoChangeMonitorAsync(_this__u8e3s4, tableName, block, $completion) {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var tmp0_iterator = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4.x5i())).a65().p2().w();
      while (tmp0_iterator.f()) {
        var element = tmp0_iterator.e();
        // Inline function 'com.ustadmobile.door.replication.withRepoChangeMonitorAsync.<anonymous>' call
        if (element.d65_1 === tableName) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    var tmp0_elvis_lhs = tmp$ret$1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('Could not find replication metadata for table: ' + tableName);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var entityMetaData = tmp;
    var remoteNodeId = _this__u8e3s4.m61();
    var tmp_0 = _this__u8e3s4.x5i();
    var tmp_1 = TransactionMode_READ_WRITE_getInstance();
    return withDoorTransactionAsync(tmp_0, tmp_1, withRepoChangeMonitorAsync$slambda_0(_this__u8e3s4, entityMetaData, remoteNodeId, block, null), $completion);
  }
  function onClientRepoDoorMessageHttpResponse(_this__u8e3s4, httpResponse, json, $completion) {
    var tmp = new $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function createChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) {
    // Inline function 'kotlin.math.absoluteValue' call
    var tmp$ret$0 = abs(remoteNodeId);
    var tmp = '_d_ch_monitor_' + entityMetaData.c65_1 + '_' + tmp$ret$0.toString();
    // Inline function 'kotlin.text.lowercase' call
    // Inline function 'kotlin.text.substring' call
    // Inline function 'kotlin.js.asDynamic' call
    // Inline function 'kotlin.js.asDynamic' call
    var triggerName = tmp + ('_' + operation.substring(0, 2).toLowerCase());
    // Inline function 'kotlin.collections.map' call
    var this_0 = until(0, 4);
    // Inline function 'kotlin.collections.mapTo' call
    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();
      // Inline function 'com.ustadmobile.door.replication.createChangeMonitorTriggerSql.<anonymous>' call
      var tmp_0;
      if (entityMetaData.f65_1.u() > item) {
        tmp_0 = 'NEW.' + entityMetaData.f65_1.v(item);
      } else {
        tmp_0 = '0';
      }
      var tmp$ret$5 = tmp_0;
      destination.i1(tmp$ret$5);
    }
    var primaryKeys = destination;
    return '\n            CREATE TEMP TRIGGER IF NOT EXISTS ' + triggerName + ' \n            AFTER ' + operation + ' ON ' + entityMetaData.d65_1 + '\n            FOR EACH ROW\n            BEGIN\n                INSERT INTO OutgoingReplication(destNodeId, orTableId, orPk1, orPk2, orPk3, orPk4)\n                VALUES (' + remoteNodeId.toString() + ', ' + entityMetaData.c65_1 + ', ' + joinToString(primaryKeys) + ');\n            END\n            ';
  }
  function dropChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) {
    // Inline function 'kotlin.math.absoluteValue' call
    var tmp$ret$0 = abs(remoteNodeId);
    var tmp = '_d_ch_monitor_' + entityMetaData.c65_1 + '_' + tmp$ret$0.toString();
    // Inline function 'kotlin.text.lowercase' call
    // Inline function 'kotlin.text.substring' call
    // Inline function 'kotlin.js.asDynamic' call
    // Inline function 'kotlin.js.asDynamic' call
    var triggerName = tmp + ('_' + operation.substring(0, 2).toLowerCase());
    return 'DROP TRIGGER IF EXISTS ' + triggerName;
  }
  function acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation) {
    this.f6i_1 = $receivedUids;
    this.g6i_1 = $nodeId;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(acknowledgeReceivedReplications$slambda).l5f = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(acknowledgeReceivedReplications$slambda).he = function (p1, $completion) {
    return this.l5f((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(acknowledgeReceivedReplications$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            var tmp_0 = this;
            tmp_0.i6i_1 = this.f6i_1;
            this.j6i_1 = this.i6i_1.w();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!this.j6i_1.f()) {
              this.hd_1 = 3;
              continue $sm;
            }

            this.k6i_1 = this.j6i_1.e();
            var tmp_1 = this;
            tmp_1.l6i_1 = this.k6i_1;
            this.h6i_1.v5h(1, this.l6i_1);
            this.h6i_1.v5h(2, this.g6i_1);
            this.hd_1 = 2;
            suspendResult = executeUpdateAsyncKmp(this.h6i_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 1;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(acknowledgeReceivedReplications$slambda).m5f = function (stmt, completion) {
    var i = new acknowledgeReceivedReplications$slambda(this.f6i_1, this.g6i_1, completion);
    i.h6i_1 = stmt;
    return i;
  };
  function acknowledgeReceivedReplications$slambda_0($receivedUids, $nodeId, resultContinuation) {
    var i = new acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation);
    var l = function (stmt, $completion) {
      return i.l5f(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda(results) {
    return mapRows(results, selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda$lambda);
  }
  function selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda$lambda(result) {
    return new OutgoingReplication(result.y5m('orUid'), result.y5m('destNodeId'), result.x5m('orTableId'), result.y5m('orPk1'), result.y5m('orPk2'));
  }
  function selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation) {
    this.u6i_1 = $nodeId;
    this.v6i_1 = $limit;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).x6i = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).he = function (p1, $completion) {
    return this.x6i((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(selectPendingOutgoingReplicationsByDestNodeId$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.w6i_1.v5h(1, this.u6i_1);
            this.w6i_1.u5h(2, this.v6i_1);
            this.hd_1 = 1;
            suspendResult = executeQueryAsyncKmp(this.w6i_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            return useResults(ARGUMENT, selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda);
          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(selectPendingOutgoingReplicationsByDestNodeId$slambda).m5f = function (stmt, completion) {
    var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda(this.u6i_1, this.v6i_1, completion);
    i.w6i_1 = stmt;
    return i;
  };
  function selectPendingOutgoingReplicationsByDestNodeId$slambda_0($nodeId, $limit, resultContinuation) {
    var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation);
    var l = function (stmt, $completion) {
      return i.x6i(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation) {
    this.g6j_1 = $message;
    this.h6j_1 = $tableId;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(insertEntitiesFromMessage$slambda).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(insertEntitiesFromMessage$slambda).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(insertEntitiesFromMessage$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.i6j_1.v5h(1, this.g6j_1.c68_1);
            this.i6j_1.u5h(2, this.h6j_1);
            this.i6j_1.u5h(3, 0);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.i6j_1, 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(insertEntitiesFromMessage$slambda).m5f = function (stmt, completion) {
    var i = new insertEntitiesFromMessage$slambda(this.g6j_1, this.h6j_1, completion);
    i.i6j_1 = stmt;
    return i;
  };
  function insertEntitiesFromMessage$slambda_0($message, $tableId, resultContinuation) {
    var i = new insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function insertEntitiesFromMessage$slambda_1($tableEntities, $entityMetaData, $message, resultContinuation) {
    this.s6j_1 = $tableEntities;
    this.t6j_1 = $entityMetaData;
    this.u6j_1 = $message;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(insertEntitiesFromMessage$slambda_1).l5f = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(insertEntitiesFromMessage$slambda_1).he = function (p1, $completion) {
    return this.l5f((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(insertEntitiesFromMessage$slambda_1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            var tmp_0 = this;
            tmp_0.w6j_1 = this.s6j_1;
            this.x6j_1 = this.w6j_1.w();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!this.x6j_1.f()) {
              this.hd_1 = 3;
              continue $sm;
            }

            this.y6j_1 = this.x6j_1.e();
            var tmp_1 = this;
            tmp_1.z6j_1 = this.y6j_1;
            setAllFromJsonObject(this.v6j_1, this.z6j_1.c6k_1, this.t6j_1.h65_1);
            this.v6j_1.v5h(this.t6j_1.h65_1.u() + 1 | 0, this.u6j_1.c68_1);
            this.hd_1 = 2;
            suspendResult = executeUpdateAsyncKmp(this.v6j_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 1;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(insertEntitiesFromMessage$slambda_1).m5f = function (stmt, completion) {
    var i = new insertEntitiesFromMessage$slambda_1(this.s6j_1, this.t6j_1, this.u6j_1, completion);
    i.v6j_1 = stmt;
    return i;
  };
  function insertEntitiesFromMessage$slambda_2($tableEntities, $entityMetaData, $message, resultContinuation) {
    var i = new insertEntitiesFromMessage$slambda_1($tableEntities, $entityMetaData, $message, resultContinuation);
    var l = function (stmt, $completion) {
      return i.l5f(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation) {
    this.l6k_1 = $message;
    this.m6k_1 = $tableId;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(insertEntitiesFromMessage$slambda_3).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(insertEntitiesFromMessage$slambda_3).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(insertEntitiesFromMessage$slambda_3).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.n6k_1.v5h(1, this.l6k_1.c68_1);
            this.n6k_1.u5h(2, this.m6k_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.n6k_1, 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(insertEntitiesFromMessage$slambda_3).m5f = function (stmt, completion) {
    var i = new insertEntitiesFromMessage$slambda_3(this.l6k_1, this.m6k_1, completion);
    i.n6k_1 = stmt;
    return i;
  };
  function insertEntitiesFromMessage$slambda_4($message, $tableId, resultContinuation) {
    var i = new insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda$lambda($tableId, $primaryKeys, $entityMetaData) {
    return function (mapResult) {
      return new DoorReplicationEntity($tableId, $primaryKeys.f6h_1, rowToJsonObject(mapResult, $entityMetaData.h65_1));
    };
  }
  function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda($tableId, $primaryKeys, $entityMetaData) {
    return function (result) {
      return mapNextRow(result, null, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda$lambda($tableId, $primaryKeys, $entityMetaData));
    };
  }
  function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda($primaryKeysList, $entityMetaData, $tableId, resultContinuation) {
    this.w6k_1 = $primaryKeysList;
    this.x6k_1 = $entityMetaData;
    this.y6k_1 = $tableId;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).i6l = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).he = function (p1, $completion) {
    return this.i6l((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            var tmp_0 = this;
            tmp_0.a6l_1 = this.w6k_1;
            var tmp_1 = this;
            tmp_1.b6l_1 = this.a6l_1;
            var tmp_2 = this;
            tmp_2.c6l_1 = ArrayList_init_$Create$();
            var tmp_3 = this;
            tmp_3.d6l_1 = this.b6l_1;
            this.e6l_1 = this.d6l_1.w();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!this.e6l_1.f()) {
              this.hd_1 = 3;
              continue $sm;
            }

            this.f6l_1 = this.e6l_1.e();
            var tmp_4 = this;
            tmp_4.g6l_1 = this.f6l_1;
            var tmp_5 = this;
            tmp_5.h6l_1 = this.g6l_1;
            this.z6k_1.v5h(1, this.h6l_1.b6h_1);
            if (this.x6k_1.f65_1.u() >= 2) {
              this.z6k_1.v5h(2, this.h6l_1.c6h_1);
            }

            if (this.x6k_1.f65_1.u() >= 3) {
              this.z6k_1.v5h(3, this.h6l_1.d6h_1);
            }

            if (this.x6k_1.f65_1.u() >= 4) {
              this.z6k_1.v5h(3, this.h6l_1.e6h_1);
            }

            this.hd_1 = 2;
            suspendResult = executeQueryAsyncKmp(this.z6k_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var ARGUMENT = suspendResult;
            var tmp0_safe_receiver = useResults(ARGUMENT, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda(this.y6k_1, this.h6l_1, this.x6k_1));
            if (tmp0_safe_receiver == null)
              null;
            else {
              this.c6l_1.i1(tmp0_safe_receiver);
            }

            this.hd_1 = 1;
            continue $sm;
          case 3:
            return this.c6l_1;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).m5f = function (stmt, completion) {
    var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda(this.w6k_1, this.x6k_1, this.y6k_1, completion);
    i.z6k_1 = stmt;
    return i;
  };
  function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0($primaryKeysList, $entityMetaData, $tableId, resultContinuation) {
    var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda($primaryKeysList, $entityMetaData, $tableId, resultContinuation);
    var l = function (stmt, $completion) {
      return i.i6l(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function withRepoChangeMonitorAsync$slambda$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withRepoChangeMonitorAsync$slambda$slambda).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withRepoChangeMonitorAsync$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 = executeUpdateAsyncKmp(this.r6l_1, 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(withRepoChangeMonitorAsync$slambda$slambda).m5f = function (stmt, completion) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda(completion);
    i.r6l_1 = stmt;
    return i;
  };
  function withRepoChangeMonitorAsync$slambda$slambda_0(resultContinuation) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda(resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withRepoChangeMonitorAsync$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 = executeUpdateAsyncKmp(this.a6m_1, 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(withRepoChangeMonitorAsync$slambda$slambda_1).m5f = function (stmt, completion) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_1(completion);
    i.a6m_1 = stmt;
    return i;
  };
  function withRepoChangeMonitorAsync$slambda$slambda_2(resultContinuation) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).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 = executeUpdateAsyncKmp(this.j6m_1, 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(withRepoChangeMonitorAsync$slambda$slambda_3).m5f = function (stmt, completion) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_3(completion);
    i.j6m_1 = stmt;
    return i;
  };
  function withRepoChangeMonitorAsync$slambda$slambda_4(resultContinuation) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).j6j = function (stmt, $completion) {
    var tmp = this.m5f(stmt, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).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 = executeUpdateAsyncKmp(this.s6m_1, 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(withRepoChangeMonitorAsync$slambda$slambda_5).m5f = function (stmt, completion) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_5(completion);
    i.s6m_1 = stmt;
    return i;
  };
  function withRepoChangeMonitorAsync$slambda$slambda_6(resultContinuation) {
    var i = new withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation);
    var l = function (stmt, $completion) {
      return i.j6j(stmt, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function withRepoChangeMonitorAsync$slambda($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation) {
    this.b6n_1 = $this_withRepoChangeMonitorAsync;
    this.c6n_1 = $entityMetaData;
    this.d6n_1 = $remoteNodeId;
    this.e6n_1 = $block;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withRepoChangeMonitorAsync$slambda).h6n = function (it, $completion) {
    var tmp = this.p5r(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withRepoChangeMonitorAsync$slambda).he = function (p1, $completion) {
    return this.h6n(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withRepoChangeMonitorAsync$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 6;
            this.hd_1 = 1;
            var tmp_0 = this.b6n_1.x5i();
            var tmp_1 = createChangeMonitorTriggerSql(this.c6n_1, this.d6n_1, 'INSERT');
            suspendResult = prepareAndUseStatementAsync_0(tmp_0, tmp_1, VOID, withRepoChangeMonitorAsync$slambda$slambda_0(null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.hd_1 = 2;
            var tmp_2 = this.b6n_1.x5i();
            var tmp_3 = createChangeMonitorTriggerSql(this.c6n_1, this.d6n_1, 'UPDATE');
            suspendResult = prepareAndUseStatementAsync_0(tmp_2, tmp_3, VOID, withRepoChangeMonitorAsync$slambda$slambda_2(null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 3;
            suspendResult = this.e6n_1(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.g6n_1 = suspendResult;
            this.hd_1 = 4;
            var tmp_4 = this.b6n_1.x5i();
            var tmp_5 = dropChangeMonitorTriggerSql(this.c6n_1, this.d6n_1, 'INSERT');
            suspendResult = prepareAndUseStatementAsync_0(tmp_4, tmp_5, VOID, withRepoChangeMonitorAsync$slambda$slambda_4(null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            this.hd_1 = 5;
            var tmp_6 = this.b6n_1.x5i();
            var tmp_7 = dropChangeMonitorTriggerSql(this.c6n_1, this.d6n_1, 'UPDATE');
            suspendResult = prepareAndUseStatementAsync_0(tmp_6, tmp_7, VOID, withRepoChangeMonitorAsync$slambda$slambda_6(null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 5:
            return this.g6n_1;
          case 6:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 6) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(withRepoChangeMonitorAsync$slambda).p5r = function (it, completion) {
    var i = new withRepoChangeMonitorAsync$slambda(this.b6n_1, this.c6n_1, this.d6n_1, this.e6n_1, completion);
    i.f6n_1 = it;
    return i;
  };
  function withRepoChangeMonitorAsync$slambda_0($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation) {
    var i = new withRepoChangeMonitorAsync$slambda($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation);
    var l = function (it, $completion) {
      return i.h6n(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function onClientRepoDoorMessageHttpResponse$lambda($nodeEventManager, $httpResponse, $message) {
    return function () {
      return '[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.c6b() + '] - ' + get_request($httpResponse).i3b() + ' - ' + ('handle message with ' + $message.e68_1.u() + ' replications');
    };
  }
  function onClientRepoDoorMessageHttpResponse$lambda_0($nodeEventManager, $httpResponse) {
    return function () {
      return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.c6b() + '] - ' + get_request($httpResponse).i3b() + ' -' + ' http response was not modified or no content, no need to do anything';
    };
  }
  function onClientRepoDoorMessageHttpResponse$lambda_1($nodeEventManager, $httpResponse) {
    return function () {
      return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.c6b() + '] - ' + get_request($httpResponse).i3b() + ' -' + (' unexpected response status = ' + $httpResponse.j3b());
    };
  }
  function $selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17(_this__u8e3s4, nodeId, limit, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.x6f_1 = _this__u8e3s4;
    this.y6f_1 = nodeId;
    this.z6f_1 = limit;
  }
  protoOf($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 5;
            this.hd_1 = 1;
            suspendResult = prepareAndUseStatementAsync_0(this.x6f_1, '\n            SELECT OutgoingReplication.*\n              FROM OutgoingReplication\n             WHERE OutgoingReplication.destNodeId = ?\n          ORDER BY OutgoingReplication.orUid ASC\n             LIMIT ?\n        ', true, selectPendingOutgoingReplicationsByDestNodeId$slambda_0(this.y6f_1, this.z6f_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.a6g_1 = suspendResult;
            if (this.a6g_1.c1())
              return emptyList();
            var tmp_0 = this;
            var this_0 = this.a6g_1;
            var result = mutableLinkedListOf([]);
            var lastItemKey = null;
            var lastList = null;
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              var itemKey = item.u64_1;
              if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) {
                lastList.i1(item);
              } else {
                var newList = mutableLinkedListOf([item]);
                result.i1(newList);
                lastList = newList;
              }
              lastItemKey = itemKey;
            }

            tmp_0.b6g_1 = toList_0(result);
            var tmp_1 = this;
            tmp_1.c6g_1 = this.b6g_1;
            var tmp_2 = this;
            tmp_2.d6g_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this.b6g_1, 10));
            this.e6g_1 = this.c6g_1.w();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            if (!this.e6g_1.f()) {
              this.hd_1 = 4;
              continue $sm;
            }

            this.f6g_1 = this.e6g_1.e();
            var tmp_3 = this;
            tmp_3.g6g_1 = this.f6g_1;
            this.h6g_1 = first(this.g6g_1).u64_1;
            this.hd_1 = 3;
            var this_1 = this.a6g_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
            var tmp0_iterator_0 = this_1.w();
            while (tmp0_iterator_0.f()) {
              var item_0 = tmp0_iterator_0.e();
              destination.i1(new ReplicateEntityPrimaryKeys(item_0.v64_1, item_0.w64_1, item_0.x64_1, item_0.y64_1, item_0.s64_1));
            }

            suspendResult = selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(this.x6f_1, this.h6g_1, destination, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            var ARGUMENT = suspendResult;
            this.d6g_1.i1(ARGUMENT);
            this.hd_1 = 2;
            continue $sm;
          case 4:
            var ARGUMENT_0 = this.d6g_1;
            return flatten(ARGUMENT_0);
          case 5:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 5) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.q6g_1 = _this__u8e3s4;
    this.r6g_1 = message;
  }
  protoOf($insertEntitiesFromMessageCOROUTINE$18).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 9;
            this.s6g_1 = doorDatabaseMetadata(getKClassFromExpression(this.q6g_1));
            this.t6g_1 = this.s6g_1.n65().a1('ReplicationOperation');
            var tmp_0 = this;
            var this_0 = this.r6g_1.e68_1;
            var result = mutableLinkedListOf([]);
            var lastItemKey = null;
            var lastList = null;
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              var itemKey = item.a6k_1;
              if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) {
                lastList.i1(item);
              } else {
                var newList = mutableLinkedListOf([item]);
                result.i1(newList);
                lastList = newList;
              }
              lastItemKey = itemKey;
            }

            tmp_0.u6g_1 = toList_0(result);
            this.v6g_1 = this.u6g_1.w();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!this.v6g_1.f()) {
              this.hd_1 = 8;
              continue $sm;
            }

            this.w6g_1 = this.v6g_1.e();
            var tmp_1 = this;
            tmp_1.x6g_1 = this.w6g_1;
            this.y6g_1 = first(this.x6g_1).a6k_1;
            this.z6g_1 = this.s6g_1.m65(this.y6g_1);
            if (this.t6g_1) {
              this.hd_1 = 2;
              suspendResult = prepareAndUseStatementAsync_0(this.q6g_1, '\n                    INSERT INTO ReplicationOperation(repOpRemoteNodeId, repOpTableId, repOpStatus)\n                           VALUES(?, ?, ?)\n                    ', false, insertEntitiesFromMessage$slambda_0(this.r6g_1, this.y6g_1, null), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 3;
              continue $sm;
            }

          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            if (this.z6g_1.j65_1.equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) {
              this.hd_1 = 4;
              var tmp_2 = this.z6g_1.i6n();
              suspendResult = prepareAndUseStatementAsync_0(this.q6g_1, tmp_2, false, insertEntitiesFromMessage$slambda_2(this.x6g_1, this.z6g_1, this.r6g_1, null), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 5;
              continue $sm;
            }

          case 4:
            this.hd_1 = 5;
            continue $sm;
          case 5:
            if (this.t6g_1) {
              this.hd_1 = 6;
              suspendResult = prepareAndUseStatementAsync_0(this.q6g_1, '\n                    DELETE FROM ReplicationOperation\n                          WHERE repOpRemoteNodeId = ?\n                            AND repOpTableId = ?\n                    ', false, insertEntitiesFromMessage$slambda_4(this.r6g_1, this.y6g_1, null), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 7;
              continue $sm;
            }

          case 6:
            this.hd_1 = 7;
            continue $sm;
          case 7:
            this.hd_1 = 1;
            continue $sm;
          case 8:
            return Unit_instance;
          case 9:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 9) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.o6h_1 = _this__u8e3s4;
    this.p6h_1 = httpResponse;
    this.q6h_1 = json;
  }
  protoOf($onClientRepoDoorMessageHttpResponseCOROUTINE$20).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            this.r6h_1 = get_doorWrapper(this.o6h_1).n61();
            this.s6h_1 = this.r6h_1.b6b();
            this.t6h_1 = this.p6h_1.j3b();
            if (this.t6h_1.equals(Companion_getInstance().f2y_1)) {
              this.u6h_1 = Companion_getInstance_11().n4r();
              this.hd_1 = 1;
              suspendResult = bodyAsText(this.p6h_1, VOID, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              if (this.t6h_1.equals(Companion_getInstance().r2y_1) ? true : this.t6h_1.equals(Companion_getInstance().j2y_1)) {
                v(this.s6h_1, VOID, onClientRepoDoorMessageHttpResponse$lambda_0(this.r6h_1, this.p6h_1));
                this.hd_1 = 3;
                continue $sm;
              } else {
                e_0(this.s6h_1, VOID, onClientRepoDoorMessageHttpResponse$lambda_1(this.r6h_1, this.p6h_1));
                throw IllegalStateException_init_$Create$('' + this.o6h_1 + ' - unexpected response status - ' + this.p6h_1.j3b());
              }
            }

          case 1:
            this.v6h_1 = suspendResult;
            this.w6h_1 = this.q6h_1.s45(this.u6h_1, this.v6h_1);
            v(this.s6h_1, VOID, onClientRepoDoorMessageHttpResponse$lambda(this.r6h_1, this.p6h_1, this.w6h_1));
            this.hd_1 = 2;
            suspendResult = this.r6h_1.f6b(this.w6h_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function Companion_11() {
  }
  var Companion_instance_11;
  function Companion_getInstance_13() {
    return Companion_instance_11;
  }
  function $serializer_1() {
    $serializer_instance_1 = this;
    var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.DoorReplicationEntity', this, 3);
    tmp0_serialDesc.t4f('tableId', false);
    tmp0_serialDesc.t4f('orUid', false);
    tmp0_serialDesc.t4f('entity', false);
    this.j6n_1 = tmp0_serialDesc;
  }
  protoOf($serializer_1).q44 = function () {
    return this.j6n_1;
  };
  protoOf($serializer_1).k4g = function () {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return [IntSerializer_getInstance(), LongSerializer_getInstance(), JsonObjectSerializer_getInstance()];
  };
  protoOf($serializer_1).s44 = function (decoder) {
    var tmp0_desc = this.j6n_1;
    var tmp1_flag = true;
    var tmp2_index = 0;
    var tmp3_bitMask0 = 0;
    var tmp4_local0 = 0;
    var tmp5_local1 = new Long(0, 0);
    var tmp6_local2 = null;
    var tmp7_input = decoder.i48(tmp0_desc);
    if (tmp7_input.x48()) {
      tmp4_local0 = tmp7_input.n48(tmp0_desc, 0);
      tmp3_bitMask0 = tmp3_bitMask0 | 1;
      tmp5_local1 = tmp7_input.o48(tmp0_desc, 1);
      tmp3_bitMask0 = tmp3_bitMask0 | 2;
      tmp6_local2 = tmp7_input.u48(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2);
      tmp3_bitMask0 = tmp3_bitMask0 | 4;
    } else
      while (tmp1_flag) {
        tmp2_index = tmp7_input.y48(tmp0_desc);
        switch (tmp2_index) {
          case -1:
            tmp1_flag = false;
            break;
          case 0:
            tmp4_local0 = tmp7_input.n48(tmp0_desc, 0);
            tmp3_bitMask0 = tmp3_bitMask0 | 1;
            break;
          case 1:
            tmp5_local1 = tmp7_input.o48(tmp0_desc, 1);
            tmp3_bitMask0 = tmp3_bitMask0 | 2;
            break;
          case 2:
            tmp6_local2 = tmp7_input.u48(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2);
            tmp3_bitMask0 = tmp3_bitMask0 | 4;
            break;
          default:
            throw UnknownFieldException_init_$Create$(tmp2_index);
        }
      }
    tmp7_input.j48(tmp0_desc);
    return DoorReplicationEntity_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, null);
  };
  protoOf($serializer_1).k6n = function (encoder, value) {
    var tmp0_desc = this.j6n_1;
    var tmp1_output = encoder.i48(tmp0_desc);
    tmp1_output.r49(tmp0_desc, 0, value.a6k_1);
    tmp1_output.s49(tmp0_desc, 1, value.b6k_1);
    tmp1_output.y49(tmp0_desc, 2, JsonObjectSerializer_getInstance(), value.c6k_1);
    tmp1_output.j48(tmp0_desc);
  };
  protoOf($serializer_1).r44 = function (encoder, value) {
    return this.k6n(encoder, value instanceof DoorReplicationEntity ? value : THROW_CCE());
  };
  var $serializer_instance_1;
  function $serializer_getInstance_1() {
    if ($serializer_instance_1 == null)
      new $serializer_1();
    return $serializer_instance_1;
  }
  function DoorReplicationEntity_init_$Init$(seen1, tableId, orUid, entity, serializationConstructorMarker, $this) {
    if (!(7 === (7 & seen1))) {
      throwMissingFieldException(seen1, 7, $serializer_getInstance_1().j6n_1);
    }
    $this.a6k_1 = tableId;
    $this.b6k_1 = orUid;
    $this.c6k_1 = entity;
    return $this;
  }
  function DoorReplicationEntity_init_$Create$(seen1, tableId, orUid, entity, serializationConstructorMarker) {
    return DoorReplicationEntity_init_$Init$(seen1, tableId, orUid, entity, serializationConstructorMarker, objectCreate(protoOf(DoorReplicationEntity)));
  }
  function DoorReplicationEntity(tableId, orUid, entity) {
    this.a6k_1 = tableId;
    this.b6k_1 = orUid;
    this.c6k_1 = entity;
  }
  protoOf(DoorReplicationEntity).toString = function () {
    return 'DoorReplicationEntity(tableId=' + this.a6k_1 + ', orUid=' + this.b6k_1.toString() + ', entity=' + this.c6k_1 + ')';
  };
  protoOf(DoorReplicationEntity).hashCode = function () {
    var result = this.a6k_1;
    result = imul(result, 31) + this.b6k_1.hashCode() | 0;
    result = imul(result, 31) + this.c6k_1.hashCode() | 0;
    return result;
  };
  protoOf(DoorReplicationEntity).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof DoorReplicationEntity))
      return false;
    var tmp0_other_with_cast = other instanceof DoorReplicationEntity ? other : THROW_CCE();
    if (!(this.a6k_1 === tmp0_other_with_cast.a6k_1))
      return false;
    if (!this.b6k_1.equals(tmp0_other_with_cast.b6k_1))
      return false;
    if (!this.c6k_1.equals(tmp0_other_with_cast.c6k_1))
      return false;
    return true;
  };
  function DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda($receivedAck, this$0, $nodeId, $batchSize, resultContinuation) {
    this.t6n_1 = $receivedAck;
    this.u6n_1 = this$0;
    this.v6n_1 = $nodeId;
    this.w6n_1 = $batchSize;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).y6n = function (it, $completion) {
    var tmp = this.p5r(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).he = function (p1, $completion) {
    return this.y6n(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            if (!this.t6n_1.z6n_1.c1()) {
              this.hd_1 = 1;
              suspendResult = acknowledgeReceivedReplications(this.u6n_1.a6o_1, this.v6n_1, this.t6n_1.z6n_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 2;
              continue $sm;
            }

          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            suspendResult = selectPendingOutgoingReplicationsByDestNodeId(this.u6n_1.a6o_1, this.v6n_1, this.w6n_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            return suspendResult;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).p5r = function (it, completion) {
    var i = new DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda(this.t6n_1, this.u6n_1, this.v6n_1, this.w6n_1, completion);
    i.x6n_1 = it;
    return i;
  };
  function DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda_0($receivedAck, this$0, $nodeId, $batchSize, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda($receivedAck, this$0, $nodeId, $batchSize, resultContinuation);
    var l = function (it, $completion) {
      return i.y6n(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda($fakeRemoteNodeId, $endpointUrl, resultContinuation) {
    this.j6o_1 = $fakeRemoteNodeId;
    this.k6o_1 = $endpointUrl;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).j6j = function (it, $completion) {
    var tmp = this.m5f(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$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.l6o_1.v5h(1, this.j6o_1);
            this.l6o_1.y5h(2, this.k6o_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.l6o_1, 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(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).m5f = function (it, completion) {
    var i = new DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda(this.j6o_1, this.k6o_1, completion);
    i.l6o_1 = it;
    return i;
  };
  function DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda_0($fakeRemoteNodeId, $endpointUrl, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda($fakeRemoteNodeId, $endpointUrl, resultContinuation);
    var l = function (it, $completion) {
      return i.j6j(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $invokeCOROUTINE$21(_this__u8e3s4, fakeRemoteNodeId, endpointUrl, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.u6o_1 = _this__u8e3s4;
    this.v6o_1 = fakeRemoteNodeId;
    this.w6o_1 = endpointUrl;
  }
  protoOf($invokeCOROUTINE$21).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 = prepareAndUseStatementAsync_0(this.u6o_1.x6o_1, '\n                INSERT INTO PendingRepositorySession(remoteNodeId, endpointUrl)\n                            VALUES(?, ?)\n                ', VOID, DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda_0(this.v6o_1, this.w6o_1, null), 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);
  };
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda($remoteNodeId, $endpointUrl, resultContinuation) {
    this.g6p_1 = $remoteNodeId;
    this.h6p_1 = $endpointUrl;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).j6j = function (it, $completion) {
    var tmp = this.m5f(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$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.i6p_1.v5h(1, this.g6p_1);
            this.i6p_1.y5h(2, this.h6p_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.i6p_1, 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(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).m5f = function (it, completion) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda(this.g6p_1, this.h6p_1, completion);
    i.i6p_1 = it;
    return i;
  };
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_0($remoteNodeId, $endpointUrl, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda($remoteNodeId, $endpointUrl, resultContinuation);
    var l = function (it, $completion) {
      return i.j6j(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1($endpointUrl, resultContinuation) {
    this.r6p_1 = $endpointUrl;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).j6j = function (it, $completion) {
    var tmp = this.m5f(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).he = function (p1, $completion) {
    return this.j6j((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$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.s6p_1.y5h(1, this.r6p_1);
            this.hd_1 = 1;
            suspendResult = executeUpdateAsyncKmp(this.s6p_1, 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(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).m5f = function (it, completion) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1(this.r6p_1, completion);
    i.s6p_1 = it;
    return i;
  };
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_2($endpointUrl, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1($endpointUrl, resultContinuation);
    var l = function (it, $completion) {
      return i.j6j(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this$0, $remoteNodeId, $endpointUrl, resultContinuation) {
    this.b6q_1 = this$0;
    this.c6q_1 = $remoteNodeId;
    this.d6q_1 = $endpointUrl;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).f6q = function (it, $completion) {
    var tmp = this.p5r(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).he = function (p1, $completion) {
    return this.f6q(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).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 = prepareAndUseStatementAsync_0(this.b6q_1.g6q_1, '\n                        UPDATE OutgoingReplication\n                           SET destNodeId = ?\n                         WHERE destNodeId IN\n                               (SELECT PendingRepositorySession.remoteNodeId\n                                  FROM PendingRepositorySession\n                                 WHERE endpointUrl = ?)  \n                        ', false, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_0(this.c6q_1, this.d6q_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.hd_1 = 2;
            suspendResult = prepareAndUseStatementAsync_0(this.b6q_1.g6q_1, '\n                        DELETE \n                          FROM PendingRepositorySession\n                         WHERE PendingRepositorySession.endpointUrl = ?\n                        ', false, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_2(this.d6q_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return suspendResult;
          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);
  };
  protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).p5r = function (it, completion) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this.b6q_1, this.c6q_1, this.d6q_1, completion);
    i.e6q_1 = it;
    return i;
  };
  function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda_0(this$0, $remoteNodeId, $endpointUrl, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this$0, $remoteNodeId, $endpointUrl, resultContinuation);
    var l = function (it, $completion) {
      return i.f6q(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $invokeCOROUTINE$22(_this__u8e3s4, remoteNodeId, endpointUrl, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.p6q_1 = _this__u8e3s4;
    this.q6q_1 = remoteNodeId;
    this.r6q_1 = endpointUrl;
  }
  protoOf($invokeCOROUTINE$22).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 = withDoorTransactionAsync(this.p6q_1.g6q_1, VOID, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda_0(this.p6q_1, this.q6q_1, this.r6q_1, null), 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);
  };
  function DoorRepositoryReplicationClient$slambda$lambda(this$0) {
    return function () {
      return this$0.k63_1 + ' getRemoteNodeId : requesting node id of server';
    };
  }
  function DoorRepositoryReplicationClient$slambda$lambda_0(this$0, $remoteNodeIdResponse, $nodeIdHeaderVal) {
    return function () {
      return this$0.k63_1 + ' getRemoteNodeId : got server node id: status=' + $remoteNodeIdResponse.j3b() + ' ' + toString_0($nodeIdHeaderVal);
    };
  }
  function DoorRepositoryReplicationClient$slambda$lambda_1(this$0) {
    return function () {
      return this$0.k63_1 + ' getRemoteNodeId : exception getting remote node id';
    };
  }
  function DoorRepositoryReplicationClient$slambda$slambda$slambda($remoteNodeIdVal, this$0, resultContinuation) {
    this.a6r_1 = $remoteNodeIdVal;
    this.b6r_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).d6r = function (events, $completion) {
    var tmp = this.e6r(events, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).he = function (p1, $completion) {
    return this.d6r((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        if (tmp === 0) {
          this.id_1 = 1;
          var tmp$ret$0;
          l$ret$1: do {
            var this_0 = this.c6r_1;
            var tmp_0;
            if (isInterface(this_0, Collection)) {
              tmp_0 = this_0.c1();
            } else {
              tmp_0 = false;
            }
            if (tmp_0) {
              tmp$ret$0 = false;
              break l$ret$1;
            }
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var element = tmp0_iterator.e();
              var tmp_1;
              if (element.l68_1.equals(this.a6r_1)) {
                Companion_getInstance_11();
                tmp_1 = element.k68_1 === 1;
              } else {
                tmp_1 = false;
              }
              if (tmp_1) {
                tmp$ret$0 = true;
                break l$ret$1;
              }
            }
            tmp$ret$0 = false;
          }
           while (false);
          if (tmp$ret$0) {
            this.b6r_1.t63_1.w19(Unit_instance);
          }
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).e6r = function (events, completion) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda(this.a6r_1, this.b6r_1, completion);
    i.c6r_1 = events;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda$slambda$slambda_0($remoteNodeIdVal, this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda($remoteNodeIdVal, this$0, resultContinuation);
    var l = function (events, $completion) {
      return i.d6r(events, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda$slambda$slambda_1($remoteNodeIdVal, this$0, resultContinuation) {
    this.n6r_1 = $remoteNodeIdVal;
    this.o6r_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).q6r = function (message, $completion) {
    var tmp = this.r6r(message, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).he = function (p1, $completion) {
    return this.q6r(p1 instanceof DoorMessage ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        if (tmp === 0) {
          this.id_1 = 1;
          var tmp_0;
          if (this.p6r_1.c68_1.equals(this.n6r_1)) {
            Companion_getInstance_11();
            tmp_0 = this.p6r_1.b68_1 === 1;
          } else {
            tmp_0 = false;
          }
          if (tmp_0) {
            this.o6r_1.s63_1.w19(Unit_instance);
          }
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).r6r = function (message, completion) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda_1(this.n6r_1, this.o6r_1, completion);
    i.p6r_1 = message;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda$slambda$slambda_2($remoteNodeIdVal, this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda_1($remoteNodeIdVal, this$0, resultContinuation);
    var l = function (message, $completion) {
      return i.q6r(message, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda$slambda(this$0, $remoteNodeIdVal, resultContinuation) {
    this.a6s_1 = this$0;
    this.b6s_1 = $remoteNodeIdVal;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$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;
            var tmp_0 = this.a6s_1.d63_1.d6b();
            var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_0(this.b6s_1, this.a6s_1, null);
            suspendResult = tmp_0.a1c(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_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(DoorRepositoryReplicationClient$slambda$slambda).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda(this.a6s_1, this.b6s_1, completion);
    i.c6s_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda$slambda_0(this$0, $remoteNodeIdVal, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda(this$0, $remoteNodeIdVal, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda$slambda_1(this$0, $remoteNodeIdVal, resultContinuation) {
    this.l6s_1 = this$0;
    this.m6s_1 = $remoteNodeIdVal;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$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;
            var tmp_0 = this.l6s_1.d63_1.e6b();
            var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_2(this.m6s_1, this.l6s_1, null);
            suspendResult = tmp_0.a1c(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_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(DoorRepositoryReplicationClient$slambda$slambda_1).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda_1(this.l6s_1, this.m6s_1, completion);
    i.n6s_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda$slambda_2(this$0, $remoteNodeIdVal, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda$slambda_1(this$0, $remoteNodeIdVal, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function ClientState(initialized) {
    initialized = initialized === VOID ? false : initialized;
    this.o6s_1 = initialized;
  }
  protoOf(ClientState).p6s = function (initialized) {
    return new ClientState(initialized);
  };
  protoOf(ClientState).toString = function () {
    return 'ClientState(initialized=' + this.o6s_1 + ')';
  };
  protoOf(ClientState).hashCode = function () {
    return getBooleanHashCode(this.o6s_1);
  };
  protoOf(ClientState).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof ClientState))
      return false;
    var tmp0_other_with_cast = other instanceof ClientState ? other : THROW_CCE();
    if (!(this.o6s_1 === tmp0_other_with_cast.o6s_1))
      return false;
    return true;
  };
  function DoorRepositoryReplicationClient_init_$Init$(db, repositoryConfig, scope, nodeEventManager, retryInterval, $this) {
    DoorRepositoryReplicationClient.call($this, get_doorWrapperNodeId(db), repositoryConfig.u65_1, repositoryConfig.w65_1, repositoryConfig.x65_1, repositoryConfig.t65_1, scope, nodeEventManager, new DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db), new DefaultOnStartPendingSession(db), new DefaultOnPendingSessionResolved(db), repositoryConfig.y65_1, repositoryConfig.z65_1, retryInterval);
    return $this;
  }
  function DoorRepositoryReplicationClient_init_$Create$(db, repositoryConfig, scope, nodeEventManager, retryInterval) {
    return DoorRepositoryReplicationClient_init_$Init$(db, repositoryConfig, scope, nodeEventManager, retryInterval, objectCreate(protoOf(DoorRepositoryReplicationClient)));
  }
  function DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db) {
    this.a6o_1 = db;
  }
  protoOf(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications).q6s = function (nodeId, receivedAck, batchSize, $completion) {
    return withDoorTransactionAsync(this.a6o_1, VOID, DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda_0(receivedAck, this, nodeId, batchSize, null), $completion);
  };
  function DefaultOnStartPendingSession(db) {
    this.x6o_1 = db;
  }
  protoOf(DefaultOnStartPendingSession).r6s = function (fakeRemoteNodeId, endpointUrl, $completion) {
    var tmp = new $invokeCOROUTINE$21(this, fakeRemoteNodeId, endpointUrl, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function DefaultOnPendingSessionResolved(db) {
    this.g6q_1 = db;
  }
  protoOf(DefaultOnPendingSessionResolved).r6s = function (remoteNodeId, endpointUrl, $completion) {
    var tmp = new $invokeCOROUTINE$22(this, remoteNodeId, endpointUrl, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function runSendLoop(_this__u8e3s4, $this, $completion) {
    var tmp = new $runSendLoopCOROUTINE$23($this, _this__u8e3s4, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function runFetchLoop(_this__u8e3s4, $this, $completion) {
    var tmp = new $runFetchLoopCOROUTINE$24($this, _this__u8e3s4, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function Companion_12() {
    this.m6u_1 = 'replication';
  }
  var Companion_instance_12;
  function Companion_getInstance_14() {
    return Companion_instance_12;
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0(function_0) {
    this.n6u_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).t1d = function (value, $completion) {
    return this.n6u_1(value, $completion);
  };
  function DoorRepositoryReplicationClient$slambda(this$0, resultContinuation) {
    this.w6u_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 10;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!(get_isActive(this.x6u_1) ? !this.w6u_1.v63_1.yq() : false)) {
              this.hd_1 = 11;
              continue $sm;
            }

            this.id_1 = 6;
            this.hd_1 = 2;
            suspendResult = this.w6u_1.f63_1.r6s(this.w6u_1.n63_1, this.w6u_1.c63_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            v(this.w6u_1.h63_1, VOID, DoorRepositoryReplicationClient$slambda$lambda(this.w6u_1));
            var tmp_0 = this;
            tmp_0.y6u_1 = this.w6u_1.a63_1;
            var tmp_1 = this;
            tmp_1.z6u_1 = this.y6u_1;
            var tmp_2 = this;
            var this_0 = new HttpRequestBuilder();
            doorNodeIdHeader_0(this_0, this.w6u_1.y62_1, this.w6u_1.z62_1);
            setRepoUrl(this_0, this.w6u_1.c63_1, 'replication/nodeId');
            tmp_2.a6v_1 = this_0;
            this.a6v_1.w38_1 = Companion_getInstance_0().l2x_1;
            var tmp_3 = this;
            tmp_3.b6v_1 = this.z6u_1;
            var tmp_4 = this;
            tmp_4.c6v_1 = this.a6v_1;
            this.hd_1 = 3;
            suspendResult = (new HttpStatement(this.c6v_1, this.b6v_1)).h3z(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.d6v_1 = suspendResult;
            var tmp_5 = this;
            var tmp_6 = this.d6v_1.k2x();
            var tmp0_safe_receiver = tmp_6.ba('door-node-id');
            tmp_5.e6v_1 = tmp0_safe_receiver == null ? null : toLong_0(tmp0_safe_receiver);
            v(this.w6u_1.h63_1, VOID, DoorRepositoryReplicationClient$slambda$lambda_0(this.w6u_1, this.d6v_1, this.e6v_1));
            if (!(this.e6v_1 == null)) {
              this.w6u_1.v63_1.gy(this.e6v_1);
              this.hd_1 = 4;
              suspendResult = this.w6u_1.g63_1.r6s(this.e6v_1, this.w6u_1.c63_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              throw IllegalStateException_init_$Create$(this.w6u_1.k63_1 + ' getRemoteNodeId : server did not provide node id');
            }

          case 4:
            l$ret$1: do {
              var this_1 = this.w6u_1.l63_1;
              while (true) {
                var prevValue = this_1.t2();
                var nextValue = prevValue.p6s(true);
                if (this_1.y1k(prevValue, nextValue)) {
                  break l$ret$1;
                }
              }
            }
             while (false);
            this.hd_1 = 5;
            continue $sm;
          case 5:
            this.id_1 = 10;
            this.hd_1 = 9;
            continue $sm;
          case 6:
            this.id_1 = 10;
            var tmp_7 = this.kd_1;
            if (tmp_7 instanceof Exception) {
              this.f6v_1 = this.kd_1;
              var tmp_8 = this.f6v_1;
              if (!(tmp_8 instanceof CancellationException)) {
                w(this.w6u_1.h63_1, this.f6v_1, DoorRepositoryReplicationClient$slambda$lambda_1(this.w6u_1));
                this.hd_1 = 7;
                suspendResult = delay(toLong(this.w6u_1.j63_1), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 8;
                continue $sm;
              }
            } else {
              throw this.kd_1;
            }

          case 7:
            this.hd_1 = 8;
            continue $sm;
          case 8:
            this.hd_1 = 9;
            continue $sm;
          case 9:
            this.id_1 = 10;
            this.hd_1 = 1;
            continue $sm;
          case 10:
            throw this.kd_1;
          case 11:
            return Unit_instance;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 10) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(DoorRepositoryReplicationClient$slambda).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda(this.w6u_1, completion);
    i.x6u_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda_0(this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation) {
    this.o6v_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda_1).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda_1).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$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 = runFetchLoop(this.p6v_1, this.o6v_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(DoorRepositoryReplicationClient$slambda_1).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda_1(this.o6v_1, completion);
    i.p6v_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda_2(this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation) {
    this.y6v_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda_3).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda_3).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$slambda_3).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 = runSendLoop(this.z6v_1, this.y6v_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(DoorRepositoryReplicationClient$slambda_3).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda_3(this.y6v_1, completion);
    i.z6v_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda_4(this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation) {
    this.i6w_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorRepositoryReplicationClient$slambda_5).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorRepositoryReplicationClient$slambda_5).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorRepositoryReplicationClient$slambda_5).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.i6w_1.v63_1.nv(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var remoteNodeIdVal = suspendResult;
            launch(this.j6w_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_0(this.i6w_1, remoteNodeIdVal, null));
            launch(this.j6w_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_2(this.i6w_1, remoteNodeIdVal, null));
            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(DoorRepositoryReplicationClient$slambda_5).v1m = function ($this$launch, completion) {
    var i = new DoorRepositoryReplicationClient$slambda_5(this.i6w_1, completion);
    i.j6w_1 = $this$launch;
    return i;
  };
  function DoorRepositoryReplicationClient$slambda_6(this$0, resultContinuation) {
    var i = new DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorRepositoryReplicationClient$runSendLoop$lambda(this$0, $outgoingReplicationsToAck) {
    return function () {
      return this$0.k63_1 + ' : runSendLoop : querying db to mark ' + $outgoingReplicationsToAck.u() + ' entities as ' + 'acknowledged by server and get next batch of replications to send';
    };
  }
  function DoorRepositoryReplicationClient$runSendLoop$lambda_0(this$0, $outgoingReplications) {
    return function () {
      return this$0.k63_1 + ' : runSendLoop : found ' + $outgoingReplications.u() + ' pending outgoing replications ' + 'to send';
    };
  }
  function DoorRepositoryReplicationClient$runSendLoop$lambda_1(this$0, $outgoingReplications) {
    return function () {
      return this$0.k63_1 + ' : runSendLoop : sending ' + $outgoingReplications.u() + ' to server ';
    };
  }
  function DoorRepositoryReplicationClient$runSendLoop$lambda_2(this$0, $replicationResponse, $replicationReceivedAck) {
    return function () {
      return this$0.k63_1 + ' : runSendLoop : received reply from server status= ' + $replicationResponse.j3b() + ' ' + (' acknowledges ' + $replicationReceivedAck.z6n_1.u() + ' entities');
    };
  }
  function DoorRepositoryReplicationClient$runSendLoop$lambda_3(this$0) {
    return function () {
      return this$0.k63_1 + ' exception sending outgoing replications';
    };
  }
  function DoorRepositoryReplicationClient$runFetchLoop$lambda(this$0, $acknowledgementsToSend) {
    return function () {
      return this$0.k63_1 + ' : runFetchLoop: acknowledging ' + $acknowledgementsToSend.u() + ' entities received and ' + 'request next batch of pending replications';
    };
  }
  function DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this$0, $entitiesReceivedResponse) {
    return function () {
      return this$0.k63_1 + ' : runFetchLoop: received response status = ' + $entitiesReceivedResponse.j3b();
    };
  }
  function DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this$0, $entitiesReceivedMessage) {
    return function () {
      return this$0.k63_1 + ' : runFetchLoop: received ' + $entitiesReceivedMessage.e68_1.u() + ' replications incoming';
    };
  }
  function DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this$0, $entitiesReceivedMessage) {
    return function () {
      return this$0.k63_1 + ' : runFetchLoop: delivered ' + $entitiesReceivedMessage.e68_1.u() + ' replications to node event manager';
    };
  }
  function DoorRepositoryReplicationClient$runFetchLoop$lambda_3($e) {
    return function () {
      return 'DoorRepositoryReplicationClient: : runFetchLoop: exception (probably offline): ' + $e;
    };
  }
  function $runSendLoopCOROUTINE$23(_this__u8e3s4, _this__u8e3s4_0, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.a6t_1 = _this__u8e3s4;
    this.b6t_1 = _this__u8e3s4_0;
  }
  protoOf($runSendLoopCOROUTINE$23).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 14;
            this.hd_1 = 1;
            suspendResult = this.a6t_1.v63_1.nv(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.c6t_1 = suspendResult;
            var tmp_0 = this;
            tmp_0.d6t_1 = ArrayList_init_$Create$();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            if (!get_isActive(this.b6t_1)) {
              this.hd_1 = 13;
              continue $sm;
            }

            this.id_1 = 9;
            if (this.d6t_1.c1()) {
              this.hd_1 = 3;
              suspendResult = this.a6t_1.t63_1.y19(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 4;
              continue $sm;
            }

          case 3:
            this.hd_1 = 4;
            continue $sm;
          case 4:
            v(this.a6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda(this.a6t_1, this.d6t_1));
            this.hd_1 = 5;
            suspendResult = this.a6t_1.e63_1.q6s(this.c6t_1, new ReplicationReceivedAck(this.d6t_1), this.a6t_1.u63_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 5:
            this.e6t_1 = suspendResult;
            v(this.a6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_0(this.a6t_1, this.e6t_1));
            this.d6t_1.n1();
            if (!this.e6t_1.c1()) {
              v(this.a6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_1(this.a6t_1, this.e6t_1));
              var tmp_1 = this;
              tmp_1.f6t_1 = this.a6t_1.a63_1;
              var tmp_2 = this;
              tmp_2.g6t_1 = this.f6t_1;
              var tmp_3 = this;
              var this_0 = new HttpRequestBuilder();
              setRepoUrl(this_0, this.a6t_1.c63_1, 'replication/message');
              doorNodeIdHeader_0(this_0, this.a6t_1.y62_1, this.a6t_1.z62_1);
              contentType(this_0, Application_getInstance().v2r_1);
              var tmp_4 = Companion_getInstance_11().n4r();
              Companion_getInstance_11();
              setBodyJson(this_0, this.a6t_1.b63_1, tmp_4, new DoorMessage(1, this.a6t_1.y62_1, this.c6t_1, this.e6t_1));
              tmp_3.h6t_1 = this_0;
              this.h6t_1.w38_1 = Companion_getInstance_0().m2x_1;
              var tmp_5 = this;
              tmp_5.i6t_1 = this.g6t_1;
              var tmp_6 = this;
              tmp_6.j6t_1 = this.h6t_1;
              this.hd_1 = 6;
              suspendResult = (new HttpStatement(this.j6t_1, this.i6t_1)).h3z(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 8;
              continue $sm;
            }

          case 6:
            this.k6t_1 = suspendResult;
            this.l6t_1 = this.a6t_1.b63_1;
            this.m6t_1 = Companion_getInstance_15().n4r();
            this.hd_1 = 7;
            suspendResult = bodyAsText(this.k6t_1, VOID, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 7:
            this.n6t_1 = suspendResult;
            this.o6t_1 = this.l6t_1.s45(this.m6t_1, this.n6t_1);
            v(this.a6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_2(this.a6t_1, this.k6t_1, this.o6t_1));
            this.d6t_1.m1(this.o6t_1.z6n_1);
            this.hd_1 = 8;
            continue $sm;
          case 8:
            this.id_1 = 14;
            this.hd_1 = 12;
            continue $sm;
          case 9:
            this.id_1 = 14;
            var tmp_7 = this.kd_1;
            if (tmp_7 instanceof Exception) {
              this.p6t_1 = this.kd_1;
              var tmp_8 = this.p6t_1;
              if (!(tmp_8 instanceof CancellationException)) {
                d_0(this.a6t_1.h63_1, this.p6t_1, DoorRepositoryReplicationClient$runSendLoop$lambda_3(this.a6t_1));
                this.hd_1 = 10;
                suspendResult = delay(toLong(this.a6t_1.j63_1), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 11;
                continue $sm;
              }
            } else {
              throw this.kd_1;
            }

          case 10:
            this.hd_1 = 11;
            continue $sm;
          case 11:
            this.hd_1 = 12;
            continue $sm;
          case 12:
            this.id_1 = 14;
            this.hd_1 = 2;
            continue $sm;
          case 13:
            return Unit_instance;
          case 14:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 14) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $runFetchLoopCOROUTINE$24(_this__u8e3s4, _this__u8e3s4_0, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.y6t_1 = _this__u8e3s4;
    this.z6t_1 = _this__u8e3s4_0;
  }
  protoOf($runFetchLoopCOROUTINE$24).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 13;
            var tmp_0 = this;
            tmp_0.a6u_1 = ArrayList_init_$Create$();
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!get_isActive(this.z6t_1)) {
              this.hd_1 = 12;
              continue $sm;
            }

            this.id_1 = 8;
            if (this.a6u_1.c1()) {
              this.hd_1 = 2;
              suspendResult = this.y6t_1.s63_1.y19(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 3;
              continue $sm;
            }

          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            v(this.y6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda(this.y6t_1, this.a6u_1));
            var tmp_1 = this;
            tmp_1.b6u_1 = this.y6t_1.a63_1;
            var tmp_2 = this;
            tmp_2.c6u_1 = this.b6u_1;
            var tmp_3 = this;
            var this_0 = new HttpRequestBuilder();
            doorNodeIdHeader_0(this_0, this.y6t_1.y62_1, this.y6t_1.z62_1);
            setRepoUrl(this_0, this.y6t_1.c63_1, 'replication/ackAndGetPendingReplications');
            contentType(this_0, Application_getInstance().v2r_1);
            setBodyJson(this_0, this.y6t_1.b63_1, Companion_getInstance_15().n4r(), new ReplicationReceivedAck(this.a6u_1));
            tmp_3.d6u_1 = this_0;
            this.d6u_1.w38_1 = Companion_getInstance_0().m2x_1;
            var tmp_4 = this;
            tmp_4.e6u_1 = this.c6u_1;
            var tmp_5 = this;
            tmp_5.f6u_1 = this.d6u_1;
            this.hd_1 = 4;
            suspendResult = (new HttpStatement(this.f6u_1, this.e6u_1)).h3z(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            this.g6u_1 = suspendResult;
            v(this.y6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this.y6t_1, this.g6u_1));
            this.a6u_1.n1();
            if (this.g6u_1.j3b().equals(Companion_getInstance().f2y_1)) {
              this.h6u_1 = this.y6t_1.b63_1;
              this.i6u_1 = Companion_getInstance_11().n4r();
              this.hd_1 = 5;
              suspendResult = bodyAsText(this.g6u_1, VOID, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.hd_1 = 7;
              continue $sm;
            }

          case 5:
            this.j6u_1 = suspendResult;
            this.k6u_1 = this.h6u_1.s45(this.i6u_1, this.j6u_1);
            v(this.y6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this.y6t_1, this.k6u_1));
            this.hd_1 = 6;
            suspendResult = this.y6t_1.d63_1.f6b(this.k6u_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 6:
            var this_1 = this.k6u_1.e68_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
            var tmp0_iterator = this_1.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              destination.i1(item.b6k_1);
            }

            this.a6u_1.m1(destination);
            v(this.y6t_1.h63_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this.y6t_1, this.k6u_1));
            this.hd_1 = 7;
            continue $sm;
          case 7:
            if (this.g6u_1.j3b().equals(Companion_getInstance().j2y_1)) {
              this.y6t_1.o63_1 = this.g6u_1.r3c().o2o_1;
            }

            this.id_1 = 13;
            this.hd_1 = 11;
            continue $sm;
          case 8:
            this.id_1 = 13;
            var tmp_6 = this.kd_1;
            if (tmp_6 instanceof Exception) {
              this.l6u_1 = this.kd_1;
              var tmp_7 = this.l6u_1;
              if (!(tmp_7 instanceof CancellationException)) {
                v(this.y6t_1.h63_1, this.l6u_1, DoorRepositoryReplicationClient$runFetchLoop$lambda_3(this.l6u_1));
                this.hd_1 = 9;
                suspendResult = delay(toLong(this.y6t_1.j63_1), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 10;
                continue $sm;
              }
            } else {
              throw this.kd_1;
            }

          case 9:
            this.hd_1 = 10;
            continue $sm;
          case 10:
            this.hd_1 = 11;
            continue $sm;
          case 11:
            this.id_1 = 13;
            this.hd_1 = 1;
            continue $sm;
          case 12:
            return Unit_instance;
          case 13:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 13) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function DoorRepositoryReplicationClient(localNodeId, localNodeAuth, httpClient, json, repoEndpointUrl, scope, nodeEventManager, onMarkAcknowledgedAndGetNextOutgoingReplications, onStartPendingSession, onPendingSessionResolved, logger, dbName, retryInterval) {
    retryInterval = retryInterval === VOID ? 10000 : retryInterval;
    this.y62_1 = localNodeId;
    this.z62_1 = localNodeAuth;
    this.a63_1 = httpClient;
    this.b63_1 = json;
    this.c63_1 = repoEndpointUrl;
    this.d63_1 = nodeEventManager;
    this.e63_1 = onMarkAcknowledgedAndGetNextOutgoingReplications;
    this.f63_1 = onStartPendingSession;
    this.g63_1 = onPendingSessionResolved;
    this.h63_1 = logger;
    this.i63_1 = dbName;
    this.j63_1 = retryInterval;
    this.k63_1 = '[DoorRepositoryReplicationClient - ' + this.i63_1 + ' - endpoint=' + this.c63_1 + ']';
    this.l63_1 = MutableStateFlow(new ClientState());
    this.m63_1 = asStateFlow(this.l63_1);
    this.n63_1 = Default_getInstance().xj(new Long(-10000, -1), new Long(-1, -1));
    d(this.h63_1, this.k63_1 + ' init');
    this.o63_1 = new Long(0, 0);
    this.s63_1 = Channel(1);
    this.t63_1 = Channel(1);
    this.u63_1 = 1000;
    this.v63_1 = CompletableDeferred();
    launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_0(this, null));
    var tmp = this;
    tmp.p63_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_2(this, null));
    var tmp_0 = this;
    tmp_0.q63_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_4(this, null));
    var tmp_1 = this;
    tmp_1.r63_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_6(this, null));
    this.s63_1.w19(Unit_instance);
    this.t63_1.w19(Unit_instance);
  }
  protoOf(DoorRepositoryReplicationClient).m61 = function () {
    var tmp;
    if (this.v63_1.yq()) {
      tmp = this.v63_1.et();
    } else {
      tmp = this.n63_1;
    }
    return tmp;
  };
  function ReplicationConstants() {
    this.l6w_1 = 'fromNodeId';
  }
  var ReplicationConstants_instance;
  function ReplicationConstants_getInstance() {
    return ReplicationConstants_instance;
  }
  function ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w(it) {
    return it + ' = ?';
  }
  function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda(it) {
    return it.e66_1;
  }
  function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this$0) {
    return function () {
      var tmp = joinToString(this$0.h65_1, VOID, VOID, VOID, VOID, VOID, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda);
      // Inline function 'kotlin.collections.map' call
      var this_0 = numberRangeToNumber(0, this$0.h65_1.u());
      // Inline function 'kotlin.collections.mapTo' call
      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();
        // Inline function 'com.ustadmobile.door.replication.ReplicationEntityMetaData.insertIntoReceiveViewSql$delegate.<anonymous>.<anonymous>' call
        destination.i1('?');
      }
      return '\n        INSERT INTO ' + this$0.e65_1 + ' (' + tmp + ', ' + 'fromNodeId' + ')\n               VALUES (' + joinToString(destination) + ')\n        ';
    };
  }
  function ReplicationEntityMetaData(tableId, entityTableName, receiveViewName, entityPrimaryKeyFieldNames, entityVersionIdFieldName, entityFields, batchSize, remoteInsertStrategy, triggers) {
    batchSize = batchSize === VOID ? 1000 : batchSize;
    this.c65_1 = tableId;
    this.d65_1 = entityTableName;
    this.e65_1 = receiveViewName;
    this.f65_1 = entityPrimaryKeyFieldNames;
    this.g65_1 = entityVersionIdFieldName;
    this.h65_1 = entityFields;
    this.i65_1 = batchSize;
    this.j65_1 = remoteInsertStrategy;
    this.k65_1 = triggers;
    var tmp = this;
    var tmp_0 = LazyThreadSafetyMode_NONE_getInstance();
    tmp.l65_1 = lazy(tmp_0, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this));
  }
  protoOf(ReplicationEntityMetaData).a6h = function () {
    return trimIndent('\n            SELECT ' + this.d65_1 + '.* \n              FROM ' + this.d65_1 + '\n             WHERE ' + joinToString(this.f65_1, ' AND ', VOID, VOID, VOID, VOID, ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w) + '\n        ');
  };
  protoOf(ReplicationEntityMetaData).i6n = function () {
    // Inline function 'kotlin.getValue' call
    var this_0 = this.l65_1;
    insertIntoReceiveViewSql$factory();
    return this_0.t2();
  };
  protoOf(ReplicationEntityMetaData).m6w = function () {
    return '\n                CREATE VIEW ' + this.e65_1 + ' AS \n                       SELECT ' + this.d65_1 + '.*, \n                              CAST(0 AS BIGINT) AS fromNodeId\n                         FROM ' + this.d65_1 + '\n            ';
  };
  function insertIntoReceiveViewSql$factory() {
    return getPropertyCallableRef('insertIntoReceiveViewSql', 1, KProperty1, function (receiver) {
      return receiver.i6n();
    }, null);
  }
  function ReplicationFieldMetaData(fieldName, dbFieldType, nullable) {
    this.e66_1 = fieldName;
    this.f66_1 = dbFieldType;
    this.g66_1 = nullable;
  }
  protoOf(ReplicationFieldMetaData).h66 = function () {
    return this.e66_1;
  };
  protoOf(ReplicationFieldMetaData).i66 = function () {
    return this.f66_1;
  };
  protoOf(ReplicationFieldMetaData).n66 = function () {
    return this.g66_1;
  };
  protoOf(ReplicationFieldMetaData).toString = function () {
    return 'ReplicationFieldMetaData(fieldName=' + this.e66_1 + ', dbFieldType=' + this.f66_1 + ', nullable=' + this.g66_1 + ')';
  };
  protoOf(ReplicationFieldMetaData).hashCode = function () {
    var result = getStringHashCode(this.e66_1);
    result = imul(result, 31) + this.f66_1 | 0;
    result = imul(result, 31) + getBooleanHashCode(this.g66_1) | 0;
    return result;
  };
  protoOf(ReplicationFieldMetaData).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof ReplicationFieldMetaData))
      return false;
    var tmp0_other_with_cast = other instanceof ReplicationFieldMetaData ? other : THROW_CCE();
    if (!(this.e66_1 === tmp0_other_with_cast.e66_1))
      return false;
    if (!(this.f66_1 === tmp0_other_with_cast.f66_1))
      return false;
    if (!(this.g66_1 === tmp0_other_with_cast.g66_1))
      return false;
    return true;
  };
  function Companion_13() {
    Companion_instance_13 = this;
    var tmp = this;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp.k6w_1 = [new ArrayListSerializer(LongSerializer_getInstance())];
  }
  protoOf(Companion_13).n4r = function () {
    return $serializer_getInstance_2();
  };
  var Companion_instance_13;
  function Companion_getInstance_15() {
    if (Companion_instance_13 == null)
      new Companion_13();
    return Companion_instance_13;
  }
  function $serializer_2() {
    $serializer_instance_2 = this;
    var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.ReplicationReceivedAck', this, 1);
    tmp0_serialDesc.t4f('replicationUids', false);
    this.n6w_1 = tmp0_serialDesc;
  }
  protoOf($serializer_2).q44 = function () {
    return this.n6w_1;
  };
  protoOf($serializer_2).k4g = function () {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return [Companion_getInstance_15().k6w_1[0]];
  };
  protoOf($serializer_2).s44 = function (decoder) {
    var tmp0_desc = this.n6w_1;
    var tmp1_flag = true;
    var tmp2_index = 0;
    var tmp3_bitMask0 = 0;
    var tmp4_local0 = null;
    var tmp5_input = decoder.i48(tmp0_desc);
    var tmp6_cached = Companion_getInstance_15().k6w_1;
    if (tmp5_input.x48()) {
      tmp4_local0 = tmp5_input.u48(tmp0_desc, 0, tmp6_cached[0], tmp4_local0);
      tmp3_bitMask0 = tmp3_bitMask0 | 1;
    } else
      while (tmp1_flag) {
        tmp2_index = tmp5_input.y48(tmp0_desc);
        switch (tmp2_index) {
          case -1:
            tmp1_flag = false;
            break;
          case 0:
            tmp4_local0 = tmp5_input.u48(tmp0_desc, 0, tmp6_cached[0], tmp4_local0);
            tmp3_bitMask0 = tmp3_bitMask0 | 1;
            break;
          default:
            throw UnknownFieldException_init_$Create$(tmp2_index);
        }
      }
    tmp5_input.j48(tmp0_desc);
    return ReplicationReceivedAck_init_$Create$(tmp3_bitMask0, tmp4_local0, null);
  };
  protoOf($serializer_2).o6w = function (encoder, value) {
    var tmp0_desc = this.n6w_1;
    var tmp1_output = encoder.i48(tmp0_desc);
    var tmp2_cached = Companion_getInstance_15().k6w_1;
    tmp1_output.y49(tmp0_desc, 0, tmp2_cached[0], value.z6n_1);
    tmp1_output.j48(tmp0_desc);
  };
  protoOf($serializer_2).r44 = function (encoder, value) {
    return this.o6w(encoder, value instanceof ReplicationReceivedAck ? value : THROW_CCE());
  };
  var $serializer_instance_2;
  function $serializer_getInstance_2() {
    if ($serializer_instance_2 == null)
      new $serializer_2();
    return $serializer_instance_2;
  }
  function ReplicationReceivedAck_init_$Init$(seen1, replicationUids, serializationConstructorMarker, $this) {
    if (!(1 === (1 & seen1))) {
      throwMissingFieldException(seen1, 1, $serializer_getInstance_2().n6w_1);
    }
    $this.z6n_1 = replicationUids;
    return $this;
  }
  function ReplicationReceivedAck_init_$Create$(seen1, replicationUids, serializationConstructorMarker) {
    return ReplicationReceivedAck_init_$Init$(seen1, replicationUids, serializationConstructorMarker, objectCreate(protoOf(ReplicationReceivedAck)));
  }
  function ReplicationReceivedAck(replicationUids) {
    Companion_getInstance_15();
    this.z6n_1 = replicationUids;
  }
  protoOf(ReplicationReceivedAck).toString = function () {
    return 'ReplicationReceivedAck(replicationUids=' + this.z6n_1 + ')';
  };
  protoOf(ReplicationReceivedAck).hashCode = function () {
    return hashCode(this.z6n_1);
  };
  protoOf(ReplicationReceivedAck).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof ReplicationReceivedAck))
      return false;
    var tmp0_other_with_cast = other instanceof ReplicationReceivedAck ? other : THROW_CCE();
    if (!equals(this.z6n_1, tmp0_other_with_cast.z6n_1))
      return false;
    return true;
  };
  function Companion_14() {
    this.p6w_1 = 'init';
    this.q6w_1 = 'pending-replication';
  }
  var Companion_instance_14;
  function Companion_getInstance_16() {
    return Companion_instance_14;
  }
  function Companion_15() {
  }
  protoOf(Companion_15).o2r = function (str) {
    var parts = split(str, charArrayOf([_Char___init__impl__6a9atx(59)]), VOID, 3);
    if (!(parts.u() === 3))
      throw IllegalArgumentException_init_$Create$('DoorServerSentEvent parse: must have three parts - id;event;data');
    return new DoorServerSentEvent(parts.v(0), parts.v(1), parts.v(2));
  };
  var Companion_instance_15;
  function Companion_getInstance_17() {
    return Companion_instance_15;
  }
  function DoorServerSentEvent(id, event, data) {
    this.a6c_1 = id;
    this.b6c_1 = event;
    this.c6c_1 = data;
  }
  protoOf(DoorServerSentEvent).toString = function () {
    return "DoorServerSentEvent id='" + this.a6c_1 + "' event='" + this.b6c_1 + "' data='" + this.c6c_1 + "'";
  };
  function TriggerConstants() {
    this.r6w_1 = "\n        SELECT name\n                  FROM sqlite_master\n                 WHERE type = 'trigger'\n                   AND name LIKE ?\n    ";
    this.s6w_1 = "\n        SELECT name\n          FROM sqlite_master\n         WHERE type = 'view'\n           AND name LIKE ?\n    ";
  }
  var TriggerConstants_instance;
  function TriggerConstants_getInstance() {
    return TriggerConstants_instance;
  }
  function createSqliteTriggerAndReceiveViewSetupStatementList(_this__u8e3s4) {
    // Inline function 'kotlin.collections.buildList' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.collections.buildListInternal' call
    // Inline function 'kotlin.apply' call
    var this_0 = ArrayList_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList.<anonymous>' call
    // Inline function 'kotlin.collections.forEach' call
    var tmp0_iterator = _this__u8e3s4.a65().p2().w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList.<anonymous>.<anonymous>' call
      if (element.j65_1.equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) {
        this_0.i1(element.m6w());
      }
      // Inline function 'kotlin.collections.forEach' call
      var tmp0_iterator_0 = element.k65_1.w();
      while (tmp0_iterator_0.f()) {
        var element_0 = tmp0_iterator_0.e();
        // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList.<anonymous>.<anonymous>.<anonymous>' call
        var tmp;
        if (element_0.l64_1.equals(On_ENTITY_getInstance())) {
          tmp = element.d65_1;
        } else {
          tmp = element.e65_1;
        }
        var tableOrViewName = tmp;
        // Inline function 'kotlin.collections.forEach' call
        var indexedObject = element_0.k64_1;
        var inductionVariable = 0;
        var last = indexedObject.length;
        while (inductionVariable < last) {
          var element_1 = indexedObject[inductionVariable];
          inductionVariable = inductionVariable + 1 | 0;
          // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList.<anonymous>.<anonymous>.<anonymous>.<anonymous>' call
          // Inline function 'kotlin.text.substring' call
          // Inline function 'kotlin.text.lowercase' call
          // Inline function 'kotlin.js.asDynamic' call
          // Inline function 'kotlin.js.asDynamic' call
          var postfix = element_1.d64_1.toLowerCase().substring(0, 3);
          this_0.i1(trimIndent('\n                CREATE TRIGGER ' + '_d' + element_0.i64_1 + '_' + postfix + ' \n                ' + element_0.j64_1.g64_1 + ' ' + element_1 + ' ON ' + tableOrViewName + '\n                FOR EACH ROW ' + (!(element_0.o64_1 === '') ? ' WHEN (' + element_0.o64_1 + ') ' : '') + '\n                BEGIN\n                    ' + joinToString_0(element_0.m64_1, ';') + ';\n                END\n            '));
        }
      }
    }
    return this_0.f3();
  }
  function DoorEventCollator$receiveEvent$slambda$slambda(this$0, resultContinuation) {
    this.b6x_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorEventCollator$receiveEvent$slambda$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorEventCollator$receiveEvent$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorEventCollator$receiveEvent$slambda$slambda).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 = delay(this.b6x_1.d6x_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.b6x_1.g6x_1.kotlinx$atomicfu$value = null;
            this.hd_1 = 2;
            suspendResult = this.b6x_1.f6x_1(tryReceiveAll(this.b6x_1.h6x_1, this.b6x_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return Unit_instance;
          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);
  };
  protoOf(DoorEventCollator$receiveEvent$slambda$slambda).v1m = function ($this$launch, completion) {
    var i = new DoorEventCollator$receiveEvent$slambda$slambda(this.b6x_1, completion);
    i.c6x_1 = $this$launch;
    return i;
  };
  function DoorEventCollator$receiveEvent$slambda$slambda_0(this$0, resultContinuation) {
    var i = new DoorEventCollator$receiveEvent$slambda$slambda(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function tryReceiveAll(_this__u8e3s4, $this) {
    var resultList = mutableLinkedListOf([]);
    while (true) {
      var result = _this__u8e3s4.a1a();
      if (_ChannelResult___get_isSuccess__impl__odq1z9(result)) {
        // Inline function 'kotlin.collections.plusAssign' call
        var element = ChannelResult__getOrThrow_impl_od1axs(result);
        resultList.i1(element);
      } else
        return resultList;
    }
  }
  function DoorEventCollator$receiveEvent$slambda(this$0, resultContinuation) {
    this.q6x_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DoorEventCollator$receiveEvent$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DoorEventCollator$receiveEvent$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DoorEventCollator$receiveEvent$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        if (tmp === 0) {
          this.id_1 = 1;
          var tmp_0 = this.q6x_1.g6x_1;
          tmp_0.kotlinx$atomicfu$value = launch(this.q6x_1.e6x_1, VOID, VOID, DoorEventCollator$receiveEvent$slambda$slambda_0(this.q6x_1, null));
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(DoorEventCollator$receiveEvent$slambda).v1m = function ($this$launch, completion) {
    var i = new DoorEventCollator$receiveEvent$slambda(this.q6x_1, completion);
    i.r6x_1 = $this$launch;
    return i;
  };
  function DoorEventCollator$receiveEvent$slambda_0(this$0, resultContinuation) {
    var i = new DoorEventCollator$receiveEvent$slambda(this$0, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function DoorEventCollator(maxWaitTime, coroutineScope, onCollate) {
    this.d6x_1 = maxWaitTime;
    this.e6x_1 = coroutineScope;
    this.f6x_1 = onCollate;
    this.g6x_1 = atomic$ref$1(null);
    var tmp = this;
    Factory_getInstance();
    tmp.h6x_1 = Channel(2147483647);
  }
  protoOf(DoorEventCollator).s6x = function (event) {
    this.h6x_1.w19(event);
    if (this.g6x_1.kotlinx$atomicfu$value == null) {
      var tmp = GlobalScope_instance;
      launch(tmp, VOID, VOID, DoorEventCollator$receiveEvent$slambda_0(this, null));
    }
  };
  function NodeIdAuthCache(db) {
    this.t6x_1 = db;
    this.u6x_1 = concurrentSafeListOf([]);
    this.v6x_1 = concurrentSafeMapOf([]);
    this.w6x_1 = Mutex();
  }
  var TransactionMode_READ_WRITE_instance;
  var TransactionMode_READ_ONLY_instance;
  var TransactionMode_entriesInitialized;
  function TransactionMode_initEntries() {
    if (TransactionMode_entriesInitialized)
      return Unit_instance;
    TransactionMode_entriesInitialized = true;
    TransactionMode_READ_WRITE_instance = new TransactionMode('READ_WRITE', 0);
    TransactionMode_READ_ONLY_instance = new TransactionMode('READ_ONLY', 1);
  }
  function TransactionMode(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function TransactionMode_READ_WRITE_getInstance() {
    TransactionMode_initEntries();
    return TransactionMode_READ_WRITE_instance;
  }
  function TransactionMode_READ_ONLY_getInstance() {
    TransactionMode_initEntries();
    return TransactionMode_READ_ONLY_instance;
  }
  function Companion_16() {
    Companion_instance_16 = this;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.x6x_1 = LinkedHashMap_init_$Create$();
  }
  protoOf(Companion_16).y6x = function (builderOptions) {
    return new DatabaseBuilder(builderOptions);
  };
  protoOf(Companion_16).z6x = function (dbKClass) {
    var tmp = this.x6x_1.q(dbKClass);
    var tmp0_elvis_lhs = tmp instanceof DoorJsImplClasses ? tmp : null;
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('' + dbKClass.f7() + ' is not registered through DatabaseBuilder.register');
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  };
  protoOf(Companion_16).a6y = function (implClasses) {
    // Inline function 'kotlin.collections.set' call
    var this_0 = this.x6x_1;
    var key = implClasses.b6y();
    this_0.s(key, implClasses);
    // Inline function 'kotlin.collections.set' call
    var this_1 = this.x6x_1;
    var key_0 = implClasses.c6y();
    this_1.s(key_0, implClasses);
    var tmp0_safe_receiver = implClasses.d6y();
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.also' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'com.ustadmobile.door.Companion.register.<anonymous>' call
      // Inline function 'kotlin.collections.set' call
      Companion_getInstance_18().x6x_1.s(tmp0_safe_receiver, implClasses);
    }
    var tmp1_safe_receiver = implClasses.e6y();
    if (tmp1_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.also' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'com.ustadmobile.door.Companion.register.<anonymous>' call
      // Inline function 'kotlin.collections.set' call
      Companion_getInstance_18().x6x_1.s(tmp1_safe_receiver, implClasses);
    }
  };
  var Companion_instance_16;
  function Companion_getInstance_18() {
    if (Companion_instance_16 == null)
      new Companion_16();
    return Companion_instance_16;
  }
  function build$execSqlAsync(_this__u8e3s4, sqlStmts, $completion) {
    var tmp = new $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function $buildCOROUTINE$28(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.b6z_1 = _this__u8e3s4;
  }
  protoOf($buildCOROUTINE$28).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 33;
            if (!startsWith(this.b6z_1.t70_1.l70_1, Companion_instance_20.x70_1))
              throw IllegalArgumentException_init_$Create$('Door/JS: Only SQLite is supported on JS! dbUrl must be in the form of sqlite::memory: OR sqlite:indexeddb_name');
            Companion_getInstance_18().a6y(this.b6z_1.t70_1.j70_1);
            this.c6z_1 = substringAfter(this.b6z_1.t70_1.l70_1, Companion_instance_20.x70_1);
            this.d6z_1 = Companion_getInstance_18().z6x(this.b6z_1.t70_1.i70_1).z70();
            this.e6z_1 = new SQLiteDatasourceJs(this.c6z_1, new Worker(this.b6z_1.t70_1.m70_1), this.b6z_1.t70_1.r70_1, this.b6z_1.t70_1.s70_1);
            Companion_getInstance_18().a6y(this.b6z_1.t70_1.j70_1);
            var tmp_0 = this;
            var tmp_1 = get_js(this.b6z_1.t70_1.j70_1.c6y());
            var tmp_2 = this.b6z_1.t70_1.l70_1;
            var tmp_3 = this.b6z_1.t70_1.q70_1;
            var tmp_4 = this.b6z_1.t70_1.p70_1;
            Companion_getInstance_3();
            var tmp_5 = createInstance(tmp_1, [null, this.e6z_1, tmp_2, tmp_3, tmp_4, 1, this.b6z_1.t70_1.r70_1]);
            tmp_0.f6z_1 = tmp_5 instanceof RoomDatabase ? tmp_5 : THROW_CCE();
            if (!(this.c6z_1 === ':memory:')) {
              this.hd_1 = 1;
              suspendResult = IndexedDb_getInstance().f71(this.c6z_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.g6z_1 = false;
              this.hd_1 = 2;
              continue $sm;
            }

          case 1:
            this.g6z_1 = suspendResult;
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.h6z_1 = this.g6z_1;
            this.i6z_1 = this.e6z_1.r5g();
            var tmp_6 = this;
            Companion_getInstance_3();
            tmp_6.j6z_1 = new DoorSqlDatabaseConnectionImpl(this.i6z_1, 1);
            if (this.h6z_1) {
              var tmp_7 = Napier_getInstance();
              var tmp_8 = 'DatabaseBuilderJs: database ' + this.b6z_1.t70_1.l70_1 + ' exists... loading\n';
              tmp_7.g5e(tmp_8, VOID, 'DoorLog');
              this.hd_1 = 9;
              suspendResult = this.e6z_1.r71(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              var tmp_9 = Napier_getInstance();
              var tmp_10 = 'DatabaseBuilderJs: Creating database ' + this.b6z_1.t70_1.l70_1 + '\n';
              tmp_9.g5e(tmp_10, VOID, 'DoorLog');
              this.hd_1 = 3;
              var this_0 = this.f6z_1.q71();
              suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_0).slice(), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 3:
            var tmp_11 = Napier_getInstance();
            var tmp_12 = 'DatabaseBuilderJs: creating door triggers and receive views ' + this.b6z_1.t70_1.l70_1 + '\n';
            tmp_11.g5e(tmp_12, VOID, 'DoorLog');
            this.hd_1 = 4;
            var this_1 = createSqliteTriggerAndReceiveViewSetupStatementList(this.d6z_1);
            suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_1).slice(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var tmp_13 = Napier_getInstance();
            tmp_13.i5e('DatabaseBuilderJs: Running onCreate callbacks...\n', VOID, 'DoorLog');
            var tmp_14 = this;
            tmp_14.k6z_1 = this.b6z_1.u70_1;
            this.l6z_1 = this.k6z_1.w();
            this.hd_1 = 5;
            continue $sm;
          case 5:
            if (!this.l6z_1.f()) {
              this.hd_1 = 8;
              continue $sm;
            }

            this.m6z_1 = this.l6z_1.e();
            var tmp_15 = this;
            tmp_15.n6z_1 = this.m6z_1;
            this.o6z_1 = this.n6z_1;
            var tmp_16 = this.o6z_1;
            if (isInterface(tmp_16, DoorDatabaseCallbackSync)) {
              throw new NotSupportedException('Cannot use sync callback on JS');
            } else {
              var tmp_17 = this.o6z_1;
              if (isInterface(tmp_17, DoorDatabaseCallbackStatementList)) {
                var tmp_18 = Napier_getInstance();
                var tmp_19 = 'DatabaseBuilderJs: Running onCreate callback: ' + getKClassFromExpression(this.n6z_1).f7();
                tmp_18.i5e(tmp_19, VOID, 'DoorLog');
                this.hd_1 = 6;
                var this_2 = this.n6z_1.k61(this.j6z_1);
                suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_2).slice(), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 7;
                continue $sm;
              }
            }

          case 6:
            this.hd_1 = 7;
            continue $sm;
          case 7:
            this.hd_1 = 5;
            continue $sm;
          case 8:
            var tmp_20 = Napier_getInstance();
            tmp_20.i5e('DatabaseBuilderJs: table creation finished\n', VOID, 'DoorLog');
            this.hd_1 = 26;
            continue $sm;
          case 9:
            var tmp_21 = this;
            tmp_21.p6z_1 = (null == null ? true : null instanceof SQLiteConnectionJs) ? null : THROW_CCE();
            var tmp_22 = this;
            tmp_22.q6z_1 = (null == null ? true : null instanceof SQLitePreparedStatementJs) ? null : THROW_CCE();
            var tmp_23 = this;
            tmp_23.r6z_1 = (null == null ? true : null instanceof SQLiteResultSet) ? null : THROW_CCE();
            this.s6z_1 = -1;
            this.hd_1 = 10;
            continue $sm;
          case 10:
            this.id_1 = 13;
            this.id_1 = 12;
            var tmp_24 = this;
            var tmp_25 = this.e6z_1.r5g();
            tmp_24.p6z_1 = tmp_25 instanceof SQLiteConnectionJs ? tmp_25 : THROW_CCE();
            this.q6z_1 = new SQLitePreparedStatementJs(this.p6z_1, 'SELECT dbVersion FROM _doorwayinfo');
            this.hd_1 = 11;
            suspendResult = this.q6z_1.k5i(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 11:
            var tmp_26 = this;
            tmp_26.r6z_1 = suspendResult instanceof SQLiteResultSet ? suspendResult : THROW_CCE();
            var tmp_27 = this;
            var tmp_28;
            if (this.r6z_1.e()) {
              this.s6z_1 = this.r6z_1.m5s(1);
              tmp_28 = Unit_instance;
            }

            tmp_27.t6z_1 = tmp_28;
            this.id_1 = 33;
            this.hd_1 = 14;
            continue $sm;
          case 12:
            this.id_1 = 13;
            var tmp_29 = this.kd_1;
            if (tmp_29 instanceof SQLException) {
              this.u6z_1 = this.kd_1;
              var tmp_30 = this;
              throw this.u6z_1;
            } else {
              throw this.kd_1;
            }

          case 13:
            this.id_1 = 33;
            this.v6z_1 = this.kd_1;
            var tmp0_safe_receiver = this.r6z_1;
            if (tmp0_safe_receiver == null)
              null;
            else {
              tmp0_safe_receiver.n();
            }

            var tmp1_safe_receiver = this.q6z_1;
            if (tmp1_safe_receiver == null)
              null;
            else {
              tmp1_safe_receiver.n();
            }

            var tmp2_safe_receiver = this.p6z_1;
            if (tmp2_safe_receiver == null)
              null;
            else {
              tmp2_safe_receiver.n();
            }

            throw this.v6z_1;
          case 14:
            this.id_1 = 33;
            var tmp0_safe_receiver_0 = this.r6z_1;
            if (tmp0_safe_receiver_0 == null)
              null;
            else {
              tmp0_safe_receiver_0.n();
            }

            var tmp1_safe_receiver_0 = this.q6z_1;
            if (tmp1_safe_receiver_0 == null)
              null;
            else {
              tmp1_safe_receiver_0.n();
            }

            var tmp2_safe_receiver_0 = this.p6z_1;
            if (tmp2_safe_receiver_0 == null)
              null;
            else {
              tmp2_safe_receiver_0.n();
            }

            var tmp_31 = Napier_getInstance();
            var tmp_32 = 'DatabaseBuilderJs: Found current db version = ' + this.s6z_1 + '\n';
            tmp_31.i5e(tmp_32, VOID, 'DoorLog');
            this.w6z_1 = this.s6z_1 < this.f6z_1.k72();
            var tmp_33 = this;
            var tmp3_safe_receiver = this.p6z_1;
            var tmp_34;
            if (tmp3_safe_receiver == null) {
              tmp_34 = null;
            } else {
              var tmp_35;
              if (this.w6z_1) {
                tmp_35 = tmp3_safe_receiver;
              } else {
                tmp_35 = null;
              }
              tmp_34 = tmp_35;
            }

            tmp_33.x6z_1 = tmp_34;
            if (this.x6z_1 == null) {
              this.y6z_1 = null;
              this.hd_1 = 16;
              continue $sm;
            } else {
              this.hd_1 = 15;
              suspendResult = dropDoorTriggersAndReceiveViewsSqlite(this.x6z_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 15:
            var tmp_36 = this;
            tmp_36.y6z_1 = Unit_instance;
            this.hd_1 = 16;
            continue $sm;
          case 16:
            this.hd_1 = 17;
            continue $sm;
          case 17:
            if (!(this.s6z_1 < this.f6z_1.k72())) {
              this.hd_1 = 23;
              continue $sm;
            }

            var tmp_37 = this;
            var tmp$ret$2;
            l$ret$3: do {
              var this_3 = this.b6z_1.v70_1;
              var destination = ArrayList_init_$Create$();
              var tmp0_iterator = this_3.w();
              while (tmp0_iterator.f()) {
                var element = tmp0_iterator.e();
                var tmp_38;
                if (element.f68() === this.s6z_1) {
                  tmp_38 = !(element instanceof DoorMigrationSync);
                } else {
                  tmp_38 = false;
                }
                if (tmp_38) {
                  destination.i1(element);
                }
              }
              var iterator = destination.w();
              if (!iterator.f()) {
                tmp$ret$2 = null;
                break l$ret$3;
              }
              var maxElem = iterator.e();
              if (!iterator.f()) {
                tmp$ret$2 = maxElem;
                break l$ret$3;
              }
              var maxValue = maxElem.g68();
              do {
                var e = iterator.e();
                var v = e.g68();
                if (compareTo(maxValue, v) < 0) {
                  maxElem = e;
                  maxValue = v;
                }
              }
               while (iterator.f());
              tmp$ret$2 = maxElem;
            }
             while (false);
            tmp_37.z6z_1 = tmp$ret$2;
            if (!(this.z6z_1 == null)) {
              var tmp_39 = Napier_getInstance();
              var tmp_40 = 'DatabaseBuilderJs: Attempting to upgrade from ' + this.z6z_1.f68() + ' to ' + ('' + this.z6z_1.g68() + '\n');
              tmp_39.i5e(tmp_40, VOID, 'DoorLog');
              this.a70_1 = this.z6z_1;
              var tmp_41 = this.a70_1;
              if (tmp_41 instanceof DoorMigrationAsync) {
                this.hd_1 = 19;
                suspendResult = this.z6z_1.l72_1(this.j6z_1, this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                var tmp_42 = this.a70_1;
                if (tmp_42 instanceof DoorMigrationStatementList) {
                  this.hd_1 = 18;
                  var this_4 = this.z6z_1.j68_1(this.j6z_1);
                  suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_4).slice(), this);
                  if (suspendResult === get_COROUTINE_SUSPENDED()) {
                    return suspendResult;
                  }
                  continue $sm;
                } else {
                  throw IllegalArgumentException_init_$Create$('Cannot use DataMigrationSync on JS');
                }
              }
            } else {
              throw IllegalStateException_init_$Create$('Need to migrate to version ' + ('' + this.f6z_1.k72() + ' from ' + this.s6z_1 + ' - could not find next migration'));
            }

          case 18:
            this.hd_1 = 20;
            continue $sm;
          case 19:
            this.hd_1 = 20;
            continue $sm;
          case 20:
            this.s6z_1 = this.z6z_1.g68();
            this.hd_1 = 21;
            suspendResult = build$execSqlAsync(this.i6z_1, ['UPDATE _doorwayinfo SET dbVersion = ' + this.s6z_1], this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 21:
            var tmp_43 = Napier_getInstance();
            var tmp_44 = 'DatabaseBuilderJs: migrated up to ' + this.s6z_1;
            tmp_43.i5e(tmp_44, VOID, 'DoorLog');
            this.hd_1 = 22;
            continue $sm;
          case 22:
            this.hd_1 = 17;
            continue $sm;
          case 23:
            var tmp_45 = this;
            var this_5 = this.i6z_1;
            var tmp_46;
            if (this.w6z_1) {
              tmp_46 = this_5;
            } else {
              tmp_46 = null;
            }

            tmp_45.b70_1 = tmp_46;
            if (this.b70_1 == null) {
              this.c70_1 = null;
              this.hd_1 = 25;
              continue $sm;
            } else {
              this.hd_1 = 24;
              var this_6 = createSqliteTriggerAndReceiveViewSetupStatementList(this.d6z_1);
              suspendResult = build$execSqlAsync(this.b70_1, copyToArray(this_6).slice(), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 24:
            var tmp_47 = this;
            tmp_47.c70_1 = Unit_instance;
            this.hd_1 = 25;
            continue $sm;
          case 25:
            this.hd_1 = 26;
            continue $sm;
          case 26:
            var tmp_48 = Napier_getInstance();
            tmp_48.i5e('DatabaseBuilderJs: Running onOpen callbacks...\n', VOID, 'DoorLog');
            var tmp_49 = this;
            tmp_49.d70_1 = this.b6z_1.u70_1;
            this.e70_1 = this.d70_1.w();
            this.hd_1 = 27;
            continue $sm;
          case 27:
            if (!this.e70_1.f()) {
              this.hd_1 = 30;
              continue $sm;
            }

            this.f70_1 = this.e70_1.e();
            var tmp_50 = this;
            tmp_50.g70_1 = this.f70_1;
            this.h70_1 = this.g70_1;
            var tmp_51 = this.h70_1;
            if (isInterface(tmp_51, DoorDatabaseCallbackStatementList)) {
              this.hd_1 = 28;
              var this_7 = this.g70_1.l61(this.j6z_1);
              suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_7).slice(), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              throw IllegalArgumentException_init_$Create$('Cannot use sync callback on JS');
            }

          case 28:
            this.hd_1 = 29;
            continue $sm;
          case 29:
            this.hd_1 = 27;
            continue $sm;
          case 30:
            var tmp_52 = Napier_getInstance();
            tmp_52.i5e('DatabaseBuilderJs: Setting up InvalidationTracker trigger SQL\n', VOID, 'DoorLog');
            this.hd_1 = 31;
            var this_8 = Companion_instance_0.l5s(this.d6z_1.n65(), false);
            suspendResult = build$execSqlAsync(this.i6z_1, copyToArray(this_8).slice(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 31:
            var tmp_53 = Napier_getInstance();
            tmp_53.i5e('DatabaseBuilderJs: Setting up NodeEvent table and trigger SQL\n', VOID, 'DoorLog');
            this.hd_1 = 32;
            var tmp_54 = this.d6z_1.n65();
            suspendResult = createNodeEventTableAndTrigger(this.i6z_1, tmp_54.a1('OutgoingReplication'), false, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 32:
            var tmp_55 = Napier_getInstance();
            tmp_55.i5e('DatabaseBuilderJs: Setting up change listener\n', VOID, 'DoorLog');
            if (!(this.c6z_1 === ':memory:')) {
              new SaveToIndexedDbChangeListener(this.f6z_1, this.e6z_1, this.d6z_1.b65(), this.b6z_1.t70_1.n70_1);
            }

            this.i6z_1.n();
            var tmp7_safe_receiver = this.b6z_1.t70_1.j70_1.e6y();
            var tmp8_safe_receiver = tmp7_safe_receiver == null ? null : get_js(tmp7_safe_receiver);
            var tmp_56 = tmp8_safe_receiver == null ? null : createInstance(tmp8_safe_receiver, [this.f6z_1, this.b6z_1.t70_1.k70_1, this.b6z_1.t70_1.o70_1, this.b6z_1.t70_1.r70_1, this.b6z_1.t70_1.q70_1]);
            var wrapperClass = (tmp_56 == null ? true : tmp_56 instanceof RoomDatabase) ? tmp_56 : THROW_CCE();
            var tmp_57 = Napier_getInstance();
            var tmp_58 = 'Built database for: ' + this.b6z_1.t70_1.l70_1 + '\n';
            tmp_57.g5e(tmp_58, VOID, 'DoorLog');
            return wrapperClass == null ? this.f6z_1 : wrapperClass;
          case 33:
            throw this.kd_1;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 33) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.n6y_1 = _this__u8e3s4;
    this.o6y_1 = sqlStmts;
  }
  protoOf($build$execSqlAsyncCOROUTINE$29).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 8;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            var tmp_0 = this;
            tmp_0.q6y_1 = this.n6y_1.y60();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            this.id_1 = 7;
            this.id_1 = 6;
            var tmp_1 = this;
            tmp_1.s6y_1 = this.q6y_1;
            this.hd_1 = 4;
            suspendResult = this.s6y_1.l5i(joinToString_0(this.o6y_1, ';'), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            this.r6y_1 = suspendResult;
            this.id_1 = 8;
            this.hd_1 = 5;
            var tmp_2 = this;
            continue $sm;
          case 5:
            var tmp_3 = this.r6y_1;
            this.id_1 = 8;
            this.q6y_1.n();
            this.p6y_1 = tmp_3;
            this.hd_1 = 10;
            continue $sm;
          case 6:
            this.id_1 = 7;
            var tmp_4 = this.kd_1;
            if (tmp_4 instanceof Exception) {
              var e = this.kd_1;
              var tmp_5 = this;
              throw e;
            } else {
              throw this.kd_1;
            }

          case 7:
            this.id_1 = 8;
            var t = this.kd_1;
            this.q6y_1.n();
            throw t;
          case 8:
            throw this.kd_1;
          case 9:
            this.id_1 = 8;
            this.q6y_1.n();
            if (false) {
              this.hd_1 = 1;
              continue $sm;
            }

            this.hd_1 = 10;
            continue $sm;
          case 10:
            return Unit_instance;
        }
      } catch ($p) {
        var e_0 = $p;
        if (this.id_1 === 8) {
          throw e_0;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e_0;
        }
      }
     while (true);
  };
  function DatabaseBuilder(builderOptions) {
    Companion_getInstance_18();
    this.t70_1 = builderOptions;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.u70_1 = ArrayList_init_$Create$();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.v70_1 = ArrayList_init_$Create$();
  }
  protoOf(DatabaseBuilder).m72 = function ($completion) {
    var tmp = new $buildCOROUTINE$28(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DatabaseBuilder).n72 = function (migrations) {
    addAll(this.v70_1, migrations);
    return this;
  };
  protoOf(DatabaseBuilder).o72 = function (callback) {
    var tmp = Napier_getInstance();
    var tmp_0 = 'DatabaseBuilderJs: Add Callback: ' + getKClassFromExpression(callback).f7();
    tmp.i5e(tmp_0, VOID, 'DoorLog');
    this.u70_1.i1(callback);
    return this;
  };
  function DatabaseBuilderOptions(dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages) {
    dbUrl = dbUrl === VOID ? 'indexeddb:' + ensureNotNull(dbClass.f7()) : dbUrl;
    saveToIndexedDbDelayTime = saveToIndexedDbDelayTime === VOID ? new Long(200, 0) : saveToIndexedDbDelayTime;
    messageCallback = messageCallback === VOID ? new DefaultDoorMessageCallback() : messageCallback;
    jdbcQueryTimeout = jdbcQueryTimeout === VOID ? 10 : jdbcQueryTimeout;
    dbName = dbName === VOID ? dbUrl : dbName;
    logger = logger === VOID ? new NapierDoorLogger() : logger;
    logWorkerMessages = logWorkerMessages === VOID ? false : logWorkerMessages;
    this.i70_1 = dbClass;
    this.j70_1 = dbImplClasses;
    this.k70_1 = nodeId;
    this.l70_1 = dbUrl;
    this.m70_1 = webWorkerPath;
    this.n70_1 = saveToIndexedDbDelayTime;
    this.o70_1 = messageCallback;
    this.p70_1 = jdbcQueryTimeout;
    this.q70_1 = dbName;
    this.r70_1 = logger;
    this.s70_1 = logWorkerMessages;
  }
  protoOf(DatabaseBuilderOptions).toString = function () {
    return 'DatabaseBuilderOptions(dbClass=' + this.i70_1 + ', dbImplClasses=' + this.j70_1 + ', nodeId=' + this.k70_1.toString() + ', dbUrl=' + this.l70_1 + ', webWorkerPath=' + this.m70_1 + ', saveToIndexedDbDelayTime=' + this.n70_1.toString() + ', messageCallback=' + this.o70_1 + ', jdbcQueryTimeout=' + this.p70_1 + ', dbName=' + this.q70_1 + ', logger=' + this.r70_1 + ', logWorkerMessages=' + this.s70_1 + ')';
  };
  protoOf(DatabaseBuilderOptions).hashCode = function () {
    var result = this.i70_1.hashCode();
    result = imul(result, 31) + hashCode(this.j70_1) | 0;
    result = imul(result, 31) + this.k70_1.hashCode() | 0;
    result = imul(result, 31) + getStringHashCode(this.l70_1) | 0;
    result = imul(result, 31) + getStringHashCode(this.m70_1) | 0;
    result = imul(result, 31) + this.n70_1.hashCode() | 0;
    result = imul(result, 31) + hashCode(this.o70_1) | 0;
    result = imul(result, 31) + this.p70_1 | 0;
    result = imul(result, 31) + getStringHashCode(this.q70_1) | 0;
    result = imul(result, 31) + hashCode(this.r70_1) | 0;
    result = imul(result, 31) + getBooleanHashCode(this.s70_1) | 0;
    return result;
  };
  protoOf(DatabaseBuilderOptions).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof DatabaseBuilderOptions))
      return false;
    var tmp0_other_with_cast = other instanceof DatabaseBuilderOptions ? other : THROW_CCE();
    if (!this.i70_1.equals(tmp0_other_with_cast.i70_1))
      return false;
    if (!equals(this.j70_1, tmp0_other_with_cast.j70_1))
      return false;
    if (!this.k70_1.equals(tmp0_other_with_cast.k70_1))
      return false;
    if (!(this.l70_1 === tmp0_other_with_cast.l70_1))
      return false;
    if (!(this.m70_1 === tmp0_other_with_cast.m70_1))
      return false;
    if (!this.n70_1.equals(tmp0_other_with_cast.n70_1))
      return false;
    if (!equals(this.o70_1, tmp0_other_with_cast.o70_1))
      return false;
    if (!(this.p70_1 === tmp0_other_with_cast.p70_1))
      return false;
    if (!(this.q70_1 === tmp0_other_with_cast.q70_1))
      return false;
    if (!equals(this.r70_1, tmp0_other_with_cast.r70_1))
      return false;
    if (!(this.s70_1 === tmp0_other_with_cast.s70_1))
      return false;
    return true;
  };
  function Companion_17() {
    Companion_instance_17 = this;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.p72_1 = LinkedHashMap_init_$Create$();
  }
  protoOf(Companion_17).o2r = function (uriString) {
    return new DoorUri(new URL(uriString));
  };
  var Companion_instance_17;
  function Companion_getInstance_19() {
    if (Companion_instance_17 == null)
      new Companion_17();
    return Companion_instance_17;
  }
  function DoorUri(uri) {
    Companion_getInstance_19();
    this.q72_1 = uri;
  }
  protoOf(DoorUri).toString = function () {
    return toString(this.q72_1);
  };
  protoOf(DoorUri).equals = function (other) {
    var tmp0_safe_receiver = other instanceof DoorUri ? other : null;
    return equals(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q72_1, this.q72_1);
  };
  protoOf(DoorUri).hashCode = function () {
    return getStringHashCode(toString(this.q72_1));
  };
  function JdbcArrayProxy(typeName, objects) {
    JdbcArrayProxyCommon.call(this, typeName, objects);
  }
  function PreparedStatementArrayProxy(query, connection) {
    PreparedStatementArrayProxyCommon.call(this, query, connection);
    this.x72_1 = false;
  }
  protoOf(PreparedStatementArrayProxy).j5i = function ($completion) {
    return this.d5i().j5i($completion);
  };
  protoOf(PreparedStatementArrayProxy).l5i = function (sql, $completion) {
    return this.d5i().l5i(sql, $completion);
  };
  protoOf(PreparedStatementArrayProxy).k5i = function ($completion) {
    return this.d5i().k5i($completion);
  };
  protoOf(PreparedStatementArrayProxy).y5e = function () {
    throw new SQLException('PreparedStatementArrayProxy does not support getting generated keys', null);
  };
  protoOf(PreparedStatementArrayProxy).n = function () {
    this.x72_1 = true;
  };
  protoOf(PreparedStatementArrayProxy).r5g = function () {
    return this.d5h_1;
  };
  function Builder(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) {
    this.y72_1 = context;
    this.z72_1 = endpoint;
    this.a73_1 = auth;
    this.b73_1 = nodeId;
    this.c73_1 = httpClient;
    this.d73_1 = json;
    this.e73_1 = logger;
    this.f73_1 = dbName;
  }
  protoOf(Builder).f3 = function () {
    return new RepositoryConfig(this.y72_1, this.z72_1, this.a73_1, this.b73_1, this.c73_1, this.d73_1, this.e73_1, this.f73_1);
  };
  function RepositoryConfig$Companion$repositoryConfig$lambda($this$Json) {
    $this$Json.d4q_1 = true;
    return Unit_instance;
  }
  function RepositoryConfig$Companion$repositoryConfig$lambda_0($this$null) {
    return Unit_instance;
  }
  function Companion_18() {
  }
  protoOf(Companion_18).g73 = function (context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block) {
    var builder = new Builder(context, endpoint, auth, nodeId, httpClient, json, logger, dbName);
    block(builder);
    return builder.f3();
  };
  protoOf(Companion_18).h73 = function (context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block, $super) {
    logger = logger === VOID ? new NapierDoorLogger() : logger;
    dbName = dbName === VOID ? endpoint : dbName;
    var tmp;
    if (json === VOID) {
      tmp = Json(VOID, RepositoryConfig$Companion$repositoryConfig$lambda);
    } else {
      tmp = json;
    }
    json = tmp;
    var tmp_0;
    if (block === VOID) {
      tmp_0 = RepositoryConfig$Companion$repositoryConfig$lambda_0;
    } else {
      tmp_0 = block;
    }
    block = tmp_0;
    return $super === VOID ? this.g73(context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block) : $super.g73.call(this, context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block);
  };
  var Companion_instance_18;
  function Companion_getInstance_20() {
    return Companion_instance_18;
  }
  function RepositoryConfig(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) {
    this.s65_1 = context;
    this.t65_1 = endpoint;
    this.u65_1 = auth;
    this.v65_1 = nodeId;
    this.w65_1 = httpClient;
    this.x65_1 = json;
    this.y65_1 = logger;
    this.z65_1 = dbName;
  }
  function SaveToIndexedDbChangeListener$eventCollator$slambda($database, this$0, resultContinuation) {
    this.q73_1 = $database;
    this.r73_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).t73 = function (it, $completion) {
    var tmp = this.u73(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).he = function (p1, $completion) {
    return this.t73((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            var tmp_0 = Napier_getInstance();
            var tmp_1 = 'Save database ' + this.q73_1 + ' to indexedDb';
            tmp_0.i5e(tmp_1, VOID, 'DoorLog');
            this.hd_1 = 1;
            suspendResult = this.r73_1.v73_1.y73(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(SaveToIndexedDbChangeListener$eventCollator$slambda).u73 = function (it, completion) {
    var i = new SaveToIndexedDbChangeListener$eventCollator$slambda(this.q73_1, this.r73_1, completion);
    i.s73_1 = it;
    return i;
  };
  function SaveToIndexedDbChangeListener$eventCollator$slambda_0($database, this$0, resultContinuation) {
    var i = new SaveToIndexedDbChangeListener$eventCollator$slambda($database, this$0, resultContinuation);
    var l = function (it, $completion) {
      return i.t73(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function SaveToIndexedDbChangeListener$1($tablesToListen, this$0) {
    this.a74_1 = this$0;
    // Inline function 'kotlin.collections.toTypedArray' call
    var tmp$ret$0 = copyToArray($tablesToListen);
    InvalidationTrackerObserver.call(this, tmp$ret$0);
  }
  protoOf(SaveToIndexedDbChangeListener$1).g5l = function (tables) {
    this.a74_1.x73_1.s6x(toList_0(tables));
  };
  function SaveToIndexedDbChangeListener(database, datasource, tablesToListen, maxWaitTime) {
    this.v73_1 = datasource;
    var tmp = this;
    var tmp_0 = GlobalScope_instance;
    tmp.x73_1 = new DoorEventCollator(maxWaitTime, tmp_0, SaveToIndexedDbChangeListener$eventCollator$slambda_0(database, this, null));
    var tmp_1 = this;
    tmp_1.w73_1 = new SaveToIndexedDbChangeListener$1(tablesToListen, this);
    database.w5l().p5m(this.w73_1);
  }
  function prepareStatement(_this__u8e3s4, db, stmtConfig) {
    var tmp;
    if (stmtConfig.c5k_1) {
      tmp = new PreparedStatementArrayProxy(stmtConfig.b5k_1, _this__u8e3s4);
    } else {
      tmp = _this__u8e3s4.b74(stmtConfig.b5k_1, stmtConfig.d5k_1);
    }
    return tmp;
  }
  function dbType_0(_this__u8e3s4) {
    Companion_getInstance_3();
    return 1;
  }
  function withDoorTransactionAsync(_this__u8e3s4, transactionMode, block, $completion) {
    transactionMode = transactionMode === VOID ? TransactionMode_READ_WRITE_getInstance() : transactionMode;
    var tmp = get_rootDatabase(_this__u8e3s4);
    var tmp_0 = (isInterface(tmp, RoomJdbcImpl) ? tmp : THROW_CCE()).a5k();
    var tmp_1 = transactionMode.equals(TransactionMode_READ_ONLY_getInstance());
    return tmp_0.d5l(tmp_1, withDoorTransactionAsync$slambda_0(block, _this__u8e3s4, null), $completion);
  }
  function unwrap(_this__u8e3s4, dbClass) {
    var tmp0_safe_receiver = isInterface(_this__u8e3s4, DoorDatabaseWrapper) ? _this__u8e3s4 : null;
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.w5i();
    var tmp1_elvis_lhs = tmp instanceof RoomDatabase ? tmp : null;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('' + _this__u8e3s4 + ' is not a replicate wrapper!');
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  }
  function doorDatabaseMetadata(_this__u8e3s4) {
    return Companion_getInstance_18().z6x(_this__u8e3s4).z70();
  }
  function dbType_1(_this__u8e3s4) {
    Companion_getInstance_3();
    return 1;
  }
  function dbSchemaVersion(_this__u8e3s4) {
    return _this__u8e3s4.k72();
  }
  function withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation) {
    this.k74_1 = $block;
    this.l74_1 = $this_withDoorTransactionAsync;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(withDoorTransactionAsync$slambda).a5l = function (it, $completion) {
    var tmp = this.b5l(it, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(withDoorTransactionAsync$slambda).he = function (p1, $completion) {
    return this.a5l((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(withDoorTransactionAsync$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.k74_1(this.l74_1, 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(withDoorTransactionAsync$slambda).b5l = function (it, completion) {
    var i = new withDoorTransactionAsync$slambda(this.k74_1, this.l74_1, completion);
    i.m74_1 = it;
    return i;
  };
  function withDoorTransactionAsync$slambda_0($block, $this_withDoorTransactionAsync, resultContinuation) {
    var i = new withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation);
    var l = function (it, $completion) {
      return i.a5l(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function createInstance(_this__u8e3s4, args) {
    var ctor = _this__u8e3s4;
    // Inline function 'kotlin.collections.toTypedArray' call
    var this_0 = plus_2(listOf(null), args);
    var argsArray = copyToArray(this_0);
    return new (Function.prototype.bind.apply(ctor, argsArray))();
  }
  function mutableLinkedListOf(items) {
    // Inline function 'kotlin.also' call
    // Inline function 'kotlin.collections.mutableListOf' call
    var this_0 = ArrayList_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.ext.mutableLinkedListOf.<anonymous>' call
    addAll(this_0, items);
    return this_0;
  }
  function concurrentSafeListOf(items) {
    // Inline function 'kotlin.also' call
    // Inline function 'kotlin.collections.mutableListOf' call
    var this_0 = ArrayList_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.ext.concurrentSafeListOf.<anonymous>' call
    addAll(this_0, items);
    return this_0;
  }
  function concurrentSafeMapOf(items) {
    // Inline function 'kotlin.also' call
    // Inline function 'kotlin.collections.mutableMapOf' call
    var this_0 = LinkedHashMap_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.ext.concurrentSafeMapOf.<anonymous>' call
    putAll(this_0, items);
    return this_0;
  }
  function weakMapOf() {
    return new WeakMapJs();
  }
  function urlEncode(_this__u8e3s4) {
    return encodeURIComponent(_this__u8e3s4);
  }
  function Array_0() {
  }
  function Connection() {
  }
  function PreparedStatement() {
  }
  function ResultSet() {
  }
  function SQLException(message, cause) {
    Exception_init_$Init$(message, cause, this);
    captureStack(this, SQLException);
  }
  function mutableLinkedListOf_0(items) {
    // Inline function 'kotlin.collections.mutableListOf' call
    return ArrayList_init_$Create$();
  }
  function executeUpdateAsyncKmp(_this__u8e3s4, $completion) {
    return _this__u8e3s4.j5i($completion);
  }
  function executeUpdateAsync(_this__u8e3s4, sql, $completion) {
    return _this__u8e3s4.l5i(sql, $completion);
  }
  function executeQueryAsyncKmp(_this__u8e3s4, $completion) {
    return _this__u8e3s4.k5i($completion);
  }
  function NodeEventManagerJs(db, messageCallback, logger, dbName, dispatcher) {
    dispatcher = dispatcher === VOID ? Dispatchers_getInstance().p12_1 : dispatcher;
    NodeEventManagerCommon.call(this, db, messageCallback, logger, dbName, dispatcher);
    this.a75_1 = new NodeEventJdbcImplListenerSqlite(this.x69_1, this.y69_1, false, logger, dbName);
    (isInterface(db, RoomJdbcImpl) ? db : THROW_CCE()).a5k().t5y(this.a75_1);
  }
  function RoomDatabase() {
  }
  protoOf(RoomDatabase).w5l = function () {
    var reason = 'getInvalidationTracker: maybe override this in the generated version';
    throw new NotImplementedError('An operation is not implemented: ' + reason);
  };
  function RoomDatabaseJdbcImplHelper(dataSource, db, dbUrl, dbName, logger, tableNames, invalidationTracker, dbType) {
    RoomDatabaseJdbcImplHelperCommon.call(this, dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType);
  }
  protoOf(RoomDatabaseJdbcImplHelper).r5y = function (_this__u8e3s4, $completion) {
    return Unit_instance;
  };
  protoOf(RoomDatabaseJdbcImplHelper).p75 = function ($completion) {
    var tmp = this.m5j_1;
    return (tmp instanceof SQLiteDatasourceJs ? tmp : THROW_CCE()).q75($completion);
  };
  function onUpgradeNeededThenCreateStores($this, request) {
    request.onupgradeneeded = IndexedDb$onUpgradeNeededThenCreateStores$lambda;
  }
  function IndexedDb$onUpgradeNeededThenCreateStores$lambda(event) {
    var db = event.target.result;
    if (!db.objectStoreNames.contains('um_db_store')) {
      db.createObjectStore('um_db_store');
    }
    if (!db.objectStoreNames.contains('door_attachments')) {
      db.createObjectStore('door_attachments');
    }
    return Unit_instance;
  }
  function IndexedDb$checkIfExists$lambda($checkCompletable) {
    return function () {
      return $checkCompletable.iy(newThrowable('Error when opening database'));
    };
  }
  function IndexedDb$checkIfExists$lambda$lambda($checkCompletable) {
    return function (data) {
      return $checkCompletable.gy(data.target.result != null);
    };
  }
  function IndexedDb$checkIfExists$lambda$lambda_0($checkCompletable) {
    return function () {
      return $checkCompletable.iy(newThrowable('Error when querying for database from um_db_store'));
    };
  }
  function IndexedDb$checkIfExists$lambda_0($checkCompletable) {
    return function (event) {
      var db = event.target.result;
      var store = db.transaction('um_db_store', 'readwrite').objectStore('um_db_store').get('um_db_key');
      store.onsuccess = IndexedDb$checkIfExists$lambda$lambda($checkCompletable);
      store.onerror = IndexedDb$checkIfExists$lambda$lambda_0($checkCompletable);
      return Unit_instance;
    };
  }
  function IndexedDb() {
    IndexedDb_instance = this;
    this.a71_1 = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
    this.b71_1 = 'um_db_store';
    this.c71_1 = 'door_attachments';
    this.d71_1 = 'um_db_key';
    this.e71_1 = 2;
  }
  protoOf(IndexedDb).f71 = function (dbName, $completion) {
    var checkCompletable = CompletableDeferred();
    var request = this.a71_1.open(dbName, 2);
    onUpgradeNeededThenCreateStores(this, request);
    request.onerror = IndexedDb$checkIfExists$lambda(checkCompletable);
    request.onsuccess = IndexedDb$checkIfExists$lambda_0(checkCompletable);
    return checkCompletable.nv($completion);
  };
  var IndexedDb_instance;
  function IndexedDb_getInstance() {
    if (IndexedDb_instance == null)
      new IndexedDb();
    return IndexedDb_instance;
  }
  function Companion_19() {
    this.r75_1 = 1;
  }
  var Companion_instance_19;
  function Companion_getInstance_21() {
    return Companion_instance_19;
  }
  function SQLiteConnectionJs$lambda(this$0) {
    return function () {
      return this$0.j72_1 + ' : open';
    };
  }
  function SQLiteConnectionJs$close$lambda(this$0) {
    return function () {
      return this$0.j72_1 + ' : close';
    };
  }
  function $setAutoCommitAsyncCOROUTINE$32(_this__u8e3s4, autoCommit, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.a76_1 = _this__u8e3s4;
    this.b76_1 = autoCommit;
  }
  protoOf($setAutoCommitAsyncCOROUTINE$32).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            if (!this.b76_1 ? this.a76_1.h72_1 : false) {
              this.hd_1 = 1;
              suspendResult = this.a76_1.f72_1.d76(this.a76_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              if (this.b76_1 ? !this.b76_1 : false) {
                this.a76_1.f72_1.c76(this.a76_1);
                this.a76_1.h72_1 = false;
                this.hd_1 = 3;
                continue $sm;
              } else {
                this.hd_1 = 3;
                continue $sm;
              }
            }

          case 1:
            this.a76_1.h72_1 = false;
            this.hd_1 = 2;
            suspendResult = this.a76_1.f72_1.e76(this.a76_1, 'BEGIN TRANSACTION', [], VOID, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.hd_1 = 3;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $commitAsyncCOROUTINE$33(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.n76_1 = _this__u8e3s4;
  }
  protoOf($commitAsyncCOROUTINE$33).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.n76_1.h72_1)
              throw IllegalStateException_init_$Create$('commitAsync: not in transaction (autoCommit=true) - cannot commit');
            this.hd_1 = 1;
            suspendResult = this.n76_1.f72_1.e76(this.n76_1, 'COMMIT', [], VOID, 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);
  };
  function $rollbackAsyncCOROUTINE$34(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.w76_1 = _this__u8e3s4;
  }
  protoOf($rollbackAsyncCOROUTINE$34).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.w76_1.f72_1.e76(this.w76_1, 'ROLLBACK', [], VOID, 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);
  };
  function SQLiteConnectionJs(datasource) {
    this.f72_1 = datasource;
    this.g72_1 = false;
    this.h72_1 = true;
    var tmp = this;
    var tmp1 = Companion_instance_19.r75_1;
    Companion_instance_19.r75_1 = tmp1 + 1 | 0;
    tmp.i72_1 = tmp1;
    this.j72_1 = '[SQLiteConnectionJS #' + this.i72_1 + ']';
    var tmp_0 = Napier_getInstance();
    tmp_0.e5e(VOID, 'DoorLog', SQLiteConnectionJs$lambda(this));
  }
  protoOf(SQLiteConnectionJs).s5g = function (commit) {
  };
  protoOf(SQLiteConnectionJs).q5y = function (autoCommit, $completion) {
    var tmp = new $setAutoCommitAsyncCOROUTINE$32(this, autoCommit, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteConnectionJs).s5y = function ($completion) {
    var tmp = new $commitAsyncCOROUTINE$33(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteConnectionJs).y5x = function ($completion) {
    var tmp = new $rollbackAsyncCOROUTINE$34(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteConnectionJs).i5i = function (sql) {
    return new SQLitePreparedStatementJs(this, sql);
  };
  protoOf(SQLiteConnectionJs).b74 = function (sql, autoGeneratedKeys) {
    return new SQLitePreparedStatementJs(this, sql, autoGeneratedKeys);
  };
  protoOf(SQLiteConnectionJs).y60 = function () {
    return new SQLiteStatementJs(this);
  };
  protoOf(SQLiteConnectionJs).t5g = function () {
  };
  protoOf(SQLiteConnectionJs).x5x = function () {
  };
  protoOf(SQLiteConnectionJs).n = function () {
    var tmp = Napier_getInstance();
    tmp.e5e(VOID, 'DoorLog', SQLiteConnectionJs$close$lambda(this));
    if (!this.h72_1) {
      this.f72_1.c76(this);
    }
    this.g72_1 = true;
  };
  protoOf(SQLiteConnectionJs).z5x = function () {
    return this.g72_1;
  };
  protoOf(SQLiteConnectionJs).m5i = function (arrayType, objects) {
    throw new SQLException('Array not supported on SQLite', null);
  };
  protoOf(SQLiteConnectionJs).n5i = function () {
    return new SQLiteDatabaseMetadataJs(this.f72_1);
  };
  function SQLiteDatabaseMetadataJs(datasource) {
    this.x76_1 = datasource;
  }
  protoOf(SQLiteDatabaseMetadataJs).o5i = function () {
    return 'SQLite';
  };
  function SQLiteDatasourceJs$sendQuery$slambda$lambda(this$0, $sql, $params) {
    return function () {
      var tmp0_safe_receiver = $params;
      return this$0.n71_1 + ' sending query: ' + $sql + ' params=' + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver));
    };
  }
  function SQLiteDatasourceJs$sendQuery$slambda$lambda_0(this$0, $sql, $params, $sqliteResultSet) {
    return function () {
      var tmp0_safe_receiver = $params;
      return this$0.n71_1 + " Got result: Ran: '" + $sql + "' params=" + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver)) + ' result = ' + $sqliteResultSet + '\n';
    };
  }
  function SQLiteDatasourceJs$sendUpdate$slambda$lambda(this$0, $sql, $params) {
    return function () {
      var tmp0_safe_receiver = $params;
      return this$0.n71_1 + " sending update: '" + $sql + "', params=" + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver)) + '\n';
    };
  }
  function SQLiteDatasourceJs$sendUpdate$slambda$lambda_0(this$0, $sql) {
    return function () {
      return this$0.n71_1 + " update done: '" + $sql + "'";
    };
  }
  function assertNotClosed($this) {
    if ($this.o71_1)
      throw IllegalStateException_init_$Create$('SQLiteDataSourceJs is closed!');
  }
  function sendMessage($this, message, $completion) {
    var tmp = new $sendMessageCOROUTINE$36($this, message, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function makeMessage($this, sql, params) {
    return json([to('action', 'exec'), to('sql', sql), to('params', params), to('config', json([to('useBigInt', true)]))]);
  }
  function makeMessage$default($this, sql, params, $super) {
    var tmp;
    if (params === VOID) {
      // Inline function 'kotlin.arrayOf' call
      // Inline function 'kotlin.js.unsafeCast' call
      // Inline function 'kotlin.js.asDynamic' call
      tmp = [];
    } else {
      tmp = params;
    }
    params = tmp;
    return makeMessage($this, sql, params);
  }
  function withTransactionLock($this, connection, block, $completion) {
    var tmp = new $withTransactionLockCOROUTINE$37($this, connection, block, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function Companion_20() {
    this.w70_1 = 0;
    this.x70_1 = 'sqlite:';
    this.y70_1 = ':memory:';
  }
  var Companion_instance_20;
  function Companion_getInstance_22() {
    return Companion_instance_20;
  }
  function SQLiteDatasourceJs$lambda(this$0) {
    return function (dbEvent) {
      var actionId = toInt(toString(dbEvent.data['id']));
      var executedQuery = this$0.l71_1.u2(actionId);
      var pendingCompletable = this$0.k71_1.u2(actionId);
      var tmp;
      if (!(pendingCompletable == null)) {
        if (dbEvent.data['error'] != undefined) {
          var exception = new SQLException(toString(dbEvent.data['error']), Exception_init_$Create$('Error occurred when executing ' + executedQuery));
          pendingCompletable.iy(exception);
        }
        var executedSuccessfully = dbEvent.data['ready'] == (undefined && dbEvent.data['results'] != undefined) ? true : dbEvent.data['ready'];
        var tmp_0;
        if (dbEvent.data['results'] != undefined) {
          tmp_0 = dbEvent.data['results'];
        } else {
          // Inline function 'kotlin.arrayOf' call
          // Inline function 'kotlin.js.unsafeCast' call
          // Inline function 'kotlin.js.asDynamic' call
          tmp_0 = [];
        }
        var results = tmp_0;
        var buffer = dbEvent.data['buffer'] != undefined ? dbEvent.data['buffer'] : null;
        pendingCompletable.gy(new WorkerResult(dbEvent.data['id'], results, executedSuccessfully, buffer));
        tmp = Unit_instance;
      }
      return Unit_instance;
    };
  }
  function SQLiteDatasourceJs$sendMessage$lambda(this$0, $actionId, $message) {
    return function () {
      return this$0.n71_1 + ' sendMessage #' + $actionId + ' - sending action=' + toString_0($message['action']) + ' \n';
    };
  }
  function SQLiteDatasourceJs$sendMessage$lambda_0(this$0, $actionId) {
    return function () {
      return this$0.n71_1 + ' sendMessage #' + $actionId + ' - got result \n';
    };
  }
  function SQLiteDatasourceJs$sendQuery$slambda(this$0, $sql, $params, resultContinuation) {
    this.h78_1 = this$0;
    this.i78_1 = $sql;
    this.j78_1 = $params;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(SQLiteDatasourceJs$sendQuery$slambda).k78 = function ($completion) {
    var tmp = this.l78($completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteDatasourceJs$sendQuery$slambda).m78 = function ($completion) {
    return this.k78($completion);
  };
  protoOf(SQLiteDatasourceJs$sendQuery$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            var this_0 = this.h78_1.i71_1;
            var tmp_0;
            if (this.h78_1.j71_1) {
              tmp_0 = this_0;
            } else {
              tmp_0 = null;
            }

            var tmp0_safe_receiver = tmp_0;
            if (tmp0_safe_receiver == null)
              null;
            else {
              v(tmp0_safe_receiver, VOID, SQLiteDatasourceJs$sendQuery$slambda$lambda(this.h78_1, this.i78_1, this.j78_1));
            }

            this.hd_1 = 1;
            suspendResult = sendMessage(this.h78_1, makeMessage(this.h78_1, this.i78_1, this.j78_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            var results = ARGUMENT.o78_1;
            var tmp_1;
            if (results == null) {
              tmp_1 = null;
            } else {
              tmp_1 = new SQLiteResultSet(results);
            }

            var tmp2_elvis_lhs = tmp_1;
            var tmp_2;
            if (tmp2_elvis_lhs == null) {
              var this_1 = [];
              tmp_2 = new SQLiteResultSet(this_1);
            } else {
              tmp_2 = tmp2_elvis_lhs;
            }

            var sqliteResultSet = tmp_2;
            var this_2 = this.h78_1.i71_1;
            var tmp_3;
            if (this.h78_1.j71_1) {
              tmp_3 = this_2;
            } else {
              tmp_3 = null;
            }

            var tmp3_safe_receiver = tmp_3;
            if (tmp3_safe_receiver == null)
              null;
            else {
              v(tmp3_safe_receiver, VOID, SQLiteDatasourceJs$sendQuery$slambda$lambda_0(this.h78_1, this.i78_1, this.j78_1, sqliteResultSet));
            }

            return sqliteResultSet;
          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(SQLiteDatasourceJs$sendQuery$slambda).l78 = function (completion) {
    return new SQLiteDatasourceJs$sendQuery$slambda(this.h78_1, this.i78_1, this.j78_1, completion);
  };
  function SQLiteDatasourceJs$sendQuery$slambda_0(this$0, $sql, $params, resultContinuation) {
    var i = new SQLiteDatasourceJs$sendQuery$slambda(this$0, $sql, $params, resultContinuation);
    var l = function ($completion) {
      return i.k78($completion);
    };
    l.$arity = 0;
    return l;
  }
  function SQLiteDatasourceJs$sendUpdate$slambda(this$0, $sql, $params, $returnGeneratedKey, resultContinuation) {
    this.z78_1 = this$0;
    this.a79_1 = $sql;
    this.b79_1 = $params;
    this.c79_1 = $returnGeneratedKey;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(SQLiteDatasourceJs$sendUpdate$slambda).e79 = function ($completion) {
    var tmp = this.l78($completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteDatasourceJs$sendUpdate$slambda).m78 = function ($completion) {
    return this.e79($completion);
  };
  protoOf(SQLiteDatasourceJs$sendUpdate$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 4;
            var this_0 = this.z78_1.i71_1;
            var tmp_0;
            if (this.z78_1.j71_1) {
              tmp_0 = this_0;
            } else {
              tmp_0 = null;
            }

            var tmp0_safe_receiver = tmp_0;
            if (tmp0_safe_receiver == null)
              null;
            else {
              v(tmp0_safe_receiver, VOID, SQLiteDatasourceJs$sendUpdate$slambda$lambda(this.z78_1, this.a79_1, this.b79_1));
            }

            this.hd_1 = 1;
            suspendResult = sendMessage(this.z78_1, makeMessage(this.z78_1, this.a79_1, this.b79_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            if (this.c79_1) {
              this.hd_1 = 2;
              suspendResult = sendMessage(this.z78_1, makeMessage$default(this.z78_1, 'SELECT last_insert_rowid()'), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              var tmp_1 = this;
              tmp_1.d79_1 = null;
              this.hd_1 = 3;
              continue $sm;
            }

          case 2:
            var ARGUMENT = suspendResult;
            var tmp1_safe_receiver = ARGUMENT.o78_1;
            var tmp_2 = this;
            var tmp_3;
            if (tmp1_safe_receiver == null) {
              tmp_3 = null;
            } else {
              tmp_3 = new SQLiteResultSet(tmp1_safe_receiver);
            }

            tmp_2.d79_1 = tmp_3;
            this.hd_1 = 3;
            continue $sm;
          case 3:
            var generatedKey = this.d79_1;
            var this_1 = this.z78_1.i71_1;
            var tmp_4;
            if (this.z78_1.j71_1) {
              tmp_4 = this_1;
            } else {
              tmp_4 = null;
            }

            var tmp2_safe_receiver = tmp_4;
            if (tmp2_safe_receiver == null)
              null;
            else {
              v(tmp2_safe_receiver, VOID, SQLiteDatasourceJs$sendUpdate$slambda$lambda_0(this.z78_1, this.a79_1));
            }

            return new UpdateResult(1, generatedKey);
          case 4:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 4) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(SQLiteDatasourceJs$sendUpdate$slambda).l78 = function (completion) {
    return new SQLiteDatasourceJs$sendUpdate$slambda(this.z78_1, this.a79_1, this.b79_1, this.c79_1, completion);
  };
  function SQLiteDatasourceJs$sendUpdate$slambda_0(this$0, $sql, $params, $returnGeneratedKey, resultContinuation) {
    var i = new SQLiteDatasourceJs$sendUpdate$slambda(this$0, $sql, $params, $returnGeneratedKey, resultContinuation);
    var l = function ($completion) {
      return i.e79($completion);
    };
    l.$arity = 0;
    return l;
  }
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this$0, $data, $exportCompletable, resultContinuation) {
    this.n79_1 = this$0;
    this.o79_1 = $data;
    this.p79_1 = $exportCompletable;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).u1m = function ($this$launch, $completion) {
    var tmp = this.v1m($this$launch, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$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 = sendMessage(this.n79_1, json([to('action', 'open'), to('buffer', this.o79_1.target.result)]), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var result = suspendResult;
            this.p79_1.gy(result.p78_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(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).v1m = function ($this$launch, completion) {
    var i = new SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this.n79_1, this.o79_1, this.p79_1, completion);
    i.q79_1 = $this$launch;
    return i;
  };
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda_0(this$0, $data, $exportCompletable, resultContinuation) {
    var i = new SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this$0, $data, $exportCompletable, resultContinuation);
    var l = function ($this$launch, $completion) {
      return i.u1m($this$launch, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable) {
    return function (data) {
      var tmp = GlobalScope_instance;
      return launch(tmp, VOID, VOID, SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda_0(this$0, data, $exportCompletable, null));
    };
  }
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda_0($exportCompletable) {
    return function () {
      return $exportCompletable.iy(newThrowable('Error when executing store data fetch'));
    };
  }
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this$0, $exportCompletable) {
    return function (event) {
      var db = event.target.result;
      IndexedDb_getInstance();
      IndexedDb_getInstance();
      IndexedDb_getInstance();
      var store = db.transaction('um_db_store', 'readwrite').objectStore('um_db_store').get('um_db_key');
      store.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable);
      store.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda_0($exportCompletable);
      return Unit_instance;
    };
  }
  function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0($exportCompletable) {
    return function () {
      return $exportCompletable.iy(newThrowable('Error when importing database from IndexedDb to SQLite DB'));
    };
  }
  function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this$0) {
    return function () {
      return this$0.n71_1 + ' SQLiteDataSource/JS: saving to indexed db';
    };
  }
  function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable) {
    return function () {
      i(this$0.i71_1, this$0.n71_1 + ' Saved to IndexedDb: ' + this$0.g71_1);
      return $exportCompletable.gy(true);
    };
  }
  function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable) {
    return function () {
      return $exportCompletable.iy(newThrowable('Error when importing SQLJs database to IndexedDb'));
    };
  }
  function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda_0($result, this$0, $exportCompletable) {
    return function (event) {
      var db = event.target.result;
      IndexedDb_getInstance();
      var transaction = db.transaction('um_db_store', 'readwrite');
      transaction.oncomplete = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable);
      transaction.onerror = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable);
      IndexedDb_getInstance();
      var store = transaction.objectStore('um_db_store');
      var tmp = $result.q78_1;
      IndexedDb_getInstance();
      return store.put(tmp, 'um_db_key');
    };
  }
  function $sendMessageCOROUTINE$36(_this__u8e3s4, message, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.g77_1 = _this__u8e3s4;
    this.h77_1 = message;
  }
  protoOf($sendMessageCOROUTINE$36).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            assertNotClosed(this.g77_1);
            this.i77_1 = CompletableDeferred();
            var tmp_0 = this;
            Companion_instance_20.w70_1 = Companion_instance_20.w70_1 + 1 | 0;
            tmp_0.j77_1 = Companion_instance_20.w70_1;
            var this_0 = this.g77_1.i71_1;
            var tmp_1;
            if (this.g77_1.j71_1) {
              tmp_1 = this_0;
            } else {
              tmp_1 = null;
            }

            var tmp1_safe_receiver = tmp_1;
            if (tmp1_safe_receiver == null)
              null;
            else {
              v(tmp1_safe_receiver, VOID, SQLiteDatasourceJs$sendMessage$lambda(this.g77_1, this.j77_1, this.h77_1));
            }

            var this_1 = this.g77_1.k71_1;
            var key = this.j77_1;
            var value = this.i77_1;
            this_1.s(key, value);
            var this_2 = this.g77_1.l71_1;
            var key_0 = this.j77_1;
            var value_0 = toString_0(this.h77_1['sql']);
            this_2.s(key_0, value_0);
            this.h77_1['id'] = this.j77_1;
            this.g77_1.h71_1.postMessage(this.h77_1);
            this.hd_1 = 1;
            suspendResult = this.i77_1.nv(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var result = suspendResult;
            var this_3 = this.g77_1.i71_1;
            var tmp_2;
            if (this.g77_1.j71_1) {
              tmp_2 = this_3;
            } else {
              tmp_2 = null;
            }

            var tmp2_safe_receiver = tmp_2;
            if (tmp2_safe_receiver == null)
              null;
            else {
              v(tmp2_safe_receiver, VOID, SQLiteDatasourceJs$sendMessage$lambda_0(this.g77_1, this.j77_1));
            }

            return result;
          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 $withTransactionLockCOROUTINE$37(_this__u8e3s4, connection, block, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.s77_1 = _this__u8e3s4;
    this.t77_1 = connection;
    this.u77_1 = block;
  }
  protoOf($withTransactionLockCOROUTINE$37).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 8;
            if (this.s77_1.m71_1.z23(this.t77_1)) {
              this.hd_1 = 6;
              suspendResult = this.u77_1(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              var tmp_0 = this;
              tmp_0.w77_1 = this.s77_1.m71_1;
              var tmp_1 = this;
              tmp_1.x77_1 = this.t77_1;
              this.hd_1 = 1;
              suspendResult = this.w77_1.a24(this.x77_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.id_1 = 5;
            this.hd_1 = 3;
            suspendResult = this.u77_1(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.y77_1 = suspendResult;
            this.id_1 = 8;
            this.hd_1 = 4;
            continue $sm;
          case 4:
            var tmp_2 = this.y77_1;
            this.id_1 = 8;
            this.w77_1.l23(this.x77_1);
            this.v77_1 = tmp_2;
            this.hd_1 = 7;
            continue $sm;
          case 5:
            this.id_1 = 8;
            var t = this.kd_1;
            this.w77_1.l23(this.x77_1);
            throw t;
          case 6:
            this.v77_1 = suspendResult;
            this.hd_1 = 7;
            continue $sm;
          case 7:
            return this.v77_1;
          case 8:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 8) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $exportDatabaseToFileCOROUTINE$38(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.z79_1 = _this__u8e3s4;
  }
  protoOf($exportDatabaseToFileCOROUTINE$38).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 6;
            var tmp_0 = this;
            tmp_0.a7a_1 = this.z79_1.m71_1;
            var tmp_1 = this;
            tmp_1.b7a_1 = null;
            this.hd_1 = 1;
            suspendResult = this.a7a_1.a24(this.b7a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.id_1 = 5;
            this.hd_1 = 3;
            suspendResult = sendMessage(this.z79_1, json([to('action', 'export')]), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            var result = suspendResult;
            var tmp0_elvis_lhs = result.q78_1;
            var tmp_2;
            if (tmp0_elvis_lhs == null) {
              throw IllegalStateException_init_$Create$('no result buffer');
            } else {
              tmp_2 = tmp0_elvis_lhs;
            }

            var typedArray = tmp_2;
            var this_0 = [typedArray.buffer];
            var blob = new Blob(this_0);
            var tmp_3 = document.createElement('a');
            var link = tmp_3 instanceof HTMLAnchorElement ? tmp_3 : THROW_CCE();
            var tmp1_safe_receiver = document.body;
            if (tmp1_safe_receiver == null)
              null;
            else
              tmp1_safe_receiver.appendChild(link);
            link.href = URL.createObjectURL(blob);
            link.download = this.z79_1.g71_1 + '.db';
            var tmp_4 = this;
            link.click();
            tmp_4.c7a_1 = Unit_instance;
            this.id_1 = 6;
            this.hd_1 = 4;
            continue $sm;
          case 4:
            this.id_1 = 6;
            this.a7a_1.l23(this.b7a_1);
            return Unit_instance;
          case 5:
            this.id_1 = 6;
            var t = this.kd_1;
            this.a7a_1.l23(this.b7a_1);
            throw t;
          case 6:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 6) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $saveDatabaseToIndexedDbCOROUTINE$39(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.l7a_1 = _this__u8e3s4;
  }
  protoOf($saveDatabaseToIndexedDbCOROUTINE$39).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 7;
            this.m7a_1 = CompletableDeferred();
            var tmp_0 = this;
            tmp_0.n7a_1 = this.l7a_1.m71_1;
            var tmp_1 = this;
            tmp_1.o7a_1 = this.l7a_1;
            this.hd_1 = 1;
            suspendResult = this.n7a_1.a24(this.o7a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.hd_1 = 2;
            continue $sm;
          case 2:
            this.id_1 = 6;
            d_0(this.l7a_1.i71_1, VOID, SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this.l7a_1));
            this.hd_1 = 3;
            suspendResult = sendMessage(this.l7a_1, json([to('action', 'export')]), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.q7a_1 = suspendResult;
            var tmp_2 = this;
            IndexedDb_getInstance();
            tmp_2.r7a_1 = IndexedDb_getInstance().a71_1.open(this.l7a_1.g71_1, 2);
            this.r7a_1.onsuccess = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda_0(this.q7a_1, this.l7a_1, this.m7a_1);
            this.hd_1 = 4;
            suspendResult = this.m7a_1.nv(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 4:
            var this_0 = suspendResult;
            d(this.l7a_1.i71_1, this.l7a_1.n71_1 + ' SQLiteDataSource/JS: saving to indexed db complete');
            this.p7a_1 = this_0;
            this.id_1 = 7;
            this.hd_1 = 5;
            continue $sm;
          case 5:
            var tmp_3 = this.p7a_1;
            this.id_1 = 7;
            this.n7a_1.l23(this.o7a_1);
            return tmp_3;
          case 6:
            this.id_1 = 7;
            var t = this.kd_1;
            this.n7a_1.l23(this.o7a_1);
            throw t;
          case 7:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 7) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function SQLiteDatasourceJs(dbName, worker, logger, logWorkerMessages) {
    logWorkerMessages = logWorkerMessages === VOID ? false : logWorkerMessages;
    this.g71_1 = dbName;
    this.h71_1 = worker;
    this.i71_1 = logger;
    this.j71_1 = logWorkerMessages;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.k71_1 = LinkedHashMap_init_$Create$();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.l71_1 = LinkedHashMap_init_$Create$();
    this.m71_1 = Mutex();
    this.n71_1 = '[SQLiteDataSourceJs - ' + this.g71_1 + ']';
    this.o71_1 = false;
    this.p71_1 = CoroutineScope_0(Dispatchers_getInstance().p12_1.lj(Job()));
    this.h71_1.onmessage = SQLiteDatasourceJs$lambda(this);
  }
  protoOf(SQLiteDatasourceJs).d76 = function (connection, $completion) {
    return this.m71_1.a24(connection, $completion);
  };
  protoOf(SQLiteDatasourceJs).c76 = function (connection) {
    this.m71_1.l23(connection);
  };
  protoOf(SQLiteDatasourceJs).s7a = function (connection, sql, params, $completion) {
    return withTransactionLock(this, connection, SQLiteDatasourceJs$sendQuery$slambda_0(this, sql, params, null), $completion);
  };
  protoOf(SQLiteDatasourceJs).t7a = function (connection, sql, params, returnGeneratedKey, $completion) {
    return withTransactionLock(this, connection, SQLiteDatasourceJs$sendUpdate$slambda_0(this, sql, params, returnGeneratedKey, null), $completion);
  };
  protoOf(SQLiteDatasourceJs).e76 = function (connection, sql, params, returnGeneratedKey, $completion, $super) {
    returnGeneratedKey = returnGeneratedKey === VOID ? false : returnGeneratedKey;
    return $super === VOID ? this.t7a(connection, sql, params, returnGeneratedKey, $completion) : $super.t7a.call(this, connection, sql, params, returnGeneratedKey, $completion);
  };
  protoOf(SQLiteDatasourceJs).r71 = function ($completion) {
    var exportCompletable = CompletableDeferred();
    IndexedDb_getInstance();
    var request = IndexedDb_getInstance().a71_1.open(this.g71_1, 2);
    request.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this, exportCompletable);
    request.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0(exportCompletable);
    return exportCompletable.nv($completion);
  };
  protoOf(SQLiteDatasourceJs).q75 = function ($completion) {
    var tmp = new $exportDatabaseToFileCOROUTINE$38(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteDatasourceJs).y73 = function ($completion) {
    var tmp = new $saveDatabaseToIndexedDbCOROUTINE$39(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteDatasourceJs).r5g = function () {
    assertNotClosed(this);
    return new SQLiteConnectionJs(this);
  };
  function $executeUpdateAsyncCOROUTINE$40(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.c7b_1 = _this__u8e3s4;
  }
  protoOf($executeUpdateAsyncCOROUTINE$40).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.d7b_1 = this.c7b_1.f7b_1 === StatementConstantsKmp_instance.x5g_1;
            this.hd_1 = 1;
            suspendResult = this.c7b_1.e7b_1.f72_1.t7a(this.c7b_1.e7b_1, this.c7b_1.x71_1, this.c7b_1.y71_1, this.d7b_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var result = suspendResult;
            this.c7b_1.h7b_1 = result.k7b_1;
            return 1;
          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 SQLitePreparedStatementJs(connection, sql, autoGeneratedKeys) {
    autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_instance.y5g_1 : autoGeneratedKeys;
    SQLiteStatementJs.call(this, connection, autoGeneratedKeys);
    this.x71_1 = sql;
    var tmp = this;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp.y71_1 = [];
  }
  protoOf(SQLitePreparedStatementJs).k5i = function ($completion) {
    return this.e7b_1.f72_1.s7a(this.e7b_1, this.x71_1, this.y71_1, $completion);
  };
  protoOf(SQLitePreparedStatementJs).i5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value ? 1 : 0;
  };
  protoOf(SQLitePreparedStatementJs).l7b = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).t5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).y5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).m7b = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).a5i = function (index, value) {
    if (value == null) {
      this.y71_1[index - 1 | 0] = null;
    } else {
      if (!(value == null) ? typeof value === 'boolean' : false) {
        this.i5h(index, value);
      } else {
        if (!(value == null) ? typeof value === 'number' : false) {
          this.l7b(index, value);
        } else {
          if (!(value == null) ? typeof value === 'number' : false) {
            this.t5h(index, value);
          } else {
            if (!(value == null) ? typeof value === 'string' : false) {
              this.y5h(index, value);
            } else {
              if (!(value == null) ? isByteArray(value) : false) {
                this.m7b(index, value);
              } else {
                if (value instanceof Long) {
                  this.v5h(index, value);
                } else {
                  if (!(value == null) ? typeof value === 'number' : false) {
                    this.u5h(index, value);
                  }
                }
              }
            }
          }
        }
      }
    }
  };
  protoOf(SQLitePreparedStatementJs).b5i = function (parameterIndex, sqlType) {
    this.y71_1[parameterIndex - 1 | 0] = null;
  };
  protoOf(SQLitePreparedStatementJs).z5h = function (index, array) {
    throw new SQLException('SQLite does not support arrays', null);
  };
  protoOf(SQLitePreparedStatementJs).u5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).v5h = function (index, value) {
    var tmp = index - 1 | 0;
    var tmp_0;
    // Inline function 'kotlin.ranges.contains' call
    var this_0 = numberRangeToNumber(0, 1);
    if (contains(isInterface(this_0, ClosedRange) ? this_0 : THROW_CCE(), value)) {
      tmp_0 = eval('Number(' + value.toString() + ')');
    } else {
      tmp_0 = eval(value.toString() + 'n');
    }
    this.y71_1[tmp] = tmp_0;
  };
  protoOf(SQLitePreparedStatementJs).w5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).x5h = function (index, value) {
    this.y71_1[index - 1 | 0] = value;
  };
  protoOf(SQLitePreparedStatementJs).j5i = function ($completion) {
    var tmp = new $executeUpdateAsyncCOROUTINE$40(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLitePreparedStatementJs).n = function () {
  };
  function getValue($this, columnName) {
    // Inline function 'kotlin.also' call
    var tmp0_safe_receiver = $this.c72_1;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : indexOf_0(tmp0_safe_receiver, columnName);
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.<anonymous>' call
      var tmp0_safe_receiver_0 = $this.b72_1;
      tmp = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0[tmp1_safe_receiver];
    }
    var this_0 = tmp;
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.<anonymous>' call
    $this.e72_1 = this_0 == null;
    return this_0;
  }
  function getValue_0($this, columnIndex) {
    // Inline function 'kotlin.also' call
    var tmp0_safe_receiver = $this.b72_1;
    var this_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver[columnIndex - 1 | 0];
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.<anonymous>' call
    $this.e72_1 = this_0 == null;
    return this_0;
  }
  function SQLiteResultSet(results) {
    this.z71_1 = results;
    this.a72_1 = -1;
    this.b72_1 = null;
    this.c72_1 = null;
    this.d72_1 = false;
    this.e72_1 = true;
    var tmp = this;
    var tmp_0;
    // Inline function 'kotlin.collections.isNotEmpty' call
    // Inline function 'kotlin.collections.isEmpty' call
    if (!(this.z71_1.length === 0)) {
      // Inline function 'kotlin.js.asDynamic' call
      tmp_0 = first_0(this.z71_1).columns;
    } else {
      tmp_0 = null;
    }
    tmp.c72_1 = tmp_0;
  }
  protoOf(SQLiteResultSet).e = function () {
    var tmp;
    // Inline function 'kotlin.collections.isNotEmpty' call
    // Inline function 'kotlin.collections.isEmpty' call
    if (!(this.z71_1.length === 0)) {
      this.a72_1 = this.a72_1 + 1 | 0;
      // Inline function 'kotlin.js.asDynamic' call
      var data = first_0(this.z71_1).values;
      var tmp_0 = this.a72_1;
      var tmp_1 = data.length;
      var hasNext = tmp_0 < ((!(tmp_1 == null) ? typeof tmp_1 === 'number' : false) ? tmp_1 : THROW_CCE());
      this.b72_1 = hasNext ? data[this.a72_1] : null;
      if (this.b72_1 == null) {
        this.a72_1 = this.a72_1 - 1 | 0;
      }
      return !(this.b72_1 == null);
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(SQLiteResultSet).rz = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
  };
  protoOf(SQLiteResultSet).x60 = function (columnIndex) {
    var tmp0_safe_receiver = getValue_0(this, columnIndex);
    return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
  };
  protoOf(SQLiteResultSet).j66 = function (columnName) {
    var value = getValue(this, columnName);
    return Boolean(value);
  };
  protoOf(SQLiteResultSet).n74 = function (columnIndex) {
    var value = getValue_0(this, columnIndex);
    return Boolean(value);
  };
  protoOf(SQLiteResultSet).m66 = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toShort_0(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).x5m = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toInt(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).m5s = function (columnIndex) {
    var tmp0_safe_receiver = getValue_0(this, columnIndex);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toInt(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).l66 = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.text.toFloat' call
      // Inline function 'kotlin.js.unsafeCast' call
      // Inline function 'kotlin.js.asDynamic' call
      tmp = toDouble(tmp1_safe_receiver);
    }
    var tmp2_elvis_lhs = tmp;
    return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).y5m = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toLong_0(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? new Long(0, 0) : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).z5e = function (columnIndex) {
    var tmp0_safe_receiver = getValue_0(this, columnIndex);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toLong_0(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? new Long(0, 0) : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).k66 = function (columnName) {
    var tmp0_safe_receiver = getValue(this, columnName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toDouble(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs;
  };
  protoOf(SQLiteResultSet).q67 = function () {
    return this.e72_1;
  };
  protoOf(SQLiteResultSet).n = function () {
    this.b72_1 = null;
    this.c72_1 = null;
    this.a72_1 = -1;
    this.d72_1 = true;
  };
  protoOf(SQLiteResultSet).toString = function () {
    var str = '[SQLiteResultSet] Columns=' + this.c72_1;
    // Inline function 'kotlin.collections.isEmpty' call
    if (this.z71_1.length === 0) {
      str = str + ' - no rows';
      return str;
    }
    return str;
  };
  function $executeUpdateAsyncJsCOROUTINE$41(_this__u8e3s4, sql, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.v7b_1 = _this__u8e3s4;
    this.w7b_1 = sql;
  }
  protoOf($executeUpdateAsyncJsCOROUTINE$41).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            var tmp_0 = Napier_getInstance();
            var tmp_1 = 'SqliteJs: updateAsyncJs: ' + this.w7b_1 + '\n';
            tmp_0.c5e(tmp_1, VOID, 'DoorLog');
            this.hd_1 = 1;
            suspendResult = this.v7b_1.e7b_1.f72_1.e76(this.v7b_1.e7b_1, this.w7b_1, [], VOID, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            return ARGUMENT.j7b_1;
          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 SQLiteStatementJs(connection, autoGeneratedKeys) {
    autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_instance.y5g_1 : autoGeneratedKeys;
    this.e7b_1 = connection;
    this.f7b_1 = autoGeneratedKeys;
    this.g7b_1 = false;
    this.h7b_1 = null;
    this.i7b_1 = 0;
  }
  protoOf(SQLiteStatementJs).l5i = function (sql, $completion) {
    var tmp = new $executeUpdateAsyncJsCOROUTINE$41(this, sql, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(SQLiteStatementJs).n = function () {
    this.g7b_1 = true;
  };
  protoOf(SQLiteStatementJs).r5g = function () {
    return this.e7b_1;
  };
  protoOf(SQLiteStatementJs).y5e = function () {
    var tmp0_elvis_lhs = this.h7b_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.arrayOf' call
      // Inline function 'kotlin.js.unsafeCast' call
      // Inline function 'kotlin.js.asDynamic' call
      var tmp$ret$2 = [];
      tmp = new SQLiteResultSet(tmp$ret$2);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  protoOf(SQLiteStatementJs).c5i = function (seconds) {
    this.i7b_1 = seconds;
  };
  function UpdateResult(numRowsChanged, autoGeneratedKey) {
    this.j7b_1 = numRowsChanged;
    this.k7b_1 = autoGeneratedKey;
  }
  protoOf(UpdateResult).toString = function () {
    return 'UpdateResult(numRowsChanged=' + this.j7b_1 + ', autoGeneratedKey=' + this.k7b_1 + ')';
  };
  protoOf(UpdateResult).hashCode = function () {
    var result = this.j7b_1;
    result = imul(result, 31) + (this.k7b_1 == null ? 0 : hashCode(this.k7b_1)) | 0;
    return result;
  };
  protoOf(UpdateResult).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof UpdateResult))
      return false;
    var tmp0_other_with_cast = other instanceof UpdateResult ? other : THROW_CCE();
    if (!(this.j7b_1 === tmp0_other_with_cast.j7b_1))
      return false;
    if (!equals(this.k7b_1, tmp0_other_with_cast.k7b_1))
      return false;
    return true;
  };
  function WorkerResult(id, results, ready, buffer) {
    this.n78_1 = id;
    this.o78_1 = results;
    this.p78_1 = ready;
    this.q78_1 = buffer;
  }
  protoOf(WorkerResult).toString = function () {
    return 'WorkerResult(id=' + this.n78_1 + ', results=' + toString(this.o78_1) + ', ready=' + this.p78_1 + ', buffer=' + this.q78_1 + ')';
  };
  protoOf(WorkerResult).hashCode = function () {
    var result = this.n78_1;
    result = imul(result, 31) + (this.o78_1 == null ? 0 : hashCode(this.o78_1)) | 0;
    result = imul(result, 31) + getBooleanHashCode(this.p78_1) | 0;
    result = imul(result, 31) + (this.q78_1 == null ? 0 : hashCode(this.q78_1)) | 0;
    return result;
  };
  protoOf(WorkerResult).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof WorkerResult))
      return false;
    var tmp0_other_with_cast = other instanceof WorkerResult ? other : THROW_CCE();
    if (!(this.n78_1 === tmp0_other_with_cast.n78_1))
      return false;
    if (!equals(this.o78_1, tmp0_other_with_cast.o78_1))
      return false;
    if (!(this.p78_1 === tmp0_other_with_cast.p78_1))
      return false;
    if (!equals(this.q78_1, tmp0_other_with_cast.q78_1))
      return false;
    return true;
  };
  function _get_logPrefix__aovpcr($this) {
    return '[DoorEventSourceJS - ' + $this.y7b_1 + ']';
  }
  function DoorEventSource$lambda(this$0) {
    return function (event) {
      Napier_getInstance().i5e(_get_logPrefix__aovpcr(this$0) + ' message received ' + event.lastEventId + ' ' + event.origin + ('- ' + toString_0(event.data)));
      this$0.z7b_1.z6b(Companion_instance_15.o2r(toString_0(event.data)));
      return Unit_instance;
    };
  }
  function DoorEventSource$lambda_0(this$0) {
    return function (it) {
      var tmp = Napier_getInstance();
      var tmp_0 = _get_logPrefix__aovpcr(this$0) + ' error occured: ' + it + '\n';
      tmp.q5e(tmp_0, VOID, 'DoorLog');
      this$0.z7b_1.d6c(Exception_init_$Create$('Error occurred on ' + toString_0(it.target)));
      return Unit_instance;
    };
  }
  function DoorEventSource$lambda_1(this$0) {
    return function (it) {
      Napier_getInstance().g5e(_get_logPrefix__aovpcr(this$0) + ' open');
      this$0.z7b_1.y6b();
      return Unit_instance;
    };
  }
  function DoorEventSource(repoConfig, url, listener, retry) {
    retry = retry === VOID ? 2000 : retry;
    this.x7b_1 = repoConfig;
    this.y7b_1 = url;
    this.z7b_1 = listener;
    this.a7c_1 = new EventSource(this.y7b_1);
    var tmp = Napier_getInstance();
    var tmp_0 = _get_logPrefix__aovpcr(this) + ' connecting\n';
    tmp.i5e(tmp_0, VOID, 'DoorLog');
    this.a7c_1.onmessage = DoorEventSource$lambda(this);
    this.a7c_1.onerror = DoorEventSource$lambda_0(this);
    this.a7c_1.onopen = DoorEventSource$lambda_1(this);
  }
  function DoorJsImplClasses() {
  }
  function KmpUuid(mostSigBits, leastSigBits) {
  }
  protoOf(KmpUuid).toString = function () {
    var timeStamp = (new Date()).getTime();
    var tmp = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (mChar) {
      var mRandom = (timeStamp + Math.random() * 16) % 16 | 0;
      timeStamp = Math.floor(timeStamp / 16);
      return (mChar == 'x' ? mRandom : mRandom & 3 | 8).toString(16);
    });
    return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  };
  function randomUuid() {
    return new KmpUuid(new Long(0, 0), new Long(0, 0));
  }
  function generateDoorNodeId(maxNodeId) {
    var nodeIdRef = 'nodeId_ref';
    // Inline function 'org.w3c.dom.get' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp0_safe_receiver = localStorage[nodeIdRef];
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toInt(tmp0_safe_receiver);
    var foundNodeId = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs;
    if (foundNodeId === 0) {
      // Inline function 'kotlin.math.floor' call
      var x = Default_getInstance().yj() * maxNodeId;
      var tmp$ret$2 = Math.floor(x);
      foundNodeId = numberToInt(tmp$ret$2);
      localStorage.setItem(nodeIdRef, foundNodeId.toString());
    }
    return foundNodeId;
  }
  function systemTimeInMillis() {
    return numberToLong((new Date()).getTime());
  }
  function threadSafeMapOf(items) {
    // Inline function 'kotlin.also' call
    // Inline function 'kotlin.collections.mutableMapOf' call
    var this_0 = LinkedHashMap_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'com.ustadmobile.door.util.threadSafeMapOf.<anonymous>' call
    putAll(this_0, items);
    return this_0;
  }
  function waitBlocking(delayInMs) {
    var delayFor = numberToLong((new Date()).getTime()).lc(delayInMs);
    while ((new Date()).getTime() <= delayFor.a7()) {
    }
  }
  function WeakMapJs() {
    var tmp = this;
    // Inline function 'kotlin.emptyArray' call
    var tmp$ret$0 = [];
    tmp.b7c_1 = new WeakMap(tmp$ret$0);
  }
  protoOf(WeakMapJs).p67 = function (key, value) {
    this.b7c_1.set(key, value);
  };
  function WeakRefJs(target) {
    this.c7c_1 = new WeakRef(target);
  }
  protoOf(WeakRefJs).lz = function () {
    return this.c7c_1.deref();
  };
  function weakRefOf(target) {
    return new WeakRefJs(target);
  }
  //region block: post-declaration
  protoOf(TransactionElement).pd = get;
  protoOf(TransactionElement).kj = fold;
  protoOf(TransactionElement).jj = minusKey;
  protoOf(TransactionElement).lj = plus_0;
  protoOf($serializer).l4g = typeParametersSerializers;
  protoOf($serializer_0).l4g = typeParametersSerializers;
  protoOf($serializer_1).l4g = typeParametersSerializers;
  protoOf($serializer_2).l4g = typeParametersSerializers;
  //endregion
  //region block: init
  Companion_instance = new Companion();
  Companion_instance_0 = new Companion_0();
  Key_instance = new Key();
  DoorConstants_instance = new DoorConstants();
  Companion_instance_3 = new Companion_3();
  Companion_instance_4 = new Companion_4();
  Companion_instance_5 = new Companion_5();
  Companion_instance_6 = new Companion_6();
  Companion_instance_7 = new Companion_7();
  Companion_instance_8 = new Companion_8();
  StatementConstantsKmp_instance = new StatementConstantsKmp();
  TypesKmp_instance = new TypesKmp();
  NodeEventConstants_instance = new NodeEventConstants();
  INITIAL_ITEM_COUNT = -1;
  Companion_instance_10 = new Companion_10();
  Companion_instance_11 = new Companion_11();
  Companion_instance_12 = new Companion_12();
  ReplicationConstants_instance = new ReplicationConstants();
  Companion_instance_14 = new Companion_14();
  Companion_instance_15 = new Companion_15();
  TriggerConstants_instance = new TriggerConstants();
  Companion_instance_18 = new Companion_18();
  Companion_instance_19 = new Companion_19();
  Companion_instance_20 = new Companion_20();
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = Trigger;
  _.$_$.b = NodeIdAndAuth;
  _.$_$.c = OutgoingReplication;
  _.$_$.d = DoorDatabaseMetadata;
  _.$_$.e = createArrayOrProxyArrayOf;
  _.$_$.f = createInstance;
  _.$_$.g = dbType_0;
  _.$_$.h = doorDatabaseMetadata;
  _.$_$.i = doorNodeAndVersionHeaders;
  _.$_$.j = doorNodeIdHeader;
  _.$_$.k = get_doorPrimaryKeyManager;
  _.$_$.l = get_doorWrapperNodeId;
  _.$_$.m = mutableLinkedListOf;
  _.$_$.n = get_nodeIdAuthCache;
  _.$_$.o = pagingSourceLoadParameters;
  _.$_$.p = get_rootDatabase;
  _.$_$.q = setBodyJson;
  _.$_$.r = setRepoUrl_0;
  _.$_$.s = toUrlQueryString;
  _.$_$.t = unwrap;
  _.$_$.u = doorFlow;
  _.$_$.v = RepoDaoFlowHelper;
  _.$_$.w = getBooleanNullable;
  _.$_$.x = getFloatNullable;
  _.$_$.y = getIntNullable;
  _.$_$.z = getLongNullable;
  _.$_$.a1 = getStringNonNull;
  _.$_$.b1 = mapNextRow_0;
  _.$_$.c1 = mapNextRow;
  _.$_$.d1 = mapRows;
  _.$_$.e1 = setBooleanNullable;
  _.$_$.f1 = setFloatNullable;
  _.$_$.g1 = setIntNullable;
  _.$_$.h1 = setLongNullable;
  _.$_$.i1 = useResults;
  _.$_$.j1 = PreparedStatement;
  _.$_$.k1 = DoorMigrationStatementList;
  _.$_$.l1 = NodeEventManagerJs;
  _.$_$.m1 = DelegatedInvalidationPagingSource;
  _.$_$.n1 = DoorLimitOffsetPagingSource;
  _.$_$.o1 = OffsetLimitMediatorState;
  _.$_$.p1 = DoorOffsetLimitRemoteMediator;
  _.$_$.q1 = DoorRepositoryReplicatePullPagingSource;
  _.$_$.r1 = PagingSourceInterceptor;
  _.$_$.s1 = PagingSourceWithHttpLoader;
  _.$_$.t1 = endOfPaginationReached;
  _.$_$.u1 = ReplicationEntityMetaData;
  _.$_$.v1 = ReplicationFieldMetaData;
  _.$_$.w1 = InvalidationTracker_0;
  _.$_$.x1 = RoomDatabaseJdbcImplHelper;
  _.$_$.y1 = RoomDatabase;
  _.$_$.z1 = RoomJdbcImpl;
  _.$_$.a2 = DoorJsImplClasses;
  _.$_$.b2 = NodeIdAuthCache;
  _.$_$.c2 = randomUuid;
  _.$_$.d2 = systemTimeInMillis;
  _.$_$.e2 = DatabaseBuilderOptions;
  _.$_$.f2 = DoorDatabaseJdbc;
  _.$_$.g2 = DoorDatabaseRepository;
  _.$_$.h2 = DoorDatabaseWrapper;
  _.$_$.i2 = DoorPrimaryKeyManager;
  _.$_$.j2 = EntityInsertionAdapter;
  _.$_$.k2 = PreparedStatementConfig;
  _.$_$.l2 = RepositoryHelper;
  _.$_$.m2 = SyncNodeIdCallback;
  _.$_$.n2 = SyncNode;
  _.$_$.o2 = RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance;
  _.$_$.p2 = Event_INSERT_getInstance;
  _.$_$.q2 = On_ENTITY_getInstance;
  _.$_$.r2 = On_RECEIVEVIEW_getInstance;
  _.$_$.s2 = Order_AFTER_getInstance;
  _.$_$.t2 = Order_INSTEAD_OF_getInstance;
  _.$_$.u2 = prepareAndUseStatementAsync;
  _.$_$.v2 = prepareAndUseStatementAsync_0;
  _.$_$.w2 = withDoorTransactionAsync;
  _.$_$.x2 = executeQueryAsyncKmp;
  _.$_$.y2 = executeUpdateAsyncKmp;
  _.$_$.z2 = onClientRepoDoorMessageHttpResponse;
  _.$_$.a3 = withRepoChangeMonitorAsync;
  _.$_$.b3 = Companion_instance_7;
  _.$_$.c3 = Companion_getInstance_18;
  _.$_$.d3 = Companion_getInstance_3;
  _.$_$.e3 = Companion_getInstance_19;
  _.$_$.f3 = Companion_instance_18;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./kotlinx-atomicfu.js'), require('./Napier-napier-js-ir.js'), require('./multiplatform-paging-root-paging-common.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js'), require('./ktor-ktor-http.js'), require('./ktor-ktor-utils.js'), require('./ktor-ktor-client-core.js'), require('./kotlinx-serialization-kotlinx-serialization-json.js')));

//# sourceMappingURL=door-door-runtime.js.map
