/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{GeometryCursor as e}from"../../geometry/GeometryCursor.js";import{TileClipper as r}from"../../geometry/support/TileClipper.js";import{importLazily as t}from"./utils.js";const o=t(()=>import("../../geometry/operators/json/bufferOperator.js")),s=t(()=>import("../../geometry/operators/json/convexHullOperator.js")),m=t(()=>import("../../geometry/operators/json/lengthOperator.js")),i=t(()=>import("../../geometry/operators/json/generalizeOperator.js")),n=t(()=>import("../../geometry/operators/json/graphicBufferOperator.js")),p=t(()=>import("../../geometry/operators/json/offsetOperator.js")),a=t(()=>import("../../geometry/operators/json/simplifyOperator.js")),f=t(()=>import("../../geometry/operators/json/simplifyOperatorOGC.js")),c=t(()=>import("../../geometry/operators/support/jsonConverter.js")),l=512;let g;function u(e){switch(e.type){case"CIMGeometricEffectDonut":case"CIMGeometricEffectBuffer":return o.getImportPromise();case"CIMGeometricEffectEnclosingPolygon":return s.getImportPromise();case"CIMGeometricEffectOffset":return Promise.all([f.getImportPromise(),p.getImportPromise(),n.getImportPromise()]);case"CIMGeometricEffectControlMeasureLine":return p.getImportPromise();case"CIMGeometricEffectTaperedPolygon":return Promise.all([a.getImportPromise(),m.getImportPromise(),i.getImportPromise()]);default:return Promise.resolve()}}function y(e){return"CIMMarkerPlacementAtMeasuredUnits"===e.type?c.getImportPromise():Promise.resolve()}class P{constructor(e){this._geometry=e}next(){const e=this._geometry;return this._geometry=null,e}}function j(t,o,s){if(!t)return null;g||(g=new r(0,0,0,1));const m=s?-1:1,i="esriGeometryPolygon"===t.geometryType,n=i?3:2,p=i?3:2;let a,f;for(g.reset(n),g.setPixelMargin(o+1),g.setExtent(l);t.nextPath();)if(!(t.pathSize<p)){for(t.nextPoint(),a=t.x,f=m*t.y,g.moveTo(a,f);t.nextPoint();)a=t.x,f=m*t.y,g.lineTo(a,f);i&&g.close()}const c=g.result(!1);if(c){const r=e.createEmptyOptimizedCIM(t.geometryType);for(const e of c){r.startPath();for(const t of e)r.pushXY(t.x,m*t.y)}return r.reset(),r}return null}export{P as SimpleEffectCursor,j as clipCursorToTileExtent,o as lazyBufferOperator,s as lazyConvexHullOperator,i as lazyGeneralizeOperator,n as lazyGraphicBufferOperator,c as lazyJsonConversion,m as lazyLengthOperator,p as lazyOffsetOperator,f as lazySimplifyOGCOperator,a as lazySimplifyOperator,u as loadGeometryOperatorsForEffect,y as loadGeometryOperatorsForPlacement};
