HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/@rushstack/node-core-library/lib/MinimumHeap.js.map
{"version":3,"file":"MinimumHeap.js","sourceRoot":"","sources":["../src/MinimumHeap.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;GAKG;AACH,MAAa,WAAW;IAItB;;;;;;OAMG;IACH,YAAmB,UAAkC;QAVpC,WAAM,GAAQ,EAAE,CAAC;QAWhC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,MAAM,GAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,IAAI,GAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAG,CAAC;YAEnC,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC;YAC/B,IAAI,IAAI,KAAK,CAAC,EAAE,CA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G,CAAC,CAAC;YACnD,MAAM,MAAM,GAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC3C,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;gBAC5B,KAAK,GAAG,WAAW,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF;AAlGD,kCAkGC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Implements a standard heap data structure for items of type T and a custom comparator.\n * The root will always be the minimum value as determined by the comparator.\n *\n * @public\n */\nexport class MinimumHeap<T> {\n  private readonly _items: T[] = [];\n  private readonly _comparator: (a: T, b: T) => number;\n\n  /**\n   * Constructs a new MinimumHeap instance.\n   * @param comparator - a comparator function that determines the order of the items in the heap.\n   *   If the comparator returns a value less than zero, then `a` will be considered less than `b`.\n   *   If the comparator returns zero, then `a` and `b` are considered equal.\n   *   Otherwise, `a` will be considered greater than `b`.\n   */\n  public constructor(comparator: (a: T, b: T) => number) {\n    this._comparator = comparator;\n  }\n\n  /**\n   * Returns the number of items in the heap.\n   * @returns the number of items in the heap.\n   */\n  public get size(): number {\n    return this._items.length;\n  }\n\n  /**\n   * Retrieves the root item from the heap without removing it.\n   * @returns the root item, or `undefined` if the heap is empty\n   */\n  public peek(): T | undefined {\n    return this._items[0];\n  }\n\n  /**\n   * Retrieves and removes the root item from the heap. The next smallest item will become the new root.\n   * @returns the root item, or `undefined` if the heap is empty\n   */\n  public poll(): T | undefined {\n    if (this.size > 0) {\n      const result: T = this._items[0];\n      const item: T = this._items.pop()!;\n\n      const size: number = this.size;\n      if (size === 0) {\n        // Short circuit in the trivial case\n        return result;\n      }\n\n      let index: number = 0;\n\n      let smallerChildIndex: number = 1;\n\n      while (smallerChildIndex < size) {\n        let smallerChild: T = this._items[smallerChildIndex];\n\n        const rightChildIndex: number = smallerChildIndex + 1;\n\n        if (rightChildIndex < size) {\n          const rightChild: T = this._items[rightChildIndex];\n          if (this._comparator(rightChild, smallerChild) < 0) {\n            smallerChildIndex = rightChildIndex;\n            smallerChild = rightChild;\n          }\n        }\n\n        if (this._comparator(smallerChild, item) < 0) {\n          this._items[index] = smallerChild;\n          index = smallerChildIndex;\n          smallerChildIndex = index * 2 + 1;\n        } else {\n          break;\n        }\n      }\n\n      // Place the item in its final location satisfying the heap property\n      this._items[index] = item;\n\n      return result;\n    }\n  }\n\n  /**\n   * Pushes an item into the heap.\n   * @param item - the item to push\n   */\n  public push(item: T): void {\n    let index: number = this.size;\n    while (index > 0) {\n      // Due to zero-based indexing the parent is not exactly a bit shift\n      const parentIndex: number = ((index + 1) >> 1) - 1;\n      const parent: T = this._items[parentIndex];\n      if (this._comparator(item, parent) < 0) {\n        this._items[index] = parent;\n        index = parentIndex;\n      } else {\n        break;\n      }\n    }\n    this._items[index] = item;\n  }\n}\n"]}