(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_atomicfu) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var VOID = kotlin_kotlin.$_$.f;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var protoOf = kotlin_kotlin.$_$.wc;
  var toList = kotlin_kotlin.$_$.t9;
  var classMeta = kotlin_kotlin.$_$.lb;
  var setMetadataFor = kotlin_kotlin.$_$.xc;
  var objectMeta = kotlin_kotlin.$_$.vc;
  var objectCreate = kotlin_kotlin.$_$.uc;
  var emptyList = kotlin_kotlin.$_$.i7;
  var trimMargin = kotlin_kotlin.$_$.hh;
  var hashCode = kotlin_kotlin.$_$.wb;
  var THROW_CCE = kotlin_kotlin.$_$.hi;
  var equals = kotlin_kotlin.$_$.ob;
  var toString = kotlin_kotlin.$_$.bd;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1;
  var firstOrNull = kotlin_kotlin.$_$.n7;
  var lastOrNull = kotlin_kotlin.$_$.g8;
  var ReentrantLock = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.a;
  //endregion
  //region block: pre-declaration
  setMetadataFor(InvalidateCallbackTracker, 'InvalidateCallbackTracker', classMeta);
  setMetadataFor(LoadParams, 'LoadParams', classMeta);
  setMetadataFor(Refresh, 'Refresh', classMeta, LoadParams);
  setMetadataFor(Append, 'Append', classMeta, LoadParams);
  setMetadataFor(Prepend, 'Prepend', classMeta, LoadParams);
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(Companion_0, 'Companion', objectMeta);
  setMetadataFor(LoadResult, 'LoadResult', classMeta);
  setMetadataFor(Error_0, 'Error', classMeta, LoadResult);
  setMetadataFor(Invalid, 'Invalid', classMeta, LoadResult, VOID, Invalid);
  setMetadataFor(Page, 'Page', classMeta, LoadResult);
  setMetadataFor(PagingSource, 'PagingSource', classMeta, VOID, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(PagingLogger, 'PagingLogger', objectMeta);
  setMetadataFor(ReentrantLock_0, 'ReentrantLock', classMeta, VOID, VOID, ReentrantLock_0);
  //endregion
  function InvalidateCallbackTracker(callbackInvoker, invalidGetter) {
    invalidGetter = invalidGetter === VOID ? null : invalidGetter;
    this.f53_1 = callbackInvoker;
    this.g53_1 = invalidGetter;
    this.h53_1 = new ReentrantLock_0();
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.i53_1 = ArrayList_init_$Create$();
    this.j53_1 = false;
  }
  protoOf(InvalidateCallbackTracker).k53 = function (callback) {
    var tmp0_safe_receiver = this.g53_1;
    if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver()) === true) {
      this.l53();
    }
    if (this.j53_1) {
      this.f53_1(callback);
      return Unit_instance;
    }
    var tmp$ret$1;
    $l$block: {
      // Inline function 'androidx.paging.internal.withLock' call
      var this_0 = this.h53_1;
      // Inline function 'kotlin.contracts.contract' call
      try {
        this_0.n53();
        // Inline function 'androidx.paging.InvalidateCallbackTracker.registerInvalidatedCallback.<anonymous>' call
        var tmp;
        if (this.j53_1) {
          tmp = true;
        } else {
          this.i53_1.i1(callback);
          tmp = false;
        }
        tmp$ret$1 = tmp;
        break $l$block;
      }finally {
        this_0.o53();
      }
    }
    var callImmediately = tmp$ret$1;
    if (callImmediately) {
      this.f53_1(callback);
    }
  };
  protoOf(InvalidateCallbackTracker).p53 = function (callback) {
    $l$block: {
      // Inline function 'androidx.paging.internal.withLock' call
      var this_0 = this.h53_1;
      // Inline function 'kotlin.contracts.contract' call
      try {
        this_0.n53();
        // Inline function 'androidx.paging.InvalidateCallbackTracker.unregisterInvalidatedCallback.<anonymous>' call
        this.i53_1.j1(callback);
        break $l$block;
      }finally {
        this_0.o53();
      }
    }
  };
  protoOf(InvalidateCallbackTracker).l53 = function () {
    if (this.j53_1)
      return false;
    $l$block: {
      // Inline function 'androidx.paging.internal.withLock' call
      var this_0 = this.h53_1;
      // Inline function 'kotlin.contracts.contract' call
      try {
        this_0.n53();
        // Inline function 'androidx.paging.InvalidateCallbackTracker.invalidate.<anonymous>' call
        if (this.j53_1)
          return false;
        this.j53_1 = true;
        // Inline function 'kotlin.also' call
        var this_1 = toList(this.i53_1);
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'androidx.paging.InvalidateCallbackTracker.invalidate.<anonymous>.<anonymous>' call
        this.i53_1.n1();
        break $l$block;
      }finally {
        this_0.o53();
      }
    }
    var callbacksToInvoke = this_1;
    // Inline function 'kotlin.collections.forEach' call
    var action = this.f53_1;
    var tmp0_iterator = callbacksToInvoke.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      action(element);
    }
    return true;
  };
  function get_DEBUG() {
    return DEBUG;
  }
  var DEBUG;
  function Refresh(key, loadSize, placeholdersEnabled) {
    LoadParams.call(this, loadSize, placeholdersEnabled);
    this.s53_1 = key;
  }
  protoOf(Refresh).s2 = function () {
    return this.s53_1;
  };
  function Append(key, loadSize, placeholdersEnabled) {
    LoadParams.call(this, loadSize, placeholdersEnabled);
    this.v53_1 = key;
  }
  protoOf(Append).s2 = function () {
    return this.v53_1;
  };
  function Prepend(key, loadSize, placeholdersEnabled) {
    LoadParams.call(this, loadSize, placeholdersEnabled);
    this.y53_1 = key;
  }
  protoOf(Prepend).s2 = function () {
    return this.y53_1;
  };
  function Companion() {
  }
  var Companion_instance;
  function Companion_getInstance() {
    return Companion_instance;
  }
  function Page_init_$Init$(data, prevKey, nextKey, $this) {
    Page.call($this, data, prevKey, nextKey, -2147483648, -2147483648);
    return $this;
  }
  function Page_init_$Create$(data, prevKey, nextKey) {
    return Page_init_$Init$(data, prevKey, nextKey, objectCreate(protoOf(Page)));
  }
  function Companion_0() {
    Companion_instance_0 = this;
    this.z53_1 = -2147483648;
    this.a54_1 = new Page(emptyList(), null, null, 0, 0);
  }
  var Companion_instance_0;
  function Companion_getInstance_0() {
    if (Companion_instance_0 == null)
      new Companion_0();
    return Companion_instance_0;
  }
  function Error_0(throwable) {
    LoadResult.call(this);
    this.b54_1 = throwable;
  }
  protoOf(Error_0).toString = function () {
    return trimMargin('LoadResult.Error(\n                    |   throwable: ' + this.b54_1 + '\n                    |) ');
  };
  protoOf(Error_0).hashCode = function () {
    return hashCode(this.b54_1);
  };
  protoOf(Error_0).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof Error_0))
      return false;
    var tmp0_other_with_cast = other instanceof Error_0 ? other : THROW_CCE();
    if (!equals(this.b54_1, tmp0_other_with_cast.b54_1))
      return false;
    return true;
  };
  function Invalid() {
    LoadResult.call(this);
  }
  protoOf(Invalid).toString = function () {
    return 'LoadResult.Invalid';
  };
  function Page(data, prevKey, nextKey, itemsBefore, itemsAfter) {
    Companion_getInstance_0();
    itemsBefore = itemsBefore === VOID ? -2147483648 : itemsBefore;
    itemsAfter = itemsAfter === VOID ? -2147483648 : itemsAfter;
    LoadResult.call(this);
    this.c54_1 = data;
    this.d54_1 = prevKey;
    this.e54_1 = nextKey;
    this.f54_1 = itemsBefore;
    this.g54_1 = itemsAfter;
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(this.f54_1 === -2147483648 ? true : this.f54_1 >= 0)) {
      // Inline function 'androidx.paging.Page.<anonymous>' call
      var message = 'itemsBefore cannot be negative';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(this.g54_1 === -2147483648 ? true : this.g54_1 >= 0)) {
      // Inline function 'androidx.paging.Page.<anonymous>' call
      var message_0 = 'itemsAfter cannot be negative';
      throw IllegalArgumentException_init_$Create$(toString(message_0));
    }
  }
  protoOf(Page).w = function () {
    return this.c54_1.y();
  };
  protoOf(Page).toString = function () {
    return trimMargin('LoadResult.Page(\n                    |   data size: ' + this.c54_1.u() + '\n                    |   first Item: ' + firstOrNull(this.c54_1) + '\n                    |   last Item: ' + lastOrNull(this.c54_1) + '\n                    |   nextKey: ' + this.e54_1 + '\n                    |   prevKey: ' + this.d54_1 + '\n                    |   itemsBefore: ' + this.f54_1 + '\n                    |   itemsAfter: ' + this.g54_1 + '\n                    |) ');
  };
  protoOf(Page).hashCode = function () {
    var result = hashCode(this.c54_1);
    result = imul(result, 31) + (this.d54_1 == null ? 0 : hashCode(this.d54_1)) | 0;
    result = imul(result, 31) + (this.e54_1 == null ? 0 : hashCode(this.e54_1)) | 0;
    result = imul(result, 31) + this.f54_1 | 0;
    result = imul(result, 31) + this.g54_1 | 0;
    return result;
  };
  protoOf(Page).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof Page))
      return false;
    var tmp0_other_with_cast = other instanceof Page ? other : THROW_CCE();
    if (!equals(this.c54_1, tmp0_other_with_cast.c54_1))
      return false;
    if (!equals(this.d54_1, tmp0_other_with_cast.d54_1))
      return false;
    if (!equals(this.e54_1, tmp0_other_with_cast.e54_1))
      return false;
    if (!(this.f54_1 === tmp0_other_with_cast.f54_1))
      return false;
    if (!(this.g54_1 === tmp0_other_with_cast.g54_1))
      return false;
    return true;
  };
  function LoadParams(loadSize, placeholdersEnabled) {
    this.h54_1 = loadSize;
    this.i54_1 = placeholdersEnabled;
  }
  function LoadResult() {
  }
  function PagingSource$invalidateCallbackTracker$lambda(it) {
    it();
    return Unit_instance;
  }
  function PagingSource() {
    var tmp = this;
    tmp.j54_1 = new InvalidateCallbackTracker(PagingSource$invalidateCallbackTracker$lambda);
  }
  protoOf(PagingSource).k54 = function () {
    if (this.j54_1.l53()) {
      // Inline function 'androidx.paging.log' call
      var level = get_DEBUG();
      var logger = PagingLogger_instance;
      if (logger.m54(level)) {
        // Inline function 'androidx.paging.PagingSource.invalidate.<anonymous>' call
        var tmp$ret$0 = 'Invalidated PagingSource ' + this;
        logger.l54(level, tmp$ret$0, null);
      }
    }
  };
  protoOf(PagingSource).n54 = function (onInvalidatedCallback) {
    this.j54_1.k53(onInvalidatedCallback);
  };
  protoOf(PagingSource).o54 = function (onInvalidatedCallback) {
    this.j54_1.p53(onInvalidatedCallback);
  };
  function PagingLogger() {
  }
  protoOf(PagingLogger).m54 = function (level) {
    return false;
  };
  protoOf(PagingLogger).l54 = function (level, message, tr) {
  };
  var PagingLogger_instance;
  function PagingLogger_getInstance() {
    return PagingLogger_instance;
  }
  function ReentrantLock_0() {
    this.m53_1 = new ReentrantLock();
  }
  protoOf(ReentrantLock_0).n53 = function () {
    // Inline function 'kotlinx.atomicfu.locks.ReentrantLock.lock' call
    this.m53_1;
  };
  protoOf(ReentrantLock_0).o53 = function () {
    // Inline function 'kotlinx.atomicfu.locks.ReentrantLock.unlock' call
    this.m53_1;
  };
  //region block: init
  DEBUG = 3;
  Companion_instance = new Companion();
  PagingLogger_instance = new PagingLogger();
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = Append;
  _.$_$.b = Prepend;
  _.$_$.c = Refresh;
  _.$_$.d = LoadParams;
  _.$_$.e = Error_0;
  _.$_$.f = Invalid;
  _.$_$.g = Page;
  _.$_$.h = LoadResult;
  _.$_$.i = PagingSource;
  _.$_$.j = Page_init_$Create$;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-atomicfu.js')));

//# sourceMappingURL=multiplatform-paging-root-paging-common.js.map
