import{a as t,u as r}from"./_commonjsHelpers-17042db9.js";import{compareAsc as e}from"date-fns";import{toSeconds as n}from"duration-fns";var o=t(function(t){t.exports=function(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n},t.exports.__esModule=!0,t.exports.default=t.exports});r(o);var i=t(function(t){t.exports=function(t,r){if(t){if("string"==typeof t)return o(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,r):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports});r(i);var u=t(function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports});r(u);var a=t(function(t){t.exports=function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,u,a=[],l=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=i.call(e)).done)&&(a.push(n.value),a.length!==r);l=!0);}catch(t){s=!0,o=t}finally{try{if(!l&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}},t.exports.__esModule=!0,t.exports.default=t.exports});r(a);var l=t(function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports});r(l);var s=r(t(function(t){t.exports=function(t,r){return u(t)||a(t,r)||i(t,r)||l()},t.exports.__esModule=!0,t.exports.default=t.exports}));function f(t){return t.deliveryEstimation}function c(t){var r=t.deliveryEstimation.duration;return null==r.min&&null==r.max}function m(t){var r=t.deliveryEstimation.deliveryDate;return null==r.min&&null==r.max}function d(t){return!f(t)||!function(t){return t.deliveryEstimation.duration}(t)}function p(t){return!f(t)||!function(t){return t.deliveryEstimation.deliveryDate}(t)}function x(t){return t.slice().sort(function(t,r){if(d(t))return 1;if(d(r))return-1;if(c(t))return 1;if(c(r))return-1;var e=t.deliveryEstimation.duration,o=r.deliveryEstimation.duration,i=n(e.max),u=n(e.min),a=n(o.max),l=n(o.min);return i===a?u<l?1:u>l?-1:0:i>a?1:i<a?-1:0})}function v(t){return t.slice().sort(function(t,r){if(p(t))return 1;if(p(r))return-1;if(m(t))return 1;if(m(r))return-1;var n=t.deliveryEstimation.deliveryDate,o=r.deliveryEstimation.deliveryDate,i=n.min?n.min:n.max,u=o.min?o.min:o.max,a=e(new Date(i),new Date(u));return 0===a?e(new Date(n.max),new Date(o.max)):a})}export{s as _,x as a,o as b,v as s,i as u};
//# sourceMappingURL=sortQuotesByDeliverySpeedEstimate-554f0c2a.js.map
