/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{Cyclical as t}from"../../core/Cyclical.js";import{getInfo as n}from"../../geometry/support/spatialReferenceUtils.js";function o(t,o){const e=n(o);if(null==e)return;const l=Array.isArray(t)?Array.isArray(t[0])?t:[t.map(t=>t.pos)]:"polygon"===t.type?t.rings:t.paths;for(const n of l)0!==n.length&&r(n,e)}function r(n,o){const r=n.length>1&&e(n),[l,s]=o.valid,i=new t(l,s),c=s-l,a=.5*c;n[0][0]=i.normalize(n[0][0]);for(let t=1;t<n.length;t++){const o=n[t-1][0];let r=i.normalize(n[t][0]);const e=r-o;e>a?r-=c:e<-a&&(r+=c),n[t][0]=r}r&&(n[n.length-1][0]=n[0][0])}function e(t){const n=t.length,o=3===t[0].length;return t[0][0]===t[n-1][0]&&t[0][1]===t[n-1][1]&&(!o||t[0][2]===t[n-1][2])}export{o as unnormalize};
