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ent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ts-sort-heap@1.0.1/umd/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\n * (c) 2019-2020 jackieli 西门互联\n * https://github.com/jackieli123723/ts-sort-array\n * http://issue.lilidong.cn\n * Released under the MIT License.\n */\n(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n  typeof define === 'function' && define.amd ? define(['exports'], factory) :\n  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.tsSortHeap = {}));\n}(this, (function (exports) { 'use strict';\n\n  var arrLength;\r\n  function maxHeap(input, i) {\r\n      var left = 2 * i + 1;\r\n      var right = 2 * i + 2;\r\n      var max = i;\r\n      if (left < arrLength && input[left] > input[max]) {\r\n          max = left;\r\n      }\r\n      if (right < arrLength && input[right] > input[max]) {\r\n          max = right;\r\n      }\r\n      if (max != i) {\r\n          swap(input, i, max);\r\n          maxHeap(input, max);\r\n      }\r\n  }\r\n  function swap(input, indexA, indexB) {\r\n      var temp = input[indexA];\r\n      input[indexA] = input[indexB];\r\n      input[indexB] = temp;\r\n  }\r\n  function heapSortSync(input) {\r\n      arrLength = input.length;\r\n      for (var i = Math.floor(arrLength / 2); i >= 0; i -= 1) {\r\n          maxHeap(input, i);\r\n      }\r\n      for (var i = input.length - 1; i > 0; i--) {\r\n          swap(input, 0, i);\r\n          arrLength--;\r\n          maxHeap(input, 0);\r\n      }\r\n      return input;\r\n  }\r\n  function heapSort(arr, callback) {\r\n      var result = heapSortSync(arr);\r\n      callback && typeof callback == 'function' && callback(result);\r\n  }\r\n  function heapSortAsync(arr) {\r\n      var result = heapSortSync(arr);\r\n      return Promise.resolve(result);\r\n  }\n\n  exports.heapSort = heapSort;\n  exports.heapSortAsync = heapSortAsync;\n  exports.heapSortSync = heapSortSync;\n\n  Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n"]}