import{c as r}from"./p-262ec334.js";const n=(r,t="children")=>r.reduce(((r,e)=>r.concat(e[t]?n(e[t],t):e)),[]),t=(r,n,t=!1,e=((r,n)=>r<n?-1:r>n?1:0))=>{if(!Array.isArray(r)||!Array.isArray(n)||r.length!=n.length)return!1;if(t){const t=[...r].sort(e),o=[...n].sort(e);return t.every(((r,n)=>0===e(r,o[n])))}return r.every(((r,t)=>0===e(r,n[t])))},e=n=>Object.keys(n).every((n=>!isNaN(r(n))));function o(r){let n=0;return r.forEach((r=>{n=r&&r.length>n?r.length:n})),n}function c(r,n){if(n.length){const t=[];return n.reduce(((n,e)=>(t.push(r.slice(n,n+e)),n+e)),0),t}return r}function s(r){return r&&Array.isArray(r[0])?r.reduce(((r,n)=>r.concat(n)),[]):r}function u(r,n){let t=r;return Array.isArray(r[0])?t=r.map((r=>(r.sort(((r,t)=>n(r)-n(t))),r))):t.sort(((r,t)=>n(r)-n(t))),t}function a(r,n,t,e){const o=r=>"function"==typeof n?n(r):r;e=e||Array.from(new Set(s(r).map(o)));const c=("function"==typeof t?e.sort(t):e).reduce(((r,n,t)=>(r[n]=t,r)),{});return u(r,(r=>c[o(r)]))}function f(r,n){for(let t=0;t<r.length;t++){const e=r[t];if(n(e))return e}}export{u as a,f as b,c,e as d,n as e,s as f,o as g,t as i,a as s}