{"version":3,"sources":["node_modules/@arcgis/core/geometry/support/coordsUtils.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport { equals as t } from \"../../core/arrayUtils.js\";\nimport { Axis as n } from \"./Axis.js\";\nimport { getInfo as r } from \"./spatialReferenceUtils.js\";\nfunction e(t) {\n if (!t) return null;\n if (Array.isArray(t)) return t;\n const n = t.hasZ,\n r = t.hasM;\n if (\"point\" === t.type) return r && n ? [t.x, t.y, t.z, t.m] : n ? [t.x, t.y, t.z] : r ? [t.x, t.y, t.m] : [t.x, t.y];\n if (\"polygon\" === t.type) return t.rings.slice();\n if (\"polyline\" === t.type) return t.paths.slice();\n if (\"multipoint\" === t.type) return t.points.slice();\n if (\"extent\" === t.type) {\n const n = t.clone().normalize();\n if (!n) return null;\n let r = !1,\n e = !1;\n return n.forEach(t => {\n t.hasZ && (r = !0), t.hasM && (e = !0);\n }), n.map(t => {\n const n = [[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]];\n if (r && t.hasZ) {\n const r = .5 * (t.zmax - t.zmin);\n for (let t = 0; t < n.length; t++) n[t].push(r);\n }\n if (e && t.hasM) {\n const r = .5 * (t.mmax - t.mmin);\n for (let t = 0; t < n.length; t++) n[t].push(r);\n }\n return n;\n });\n }\n return null;\n}\nfunction i(t, n) {\n const r = n[0] - t[0],\n e = n[1] - t[1];\n if (t.length > 2 && n.length > 2) {\n const i = t[2] - n[2];\n return Math.sqrt(r * r + e * e + i * i);\n }\n return Math.sqrt(r * r + e * e);\n}\nfunction o(t, n, r) {\n const e = t[0] + r * (n[0] - t[0]),\n i = t[1] + r * (n[1] - t[1]);\n return t.length > 2 && n.length > 2 ? [e, i, t[2] + r * (n[2] - t[2])] : [e, i];\n}\nfunction s(t, n, r, e) {\n return f(t, n, r[e], r[e + 1]);\n}\nfunction f(t, n, r, e) {\n const [i, o] = n,\n [s, f] = r,\n [u, l] = e,\n c = u - s,\n h = l - f,\n p = c * c + h * h,\n a = (i - s) * c + (o - f) * h,\n y = Math.min(1, Math.max(0, a / p));\n return t[0] = s + c * y, t[1] = f + h * y, t;\n}\nfunction u(t, n, r) {\n let e,\n i,\n o,\n s,\n f = !1,\n u = 1 / 0;\n for (r.reset(); r.nextPath();) if (r.nextPoint()) for (e = r.x, i = r.y; r.nextPoint();) o = r.x, s = r.y, i > n != s > n && t < (o - e) * (n - i) / (s - i) + e && (f = !f), u = Math.min(u, l(t, n, e, i, o, s)), e = o, i = s;\n return 0 === u ? 0 : (f ? 1 : -1) * Math.sqrt(u);\n}\nfunction l(t, n, r, e, i, o) {\n let s = r,\n f = e,\n u = i - s,\n l = o - f;\n if (0 !== u || 0 !== l) {\n const r = ((t - s) * u + (n - f) * l) / (u * u + l * l);\n r > 1 ? (s = i, f = o) : r > 0 && (s += u * r, f += l * r);\n }\n return u = t - s, l = n - f, u * u + l * l;\n}\nfunction c(t, n) {\n return o(t, n, .5);\n}\nfunction h(t) {\n const n = t.length;\n let r = 0;\n for (let e = 0; e < n - 1; ++e) r += i(t[e], t[e + 1]);\n return r;\n}\nfunction p(t, n) {\n if (n <= 0) return t[0];\n const r = t.length;\n let e = 0;\n for (let s = 0; s < r - 1; ++s) {\n const r = i(t[s], t[s + 1]);\n if (n - e < r) {\n const i = (n - e) / r;\n return o(t[s], t[s + 1], i);\n }\n e += r;\n }\n return t[r - 1];\n}\nfunction a(t, r = n.X, e = n.Y) {\n let i = 0;\n const o = t.length;\n let s = t[0];\n for (let n = 1; n < o; n++) {\n const o = t[n];\n i += (o[r] - s[r]) * (o[e] + s[e]), s = o;\n }\n if (!y(t)) {\n const n = t[0];\n i += (n[r] - s[r]) * (n[e] + s[e]);\n }\n return i >= 0;\n}\nfunction y(n) {\n const r = n.length;\n return r < 3 || t(n[0], n[r - 1]);\n}\nfunction m(t) {\n \"rings\" in t && (g(t), x(t));\n}\nfunction g(t) {\n if (!(\"rings\" in t)) return !1;\n let n = !1;\n for (const r of t.rings) y(r) || (r.push(r[0].slice()), n = !0);\n return n;\n}\nfunction x(t) {\n if (!(\"rings\" in t)) return !1;\n if (0 === t.rings.length || a(t.rings[0])) return !1;\n for (const n of t.rings) n.reverse();\n return !0;\n}\nfunction M(t) {\n if (\"polygon\" !== t.type && \"polyline\" !== t.type) return t;\n return z(\"polygon\" === t.type ? t.rings : t.paths, t.spatialReference), t;\n}\nfunction z(t, n) {\n const e = r(n);\n if (!e) return;\n const i = e.valid[0],\n o = e.valid[1],\n s = o - i;\n for (const r of t) {\n let t = 1 / 0,\n n = -1 / 0;\n for (const s of r) {\n const r = v(s[0], i, o);\n t = Math.min(t, r), n = Math.max(n, r), s[0] = r;\n }\n const e = n - t;\n s - e < e && r.forEach(t => {\n t[0] < 0 && (t[0] += s);\n });\n }\n}\nfunction v(t, n, r) {\n const e = r - n;\n return t < n ? r - (n - t) % e : t > r ? n + (t - n) % e : t;\n}\nfunction j(t, n) {\n if (t === n) return !0;\n if (t.type !== n.type) return !1;\n if (\"point\" === t.type || \"mesh\" === t.type || \"extent\" === t.type) return !0;\n if (\"multipoint\" === t.type) return t.points.length === n.points.length;\n const [r, e] = \"polyline\" === t.type ? [t.paths, n.paths] : [t.rings, n.rings];\n return r.length === e.length && r.every((t, n) => t.length === e[n].length);\n}\nexport { g as closeRings, m as closeRingsAndFixWinding, u as distanceFromPointToPolygon, l as distanceToSegmentSquared, x as fixWinding, e as geometryToCoordinates, i as getLength, c as getMidpoint, h as getPathLength, p as getPointOnPath, j as hasCompatibleTopology, a as isClockwise, y as isClosed, s as projectPointOnLine, f as projectPointOnLineSeg, M as unnormalizeGeometryOnDatelineCrossing, z as unnormalizeVerticesOnDatelineCrossing, v as unnormalizedCoordinate };"],"mappings":"wHAsCA,SAASA,EAAEC,EAAGC,EAAG,CACf,IAAMC,EAAID,EAAE,CAAC,EAAID,EAAE,CAAC,EAClBG,EAAIF,EAAE,CAAC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A,EAAE,CAAC,EAAI,IAAMA,EAAE,CAAC,GAAKM,EACvB,CAAC,CACH,CACF,CACA,SAASQ,EAAEd,EAAGE,EAAGD,EAAG,CAClB,IAAME,EAAIF,EAAIC,EACd,OAAOF,EAAIE,EAAID,GAAKC,EAAIF,GAAKG,EAAIH,EAAIC,EAAIC,GAAKF,EAAIE,GAAKC,EAAIH,CAC7D,CACA,SAASe,EAAEf,EAAGE,EAAG,CACf,GAAIF,IAAME,EAAG,MAAO,GACpB,GAAIF,EAAE,OAASE,EAAE,KAAM,MAAO,GAC9B,GAAgBF,EAAE,OAAd,SAAiCA,EAAE,OAAb,QAAkCA,EAAE,OAAf,SAAqB,MAAO,GAC3E,GAAqBA,EAAE,OAAnB,aAAyB,OAAOA,EAAE,OAAO,SAAWE,EAAE,OAAO,OACjE,GAAM,CAACD,EAAGE,CAAC,EAAmBH,EAAE,OAAjB,WAAwB,CAACA,EAAE,MAAOE,EAAE,KAAK,EAAI,CAACF,EAAE,MAAOE,EAAE,KAAK,EAC7E,OAAOD,EAAE,SAAWE,EAAE,QAAUF,EAAE,MAAM,CAACD,EAAGE,IAAMF,EAAE,SAAWG,EAAED,CAAC,EAAE,MAAM,CAC5E","names":["i","t","n","r","e","o","s","f","u","l","c","h","p","a","y","l","t","n","r","e","i","o","s","f","u","c","h","a","t","r","n","e","i","o","s","c","m","g","x","M","z","d","v","j"],"x_google_ignoreList":[0]}