startUpdate(item) {
		if (this._unsortedItems.has(item)) {
			return remove => {
				if (remove) {
					this._unsortedItems.delete(item);
					this.size--;
				}
			};
		}
		const key = this._getKey(item);
		if (this._leaf) {
			const oldEntry = /** @type {SortableSet<T>} */ (this._map.get(key));
			return remove => {
				if (remove) {
					this.size--;
					oldEntry.delete(item);
					if (oldEntry.size === 0) {
						this._deleteKey(key);
					}
					return;
				}
				const newKey = this._getKey(item);
				if (key === newKey) {
					// This flags the sortable set as unordered
					oldEntry.add(item);
				} else {
					oldEntry.delete(item);
					if (oldEntry.size === 0) {
						this._deleteKey(key);
					}
					this._addInternal(newKey, item);
				}
			};
		}
		const oldEntry =
			/** @type {LazyBucketSortedSet<T, K>} */
			(this._map.get(key));
		const finishUpdate = oldEntry.startUpdate(item);
		return remove => {
			if (remove) {
				this.size--;
				finishUpdate(true);
				if (oldEntry.size === 0) {
					this._deleteKey(key);
				}
				return;
			}
			const newKey = this._getKey(item);
			if (key === newKey) {
				finishUpdate();
			} else {
				finishUpdate(true);
				if (oldEntry.size === 0) {
					this._deleteKey(key);
				}
				this._addInternal(newKey, item);
			}
		};
	}
@param {T} item to be updated item
@returns {(remove?: true) => void} finish update