UNPKG

@rimbu/sorted

Version:

Immutable SortedMap and SortedSet implementations for TypeScript

728 lines 30.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SortedMapInner = exports.SortedMapLeaf = exports.SortedMapNode = exports.SortedMapEmpty = void 0; var tslib_1 = require("tslib"); var base_1 = require("@rimbu/base"); var common_1 = require("@rimbu/common"); var stream_1 = require("@rimbu/stream"); var custom_1 = require("@rimbu/stream/custom"); var common_2 = require("@rimbu/sorted/common"); var SortedMapEmpty = /** @class */ (function (_super) { tslib_1.__extends(SortedMapEmpty, _super); function SortedMapEmpty(context) { var _this = _super.call(this) || this; _this.context = context; return _this; } SortedMapEmpty.prototype.streamRange = function () { return stream_1.Stream.empty(); }; SortedMapEmpty.prototype.streamKeys = function () { return stream_1.Stream.empty(); }; SortedMapEmpty.prototype.streamValues = function () { return stream_1.Stream.empty(); }; SortedMapEmpty.prototype.streamSliceIndex = function () { return stream_1.Stream.empty(); }; SortedMapEmpty.prototype.minKey = function (otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.minValue = function (otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.maxKey = function (otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.maxValue = function (otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.get = function (key, otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.hasKey = function () { return false; }; SortedMapEmpty.prototype.findIndex = function () { return -1; }; SortedMapEmpty.prototype.getKeyAtIndex = function (index, otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.getValueAtIndex = function (index, otherwise) { return (0, common_1.OptLazy)(otherwise); }; SortedMapEmpty.prototype.set = function (key, value) { return this.context.leaf([[key, value]]); }; SortedMapEmpty.prototype.addEntry = function (entry) { return this.context.leaf([entry]); }; SortedMapEmpty.prototype.addEntries = function (entries) { return this.context.from(entries); }; SortedMapEmpty.prototype.removeKey = function () { return this; }; SortedMapEmpty.prototype.removeKeys = function () { return this; }; SortedMapEmpty.prototype.removeKeyAndGet = function () { return undefined; }; SortedMapEmpty.prototype.modifyAt = function (atKey, options) { if (undefined !== options.ifNew) { var value = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token); if (base_1.Token === value) return this; return this.context.leaf([[atKey, value]]); } return this; }; SortedMapEmpty.prototype.mapValues = function () { return this; }; SortedMapEmpty.prototype.updateAt = function () { return this; }; SortedMapEmpty.prototype.slice = function () { return this; }; SortedMapEmpty.prototype.toBuilder = function () { return this.context.builder(); }; SortedMapEmpty.prototype.toString = function () { return "SortedMap()"; }; SortedMapEmpty.prototype.toJSON = function () { return { dataType: this.context.typeTag, value: [], }; }; return SortedMapEmpty; }(common_2.SortedEmpty)); exports.SortedMapEmpty = SortedMapEmpty; var SortedMapNode = /** @class */ (function (_super) { tslib_1.__extends(SortedMapNode, _super); function SortedMapNode() { return _super !== null && _super.apply(this, arguments) || this; } SortedMapNode.prototype.asNormal = function () { return this; }; SortedMapNode.prototype.getSliceRange = function (range) { var _a = common_1.Range.getNormalizedRange(range), start = _a.start, end = _a.end; var startIndex = 0; var endIndex = this.size - 1; if (undefined !== start) { var _b = tslib_1.__read(start, 2), startValue = _b[0], startInclude = _b[1]; startIndex = this.getInsertIndexOf(startValue); if (startIndex < 0) { startIndex = common_2.SortedIndex.next(startIndex); } else if (!startInclude) { startIndex++; } } if (undefined !== end) { var _c = tslib_1.__read(end, 2), endValue = _c[0], endInclude = _c[1]; endIndex = this.getInsertIndexOf(endValue); if (endIndex < 0) endIndex = common_2.SortedIndex.prev(endIndex); else if (!endInclude) endIndex--; } return { startIndex: startIndex, endIndex: endIndex }; }; SortedMapNode.prototype.streamKeys = function (options) { if (options === void 0) { options = {}; } return this.stream(options).map(base_1.Entry.first); }; SortedMapNode.prototype.streamValues = function (options) { if (options === void 0) { options = {}; } return this.stream(options).map(base_1.Entry.second); }; SortedMapNode.prototype.streamRange = function (keyRange, options) { if (options === void 0) { options = {}; } var _a = this.getSliceRange(keyRange), startIndex = _a.startIndex, endIndex = _a.endIndex; return this.streamSliceIndex({ start: [startIndex, true], end: [endIndex, true], }, options); }; SortedMapNode.prototype.minKey = function () { return this.min()[0]; }; SortedMapNode.prototype.minValue = function () { return this.min()[1]; }; SortedMapNode.prototype.maxKey = function () { return this.max()[0]; }; SortedMapNode.prototype.maxValue = function () { return this.max()[1]; }; SortedMapNode.prototype.hasKey = function (key) { var token = Symbol(); return token !== this.get(key, token); }; SortedMapNode.prototype.getKeyAtIndex = function (index, otherwise) { var token = Symbol(); var result = this.getAtIndex(index, token); if (token === result) return (0, common_1.OptLazy)(otherwise); return result[0]; }; SortedMapNode.prototype.getValueAtIndex = function (index, otherwise) { var token = Symbol(); var result = this.getAtIndex(index, token); if (token === result) return (0, common_1.OptLazy)(otherwise); return result[1]; }; SortedMapNode.prototype.addEntry = function (entry) { return this.addInternal(entry).normalize().assumeNonEmpty(); }; SortedMapNode.prototype.addEntries = function (entries) { if ((0, custom_1.isEmptyStreamSourceInstance)(entries)) return this; var builder = this.toBuilder(); builder.addEntries(entries); return builder.build(); }; SortedMapNode.prototype.modifyAt = function (atKey, options) { return this.modifyAtInternal(atKey, options).normalize(); }; SortedMapNode.prototype.set = function (key, value) { return this.addEntry([key, value]); }; SortedMapNode.prototype.updateAt = function (key, update) { if (!this.context.isValidKey(key)) return this; return this.modifyAt(key, { ifExists: function (value) { return (0, common_1.Update)(value, update); }, }).assumeNonEmpty(); }; SortedMapNode.prototype.removeKey = function (key) { if (!this.context.isValidKey(key)) return this; return this.modifyAt(key, { ifExists: function (_, remove) { return remove; }, }); }; SortedMapNode.prototype.removeKeys = function (keys) { if ((0, custom_1.isEmptyStreamSourceInstance)(keys)) return this; var builder = this.toBuilder(); builder.removeKeys(keys); return builder.build(); }; SortedMapNode.prototype.removeKeyAndGet = function (key) { if (!this.context.isValidKey(key)) return undefined; var token = Symbol(); var currentValue = token; var newMap = this.modifyAt(key, { ifExists: function (value, remove) { currentValue = value; return remove; }, }); if (token === currentValue) { return undefined; } return [newMap, currentValue]; }; SortedMapNode.prototype.filter = function (pred, options) { if (options === void 0) { options = {}; } var builder = this.context.builder(); builder.addEntries(this.stream().filter(pred, options)); if (builder.size === this.size) return this; return builder.build(); }; SortedMapNode.prototype.take = function (amount) { if (amount === 0) return this.context.empty(); if (amount >= this.size || -amount > this.size) return this; if (amount < 0) return this.drop(this.size + amount); return this.takeInternal(amount).normalize(); }; SortedMapNode.prototype.drop = function (amount) { if (amount === 0) return this; if (amount >= this.size || -amount > this.size) return this.context.empty(); if (amount < 0) return this.take(this.size + amount); return this.dropInternal(amount).normalize(); }; SortedMapNode.prototype.sliceIndex = function (range) { var indexRange = common_1.IndexRange.getIndicesFor(range, this.size); if (indexRange === 'empty') return this.context.empty(); if (indexRange === 'all') return this; var _a = tslib_1.__read(indexRange, 2), start = _a[0], end = _a[1]; return this.drop(start).take(end - start + 1); }; SortedMapNode.prototype.slice = function (range) { var _a = this.getSliceRange(range), startIndex = _a.startIndex, endIndex = _a.endIndex; return this.sliceIndex({ start: [startIndex, true], end: [endIndex, true], }); }; SortedMapNode.prototype.toBuilder = function () { return this.context.createBuilder(this); }; SortedMapNode.prototype.toString = function () { return this.stream().join({ start: 'SortedMap(', sep: ', ', end: ')', valueToString: function (entry) { return "".concat(entry[0], " -> ").concat(entry[1]); }, }); }; SortedMapNode.prototype.toJSON = function () { return { dataType: this.context.typeTag, value: this.toArray(), }; }; return SortedMapNode; }(common_2.SortedNonEmptyBase)); exports.SortedMapNode = SortedMapNode; var SortedMapLeaf = /** @class */ (function (_super) { tslib_1.__extends(SortedMapLeaf, _super); function SortedMapLeaf(context, entries) { var _this = _super.call(this) || this; _this.context = context; _this.entries = entries; return _this; } SortedMapLeaf.prototype.copy = function (entries) { if (entries === this.entries) return this; return this.context.leaf(entries); }; Object.defineProperty(SortedMapLeaf.prototype, "size", { get: function () { return this.entries.length; }, enumerable: false, configurable: true }); SortedMapLeaf.prototype.stream = function (options) { if (options === void 0) { options = {}; } return stream_1.Stream.fromArray(this.entries, options); }; SortedMapLeaf.prototype.streamSliceIndex = function (range, options) { if (options === void 0) { options = {}; } var _a = options.reversed, reversed = _a === void 0 ? false : _a; return stream_1.Stream.fromArray(this.entries, { range: range, reversed: reversed }); }; SortedMapLeaf.prototype.min = function () { return this.entries[0]; }; SortedMapLeaf.prototype.max = function () { return base_1.Arr.last(this.entries); }; SortedMapLeaf.prototype.get = function (key, otherwise) { if (!this.context.isValidKey(key)) return (0, common_1.OptLazy)(otherwise); var index = this.context.findIndex(key, this.entries); if (index < 0) return (0, common_1.OptLazy)(otherwise); return this.entries[index][1]; }; SortedMapLeaf.prototype.findIndex = function (key) { if (!this.context.comp.isComparable(key)) return -1; var index = this.context.findIndex(key, this.entries); return index < 0 ? -1 : index; }; SortedMapLeaf.prototype.getAtIndex = function (index, otherwise) { if (index >= this.size || -index > this.size) return (0, common_1.OptLazy)(otherwise); if (index < 0) return this.getAtIndex(this.size + index, otherwise); return this.entries[index]; }; SortedMapLeaf.prototype.forEach = function (f, options) { if (options === void 0) { options = {}; } var _a = options.state, state = _a === void 0 ? (0, common_1.TraverseState)() : _a; if (state.halted) return; base_1.Arr.forEach(this.entries, f, state); }; SortedMapLeaf.prototype.mapValues = function (mapFun) { var newEntries = this.entries.map(function (entry) { var newValue = mapFun(entry[1], entry[0]); return [entry[0], newValue]; }); return this.context.leaf(newEntries); }; SortedMapLeaf.prototype.toArray = function () { return this.entries.slice(); }; // internal methods SortedMapLeaf.prototype.getInsertIndexOf = function (key) { return this.context.findIndex(key, this.entries); }; SortedMapLeaf.prototype.addInternal = function (entry) { var index = this.context.findIndex(entry[0], this.entries); if (index >= 0) { var currentEntry = this.entries[index]; if (Object.is(currentEntry[1], entry[1])) return this; var newEntries_1 = base_1.Arr.update(this.entries, index, entry); return this.copy(newEntries_1); } var insertIndex = common_2.SortedIndex.next(index); var newEntries = base_1.Arr.insert(this.entries, insertIndex, entry); return this.copy(newEntries); }; SortedMapLeaf.prototype.modifyAtInternal = function (key, options) { var entryIndex = this.context.findIndex(key, this.entries); if (entryIndex >= 0) { if (undefined === options.ifExists) return this; var currentEntry = this.entries[entryIndex]; var currentValue = currentEntry[1]; var newValue_1 = options.ifExists instanceof Function ? options.ifExists(currentValue, base_1.Token) : options.ifExists; if (Object.is(newValue_1, currentValue)) return this; if (base_1.Token === newValue_1) { var newEntries_2 = base_1.Arr.splice(this.mutateEntries, entryIndex, 1); return this.copy(newEntries_2); } var newEntries_3 = base_1.Arr.update(this.entries, entryIndex, [ key, newValue_1, ]); return this.copy(newEntries_3); } if (undefined === options.ifNew) return this; var newValue = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token); if (base_1.Token === newValue) return this; var insertIndex = common_2.SortedIndex.next(entryIndex); var newEntries = base_1.Arr.insert(this.entries, insertIndex, [ key, newValue, ]); return this.copy(newEntries); }; SortedMapLeaf.prototype.takeInternal = function (amount) { return this.context.leaf(this.entries.slice(0, amount)); }; SortedMapLeaf.prototype.dropInternal = function (amount) { return this.context.leaf(this.entries.slice(amount)); }; SortedMapLeaf.prototype.deleteMin = function () { return (0, common_2.leafDeleteMin)(this); }; SortedMapLeaf.prototype.deleteMax = function () { return (0, common_2.leafDeleteMax)(this); }; SortedMapLeaf.prototype.mutateSplitRight = function (index) { return (0, common_2.leafMutateSplitRight)(this, index); }; SortedMapLeaf.prototype.mutateGiveToLeft = function (left, toLeft) { return (0, common_2.leafMutateGiveToLeft)(this, left, toLeft); }; SortedMapLeaf.prototype.mutateGiveToRight = function (right, toRight) { return (0, common_2.leafMutateGiveToRight)(this, right, toRight); }; SortedMapLeaf.prototype.mutateGetFromLeft = function (left, toMe) { return (0, common_2.leafMutateGetFromLeft)(this, left, toMe); }; SortedMapLeaf.prototype.mutateGetFromRight = function (right, toMe) { return (0, common_2.leafMutateGetFromRight)(this, right, toMe); }; SortedMapLeaf.prototype.mutateJoinLeft = function (left, entry) { return (0, common_2.leafMutateJoinLeft)(this, left, entry); }; SortedMapLeaf.prototype.mutateJoinRight = function (right, entry) { return (0, common_2.leafMutateJoinRight)(this, right, entry); }; SortedMapLeaf.prototype.normalize = function () { if (this.entries.length === 0) return this.context.empty(); if (this.entries.length <= this.context.maxEntries) return this; var size = this.size; var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1]; return this.context.inner([upEntry], [this, rightNode], size); }; return SortedMapLeaf; }(SortedMapNode)); exports.SortedMapLeaf = SortedMapLeaf; var SortedMapInner = /** @class */ (function (_super) { tslib_1.__extends(SortedMapInner, _super); function SortedMapInner(context, entries, children, size) { var _this = _super.call(this) || this; _this.context = context; _this.entries = entries; _this.children = children; _this.size = size; return _this; } Object.defineProperty(SortedMapInner.prototype, "mutateChildren", { get: function () { return this.children; }, enumerable: false, configurable: true }); SortedMapInner.prototype.copy = function (entries, children, size) { if (entries === void 0) { entries = this.entries; } if (children === void 0) { children = this.children; } if (size === void 0) { size = this.size; } if (entries === this.entries && children === this.children && size === this.size) return this; return this.context.inner(entries, children, size); }; SortedMapInner.prototype.stream = function (options) { if (options === void 0) { options = {}; } var token = Symbol(); return stream_1.Stream.zipAll(token, stream_1.Stream.fromArray(this.children, options), stream_1.Stream.fromArray(this.entries, options)).flatMap(function (_a) { var _b = tslib_1.__read(_a, 2), child = _b[0], e = _b[1]; if (token === child) base_1.RimbuError.throwInvalidStateError(); if (token === e) return child.stream(options); return child.stream(options).append(e); }); }; SortedMapInner.prototype.streamSliceIndex = function (range, options) { if (options === void 0) { options = {}; } var _a = options.reversed, reversed = _a === void 0 ? false : _a; return (0, common_2.innerStreamSliceIndex)(this, range, reversed); }; SortedMapInner.prototype.min = function () { return this.children[0].min(); }; SortedMapInner.prototype.max = function () { return base_1.Arr.last(this.children).max(); }; SortedMapInner.prototype.get = function (key, otherwise) { if (!this.context.isValidKey(key)) return (0, common_1.OptLazy)(otherwise); var index = this.context.findIndex(key, this.entries); if (index >= 0) return this.entries[index][1]; var childIndex = common_2.SortedIndex.next(index); var child = this.children[childIndex]; return child.get(key, otherwise); }; SortedMapInner.prototype.findIndex = function (key) { if (!this.context.comp.isComparable(key)) return -1; var index = this.context.findIndex(key, this.entries); if (index >= 0) return (this.children.slice(0, index + 1).reduce(function (x, y) { return x + y.size; }, 0) + index); var childIndex = common_2.SortedIndex.next(index); var child = this.children[childIndex]; var index$ = child.findIndex(key); if (index$ >= 0) { return (index$ + (this.children.slice(0, childIndex).reduce(function (x, y) { return x + y.size; }, 0) - index - 1)); } return -1; }; SortedMapInner.prototype.getAtIndex = function (index, otherwise) { return (0, common_2.innerGetAtIndex)(this, index, otherwise); }; SortedMapInner.prototype.forEach = function (f, options) { if (options === void 0) { options = {}; } var _a = options.state, state = _a === void 0 ? (0, common_1.TraverseState)() : _a; var i = -1; var entryLength = this.entries.length; var halt = state.halt; while (!state.halted && i < entryLength) { if (i >= 0) f(this.entries[i], state.nextIndex(), halt); else { var childIndex = common_2.SortedIndex.next(i); this.children[childIndex].forEach(f, { state: state }); } i = common_2.SortedIndex.next(i); } }; SortedMapInner.prototype.mapValues = function (mapFun) { var newEntries = this.entries.map(function (entry) { var newValue = mapFun(entry[1], entry[0]); return [entry[0], newValue]; }); var newChildren = this.children.map(function (child) { return child.mapValues(mapFun); }); return this.context.inner(newEntries, newChildren, this.size); }; SortedMapInner.prototype.toArray = function () { var i = -1; var result = []; while (i < this.entries.length) { if (i >= 0) result.push(this.entries[i]); else { var childIndex = common_2.SortedIndex.next(i); result = result.concat(this.children[childIndex].toArray()); } i = common_2.SortedIndex.next(i); } return result; }; // internal methods SortedMapInner.prototype.getInsertIndexOf = function (key) { var index = 0; for (var i = 0; i < this.entries.length; i++) { var comp = this.context.comp.compare(key, this.entries[i][0]); var child = this.children[i]; if (comp < 0) { var insertIndex_1 = child.getInsertIndexOf(key); if (insertIndex_1 < 0) return -index + insertIndex_1; return index + insertIndex_1; } index += child.size + 1; if (comp === 0) return index - 1; } var insertIndex = base_1.Arr.last(this.children).getInsertIndexOf(key); if (insertIndex < 0) return -index + insertIndex; return index + insertIndex; }; SortedMapInner.prototype.addInternal = function (entry) { var entryIndex = this.context.findIndex(entry[0], this.entries); if (entryIndex >= 0) { var newEntries = base_1.Arr.update(this.entries, entryIndex, function (currentEntry) { if (Object.is(currentEntry[1], entry[1])) return currentEntry; return entry; }); return this.copy(newEntries); } var childIndex = common_2.SortedIndex.next(entryIndex); var child = this.children[childIndex]; var newChild = child.addInternal(entry); if (newChild === child) return this; var newSize = this.size + newChild.size - child.size; if (newChild.entries.length <= this.context.maxEntries) { // no need to shift var newChildren = base_1.Arr.update(this.children, childIndex, newChild); return this.copy(undefined, newChildren, newSize); } return this.normalizeDownsizeChild(childIndex, newChild, newSize); }; SortedMapInner.prototype.modifyAtInternal = function (key, options) { var entryIndex = this.context.findIndex(key, this.entries); if (entryIndex >= 0) { if (undefined === options.ifExists) return this; var currentEntry = this.entries[entryIndex]; var currentValue = currentEntry[1]; var newValue = options.ifExists instanceof Function ? options.ifExists(currentValue, base_1.Token) : options.ifExists; if (Object.is(newValue, currentValue)) return this; if (base_1.Token === newValue) { // remove inner entry var leftChild = this.children[entryIndex]; var rightChild = this.children[entryIndex + 1]; if (leftChild.entries.length >= rightChild.entries.length) { var _a = tslib_1.__read(leftChild.deleteMax(), 2), max = _a[0], newLeft = _a[1]; var newEntries_4 = base_1.Arr.update(this.entries, entryIndex, max); var newSelf_1 = this.copy(newEntries_4); return newSelf_1.normalizeIncreaseChild(entryIndex, newLeft, this.size - 1); } var _b = tslib_1.__read(rightChild.deleteMin(), 2), min = _b[0], newRight = _b[1]; var newEntries_5 = base_1.Arr.update(this.entries, entryIndex, min); var newSelf = this.copy(newEntries_5); return newSelf.normalizeIncreaseChild(entryIndex + 1, newRight, this.size - 1); } // update inner entry var newEntry = [key, newValue]; var newEntries = base_1.Arr.update(this.entries, entryIndex, newEntry); return this.copy(newEntries); } var childIndex = common_2.SortedIndex.next(entryIndex); var child = this.children[childIndex]; var newChild = child.modifyAtInternal(key, options); var newSize = this.size + newChild.size - child.size; if (newChild.entries.length < this.context.minEntries) { return this.normalizeIncreaseChild(childIndex, newChild, newSize); } if (newChild.entries.length > this.context.maxEntries) { return this.normalizeDownsizeChild(childIndex, newChild, newSize); } var newChildren = base_1.Arr.update(this.children, childIndex, newChild); return this.copy(undefined, newChildren, this.size + newChild.size - child.size); }; SortedMapInner.prototype.takeInternal = function (amount) { return (0, common_2.innerTakeInternal)(this, amount); }; SortedMapInner.prototype.dropInternal = function (amount) { return (0, common_2.innerDropInternal)(this, amount); }; SortedMapInner.prototype.deleteMin = function () { return (0, common_2.innerDeleteMin)(this); }; SortedMapInner.prototype.deleteMax = function () { return (0, common_2.innerDeleteMax)(this); }; SortedMapInner.prototype.mutateSplitRight = function (index) { return (0, common_2.innerMutateSplitRight)(this, index); }; SortedMapInner.prototype.mutateGiveToLeft = function (left, toLeft) { return (0, common_2.innerMutateGiveToLeft)(this, left, toLeft); }; SortedMapInner.prototype.mutateGiveToRight = function (right, toRight) { return (0, common_2.innerMutateGiveToRight)(this, right, toRight); }; SortedMapInner.prototype.mutateGetFromLeft = function (left, toMe) { return (0, common_2.innerMutateGetFromLeft)(this, left, toMe); }; SortedMapInner.prototype.mutateGetFromRight = function (right, toMe) { return (0, common_2.innerMutateGetFromRight)(this, right, toMe); }; SortedMapInner.prototype.mutateJoinLeft = function (left, entry) { return (0, common_2.innerMutateJoinLeft)(this, left, entry); }; SortedMapInner.prototype.mutateJoinRight = function (right, entry) { return (0, common_2.innerMutateJoinRight)(this, right, entry); }; SortedMapInner.prototype.normalizeDownsizeChild = function (childIndex, newChild, newSize) { return (0, common_2.innerNormalizeDownsizeChild)(this, childIndex, newChild, newSize); }; SortedMapInner.prototype.normalizeIncreaseChild = function (childIndex, newChild, newSize) { return (0, common_2.innerNormalizeIncreaseChild)(this, childIndex, newChild, newSize); }; SortedMapInner.prototype.normalize = function () { if (this.entries.length === 0) return this.children[0].normalize(); if (this.entries.length <= this.context.maxEntries) return this; var size = this.size; var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1]; return this.copy([upEntry], [this, rightNode], size); }; return SortedMapInner; }(SortedMapNode)); exports.SortedMapInner = SortedMapInner; //# sourceMappingURL=immutable.cjs.map