123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- import {
- t as t2
- } from "./chunk-XZA4MVET.js";
- import {
- fn,
- ln
- } from "./chunk-DH2OBAUC.js";
- import {
- d,
- g,
- y
- } from "./chunk-ECW2QABR.js";
- import {
- E,
- I,
- k
- } from "./chunk-MRJEICT6.js";
- import {
- r,
- t
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/layers/graphics/data/projectionSupport.js
- var h = [0, 0];
- function c(s, t3) {
- if (!t3)
- return null;
- if ("x" in t3) {
- const e2 = { x: 0, y: 0 };
- 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;
- }
- if ("xmin" in t3) {
- const e2 = { xmin: 0, ymin: 0, xmax: 0, ymax: 0 };
- 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;
- }
- 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;
- }
- function p(s, t3) {
- const e2 = [];
- for (const n2 of s)
- e2.push(l(n2, t3));
- return e2;
- }
- function l(s, t3) {
- const e2 = [];
- for (const n2 of s) {
- const s2 = t3(n2[0], n2[1], [0, 0]);
- e2.push(s2), n2.length > 2 && s2.push(n2[2]), n2.length > 3 && s2.push(n2[3]);
- }
- return e2;
- }
- async function f(e2, n2) {
- if (!n2)
- return;
- const r3 = Array.isArray(e2) ? e2.map((t3) => r(t3.geometry) && t3.geometry.spatialReference) : [e2];
- await fn(r3.map((s) => ({ source: s, dest: n2 })));
- }
- var x = c.bind(null, y);
- var y2 = c.bind(null, d);
- function g2(s, t3, a, m) {
- if (!s)
- return s;
- if (a || (a = t3, t3 = s.spatialReference), !I(t3) || !I(a) || E(t3, a))
- return s;
- if (g(t3, a)) {
- const t4 = k(a) ? x(s) : y2(s);
- return t4.spatialReference = a, t4;
- }
- return ln(t2, [s], t3, a, null, m)[0];
- }
- var _ = class {
- constructor() {
- this._jobs = [], this._timer = null, this._process = this._process.bind(this);
- }
- async push(s, t3, e2) {
- if (!s || !s.length || !t3 || !e2 || E(t3, e2))
- return s;
- const n2 = { geometries: s, inSpatialReference: t3, outSpatialReference: e2, resolve: null };
- return this._jobs.push(n2), new Promise((s2) => {
- n2.resolve = s2, this._timer === null && (this._timer = setTimeout(this._process, 10));
- });
- }
- _process() {
- this._timer = null;
- const s = this._jobs.shift();
- if (!s)
- return;
- const { geometries: t3, inSpatialReference: r3, outSpatialReference: i, resolve: a } = s;
- 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));
- }
- };
- var j = new _();
- function M(s, t3, e2) {
- return j.push(s, t3, e2);
- }
- // node_modules/@arcgis/core/layers/graphics/centroid.js
- function n(t3, n2) {
- return t3 ? n2 ? 4 : 3 : n2 ? 3 : 2;
- }
- function e(e2, o2, u2, N2, l3) {
- if (t(o2) || !o2.lengths.length)
- return null;
- const s = l3?.originPosition === "upperLeft" ? -1 : 1;
- e2.lengths.length && (e2.lengths.length = 0), e2.coords.length && (e2.coords.length = 0);
- 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);
- let E2 = 0;
- for (const t3 of T) {
- const n2 = r2(i, h2, E2, t3, u2, N2, s);
- n2 && f2.push(n2), E2 += t3 * g3;
- }
- if (f2.sort((t3, n2) => {
- let e3 = s * t3[2] - s * n2[2];
- return e3 === 0 && u2 && (e3 = t3[4] - n2[4]), e3;
- }), f2.length) {
- let t3 = 6 * f2[0][2];
- 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);
- }
- if (!c2.length) {
- const t3 = o2.lengths[0] ? I2(h2, 0, T[0], u2, N2) : null;
- if (!t3)
- return null;
- c2[0] = t3[0], c2[1] = t3[1], u2 && t3.length > 2 && (c2[2] = t3[2]);
- }
- return e2;
- }
- function r2(t3, e2, r3, I3, o2, u2, N2 = 1) {
- const l3 = n(o2, u2);
- let s = r3, c2 = r3 + l3, f2 = 0, i = 0, T = 0, h2 = 0, g3 = 0;
- for (let n2 = 0, m = I3 - 1; n2 < m; n2++, s += l3, c2 += l3) {
- const n3 = e2[s], r4 = e2[s + 1], I4 = e2[s + 2], u3 = e2[c2], N3 = e2[c2 + 1], l4 = e2[c2 + 2];
- let E3 = n3 * N3 - u3 * r4;
- 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));
- }
- if (h2 * N2 > 0 && (h2 *= -1), g3 * N2 > 0 && (g3 *= -1), !h2)
- return null;
- const E2 = [f2, i, 0.5 * h2];
- return o2 && (E2[3] = T, E2[4] = 0.5 * g3), E2;
- }
- function I2(t3, e2, r3, I3, s) {
- const c2 = n(I3, s);
- let f2 = e2, i = e2 + c2, T = 0, h2 = 0, g3 = 0, E2 = 0;
- for (let n2 = 0, m = r3 - 1; n2 < m; n2++, f2 += c2, i += c2) {
- 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);
- if (b)
- if (T += b, I3) {
- const t4 = l2(n3, e3, r4, s2, c3, m2);
- h2 += b * t4[0], g3 += b * t4[1], E2 += b * t4[2];
- } else {
- const t4 = N(n3, e3, s2, c3);
- h2 += b * t4[0], g3 += b * t4[1];
- }
- }
- 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;
- }
- function o(t3, n2, e2, r3) {
- const I3 = e2 - t3, o2 = r3 - n2;
- return Math.sqrt(I3 * I3 + o2 * o2);
- }
- function u(t3, n2, e2, r3, I3, o2) {
- const u2 = r3 - t3, N2 = I3 - n2, l3 = o2 - e2;
- return Math.sqrt(u2 * u2 + N2 * N2 + l3 * l3);
- }
- function N(t3, n2, e2, r3) {
- return [t3 + 0.5 * (e2 - t3), n2 + 0.5 * (r3 - n2)];
- }
- function l2(t3, n2, e2, r3, I3, o2) {
- return [t3 + 0.5 * (r3 - t3), n2 + 0.5 * (I3 - n2), e2 + 0.5 * (o2 - e2)];
- }
- export {
- e,
- f,
- g2 as g,
- M
- };
- //# sourceMappingURL=chunk-M5BTTMP6.js.map
|