"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../utils/polygonCoords.js");exports.useLassoEventHandlers=function(t,n,o,a,l,u,i,c,s,d,g){return{handleDrawCreate:e.useCallback((function(e){var r=e.features[0];"Polygon"===(null==r?void 0:r.geometry.type)&&g(r.geometry.coordinates[0])}),[g]),handleDrawUpdate:e.useCallback((function(e){var l=e.features[0];if("Polygon"===(null==l?void 0:l.geometry.type)){var u=l.geometry.coordinates[0],i=r.convertDrawCoordsToApi(u);"confirming"===t.phase?(a(i),o({phase:"confirming",polygon:i.map((function(e){return{latitude:e.latitude,longitude:e.longitude}}))})):n(i)}}),[t.phase,n,o,a]),handleModeChange:e.useCallback((function(e){l("draw_polygon"===e.mode),i("direct_select"===e.mode)}),[l,i]),handleSelectionChange:e.useCallback((function(e){if(d.current&&e.features.length>0&&s.current)return d.current=!1,void s.current.changeMode("simple_select",{featureIds:[]});d.current=!1,u(e.features.length>0)}),[d,s,u]),handleMapClick:e.useCallback((function(){if(s.current){var e=s.current.getAll().features[0];if("Polygon"===(null==e?void 0:e.geometry.type)){var r=e.geometry.coordinates[0];c(Math.max(0,r.length-2))}}}),[s,c])}};
//# sourceMappingURL=useLassoEventHandlers.js.map
