/proc/self/root/var/runtime/node_modules/@aws-sdk/node_modules/aws-crt/dist.browser/browser
This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.
"use strict";/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */Object.defineProperty(exports, "__esModule", { value: true });exports.MinHeap = void 0;var error_1 = require("./error");/** * A generic array-based min-heap implementation for priority queue usage. Used to track operation timeouts. */var MinHeap = /** @class */ (function () { function MinHeap(lessThanOperator) { this.lessThanOperator = lessThanOperator; this.heap = [undefined]; this.currentSize = 0; } /** * Push a value into the min-heap * * @param value value to add */ MinHeap.prototype.push = function (value) { this.currentSize++; this.heap[this.currentSize] = value; this.heapifyUp(this.currentSize); }; /** * Gets the minimum value of the heap. Returns undefined if the heap is empty. */ MinHeap.prototype.peek = function () { if (this.currentSize == 0) { return undefined; } // guaranteed to be a T return this.heap[1]; }; /** * Pops the minimum value from the heap. Throws an exception if the heap is empty. */ MinHeap.prototype.pop = function () { if (this.empty()) { throw new error_1.CrtError("Heap is empty"); } var returnValue = this.heap[1]; var lastElement = this.heap[this.currentSize]; this.heap[this.currentSize--] = undefined; // erase the reference; unclear if this is overkill rather than simply removing from an array (or an indexed map for that matter) this.heap[1] = lastElement; this.heapifyDown(1); // @ts-ignore - guaranteed to be a T return returnValue; }; /** * Checks if the min-heap is empty or not */ MinHeap.prototype.empty = function () { return this.currentSize == 0; }; /** * Removes all values from the min-heap */ MinHeap.prototype.clear = function () { this.heap = [undefined]; this.currentSize = 0; }; MinHeap.prototype.swapElements = function (index1, index2) { var temp = this.heap[index1]; this.heap[index1] = this.heap[index2]; this.heap[index2] = temp; }; MinHeap.prototype.heapifyDown = function (startIndex) { var currentIndex = startIndex; while (true) { var leftIndex = currentIndex << 1; var rightIndex = leftIndex + 1; var swapIndex = undefined; // @ts-ignore - heap elements guaranteed to be a T if (leftIndex <= this.currentSize && this.lessThanOperator(this.heap[leftIndex], this.heap[currentIndex])) { swapIndex = leftIndex; } // @ts-ignore - heap elements guaranteed to be a T if (rightIndex <= this.currentSize && this.lessThanOperator(this.heap[rightIndex], this.heap[currentIndex])) { // @ts-ignore - heap elements guaranteed to be a T if (!swapIndex || this.lessThanOperator(this.heap[rightIndex], this.heap[leftIndex])) { // if current is greater than both left and right children, we must swap with the smallest child // since it will become the parent of both current and the other child swapIndex = rightIndex; } } if (!swapIndex) { break; } this.swapElements(currentIndex, swapIndex); currentIndex = swapIndex; } }; MinHeap.prototype.heapifyUp = function (index) { var parentIndex = index >> 1; // @ts-ignore - heap element guaranteed to be a T while (parentIndex > 0 && this.lessThanOperator(this.heap[index], this.heap[parentIndex])) { this.swapElements(index, parentIndex); index = parentIndex; parentIndex = parentIndex >> 1; } }; return MinHeap;}());exports.MinHeap = MinHeap;//# sourceMappingURL=heap.js.map