/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../geometry/support/jsonUtils","../CurveHelper","../enums"],(function(t,e,n,i){"use strict";let s=function(){function t(){}return t.local=function(){return null===t.instance&&(t.instance=new t),t.instance},t.prototype.execute=function(t,e,n,i){return new o(t,e,n)},t}();s.instance=null;let o=function(){function t(t,e,i){var s;this._inputGeometries=t,this._curveHelper=new n.CurveHelper,this._offset=(null!=(s=e.offset)?s:1)*i,this._method=e.method,this._option=e.option,this._offsetFlattenError=n.PIXEL_TOLERANCE*i}return t.prototype.next=function(){let t=this._inputGeometries.next();for(;t;){if(0===this._offset)return t;if(e.isExtent(t)){if(this._method===i.GeometricEffectOffsetMethod.Rounded&&this._offset>0){const e=[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]],n=this._curveHelper.offset(e,-this._offset,this._method,4,this._offsetFlattenError);return n?{rings:[n]}:null}if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._offset>0)return{xmin:t.xmin-this._offset,xmax:t.xmax+this._offset,ymin:t.ymin-this._offset,ymax:t.ymax+this._offset}}if(e.isPolygon(t)){const e=[];for(const n of t.rings){const t=this._curveHelper.offset(n,-this._offset,this._method,4,this._offsetFlattenError);t&&e.push(t)}if(e.length)return{rings:e}}if(e.isPolyline(t)){const e=[];for(const n of t.paths){const t=this._curveHelper.offset(n,-this._offset,this._method,4,this._offsetFlattenError);t&&e.push(t)}if(e.length)return{paths:e}}t=this._inputGeometries.next()}return null},t}();t.EffectOffset=s,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
