/*
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/aaBoundingRect","../../../geometry/support/boundsUtils","../CIMPlacements","../enums"],(function(e,t,n,o,s){"use strict";function l(e){return void 0!==e.rings}let r=function(){function e(){}return e.local=function(){return null===e.instance&&(e.instance=new e),e.instance},e.prototype.execute=function(e,t,n,o){return new i(e,t,n)},e}();r.instance=null;let i=function(){function e(e,t,n){this._geometry=e,this._offsetX=void 0!==t.offsetX?t.offsetX*n:0,this._offsetY=void 0!==t.offsetY?t.offsetY*n:0,this._method=void 0!==t.method?t.method:s.PlacementPolygonCenterMethod.OnPolygon,this._internalPlacement=new o.Placement}var r=e.prototype;return r.next=function(){const e=this._geometry;return this._geometry=null,e&&l(e)?this._polygonCenter(e):null},r._polygonCenter=function(e){let o=!1;switch(this._method){case s.PlacementPolygonCenterMethod.OnPolygon:default:case s.PlacementPolygonCenterMethod.CenterOfMass:case s.PlacementPolygonCenterMethod.BoundingBoxCenter:{const s=t.create();n.getBoundsXY(s,e),this._internalPlacement.setTranslate((s[2]+s[0])/2+this._offsetX,(s[3]+s[1])/2+this._offsetY),o=!0;break}}return o?this._internalPlacement:null},e}();e.PlacementPolygonCenter=r,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
