chunk-VAY3LZG7.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. import {
  2. a
  3. } from "./chunk-QOV6ITMI.js";
  4. // node_modules/@arcgis/core/chunks/rbush.js
  5. function i(t, n2) {
  6. if (!(this instanceof i))
  7. return new i(t, n2);
  8. this._maxEntries = Math.max(4, t || 9), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), n2 && (typeof n2 == "function" ? this.toBBox = n2 : this._initFormat(n2)), this.clear();
  9. }
  10. function n(t, i2, n2) {
  11. if (!n2)
  12. return i2.indexOf(t);
  13. for (var h2 = 0; h2 < i2.length; h2++)
  14. if (n2(t, i2[h2]))
  15. return h2;
  16. return -1;
  17. }
  18. function h(t, i2) {
  19. a2(t, 0, t.children.length, i2, t);
  20. }
  21. function a2(t, i2, n2, h2, a3) {
  22. a3 || (a3 = x(null)), a3.minX = 1 / 0, a3.minY = 1 / 0, a3.maxX = -1 / 0, a3.maxY = -1 / 0;
  23. for (var e2, o2 = i2; o2 < n2; o2++)
  24. e2 = t.children[o2], r(a3, t.leaf ? h2(e2) : e2);
  25. return a3;
  26. }
  27. function r(t, i2) {
  28. return t.minX = Math.min(t.minX, i2.minX), t.minY = Math.min(t.minY, i2.minY), t.maxX = Math.max(t.maxX, i2.maxX), t.maxY = Math.max(t.maxY, i2.maxY), t;
  29. }
  30. function e(t, i2) {
  31. return t.minX - i2.minX;
  32. }
  33. function o(t, i2) {
  34. return t.minY - i2.minY;
  35. }
  36. function s(t) {
  37. return (t.maxX - t.minX) * (t.maxY - t.minY);
  38. }
  39. function l(t) {
  40. return t.maxX - t.minX + (t.maxY - t.minY);
  41. }
  42. function m(t, i2) {
  43. return (Math.max(i2.maxX, t.maxX) - Math.min(i2.minX, t.minX)) * (Math.max(i2.maxY, t.maxY) - Math.min(i2.minY, t.minY));
  44. }
  45. function c(t, i2) {
  46. var n2 = Math.max(t.minX, i2.minX), h2 = Math.max(t.minY, i2.minY), a3 = Math.min(t.maxX, i2.maxX), r2 = Math.min(t.maxY, i2.maxY);
  47. return Math.max(0, a3 - n2) * Math.max(0, r2 - h2);
  48. }
  49. function u(t, i2) {
  50. return t.minX <= i2.minX && t.minY <= i2.minY && i2.maxX <= t.maxX && i2.maxY <= t.maxY;
  51. }
  52. function f(t, i2) {
  53. return i2.minX <= t.maxX && i2.minY <= t.maxY && i2.maxX >= t.minX && i2.maxY >= t.minY;
  54. }
  55. function x(t) {
  56. return { children: t, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  57. }
  58. function d(i2, n2, h2, a3, r2) {
  59. for (var e2, o2 = [n2, h2]; o2.length; )
  60. (h2 = o2.pop()) - (n2 = o2.pop()) <= a3 || (e2 = n2 + Math.ceil((h2 - n2) / a3 / 2) * a3, a(i2, e2, n2, h2, r2), o2.push(n2, e2, e2, h2));
  61. }
  62. i.prototype = { all: function() {
  63. return this._all(this.data, []);
  64. }, search: function(t) {
  65. var i2 = this.data, n2 = [], h2 = this.toBBox;
  66. if (!f(t, i2))
  67. return n2;
  68. for (var a3, r2, e2, o2, s2 = []; i2; ) {
  69. for (a3 = 0, r2 = i2.children.length; a3 < r2; a3++)
  70. e2 = i2.children[a3], f(t, o2 = i2.leaf ? h2(e2) : e2) && (i2.leaf ? n2.push(e2) : u(t, o2) ? this._all(e2, n2) : s2.push(e2));
  71. i2 = s2.pop();
  72. }
  73. return n2;
  74. }, collides: function(t) {
  75. var i2 = this.data, n2 = this.toBBox;
  76. if (!f(t, i2))
  77. return false;
  78. for (var h2, a3, r2, e2, o2 = []; i2; ) {
  79. for (h2 = 0, a3 = i2.children.length; h2 < a3; h2++)
  80. if (r2 = i2.children[h2], f(t, e2 = i2.leaf ? n2(r2) : r2)) {
  81. if (i2.leaf || u(t, e2))
  82. return true;
  83. o2.push(r2);
  84. }
  85. i2 = o2.pop();
  86. }
  87. return false;
  88. }, load: function(t) {
  89. if (!t || !t.length)
  90. return this;
  91. if (t.length < this._minEntries) {
  92. for (var i2 = 0, n2 = t.length; i2 < n2; i2++)
  93. this.insert(t[i2]);
  94. return this;
  95. }
  96. var h2 = this._build(t.slice(), 0, t.length - 1, 0);
  97. if (this.data.children.length)
  98. if (this.data.height === h2.height)
  99. this._splitRoot(this.data, h2);
  100. else {
  101. if (this.data.height < h2.height) {
  102. var a3 = this.data;
  103. this.data = h2, h2 = a3;
  104. }
  105. this._insert(h2, this.data.height - h2.height - 1, true);
  106. }
  107. else
  108. this.data = h2;
  109. return this;
  110. }, insert: function(t) {
  111. return t && this._insert(t, this.data.height - 1), this;
  112. }, clear: function() {
  113. return this.data = x([]), this;
  114. }, remove: function(t, i2) {
  115. if (!t)
  116. return this;
  117. for (var h2, a3, r2, e2, o2 = this.data, s2 = this.toBBox(t), l2 = [], m2 = []; o2 || l2.length; ) {
  118. if (o2 || (o2 = l2.pop(), a3 = l2[l2.length - 1], h2 = m2.pop(), e2 = true), o2.leaf && (r2 = n(t, o2.children, i2)) !== -1)
  119. return o2.children.splice(r2, 1), l2.push(o2), this._condense(l2), this;
  120. e2 || o2.leaf || !u(o2, s2) ? a3 ? (h2++, o2 = a3.children[h2], e2 = false) : o2 = null : (l2.push(o2), m2.push(h2), h2 = 0, a3 = o2, o2 = o2.children[0]);
  121. }
  122. return this;
  123. }, toBBox: function(t) {
  124. return t;
  125. }, compareMinX: e, compareMinY: o, toJSON: function() {
  126. return this.data;
  127. }, fromJSON: function(t) {
  128. return this.data = t, this;
  129. }, _all: function(t, i2) {
  130. for (var n2 = []; t; )
  131. t.leaf ? i2.push.apply(i2, t.children) : n2.push.apply(n2, t.children), t = n2.pop();
  132. return i2;
  133. }, _build: function(t, i2, n2, a3) {
  134. var r2, e2 = n2 - i2 + 1, o2 = this._maxEntries;
  135. if (e2 <= o2)
  136. return h(r2 = x(t.slice(i2, n2 + 1)), this.toBBox), r2;
  137. a3 || (a3 = Math.ceil(Math.log(e2) / Math.log(o2)), o2 = Math.ceil(e2 / Math.pow(o2, a3 - 1))), (r2 = x([])).leaf = false, r2.height = a3;
  138. var s2, l2, m2, c2, u2 = Math.ceil(e2 / o2), f2 = u2 * Math.ceil(Math.sqrt(o2));
  139. for (d(t, i2, n2, f2, this.compareMinX), s2 = i2; s2 <= n2; s2 += f2)
  140. for (d(t, s2, m2 = Math.min(s2 + f2 - 1, n2), u2, this.compareMinY), l2 = s2; l2 <= m2; l2 += u2)
  141. c2 = Math.min(l2 + u2 - 1, m2), r2.children.push(this._build(t, l2, c2, a3 - 1));
  142. return h(r2, this.toBBox), r2;
  143. }, _chooseSubtree: function(t, i2, n2, h2) {
  144. for (var a3, r2, e2, o2, l2, c2, u2, f2; h2.push(i2), !i2.leaf && h2.length - 1 !== n2; ) {
  145. for (u2 = f2 = 1 / 0, a3 = 0, r2 = i2.children.length; a3 < r2; a3++)
  146. l2 = s(e2 = i2.children[a3]), (c2 = m(t, e2) - l2) < f2 ? (f2 = c2, u2 = l2 < u2 ? l2 : u2, o2 = e2) : c2 === f2 && l2 < u2 && (u2 = l2, o2 = e2);
  147. i2 = o2 || i2.children[0];
  148. }
  149. return i2;
  150. }, _insert: function(t, i2, n2) {
  151. var h2 = this.toBBox, a3 = n2 ? t : h2(t), e2 = [], o2 = this._chooseSubtree(a3, this.data, i2, e2);
  152. for (o2.children.push(t), r(o2, a3); i2 >= 0 && e2[i2].children.length > this._maxEntries; )
  153. this._split(e2, i2), i2--;
  154. this._adjustParentBBoxes(a3, e2, i2);
  155. }, _split: function(t, i2) {
  156. var n2 = t[i2], a3 = n2.children.length, r2 = this._minEntries;
  157. this._chooseSplitAxis(n2, r2, a3);
  158. var e2 = this._chooseSplitIndex(n2, r2, a3), o2 = x(n2.children.splice(e2, n2.children.length - e2));
  159. o2.height = n2.height, o2.leaf = n2.leaf, h(n2, this.toBBox), h(o2, this.toBBox), i2 ? t[i2 - 1].children.push(o2) : this._splitRoot(n2, o2);
  160. }, _splitRoot: function(t, i2) {
  161. this.data = x([t, i2]), this.data.height = t.height + 1, this.data.leaf = false, h(this.data, this.toBBox);
  162. }, _chooseSplitIndex: function(t, i2, n2) {
  163. var h2, r2, e2, o2, l2, m2, u2, f2;
  164. for (m2 = u2 = 1 / 0, h2 = i2; h2 <= n2 - i2; h2++)
  165. o2 = c(r2 = a2(t, 0, h2, this.toBBox), e2 = a2(t, h2, n2, this.toBBox)), l2 = s(r2) + s(e2), o2 < m2 ? (m2 = o2, f2 = h2, u2 = l2 < u2 ? l2 : u2) : o2 === m2 && l2 < u2 && (u2 = l2, f2 = h2);
  166. return f2;
  167. }, _chooseSplitAxis: function(t, i2, n2) {
  168. var h2 = t.leaf ? this.compareMinX : e, a3 = t.leaf ? this.compareMinY : o;
  169. this._allDistMargin(t, i2, n2, h2) < this._allDistMargin(t, i2, n2, a3) && t.children.sort(h2);
  170. }, _allDistMargin: function(t, i2, n2, h2) {
  171. t.children.sort(h2);
  172. var e2, o2, s2 = this.toBBox, m2 = a2(t, 0, i2, s2), c2 = a2(t, n2 - i2, n2, s2), u2 = l(m2) + l(c2);
  173. for (e2 = i2; e2 < n2 - i2; e2++)
  174. o2 = t.children[e2], r(m2, t.leaf ? s2(o2) : o2), u2 += l(m2);
  175. for (e2 = n2 - i2 - 1; e2 >= i2; e2--)
  176. o2 = t.children[e2], r(c2, t.leaf ? s2(o2) : o2), u2 += l(c2);
  177. return u2;
  178. }, _adjustParentBBoxes: function(t, i2, n2) {
  179. for (var h2 = n2; h2 >= 0; h2--)
  180. r(i2[h2], t);
  181. }, _condense: function(t) {
  182. for (var i2, n2 = t.length - 1; n2 >= 0; n2--)
  183. t[n2].children.length === 0 ? n2 > 0 ? (i2 = t[n2 - 1].children).splice(i2.indexOf(t[n2]), 1) : this.clear() : h(t[n2], this.toBBox);
  184. }, _initFormat: function(t) {
  185. var i2 = ["return a", " - b", ";"];
  186. this.compareMinX = new Function("a", "b", i2.join(t[0])), this.compareMinY = new Function("a", "b", i2.join(t[1])), this.toBBox = new Function("a", "return {minX: a" + t[0] + ", minY: a" + t[1] + ", maxX: a" + t[2] + ", maxY: a" + t[3] + "};");
  187. } };
  188. export {
  189. i
  190. };
  191. //# sourceMappingURL=chunk-VAY3LZG7.js.map