chunk-M5BTTMP6.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import {
  2. t as t2
  3. } from "./chunk-XZA4MVET.js";
  4. import {
  5. fn,
  6. ln
  7. } from "./chunk-DH2OBAUC.js";
  8. import {
  9. d,
  10. g,
  11. y
  12. } from "./chunk-ECW2QABR.js";
  13. import {
  14. E,
  15. I,
  16. k
  17. } from "./chunk-MRJEICT6.js";
  18. import {
  19. r,
  20. t
  21. } from "./chunk-GZT4BVFP.js";
  22. // node_modules/@arcgis/core/layers/graphics/data/projectionSupport.js
  23. var h = [0, 0];
  24. function c(s, t3) {
  25. if (!t3)
  26. return null;
  27. if ("x" in t3) {
  28. const e2 = { x: 0, y: 0 };
  29. return [e2.x, e2.y] = s(t3.x, t3.y, h), t3.z != null && (e2.z = t3.z), t3.m != null && (e2.m = t3.m), e2;
  30. }
  31. if ("xmin" in t3) {
  32. const e2 = { xmin: 0, ymin: 0, xmax: 0, ymax: 0 };
  33. return [e2.xmin, e2.ymin] = s(t3.xmin, t3.ymin, h), [e2.xmax, e2.ymax] = s(t3.xmax, t3.ymax, h), t3.hasZ && (e2.zmin = t3.zmin, e2.zmax = t3.zmax, e2.hasZ = true), t3.hasM && (e2.mmin = t3.mmin, e2.mmax = t3.mmax, e2.hasM = true), e2;
  34. }
  35. return "rings" in t3 ? { rings: p(t3.rings, s), hasM: t3.hasM, hasZ: t3.hasZ } : "paths" in t3 ? { paths: p(t3.paths, s), hasM: t3.hasM, hasZ: t3.hasZ } : "points" in t3 ? { points: l(t3.points, s), hasM: t3.hasM, hasZ: t3.hasZ } : void 0;
  36. }
  37. function p(s, t3) {
  38. const e2 = [];
  39. for (const n2 of s)
  40. e2.push(l(n2, t3));
  41. return e2;
  42. }
  43. function l(s, t3) {
  44. const e2 = [];
  45. for (const n2 of s) {
  46. const s2 = t3(n2[0], n2[1], [0, 0]);
  47. e2.push(s2), n2.length > 2 && s2.push(n2[2]), n2.length > 3 && s2.push(n2[3]);
  48. }
  49. return e2;
  50. }
  51. async function f(e2, n2) {
  52. if (!n2)
  53. return;
  54. const r3 = Array.isArray(e2) ? e2.map((t3) => r(t3.geometry) && t3.geometry.spatialReference) : [e2];
  55. await fn(r3.map((s) => ({ source: s, dest: n2 })));
  56. }
  57. var x = c.bind(null, y);
  58. var y2 = c.bind(null, d);
  59. function g2(s, t3, a, m) {
  60. if (!s)
  61. return s;
  62. if (a || (a = t3, t3 = s.spatialReference), !I(t3) || !I(a) || E(t3, a))
  63. return s;
  64. if (g(t3, a)) {
  65. const t4 = k(a) ? x(s) : y2(s);
  66. return t4.spatialReference = a, t4;
  67. }
  68. return ln(t2, [s], t3, a, null, m)[0];
  69. }
  70. var _ = class {
  71. constructor() {
  72. this._jobs = [], this._timer = null, this._process = this._process.bind(this);
  73. }
  74. async push(s, t3, e2) {
  75. if (!s || !s.length || !t3 || !e2 || E(t3, e2))
  76. return s;
  77. const n2 = { geometries: s, inSpatialReference: t3, outSpatialReference: e2, resolve: null };
  78. return this._jobs.push(n2), new Promise((s2) => {
  79. n2.resolve = s2, this._timer === null && (this._timer = setTimeout(this._process, 10));
  80. });
  81. }
  82. _process() {
  83. this._timer = null;
  84. const s = this._jobs.shift();
  85. if (!s)
  86. return;
  87. const { geometries: t3, inSpatialReference: r3, outSpatialReference: i, resolve: a } = s;
  88. g(r3, i) ? k(i) ? a(t3.map(x)) : a(t3.map(y2)) : a(ln(t2, t3, r3, i, null, null)), this._jobs.length > 0 && (this._timer = setTimeout(this._process, 10));
  89. }
  90. };
  91. var j = new _();
  92. function M(s, t3, e2) {
  93. return j.push(s, t3, e2);
  94. }
  95. // node_modules/@arcgis/core/layers/graphics/centroid.js
  96. function n(t3, n2) {
  97. return t3 ? n2 ? 4 : 3 : n2 ? 3 : 2;
  98. }
  99. function e(e2, o2, u2, N2, l3) {
  100. if (t(o2) || !o2.lengths.length)
  101. return null;
  102. const s = l3?.originPosition === "upperLeft" ? -1 : 1;
  103. e2.lengths.length && (e2.lengths.length = 0), e2.coords.length && (e2.coords.length = 0);
  104. const c2 = e2.coords, f2 = [], i = u2 ? [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY] : [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY], { lengths: T, coords: h2 } = o2, g3 = n(u2, N2);
  105. let E2 = 0;
  106. for (const t3 of T) {
  107. const n2 = r2(i, h2, E2, t3, u2, N2, s);
  108. n2 && f2.push(n2), E2 += t3 * g3;
  109. }
  110. if (f2.sort((t3, n2) => {
  111. let e3 = s * t3[2] - s * n2[2];
  112. return e3 === 0 && u2 && (e3 = t3[4] - n2[4]), e3;
  113. }), f2.length) {
  114. let t3 = 6 * f2[0][2];
  115. c2[0] = f2[0][0] / t3, c2[1] = f2[0][1] / t3, u2 && (t3 = 6 * f2[0][4], c2[2] = t3 !== 0 ? f2[0][3] / t3 : 0), (c2[0] < i[0] || c2[0] > i[1] || c2[1] < i[2] || c2[1] > i[3] || u2 && (c2[2] < i[4] || c2[2] > i[5])) && (c2.length = 0);
  116. }
  117. if (!c2.length) {
  118. const t3 = o2.lengths[0] ? I2(h2, 0, T[0], u2, N2) : null;
  119. if (!t3)
  120. return null;
  121. c2[0] = t3[0], c2[1] = t3[1], u2 && t3.length > 2 && (c2[2] = t3[2]);
  122. }
  123. return e2;
  124. }
  125. function r2(t3, e2, r3, I3, o2, u2, N2 = 1) {
  126. const l3 = n(o2, u2);
  127. let s = r3, c2 = r3 + l3, f2 = 0, i = 0, T = 0, h2 = 0, g3 = 0;
  128. for (let n2 = 0, m = I3 - 1; n2 < m; n2++, s += l3, c2 += l3) {
  129. const n3 = e2[s], r4 = e2[s + 1], I4 = e2[s + 2], u3 = e2[c2], N3 = e2[c2 + 1], l4 = e2[c2 + 2];
  130. let E3 = n3 * N3 - u3 * r4;
  131. h2 += E3, f2 += (n3 + u3) * E3, i += (r4 + N3) * E3, o2 && (E3 = n3 * l4 - u3 * I4, T += (I4 + l4) * E3, g3 += E3), n3 < t3[0] && (t3[0] = n3), n3 > t3[1] && (t3[1] = n3), r4 < t3[2] && (t3[2] = r4), r4 > t3[3] && (t3[3] = r4), o2 && (I4 < t3[4] && (t3[4] = I4), I4 > t3[5] && (t3[5] = I4));
  132. }
  133. if (h2 * N2 > 0 && (h2 *= -1), g3 * N2 > 0 && (g3 *= -1), !h2)
  134. return null;
  135. const E2 = [f2, i, 0.5 * h2];
  136. return o2 && (E2[3] = T, E2[4] = 0.5 * g3), E2;
  137. }
  138. function I2(t3, e2, r3, I3, s) {
  139. const c2 = n(I3, s);
  140. let f2 = e2, i = e2 + c2, T = 0, h2 = 0, g3 = 0, E2 = 0;
  141. for (let n2 = 0, m = r3 - 1; n2 < m; n2++, f2 += c2, i += c2) {
  142. const n3 = t3[f2], e3 = t3[f2 + 1], r4 = t3[f2 + 2], s2 = t3[i], c3 = t3[i + 1], m2 = t3[i + 2], b = I3 ? u(n3, e3, r4, s2, c3, m2) : o(n3, e3, s2, c3);
  143. if (b)
  144. if (T += b, I3) {
  145. const t4 = l2(n3, e3, r4, s2, c3, m2);
  146. h2 += b * t4[0], g3 += b * t4[1], E2 += b * t4[2];
  147. } else {
  148. const t4 = N(n3, e3, s2, c3);
  149. h2 += b * t4[0], g3 += b * t4[1];
  150. }
  151. }
  152. return T > 0 ? I3 ? [h2 / T, g3 / T, E2 / T] : [h2 / T, g3 / T] : r3 > 0 ? I3 ? [t3[e2], t3[e2 + 1], t3[e2 + 2]] : [t3[e2], t3[e2 + 1]] : null;
  153. }
  154. function o(t3, n2, e2, r3) {
  155. const I3 = e2 - t3, o2 = r3 - n2;
  156. return Math.sqrt(I3 * I3 + o2 * o2);
  157. }
  158. function u(t3, n2, e2, r3, I3, o2) {
  159. const u2 = r3 - t3, N2 = I3 - n2, l3 = o2 - e2;
  160. return Math.sqrt(u2 * u2 + N2 * N2 + l3 * l3);
  161. }
  162. function N(t3, n2, e2, r3) {
  163. return [t3 + 0.5 * (e2 - t3), n2 + 0.5 * (r3 - n2)];
  164. }
  165. function l2(t3, n2, e2, r3, I3, o2) {
  166. return [t3 + 0.5 * (r3 - t3), n2 + 0.5 * (I3 - n2), e2 + 0.5 * (o2 - e2)];
  167. }
  168. export {
  169. e,
  170. f,
  171. g2 as g,
  172. M
  173. };
  174. //# sourceMappingURL=chunk-M5BTTMP6.js.map