/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
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")),n=t(()=>import("../../geometry/operators/json/generalizeOperator.js")),i=t(()=>import("../../geometry/operators/json/graphicBufferOperator.js")),p=t(()=>import("../../geometry/operators/json/offsetOperator.js")),f=t(()=>import("../../geometry/operators/json/simplifyOperator.js")),a=t(()=>import("../../geometry/operators/support/jsonConverter.js")),c=512;let l;function g(e){switch(e.type){case"CIMGeometricEffectDonut":case"CIMGeometricEffectBuffer":return o.getImportPromise();case"CIMGeometricEffectEnclosingPolygon":return s.getImportPromise();case"CIMGeometricEffectOffset":return Promise.all([p.getImportPromise(),i.getImportPromise()]);case"CIMGeometricEffectTaperedPolygon":return Promise.all([f.getImportPromise(),m.getImportPromise(),n.getImportPromise()]);default:return Promise.resolve()}}function u(e){return"CIMMarkerPlacementAtMeasuredUnits"===e.type?a.getImportPromise():Promise.resolve()}class y{constructor(e){this._geometry=e}next(){const e=this._geometry;return this._geometry=null,e}}function P(t,o,s){if(!t)return null;l||(l=new r(0,0,0,1));const m=s?-1:1,n="esriGeometryPolygon"===t.geometryType,i=n?3:2,p=n?3:2;let f,a;for(l.reset(i),l.setPixelMargin(o+1),l.setExtent(c);t.nextPath();)if(!(t.pathSize<p)){for(t.nextPoint(),f=t.x,a=m*t.y,l.moveTo(f,a);t.nextPoint();)f=t.x,a=m*t.y,l.lineTo(f,a);n&&l.close()}const g=l.result(!1);if(g){const r=e.createEmptyOptimizedCIM(t.geometryType);for(const e of g){r.startPath();for(const t of e)r.pushXY(t.x,m*t.y)}return r.reset(),r}return null}export{y as SimpleEffectCursor,P as clipCursorToTileExtent,o as lazyBufferOperator,s as lazyConvexHullOperator,n as lazyGeneralizeOperator,i as lazyGraphicBufferOperator,a as lazyJsonConversion,m as lazyLengthOperator,p as lazyOffsetOperator,f as lazySimplifyOperator,g as loadGeometryOperatorsForEffect,u as loadGeometryOperatorsForPlacement};
