import{t as e}from"./isSymbol.CmW3dkoN.js";import{i as t,r as n}from"./toString.tRXNBxtF.js";import{t as r}from"./_isIterateeCall.BUStsXAd.js";import{A as i,I as a,T as o,m as s}from"./isArrayLikeObject.B3Zf3PTL.js";import{t as c}from"./_baseFlatten.IOj0lc7G.js";import{r as l}from"./_baseEach.PLhpSRgM.js";import{t as u}from"./_baseMap.OhVc4KF-.js";function d(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function f(t,n){if(t!==n){var r=t!==void 0,i=t===null,a=t===t,o=e(t),s=n!==void 0,c=n===null,l=n===n,u=e(n);if(!c&&!u&&!o&&t>n||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&t<n||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function p(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=f(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function m(e,r,i){r=r.length?t(r,function(e){return n(e)?function(t){return s(t,e.length===1?e[0]:e)}:e}):[a];var c=-1;return r=t(r,o(l)),d(u(e,function(e,n,i){return{criteria:t(r,function(t){return t(e)}),index:++c,value:e}}),function(e,t){return p(e,t,i)})}var h=i(function(e,t){if(e==null)return[];var n=t.length;return n>1&&r(e,t[0],t[1])?t=[]:n>2&&r(t[0],t[1],t[2])&&(t=[t[0]]),m(e,c(t,1),[])});export{h as t};