"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.resetLassoDrawState=function(e,n,r,t,o){e.current&&(e.current.deleteAll(),e.current.changeMode("draw_polygon")),n(null),r(!0),t(!1),o(!1)},exports.useLassoDrawActions=function(n){var r=n.drawRef,t=n.lassoState,o=n.drawingPointCount,a=n.onPolygonChange,l=n.setLassoState,s=n.setConfirmingPolygon,i=n.setIsDrawing,c=n.setIsEditingPolygon,u=n.setIsEditingVertices,g=n.setDrawingPointCount,d=n.enterConfirmingPhase;return{discardDrawing:e.useCallback((function(){r.current&&(r.current.deleteAll(),r.current.changeMode("draw_polygon"),g(0))}),[r,g]),completeDrawing:e.useCallback((function(){if(r.current&&!(o<3)){var e=r.current.getAll().features[0];if(e&&"Polygon"===e.geometry.type){var n=e.geometry.coordinates[0];!n||n.length<3||(d(n),r.current.changeMode("simple_select",{featureIds:[]}),c(!1),u(!1))}}}),[r,o,d,c,u]),deletePolygon:e.useCallback((function(){r.current&&(r.current.deleteAll(),"confirming"!==t.phase&&a(void 0),s(null),r.current.changeMode("draw_polygon"),i(!0),c(!1),u(!1),l({phase:"drawing",pointCount:0}))}),[r,t.phase,a,l,s,i,c,u]),handleDrawDelete:e.useCallback((function(){"confirming"===t.phase?(s(null),l({phase:"idle"})):a(void 0),r.current&&(r.current.changeMode("draw_polygon"),i(!0),l({phase:"drawing",pointCount:0}))}),[r,t.phase,a,l,s,i])}};
//# sourceMappingURL=useLassoDrawActions.js.map
