git-digger
Version:
 
631 lines (629 loc) • 26.3 kB
JavaScript
(function (_, kotlin_kotlin, kotlin_com_zegreatrob_tools_digger_model) {
'use strict';
//region block: imports
var imul = Math.imul;
var HashSet_init_$Create$ = kotlin_kotlin.$_$.p;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
var Unit_instance = kotlin_kotlin.$_$.j3;
var collectionSizeOrDefault = kotlin_kotlin.$_$.g4;
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.k;
var to = kotlin_kotlin.$_$.xc;
var firstOrNull = kotlin_kotlin.$_$.r4;
var Pair = kotlin_kotlin.$_$.wb;
var listOf = kotlin_kotlin.$_$.i5;
var checkIndexOverflow = kotlin_kotlin.$_$.f4;
var getOrNull = kotlin_kotlin.$_$.v4;
var plus = kotlin_kotlin.$_$.t5;
var emptyList = kotlin_kotlin.$_$.o4;
var plus_0 = kotlin_kotlin.$_$.u5;
var last = kotlin_kotlin.$_$.f5;
var toString = kotlin_kotlin.$_$.u8;
var toString_0 = kotlin_kotlin.$_$.wc;
var protoOf = kotlin_kotlin.$_$.r8;
var getStringHashCode = kotlin_kotlin.$_$.q7;
var hashCode = kotlin_kotlin.$_$.r7;
var THROW_CCE = kotlin_kotlin.$_$.zb;
var equals = kotlin_kotlin.$_$.m7;
var initMetadataForClass = kotlin_kotlin.$_$.s7;
var lastOrNull = kotlin_kotlin.$_$.e5;
var maxOrNull = kotlin_kotlin.$_$.m5;
var Contribution = kotlin_com_zegreatrob_tools_digger_model.$_$.a;
var listOf_0 = kotlin_kotlin.$_$.j5;
var addAll = kotlin_kotlin.$_$.x3;
var toSet = kotlin_kotlin.$_$.q6;
var sorted = kotlin_kotlin.$_$.e6;
var toList = kotlin_kotlin.$_$.l6;
var joinToString = kotlin_kotlin.$_$.z4;
var Regex_init_$Create$ = kotlin_kotlin.$_$.t;
var initMetadataForObject = kotlin_kotlin.$_$.x7;
var VOID = kotlin_kotlin.$_$.g;
var take = kotlin_kotlin.$_$.h6;
var RegexOption_IGNORE_CASE_getInstance = kotlin_kotlin.$_$.h;
var Regex_init_$Create$_0 = kotlin_kotlin.$_$.u;
var RuntimeException_init_$Create$ = kotlin_kotlin.$_$.m1;
var contains = kotlin_kotlin.$_$.ba;
var mapOf = kotlin_kotlin.$_$.l5;
var RegexOption_MULTILINE_getInstance = kotlin_kotlin.$_$.i;
var setOf = kotlin_kotlin.$_$.z5;
var Regex = kotlin_kotlin.$_$.y9;
var firstOrNull_0 = kotlin_kotlin.$_$.fa;
var lastIndexOf = kotlin_kotlin.$_$.na;
var Char = kotlin_kotlin.$_$.nb;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.q1;
var mapNotNull = kotlin_kotlin.$_$.s9;
var toList_0 = kotlin_kotlin.$_$.x9;
var maxOrNull_0 = kotlin_kotlin.$_$.u9;
var get = kotlin_kotlin.$_$.ha;
var toIntOrNull = kotlin_kotlin.$_$.db;
var Companion_instance = kotlin_kotlin.$_$.e3;
var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.u1;
var createFailure = kotlin_kotlin.$_$.nc;
var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.x1;
var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.v1;
var Enum = kotlin_kotlin.$_$.rb;
//endregion
//region block: pre-declaration
initMetadataForClass(CommitInspectionResult, 'CommitInspectionResult');
initMetadataForObject(Defaults, 'Defaults');
initMetadataForClass(DiggerCore, 'DiggerCore');
initMetadataForClass(MessageDigResult, 'MessageDigResult');
initMetadataForObject(Defaults_0, 'Defaults');
initMetadataForClass(MessageDigger, 'MessageDigger', MessageDigger);
initMetadataForClass(SemverType, 'SemverType', VOID, Enum);
//endregion
function allContributionCommits(_this__u8e3s4, tagRefs, fullLog) {
// Inline function 'kotlin.collections.distinctBy' call
var set = HashSet_init_$Create$();
var list = ArrayList_init_$Create$();
var _iterator__ex2g4s = tagRefs.p();
while (_iterator__ex2g4s.q()) {
var e = _iterator__ex2g4s.r();
var key = e.c1c_1;
if (set.e(key)) {
list.e(e);
}
}
// Inline function 'kotlin.collections.filter' call
// Inline function 'kotlin.collections.filterTo' call
var destination = ArrayList_init_$Create$();
var _iterator__ex2g4s_0 = list.p();
while (_iterator__ex2g4s_0.q()) {
var element = _iterator__ex2g4s_0.r();
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(fullLog, 10));
var _iterator__ex2g4s_1 = fullLog.p();
while (_iterator__ex2g4s_1.q()) {
var item = _iterator__ex2g4s_1.r();
var tmp$ret$2 = item.m1b_1;
destination_0.e(tmp$ret$2);
}
if (destination_0.d1(element.c1c_1)) {
destination.e(element);
}
}
return sortIntoTagSets(_this__u8e3s4, destination, fullLog);
}
function sortIntoTagSets(_this__u8e3s4, tagRefs, log) {
// Inline function 'kotlin.collections.map' call
var this_0 = tagPairs(tagRefs);
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var earlierTag = item.w9();
var nextTag = item.x9();
var tmp;
if (earlierTag == null && !(nextTag == null)) {
tmp = _this__u8e3s4.z1b('^' + nextTag.c1c_1, 'HEAD');
} else if (!(earlierTag == null) && !(nextTag == null)) {
tmp = _this__u8e3s4.z1b('^' + nextTag.c1c_1, earlierTag.c1c_1);
} else if (!(earlierTag == null)) {
tmp = _this__u8e3s4.a1c(earlierTag.c1c_1);
} else {
tmp = alwaysLeftParent(log);
}
var tmp$ret$0 = to(earlierTag, tmp);
destination.e(tmp$ret$0);
}
// Inline function 'kotlin.collections.filter' call
// Inline function 'kotlin.collections.filterTo' call
var destination_0 = ArrayList_init_$Create$();
var _iterator__ex2g4s_0 = destination.p();
while (_iterator__ex2g4s_0.q()) {
var element = _iterator__ex2g4s_0.r();
// Inline function 'kotlin.collections.isNotEmpty' call
if (!element.v9_1.m()) {
destination_0.e(element);
}
}
return destination_0;
}
function tagPairs(_this__u8e3s4) {
var tmp = listOf(new Pair(null, firstOrNull(_this__u8e3s4)));
// Inline function 'kotlin.collections.mapIndexed' call
// Inline function 'kotlin.collections.mapIndexedTo' call
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(_this__u8e3s4, 10));
var index = 0;
var _iterator__ex2g4s = _this__u8e3s4.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var _unary__edvuaz = index;
index = _unary__edvuaz + 1 | 0;
var index_0 = checkIndexOverflow(_unary__edvuaz);
var tmp$ret$0 = to(item, getOrNull(_this__u8e3s4, index_0 + 1 | 0));
destination.e(tmp$ret$0);
}
return plus(tmp, destination);
}
function alwaysLeftParent(_this__u8e3s4) {
// Inline function 'kotlin.collections.fold' call
var accumulator = emptyList();
var _iterator__ex2g4s = _this__u8e3s4.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
var acc = accumulator;
var tmp;
if (acc.m()) {
tmp = plus_0(acc, element);
} else if (element.m1b_1 === firstOrNull(last(acc).q1b_1)) {
tmp = plus_0(acc, element);
} else {
tmp = acc;
}
accumulator = tmp;
}
return accumulator;
}
function CommitInspectionResult(storyId, ease, authors, semver) {
this.e1c_1 = storyId;
this.f1c_1 = ease;
this.g1c_1 = authors;
this.h1c_1 = semver;
}
protoOf(CommitInspectionResult).toString = function () {
return 'CommitInspectionResult(storyId=' + this.e1c_1 + ', ease=' + this.f1c_1 + ', authors=' + toString(this.g1c_1) + ', semver=' + toString_0(this.h1c_1) + ')';
};
protoOf(CommitInspectionResult).hashCode = function () {
var result = this.e1c_1 == null ? 0 : getStringHashCode(this.e1c_1);
result = imul(result, 31) + (this.f1c_1 == null ? 0 : this.f1c_1) | 0;
result = imul(result, 31) + hashCode(this.g1c_1) | 0;
result = imul(result, 31) + (this.h1c_1 == null ? 0 : this.h1c_1.hashCode()) | 0;
return result;
};
protoOf(CommitInspectionResult).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof CommitInspectionResult))
return false;
var tmp0_other_with_cast = other instanceof CommitInspectionResult ? other : THROW_CCE();
if (!(this.e1c_1 == tmp0_other_with_cast.e1c_1))
return false;
if (!(this.f1c_1 == tmp0_other_with_cast.f1c_1))
return false;
if (!equals(this.g1c_1, tmp0_other_with_cast.g1c_1))
return false;
if (!equals(this.h1c_1, tmp0_other_with_cast.h1c_1))
return false;
return true;
};
function contribution(_this__u8e3s4, commitRefs) {
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(commitRefs, 10));
var _iterator__ex2g4s = commitRefs.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var tmp$ret$0 = commitInspectionResult(item, _this__u8e3s4.o1c(item.r1b_1));
destination.e(tmp$ret$0);
}
var messageDigResults = destination;
var lastCommit = firstOrNull(commitRefs);
var firstCommit = lastOrNull(commitRefs);
var tmp1_elvis_lhs = lastCommit == null ? null : lastCommit.m1b_1;
var tmp7_lastCommit = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
var tmp3_elvis_lhs = firstCommit == null ? null : firstCommit.m1b_1;
var tmp8_firstCommit = tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs;
var tmp9_authors = allAuthors(messageDigResults);
var tmp10_dateTime = lastCommit == null ? null : lastCommit.p1b_1;
var tmp11_firstCommitDateTime = firstCommit == null ? null : firstCommit.p1b_1;
// Inline function 'kotlin.collections.mapNotNull' call
// Inline function 'kotlin.collections.mapNotNullTo' call
var destination_0 = ArrayList_init_$Create$();
// Inline function 'kotlin.collections.forEach' call
var _iterator__ex2g4s_0 = messageDigResults.p();
while (_iterator__ex2g4s_0.q()) {
var element = _iterator__ex2g4s_0.r();
var tmp0_safe_receiver = element.f1c_1;
if (tmp0_safe_receiver == null)
null;
else {
// Inline function 'kotlin.let' call
destination_0.e(tmp0_safe_receiver);
}
}
var tmp12_ease = maxOrNull(destination_0);
var tmp13_storyId = mergedStoryIds(messageDigResults);
// Inline function 'kotlin.collections.mapNotNull' call
// Inline function 'kotlin.collections.mapNotNullTo' call
var destination_1 = ArrayList_init_$Create$();
// Inline function 'kotlin.collections.forEach' call
var _iterator__ex2g4s_1 = messageDigResults.p();
while (_iterator__ex2g4s_1.q()) {
var element_0 = _iterator__ex2g4s_1.r();
var tmp0_safe_receiver_0 = element_0.h1c_1;
if (tmp0_safe_receiver_0 == null)
null;
else {
// Inline function 'kotlin.let' call
destination_1.e(tmp0_safe_receiver_0);
}
}
var tmp6_safe_receiver = highestPrioritySemver(destination_1);
var tmp14_semver = tmp6_safe_receiver == null ? null : tmp6_safe_receiver.toString();
// Inline function 'kotlin.collections.count' call
var tmp15_commitCount = commitRefs.s();
return new Contribution(tmp7_lastCommit, tmp8_firstCommit, tmp9_authors, tmp15_commitCount, tmp10_dateTime, tmp11_firstCommitDateTime, tmp12_ease, tmp13_storyId, tmp14_semver, null, null, null);
}
function commitInspectionResult(_this__u8e3s4, digResult) {
return new CommitInspectionResult(digResult.p1c_1, digResult.q1c_1, plus(listOf_0([_this__u8e3s4.o1b_1, _this__u8e3s4.n1b_1]), digResult.r1c_1), digResult.s1c_1);
}
function allAuthors(messageDigResults) {
// Inline function 'kotlin.collections.flatMap' call
// Inline function 'kotlin.collections.flatMapTo' call
var destination = ArrayList_init_$Create$();
var _iterator__ex2g4s = messageDigResults.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
var list = element.g1c_1;
addAll(destination, list);
}
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
var _iterator__ex2g4s_0 = destination.p();
while (_iterator__ex2g4s_0.q()) {
var item = _iterator__ex2g4s_0.r();
// Inline function 'kotlin.text.lowercase' call
// Inline function 'kotlin.js.asDynamic' call
var tmp$ret$5 = item.toLowerCase();
destination_0.e(tmp$ret$5);
}
return toList(sorted(toSet(destination_0)));
}
function mergedStoryIds(messageDigResults) {
// Inline function 'kotlin.collections.mapNotNull' call
// Inline function 'kotlin.collections.mapNotNullTo' call
var destination = ArrayList_init_$Create$();
// Inline function 'kotlin.collections.forEach' call
var _iterator__ex2g4s = messageDigResults.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
var tmp0_safe_receiver = element.e1c_1;
if (tmp0_safe_receiver == null)
null;
else {
// Inline function 'kotlin.let' call
destination.e(tmp0_safe_receiver);
}
}
// Inline function 'kotlin.let' call
var tmp;
// Inline function 'kotlin.collections.isNotEmpty' call
if (!destination.m()) {
tmp = joinToString(sorted(toSet(destination)), ', ');
} else {
tmp = null;
}
return tmp;
}
function currentContributionCommits(_this__u8e3s4, previousTag) {
var tmp;
if (previousTag == null) {
tmp = _this__u8e3s4.y1b();
} else {
tmp = _this__u8e3s4.z1b('^' + previousTag.b1c_1, 'HEAD');
}
return tmp;
}
function tagRefs($this) {
// Inline function 'kotlin.collections.filter' call
var tmp0 = $this.u1c_1.x1b();
// Inline function 'kotlin.collections.filterTo' call
var destination = ArrayList_init_$Create$();
var _iterator__ex2g4s = tmp0.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
if ($this.w1c_1.ec(element.b1c_1)) {
destination.e(element);
}
}
return destination;
}
function currentRelevantTags($this, headCommitId, lastTwoTags) {
// Inline function 'kotlin.let' call
var latestTag = getOrNull(lastTwoTags, 0);
var tmp;
if ((latestTag == null ? null : latestTag.c1c_1) === headCommitId) {
tmp = to(latestTag, getOrNull(lastTwoTags, 1));
} else {
tmp = to(null, latestTag);
}
return tmp;
}
function Defaults() {
Defaults_instance = this;
this.x1c_1 = Regex_init_$Create$('.*');
}
var Defaults_instance;
function Defaults_getInstance() {
if (Defaults_instance == null)
new Defaults();
return Defaults_instance;
}
function DiggerCore(label, gitWrapper, messageDigger, tagRegex) {
tagRegex = tagRegex === VOID ? Defaults_getInstance().x1c_1 : tagRegex;
this.t1c_1 = label;
this.u1c_1 = gitWrapper;
this.v1c_1 = messageDigger;
this.w1c_1 = tagRegex;
}
protoOf(DiggerCore).y1c = function () {
// Inline function 'kotlin.with' call
var $this$with = this.u1c_1;
var _destruct__k2r9zo = currentRelevantTags(this, $this$with.w1b(), take(tagRefs(this), 2));
var currentTag = _destruct__k2r9zo.w9();
var previousTag = _destruct__k2r9zo.x9();
var tmp = contribution(this.v1c_1, currentContributionCommits($this$with, previousTag));
var tmp_0 = currentTag == null ? null : currentTag.b1c_1;
return tmp.l1b(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, this.t1c_1, tmp_0, currentTag == null ? null : currentTag.d1c_1);
};
protoOf(DiggerCore).z1c = function () {
// Inline function 'kotlin.collections.map' call
var this_0 = allContributionCommits(this.u1c_1, tagRefs(this), this.u1c_1.y1b());
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var tmp$ret$0 = to(item.u9_1, contribution(this.v1c_1, toList(item.v9_1)));
destination.e(tmp$ret$0);
}
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
var _iterator__ex2g4s_0 = destination.p();
while (_iterator__ex2g4s_0.q()) {
var item_0 = _iterator__ex2g4s_0.r();
var tag = item_0.w9();
var contribution_0 = item_0.x9();
var tmp = tag == null ? null : tag.b1c_1;
var tmp$ret$3 = contribution_0.l1b(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, this.t1c_1, tmp, tag == null ? null : tag.d1c_1);
destination_0.e(tmp$ret$3);
}
return destination_0;
};
function MessageDigResult(storyId, ease, coauthors, semver) {
this.p1c_1 = storyId;
this.q1c_1 = ease;
this.r1c_1 = coauthors;
this.s1c_1 = semver;
}
protoOf(MessageDigResult).toString = function () {
return 'MessageDigResult(storyId=' + this.p1c_1 + ', ease=' + this.q1c_1 + ', coauthors=' + toString(this.r1c_1) + ', semver=' + toString_0(this.s1c_1) + ')';
};
protoOf(MessageDigResult).hashCode = function () {
var result = this.p1c_1 == null ? 0 : getStringHashCode(this.p1c_1);
result = imul(result, 31) + (this.q1c_1 == null ? 0 : this.q1c_1) | 0;
result = imul(result, 31) + hashCode(this.r1c_1) | 0;
result = imul(result, 31) + (this.s1c_1 == null ? 0 : this.s1c_1.hashCode()) | 0;
return result;
};
protoOf(MessageDigResult).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof MessageDigResult))
return false;
var tmp0_other_with_cast = other instanceof MessageDigResult ? other : THROW_CCE();
if (!(this.p1c_1 == tmp0_other_with_cast.p1c_1))
return false;
if (!(this.q1c_1 == tmp0_other_with_cast.q1c_1))
return false;
if (!equals(this.r1c_1, tmp0_other_with_cast.r1c_1))
return false;
if (!equals(this.s1c_1, tmp0_other_with_cast.s1c_1))
return false;
return true;
};
function Defaults_0() {
Defaults_instance_0 = this;
this.a1d_1 = Regex_init_$Create$_0('\\[major\\]', RegexOption_IGNORE_CASE_getInstance());
this.b1d_1 = Regex_init_$Create$_0('\\[minor\\]', RegexOption_IGNORE_CASE_getInstance());
this.c1d_1 = Regex_init_$Create$_0('\\[patch\\]', RegexOption_IGNORE_CASE_getInstance());
this.d1d_1 = Regex_init_$Create$_0('\\[none\\]', RegexOption_IGNORE_CASE_getInstance());
this.e1d_1 = Regex_init_$Create$('\\[(?<storyId>.*?)\\]');
this.f1d_1 = Regex_init_$Create$('-(?<ease>[1-5])-');
}
var Defaults_instance_0;
function Defaults_getInstance_0() {
if (Defaults_instance_0 == null)
new Defaults_0();
return Defaults_instance_0;
}
function MessageDigger(majorRegex, minorRegex, patchRegex, noneRegex, storyIdRegex, easeRegex) {
majorRegex = majorRegex === VOID ? Defaults_getInstance_0().a1d_1 : majorRegex;
minorRegex = minorRegex === VOID ? Defaults_getInstance_0().b1d_1 : minorRegex;
patchRegex = patchRegex === VOID ? Defaults_getInstance_0().c1d_1 : patchRegex;
noneRegex = noneRegex === VOID ? Defaults_getInstance_0().d1d_1 : noneRegex;
storyIdRegex = storyIdRegex === VOID ? Defaults_getInstance_0().e1d_1 : storyIdRegex;
easeRegex = easeRegex === VOID ? Defaults_getInstance_0().f1d_1 : easeRegex;
if (!contains(storyIdRegex.yb_1, '?<storyId>')) {
throw RuntimeException_init_$Create$('StoryIdRegex must include a storyId group. The regex was: ' + storyIdRegex.yb_1);
}
if (!contains(easeRegex.yb_1, '?<ease>')) {
throw RuntimeException_init_$Create$('EaseRegex must include an ease group. The regex was: ' + easeRegex.yb_1);
}
this.i1c_1 = mapOf([to('major', majorRegex), to('minor', minorRegex), to('patch', patchRegex), to('none', noneRegex)]);
var tmp = this;
// Inline function 'kotlin.collections.map' call
var this_0 = this.i1c_1;
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$_0(this_0.s());
// Inline function 'kotlin.collections.iterator' call
var _iterator__ex2g4s = this_0.x().p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
// Inline function 'kotlin.collections.component1' call
var group = item.y();
// Inline function 'kotlin.collections.component2' call
var regex = item.z();
var tmp$ret$3 = '(?<' + group + '>' + cleaned(regex) + ')?';
destination.e(tmp$ret$3);
}
tmp.j1c_1 = joinToString(destination, '');
this.k1c_1 = '(' + cleaned(storyIdRegex) + ')?';
this.l1c_1 = '(' + cleaned(easeRegex) + ')?';
this.m1c_1 = '(Co-authored-by: .* <(?<coAuthors>.*)>)?';
this.n1c_1 = new Regex(this.j1c_1 + this.k1c_1 + this.l1c_1 + this.m1c_1, setOf([RegexOption_IGNORE_CASE_getInstance(), RegexOption_MULTILINE_getInstance()]));
}
protoOf(MessageDigger).o1c = function (input) {
return messageDigResult(this.n1c_1.hc(input));
};
function cleaned(_this__u8e3s4) {
var first = firstOrNull_0(_this__u8e3s4.yb_1);
var last = lastIndexOf(_this__u8e3s4.yb_1, '/');
var tmp;
var tmp_0 = first;
if (equals(tmp_0 == null ? null : new Char(tmp_0), new Char(_Char___init__impl__6a9atx(47)))) {
// Inline function 'kotlin.text.substring' call
// Inline function 'kotlin.js.asDynamic' call
tmp = _this__u8e3s4.yb_1.substring(1, last);
} else {
tmp = _this__u8e3s4.yb_1;
}
return tmp;
}
function messageDigResult(_this__u8e3s4) {
var tmp3_coauthors = toList_0(mapNotNull(_this__u8e3s4, messageDigResult$lambda));
var tmp4_semver = maxOrNull_0(mapNotNull(_this__u8e3s4, messageDigResult$lambda_0));
var tmp$ret$1;
$l$block: {
// Inline function 'kotlin.sequences.firstNotNullOfOrNull' call
var _iterator__ex2g4s = _this__u8e3s4.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
var result = get(element.pc(), 'storyId');
if (!(result == null)) {
tmp$ret$1 = result;
break $l$block;
}
}
tmp$ret$1 = null;
}
var tmp0_safe_receiver = tmp$ret$1;
var tmp5_storyId = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.lc_1;
var tmp$ret$3;
$l$block_0: {
// Inline function 'kotlin.sequences.firstNotNullOfOrNull' call
var _iterator__ex2g4s_0 = _this__u8e3s4.p();
while (_iterator__ex2g4s_0.q()) {
var element_0 = _iterator__ex2g4s_0.r();
var result_0 = get(element_0.pc(), 'ease');
if (!(result_0 == null)) {
tmp$ret$3 = result_0;
break $l$block_0;
}
}
tmp$ret$3 = null;
}
var tmp1_safe_receiver = tmp$ret$3;
var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.lc_1;
var tmp6_ease = tmp2_safe_receiver == null ? null : toIntOrNull(tmp2_safe_receiver);
return new MessageDigResult(tmp5_storyId, tmp6_ease, tmp3_coauthors, tmp4_semver);
}
function getSemver(it) {
return groupMatches(it, 'major') ? SemverType_Major_getInstance() : groupMatches(it, 'minor') ? SemverType_Minor_getInstance() : groupMatches(it, 'patch') ? SemverType_Patch_getInstance() : groupMatches(it, 'none') ? SemverType_None_getInstance() : null;
}
function groupMatches(_this__u8e3s4, groupName) {
// Inline function 'kotlin.runCatching' call
var tmp;
try {
// Inline function 'kotlin.Companion.success' call
var value = get(_this__u8e3s4.pc(), groupName);
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;
}
// Inline function 'kotlin.Result.getOrNull' call
var this_0 = tmp;
var tmp_1;
if (_Result___get_isFailure__impl__jpiriv(this_0)) {
tmp_1 = null;
} else {
var tmp_2 = _Result___get_value__impl__bjfvqg(this_0);
tmp_1 = (tmp_2 == null ? true : !(tmp_2 == null)) ? tmp_2 : THROW_CCE();
}
return !(tmp_1 == null);
}
function highestPrioritySemver(_this__u8e3s4) {
return maxOrNull(_this__u8e3s4);
}
function messageDigResult$lambda(it) {
var tmp0_safe_receiver = get(it.pc(), 'coAuthors');
return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.lc_1;
}
function messageDigResult$lambda_0(it) {
return getSemver(it);
}
var SemverType_None_instance;
var SemverType_Patch_instance;
var SemverType_Minor_instance;
var SemverType_Major_instance;
var SemverType_entriesInitialized;
function SemverType_initEntries() {
if (SemverType_entriesInitialized)
return Unit_instance;
SemverType_entriesInitialized = true;
SemverType_None_instance = new SemverType('None', 0);
SemverType_Patch_instance = new SemverType('Patch', 1);
SemverType_Minor_instance = new SemverType('Minor', 2);
SemverType_Major_instance = new SemverType('Major', 3);
}
function SemverType(name, ordinal) {
Enum.call(this, name, ordinal);
}
function SemverType_None_getInstance() {
SemverType_initEntries();
return SemverType_None_instance;
}
function SemverType_Patch_getInstance() {
SemverType_initEntries();
return SemverType_Patch_instance;
}
function SemverType_Minor_getInstance() {
SemverType_initEntries();
return SemverType_Minor_instance;
}
function SemverType_Major_getInstance() {
SemverType_initEntries();
return SemverType_Major_instance;
}
//region block: exports
_.$_$ = _.$_$ || {};
_.$_$.a = DiggerCore;
_.$_$.b = MessageDigger;
_.$_$.c = Defaults_getInstance;
_.$_$.d = Defaults_getInstance_0;
//endregion
return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./tools-digger-model.js')));
//# sourceMappingURL=tools-digger-core.js.map