chunk-P4UZNLD5.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import {
  2. a,
  3. c,
  4. d,
  5. v as v2
  6. } from "./chunk-2Z6LERTI.js";
  7. import {
  8. m2 as m,
  9. v2 as v
  10. } from "./chunk-OWVBLVP3.js";
  11. import {
  12. U
  13. } from "./chunk-VNFRAYHO.js";
  14. import {
  15. j as j2
  16. } from "./chunk-VBRY5KJM.js";
  17. import {
  18. R as R2,
  19. j
  20. } from "./chunk-ECW2QABR.js";
  21. import {
  22. R,
  23. k2 as k
  24. } from "./chunk-MRJEICT6.js";
  25. import {
  26. r as r2,
  27. s,
  28. s3 as s2
  29. } from "./chunk-EMJ4ZSM2.js";
  30. import {
  31. r,
  32. t
  33. } from "./chunk-GZT4BVFP.js";
  34. // node_modules/@arcgis/core/geometry/support/normalizeUtilsCommon.js
  35. var r3 = { 102100: { maxX: 20037508342788905e-9, minX: -20037508342788905e-9, plus180Line: new m({ paths: [[[20037508342788905e-9, -20037508342788905e-9], [20037508342788905e-9, 20037508342788905e-9]]], spatialReference: k.WebMercator }), minus180Line: new m({ paths: [[[-20037508342788905e-9, -20037508342788905e-9], [-20037508342788905e-9, 20037508342788905e-9]]], spatialReference: k.WebMercator }) }, 4326: { maxX: 180, minX: -180, plus180Line: new m({ paths: [[[180, -180], [180, 180]]], spatialReference: k.WGS84 }), minus180Line: new m({ paths: [[[-180, -180], [-180, 180]]], spatialReference: k.WGS84 }) } };
  36. function i(e, n2) {
  37. return Math.ceil((e - n2) / (2 * n2));
  38. }
  39. function s3(e, n2) {
  40. const t2 = o(e);
  41. for (const r4 of t2)
  42. for (const e2 of r4)
  43. e2[0] += n2;
  44. return e;
  45. }
  46. function o(e) {
  47. return c(e) ? e.rings : e.paths;
  48. }
  49. // node_modules/@arcgis/core/rest/geometry/cut.js
  50. async function o2(o3, i3, n2, m2) {
  51. const p = typeof o3 == "string" ? j2(o3) : o3, a2 = i3[0].spatialReference, u = { ...m2, query: { ...p.query, f: "json", sr: JSON.stringify(a2), target: JSON.stringify({ geometryType: v2(i3[0]), geometries: i3 }), cutter: JSON.stringify(n2) } }, c2 = await U(p.path + "/cut", u), { cutIndexes: f, geometries: g = [] } = c2.data;
  52. return { cutIndexes: f, geometries: g.map((e) => {
  53. const t2 = d(e);
  54. return t2.spatialReference = a2, t2;
  55. }) };
  56. }
  57. // node_modules/@arcgis/core/rest/geometry/simplify.js
  58. async function i2(o3, i3, f) {
  59. const m2 = typeof o3 == "string" ? j2(o3) : o3, p = i3[0].spatialReference, a2 = v2(i3[0]), u = { ...f, query: { ...m2.query, f: "json", sr: p.wkid ? p.wkid : JSON.stringify(p), geometries: JSON.stringify(s4(i3)) } };
  60. return n((await U(m2.path + "/simplify", u)).data, a2, p);
  61. }
  62. function s4(r4) {
  63. return { geometryType: v2(r4[0]), geometries: r4.map((r5) => r5.toJSON()) };
  64. }
  65. function n(r4, t2, e) {
  66. const i3 = a(t2);
  67. return r4.map((r5) => {
  68. const t3 = i3.fromJSON(r5);
  69. return t3.spatialReference = e, t3;
  70. });
  71. }
  72. // node_modules/@arcgis/core/geometry/support/normalizeUtils.js
  73. var y = s.getLogger("esri.geometry.support.normalizeUtils");
  74. function x(t2) {
  75. return t2.type === "polygon";
  76. }
  77. function d2(t2) {
  78. return t2[0].type === "polygon";
  79. }
  80. function w(t2) {
  81. return t2[0].type === "polyline";
  82. }
  83. function M(t2, n2) {
  84. if (!(t2 instanceof m || t2 instanceof v)) {
  85. const t3 = "straightLineDensify: the input geometry is neither polyline nor polygon";
  86. throw y.error(t3), new s2(t3);
  87. }
  88. const o3 = o(t2), s5 = [];
  89. for (const e of o3) {
  90. const t3 = [];
  91. s5.push(t3), t3.push([e[0][0], e[0][1]]);
  92. for (let o4 = 0; o4 < e.length - 1; o4++) {
  93. const s6 = e[o4][0], r4 = e[o4][1], i3 = e[o4 + 1][0], l = e[o4 + 1][1], f = Math.sqrt((i3 - s6) * (i3 - s6) + (l - r4) * (l - r4)), c2 = (l - r4) / f, p = (i3 - s6) / f, u = f / n2;
  94. if (u > 1) {
  95. for (let l2 = 1; l2 <= u - 1; l2++) {
  96. const e3 = l2 * n2, o6 = p * e3 + s6, i5 = c2 * e3 + r4;
  97. t3.push([o6, i5]);
  98. }
  99. const e2 = (f + Math.floor(u - 1) * n2) / 2, o5 = p * e2 + s6, i4 = c2 * e2 + r4;
  100. t3.push([o5, i4]);
  101. }
  102. t3.push([i3, l]);
  103. }
  104. }
  105. return x(t2) ? new v({ rings: s5, spatialReference: t2.spatialReference }) : new m({ paths: s5, spatialReference: t2.spatialReference });
  106. }
  107. function R3(t2, e, n2) {
  108. if (e) {
  109. const e2 = M(t2, 1e6);
  110. t2 = j(e2, true);
  111. }
  112. return n2 && (t2 = s3(t2, n2)), t2;
  113. }
  114. function b(t2, e, n2) {
  115. if (Array.isArray(t2)) {
  116. const o3 = t2[0];
  117. if (o3 > e) {
  118. const n3 = i(o3, e);
  119. t2[0] = o3 + n3 * (-2 * e);
  120. } else if (o3 < n2) {
  121. const e2 = i(o3, n2);
  122. t2[0] = o3 + e2 * (-2 * n2);
  123. }
  124. } else {
  125. const o3 = t2.x;
  126. if (o3 > e) {
  127. const n3 = i(o3, e);
  128. t2 = t2.clone().offset(n3 * (-2 * e), 0);
  129. } else if (o3 < n2) {
  130. const e2 = i(o3, n2);
  131. t2 = t2.clone().offset(e2 * (-2 * n2), 0);
  132. }
  133. }
  134. return t2;
  135. }
  136. function P(t2, e) {
  137. let n2 = -1;
  138. for (let o3 = 0; o3 < e.cutIndexes.length; o3++) {
  139. const s5 = e.cutIndexes[o3], r4 = e.geometries[o3], i3 = o(r4);
  140. for (let t3 = 0; t3 < i3.length; t3++) {
  141. const e2 = i3[t3];
  142. e2.some((n3) => {
  143. if (n3[0] < 180)
  144. return true;
  145. {
  146. let n4 = 0;
  147. for (let t4 = 0; t4 < e2.length; t4++) {
  148. const o5 = e2[t4][0];
  149. n4 = o5 > n4 ? o5 : n4;
  150. }
  151. n4 = Number(n4.toFixed(9));
  152. const o4 = -360 * i(n4, 180);
  153. for (let s6 = 0; s6 < e2.length; s6++) {
  154. const e3 = r4.getPoint(t3, s6);
  155. r4.setPoint(t3, s6, e3.clone().offset(o4, 0));
  156. }
  157. return true;
  158. }
  159. });
  160. }
  161. if (s5 === n2) {
  162. if (d2(t2))
  163. for (const e2 of o(r4))
  164. t2[s5] = t2[s5].addRing(e2);
  165. else if (w(t2))
  166. for (const e2 of o(r4))
  167. t2[s5] = t2[s5].addPath(e2);
  168. } else
  169. n2 = s5, t2[s5] = r4;
  170. }
  171. return t2;
  172. }
  173. async function L(e, n2, l) {
  174. if (!Array.isArray(e))
  175. return L([e], n2);
  176. n2 && typeof n2 != "string" && y.warn("normalizeCentralMeridian()", "The url object is deprecated, use the url string instead");
  177. const h = typeof n2 == "string" ? n2 : n2?.url ?? r2.geometryServiceUrl;
  178. let x2, d3, w2, j3, M2, U2, z2, A, v3 = 0;
  179. const k2 = [], C = [];
  180. for (const t2 of e)
  181. if (t(t2))
  182. C.push(t2);
  183. else if (x2 || (x2 = t2.spatialReference, d3 = R(x2), w2 = x2.isWebMercator, U2 = w2 ? 102100 : 4326, j3 = r3[U2].maxX, M2 = r3[U2].minX, z2 = r3[U2].plus180Line, A = r3[U2].minus180Line), d3)
  184. if (t2.type === "mesh")
  185. C.push(t2);
  186. else if (t2.type === "point")
  187. C.push(b(t2.clone(), j3, M2));
  188. else if (t2.type === "multipoint") {
  189. const e2 = t2.clone();
  190. e2.points = e2.points.map((t3) => b(t3, j3, M2)), C.push(e2);
  191. } else if (t2.type === "extent") {
  192. const e2 = t2.clone()._normalize(false, false, d3);
  193. C.push(e2.rings ? new v(e2) : e2);
  194. } else if (t2.extent) {
  195. const e2 = t2.extent, n3 = i(e2.xmin, M2) * (2 * j3);
  196. let o3 = n3 === 0 ? t2.clone() : s3(t2.clone(), n3);
  197. e2.offset(n3, 0), e2.intersects(z2) && e2.xmax !== j3 ? (v3 = e2.xmax > v3 ? e2.xmax : v3, o3 = R3(o3, w2), k2.push(o3), C.push("cut")) : e2.intersects(A) && e2.xmin !== M2 ? (v3 = e2.xmax * (2 * j3) > v3 ? e2.xmax * (2 * j3) : v3, o3 = R3(o3, w2, 360), k2.push(o3), C.push("cut")) : C.push(o3);
  198. } else
  199. C.push(t2.clone());
  200. else
  201. C.push(t2);
  202. let I = i(v3, j3), X = -90;
  203. const q = I, D = new m();
  204. for (; I > 0; ) {
  205. const t2 = 360 * I - 180;
  206. D.addPath([[t2, X], [t2, -1 * X]]), X *= -1, I--;
  207. }
  208. if (k2.length > 0 && q > 0) {
  209. const t2 = P(k2, await o2(h, k2, D, l)), n3 = [], o3 = [];
  210. for (let l2 = 0; l2 < C.length; l2++) {
  211. const r5 = C[l2];
  212. if (r5 !== "cut")
  213. o3.push(r5);
  214. else {
  215. const r6 = t2.shift(), i4 = e[l2];
  216. r(i4) && i4.type === "polygon" && i4.rings && i4.rings.length > 1 && r6.rings.length >= i4.rings.length ? (n3.push(r6), o3.push("simplify")) : o3.push(w2 ? R2(r6) : r6);
  217. }
  218. }
  219. if (!n3.length)
  220. return o3;
  221. const r4 = await i2(h, n3, l), i3 = [];
  222. for (let e2 = 0; e2 < o3.length; e2++) {
  223. const t3 = o3[e2];
  224. t3 !== "simplify" ? i3.push(t3) : i3.push(w2 ? R2(r4.shift()) : r4.shift());
  225. }
  226. return i3;
  227. }
  228. const E = [];
  229. for (let t2 = 0; t2 < C.length; t2++) {
  230. const e2 = C[t2];
  231. if (e2 !== "cut")
  232. E.push(e2);
  233. else {
  234. const t3 = k2.shift();
  235. E.push(w2 === true ? R2(t3) : t3);
  236. }
  237. }
  238. return E;
  239. }
  240. function z(t2, e) {
  241. const n2 = R(e);
  242. if (n2) {
  243. const [e2, o3] = n2.valid, s5 = o3 - e2;
  244. if (t2 < e2)
  245. for (; t2 < e2; )
  246. t2 += s5;
  247. if (t2 > o3)
  248. for (; t2 > o3; )
  249. t2 -= s5;
  250. }
  251. return t2;
  252. }
  253. export {
  254. r3 as r,
  255. i,
  256. s3 as s,
  257. L,
  258. z
  259. };
  260. //# sourceMappingURL=chunk-P4UZNLD5.js.map