chunk-CR67YDNV.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import {
  2. i,
  3. r,
  4. s as s2
  5. } from "./chunk-P4UZNLD5.js";
  6. import {
  7. u
  8. } from "./chunk-N2663GRX.js";
  9. import {
  10. c as c2,
  11. f,
  12. l,
  13. s,
  14. y
  15. } from "./chunk-2Z6LERTI.js";
  16. import {
  17. c,
  18. h
  19. } from "./chunk-OWVBLVP3.js";
  20. import {
  21. R,
  22. k
  23. } from "./chunk-MRJEICT6.js";
  24. import {
  25. t
  26. } from "./chunk-GZT4BVFP.js";
  27. // node_modules/@arcgis/core/geometry/support/normalizeUtilsSync.js
  28. function p(t2) {
  29. return _(t2, true);
  30. }
  31. function f2(t2) {
  32. return _(t2, false);
  33. }
  34. function _(i2, n) {
  35. if (t(i2))
  36. return null;
  37. const p2 = i2.spatialReference, f3 = R(p2), _2 = "toJSON" in i2 ? i2.toJSON() : i2;
  38. if (!f3)
  39. return _2;
  40. const I2 = k(p2) ? 102100 : 4326, g2 = r[I2].maxX, v2 = r[I2].minX;
  41. if (l(_2))
  42. return y2(_2, g2, v2);
  43. if (f(_2))
  44. return _2.points = _2.points.map((t2) => y2(t2, g2, v2)), _2;
  45. if (s(_2))
  46. return d(_2, f3);
  47. if (c2(_2) || y(_2)) {
  48. const t2 = c(S, _2), i3 = { xmin: t2[0], ymin: t2[1], xmax: t2[2], ymax: t2[3] }, e = i(i3.xmin, v2) * (2 * g2), h2 = e === 0 ? _2 : s2(_2, e);
  49. return i3.xmin += e, i3.xmax += e, i3.xmax > g2 ? P(h2, g2, n) : i3.xmin < v2 ? P(h2, v2, n) : h2;
  50. }
  51. return _2;
  52. }
  53. function d(t2, i2) {
  54. if (!i2)
  55. return t2;
  56. const s3 = I(t2, i2).map((t3) => t3.extent);
  57. return s3.length < 2 ? s3[0] || t2 : s3.length > 2 ? (t2.xmin = i2.valid[0], t2.xmax = i2.valid[1], t2) : { rings: s3.map((t3) => [[t3.xmin, t3.ymin], [t3.xmin, t3.ymax], [t3.xmax, t3.ymax], [t3.xmax, t3.ymin], [t3.xmin, t3.ymin]]) };
  58. }
  59. function y2(t2, i2, s3) {
  60. if (Array.isArray(t2)) {
  61. const n = t2[0];
  62. if (n > i2) {
  63. const s4 = i(n, i2);
  64. t2[0] = n + s4 * (-2 * i2);
  65. } else if (n < s3) {
  66. const i3 = i(n, s3);
  67. t2[0] = n + i3 * (-2 * s3);
  68. }
  69. } else {
  70. const n = t2.x;
  71. if (n > i2) {
  72. const s4 = i(n, i2);
  73. t2.x += s4 * (-2 * i2);
  74. } else if (n < s3) {
  75. const i3 = i(n, s3);
  76. t2.x += i3 * (-2 * s3);
  77. }
  78. }
  79. return t2;
  80. }
  81. function I(t2, i2) {
  82. const s3 = [], { ymin: n, ymax: e, xmin: h2, xmax: o } = t2, r2 = t2.xmax - t2.xmin, [u2, m] = i2.valid, { x, frameId: l2 } = g(t2.xmin, i2), { x: c3, frameId: a } = g(t2.xmax, i2), p2 = x === c3 && r2 > 0;
  83. if (r2 > 2 * m) {
  84. const t3 = { xmin: h2 < o ? x : c3, ymin: n, xmax: m, ymax: e }, i3 = { xmin: u2, ymin: n, xmax: h2 < o ? c3 : x, ymax: e }, r3 = { xmin: 0, ymin: n, xmax: m, ymax: e }, p3 = { xmin: u2, ymin: n, xmax: 0, ymax: e }, f3 = [], _2 = [];
  85. v(t3, r3) && f3.push(l2), v(t3, p3) && _2.push(l2), v(i3, r3) && f3.push(a), v(i3, p3) && _2.push(a);
  86. for (let s4 = l2 + 1; s4 < a; s4++)
  87. f3.push(s4), _2.push(s4);
  88. s3.push(new C(t3, [l2]), new C(i3, [a]), new C(r3, f3), new C(p3, _2));
  89. } else
  90. x > c3 || p2 ? s3.push(new C({ xmin: x, ymin: n, xmax: m, ymax: e }, [l2]), new C({ xmin: u2, ymin: n, xmax: c3, ymax: e }, [a])) : s3.push(new C({ xmin: x, ymin: n, xmax: c3, ymax: e }, [l2]));
  91. return s3;
  92. }
  93. function g(t2, i2) {
  94. const [s3, n] = i2.valid, e = 2 * n;
  95. let h2, o = 0;
  96. return t2 > n ? (h2 = Math.ceil(Math.abs(t2 - n) / e), t2 -= h2 * e, o = h2) : t2 < s3 && (h2 = Math.ceil(Math.abs(t2 - s3) / e), t2 += h2 * e, o = -h2), { x: t2, frameId: o };
  97. }
  98. function v(t2, i2) {
  99. const { xmin: s3, ymin: n, xmax: e, ymax: h2 } = i2;
  100. return O(t2, s3, n) && O(t2, s3, h2) && O(t2, e, h2) && O(t2, e, n);
  101. }
  102. function O(t2, i2, s3) {
  103. return i2 >= t2.xmin && i2 <= t2.xmax && s3 >= t2.ymin && s3 <= t2.ymax;
  104. }
  105. function P(t2, i2, s3 = true) {
  106. const e = !y(t2);
  107. if (e && h(t2), s3) {
  108. return new T().cut(t2, i2);
  109. }
  110. const h2 = e ? t2.rings : t2.paths, o = e ? 4 : 2, r2 = h2.length, m = -2 * i2;
  111. for (let n = 0; n < r2; n++) {
  112. const t3 = h2[n];
  113. if (t3 && t3.length >= o) {
  114. const i3 = [];
  115. for (const s4 of t3)
  116. i3.push([s4[0] + m, s4[1]]);
  117. h2.push(i3);
  118. }
  119. }
  120. return e ? t2.rings = h2 : t2.paths = h2, t2;
  121. }
  122. var C = class {
  123. constructor(t2, i2) {
  124. this.extent = t2, this.frameIds = i2;
  125. }
  126. };
  127. var S = u();
  128. var T = class {
  129. constructor() {
  130. this.linesIn = [], this.linesOut = [];
  131. }
  132. cut(t2, i2) {
  133. let s3;
  134. if (this.xCut = i2, t2.rings)
  135. this.closed = true, s3 = t2.rings, this.minPts = 4;
  136. else {
  137. if (!t2.paths)
  138. return null;
  139. this.closed = false, s3 = t2.paths, this.minPts = 2;
  140. }
  141. for (const e of s3) {
  142. if (!e || e.length < this.minPts)
  143. continue;
  144. let t3 = true;
  145. for (const i3 of e)
  146. t3 ? (this.moveTo(i3), t3 = false) : this.lineTo(i3);
  147. this.closed && this.close();
  148. }
  149. this._pushLineIn(), this._pushLineOut(), s3 = [];
  150. for (const e of this.linesIn)
  151. e && e.length >= this.minPts && s3.push(e);
  152. const n = -2 * this.xCut;
  153. for (const e of this.linesOut)
  154. if (e && e.length >= this.minPts) {
  155. for (const t3 of e)
  156. t3[0] += n;
  157. s3.push(e);
  158. }
  159. return this.closed ? t2.rings = s3 : t2.paths = s3, t2;
  160. }
  161. moveTo(t2) {
  162. this._pushLineIn(), this._pushLineOut(), this._prevSide = this._side(t2[0]), this._moveTo(t2[0], t2[1], this._prevSide), this._prevPt = t2, this._firstPt = t2;
  163. }
  164. lineTo(t2) {
  165. const i2 = this._side(t2[0]);
  166. if (i2 * this._prevSide == -1) {
  167. const s3 = this._intersect(this._prevPt, t2);
  168. this._lineTo(this.xCut, s3, 0), this._prevSide = 0, this._lineTo(t2[0], t2[1], i2);
  169. } else
  170. this._lineTo(t2[0], t2[1], i2);
  171. this._prevSide = i2, this._prevPt = t2;
  172. }
  173. close() {
  174. const t2 = this._firstPt, i2 = this._prevPt;
  175. t2[0] === i2[0] && t2[1] === i2[1] || this.lineTo(t2), this._checkClosingPt(this.lineIn), this._checkClosingPt(this.lineOut);
  176. }
  177. _moveTo(t2, i2, s3) {
  178. this.closed ? (this.lineIn.push([s3 <= 0 ? t2 : this.xCut, i2]), this.lineOut.push([s3 >= 0 ? t2 : this.xCut, i2])) : (s3 <= 0 && this.lineIn.push([t2, i2]), s3 >= 0 && this.lineOut.push([t2, i2]));
  179. }
  180. _lineTo(t2, i2, s3) {
  181. this.closed ? (this._addPolyVertex(this.lineIn, s3 <= 0 ? t2 : this.xCut, i2), this._addPolyVertex(this.lineOut, s3 >= 0 ? t2 : this.xCut, i2)) : s3 < 0 ? (this._prevSide === 0 && this._pushLineOut(), this.lineIn.push([t2, i2])) : s3 > 0 ? (this._prevSide === 0 && this._pushLineIn(), this.lineOut.push([t2, i2])) : this._prevSide < 0 ? (this.lineIn.push([t2, i2]), this.lineOut.push([t2, i2])) : this._prevSide > 0 && (this.lineOut.push([t2, i2]), this.lineIn.push([t2, i2]));
  182. }
  183. _addPolyVertex(t2, i2, s3) {
  184. const n = t2.length;
  185. n > 1 && t2[n - 1][0] === i2 && t2[n - 2][0] === i2 ? t2[n - 1][1] = s3 : t2.push([i2, s3]);
  186. }
  187. _checkClosingPt(t2) {
  188. const i2 = t2.length;
  189. i2 > 3 && t2[0][0] === this.xCut && t2[i2 - 2][0] === this.xCut && t2[1][0] === this.xCut && (t2[0][1] = t2[i2 - 2][1], t2.pop());
  190. }
  191. _side(t2) {
  192. return t2 < this.xCut ? -1 : t2 > this.xCut ? 1 : 0;
  193. }
  194. _intersect(t2, i2) {
  195. const s3 = (this.xCut - t2[0]) / (i2[0] - t2[0]);
  196. return t2[1] + s3 * (i2[1] - t2[1]);
  197. }
  198. _pushLineIn() {
  199. this.lineIn && this.lineIn.length >= this.minPts && this.linesIn.push(this.lineIn), this.lineIn = [];
  200. }
  201. _pushLineOut() {
  202. this.lineOut && this.lineOut.length >= this.minPts && this.linesOut.push(this.lineOut), this.lineOut = [];
  203. }
  204. };
  205. export {
  206. p,
  207. f2 as f
  208. };
  209. //# sourceMappingURL=chunk-CR67YDNV.js.map