import e from"@babel/runtime/helpers/defineProperty";import{useCallback as t}from"react";import{uniqBy as r}from"lodash";import{DEFAULT_RADIUS_MILES as n,ALL_SECTION_KEY as l}from"../../constants.js";import{normalizeFilters as o}from"../../stores/filter-store/utils/normalizeFilters.js";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?i(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=function(e){var i=e.setSelectedWells,c=e.setSelectedWellSection,a=e.setCurrentSelectionZone,d=e.offsetSettings,u=e.subjectWell,f=e.isMapHidden,p=e.isFilterExpanded,v=e.wells,b=e.pinnedWells,m=e.onClose,O=e.onSave,j=e.setFilters,S=e.resetIsLoadAllWells,y=e.resetSafeguard,g=e.abandonPendingSearch;return t((function(){var e,t,h;g();var w=new Set((null==d?void 0:d.selectedWellIds)||[]),P=(v||[]).filter((function(e){return w.has(e.id)}));if(null!=b&&b.length){var W=new Set(P.map((function(e){return e.id}))),x=b.filter((function(e){return w.has(e.id)&&!W.has(e.id)}));P=P.concat(x)}u&&(P=P.concat(u)),i(r(P,"id")),a(null!==(e=null==d?void 0:d.lastSelectionZone)&&void 0!==e?e:null);var D=s(s({},d),{},{selectedWellIds:null!==(t=null==d?void 0:d.selectedWellIds)&&void 0!==t?t:[],mapHidden:f,filterExpanded:p});null==O||O(D);var E=o(null==d?void 0:d.filters);j(s(s({},E),{},{radius:null!==(h=null==E?void 0:E.radius)&&void 0!==h?h:n}),"external_sync"),c((null==d?void 0:d.wellSection)||l),S(),y(),null==m||m()}),[i,c,a,d,u,f,p,v,b,m,O,j,S,y,g])};export{c as useCancelHandler};
//# sourceMappingURL=useCancelHandler.js.map
