git-semver-tagger
Version:
 
803 lines (801 loc) • 31.3 kB
JavaScript
(function (_, kotlin_kotlin, kotlin_com_zegreatrob_tools_digger_core) {
'use strict';
//region block: imports
var imul = Math.imul;
var split = kotlin_kotlin.$_$.xb;
var collectionSizeOrDefault = kotlin_kotlin.$_$.w4;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.i;
var toInt = kotlin_kotlin.$_$.kc;
var Unit_instance = kotlin_kotlin.$_$.y3;
var charSequenceLength = kotlin_kotlin.$_$.h8;
var charSequenceGet = kotlin_kotlin.$_$.g8;
var digitToIntOrNull = kotlin_kotlin.$_$.bb;
var substring = kotlin_kotlin.$_$.dc;
var listOf = kotlin_kotlin.$_$.i6;
var protoOf = kotlin_kotlin.$_$.q9;
var initMetadataForClass = kotlin_kotlin.$_$.q8;
var VOID = kotlin_kotlin.$_$.f;
var enumEntries = kotlin_kotlin.$_$.v7;
var Enum = kotlin_kotlin.$_$.ed;
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.j;
var getStringHashCode = kotlin_kotlin.$_$.o8;
var THROW_CCE = kotlin_kotlin.$_$.md;
var isCharSequence = kotlin_kotlin.$_$.a9;
var trim = kotlin_kotlin.$_$.vc;
var toString = kotlin_kotlin.$_$.t9;
var Companion_instance = kotlin_kotlin.$_$.t3;
var get = kotlin_kotlin.$_$.gb;
var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.r1;
var createFailure = kotlin_kotlin.$_$.be;
var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.t1;
var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.v1;
var substringBefore = kotlin_kotlin.$_$.bc;
var contains = kotlin_kotlin.$_$.za;
var to = kotlin_kotlin.$_$.ne;
var _Result___get_isSuccess__impl__sndoy8 = kotlin_kotlin.$_$.u1;
var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.s1;
var mapOf = kotlin_kotlin.$_$.m6;
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.s;
var joinToString = kotlin_kotlin.$_$.y5;
var initMetadataForObject = kotlin_kotlin.$_$.v8;
var hashCode = kotlin_kotlin.$_$.p8;
var equals = kotlin_kotlin.$_$.k8;
var Defaults_getInstance = kotlin_com_zegreatrob_tools_digger_core.$_$.a;
var initMetadataForCompanion = kotlin_kotlin.$_$.r8;
var toString_0 = kotlin_kotlin.$_$.me;
var emptyList = kotlin_kotlin.$_$.m5;
//endregion
//region block: pre-declaration
initMetadataForClass(SnapshotReason, 'SnapshotReason', VOID, Enum);
initMetadataForClass(SnapshotReason$DIRTY, 'DIRTY', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$AHEAD, 'AHEAD', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$BEHIND, 'BEHIND', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$NOT_RELEASE_BRANCH, 'NOT_RELEASE_BRANCH', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$NO_NEW_VERSION, 'NO_NEW_VERSION', VOID, SnapshotReason);
initMetadataForClass(ChangeType, 'ChangeType', VOID, Enum);
initMetadataForClass(ChangeType$Major, 'Major', VOID, ChangeType);
initMetadataForClass(ChangeType$Minor, 'Minor', VOID, ChangeType);
initMetadataForClass(ChangeType$Patch, 'Patch', VOID, ChangeType);
initMetadataForClass(ChangeType$None, 'None', VOID, ChangeType);
initMetadataForClass(StatusCheck, 'StatusCheck');
initMetadataForClass(FailureVersionReasons, 'FailureVersionReasons', VOID, Enum);
initMetadataForObject(TagErrors, 'TagErrors');
initMetadataForClass(TagResult, 'TagResult');
initMetadataForObject(Success, 'Success', VOID, TagResult);
initMetadataForClass(Error_0, 'Error', VOID, TagResult);
initMetadataForClass(TaggerCore, 'TaggerCore');
initMetadataForObject(Defaults, 'Defaults');
initMetadataForCompanion(Companion);
initMetadataForClass(VersionRegex, 'VersionRegex');
initMetadataForClass(Success_0, 'Success');
initMetadataForClass(Failure, 'Failure');
//endregion
function asSemverComponents(_this__u8e3s4) {
// Inline function 'kotlin.collections.map' call
var this_0 = split(stripPrefix(_this__u8e3s4), ['.']);
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.m();
while (_iterator__ex2g4s.n()) {
var item = _iterator__ex2g4s.o();
var tmp$ret$0 = toInt(item);
destination.e(tmp$ret$0);
}
// Inline function 'kotlin.let' call
return destination.p() === 3 ? destination : null;
}
function stripPrefix(_this__u8e3s4) {
var tmp$ret$1;
$l$block: {
// Inline function 'kotlin.text.indexOfFirst' call
var inductionVariable = 0;
var last = charSequenceLength(_this__u8e3s4) - 1 | 0;
if (inductionVariable <= last)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var it = charSequenceGet(_this__u8e3s4, index);
if (!(digitToIntOrNull(it) == null)) {
tmp$ret$1 = index;
break $l$block;
}
}
while (inductionVariable <= last);
tmp$ret$1 = -1;
}
var startIndex = tmp$ret$1;
return substring(_this__u8e3s4, startIndex);
}
function calculateNextVersion(_this__u8e3s4, implicitPatch, disableDetached, versionRegex, releaseBranch) {
var gitStatus = _this__u8e3s4.i17_1.s16();
var tmp;
if (disableDetached) {
// Inline function 'kotlin.text.isEmpty' call
var this_0 = gitStatus.y16_1;
tmp = charSequenceLength(this_0) === 0;
} else {
tmp = false;
}
if (tmp) {
return new Failure(listOf(FailureVersionReasons_NoRemote_getInstance()));
}
var tmp0_elvis_lhs = lastVersionAndTag(_this__u8e3s4);
var tmp_0;
if (tmp0_elvis_lhs == null) {
return new Failure(listOf(FailureVersionReasons_NoTagsExist_getInstance()));
} else {
tmp_0 = tmp0_elvis_lhs;
}
var _destruct__k2r9zo = tmp_0;
var previousVersionNumber = _destruct__k2r9zo.ra();
var lastTagDescription = _destruct__k2r9zo.sa();
var tmp1_elvis_lhs = asSemverComponents(previousVersionNumber);
var tmp_1;
if (tmp1_elvis_lhs == null) {
return new Failure(listOf(FailureVersionReasons_VersionMissingElements_getInstance()));
} else {
tmp_1 = tmp1_elvis_lhs;
}
var previousVersionComponents = tmp_1;
var incrementComponent = findAppropriateIncrement(_this__u8e3s4.i17_1, lastTagDescription, implicitPatch, versionRegex);
var tmp3_elvis_lhs = incrementComponent == null ? null : incrementComponent.m17(previousVersionComponents);
var currentVersionNumber = tmp3_elvis_lhs == null ? previousVersionNumber : tmp3_elvis_lhs;
var reasonsToUseSnapshot = snapshotReasons(releaseBranch, currentVersionNumber, previousVersionNumber, gitStatus);
return new Success_0(reasonsToUseSnapshot.j() ? currentVersionNumber : currentVersionNumber + '-SNAPSHOT', reasonsToUseSnapshot);
}
function SnapshotReason$DIRTY() {
SnapshotReason.call(this, 'DIRTY', 0);
SnapshotReason_DIRTY_instance = this;
}
protoOf(SnapshotReason$DIRTY).p17 = function (_this__u8e3s4) {
return !_this__u8e3s4.q17_1.u16_1;
};
var SnapshotReason_DIRTY_instance;
function SnapshotReason$AHEAD() {
SnapshotReason.call(this, 'AHEAD', 1);
SnapshotReason_AHEAD_instance = this;
}
protoOf(SnapshotReason$AHEAD).p17 = function (_this__u8e3s4) {
return !(_this__u8e3s4.q17_1.v16_1 === 0);
};
var SnapshotReason_AHEAD_instance;
function SnapshotReason$BEHIND() {
SnapshotReason.call(this, 'BEHIND', 2);
SnapshotReason_BEHIND_instance = this;
}
protoOf(SnapshotReason$BEHIND).p17 = function (_this__u8e3s4) {
return !(_this__u8e3s4.q17_1.w16_1 === 0);
};
var SnapshotReason_BEHIND_instance;
function SnapshotReason$NOT_RELEASE_BRANCH() {
SnapshotReason.call(this, 'NOT_RELEASE_BRANCH', 3);
SnapshotReason_NOT_RELEASE_BRANCH_instance = this;
}
protoOf(SnapshotReason$NOT_RELEASE_BRANCH).p17 = function (_this__u8e3s4) {
return !(_this__u8e3s4.q17_1.x16_1 === _this__u8e3s4.r17_1);
};
var SnapshotReason_NOT_RELEASE_BRANCH_instance;
function SnapshotReason$NO_NEW_VERSION() {
SnapshotReason.call(this, 'NO_NEW_VERSION', 4);
SnapshotReason_NO_NEW_VERSION_instance = this;
}
protoOf(SnapshotReason$NO_NEW_VERSION).p17 = function (_this__u8e3s4) {
return _this__u8e3s4.s17_1 === _this__u8e3s4.t17_1;
};
var SnapshotReason_NO_NEW_VERSION_instance;
function values() {
return [SnapshotReason_DIRTY_getInstance(), SnapshotReason_AHEAD_getInstance(), SnapshotReason_BEHIND_getInstance(), SnapshotReason_NOT_RELEASE_BRANCH_getInstance(), SnapshotReason_NO_NEW_VERSION_getInstance()];
}
function get_entries() {
if ($ENTRIES == null)
$ENTRIES = enumEntries(values());
return $ENTRIES;
}
var SnapshotReason_entriesInitialized;
function SnapshotReason_initEntries() {
if (SnapshotReason_entriesInitialized)
return Unit_instance;
SnapshotReason_entriesInitialized = true;
SnapshotReason_DIRTY_instance = new SnapshotReason$DIRTY();
SnapshotReason_AHEAD_instance = new SnapshotReason$AHEAD();
SnapshotReason_BEHIND_instance = new SnapshotReason$BEHIND();
SnapshotReason_NOT_RELEASE_BRANCH_instance = new SnapshotReason$NOT_RELEASE_BRANCH();
SnapshotReason_NO_NEW_VERSION_instance = new SnapshotReason$NO_NEW_VERSION();
}
var $ENTRIES;
function SnapshotReason(name, ordinal) {
Enum.call(this, name, ordinal);
}
protoOf(SnapshotReason).w17 = function (check) {
return this.p17(check);
};
function ChangeType$Major() {
ChangeType.call(this, 'Major', 0, 3);
ChangeType_Major_instance = this;
}
protoOf(ChangeType$Major).m17 = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.q(0);
return '' + (major + 1 | 0) + '.0.0';
};
var ChangeType_Major_instance;
function ChangeType$Minor() {
ChangeType.call(this, 'Minor', 1, 2);
ChangeType_Minor_instance = this;
}
protoOf(ChangeType$Minor).m17 = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.q(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.q(1);
return '' + major + '.' + (minor + 1 | 0) + '.0';
};
var ChangeType_Minor_instance;
function ChangeType$Patch() {
ChangeType.call(this, 'Patch', 2, 1);
ChangeType_Patch_instance = this;
}
protoOf(ChangeType$Patch).m17 = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.q(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.q(1);
// Inline function 'kotlin.collections.component3' call
var patch = components.q(2);
return '' + major + '.' + minor + '.' + (patch + 1 | 0);
};
var ChangeType_Patch_instance;
function ChangeType$None() {
ChangeType.call(this, 'None', 3, 0);
ChangeType_None_instance = this;
}
protoOf(ChangeType$None).m17 = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.q(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.q(1);
// Inline function 'kotlin.collections.component3' call
var patch = components.q(2);
return '' + major + '.' + minor + '.' + patch;
};
var ChangeType_None_instance;
var ChangeType_entriesInitialized;
function ChangeType_initEntries() {
if (ChangeType_entriesInitialized)
return Unit_instance;
ChangeType_entriesInitialized = true;
ChangeType_Major_instance = new ChangeType$Major();
ChangeType_Minor_instance = new ChangeType$Minor();
ChangeType_Patch_instance = new ChangeType$Patch();
ChangeType_None_instance = new ChangeType$None();
}
function ChangeType(name, ordinal, priority) {
Enum.call(this, name, ordinal);
this.l17_1 = priority;
}
function findAppropriateIncrement(gitAdapter, previousTag, implicitPatch, minorRegex) {
// Inline function 'kotlin.also' call
var this_0 = gitAdapter.r16('HEAD', '^' + previousTag);
if (this_0.j())
return null;
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.m();
while (_iterator__ex2g4s.n()) {
var item = _iterator__ex2g4s.o();
var tmp0_elvis_lhs = changeType(item, minorRegex);
var tmp$ret$2 = tmp0_elvis_lhs == null ? implicitPatch ? ChangeType_Patch_getInstance() : null : tmp0_elvis_lhs;
destination.e(tmp$ret$2);
}
// Inline function 'kotlin.collections.fold' call
var accumulator = null;
var _iterator__ex2g4s_0 = destination.m();
while (_iterator__ex2g4s_0.n()) {
var element = _iterator__ex2g4s_0.o();
var p0 = accumulator;
accumulator = highestPriority(p0, element);
}
var tmp0_elvis_lhs_0 = accumulator;
return tmp0_elvis_lhs_0 == null ? implicitPatch ? ChangeType_Patch_getInstance() : ChangeType_None_getInstance() : tmp0_elvis_lhs_0;
}
function snapshotReasons(releaseBranch, currentVersionNumber, previousVersionNumber, gitStatus) {
// Inline function 'kotlin.let' call
var statusCheck = new StatusCheck(gitStatus, releaseBranch, currentVersionNumber, previousVersionNumber);
// Inline function 'kotlin.collections.filter' call
var tmp0 = get_entries();
// Inline function 'kotlin.collections.filterTo' call
var destination = ArrayList_init_$Create$_0();
var _iterator__ex2g4s = tmp0.m();
while (_iterator__ex2g4s.n()) {
var element = _iterator__ex2g4s.o();
if (element.w17(statusCheck)) {
destination.e(element);
}
}
return destination;
}
function StatusCheck(gitStatus, releaseBranch, currentVersionNumber, previousVersionNumber) {
this.q17_1 = gitStatus;
this.r17_1 = releaseBranch;
this.s17_1 = currentVersionNumber;
this.t17_1 = previousVersionNumber;
}
protoOf(StatusCheck).toString = function () {
return 'StatusCheck(gitStatus=' + this.q17_1.toString() + ', releaseBranch=' + this.r17_1 + ', currentVersionNumber=' + this.s17_1 + ', previousVersionNumber=' + this.t17_1 + ')';
};
protoOf(StatusCheck).hashCode = function () {
var result = this.q17_1.hashCode();
result = imul(result, 31) + getStringHashCode(this.r17_1) | 0;
result = imul(result, 31) + getStringHashCode(this.s17_1) | 0;
result = imul(result, 31) + getStringHashCode(this.t17_1) | 0;
return result;
};
protoOf(StatusCheck).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof StatusCheck))
return false;
var tmp0_other_with_cast = other instanceof StatusCheck ? other : THROW_CCE();
if (!this.q17_1.equals(tmp0_other_with_cast.q17_1))
return false;
if (!(this.r17_1 === tmp0_other_with_cast.r17_1))
return false;
if (!(this.s17_1 === tmp0_other_with_cast.s17_1))
return false;
if (!(this.t17_1 === tmp0_other_with_cast.t17_1))
return false;
return true;
};
function changeType(_this__u8e3s4, versionRegex) {
// Inline function 'kotlin.text.trim' call
var this_0 = _this__u8e3s4.j16_1;
var tmp$ret$0 = toString(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
return changeType_0(versionRegex, tmp$ret$0);
}
function highestPriority(left, right) {
return left == null ? right : right == null ? left : left.l17_1 > right.l17_1 ? left : right;
}
function changeType_0(_this__u8e3s4, message) {
var tmp;
var tmp0_safe_receiver = _this__u8e3s4.v18_1;
if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.bd(message)) === true) {
tmp = findMatchType(message, _this__u8e3s4.v18_1);
} else {
if (_this__u8e3s4.u18_1.bd(message)) {
tmp = ChangeType_Major_getInstance();
} else {
if (_this__u8e3s4.t18_1.bd(message)) {
tmp = ChangeType_Minor_getInstance();
} else {
if (_this__u8e3s4.s18_1.bd(message)) {
tmp = ChangeType_Patch_getInstance();
} else {
if (_this__u8e3s4.r18_1.bd(message)) {
tmp = ChangeType_None_getInstance();
} else {
tmp = null;
}
}
}
}
}
return tmp;
}
function findMatchType(message, regex) {
var tmp0_safe_receiver = regex.fd(message);
var groups = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.nd();
return groupExists(groups, 'major') ? ChangeType_Major_getInstance() : groupExists(groups, 'minor') ? ChangeType_Minor_getInstance() : groupExists(groups, 'patch') ? ChangeType_Patch_getInstance() : groupExists(groups, 'none') ? ChangeType_None_getInstance() : null;
}
function groupExists(_this__u8e3s4, groupName) {
// Inline function 'kotlin.runCatching' call
var tmp;
try {
// Inline function 'kotlin.Companion.success' call
var value = !((_this__u8e3s4 == null ? null : get(_this__u8e3s4, groupName)) == null);
tmp = _Result___init__impl__xyqfz8(value);
} catch ($p) {
var tmp_0;
if ($p instanceof Error) {
var e = $p;
// Inline function 'kotlin.Companion.failure' call
tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
} else {
throw $p;
}
tmp = tmp_0;
}
var tmp0 = tmp;
var tmp$ret$4;
$l$block: {
// Inline function 'kotlin.getOrDefault' call
if (_Result___get_isFailure__impl__jpiriv(tmp0)) {
tmp$ret$4 = false;
break $l$block;
}
var tmp_1 = _Result___get_value__impl__bjfvqg(tmp0);
tmp$ret$4 = (tmp_1 == null ? true : !(tmp_1 == null)) ? tmp_1 : THROW_CCE();
}
return tmp$ret$4;
}
function SnapshotReason_DIRTY_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_DIRTY_instance;
}
function SnapshotReason_AHEAD_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_AHEAD_instance;
}
function SnapshotReason_BEHIND_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_BEHIND_instance;
}
function SnapshotReason_NOT_RELEASE_BRANCH_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_NOT_RELEASE_BRANCH_instance;
}
function SnapshotReason_NO_NEW_VERSION_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_NO_NEW_VERSION_instance;
}
function ChangeType_Major_getInstance() {
ChangeType_initEntries();
return ChangeType_Major_instance;
}
function ChangeType_Minor_getInstance() {
ChangeType_initEntries();
return ChangeType_Minor_instance;
}
function ChangeType_Patch_getInstance() {
ChangeType_initEntries();
return ChangeType_Patch_instance;
}
function ChangeType_None_getInstance() {
ChangeType_initEntries();
return ChangeType_None_instance;
}
var FailureVersionReasons_NoRemote_instance;
var FailureVersionReasons_NoTagsExist_instance;
var FailureVersionReasons_VersionMissingElements_instance;
var FailureVersionReasons_entriesInitialized;
function FailureVersionReasons_initEntries() {
if (FailureVersionReasons_entriesInitialized)
return Unit_instance;
FailureVersionReasons_entriesInitialized = true;
FailureVersionReasons_NoRemote_instance = new FailureVersionReasons('NoRemote', 0, 'repository has no remote.');
FailureVersionReasons_NoTagsExist_instance = new FailureVersionReasons('NoTagsExist', 1, 'repository has no tags.\nIf this is a new repository, use `tag` to set the initial version.');
FailureVersionReasons_VersionMissingElements_instance = new FailureVersionReasons('VersionMissingElements', 2, 'the most recent tag did not have all three semver components.');
}
function FailureVersionReasons(name, ordinal, message) {
Enum.call(this, name, ordinal);
this.y18_1 = message;
}
function FailureVersionReasons_NoRemote_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_NoRemote_instance;
}
function FailureVersionReasons_NoTagsExist_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_NoTagsExist_instance;
}
function FailureVersionReasons_VersionMissingElements_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_VersionMissingElements_instance;
}
function lastVersionAndTag(_this__u8e3s4) {
var tmp0_elvis_lhs = _this__u8e3s4.i17_1.t16(0);
var tmp;
if (tmp0_elvis_lhs == null) {
return null;
} else {
tmp = tmp0_elvis_lhs;
}
var description = tmp;
var tmp_0;
if (contains(description, '-')) {
tmp_0 = substringBefore(description, '-');
} else {
tmp_0 = description;
}
var previousVersionNumber = tmp_0;
// Inline function 'kotlin.text.ifEmpty' call
var tmp_1;
// Inline function 'kotlin.text.isEmpty' call
if (charSequenceLength(previousVersionNumber) === 0) {
tmp_1 = null;
} else {
tmp_1 = previousVersionNumber;
}
var tmp1_safe_receiver = tmp_1;
var tmp_2;
if (tmp1_safe_receiver == null) {
tmp_2 = null;
} else {
// Inline function 'kotlin.let' call
tmp_2 = to(tmp1_safe_receiver, description);
}
return tmp_2;
}
function tag(_this__u8e3s4, version, releaseBranch, userName, userEmail) {
var isSnapshot_0 = isSnapshot(version);
var headTag = _this__u8e3s4.i17_1.q16('HEAD');
var alreadyTagged = !(headTag == null);
var headBranch = _this__u8e3s4.i17_1.s16().x16_1;
var isNotOnReleaseBranch = !(headBranch === releaseBranch);
var tmp;
if (isSnapshot_0 || alreadyTagged || isNotOnReleaseBranch) {
var tmp_0 = TagErrors_instance;
var tmp_1 = to(isSnapshot_0, 'being snapshot');
var tmp_2 = TagErrors_instance;
// Inline function 'kotlin.collections.filterKeys' call
var this_0 = mapOf([tmp_1, to(alreadyTagged, tmp_2.a19(headTag == null ? null : headTag.z16_1)), to(isNotOnReleaseBranch, TagErrors_instance.b19(releaseBranch, headBranch))]);
var result = LinkedHashMap_init_$Create$();
// Inline function 'kotlin.collections.iterator' call
var _iterator__ex2g4s = this_0.x().m();
while (_iterator__ex2g4s.n()) {
var entry = _iterator__ex2g4s.o();
if (entry.y()) {
result.l2(entry.y(), entry.z());
}
}
tmp = new Error_0(tmp_0.c19(joinToString(result.f2(), ', ')));
} else {
// Inline function 'kotlin.runCatching' call
var tmp_3;
try {
_this__u8e3s4.i17_1.o16(version, 'HEAD', userName, userEmail);
// Inline function 'kotlin.Companion.success' call
tmp_3 = _Result___init__impl__xyqfz8(Unit_instance);
} catch ($p) {
var tmp_4;
if ($p instanceof Error) {
var e = $p;
// Inline function 'kotlin.Companion.failure' call
tmp_4 = _Result___init__impl__xyqfz8(createFailure(e));
} else {
throw $p;
}
tmp_3 = tmp_4;
}
// Inline function 'kotlin.map' call
var this_1 = tmp_3;
var tmp_5;
if (_Result___get_isSuccess__impl__sndoy8(this_1)) {
var tmp_6 = _Result___get_value__impl__bjfvqg(this_1);
if (!(tmp_6 == null ? true : !(tmp_6 == null)))
THROW_CCE();
_this__u8e3s4.i17_1.p16();
// Inline function 'kotlin.Companion.success' call
var value = Success_getInstance();
tmp_5 = _Result___init__impl__xyqfz8(value);
} else {
tmp_5 = _Result___init__impl__xyqfz8(_Result___get_value__impl__bjfvqg(this_1));
}
// Inline function 'kotlin.getOrElse' call
var this_2 = tmp_5;
var exception = Result__exceptionOrNull_impl_p6xea9(this_2);
var tmp_7;
if (exception == null) {
var tmp_8 = _Result___get_value__impl__bjfvqg(this_2);
tmp_7 = (tmp_8 == null ? true : !(tmp_8 == null)) ? tmp_8 : THROW_CCE();
} else {
var tmp0_elvis_lhs = exception.message;
tmp_7 = new Error_0(tmp0_elvis_lhs == null ? 'Unknown error during tagging' : tmp0_elvis_lhs);
}
tmp = tmp_7;
}
return tmp;
}
function isSnapshot(_this__u8e3s4) {
return contains(_this__u8e3s4, 'SNAPSHOT');
}
function TagErrors() {
this.z18_1 = 'being snapshot';
}
protoOf(TagErrors).c19 = function (messages) {
return 'skipping tag due to ' + messages;
};
protoOf(TagErrors).a19 = function (headTag) {
return 'already tagged ' + headTag;
};
protoOf(TagErrors).b19 = function (releaseBranch, headBranch) {
return 'not on release branch ' + releaseBranch + ' - branch was ' + headBranch;
};
var TagErrors_instance;
function TagErrors_getInstance() {
return TagErrors_instance;
}
function Success() {
Success_instance = this;
TagResult.call(this);
}
protoOf(Success).toString = function () {
return 'Success';
};
protoOf(Success).hashCode = function () {
return -888110432;
};
protoOf(Success).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Success))
return false;
other instanceof Success || THROW_CCE();
return true;
};
var Success_instance;
function Success_getInstance() {
if (Success_instance == null)
new Success();
return Success_instance;
}
function Error_0(message) {
TagResult.call(this);
this.d19_1 = message;
}
protoOf(Error_0).toString = function () {
return 'Error(message=' + this.d19_1 + ')';
};
protoOf(Error_0).hashCode = function () {
return getStringHashCode(this.d19_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 (!(this.d19_1 === tmp0_other_with_cast.d19_1))
return false;
return true;
};
function TagResult() {
}
function TaggerCore(adapter) {
this.i17_1 = adapter;
}
protoOf(TaggerCore).toString = function () {
return 'TaggerCore(adapter=' + toString(this.i17_1) + ')';
};
protoOf(TaggerCore).hashCode = function () {
return hashCode(this.i17_1);
};
protoOf(TaggerCore).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof TaggerCore))
return false;
var tmp0_other_with_cast = other instanceof TaggerCore ? other : THROW_CCE();
if (!equals(this.i17_1, tmp0_other_with_cast.i17_1))
return false;
return true;
};
function Defaults() {
Defaults_instance = this;
this.e19_1 = Defaults_getInstance().f17_1;
this.f19_1 = Defaults_getInstance().e17_1;
this.g19_1 = Defaults_getInstance().d17_1;
this.h19_1 = Defaults_getInstance().c17_1;
}
var Defaults_instance;
function Defaults_getInstance_0() {
if (Defaults_instance == null)
new Defaults();
return Defaults_instance;
}
function Companion() {
this.i19_1 = "version regex must include groups named 'major', 'minor', 'patch', and 'none'.";
}
protoOf(Companion).j19 = function (regexPattern) {
return contains(regexPattern, '?<major>') && contains(regexPattern, '?<minor>') && contains(regexPattern, '?<patch>') && contains(regexPattern, '?<none>');
};
var Companion_instance_0;
function Companion_getInstance() {
return Companion_instance_0;
}
function VersionRegex(none, patch, minor, major, unified) {
this.r18_1 = none;
this.s18_1 = patch;
this.t18_1 = minor;
this.u18_1 = major;
this.v18_1 = unified;
}
protoOf(VersionRegex).toString = function () {
return 'VersionRegex(none=' + this.r18_1.toString() + ', patch=' + this.s18_1.toString() + ', minor=' + this.t18_1.toString() + ', major=' + this.u18_1.toString() + ', unified=' + toString_0(this.v18_1) + ')';
};
protoOf(VersionRegex).hashCode = function () {
var result = hashCode(this.r18_1);
result = imul(result, 31) + hashCode(this.s18_1) | 0;
result = imul(result, 31) + hashCode(this.t18_1) | 0;
result = imul(result, 31) + hashCode(this.u18_1) | 0;
result = imul(result, 31) + (this.v18_1 == null ? 0 : hashCode(this.v18_1)) | 0;
return result;
};
protoOf(VersionRegex).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof VersionRegex))
return false;
var tmp0_other_with_cast = other instanceof VersionRegex ? other : THROW_CCE();
if (!equals(this.r18_1, tmp0_other_with_cast.r18_1))
return false;
if (!equals(this.s18_1, tmp0_other_with_cast.s18_1))
return false;
if (!equals(this.t18_1, tmp0_other_with_cast.t18_1))
return false;
if (!equals(this.u18_1, tmp0_other_with_cast.u18_1))
return false;
if (!equals(this.v18_1, tmp0_other_with_cast.v18_1))
return false;
return true;
};
function VersionResult$Failure$_get_message_$lambda_nuugae(it) {
return it.y18_1;
}
function Success_0(version, snapshotReasons) {
snapshotReasons = snapshotReasons === VOID ? emptyList() : snapshotReasons;
this.k19_1 = version;
this.l19_1 = snapshotReasons;
}
protoOf(Success_0).toString = function () {
return 'Success(version=' + this.k19_1 + ', snapshotReasons=' + toString(this.l19_1) + ')';
};
protoOf(Success_0).hashCode = function () {
var result = getStringHashCode(this.k19_1);
result = imul(result, 31) + hashCode(this.l19_1) | 0;
return result;
};
protoOf(Success_0).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Success_0))
return false;
var tmp0_other_with_cast = other instanceof Success_0 ? other : THROW_CCE();
if (!(this.k19_1 === tmp0_other_with_cast.k19_1))
return false;
if (!equals(this.l19_1, tmp0_other_with_cast.l19_1))
return false;
return true;
};
function Failure(reasons) {
this.m19_1 = reasons;
}
protoOf(Failure).na = function () {
return 'Inappropriate configuration: ' + joinToString(this.m19_1, '\n', VOID, VOID, VOID, VOID, VersionResult$Failure$_get_message_$lambda_nuugae);
};
protoOf(Failure).toString = function () {
return 'Failure(reasons=' + toString(this.m19_1) + ')';
};
protoOf(Failure).hashCode = function () {
return hashCode(this.m19_1);
};
protoOf(Failure).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Failure))
return false;
var tmp0_other_with_cast = other instanceof Failure ? other : THROW_CCE();
if (!equals(this.m19_1, tmp0_other_with_cast.m19_1))
return false;
return true;
};
//region block: init
TagErrors_instance = new TagErrors();
Companion_instance_0 = new Companion();
//endregion
//region block: exports
_.$_$ = _.$_$ || {};
_.$_$.a = Error_0;
_.$_$.b = TaggerCore;
_.$_$.c = VersionRegex;
_.$_$.d = Failure;
_.$_$.e = Success_0;
_.$_$.f = calculateNextVersion;
_.$_$.g = tag;
_.$_$.h = Success_getInstance;
_.$_$.i = Companion_instance_0;
_.$_$.j = Defaults_getInstance_0;
//endregion
return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./tools-digger-core.js')));
//# sourceMappingURL=tools-tagger-core.js.map