#!/usr/bin/env node
(function (_, kotlin_clikt_clikt, kotlin_kotlin, kotlin_com_mrs_platform_toolbox_library, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_http, kotlin_com_mrs_platform_configuration_dto_dto, kotlin_io_ktor_ktor_client_core, kotlin_dev_whyoleg_cryptography_cryptography_provider_webcrypto) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var BaseCliktCommand = kotlin_clikt_clikt.$_$.a;
  var VOID = kotlin_kotlin.$_$.c;
  var option = kotlin_clikt_clikt.$_$.g;
  var KProperty1 = kotlin_kotlin.$_$.ne;
  var getPropertyCallableRef = kotlin_kotlin.$_$.mc;
  var protoOf = kotlin_kotlin.$_$.od;
  var CommandExecutor_getInstance = kotlin_com_mrs_platform_toolbox_library.$_$.a;
  var initMetadataForClass = kotlin_kotlin.$_$.pc;
  var CoroutineImpl = kotlin_kotlin.$_$.xa;
  var Unit_instance = kotlin_kotlin.$_$.b1;
  var THROW_CCE = kotlin_kotlin.$_$.vi;
  var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1;
  var isInterface = kotlin_kotlin.$_$.ed;
  var initMetadataForLambda = kotlin_kotlin.$_$.uc;
  var flow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h1;
  var argument = kotlin_clikt_clikt.$_$.e;
  var LoggerMessage = kotlin_com_mrs_platform_toolbox_library.$_$.k;
  var equals = kotlin_kotlin.$_$.ic;
  var FunctionAdapter = kotlin_kotlin.$_$.vb;
  var hashCode = kotlin_kotlin.$_$.oc;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.fa;
  var split = kotlin_kotlin.$_$.kg;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.p6;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.k1;
  var BuildHelper_getInstance = kotlin_com_mrs_platform_toolbox_library.$_$.d;
  var isCharSequence = kotlin_kotlin.$_$.ad;
  var trim = kotlin_kotlin.$_$.xh;
  var toString = kotlin_kotlin.$_$.rd;
  var toList = kotlin_kotlin.$_$.p9;
  var emptyList = kotlin_kotlin.$_$.k7;
  var boolean = kotlin_clikt_clikt.$_$.i;
  var default_0 = kotlin_clikt_clikt.$_$.f;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l1;
  var getKClassFromExpression = kotlin_kotlin.$_$.he;
  var joinToString = kotlin_kotlin.$_$.c8;
  var Prompt_instance = kotlin_com_mrs_platform_toolbox_library.$_$.e;
  var Url = kotlin_io_ktor_ktor_http.$_$.e1;
  var KeychainManager_instance = kotlin_com_mrs_platform_toolbox_library.$_$.c;
  var required = kotlin_clikt_clikt.$_$.h;
  var Error_0 = kotlin_com_mrs_platform_toolbox_library.$_$.h;
  var Info = kotlin_com_mrs_platform_toolbox_library.$_$.i;
  var Progress = kotlin_com_mrs_platform_toolbox_library.$_$.j;
  var Exception_init_$Create$ = kotlin_kotlin.$_$.o2;
  var ensureNotNull = kotlin_kotlin.$_$.nj;
  var AccessToken = kotlin_com_mrs_platform_toolbox_library.$_$.f;
  var Authorizer_instance = kotlin_com_mrs_platform_toolbox_library.$_$.b;
  var listOf = kotlin_kotlin.$_$.k8;
  var CommandLineParser_instance = kotlin_clikt_clikt.$_$.k;
  var asList = kotlin_kotlin.$_$.h6;
  var flatten = kotlin_clikt_clikt.$_$.j;
  var closeFinally = kotlin_kotlin.$_$.kj;
  var ProgramResult = kotlin_clikt_clikt.$_$.c;
  var CliktError = kotlin_clikt_clikt.$_$.b;
  var emitAll = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i;
  var subcommands = kotlin_clikt_clikt.$_$.d;
  var Exception = kotlin_kotlin.$_$.oi;
  var InvalidTokenException = kotlin_com_mrs_platform_toolbox_library.$_$.g;
  var initMetadataForCoroutine = kotlin_kotlin.$_$.rc;
  var repeat = kotlin_kotlin.$_$.eg;
  var isArray = kotlin_kotlin.$_$.wc;
  var get_EmptyContinuation = kotlin_kotlin.$_$.la;
  //endregion
  //region block: pre-declaration
  initMetadataForClass(FlowCliktCommand, 'FlowCliktCommand', VOID, BaseCliktCommand);
  initMetadataForLambda(Mrsc$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Mrsc, 'Mrsc', Mrsc, FlowCliktCommand);
  initMetadataForLambda(WorkingDir$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(WorkingDir, 'WorkingDir', WorkingDir, FlowCliktCommand);
  initMetadataForLambda(Test$run$slambda$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForLambda(Test$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Test, 'Test', Test, FlowCliktCommand);
  initMetadataForLambda(Prepare$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Prepare, 'Prepare', Prepare, FlowCliktCommand);
  initMetadataForLambda(Build$run$slambda$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0_0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForLambda(Build$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Build, 'Build', Build, FlowCliktCommand);
  initMetadataForLambda(Auth$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Auth, 'Auth', Auth, FlowCliktCommand);
  initMetadataForLambda(Deploy$run$slambda$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForLambda(Deploy$run$slambda$slambda_1, CoroutineImpl, VOID, [1]);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0_1, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForLambda(Deploy$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Deploy, 'Deploy', Deploy, FlowCliktCommand);
  initMetadataForLambda(Version$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Version, 'Version', Version, FlowCliktCommand);
  initMetadataForLambda(Migrate$run$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(Migrate, 'Migrate', Migrate, FlowCliktCommand);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0_2, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForLambda(parse$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForLambda(commonMain$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForCoroutine($commonMainCOROUTINE$, CoroutineImpl);
  //endregion
  function FlowCliktCommand$_get_workingDir_$ref_l1r8q6() {
    return function (p0) {
      return p0.laf();
    };
  }
  function FlowCliktCommand$_get_workingDir_$ref_l1r8q6_0() {
    return function (p0) {
      return p0.laf();
    };
  }
  function FlowCliktCommand(name) {
    name = name === VOID ? null : name;
    BaseCliktCommand.call(this, name);
    var tmp = this;
    var tmp_0 = option(this, ['--workingdir', '-w'], 'Working directory');
    var tmp_1 = KProperty1;
    tmp.kaf_1 = tmp_0.ua9(this, getPropertyCallableRef('workingDir', 1, tmp_1, FlowCliktCommand$_get_workingDir_$ref_l1r8q6(), null));
  }
  protoOf(FlowCliktCommand).laf = function () {
    var tmp = KProperty1;
    return this.kaf_1.ia9(this, getPropertyCallableRef('workingDir', 1, tmp, FlowCliktCommand$_get_workingDir_$ref_l1r8q6_0(), null));
  };
  protoOf(FlowCliktCommand).naf = function () {
    if (!(this.laf() == null))
      CommandExecutor_getInstance().j6w_1 = this.laf();
  };
  function Mrsc$run$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Mrsc$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Mrsc$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Mrsc$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(Mrsc$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Mrsc$run$slambda(completion);
    i.waf_1 = $this$flow;
    return i;
  };
  function Mrsc$run$slambda_0(resultContinuation) {
    var i = new Mrsc$run$slambda(resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Mrsc() {
    FlowCliktCommand.call(this);
  }
  protoOf(Mrsc).maf = function () {
    return flow(Mrsc$run$slambda_0(null));
  };
  function WorkingDir$_get_path_$ref_x0ppb7() {
    return function (p0) {
      return p0.y1w();
    };
  }
  function WorkingDir$_get_path_$ref_x0ppb7_0() {
    return function (p0) {
      return p0.y1w();
    };
  }
  function WorkingDir$run$slambda(this$0, resultContinuation) {
    this.oah_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(WorkingDir$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(WorkingDir$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(WorkingDir$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          CommandExecutor_getInstance().j6w_1 = this.oah_1.y1w();
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(WorkingDir$run$slambda).yaf = function ($this$flow, completion) {
    var i = new WorkingDir$run$slambda(this.oah_1, completion);
    i.pah_1 = $this$flow;
    return i;
  };
  function WorkingDir$run$slambda_0(this$0, resultContinuation) {
    var i = new WorkingDir$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function WorkingDir() {
    FlowCliktCommand.call(this, 'workingdir');
    var tmp = this;
    var tmp_0 = argument(this);
    var tmp_1 = KProperty1;
    tmp.fah_1 = tmp_0.ka9(this, getPropertyCallableRef('path', 1, tmp_1, WorkingDir$_get_path_$ref_x0ppb7(), null));
  }
  protoOf(WorkingDir).g9z = function (context) {
    return 'Set working directory';
  };
  protoOf(WorkingDir).y1w = function () {
    var tmp = KProperty1;
    return this.fah_1.ia9(this, getPropertyCallableRef('path', 1, tmp, WorkingDir$_get_path_$ref_x0ppb7_0(), null));
  };
  protoOf(WorkingDir).maf = function () {
    return flow(WorkingDir$run$slambda_0(this, null));
  };
  function Test$run$slambda$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Test$run$slambda$slambda).j85 = function (it, $completion) {
    var tmp = this.k85(it, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Test$run$slambda$slambda).z9 = function (p1, $completion) {
    return this.j85(p1 instanceof LoggerMessage ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Test$run$slambda$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(Test$run$slambda$slambda).k85 = function (it, completion) {
    var i = new Test$run$slambda$slambda(completion);
    i.yah_1 = it;
    return i;
  };
  function Test$run$slambda$slambda_0(resultContinuation) {
    var i = new Test$run$slambda$slambda(resultContinuation);
    var l = function (it, $completion) {
      return i.j85(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0(function_0) {
    this.zah_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).k3c = function (value, $completion) {
    return this.zah_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).o3 = function () {
    return this.zah_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.o3(), other.o3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).hashCode = function () {
    return hashCode(this.o3());
  };
  function Test$run$slambda(this$0, resultContinuation) {
    this.iai_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Test$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Test$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Test$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 2;
            this.iai_1.naf();
            this.e9_1 = 1;
            var tmp_0 = CommandExecutor_getInstance().q6x();
            var tmp_1 = Test$run$slambda$slambda_0(null);
            suspendResult = tmp_0.v3b(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.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 2) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Test$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Test$run$slambda(this.iai_1, completion);
    i.jai_1 = $this$flow;
    return i;
  };
  function Test$run$slambda_0(this$0, resultContinuation) {
    var i = new Test$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Test() {
    FlowCliktCommand.call(this, 'test');
  }
  protoOf(Test).g9z = function (context) {
    return 'Test hooks';
  };
  protoOf(Test).maf = function () {
    return flow(Test$run$slambda_0(this, null));
  };
  function Prepare$run$slambda(this$0, resultContinuation) {
    this.iaj_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Prepare$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Prepare$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Prepare$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          this.iaj_1.naf();
          CommandExecutor_getInstance().y6x();
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(Prepare$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Prepare$run$slambda(this.iaj_1, completion);
    i.jaj_1 = $this$flow;
    return i;
  };
  function Prepare$run$slambda_0(this$0, resultContinuation) {
    var i = new Prepare$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Prepare() {
    FlowCliktCommand.call(this, 'prepare');
  }
  protoOf(Prepare).g9z = function (context) {
    return 'Prepare workspace';
  };
  protoOf(Prepare).maf = function () {
    return flow(Prepare$run$slambda_0(this, null));
  };
  function Build$run$slambda$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Build$run$slambda$slambda).j85 = function (it, $completion) {
    var tmp = this.k85(it, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Build$run$slambda$slambda).z9 = function (p1, $completion) {
    return this.j85(p1 instanceof LoggerMessage ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Build$run$slambda$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(Build$run$slambda$slambda).k85 = function (it, completion) {
    var i = new Build$run$slambda$slambda(completion);
    i.iak_1 = it;
    return i;
  };
  function Build$run$slambda$slambda_0(resultContinuation) {
    var i = new Build$run$slambda$slambda(resultContinuation);
    var l = function (it, $completion) {
      return i.j85(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0_0(function_0) {
    this.jak_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).k3c = function (value, $completion) {
    return this.jak_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).o3 = function () {
    return this.jak_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.o3(), other.o3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).hashCode = function () {
    return hashCode(this.o3());
  };
  function Build$_get_cleanPrevBuild_$ref_6j0z1e() {
    return function (p0) {
      return p0.cal();
    };
  }
  function Build$_get_cleanPrevBuild_$ref_6j0z1e_0() {
    return function (p0) {
      return p0.cal();
    };
  }
  function Build$_get_processors_$ref_tgldlb() {
    return function (p0) {
      return p0.dal();
    };
  }
  function Build$_get_processors_$ref_tgldlb_0() {
    return function (p0) {
      return p0.dal();
    };
  }
  function Build$run$slambda(this$0, resultContinuation) {
    this.mal_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Build$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Build$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Build$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 3;
            this.mal_1.naf();
            var tmp0_safe_receiver = this.mal_1.dal();
            var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : split(tmp0_safe_receiver, [',']);
            var tmp_0;
            if (tmp1_safe_receiver == null) {
              tmp_0 = null;
            } else {
              var destination = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_safe_receiver, 10));
              var _iterator__ex2g4s = tmp1_safe_receiver.t();
              while (_iterator__ex2g4s.u()) {
                var item = _iterator__ex2g4s.v();
                var tmp_1 = BuildHelper_getInstance();
                destination.e1(tmp_1.p9b(toString(trim(isCharSequence(item) ? item : THROW_CCE()))));
              }
              tmp_0 = destination;
            }

            var tmp2_safe_receiver = tmp_0;
            var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : toList(tmp2_safe_receiver);
            var tmp_2;
            if (tmp3_elvis_lhs == null) {
              tmp_2 = emptyList();
            } else {
              tmp_2 = tmp3_elvis_lhs;
            }

            var processorsList = tmp_2;
            this.e9_1 = 1;
            suspendResult = CommandExecutor_getInstance().d6y(processorsList, this.mal_1.cal(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var flow = suspendResult;
            this.e9_1 = 2;
            var tmp_3 = Build$run$slambda$slambda_0(null);
            suspendResult = flow.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0_0(tmp_3), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return Unit_instance;
          case 3:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 3) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Build$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Build$run$slambda(this.mal_1, completion);
    i.nal_1 = $this$flow;
    return i;
  };
  function Build$run$slambda_0(this$0, resultContinuation) {
    var i = new Build$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Build() {
    FlowCliktCommand.call(this, 'build');
    var tmp = this;
    var tmp_0 = default_0(boolean(option(this, ['-c', '--cleanPrevBuild'], 'Clean previous build cache')), false);
    var tmp_1 = KProperty1;
    tmp.aal_1 = tmp_0.ua9(this, getPropertyCallableRef('cleanPrevBuild', 1, tmp_1, Build$_get_cleanPrevBuild_$ref_6j0z1e(), null));
    var tmp_2 = this;
    var tmp_3 = option(this, ['-p', '--processors'], 'Processors to run, comma separated');
    var tmp_4 = KProperty1;
    tmp_2.bal_1 = tmp_3.ua9(this, getPropertyCallableRef('processors', 1, tmp_4, Build$_get_processors_$ref_tgldlb(), null));
  }
  protoOf(Build).g9z = function (context) {
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = BuildHelper_getInstance().k9b();
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList_init_$Create$_0();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0.t();
    while (_iterator__ex2g4s.u()) {
      var element = _iterator__ex2g4s.v();
      var tmp0_safe_receiver = getKClassFromExpression(element).o();
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.e1(tmp0_safe_receiver);
      }
    }
    return 'Build configuration.\nAvailable processors:\n\t' + joinToString(destination, ',\n\t');
  };
  protoOf(Build).cal = function () {
    var tmp = KProperty1;
    return this.aal_1.ia9(this, getPropertyCallableRef('cleanPrevBuild', 1, tmp, Build$_get_cleanPrevBuild_$ref_6j0z1e_0(), null));
  };
  protoOf(Build).dal = function () {
    var tmp = KProperty1;
    return this.bal_1.ia9(this, getPropertyCallableRef('processors', 1, tmp, Build$_get_processors_$ref_tgldlb_0(), null));
  };
  protoOf(Build).maf = function () {
    return flow(Build$run$slambda_0(this, null));
  };
  function Auth$_get_tenant_$ref_vqu7os() {
    return function (p0) {
      return p0.ham();
    };
  }
  function Auth$_get_tenant_$ref_vqu7os_0() {
    return function (p0) {
      return p0.ham();
    };
  }
  function Auth$_get_email_$ref_pvqceg() {
    return function (p0) {
      return p0.r2h();
    };
  }
  function Auth$_get_email_$ref_pvqceg_0() {
    return function (p0) {
      return p0.r2h();
    };
  }
  function Auth$_get_password_$ref_5gkycb() {
    return function (p0) {
      return p0.l2h();
    };
  }
  function Auth$_get_password_$ref_5gkycb_0() {
    return function (p0) {
      return p0.l2h();
    };
  }
  function Auth$run$slambda(this$0, resultContinuation) {
    this.qam_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Auth$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Auth$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Auth$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 4;
            this.qam_1.naf();
            var tmp0_elvis_lhs = this.qam_1.r2h();
            var resolvedEmail = tmp0_elvis_lhs == null ? Prompt_instance.l9t('Email: ') : tmp0_elvis_lhs;
            var tmp1_elvis_lhs = this.qam_1.l2h();
            var resolvedPassword = tmp1_elvis_lhs == null ? Prompt_instance.m9t('Password: ') : tmp1_elvis_lhs;
            this.e9_1 = 1;
            suspendResult = CommandExecutor_getInstance().p6x(resolvedEmail, resolvedPassword, Url(this.qam_1.ham()), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var loginResponse = suspendResult;
            this.e9_1 = 2;
            suspendResult = KeychainManager_instance.t9g('mrs-toolbox', this.qam_1.ham(), loginResponse.refresh_token, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.e9_1 = 3;
            suspendResult = this.ram_1.k3c('Authenticated successfully for ' + this.qam_1.ham(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 4) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Auth$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Auth$run$slambda(this.qam_1, completion);
    i.ram_1 = $this$flow;
    return i;
  };
  function Auth$run$slambda_0(this$0, resultContinuation) {
    var i = new Auth$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Auth() {
    FlowCliktCommand.call(this, 'auth');
    var tmp = this;
    var tmp_0 = required(option(this, ['--tenant', '-t'], 'Tenant URL'));
    var tmp_1 = KProperty1;
    tmp.eam_1 = tmp_0.ua9(this, getPropertyCallableRef('tenant', 1, tmp_1, Auth$_get_tenant_$ref_vqu7os(), null));
    var tmp_2 = this;
    var tmp_3 = option(this, ['--email', '-e'], 'Admin email');
    var tmp_4 = KProperty1;
    tmp_2.fam_1 = tmp_3.ua9(this, getPropertyCallableRef('email', 1, tmp_4, Auth$_get_email_$ref_pvqceg(), null));
    var tmp_5 = this;
    var tmp_6 = option(this, ['--password', '-p'], 'Admin password');
    var tmp_7 = KProperty1;
    tmp_5.gam_1 = tmp_6.ua9(this, getPropertyCallableRef('password', 1, tmp_7, Auth$_get_password_$ref_5gkycb(), null));
  }
  protoOf(Auth).g9z = function (context) {
    return 'Authenticate with a tenant and save credentials to keychain';
  };
  protoOf(Auth).ham = function () {
    var tmp = KProperty1;
    return this.eam_1.ia9(this, getPropertyCallableRef('tenant', 1, tmp, Auth$_get_tenant_$ref_vqu7os_0(), null));
  };
  protoOf(Auth).r2h = function () {
    var tmp = KProperty1;
    return this.fam_1.ia9(this, getPropertyCallableRef('email', 1, tmp, Auth$_get_email_$ref_pvqceg_0(), null));
  };
  protoOf(Auth).l2h = function () {
    var tmp = KProperty1;
    return this.gam_1.ia9(this, getPropertyCallableRef('password', 1, tmp, Auth$_get_password_$ref_5gkycb_0(), null));
  };
  protoOf(Auth).maf = function () {
    return flow(Auth$run$slambda_0(this, null));
  };
  function Deploy$run$slambda$slambda($this_flow, resultContinuation) {
    this.aan_1 = $this_flow;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Deploy$run$slambda$slambda).j85 = function (msg, $completion) {
    var tmp = this.k85(msg, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Deploy$run$slambda$slambda).z9 = function (p1, $completion) {
    return this.j85(p1 instanceof LoggerMessage ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Deploy$run$slambda$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 4;
            var tmp0_subject = this.ban_1;
            if (tmp0_subject instanceof Progress) {
              printProgress(this.ban_1.e8y_1, this.ban_1.f8y_1);
              this.e9_1 = 3;
              continue $sm;
            } else {
              if (tmp0_subject instanceof Info) {
                finalizeProgress();
                this.e9_1 = 2;
                suspendResult = this.aan_1.k3c(this.ban_1.z8x_1, this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                if (tmp0_subject instanceof Error_0) {
                  finalizeProgress();
                  this.e9_1 = 1;
                  suspendResult = this.aan_1.k3c('Error: ' + this.ban_1.a8y_1, this);
                  if (suspendResult === get_COROUTINE_SUSPENDED()) {
                    return suspendResult;
                  }
                  continue $sm;
                } else {
                  this.e9_1 = 3;
                  continue $sm;
                }
              }
            }

          case 1:
            this.e9_1 = 3;
            continue $sm;
          case 2:
            this.e9_1 = 3;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 4) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Deploy$run$slambda$slambda).k85 = function (msg, completion) {
    var i = new Deploy$run$slambda$slambda(this.aan_1, completion);
    i.ban_1 = msg;
    return i;
  };
  function Deploy$run$slambda$slambda_0($this_flow, resultContinuation) {
    var i = new Deploy$run$slambda$slambda($this_flow, resultContinuation);
    var l = function (msg, $completion) {
      return i.j85(msg, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Deploy$run$slambda$slambda_1($this_flow, resultContinuation) {
    this.kan_1 = $this_flow;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Deploy$run$slambda$slambda_1).j85 = function (msg, $completion) {
    var tmp = this.k85(msg, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Deploy$run$slambda$slambda_1).z9 = function (p1, $completion) {
    return this.j85(p1 instanceof LoggerMessage ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Deploy$run$slambda$slambda_1).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 4;
            var tmp0_subject = this.lan_1;
            if (tmp0_subject instanceof Info) {
              this.e9_1 = 2;
              suspendResult = this.kan_1.k3c(this.lan_1.z8x_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              if (tmp0_subject instanceof Error_0) {
                this.e9_1 = 1;
                suspendResult = this.kan_1.k3c('Error: ' + this.lan_1.a8y_1, this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.e9_1 = 3;
                continue $sm;
              }
            }

          case 1:
            this.e9_1 = 3;
            continue $sm;
          case 2:
            this.e9_1 = 3;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 4) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Deploy$run$slambda$slambda_1).k85 = function (msg, completion) {
    var i = new Deploy$run$slambda$slambda_1(this.kan_1, completion);
    i.lan_1 = msg;
    return i;
  };
  function Deploy$run$slambda$slambda_2($this_flow, resultContinuation) {
    var i = new Deploy$run$slambda$slambda_1($this_flow, resultContinuation);
    var l = function (msg, $completion) {
      return i.j85(msg, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0_1(function_0) {
    this.man_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_1).k3c = function (value, $completion) {
    return this.man_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_1).o3 = function () {
    return this.man_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_1).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.o3(), other.o3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_1).hashCode = function () {
    return hashCode(this.o3());
  };
  function Deploy$_get_accessToken_$ref_v3ezbi() {
    return function (p0) {
      return p0.fao();
    };
  }
  function Deploy$_get_accessToken_$ref_v3ezbi_0() {
    return function (p0) {
      return p0.fao();
    };
  }
  function Deploy$_get_tenant_$ref_utr11p() {
    return function (p0) {
      return p0.ham();
    };
  }
  function Deploy$_get_tenant_$ref_utr11p_0() {
    return function (p0) {
      return p0.ham();
    };
  }
  function Deploy$run$slambda(this$0, resultContinuation) {
    this.oao_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Deploy$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Deploy$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Deploy$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 7;
            this.oao_1.naf();
            if (!(this.oao_1.fao() == null)) {
              var tmp_0 = this;
              tmp_0.rao_1 = new AccessToken(ensureNotNull(this.oao_1.fao()));
              this.e9_1 = 4;
              continue $sm;
            } else {
              var tmp_1 = this;
              var tmp0_elvis_lhs = this.oao_1.ham();
              var tmp_2;
              if (tmp0_elvis_lhs == null) {
                throw Exception_init_$Create$('--tenant is required when --token is not provided');
              } else {
                tmp_2 = tmp0_elvis_lhs;
              }
              tmp_1.tao_1 = tmp_2;
              this.e9_1 = 1;
              suspendResult = KeychainManager_instance.s9g('mrs-toolbox', this.tao_1, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            }

          case 1:
            var tmp1_elvis_lhs = suspendResult;
            var tmp_3;
            if (tmp1_elvis_lhs == null) {
              throw Exception_init_$Create$('No credentials found for ' + this.tao_1 + ". Run 'mrsc auth --tenant " + this.tao_1 + "' first");
            } else {
              tmp_3 = tmp1_elvis_lhs;
            }

            var refreshToken = tmp_3;
            this.e9_1 = 2;
            suspendResult = Authorizer_instance.z6z(Url(this.tao_1), refreshToken, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.sao_1 = suspendResult;
            this.e9_1 = 3;
            suspendResult = KeychainManager_instance.t9g('mrs-toolbox', this.tao_1, this.sao_1.refresh_token, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.rao_1 = new AccessToken(this.sao_1.access_token);
            this.e9_1 = 4;
            continue $sm;
          case 4:
            this.qao_1 = this.rao_1;
            this.e9_1 = 5;
            var tmp_4 = CommandExecutor_getInstance().c6y(listOf(this.qao_1));
            var tmp_5 = Deploy$run$slambda$slambda_0(this.pao_1, null);
            suspendResult = tmp_4.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0_1(tmp_5), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 5:
            finalizeProgress();
            this.e9_1 = 6;
            var tmp_6 = CommandExecutor_getInstance().g6y(listOf(this.qao_1));
            var tmp_7 = Deploy$run$slambda$slambda_2(this.pao_1, null);
            suspendResult = tmp_6.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0_1(tmp_7), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 6:
            return Unit_instance;
          case 7:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 7) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Deploy$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Deploy$run$slambda(this.oao_1, completion);
    i.pao_1 = $this$flow;
    return i;
  };
  function Deploy$run$slambda_0(this$0, resultContinuation) {
    var i = new Deploy$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Deploy() {
    FlowCliktCommand.call(this, 'deploy');
    var tmp = this;
    var tmp_0 = option(this, ['--token', '-t'], 'Access token of tenant to be deployed');
    var tmp_1 = KProperty1;
    tmp.dao_1 = tmp_0.ua9(this, getPropertyCallableRef('accessToken', 1, tmp_1, Deploy$_get_accessToken_$ref_v3ezbi(), null));
    var tmp_2 = this;
    var tmp_3 = option(this, ['--tenant'], 'Tenant URL (required when --token is not provided)');
    var tmp_4 = KProperty1;
    tmp_2.eao_1 = tmp_3.ua9(this, getPropertyCallableRef('tenant', 1, tmp_4, Deploy$_get_tenant_$ref_utr11p(), null));
  }
  protoOf(Deploy).g9z = function (context) {
    return 'Deploy configuration';
  };
  protoOf(Deploy).fao = function () {
    var tmp = KProperty1;
    return this.dao_1.ia9(this, getPropertyCallableRef('accessToken', 1, tmp, Deploy$_get_accessToken_$ref_v3ezbi_0(), null));
  };
  protoOf(Deploy).ham = function () {
    var tmp = KProperty1;
    return this.eao_1.ia9(this, getPropertyCallableRef('tenant', 1, tmp, Deploy$_get_tenant_$ref_utr11p_0(), null));
  };
  protoOf(Deploy).maf = function () {
    return flow(Deploy$run$slambda_0(this, null));
  };
  function Version$run$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Version$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Version$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Version$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 2;
            this.e9_1 = 1;
            suspendResult = this.cap_1.k3c('Version is 0.0.1', this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 2) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Version$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Version$run$slambda(completion);
    i.cap_1 = $this$flow;
    return i;
  };
  function Version$run$slambda_0(resultContinuation) {
    var i = new Version$run$slambda(resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Version() {
    FlowCliktCommand.call(this, 'version');
  }
  protoOf(Version).g9z = function (context) {
    return 'Get toolbox version';
  };
  protoOf(Version).maf = function () {
    return flow(Version$run$slambda_0(null));
  };
  function Migrate$run$slambda(this$0, resultContinuation) {
    this.caq_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(Migrate$run$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(Migrate$run$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(Migrate$run$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 5;
            this.caq_1.naf();
            this.e9_1 = 1;
            suspendResult = CommandExecutor_getInstance().i6y().q2w(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var results = suspendResult;
            this.eaq_1 = results.t();
            this.e9_1 = 2;
            continue $sm;
          case 2:
            if (!this.eaq_1.u()) {
              this.e9_1 = 4;
              continue $sm;
            }

            var element = this.eaq_1.v();
            this.e9_1 = 3;
            suspendResult = this.daq_1.k3c(element, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.e9_1 = 2;
            continue $sm;
          case 4:
            return Unit_instance;
          case 5:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 5) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(Migrate$run$slambda).yaf = function ($this$flow, completion) {
    var i = new Migrate$run$slambda(this.caq_1, completion);
    i.daq_1 = $this$flow;
    return i;
  };
  function Migrate$run$slambda_0(this$0, resultContinuation) {
    var i = new Migrate$run$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function Migrate() {
    FlowCliktCommand.call(this, 'migrate');
  }
  protoOf(Migrate).g9z = function (context) {
    return 'Migrate current configuration';
  };
  protoOf(Migrate).maf = function () {
    return flow(Migrate$run$slambda_0(this, null));
  };
  function parse(_this__u8e3s4, argv) {
    // Inline function 'kotlin.collections.mutableListOf' call
    var flows = ArrayList_init_$Create$_0();
    // Inline function 'com.github.ajalt.clikt.parsers.CommandLineParser.parseAndRun' call
    var argv_0 = asList(argv);
    var result = CommandLineParser_instance.lab(_this__u8e3s4, argv_0);
    // Inline function 'com.github.ajalt.clikt.parsers.CommandLineParser.run' call
    var rootInvocation = result.oab_1;
    var tmp0 = flatten(rootInvocation);
    $l$block: {
      // Inline function 'kotlin.use' call
      var exception = null;
      try {
        var _iterator__ex2g4s = tmp0.t();
        while (_iterator__ex2g4s.u()) {
          var invocation = _iterator__ex2g4s.v();
          // Inline function 'kotlin.collections.plusAssign' call
          var element = invocation.gab_1.maf();
          flows.e1(element);
        }
        break $l$block;
      } catch ($p) {
        if ($p instanceof Error) {
          var e = $p;
          exception = e;
          throw e;
        } else {
          throw $p;
        }
      }
      finally {
        closeFinally(tmp0, exception);
      }
    }
    return flow(parse$slambda_0(flows, null));
  }
  function main(_this__u8e3s4, argv) {
    var tmp$ret$0;
    $l$block: {
      // Inline function 'com.github.ajalt.clikt.parsers.CommandLineParser.mainReturningValue' call
      try {
        tmp$ret$0 = parse(_this__u8e3s4, argv);
        break $l$block;
      } catch ($p) {
        if ($p instanceof CliktError) {
          var e = $p;
          _this__u8e3s4.la0(e);
          _this__u8e3s4.x9x().r9y_1(e.ma0_1);
          throw new ProgramResult(e.ma0_1);
        } else {
          throw $p;
        }
      }
    }
    return tmp$ret$0;
  }
  function commonMain(argv, $completion) {
    var tmp = new $commonMainCOROUTINE$(argv, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0_2(function_0) {
    this.far_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_2).k3c = function (value, $completion) {
    return this.far_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_2).o3 = function () {
    return this.far_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_2).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.o3(), other.o3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_2).hashCode = function () {
    return hashCode(this.o3());
  };
  function parse$slambda($flows, resultContinuation) {
    this.oar_1 = $flows;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(parse$slambda).xaf = function ($this$flow, $completion) {
    var tmp = this.yaf($this$flow, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(parse$slambda).z9 = function (p1, $completion) {
    return this.xaf((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(parse$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 4;
            this.qar_1 = this.oar_1.t();
            this.e9_1 = 1;
            continue $sm;
          case 1:
            if (!this.qar_1.u()) {
              this.e9_1 = 3;
              continue $sm;
            }

            var element = this.qar_1.v();
            this.e9_1 = 2;
            suspendResult = emitAll(this.par_1, element, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.e9_1 = 1;
            continue $sm;
          case 3:
            return Unit_instance;
          case 4:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 4) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(parse$slambda).yaf = function ($this$flow, completion) {
    var i = new parse$slambda(this.oar_1, completion);
    i.par_1 = $this$flow;
    return i;
  };
  function parse$slambda_0($flows, resultContinuation) {
    var i = new parse$slambda($flows, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.xaf($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function commonMain$slambda($command, resultContinuation) {
    this.zar_1 = $command;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(commonMain$slambda).bas = function (it, $completion) {
    var tmp = this.cas(it, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(commonMain$slambda).z9 = function (p1, $completion) {
    return this.bas((!(p1 == null) ? typeof p1 === 'string' : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(commonMain$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          this.zar_1.oa0(this.aas_1);
          return Unit_instance;
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(commonMain$slambda).cas = function (it, completion) {
    var i = new commonMain$slambda(this.zar_1, completion);
    i.aas_1 = it;
    return i;
  };
  function commonMain$slambda_0($command, resultContinuation) {
    var i = new commonMain$slambda($command, resultContinuation);
    var l = function (it, $completion) {
      return i.bas(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $commonMainCOROUTINE$(argv, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.dar_1 = argv;
  }
  protoOf($commonMainCOROUTINE$).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 3;
            this.ear_1 = subcommands(new Mrsc(), [new WorkingDir(), new Test(), new Prepare(), new Build(), new Auth(), new Deploy(), new Version(), new Migrate()]);
            var resultFlow = main(this.ear_1, this.dar_1);
            this.f9_1 = 2;
            this.e9_1 = 1;
            var tmp_0 = commonMain$slambda_0(this.ear_1, null);
            suspendResult = resultFlow.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0_2(tmp_0), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.f9_1 = 3;
            this.e9_1 = 4;
            continue $sm;
          case 2:
            this.f9_1 = 3;
            var tmp_1 = this.h9_1;
            if (tmp_1 instanceof InvalidTokenException) {
              var e = this.h9_1;
              this.ear_1.oa0('Error: ' + e.message);
              this.ear_1.oa0("Run 'mrsc auth --tenant <tenantUrl>' to re-authenticate, or pass '--token <accessToken>' directly.");
              this.e9_1 = 4;
              continue $sm;
            } else {
              var tmp_2 = this.h9_1;
              if (tmp_2 instanceof Exception) {
                var e_0 = this.h9_1;
                var tmp0_elvis_lhs = e_0.message;
                this.ear_1.oa0('Error: ' + (tmp0_elvis_lhs == null ? e_0.toString() : tmp0_elvis_lhs));
                this.e9_1 = 4;
                continue $sm;
              } else {
                throw this.h9_1;
              }
            }

          case 3:
            throw this.h9_1;
          case 4:
            this.f9_1 = 3;
            return Unit_instance;
        }
      } catch ($p) {
        var e_1 = $p;
        if (this.f9_1 === 3) {
          throw e_1;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e_1;
        }
      }
     while (true);
  };
  var progressActive;
  function printProgress(current, total) {
    var barWidth = 25;
    var filled = total > 0 ? imul(current, barWidth) / total | 0 : 0;
    var empty = barWidth - filled | 0;
    var percent = total > 0 ? imul(current, 100) / total | 0 : 0;
    var bar = repeat('\u2588', filled) + repeat('\u2591', empty);
    process.stdout.write('\rUploading: [' + bar + '] ' + percent + '% (' + current + '/' + total + ')');
    progressActive = true;
  }
  function finalizeProgress() {
    if (progressActive) {
      process.stdout.write('\n');
      progressActive = false;
    }
  }
  function main_0(args, $completion) {
    var tmp = process.argv.slice(2);
    var argv = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
    return commonMain(argv, $completion);
  }
  function mainWrapper() {
    main_0([], get_EmptyContinuation());
  }
  //region block: init
  progressActive = false;
  //endregion
  //region block: exports
  kotlin_kotlin.$jsExportAll$(_);
  kotlin_com_mrs_platform_configuration_dto_dto.$jsExportAll$(_);
  kotlin_io_ktor_ktor_client_core.$jsExportAll$(_);
  kotlin_com_mrs_platform_toolbox_library.$jsExportAll$(_);
  kotlin_dev_whyoleg_cryptography_cryptography_provider_webcrypto.$jsExportAll$(_);
  //endregion
  mainWrapper();
  return _;
}(module.exports, require('./clikt-clikt.js'), require('./kotlin-kotlin-stdlib.js'), require('./toolbox.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-http.js'), require('./com.mrs.platform.configuration.dto.js'), require('./ktor-ktor-client-core.js'), require('./cryptography-kotlin-cryptography-provider-webcrypto.js')));

//# sourceMappingURL=mrs-toolbox-cli.js.map
