UNPKG

@zestlet/fp

Version:

TypeScript functional programming library with over 70% AI-generated code, featuring precise type inference and currying support

2 lines (1 loc) 29.4 kB
function c(t){return function n(...e){return e.length>=t.length?t.apply(null,e):function(...r){return n.apply(null,[...e,...r])}}}function q(t,n,e){return t<0||t>=e.length?[...e]:[...e.slice(0,t),n(e[t]),...e.slice(t+1)]}const Z=c(q);function J(t,n){return n.every(t)}const K=c(J);function Y(t,n){return t.every(e=>e(n))}const _=c(Y);function H(t){return()=>t}const Q=H;function X(t,n){return n.some(t)}const tt=c(X);function nt(t,n){return t.length===0?!1:t.some(e=>e(n))}const et=c(nt);function rt(t,n){return t.flatMap(e=>n.map(r=>e(r)))}const ot=c(rt);function ct(t,n){if(t<=0||t>n.length)return[];const e=[];for(let r=0;r<=n.length-t;r++)e.push(n.slice(r,r+t));return e}const st=c(ct);function ut(t,n){return[...n,t]}const it=c(ut);function ft(t,n){if(n.length===0)return[[],[]];const e=Math.min(t.length,n.length),r=[[],[]];for(let o=0;o<e;o++)r[t[o]?0:1].push(n[o]);return r}const lt=c(ft);function at(t,n){if(t<=0)return[];const e=[];for(let r=0;r<n.length;r+=t)e.push(n.slice(r,r+t));return e}const ht=c(at);function gt(t){return{...t}}const pt=gt;function yt(t){return(...n)=>!t(...n)}const bt=yt;function mt(...t){return t.length===0?n=>n:t.length===1?t[0]:n=>{let e=n;for(let r=t.length-1;r>=0;r--)e=t[r](e);return e}}function $t(...t){return t.length===0?async n=>n:t.length===1?t[0]:async n=>{let e=n;for(let r=t.length-1;r>=0;r--)e=await t[r](e);return e}}function dt(t,n){return[...n,...t]}const At=c(dt);function jt(t,n){return n.reduce((e,r,o,s)=>{const u=t(r,o,s);return e[u]=(e[u]||0)+1,e},{})}const Ot=c(jt);function wt(t,n){return n.filter(e=>!t.includes(e))}const kt=c(wt);function St(t,n,e){const r=new Set(n.map(t));return e.filter((o,s,u)=>!r.has(t(o,s,u)))}const It=c(St);function Bt(t,n,e){return e.filter(r=>!n.some(o=>t(r,o)))}const Mt=c(Bt);function Nt(t,n){return t<0?[...n]:n.slice(t)}const vt=c(Nt);function Et(t,n){return t<=0?[...n]:n.slice(0,-t)}const Pt=c(Et);function xt(t,n){let e=n.length-1;for(;e>=0&&t(n[e],e,n);)e--;return n.slice(0,e+1)}const Ut=c(xt);function Tt(t){return t.length===0?[]:t.reduce((n,e,r)=>((r===0||e!==t[r-1])&&n.push(e),n),[])}const Ft=Tt;function Wt(t,n){return n.length===0?[]:n.reduce((e,r,o)=>((o===0||!t(r,n[o-1]))&&e.push(r),e),[])}const Lt=c(Wt);function Dt(t,n){let e=0;for(;e<n.length&&t(n[e],e,n);)e++;return n.slice(e)}const Rt=c(Dt);function zt(...t){return!1}function Gt(t,n){return n.filter(t)}const Ct=c(Gt);function Vt(...t){if(t.length===0)return r=>r;if(t.length===1)return t[0];const[n,...e]=t;return function(...r){return e.reduce((o,s)=>s(o),n(...r))}}function qt(t,n){return n.find(t)}const Zt=c(qt);function Jt(t,n){return n.findIndex(t)}const Kt=c(Jt);function Yt(t,n){return n.findLast(t)}const _t=c(Yt);function Ht(t,n){for(let e=n.length-1;e>=0;e--)if(t(n[e],e,n))return e;return-1}const Qt=c(Ht);function Xt(t){return t[0]}const tn=Xt;function nn(t,n){return n.flatMap(t)}const en=c(nn);function rn(t,n){return n.flat(t)}const on=c(rn);function cn(t){return(n,e,...r)=>t(e,n,...r)}const sn=cn;function un(t,n){return n.forEach(t),n}const fn=c(un);function ln(t){return Object.fromEntries(t)}const an=ln;function hn(t,n){return n.reduce((e,r,o)=>{const s=t(r,o,n);return e[s]||(e[s]=[]),e[s].push(r),e},{})}const gn=c(hn);function pn(t){return t==null}function yn(t){return t!=null}function N(t){return Array.isArray(t)}function m(t){return typeof t=="string"}function $(t){return typeof t=="number"&&!O(t)}function bn(t){return typeof t=="boolean"}function I(t){return typeof t=="function"}function j(t){return t!==null&&typeof t=="object"}function S(t){if(!j(t))return!1;const n=Object.getPrototypeOf(t);return n===null||n===Object.prototype}function mn(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function $n(t){return Object.prototype.toString.call(t)==="[object Date]"}function dn(t){return Object.prototype.toString.call(t)==="[object Error]"}function An(t){return typeof t=="symbol"}function jn(t){return t===null}function On(t){return t===void 0}function O(t){return Number.isNaN(t)}function wn(t){return Number.isFinite(t)}function kn(t){return $(t)&&t>0}function Sn(t){return $(t)&&t<0}function In(t){return $(t)&&t===0}function Bn(t){return $(t)&&t%2===0}function Mn(t){return $(t)&&t%2!==0}function Nn(t){return t===1/0}function vn(t){return t===-1/0}function En(t){return t===1/0}function Pn(t){return m(t)&&t.length===0}function xn(t){return N(t)&&t.length===0}function Un(t){return S(t)&&Object.keys(t).length===0}function Tn(t){return m(t)&&t.trim().length===0}function Fn(t){return m(t)&&/^-?\d*\.?\d+$/.test(t)}function Wn(t){return m(t)&&/^[a-zA-Z]+$/.test(t)}function Ln(t){return m(t)&&/^[a-zA-Z0-9]+$/.test(t)}function Dn(t){return m(t)&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function Rn(t){try{return m(t)&&!!new URL(t)}catch{return!1}}function zn(t,n){return N(t)&&t.every(n)}function Gn(t){return t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0}function Cn(t){return t!==null&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}function Vn(t){return t!==null&&typeof t[Symbol.iterator]=="function"}function qn(t){return I(t)&&t.constructor.name==="GeneratorFunction"}function Zn(t){return I(t)&&t.constructor.name==="AsyncGeneratorFunction"}function Jn(t){return I(t)&&(t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction")}function Kn(t){return $(t)&&Number.isInteger(t)}function Yn(t){return $(t)&&!Number.isInteger(t)}function _n(t,n){return Object.prototype.hasOwnProperty.call(n,t)}const Hn=c(_n);function Qn(t,...n){return t}const Xn=Qn;function te(t,n){return n.includes(t)}const ne=c(te);function ee(t,n){return n.reduce((e,r,o)=>{const s=t(r,o,n);return e[s]=r,e},{})}const re=c(ee);function oe(t,n){return n.indexOf(t)}const ce=c(oe);function se(t){return t.slice(0,-1)}const ue=se;function ie(t,n,e){const r=t<0?Math.max(e.length+t,0):Math.min(t,e.length);return[...e.slice(0,r),n,...e.slice(r)]}const fe=c(ie);function le(t,n){return n.length===0?[]:n.length===1?[...n[0]]:n.reduce((e,r,o)=>o===0?[r]:[...e,t,r],[]).flat()}const ae=c(le);function he(t,n){const e=[],r=Math.max(n.length,t.length);for(let o=0;o<r;o++)o<n.length&&e.push(n[o]),o<t.length&&e.push(t[o]);return e}const ge=c(he);function pe(t,n){return n.filter(e=>t.includes(e))}const ye=c(pe);function be(t,n,e){const r=new Set(n.map(t));return e.filter((o,s,u)=>r.has(t(o,s,u)))}const me=c(be);function $e(t,n,e){return e.filter(r=>n.some(o=>t(r,o)))}const de=c($e);function Ae(t,n){const e=n.length;if(e<=1)return[...n];const r=[];for(let o=0;o<e-1;o++)r.push(n[o]),r.push(t);return r.push(n[e-1]),r}const je=c(Ae);function Oe(t){const n={};for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];n[r]=e}return n}const we=Oe;function ke(t){const n={};for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];n[r]?n[r].push(e):n[r]=[e]}return n}const Se=c(ke),i={Number:"[object Number]",String:"[object String]",Boolean:"[object Boolean]",Symbol:"[object Symbol]",BigInt:"[object BigInt]",Date:"[object Date]",RegExp:"[object RegExp]",Array:"[object Array]",Map:"[object Map]",Set:"[object Set]",ArrayBuffer:"[object ArrayBuffer]",SharedArrayBuffer:"[object SharedArrayBuffer]",DataView:"[object DataView]",Int8Array:"[object Int8Array]",Uint8Array:"[object Uint8Array]",Uint8ClampedArray:"[object Uint8ClampedArray]",Int16Array:"[object Int16Array]",Uint16Array:"[object Uint16Array]",Int32Array:"[object Int32Array]",Uint32Array:"[object Uint32Array]",Float32Array:"[object Float32Array]",Float64Array:"[object Float64Array]",BigInt64Array:"[object BigInt64Array]",BigUint64Array:"[object BigUint64Array]",Error:"[object Error]",Function:"[object Function]",AsyncFunction:"[object AsyncFunction]",GeneratorFunction:"[object GeneratorFunction]",Arguments:"[object Arguments]",Object:"[object Object]"},M=t=>Object.prototype.toString.call(t);function y(t,n,e=new WeakMap){if(t===n)return!0;if(t==null||n==null)return!1;const r=M(t),o=M(n);if(r!==o)return!1;const s=typeof t,u=typeof n;if(s==="object"){if(e.has(t))return e.get(t)===n;e.set(t,n)}let f,h,a=!0;switch(r){case i.Number:f=s==="object"?t.valueOf():t,h=u==="object"?n.valueOf():n,a=O(f)&&O(h)?!0:f===h;break;case i.Boolean:case i.String:case i.Symbol:case i.BigInt:f=s==="object"?t.valueOf():t,h=u==="object"?n.valueOf():n,a=f===h;break;case i.Date:f=t.getTime(),h=n.getTime(),a=O(f)&&O(h)?!0:f===h;break;case i.RegExp:a=t.source===n.source&&t.flags===n.flags;break;case i.Array:case i.Arguments:if(t.length!==n.length)a=!1;else for(let l=0;l<t.length;l++)if(!y(t[l],n[l],e)){a=!1;break}break;case i.Map:if(t.size!==n.size)a=!1;else for(const[l,g]of t){let p=!1;for(const d of n.keys())if(y(l,d,e)){if(!y(g,n.get(d),e)){a=!1;break}p=!0;break}if(!p||!a){a=!1;break}}break;case i.Set:if(t.size!==n.size)a=!1;else{const l=new Set;for(const g of n.values())l.add(g);for(const g of t){let p=!1;for(const d of l)if(y(g,d,e)){l.delete(d),p=!0;break}if(!p){a=!1;break}}}break;case i.ArrayBuffer:case i.SharedArrayBuffer:if(t.byteLength!==n.byteLength)a=!1;else{const l=new Uint8Array(t),g=new Uint8Array(n);for(let p=0;p<t.byteLength;p++)if(l[p]!==g[p]){a=!1;break}}break;case i.DataView:t.byteLength!==n.byteLength||t.byteOffset!==n.byteOffset?a=!1:y(t.buffer,n.buffer,e)||(a=!1);break;case i.Int8Array:case i.Uint8Array:case i.Uint8ClampedArray:case i.Int16Array:case i.Uint16Array:case i.Int32Array:case i.Uint32Array:case i.Float32Array:case i.Float64Array:case i.BigInt64Array:case i.BigUint64Array:if(t.length!==n.length)a=!1;else for(let l=0;l<t.length;l++)if(t[l]!==n[l]){a=!1;break}break;case i.Object:const w=Object.keys(t),B=Object.keys(n);if(w.length!==B.length)a=!1;else for(const l of w)if(!Object.prototype.hasOwnProperty.call(n,l)||!y(t[l],n[l],e)){a=!1;break}if(a){const l=Object.getOwnPropertySymbols(t),g=Object.getOwnPropertySymbols(n);if(l.length!==g.length)a=!1;else for(const p of l)if(!Object.prototype.hasOwnProperty.call(n,p)||!y(t[p],n[p],e)){a=!1;break}}break;case i.Error:a=t.name===n.name&&t.message===n.message;break;case i.Function:case i.AsyncFunction:case i.GeneratorFunction:a=!1;break;default:a=!1;break}return!a&&s==="object"&&e.delete(t),a}const v=(t,n)=>y(t,n);function Ie(t,n){return n.join(t)}const Be=c(Ie);function Me(t,n){return t.map(e=>e(n))}const Ne=c(Me);function ve(t){return Object.keys(t)}const Ee=ve;function Pe(t){return t[t.length-1]}const xe=Pe;function Ue(t,n){return n.lastIndexOf(t)}const Te=c(Ue);function Fe(t){return t.length}const We=Fe,k=Symbol("mergeDelete");function T(t,n){return(e,r)=>{const o=new WeakMap;function s(u,f,h=[],a=null,w=null){if(f==null||u==null)return f;if(j(f)&&o.has(f))return o.get(f);if(j(u)&&o.has(u))return o.get(u);const B=h.length>0?h[h.length-1]:"";if(t&&h.length>0){const l=t(f,u,{key:B,path:h,source:w||f,target:a||u});if(l===k)return k;if(l!==void 0)return l}if(S(u)&&S(f)){const l=n?{...u}:u;return n?(o.set(f,l),o.set(u,l)):o.set(f,u),Object.keys(f).forEach(g=>{const p=u[g],d=f[g],V=[...h,g],U=s(p,d,V,u,f);U===k?(n||g in l)&&delete l[g]:l[g]=U}),l}return f}return!j(e)||!j(r)?r:s(e,r)}}function E(t,n,e){return T(t,!0)(n,e)}function P(t,n,e){return T(t,!1)(n,e)}const Le=c(E),De=c(P);function Re(t,n){return E(null,t,n)}function ze(t,n){return E(null,n,t)}function Ge(t,n){return P(null,t,n)}function Ce(t,n){return P(null,n,t)}const Ve=c(Re),qe=c(ze),Ze=c(Ge),Je=c(Ce);function Ke(t,n){return n.map(t)}const Ye=c(Ke);function _e(t,n){const e={};return Object.entries(n).forEach(([r,o])=>{const[s,u]=t([r,o],n);e[s]=u}),e}const He=c(_e);function Qe(t,n){const e={};return Object.entries(n).forEach(([r,o])=>{const s=t(r,o,n);e[s]=o}),e}const Xe=c(Qe);function tr(t,n){const e={};return Object.entries(n).forEach(([r,o])=>{e[r]=t(o,r,n)}),e}const nr=c(tr);function er(t){if(t.length!==0)return Math.max(...t)}const rr=er;function or(t,n){if(n.length!==0)return n.reduce((e,r)=>t(r)>t(e)?r:e)}const cr=c(or);function sr(t,n){if(n.length!==0)return n.reduce((e,r)=>t(r,e)>0?r:e)}const ur=c(sr);function ir(t){return t.length===0?0:t.reduce((n,e)=>n+e,0)/t.length}const fr=ir;function lr(t){if(t.length===0)return NaN;const n=[...t].sort((r,o)=>r-o),e=Math.floor(n.length/2);return n.length%2===0?(n[e-1]+n[e])/2:n[e]}const ar=lr;function hr(t){if(t.length!==0)return Math.min(...t)}const gr=hr;function pr(t,n){if(n.length!==0)return n.reduce((e,r)=>t(r)<t(e)?r:e)}const yr=c(pr);function br(t,n){if(n.length!==0)return n.reduce((e,r)=>t(r,e)<0?r:e)}const mr=c(br);function $r(t,n,e){if(e.length===0)return[];const r=t<0?e.length+t:t,o=n<0?e.length+n:n;if(r<0||r>=e.length||o<0||o>=e.length)return[...e];const s=e[r],u=[...e];return u.splice(r,1),u.splice(o,0,s),u}const dr=c($r);function Ar(t,n){return!n.some(t)}const jr=c(Ar);function Or(t,n){return t.length===0?!0:!t.some(e=>e(n,0,[n]))}const wr=c(Or);function kr(...t){}function Sr(t,n){return n.at(t)}const Ir=c(Sr);function Br(t,n){const e=new Set(t);return Object.entries(n).reduce((r,[o,s])=>(e.has(o)||(r[o]=s),r),{})}const Mr=c(Br);function Nr(t,n){const e={};for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r];t(o,r,n)||(e[r]=o)}return e}const vr=c(Nr);function Er(t,n){const e=new Set(t);return n.filter((r,o)=>!e.has(o))}const Pr=c(Er);function xr(t){let n=!1,e;return(...r)=>(n||(n=!0,e=t(...r)),e)}function Ur(t,n,e){if(t<=e.length)return[...e];const r=t-e.length;return[...Array(r).fill(n),...e]}const Tr=c(Ur);function Fr(t,n,e){if(t<=e.length)return[...e];const r=t-e.length;return[...e,...Array(r).fill(n)]}const Wr=c(Fr);function Lr(t){if(t.length<2)return[];const n=[];for(let e=0;e<t.length-1;e+=2)e+1<t.length&&n.push([t[e],t[e+1]]);return n}const Dr=Lr;function Rr(t,n){const e={},r={...n};for(const o of t)o in n&&(e[o]=n[o],delete r[o]);return[e,r]}const zr=c(Rr);function Gr(t,n){const e=[],r=[];for(let o=0;o<n.length;o++)t(n[o],o,n)?e.push(n[o]):r.push(n[o]);return[e,r]}const Cr=c(Gr);function F(t,n){if(t.length===0)return n;if(n==null)return;const[e,...r]=t;if(!(e in n))return;const o=n[e];return F(r,o)}const W=c(F);function L(t,n,e){if(n.length===0)return e;if(e==null)return t;const[r,...o]=n;if(!(r in e))return t;const s=e[r];return L(t,o,s)}const Vr=c(L);function qr(t,n){return t.reduce((e,r)=>(r in n&&(e[r]=n[r]),e),{})}const Zr=c(qr);function Jr(t,n){const e={};for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r];t(o,r)&&(e[r]=o)}return e}const Kr=c(Jr);function Yr(t,n){return t.map(e=>n[e]).filter((e,r)=>t[r]>=0&&t[r]<n.length)}const _r=c(Yr);function Hr(t,...n){return n.length===0?t:n.reduce((e,r)=>r(e),t)}function Qr(...t){return t.length===0?async n=>n:t.length===1?t[0]:async n=>{let e=n;for(const r of t)e=await r(e);return e}}function Xr(t,n){return n.map(e=>e[t])}const to=c(Xr);function no(t,n){return[t,...n]}const eo=c(no);function ro(t){return t.length===0?NaN:t.reduce((n,e)=>n*e,1)}const oo=ro;function co(t,n){return n[t]}const so=c(co);function uo(t,n,e){return e==null?t:Object.prototype.hasOwnProperty.call(e,n)?e[n]:t}const io=c(uo);function fo(t,n,e){if(e===0)return[];const r=Math.max(Math.ceil((n-t)/e),0),o=Array(r);let s=0,u=t;if(e>0)for(;u<n;)o[s++]=u,u+=e;else for(;u>n;)o[s++]=u,u+=e;return o}const lo=c(fo);function ao(t,n,e){return e.reduce(t,n)}const ho=c(ao);function go(t,n,e){let r=n;for(let o=e.length-1;o>=0;o--)r=t(r,e[o],o,e);return r}const po=c(go);function yo(t,n,e,r){let o=e;for(let s=r.length-1;s>=0;s--){const u=n(o,r[s],s,r);if(!t(u,r[s],s,r))break;o=u}return o}const bo=c(yo);function mo(t,n,e,r){let o=e;for(let s=0;s<r.length;s++){const u=n(o,r[s],s,r);if(!t(u,r[s],s,r))break;o=u}return o}const $o=c(mo);function Ao(t,n){const e=[];for(let r=0;r<n.length;r++){const o=n[r];t(o,r,n)||e.push(o)}return e}const jo=c(Ao);function Oo(t,n){const e=t<0?n.length+t:t;return e<0||e>=n.length?[...n]:[...n.slice(0,e),...n.slice(e+1)]}const wo=c(Oo);function ko(t,n){return Array.from({length:n},()=>t)}const So=c(ko);function Io(t){return[...t].reverse()}const Bo=Io;function Mo(t,n){if(n.length===0)return[...n];const e=(t%n.length+n.length)%n.length;return[...n.slice(e),...n.slice(0,e)]}const No=c(Mo);function vo(t,n){if(n.length===0)return[...n];const e=(t%n.length+n.length)%n.length;return[...n.slice(-e),...n.slice(0,-e)]}const Eo=c(vo);function Po(t){if(t.length===0)return;const n=Math.floor(Math.random()*t.length);return t[n]}const xo=Po;function Uo(t,n){if(n.length===0||t<=0)return[];const e=Math.min(t,n.length),r=new Array(n.length).fill(0).map((o,s)=>s);for(let o=0;o<e;o++){const s=o+Math.floor(Math.random()*(r.length-o));[r[o],r[s]]=[r[s],r[o]]}return r.slice(0,e).map(o=>n[o])}const To=c(Uo);function Fo(t,n,e){const r=[n];let o=n;for(let s=0;s<e.length;s++)o=t(o,e[s],s,e),r.push(o);return r}const Wo=c(Fo);function Lo(t,n,e){const r=[n];for(let o=e.length-1;o>=0;o--)r.unshift(t(r[0],e[o],o,e));return r}const Do=c(Lo);function Ro(t,n,e){return{...e,[t]:n}}const zo=c(Ro);function A(t,n,e){const[r,...o]=t;if(r===void 0)return n;const s=o.length>0&&typeof o[0]=="number"&&Number(o[0])>=0;if(e==null){const f=typeof r=="number"&&Number(r)>=0?[]:{};return A(t,n,f)}if(Array.isArray(e)){const f=Number(r),h=[...e];if(isNaN(f))throw new Error(`Cannot use non-numeric index with array: ${String(r)}`);return h[f]=A(o,n,e[f]===void 0?s?[]:{}:e[f]),h}if(typeof e=="object"){const f=e,h=f[r];if(h!=null&&typeof h!="object"){const a=typeof o[0]=="number"&&Number(o[0])>=0?[]:{};return{...f,[r]:A(o,n,a)}}return{...f,[r]:A(o,n,h===void 0?s?[]:{}:h)}}const u=typeof r=="number"&&Number(r)>=0?[]:{};return A(t,n,u)}const D=c(A);function Go(t){const n=[...t];for(let e=n.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}const Co=Go;function Vo(t,n,e){return e.slice(t,n)}const qo=c(Vo);function Zo(t){return[...t].sort()}const Jo=Zo;function Ko(t,n){return[...n].sort((e,r)=>{const o=t(e)??0,s=t(r)??0;return o<s?-1:o>s?1:0})}const Yo=c(Ko);function _o(t,n){return[...n].sort(t)}const Ho=c(_o);function Qo(t,n,e,r){const o=t<0?Math.max(r.length+t,0):Math.min(t,r.length),s=Math.max(0,Math.min(n,r.length-o));return[...r.slice(0,o),...e,...r.slice(o+s)]}const Xo=c(Qo);function tc(t,n){return t<0?[[],[...n]]:[n.slice(0,t),n.slice(t)]}const nc=c(tc);function ec(t,n){const e=n.findIndex(t);return e===-1?[[...n],[]]:[n.slice(0,e),n.slice(e)]}const rc=c(ec);function oc(t){return t.reduce((n,e)=>n+e,0)}const cc=oc;function sc(t,n){return n.reduce((e,r)=>e+t(r),0)}const uc=c(sc);function ic(t,n,e){if(e.length===0)return[];const r=t<0?e.length+t:t,o=n<0?e.length+n:n;if(r<0||r>=e.length||o<0||o>=e.length)return[...e];const s=[...e];return[s[r],s[o]]=[s[o],s[r]],s}const fc=c(ic);function lc(t,n){return[...new Set([...n.filter(e=>!t.includes(e)),...t.filter(e=>!n.includes(e))])]}const ac=c(lc);function hc(t,n,e){const r=new Set(e.map(t)),o=new Set(n.map(t)),s=[];let u=0;for(const f of e){const h=t(f,u++,e);o.has(h)||s.push(f),u++}u=0;for(const f of n){const h=t(f,u++,n);r.has(h)||s.push(f),u++}return s}const gc=c(hc);function pc(t,n,e){const r=[];for(const o of e)n.some(s=>t(o,s))||r.push(o);for(const o of n)e.some(s=>t(s,o))||r.push(o);return r}const yc=c(pc);function bc(t){return t.slice(1)}const mc=bc;function $c(t,n){return t<0?[]:n.slice(0,t)}const dc=c($c);function Ac(t,n){return t<=0?[]:n.slice(-t)}const jc=c(Ac);function Oc(t,n){const e=[];for(let r=n.length-1;r>=0&&t(n[r],r,n);r--)e.unshift(n[r]);return e}const wc=c(Oc);function kc(t,n){const e=[];for(let r=0;r<n.length&&t(n[r],r,n);r++)e.push(n[r]);return e}const Sc=c(kc);function Ic(t){return t.reduce((n,e)=>(n.set(e,(n.get(e)||0)+1),n),new Map)}const Bc=Ic;function Mc(t,n){return t(n),n}const Nc=c(Mc);function vc(t,n){return Array.from({length:n},(e,r)=>t(r))}const Ec=c(vc);function Pc(t){return Object.entries(t)}const xc=Pc;function Uc(t){if(t.length===0)return[];const n=Math.min(...t.map(r=>r.length)),e=[];for(let r=0;r<n;r++)e.push(t.map(o=>o[r]));return e}const Tc=Uc;function Fc(...t){return!0}function Wc(t){return n=>t(n)}const Lc=Wc;function Dc(t,n){const e=[];let r=n;for(;;){const o=t(r);if(!o)break;const[s,u]=o;e.push(s),r=u}return e}const Rc=c(Dc);function zc(t,n){return[...new Set([...n,...t])]}const Gc=c(zc);function Cc(t,n,e){const r=new Set,o=[];let s=0;for(const u of e){const f=t(u,s++,e);r.has(f)||(r.add(f),o.push(u))}s=0;for(const u of n){const f=t(u,s++,n);r.has(f)||(r.add(f),o.push(u))}return o}const Vc=c(Cc);function qc(t,n,e){const r=[...e];for(const o of n)r.some(s=>t(s,o))||r.push(o);return r}const Zc=c(qc);function Jc(t){return[...new Set(t)]}const Kc=Jc;function Yc(t,n){const e=new Set,r=[];let o=0;for(const s of n){const u=t(s,o++,n);e.has(u)||(e.add(u),r.push(s))}return r}const _c=c(Yc);function Hc(t){if(t.length===0)return[];const n=t[0].length,e=Array.from({length:n},()=>[]);for(const r of t)for(let o=0;o<n;o++)e[o].push(r[o]);return e}const Qc=Hc;function Xc(t,n,e){if(e.length===0)return[];const r=t<0?e.length+t:t;return r<0||r>=e.length?[...e]:[...e.slice(0,r),n,...e.slice(r+1)]}const ts=c(Xc);function ns(t){return[...Object.values(t),...Object.getOwnPropertySymbols(t).map(n=>t[n])]}const es=ns;function rs(t,n){const e=[];for(const r of n)for(const o of t)e.push([r,o]);return e}const os=c(rs);function cs(t,n){const e=Math.min(n.length,t.length),r=[];for(let o=0;o<e;o++)r.push([n[o],t[o]]);return r}const ss=c(cs);function us(t,n){return t.reduce((e,r,o)=>(o<n.length&&(e[r]=n[o]),e),{})}const is=c(us);function fs(t,n,e){const r=Math.min(e.length,n.length),o=[];for(let s=0;s<r;s++)o.push(t(e[s],n[s]));return o}const ls=c(fs),R=Symbol("ZipAllShortest");function as(t,n){if(n.length===0)return[];if(t===R){const e=Math.min(...n.map(r=>r.length));return Array.from({length:e},(r,o)=>n.map(s=>s[o]))}else{const e=Math.max(...n.map(r=>r.length));return Array.from({length:e},(r,o)=>n.map(s=>o<s.length?s[o]:t))}}const hs=c(as);function gs(t){const n=Math.max(0,...t.map(r=>r.length)),e=[];for(let r=0;r<n;r++)for(let o=0;o<t.length;o++)r<t[o].length&&e.push(t[o][r]);return e}const ps=gs;function ys(t,n){if(n.length===0)return[];const e=Math.max(...n.map(o=>o.length)),r=[];for(let o=0;o<e;o++){const s=n.map(u=>u[o]);r.push(t(s))}return r}const bs=c(ys);function ms(t,n,e){return v(e[n],t)}const $s=c(ms);function z(t,n,e){if(n.length===0)return t===e;if(e==null)return!1;const[r,...o]=n;if(!(r in e))return!1;const s=e[r];return s===t?!0:z(t,o,s)}const ds=c(z);function As(t,n){const e=[{},{}];for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r],s=t(o,r,n)?e[0]:e[1];s[r]=o}return e}const js=c(As);function Os(t){return JSON.parse(JSON.stringify(t))}const ws=Os;function ks(t,n,e){for(let r=0;r<e.length;r++)if(t(e[r],r,e)===n)return!0;return!1}const Ss=c(ks);function Is(t,n,e){for(let r=0;r<e.length;r++){const o=n(e[r],r,e);if(o!==void 0)return o}return t}const Bs=c(Is);function Ms(t,n){return n.reduce((e,r,o,s)=>(t(r,o,s)&&e.push(o),e),[])}const Ns=c(Ms),G=[!1,null,0,-0,0n,"",void 0,NaN];function vs(t){return t.filter(n=>!G.includes(n))}const Es=vs;function C(t,n){const e={...n},r=n;for(const o in t)if(Object.prototype.hasOwnProperty.call(r,o)){const s=t[o];typeof s=="function"?e[o]=s(r[o]):s&&typeof s=="object"&&r[o]&&typeof r[o]=="object"&&(e[o]=C(s,r[o]))}return e}const Ps=c(C);function x(t,n){return{get:t,set:n}}function xs(t){return x(n=>n[t],(n,e)=>({...e,[t]:n}))}function Us(t){return x(n=>W(t,n),(n,e)=>D(t,n,e))}const Ts=c((t,n)=>t.get(n)),Fs=c((t,n,e)=>t.set(n,e)),Ws=c((t,n,e)=>t.set(n(t.get(e)),e));function b(t,n=new WeakMap){if(t===null||typeof t!="object"&&typeof t!="function"||typeof t=="function")return t;if(n.has(t))return n.get(t);const e=M(t);let r;switch(e){case i.Number:case i.String:case i.Boolean:case i.Symbol:case i.BigInt:r=new t.constructor(t.valueOf());break;case i.Date:r=new Date(t.getTime());break;case i.RegExp:r=new RegExp(t.source,t.flags);break;case i.Array:case i.Arguments:r=new t.constructor(t.length),n.set(t,r);for(let s=0;s<t.length;s++)r[s]=b(t[s],n);return r;case i.Map:return r=new Map,n.set(t,r),t.forEach((s,u)=>{r.set(b(u,n),b(s,n))}),r;case i.Set:return r=new Set,n.set(t,r),t.forEach(s=>{r.add(b(s,n))}),r;case i.ArrayBuffer:r=t.slice(0);break;case i.SharedArrayBuffer:r=t;break;case i.DataView:const o=b(t.buffer,n);r=new DataView(o,t.byteOffset,t.byteLength);break;case i.Int8Array:case i.Uint8Array:case i.Uint8ClampedArray:case i.Int16Array:case i.Uint16Array:case i.Int32Array:case i.Uint32Array:case i.Float32Array:case i.Float64Array:case i.BigInt64Array:case i.BigUint64Array:r=new t.constructor(t);break;case i.Object:r=Object.create(Object.getPrototypeOf(t)),n.set(t,r);for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=b(t[s],n));return Object.getOwnPropertySymbols(t).forEach(s=>{Object.prototype.propertyIsEnumerable.call(t,s)&&(r[s]=b(t[s],n))}),r;case i.Error:r=new t.constructor(t.message),r.name=t.name;break;default:console.warn(`deepClone: Unsupported type ${e}. Returning original object.`),r=t;break}return r!==t&&n.set(t,r),r}const Ls=t=>b(t);function Ds(t,n){if(!t.length)return!0;if(!n||typeof n!="object")return!1;let e=n;for(const r of t)if(!(r in e)||(e=e[r],e==null))return!1;return!0}const Rs=c(Ds),zs=/\.?([^\.\[\]]+)|\[(\d+)\]/g;function Gs(t){if(!t)return[];const n=[];let e;for(;(e=zs.exec(t))!==null;){const r=e[2]?Number(e[2]):e[1];r!==void 0&&n.push(r)}return n}const Cs=Gs;function Vs(t,n){for(const e in t){const r=t[e];if(r&&!r(n[e],e,n))return!1}return!0}const qs=c(Vs);function Zs(t,n){for(const e in t)if(!v(t[e],n[e]))return!1;return!0}const Js=c(Zs);function Ks(t,n){for(const e in t){const r=t[e];if(r&&r(n[e],e,n))return!0}return!1}const Ys=c(Ks);function _s(t,n){return(...e)=>{const r=e.map((o,s)=>{const u=n[s];return u?u(o):o});return t(...r)}}const Hs=c(_s);function Qs(t,n){return(...e)=>{const r=n.map(o=>o(...e));return t(...r)}}const Xs=c(Qs);function tu(t,n){return t.apply(null,n)}const nu=c(tu);function eu(t,n){return t.bind(n)}const ru=c(eu);export{G as FALSY_VALUES,zt as False,Fc as True,R as ZipAllShortest,Z as adjust,K as all,_ as allPass,Q as always,tt as any,et as anyPass,ot as ap,st as aperture,it as append,lt as bifurcate,ru as bind,nu as call,ht as chunk,pt as clone,Ls as cloneDeep,Es as compact,bt as complement,mt as compose,$t as composeAsync,At as concat,Xs as converge,Ot as countBy,c as curry,kt as difference,It as differenceBy,Mt as differenceWith,vt as drop,Pt as dropLast,Ut as dropLastWhile,Ft as dropRepeats,Lt as dropRepeatsWith,Rt as dropWhile,Ps as evolve,Ct as filter,Zt as find,Kt as findIndex,Ns as findIndices,_t as findLast,Qt as findLastIndex,Bs as findMap,tn as first,en as flatMap,on as flatten,sn as flip,Vt as flow,Qr as flowAsync,fn as forEach,an as fromPairs,gn as groupBy,Hn as has,Rs as hasPath,Xn as identity,ne as includes,Ss as includesBy,re as indexBy,ce as indexOf,ue as init,fe as insert,ae as intercalate,ge as interleave,ye as intersection,me as intersectionBy,de as intersectionWith,je as intersperse,we as invert,Se as invertMulti,Wn as isAlpha,Ln as isAlphanumeric,N as isArray,Gn as isArrayLike,zn as isArrayOf,Zn as isAsyncGenerator,Tn as isBlankString,bn as isBoolean,$n as isDate,Dn as isEmail,xn as isEmptyArray,Un as isEmptyObject,Pn as isEmptyString,v as isEqual,dn as isError,Bn as isEven,wn as isFinite,Yn as isFloat,I as isFunction,qn as isGenerator,Jn as isGenericGenerator,Nn as isInfinity,Kn as isInteger,Vn as isIterable,O as isNaN,Sn as isNegative,vn as isNegativeInfinity,pn as isNil,yn as isNotNil,jn as isNull,$ as isNumber,Fn as isNumeric,j as isObject,Mn as isOdd,S as isPlainObject,kn as isPositive,En as isPositiveInfinity,Cn as isPromise,mn as isRegExp,m as isString,An as isSymbol,On as isUndefined,Rn as isUrl,In as isZero,Be as join,ws as jsonClone,Ne as juxt,Ee as keys,xe as last,Te as lastIndexOf,We as length,x as lens,Ws as lensOver,Us as lensPath,xs as lensProp,Fs as lensSet,Ts as lensView,Ye as map,He as mapEntries,Xe as mapKeys,nr as mapValues,rr as max,cr as maxBy,ur as maxWith,fr as mean,ar as median,k as mergeDeleteSymbol,Ve as mergeLeft,Ze as mergeLeftInPlace,qe as mergeRight,Je as mergeRightInPlace,Le as mergeWith,De as mergeWithInPlace,gr as min,yr as minBy,mr as minWith,dr as move,jr as none,wr as nonePass,kr as noop,Ir as nth,Mr as omit,vr as omitBy,Pr as omitIndices,xr as once,Tr as padLeft,Wr as padRight,Dr as pairwise,zr as partition,js as partitionWith,W as path,ds as pathEq,Vr as pathOr,Cs as pathToArray,Zr as pick,Kr as pickBy,_r as pickIndices,Hr as pipe,to as pluck,eo as prepend,oo as product,so as prop,$s as propEq,io as propOr,lo as range,ho as reduce,po as reduceRight,bo as reduceRightWhile,$o as reduceWhile,jo as reject,wo as remove,So as repeat,Bo as reverse,No as rotateLeft,Eo as rotateRight,xo as sample,To as sampleSize,Wo as scan,Do as scanRight,zo as set,D as setPath,Co as shuffle,qo as slice,Jo as sort,Yo as sortBy,Ho as sortWith,Xo as splice,nc as splitAt,Cr as splitBy,rc as splitWhen,cc as sum,uc as sumBy,fc as swap,ac as symmetricDifference,gc as symmetricDifferenceBy,yc as symmetricDifferenceWith,mc as tail,dc as take,jc as takeLast,wc as takeLastWhile,Sc as takeWhile,Bc as tally,Nc as tap,Ec as times,xc as toPairs,Tc as transpose,Lc as unary,Rc as unfold,Gc as union,Vc as unionBy,Zc as unionWith,Kc as unique,_c as uniqueBy,Qc as unzip,bs as unzipWith,ts as update,Hs as useWith,es as values,ps as weave,qs as where,Ys as whereAny,Js as whereEq,os as xprod,ss as zip,hs as zipAll,is as zipObj,ls as zipWith};