import { e, l, s, u } from "./chunk-HEFAWVPH.js"; import { a, c, r } from "./chunk-PJ6KSXOD.js"; import { E, G, I, L, Se, X, ge, he, ne, oe, se, ye, z } from "./chunk-25BNEBXZ.js"; import { z as z2 } from "./chunk-O4FY3ITT.js"; import { d } from "./chunk-2Z6LERTI.js"; import { m, m2, v2 as v } from "./chunk-OWVBLVP3.js"; import { s as s2 } from "./chunk-R5IG2D6H.js"; import { M2 as M, j2 as j, p } from "./chunk-ECW2QABR.js"; // node_modules/@arcgis/core/arcade/functions/geomsync.js var P = null; function Z(e2) { 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]]] }); } function b(n) { P = n; } function v2(n, e2) { if (n.type !== "polygon" && n.type !== "polyline" && n.type !== "extent") return 0; let r2 = 1; if (n.spatialReference.vcsWkid || n.spatialReference.latestVcsWkid) { r2 = s(n.spatialReference) / z2(n.spatialReference); } let t = 0; if (n.type === "polyline") for (const i of n.paths) for (let n2 = 1; n2 < i.length; n2++) t += e(i[n2], i[n2 - 1], r2); else if (n.type === "polygon") for (const i of n.rings) { for (let n2 = 1; n2 < i.length; n2++) t += e(i[n2], i[n2 - 1], r2); (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)); } else 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)); const l2 = new m2({ hasZ: false, hasM: false, spatialReference: n.spatialReference, paths: [[0, 0], [0, t]] }); return P.planarLength(l2, e2); } function z3(n, I2) { function y(n2) { if (G(n2, 2, 2), n2[0] instanceof p && n2[1] instanceof p) ; else if (n2[0] instanceof p && n2[1] === null) ; else if (n2[1] instanceof p && n2[0] === null) ; else if (n2[0] !== null || n2[1] !== null) throw new Error("Illegal Argument"); } n.disjoint = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] === null || r2[1] === null || P.disjoint(r2[0], r2[1]); }); }, n.intersects = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.intersects(r2[0], r2[1]); }); }, n.touches = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.touches(r2[0], r2[1]); }); }, n.crosses = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.crosses(r2[0], r2[1]); }); }, n.within = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.within(r2[0], r2[1]); }); }, n.contains = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.contains(r2[0], r2[1]); }); }, n.overlaps = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] !== null && r2[1] !== null && P.overlaps(r2[0], r2[1]); }); }, n.equals = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { 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()); }); }, n.relate = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 3, 3), r2[0] instanceof p && r2[1] instanceof p) return P.relate(r2[0], r2[1], X(r2[2])); if (r2[0] instanceof p && r2[1] === null) return false; if (r2[1] instanceof p && r2[0] === null) return false; if (r2[0] === null && r2[1] === null) return false; throw new Error("Illegal Argument"); }); }, n.intersection = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { return y(r2 = ye(r2)), r2[0] === null || r2[1] === null ? null : P.intersect(r2[0], r2[1]); }); }, n.union = function(n2, r2) { return I2(n2, r2, function(r3, t, i) { const o = []; if ((i = ye(i)).length === 0) throw new Error("Function called with wrong number of Parameters"); if (i.length === 1) if (L(i[0])) { const n3 = ye(i[0]); for (let e2 = 0; e2 < n3.length; e2++) if (n3[e2] !== null) { if (!(n3[e2] instanceof p)) throw new Error("Illegal Argument"); o.push(n3[e2]); } } else { if (!E(i[0])) { if (i[0] instanceof p) return se(c(i[0]), n2.spatialReference); if (i[0] === null) return null; throw new Error("Illegal Argument"); } { const n3 = ye(i[0].toArray()); for (let e2 = 0; e2 < n3.length; e2++) if (n3[e2] !== null) { if (!(n3[e2] instanceof p)) throw new Error("Illegal Argument"); o.push(n3[e2]); } } } else for (let n3 = 0; n3 < i.length; n3++) if (i[n3] !== null) { if (!(i[n3] instanceof p)) throw new Error("Illegal Argument"); o.push(i[n3]); } return o.length === 0 ? null : P.union(o); }); }, n.difference = function(n2, r2) { return I2(n2, r2, function(n3, r3, t) { return y(t = ye(t)), t[0] !== null && t[1] === null ? c(t[0]) : t[0] === null ? null : P.difference(t[0], t[1]); }); }, n.symmetricdifference = function(n2, r2) { return I2(n2, r2, function(n3, r3, t) { 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]); }); }, n.clip = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 2, 2), !(r2[1] instanceof M) && r2[1] !== null) throw new Error("Illegal Argument"); if (r2[0] === null) return null; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); return r2[1] === null ? null : P.clip(r2[0], r2[1]); }); }, n.cut = function(n2, r2) { return I2(n2, r2, function(n3, r3, t) { if (t = ye(t), G(t, 2, 2), !(t[1] instanceof m2) && t[1] !== null) throw new Error("Illegal Argument"); if (t[0] === null) return []; if (!(t[0] instanceof p)) throw new Error("Illegal Argument"); return t[1] === null ? [c(t[0])] : P.cut(t[0], t[1]); }); }, n.area = function(n2, e2) { return I2(n2, e2, function(e3, t, o) { if (G(o, 1, 2), (o = ye(o))[0] === null) return 0; if (L(o[0]) || E(o[0])) { const e4 = ge(o[0], n2.spatialReference); return e4 === null ? 0 : P.planarArea(e4, r(I(o[1], -1))); } if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); return P.planarArea(o[0], r(I(o[1], -1))); }); }, n.areageodetic = function(n2, e2) { return I2(n2, e2, function(e3, t, o) { if (G(o, 1, 2), (o = ye(o))[0] === null) return 0; if (L(o[0]) || E(o[0])) { const e4 = ge(o[0], n2.spatialReference); return e4 === null ? 0 : P.geodesicArea(e4, r(I(o[1], -1))); } if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); return P.geodesicArea(o[0], r(I(o[1], -1))); }); }, n.length = function(n2, e2) { return I2(n2, e2, function(e3, r2, o) { if (G(o, 1, 2), (o = ye(o))[0] === null) return 0; if (L(o[0]) || E(o[0])) { const e4 = he(o[0], n2.spatialReference); return e4 === null ? 0 : P.planarLength(e4, a(I(o[1], -1))); } if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); return P.planarLength(o[0], a(I(o[1], -1))); }); }, n.length3d = function(n2, e2) { return I2(n2, e2, function(e3, r2, o) { if (G(o, 1, 2), (o = ye(o))[0] === null) return 0; if (L(o[0]) || E(o[0])) { const e4 = he(o[0], n2.spatialReference); return e4 === null ? 0 : e4.hasZ === true ? v2(e4, a(I(o[1], -1))) : P.planarLength(e4, a(I(o[1], -1))); } if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); return o[0].hasZ === true ? v2(o[0], a(I(o[1], -1))) : P.planarLength(o[0], a(I(o[1], -1))); }); }, n.lengthgeodetic = function(n2, e2) { return I2(n2, e2, function(e3, r2, o) { if (G(o, 1, 2), (o = ye(o))[0] === null) return 0; if (L(o[0]) || E(o[0])) { const e4 = he(o[0], n2.spatialReference); return e4 === null ? 0 : P.geodesicLength(e4, a(I(o[1], -1))); } if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); return P.geodesicLength(o[0], a(I(o[1], -1))); }); }, n.distance = function(n2, e2) { return I2(n2, e2, function(e3, r2, o) { o = ye(o), G(o, 2, 3); let u2 = o[0]; (L(o[0]) || E(o[0])) && (u2 = Se(o[0], n2.spatialReference)); let s3 = o[1]; if ((L(o[1]) || E(o[1])) && (s3 = Se(o[1], n2.spatialReference)), !(u2 instanceof p)) throw new Error("Illegal Argument"); if (!(s3 instanceof p)) throw new Error("Illegal Argument"); return P.distance(u2, s3, a(I(o[2], -1))); }); }, n.distancegeodetic = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { r2 = ye(r2), G(r2, 2, 3); const o = r2[0], u2 = r2[1]; if (!(o instanceof j)) throw new Error("Illegal Argument"); if (!(u2 instanceof j)) throw new Error("Illegal Argument"); const f = new m2({ paths: [], spatialReference: o.spatialReference }); return f.addPath([o, u2]), P.geodesicLength(f, a(I(r2[2], -1))); }); }, n.densify = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 2, 3), r2[0] === null) return null; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); const o = ne(r2[1]); if (isNaN(o)) throw new Error("Illegal Argument"); if (o <= 0) throw new Error("Illegal Argument"); 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]; }); }, n.densifygeodetic = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 2, 3), r2[0] === null) return null; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); const o = ne(r2[1]); if (isNaN(o)) throw new Error("Illegal Argument"); if (o <= 0) throw new Error("Illegal Argument"); 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]; }); }, n.generalize = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 2, 4), r2[0] === null) return null; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); const o = ne(r2[1]); if (isNaN(o)) throw new Error("Illegal Argument"); return P.generalize(r2[0], o, oe(I(r2[2], true)), a(I(r2[3], -1))); }); }, n.buffer = function(n2, r2) { return I2(n2, r2, function(n3, r3, o) { if (o = ye(o), G(o, 2, 3), o[0] === null) return null; if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); const u2 = ne(o[1]); if (isNaN(u2)) throw new Error("Illegal Argument"); return u2 === 0 ? c(o[0]) : P.buffer(o[0], u2, a(I(o[2], -1))); }); }, n.buffergeodetic = function(n2, r2) { return I2(n2, r2, function(n3, r3, o) { if (o = ye(o), G(o, 2, 3), o[0] === null) return null; if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); const u2 = ne(o[1]); if (isNaN(u2)) throw new Error("Illegal Argument"); return u2 === 0 ? c(o[0]) : P.geodesicBuffer(o[0], u2, a(I(o[2], -1))); }); }, n.offset = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 2, 6), r2[0] === null) return null; if (!(r2[0] instanceof v || r2[0] instanceof m2)) throw new Error("Illegal Argument"); const o = ne(r2[1]); if (isNaN(o)) throw new Error("Illegal Argument"); const f = ne(I(r2[4], 10)); if (isNaN(f)) throw new Error("Illegal Argument"); const a2 = ne(I(r2[5], 0)); if (isNaN(a2)) throw new Error("Illegal Argument"); return P.offset(r2[0], o, a(I(r2[2], -1)), X(I(r2[3], "round")).toLowerCase(), f, a2); }); }, n.rotate = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { r2 = ye(r2), G(r2, 2, 3); let t = r2[0]; if (t === null) return null; if (!(t instanceof p)) throw new Error("Illegal Argument"); t instanceof M && (t = v.fromExtent(t)); const o = ne(r2[1]); if (isNaN(o)) throw new Error("Illegal Argument"); const u2 = I(r2[2], null); if (u2 === null) return P.rotate(t, o); if (u2 instanceof j) return P.rotate(t, o, u2); throw new Error("Illegal Argument"); }); }, n.centroid = function(n2, r2) { return I2(n2, r2, function(r3, t, o) { if (o = ye(o), G(o, 1, 1), o[0] === null) return null; let u2 = o[0]; if ((L(o[0]) || E(o[0])) && (u2 = Se(o[0], n2.spatialReference)), u2 === null) return null; if (!(u2 instanceof p)) throw new Error("Illegal Argument"); 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; }); }, n.multiparttosinglepart = function(n2, r2) { return I2(n2, r2, function(r3, t, o) { o = ye(o), G(o, 1, 1); const u2 = []; if (o[0] === null) return null; if (!(o[0] instanceof p)) throw new Error("Illegal Argument"); if (o[0] instanceof j) return [se(c(o[0]), n2.spatialReference)]; if (o[0] instanceof M) return [se(c(o[0]), n2.spatialReference)]; const f = P.simplify(o[0]); if (f instanceof v) { const n3 = [], e2 = []; for (let r4 = 0; r4 < f.rings.length; r4++) if (f.isClockwise(f.rings[r4])) { const e3 = d({ rings: [f.rings[r4]], hasZ: f.hasZ === true, hasM: f.hasM === true, spatialReference: f.spatialReference.toJSON() }); n3.push(e3); } else e2.push({ ring: f.rings[r4], pt: f.getPoint(r4, 0) }); for (let r4 = 0; r4 < e2.length; r4++) for (let t2 = 0; t2 < n3.length; t2++) if (n3[t2].contains(e2[r4].pt)) { n3[t2].addRing(e2[r4].ring); break; } return n3; } if (f instanceof m2) { const n3 = []; for (let e2 = 0; e2 < f.paths.length; e2++) { const r4 = d({ paths: [f.paths[e2]], hasZ: f.hasZ === true, hasM: f.hasM === true, spatialReference: f.spatialReference.toJSON() }); n3.push(r4); } return n3; } if (o[0] instanceof m) { const r4 = se(c(o[0]), n2.spatialReference); for (let n3 = 0; n3 < r4.points.length; n3++) u2.push(r4.getPoint(n3)); return u2; } return null; }); }, n.issimple = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 1, 1), r2[0] === null) return true; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); return P.isSimple(r2[0]); }); }, n.simplify = function(n2, e2) { return I2(n2, e2, function(n3, e3, r2) { if (r2 = ye(r2), G(r2, 1, 1), r2[0] === null) return null; if (!(r2[0] instanceof p)) throw new Error("Illegal Argument"); return P.simplify(r2[0]); }); }; } export { b, z3 as z }; //# sourceMappingURL=chunk-NLNXEWKQ.js.map