chunk-NLNXEWKQ.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. import {
  2. e,
  3. l,
  4. s,
  5. u
  6. } from "./chunk-HEFAWVPH.js";
  7. import {
  8. a,
  9. c,
  10. r
  11. } from "./chunk-PJ6KSXOD.js";
  12. import {
  13. E,
  14. G,
  15. I,
  16. L,
  17. Se,
  18. X,
  19. ge,
  20. he,
  21. ne,
  22. oe,
  23. se,
  24. ye,
  25. z
  26. } from "./chunk-25BNEBXZ.js";
  27. import {
  28. z as z2
  29. } from "./chunk-O4FY3ITT.js";
  30. import {
  31. d
  32. } from "./chunk-2Z6LERTI.js";
  33. import {
  34. m,
  35. m2,
  36. v2 as v
  37. } from "./chunk-OWVBLVP3.js";
  38. import {
  39. s as s2
  40. } from "./chunk-R5IG2D6H.js";
  41. import {
  42. M2 as M,
  43. j2 as j,
  44. p
  45. } from "./chunk-ECW2QABR.js";
  46. // node_modules/@arcgis/core/arcade/functions/geomsync.js
  47. var P = null;
  48. function Z(e2) {
  49. return s2.indexOf("4.") === 0 ? v.fromExtent(e2) : new v({ spatialReference: e2.spatialReference, rings: [[[e2.xmin, e2.ymin], [e2.xmin, e2.ymax], [e2.xmax, e2.ymax], [e2.xmax, e2.ymin], [e2.xmin, e2.ymin]]] });
  50. }
  51. function b(n) {
  52. P = n;
  53. }
  54. function v2(n, e2) {
  55. if (n.type !== "polygon" && n.type !== "polyline" && n.type !== "extent")
  56. return 0;
  57. let r2 = 1;
  58. if (n.spatialReference.vcsWkid || n.spatialReference.latestVcsWkid) {
  59. r2 = s(n.spatialReference) / z2(n.spatialReference);
  60. }
  61. let t = 0;
  62. if (n.type === "polyline")
  63. for (const i of n.paths)
  64. for (let n2 = 1; n2 < i.length; n2++)
  65. t += e(i[n2], i[n2 - 1], r2);
  66. else if (n.type === "polygon")
  67. for (const i of n.rings) {
  68. for (let n2 = 1; n2 < i.length; n2++)
  69. t += e(i[n2], i[n2 - 1], r2);
  70. (i[0][0] !== i[i.length - 1][0] || i[0][1] !== i[i.length - 1][1] || i[0][2] !== void 0 && i[0][2] !== i[i.length - 1][2]) && (t += e(i[0], i[i.length - 1], r2));
  71. }
  72. else
  73. n.type === "extent" && (t += 2 * e([n.xmin, n.ymin, 0], [n.xmax, n.ymin, 0], r2), t += 2 * e([n.xmin, n.ymin, 0], [n.xmin, n.ymax, 0], r2), t *= 2, t += 4 * Math.abs(I(n.zmax, 0) * r2 - I(n.zmin, 0) * r2));
  74. const l2 = new m2({ hasZ: false, hasM: false, spatialReference: n.spatialReference, paths: [[0, 0], [0, t]] });
  75. return P.planarLength(l2, e2);
  76. }
  77. function z3(n, I2) {
  78. function y(n2) {
  79. if (G(n2, 2, 2), n2[0] instanceof p && n2[1] instanceof p)
  80. ;
  81. else if (n2[0] instanceof p && n2[1] === null)
  82. ;
  83. else if (n2[1] instanceof p && n2[0] === null)
  84. ;
  85. else if (n2[0] !== null || n2[1] !== null)
  86. throw new Error("Illegal Argument");
  87. }
  88. n.disjoint = function(n2, e2) {
  89. return I2(n2, e2, function(n3, e3, r2) {
  90. return y(r2 = ye(r2)), r2[0] === null || r2[1] === null || P.disjoint(r2[0], r2[1]);
  91. });
  92. }, n.intersects = function(n2, e2) {
  93. return I2(n2, e2, function(n3, e3, r2) {
  94. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.intersects(r2[0], r2[1]);
  95. });
  96. }, n.touches = function(n2, e2) {
  97. return I2(n2, e2, function(n3, e3, r2) {
  98. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.touches(r2[0], r2[1]);
  99. });
  100. }, n.crosses = function(n2, e2) {
  101. return I2(n2, e2, function(n3, e3, r2) {
  102. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.crosses(r2[0], r2[1]);
  103. });
  104. }, n.within = function(n2, e2) {
  105. return I2(n2, e2, function(n3, e3, r2) {
  106. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.within(r2[0], r2[1]);
  107. });
  108. }, n.contains = function(n2, e2) {
  109. return I2(n2, e2, function(n3, e3, r2) {
  110. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.contains(r2[0], r2[1]);
  111. });
  112. }, n.overlaps = function(n2, e2) {
  113. return I2(n2, e2, function(n3, e3, r2) {
  114. return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.overlaps(r2[0], r2[1]);
  115. });
  116. }, n.equals = function(n2, e2) {
  117. return I2(n2, e2, function(n3, e3, r2) {
  118. return G(r2, 2, 2), r2[0] === r2[1] || (r2[0] instanceof p && r2[1] instanceof p ? P.equals(r2[0], r2[1]) : !(!z(r2[0]) || !z(r2[1])) && r2[0].getTime() === r2[1].getTime());
  119. });
  120. }, n.relate = function(n2, e2) {
  121. return I2(n2, e2, function(n3, e3, r2) {
  122. if (r2 = ye(r2), G(r2, 3, 3), r2[0] instanceof p && r2[1] instanceof p)
  123. return P.relate(r2[0], r2[1], X(r2[2]));
  124. if (r2[0] instanceof p && r2[1] === null)
  125. return false;
  126. if (r2[1] instanceof p && r2[0] === null)
  127. return false;
  128. if (r2[0] === null && r2[1] === null)
  129. return false;
  130. throw new Error("Illegal Argument");
  131. });
  132. }, n.intersection = function(n2, e2) {
  133. return I2(n2, e2, function(n3, e3, r2) {
  134. return y(r2 = ye(r2)), r2[0] === null || r2[1] === null ? null : P.intersect(r2[0], r2[1]);
  135. });
  136. }, n.union = function(n2, r2) {
  137. return I2(n2, r2, function(r3, t, i) {
  138. const o = [];
  139. if ((i = ye(i)).length === 0)
  140. throw new Error("Function called with wrong number of Parameters");
  141. if (i.length === 1)
  142. if (L(i[0])) {
  143. const n3 = ye(i[0]);
  144. for (let e2 = 0; e2 < n3.length; e2++)
  145. if (n3[e2] !== null) {
  146. if (!(n3[e2] instanceof p))
  147. throw new Error("Illegal Argument");
  148. o.push(n3[e2]);
  149. }
  150. } else {
  151. if (!E(i[0])) {
  152. if (i[0] instanceof p)
  153. return se(c(i[0]), n2.spatialReference);
  154. if (i[0] === null)
  155. return null;
  156. throw new Error("Illegal Argument");
  157. }
  158. {
  159. const n3 = ye(i[0].toArray());
  160. for (let e2 = 0; e2 < n3.length; e2++)
  161. if (n3[e2] !== null) {
  162. if (!(n3[e2] instanceof p))
  163. throw new Error("Illegal Argument");
  164. o.push(n3[e2]);
  165. }
  166. }
  167. }
  168. else
  169. for (let n3 = 0; n3 < i.length; n3++)
  170. if (i[n3] !== null) {
  171. if (!(i[n3] instanceof p))
  172. throw new Error("Illegal Argument");
  173. o.push(i[n3]);
  174. }
  175. return o.length === 0 ? null : P.union(o);
  176. });
  177. }, n.difference = function(n2, r2) {
  178. return I2(n2, r2, function(n3, r3, t) {
  179. return y(t = ye(t)), t[0] !== null && t[1] === null ? c(t[0]) : t[0] === null ? null : P.difference(t[0], t[1]);
  180. });
  181. }, n.symmetricdifference = function(n2, r2) {
  182. return I2(n2, r2, function(n3, r3, t) {
  183. return y(t = ye(t)), t[0] === null && t[1] === null ? null : t[0] === null ? c(t[1]) : t[1] === null ? c(t[0]) : P.symmetricDifference(t[0], t[1]);
  184. });
  185. }, n.clip = function(n2, e2) {
  186. return I2(n2, e2, function(n3, e3, r2) {
  187. if (r2 = ye(r2), G(r2, 2, 2), !(r2[1] instanceof M) && r2[1] !== null)
  188. throw new Error("Illegal Argument");
  189. if (r2[0] === null)
  190. return null;
  191. if (!(r2[0] instanceof p))
  192. throw new Error("Illegal Argument");
  193. return r2[1] === null ? null : P.clip(r2[0], r2[1]);
  194. });
  195. }, n.cut = function(n2, r2) {
  196. return I2(n2, r2, function(n3, r3, t) {
  197. if (t = ye(t), G(t, 2, 2), !(t[1] instanceof m2) && t[1] !== null)
  198. throw new Error("Illegal Argument");
  199. if (t[0] === null)
  200. return [];
  201. if (!(t[0] instanceof p))
  202. throw new Error("Illegal Argument");
  203. return t[1] === null ? [c(t[0])] : P.cut(t[0], t[1]);
  204. });
  205. }, n.area = function(n2, e2) {
  206. return I2(n2, e2, function(e3, t, o) {
  207. if (G(o, 1, 2), (o = ye(o))[0] === null)
  208. return 0;
  209. if (L(o[0]) || E(o[0])) {
  210. const e4 = ge(o[0], n2.spatialReference);
  211. return e4 === null ? 0 : P.planarArea(e4, r(I(o[1], -1)));
  212. }
  213. if (!(o[0] instanceof p))
  214. throw new Error("Illegal Argument");
  215. return P.planarArea(o[0], r(I(o[1], -1)));
  216. });
  217. }, n.areageodetic = function(n2, e2) {
  218. return I2(n2, e2, function(e3, t, o) {
  219. if (G(o, 1, 2), (o = ye(o))[0] === null)
  220. return 0;
  221. if (L(o[0]) || E(o[0])) {
  222. const e4 = ge(o[0], n2.spatialReference);
  223. return e4 === null ? 0 : P.geodesicArea(e4, r(I(o[1], -1)));
  224. }
  225. if (!(o[0] instanceof p))
  226. throw new Error("Illegal Argument");
  227. return P.geodesicArea(o[0], r(I(o[1], -1)));
  228. });
  229. }, n.length = function(n2, e2) {
  230. return I2(n2, e2, function(e3, r2, o) {
  231. if (G(o, 1, 2), (o = ye(o))[0] === null)
  232. return 0;
  233. if (L(o[0]) || E(o[0])) {
  234. const e4 = he(o[0], n2.spatialReference);
  235. return e4 === null ? 0 : P.planarLength(e4, a(I(o[1], -1)));
  236. }
  237. if (!(o[0] instanceof p))
  238. throw new Error("Illegal Argument");
  239. return P.planarLength(o[0], a(I(o[1], -1)));
  240. });
  241. }, n.length3d = function(n2, e2) {
  242. return I2(n2, e2, function(e3, r2, o) {
  243. if (G(o, 1, 2), (o = ye(o))[0] === null)
  244. return 0;
  245. if (L(o[0]) || E(o[0])) {
  246. const e4 = he(o[0], n2.spatialReference);
  247. return e4 === null ? 0 : e4.hasZ === true ? v2(e4, a(I(o[1], -1))) : P.planarLength(e4, a(I(o[1], -1)));
  248. }
  249. if (!(o[0] instanceof p))
  250. throw new Error("Illegal Argument");
  251. return o[0].hasZ === true ? v2(o[0], a(I(o[1], -1))) : P.planarLength(o[0], a(I(o[1], -1)));
  252. });
  253. }, n.lengthgeodetic = function(n2, e2) {
  254. return I2(n2, e2, function(e3, r2, o) {
  255. if (G(o, 1, 2), (o = ye(o))[0] === null)
  256. return 0;
  257. if (L(o[0]) || E(o[0])) {
  258. const e4 = he(o[0], n2.spatialReference);
  259. return e4 === null ? 0 : P.geodesicLength(e4, a(I(o[1], -1)));
  260. }
  261. if (!(o[0] instanceof p))
  262. throw new Error("Illegal Argument");
  263. return P.geodesicLength(o[0], a(I(o[1], -1)));
  264. });
  265. }, n.distance = function(n2, e2) {
  266. return I2(n2, e2, function(e3, r2, o) {
  267. o = ye(o), G(o, 2, 3);
  268. let u2 = o[0];
  269. (L(o[0]) || E(o[0])) && (u2 = Se(o[0], n2.spatialReference));
  270. let s3 = o[1];
  271. if ((L(o[1]) || E(o[1])) && (s3 = Se(o[1], n2.spatialReference)), !(u2 instanceof p))
  272. throw new Error("Illegal Argument");
  273. if (!(s3 instanceof p))
  274. throw new Error("Illegal Argument");
  275. return P.distance(u2, s3, a(I(o[2], -1)));
  276. });
  277. }, n.distancegeodetic = function(n2, e2) {
  278. return I2(n2, e2, function(n3, e3, r2) {
  279. r2 = ye(r2), G(r2, 2, 3);
  280. const o = r2[0], u2 = r2[1];
  281. if (!(o instanceof j))
  282. throw new Error("Illegal Argument");
  283. if (!(u2 instanceof j))
  284. throw new Error("Illegal Argument");
  285. const f = new m2({ paths: [], spatialReference: o.spatialReference });
  286. return f.addPath([o, u2]), P.geodesicLength(f, a(I(r2[2], -1)));
  287. });
  288. }, n.densify = function(n2, e2) {
  289. return I2(n2, e2, function(n3, e3, r2) {
  290. if (r2 = ye(r2), G(r2, 2, 3), r2[0] === null)
  291. return null;
  292. if (!(r2[0] instanceof p))
  293. throw new Error("Illegal Argument");
  294. const o = ne(r2[1]);
  295. if (isNaN(o))
  296. throw new Error("Illegal Argument");
  297. if (o <= 0)
  298. throw new Error("Illegal Argument");
  299. return r2[0] instanceof v || r2[0] instanceof m2 ? P.densify(r2[0], o, a(I(r2[2], -1))) : r2[0] instanceof M ? P.densify(Z(r2[0]), o, a(I(r2[2], -1))) : r2[0];
  300. });
  301. }, n.densifygeodetic = function(n2, e2) {
  302. return I2(n2, e2, function(n3, e3, r2) {
  303. if (r2 = ye(r2), G(r2, 2, 3), r2[0] === null)
  304. return null;
  305. if (!(r2[0] instanceof p))
  306. throw new Error("Illegal Argument");
  307. const o = ne(r2[1]);
  308. if (isNaN(o))
  309. throw new Error("Illegal Argument");
  310. if (o <= 0)
  311. throw new Error("Illegal Argument");
  312. return r2[0] instanceof v || r2[0] instanceof m2 ? P.geodesicDensify(r2[0], o, a(I(r2[2], -1))) : r2[0] instanceof M ? P.geodesicDensify(Z(r2[0]), o, a(I(r2[2], -1))) : r2[0];
  313. });
  314. }, n.generalize = function(n2, e2) {
  315. return I2(n2, e2, function(n3, e3, r2) {
  316. if (r2 = ye(r2), G(r2, 2, 4), r2[0] === null)
  317. return null;
  318. if (!(r2[0] instanceof p))
  319. throw new Error("Illegal Argument");
  320. const o = ne(r2[1]);
  321. if (isNaN(o))
  322. throw new Error("Illegal Argument");
  323. return P.generalize(r2[0], o, oe(I(r2[2], true)), a(I(r2[3], -1)));
  324. });
  325. }, n.buffer = function(n2, r2) {
  326. return I2(n2, r2, function(n3, r3, o) {
  327. if (o = ye(o), G(o, 2, 3), o[0] === null)
  328. return null;
  329. if (!(o[0] instanceof p))
  330. throw new Error("Illegal Argument");
  331. const u2 = ne(o[1]);
  332. if (isNaN(u2))
  333. throw new Error("Illegal Argument");
  334. return u2 === 0 ? c(o[0]) : P.buffer(o[0], u2, a(I(o[2], -1)));
  335. });
  336. }, n.buffergeodetic = function(n2, r2) {
  337. return I2(n2, r2, function(n3, r3, o) {
  338. if (o = ye(o), G(o, 2, 3), o[0] === null)
  339. return null;
  340. if (!(o[0] instanceof p))
  341. throw new Error("Illegal Argument");
  342. const u2 = ne(o[1]);
  343. if (isNaN(u2))
  344. throw new Error("Illegal Argument");
  345. return u2 === 0 ? c(o[0]) : P.geodesicBuffer(o[0], u2, a(I(o[2], -1)));
  346. });
  347. }, n.offset = function(n2, e2) {
  348. return I2(n2, e2, function(n3, e3, r2) {
  349. if (r2 = ye(r2), G(r2, 2, 6), r2[0] === null)
  350. return null;
  351. if (!(r2[0] instanceof v || r2[0] instanceof m2))
  352. throw new Error("Illegal Argument");
  353. const o = ne(r2[1]);
  354. if (isNaN(o))
  355. throw new Error("Illegal Argument");
  356. const f = ne(I(r2[4], 10));
  357. if (isNaN(f))
  358. throw new Error("Illegal Argument");
  359. const a2 = ne(I(r2[5], 0));
  360. if (isNaN(a2))
  361. throw new Error("Illegal Argument");
  362. return P.offset(r2[0], o, a(I(r2[2], -1)), X(I(r2[3], "round")).toLowerCase(), f, a2);
  363. });
  364. }, n.rotate = function(n2, e2) {
  365. return I2(n2, e2, function(n3, e3, r2) {
  366. r2 = ye(r2), G(r2, 2, 3);
  367. let t = r2[0];
  368. if (t === null)
  369. return null;
  370. if (!(t instanceof p))
  371. throw new Error("Illegal Argument");
  372. t instanceof M && (t = v.fromExtent(t));
  373. const o = ne(r2[1]);
  374. if (isNaN(o))
  375. throw new Error("Illegal Argument");
  376. const u2 = I(r2[2], null);
  377. if (u2 === null)
  378. return P.rotate(t, o);
  379. if (u2 instanceof j)
  380. return P.rotate(t, o, u2);
  381. throw new Error("Illegal Argument");
  382. });
  383. }, n.centroid = function(n2, r2) {
  384. return I2(n2, r2, function(r3, t, o) {
  385. if (o = ye(o), G(o, 1, 1), o[0] === null)
  386. return null;
  387. let u2 = o[0];
  388. if ((L(o[0]) || E(o[0])) && (u2 = Se(o[0], n2.spatialReference)), u2 === null)
  389. return null;
  390. if (!(u2 instanceof p))
  391. throw new Error("Illegal Argument");
  392. return u2 instanceof j ? se(c(o[0]), n2.spatialReference) : u2 instanceof v ? u2.centroid : u2 instanceof m2 ? l(u2) : u2 instanceof m ? u(u2) : u2 instanceof M ? u2.center : null;
  393. });
  394. }, n.multiparttosinglepart = function(n2, r2) {
  395. return I2(n2, r2, function(r3, t, o) {
  396. o = ye(o), G(o, 1, 1);
  397. const u2 = [];
  398. if (o[0] === null)
  399. return null;
  400. if (!(o[0] instanceof p))
  401. throw new Error("Illegal Argument");
  402. if (o[0] instanceof j)
  403. return [se(c(o[0]), n2.spatialReference)];
  404. if (o[0] instanceof M)
  405. return [se(c(o[0]), n2.spatialReference)];
  406. const f = P.simplify(o[0]);
  407. if (f instanceof v) {
  408. const n3 = [], e2 = [];
  409. for (let r4 = 0; r4 < f.rings.length; r4++)
  410. if (f.isClockwise(f.rings[r4])) {
  411. const e3 = d({ rings: [f.rings[r4]], hasZ: f.hasZ === true, hasM: f.hasM === true, spatialReference: f.spatialReference.toJSON() });
  412. n3.push(e3);
  413. } else
  414. e2.push({ ring: f.rings[r4], pt: f.getPoint(r4, 0) });
  415. for (let r4 = 0; r4 < e2.length; r4++)
  416. for (let t2 = 0; t2 < n3.length; t2++)
  417. if (n3[t2].contains(e2[r4].pt)) {
  418. n3[t2].addRing(e2[r4].ring);
  419. break;
  420. }
  421. return n3;
  422. }
  423. if (f instanceof m2) {
  424. const n3 = [];
  425. for (let e2 = 0; e2 < f.paths.length; e2++) {
  426. const r4 = d({ paths: [f.paths[e2]], hasZ: f.hasZ === true, hasM: f.hasM === true, spatialReference: f.spatialReference.toJSON() });
  427. n3.push(r4);
  428. }
  429. return n3;
  430. }
  431. if (o[0] instanceof m) {
  432. const r4 = se(c(o[0]), n2.spatialReference);
  433. for (let n3 = 0; n3 < r4.points.length; n3++)
  434. u2.push(r4.getPoint(n3));
  435. return u2;
  436. }
  437. return null;
  438. });
  439. }, n.issimple = function(n2, e2) {
  440. return I2(n2, e2, function(n3, e3, r2) {
  441. if (r2 = ye(r2), G(r2, 1, 1), r2[0] === null)
  442. return true;
  443. if (!(r2[0] instanceof p))
  444. throw new Error("Illegal Argument");
  445. return P.isSimple(r2[0]);
  446. });
  447. }, n.simplify = function(n2, e2) {
  448. return I2(n2, e2, function(n3, e3, r2) {
  449. if (r2 = ye(r2), G(r2, 1, 1), r2[0] === null)
  450. return null;
  451. if (!(r2[0] instanceof p))
  452. throw new Error("Illegal Argument");
  453. return P.simplify(r2[0]);
  454. });
  455. };
  456. }
  457. export {
  458. b,
  459. z3 as z
  460. };
  461. //# sourceMappingURL=chunk-NLNXEWKQ.js.map