@ts-utilities/core 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{i as e,n as t,r as n,t as r}from"./types-CExAEo2W.js";import{a as i,c as a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./functions-DOWFQTb6.js";export{l as convertToNormalCase,i as convertToSlug,p as debounce,c as deepmerge,g as escapeRegExp,s as extendProps,m as getObjectValue,d as hydrate,r as isFalsy,t as isNullish,n as isPlainObject,e as isPrimitive,a as normalizeText,h as poll,u as printf,f as schedule,_ as shield,v as sleep,o as throttle};
1
+ const e=e=>!e,t=e=>e==null,n=e=>{if(e==null)return!0;switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:case`symbol`:return!0;default:return!1}};function r(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function i(e,...t){let n,i={},a=t[t.length-1];a&&typeof a==`object`&&!Array.isArray(a)&&(a.arrayMerge!==void 0||a.clone!==void 0||a.customMerge!==void 0||a.functionMerge!==void 0||a.maxDepth!==void 0)?(i={...i,...a},n=t.slice(0,-1)):n=t;let{arrayMerge:o=`replace`,clone:s=!0,functionMerge:c=`replace`,maxDepth:l=100,customMerge:u}=i,d=new WeakMap;return f(e,n,0);function f(e,t,n){if(n>=l)return console.warn(`[deepmerge] Maximum depth ${l} exceeded. Returning target as-is.`),e;if(!r(e)&&!Array.isArray(e)){for(let n of t)if(n!==void 0){if(u){let t=u(``,e,n);if(t!==void 0)return t}return typeof e==`function`&&typeof n==`function`&&c===`compose`?(...t)=>{e(...t),n(...t)}:n}return e}let i=s?Array.isArray(e)?[...e]:{...e}:e;for(let e of t)if(e!=null&&!d.has(e))if(d.set(e,i),Array.isArray(i)&&Array.isArray(e))i=p(i,e,o);else if(r(i)&&r(e)){let t=new Set([...Object.keys(i),...Object.keys(e),...Object.getOwnPropertySymbols(i),...Object.getOwnPropertySymbols(e)]);for(let a of t){let t=i[a],s=e[a];u&&u(a,t,s)!==void 0?i[a]=u(a,t,s):typeof t==`function`&&typeof s==`function`?c===`compose`?i[a]=(...e)=>{t(...e),s(...e)}:i[a]=s:r(t)&&r(s)?i[a]=f(t,[s],n+1):Array.isArray(t)&&Array.isArray(s)?i[a]=p(t,s,o):s!==void 0&&(i[a]=s)}}else i=e;return i}function p(e,t,n){if(typeof n==`function`)return n(e,t);switch(n){case`concat`:return[...e,...t];case`merge`:let n=Math.max(e.length,t.length),i=[];for(let a=0;a<n;a++)a<e.length&&a<t.length?r(e[a])&&r(t[a])?i[a]=f(e[a],[t[a]],0):i[a]=t[a]:a<e.length?i[a]=e[a]:i[a]=t[a];return i;case`replace`:default:return[...t]}}}function a(e){return o(e)}function o(e){if(e!==null){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(o);if(r(e)){let t={};for(let n in e)t[n]=o(e[n]);return t}return e}}function s(e,t,n){if(typeof t!=`string`&&!Array.isArray(t))return n;let r=(()=>Array.isArray(t)?t:t===``?[]:String(t).split(`.`).filter(e=>e!==``))();if(!Array.isArray(r))return n;let i=e;for(let e of r){if(i==null)return n;let t=typeof e==`string`&&Array.isArray(i)&&/^\d+$/.test(e)?Number.parseInt(e,10):e;i=i[t]}return i===void 0?n:i}function c(e,t){return e==null?e:Object.assign(e,t)}function l(e){return(e.split(`.`).pop()||e).replace(/([a-z])([A-Z])/g,`$1 $2`).split(/[-_|�\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}const u=`àáãäâèéëêìíïîòóöôùúüûñç·/_,:;`,d=e=>{if(typeof e!=`string`)throw TypeError(`Input must be a string`);let t=e.trim().toLowerCase(),n={};for(let e=0;e<29;e++)n[u.charAt(e)]=`aaaaaeeeeiiiioooouuuunc------`.charAt(e);return t=t.replace(RegExp(`[${u}]`,`g`),e=>n[e]||e),t.replace(/[^a-z0-9 -]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+/,``).replace(/-+$/,``)||``},f=(e=1e3,t)=>new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(()=>{a(),n()},e);function i(){clearTimeout(r),a(),n()}function a(){t?.removeEventListener(`abort`,i)}t&&t.addEventListener(`abort`,i,{once:!0})});function p(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.immediate??!1,i,a,o,s;function c(){return s=e.apply(o,a),a=void 0,o=void 0,s}let l=function(...e){return a=e,o=this,i===void 0&&r&&(s=c.call(this)),i!==void 0&&clearTimeout(i),i=setTimeout(c.bind(this),t),s};return Object.defineProperty(l,`isPending`,{get(){return i!==void 0}}),l}function m(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.leading??!0,i=n?.trailing??!0,a,o,s,c,l;function u(){c=Date.now(),l=e.apply(s,o),o=void 0,s=void 0}function d(){a=void 0,i&&o&&u()}let f=function(...e){let n=c?Date.now()-c:1/0;return o=e,s=this,n>=t?r?u():a=setTimeout(d,t):!a&&i&&(a=setTimeout(d,t-n)),l};return Object.defineProperty(f,`isPending`,{get(){return a!==void 0}}),f}function h(e,...t){let n=t.length===1&&Array.isArray(t[0])?t[0]:t,r=0;return e.replace(/%s/g,()=>{let e=n[r++];return e===void 0?``:String(e)})}function g(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _(e,t={}){if(!e)return``;let{lowercase:n=!0,removeAccents:r=!0,removeNonAlphanumeric:i=!0}=t,a=e.normalize(`NFC`);return r&&(a=a.normalize(`NFD`).replace(/\p{M}/gu,``)),i&&(a=a.replace(/^[^\p{L}\p{N}]*|[^\p{L}\p{N}]*$/gu,``)),n&&(a=a.toLocaleLowerCase()),a}async function v(e,{interval:t=5e3,timeout:n=300*1e3,jitter:r=!0,signal:i}={}){let a=Date.now(),o=i?.aborted??!1,s=()=>{o=!0};i?.addEventListener(`abort`,s,{once:!0});try{for(let s=0;;s++){if(o)throw Error(`Polling aborted`);let s=await e();if(s)return s;if(Date.now()-a>=n)throw Error(`Polling timed out`,{cause:`Polling timed out after ${n}ms`});await f(r?t+(Math.random()-.5)*t*.2:t,i)}}catch(e){throw e}finally{i?.removeEventListener(`abort`,s)}}function y(e,t={}){let{retry:n=0,delay:r=0}=t,i=Date.now(),a=async t=>{try{await e();let t=Date.now()-i;console.log(`⚡[schedule.ts] Completed in ${t}ms`)}catch(e){if(console.log(`⚡[schedule.ts] err:`,e),t>0)console.log(`⚡[schedule.ts] Retrying in ${r}ms...`),setTimeout(()=>a(t-1),r);else{let e=Date.now()-i;console.log(`⚡[schedule.ts] Failed after ${e}ms`)}}};setTimeout(()=>a(n),0)}function b(e){if(e instanceof Promise)return e.then(e=>[null,e]).catch(e=>[e,null]);try{return[null,e()]}catch(t){return console.log(`\x1b[31m🛡 [shield]\x1b[0m ${e.name} failed →`,t),[t,null]}}export{l as convertToNormalCase,d as convertToSlug,p as debounce,i as deepmerge,g as escapeRegExp,c as extendProps,s as getObjectValue,a as hydrate,e as isFalsy,t as isNullish,r as isPlainObject,n as isPrimitive,_ as normalizeText,v as poll,h as printf,y as schedule,b as shield,f as sleep,m as throttle};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-utilities/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "author": "Sohan Emon <sohanemon@outlook.com>",
5
5
  "description": "Core utilities for JavaScript/TypeScript projects",
6
6
  "type": "module",
@@ -16,14 +16,6 @@
16
16
  "import": "./dist/index.js",
17
17
  "require": "./dist/index.cjs"
18
18
  },
19
- "./functions": {
20
- "import": "./dist/functions/index.js",
21
- "require": "./dist/functions/index.cjs"
22
- },
23
- "./types": {
24
- "import": "./dist/types/index.js",
25
- "require": "./dist/types/index.cjs"
26
- },
27
19
  "./package.json": "./package.json"
28
20
  },
29
21
  "typesVersions": {
@@ -1 +0,0 @@
1
- require(`../types-Cr826iDM.cjs`);const e=require(`../functions-Bj4KwuS7.cjs`);exports.convertToNormalCase=e.i,exports.convertToSlug=e.a,exports.debounce=e.o,exports.deepmerge=e.h,exports.escapeRegExp=e.s,exports.extendProps=e.f,exports.getObjectValue=e.p,exports.hydrate=e.m,exports.normalizeText=e.c,exports.poll=e.r,exports.printf=e.l,exports.schedule=e.n,exports.shield=e.t,exports.sleep=e.u,exports.throttle=e.d;
@@ -1,2 +0,0 @@
1
- import { _ as DeepMergeOptions, a as normalizeText, c as throttle, d as Task, f as schedule, g as hydrate, h as getObjectValue, i as escapeRegExp, l as shield, m as extendProps, n as convertToSlug, o as printf, p as poll, r as debounce, s as sleep, t as convertToNormalCase, u as ScheduleOpts, v as deepmerge } from "../index-CODZbfqn.cjs";
2
- export { DeepMergeOptions, ScheduleOpts, Task, convertToNormalCase, convertToSlug, debounce, deepmerge, escapeRegExp, extendProps, getObjectValue, hydrate, normalizeText, poll, printf, schedule, shield, sleep, throttle };
@@ -1,2 +0,0 @@
1
- import { _ as DeepMergeOptions, a as normalizeText, c as throttle, d as Task, f as schedule, g as hydrate, h as getObjectValue, i as escapeRegExp, l as shield, m as extendProps, n as convertToSlug, o as printf, p as poll, r as debounce, s as sleep, t as convertToNormalCase, u as ScheduleOpts, v as deepmerge } from "../index-BlbkY6UJ.js";
2
- export { DeepMergeOptions, ScheduleOpts, Task, convertToNormalCase, convertToSlug, debounce, deepmerge, escapeRegExp, extendProps, getObjectValue, hydrate, normalizeText, poll, printf, schedule, shield, sleep, throttle };
@@ -1 +0,0 @@
1
- import"../types-CExAEo2W.js";import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"../functions-DOWFQTb6.js";export{a as convertToNormalCase,e as convertToSlug,l as debounce,i as deepmerge,f as escapeRegExp,r as extendProps,u as getObjectValue,s as hydrate,t as normalizeText,d as poll,o as printf,c as schedule,p as shield,m as sleep,n as throttle};
@@ -1 +0,0 @@
1
- const e=require(`./types-Cr826iDM.cjs`);function t(t,...n){let r,i={},a=n[n.length-1];a&&typeof a==`object`&&!Array.isArray(a)&&(a.arrayMerge!==void 0||a.clone!==void 0||a.customMerge!==void 0||a.functionMerge!==void 0||a.maxDepth!==void 0)?(i={...i,...a},r=n.slice(0,-1)):r=n;let{arrayMerge:o=`replace`,clone:s=!0,functionMerge:c=`replace`,maxDepth:l=100,customMerge:u}=i,d=new WeakMap;return f(t,r,0);function f(t,n,r){if(r>=l)return console.warn(`[deepmerge] Maximum depth ${l} exceeded. Returning target as-is.`),t;if(!e.r(t)&&!Array.isArray(t)){for(let e of n)if(e!==void 0){if(u){let n=u(``,t,e);if(n!==void 0)return n}return typeof t==`function`&&typeof e==`function`&&c===`compose`?(...n)=>{t(...n),e(...n)}:e}return t}let i=s?Array.isArray(t)?[...t]:{...t}:t;for(let t of n)if(t!=null&&!d.has(t))if(d.set(t,i),Array.isArray(i)&&Array.isArray(t))i=p(i,t,o);else if(e.r(i)&&e.r(t)){let n=new Set([...Object.keys(i),...Object.keys(t),...Object.getOwnPropertySymbols(i),...Object.getOwnPropertySymbols(t)]);for(let a of n){let n=i[a],s=t[a];u&&u(a,n,s)!==void 0?i[a]=u(a,n,s):typeof n==`function`&&typeof s==`function`?c===`compose`?i[a]=(...e)=>{n(...e),s(...e)}:i[a]=s:e.r(n)&&e.r(s)?i[a]=f(n,[s],r+1):Array.isArray(n)&&Array.isArray(s)?i[a]=p(n,s,o):s!==void 0&&(i[a]=s)}}else i=t;return i}function p(t,n,r){if(typeof r==`function`)return r(t,n);switch(r){case`concat`:return[...t,...n];case`merge`:let r=Math.max(t.length,n.length),i=[];for(let a=0;a<r;a++)a<t.length&&a<n.length?e.r(t[a])&&e.r(n[a])?i[a]=f(t[a],[n[a]],0):i[a]=n[a]:a<t.length?i[a]=t[a]:i[a]=n[a];return i;case`replace`:default:return[...n]}}}function n(e){return r(e)}function r(t){if(t!==null){if(typeof t!=`object`||!t)return t;if(Array.isArray(t))return t.map(r);if(e.r(t)){let e={};for(let n in t)e[n]=r(t[n]);return e}return t}}function i(e,t,n){if(typeof t!=`string`&&!Array.isArray(t))return n;let r=(()=>Array.isArray(t)?t:t===``?[]:String(t).split(`.`).filter(e=>e!==``))();if(!Array.isArray(r))return n;let i=e;for(let e of r){if(i==null)return n;let t=typeof e==`string`&&Array.isArray(i)&&/^\d+$/.test(e)?Number.parseInt(e,10):e;i=i[t]}return i===void 0?n:i}function a(e,t){return e==null?e:Object.assign(e,t)}function o(e){return(e.split(`.`).pop()||e).replace(/([a-z])([A-Z])/g,`$1 $2`).split(/[-_|�\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}const s=`àáãäâèéëêìíïîòóöôùúüûñç·/_,:;`,c=`aaaaaeeeeiiiioooouuuunc------`,l=e=>{if(typeof e!=`string`)throw TypeError(`Input must be a string`);let t=e.trim().toLowerCase(),n={};for(let e=0;e<29;e++)n[s.charAt(e)]=`aaaaaeeeeiiiioooouuuunc------`.charAt(e);return t=t.replace(RegExp(`[${s}]`,`g`),e=>n[e]||e),t.replace(/[^a-z0-9 -]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+/,``).replace(/-+$/,``)||``},u=(e=1e3,t)=>new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(()=>{a(),n()},e);function i(){clearTimeout(r),a(),n()}function a(){t?.removeEventListener(`abort`,i)}t&&t.addEventListener(`abort`,i,{once:!0})});function d(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.immediate??!1,i,a,o,s;function c(){return s=e.apply(o,a),a=void 0,o=void 0,s}let l=function(...e){return a=e,o=this,i===void 0&&r&&(s=c.call(this)),i!==void 0&&clearTimeout(i),i=setTimeout(c.bind(this),t),s};return Object.defineProperty(l,`isPending`,{get(){return i!==void 0}}),l}function f(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.leading??!0,i=n?.trailing??!0,a,o,s,c,l;function u(){c=Date.now(),l=e.apply(s,o),o=void 0,s=void 0}function d(){a=void 0,i&&o&&u()}let f=function(...e){let n=c?Date.now()-c:1/0;return o=e,s=this,n>=t?r?u():a=setTimeout(d,t):!a&&i&&(a=setTimeout(d,t-n)),l};return Object.defineProperty(f,`isPending`,{get(){return a!==void 0}}),f}function p(e,...t){let n=t.length===1&&Array.isArray(t[0])?t[0]:t,r=0;return e.replace(/%s/g,()=>{let e=n[r++];return e===void 0?``:String(e)})}function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function h(e,t={}){if(!e)return``;let{lowercase:n=!0,removeAccents:r=!0,removeNonAlphanumeric:i=!0}=t,a=e.normalize(`NFC`);return r&&(a=a.normalize(`NFD`).replace(/\p{M}/gu,``)),i&&(a=a.replace(/^[^\p{L}\p{N}]*|[^\p{L}\p{N}]*$/gu,``)),n&&(a=a.toLocaleLowerCase()),a}async function g(e,{interval:t=5e3,timeout:n=300*1e3,jitter:r=!0,signal:i}={}){let a=Date.now(),o=i?.aborted??!1,s=()=>{o=!0};i?.addEventListener(`abort`,s,{once:!0});try{for(let s=0;;s++){if(o)throw Error(`Polling aborted`);let s=await e();if(s)return s;if(Date.now()-a>=n)throw Error(`Polling timed out`,{cause:`Polling timed out after ${n}ms`});await u(r?t+(Math.random()-.5)*t*.2:t,i)}}catch(e){throw e}finally{i?.removeEventListener(`abort`,s)}}function _(e,t={}){let{retry:n=0,delay:r=0}=t,i=Date.now(),a=async t=>{try{await e();let t=Date.now()-i;console.log(`⚡[schedule.ts] Completed in ${t}ms`)}catch(e){if(console.log(`⚡[schedule.ts] err:`,e),t>0)console.log(`⚡[schedule.ts] Retrying in ${r}ms...`),setTimeout(()=>a(t-1),r);else{let e=Date.now()-i;console.log(`⚡[schedule.ts] Failed after ${e}ms`)}}};setTimeout(()=>a(n),0)}function v(e){if(e instanceof Promise)return e.then(e=>[null,e]).catch(e=>[e,null]);try{return[null,e()]}catch(t){return console.log(`\x1b[31m🛡 [shield]\x1b[0m ${e.name} failed →`,t),[t,null]}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return u}});
@@ -1 +0,0 @@
1
- import{r as e}from"./types-CExAEo2W.js";function t(t,...n){let r,i={},a=n[n.length-1];a&&typeof a==`object`&&!Array.isArray(a)&&(a.arrayMerge!==void 0||a.clone!==void 0||a.customMerge!==void 0||a.functionMerge!==void 0||a.maxDepth!==void 0)?(i={...i,...a},r=n.slice(0,-1)):r=n;let{arrayMerge:o=`replace`,clone:s=!0,functionMerge:c=`replace`,maxDepth:l=100,customMerge:u}=i,d=new WeakMap;return f(t,r,0);function f(t,n,r){if(r>=l)return console.warn(`[deepmerge] Maximum depth ${l} exceeded. Returning target as-is.`),t;if(!e(t)&&!Array.isArray(t)){for(let e of n)if(e!==void 0){if(u){let n=u(``,t,e);if(n!==void 0)return n}return typeof t==`function`&&typeof e==`function`&&c===`compose`?(...n)=>{t(...n),e(...n)}:e}return t}let i=s?Array.isArray(t)?[...t]:{...t}:t;for(let t of n)if(t!=null&&!d.has(t))if(d.set(t,i),Array.isArray(i)&&Array.isArray(t))i=p(i,t,o);else if(e(i)&&e(t)){let n=new Set([...Object.keys(i),...Object.keys(t),...Object.getOwnPropertySymbols(i),...Object.getOwnPropertySymbols(t)]);for(let a of n){let n=i[a],s=t[a];u&&u(a,n,s)!==void 0?i[a]=u(a,n,s):typeof n==`function`&&typeof s==`function`?c===`compose`?i[a]=(...e)=>{n(...e),s(...e)}:i[a]=s:e(n)&&e(s)?i[a]=f(n,[s],r+1):Array.isArray(n)&&Array.isArray(s)?i[a]=p(n,s,o):s!==void 0&&(i[a]=s)}}else i=t;return i}function p(t,n,r){if(typeof r==`function`)return r(t,n);switch(r){case`concat`:return[...t,...n];case`merge`:let r=Math.max(t.length,n.length),i=[];for(let a=0;a<r;a++)a<t.length&&a<n.length?e(t[a])&&e(n[a])?i[a]=f(t[a],[n[a]],0):i[a]=n[a]:a<t.length?i[a]=t[a]:i[a]=n[a];return i;case`replace`:default:return[...n]}}}function n(e){return r(e)}function r(t){if(t!==null){if(typeof t!=`object`||!t)return t;if(Array.isArray(t))return t.map(r);if(e(t)){let e={};for(let n in t)e[n]=r(t[n]);return e}return t}}function i(e,t,n){if(typeof t!=`string`&&!Array.isArray(t))return n;let r=(()=>Array.isArray(t)?t:t===``?[]:String(t).split(`.`).filter(e=>e!==``))();if(!Array.isArray(r))return n;let i=e;for(let e of r){if(i==null)return n;let t=typeof e==`string`&&Array.isArray(i)&&/^\d+$/.test(e)?Number.parseInt(e,10):e;i=i[t]}return i===void 0?n:i}function a(e,t){return e==null?e:Object.assign(e,t)}function o(e){return(e.split(`.`).pop()||e).replace(/([a-z])([A-Z])/g,`$1 $2`).split(/[-_|�\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}const s=`àáãäâèéëêìíïîòóöôùúüûñç·/_,:;`,c=e=>{if(typeof e!=`string`)throw TypeError(`Input must be a string`);let t=e.trim().toLowerCase(),n={};for(let e=0;e<29;e++)n[s.charAt(e)]=`aaaaaeeeeiiiioooouuuunc------`.charAt(e);return t=t.replace(RegExp(`[${s}]`,`g`),e=>n[e]||e),t.replace(/[^a-z0-9 -]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+/,``).replace(/-+$/,``)||``},l=(e=1e3,t)=>new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(()=>{a(),n()},e);function i(){clearTimeout(r),a(),n()}function a(){t?.removeEventListener(`abort`,i)}t&&t.addEventListener(`abort`,i,{once:!0})});function u(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.immediate??!1,i,a,o,s;function c(){return s=e.apply(o,a),a=void 0,o=void 0,s}let l=function(...e){return a=e,o=this,i===void 0&&r&&(s=c.call(this)),i!==void 0&&clearTimeout(i),i=setTimeout(c.bind(this),t),s};return Object.defineProperty(l,`isPending`,{get(){return i!==void 0}}),l}function d(e,t=100,n){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");let r=n?.leading??!0,i=n?.trailing??!0,a,o,s,c,l;function u(){c=Date.now(),l=e.apply(s,o),o=void 0,s=void 0}function d(){a=void 0,i&&o&&u()}let f=function(...e){let n=c?Date.now()-c:1/0;return o=e,s=this,n>=t?r?u():a=setTimeout(d,t):!a&&i&&(a=setTimeout(d,t-n)),l};return Object.defineProperty(f,`isPending`,{get(){return a!==void 0}}),f}function f(e,...t){let n=t.length===1&&Array.isArray(t[0])?t[0]:t,r=0;return e.replace(/%s/g,()=>{let e=n[r++];return e===void 0?``:String(e)})}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function m(e,t={}){if(!e)return``;let{lowercase:n=!0,removeAccents:r=!0,removeNonAlphanumeric:i=!0}=t,a=e.normalize(`NFC`);return r&&(a=a.normalize(`NFD`).replace(/\p{M}/gu,``)),i&&(a=a.replace(/^[^\p{L}\p{N}]*|[^\p{L}\p{N}]*$/gu,``)),n&&(a=a.toLocaleLowerCase()),a}async function h(e,{interval:t=5e3,timeout:n=300*1e3,jitter:r=!0,signal:i}={}){let a=Date.now(),o=i?.aborted??!1,s=()=>{o=!0};i?.addEventListener(`abort`,s,{once:!0});try{for(let s=0;;s++){if(o)throw Error(`Polling aborted`);let s=await e();if(s)return s;if(Date.now()-a>=n)throw Error(`Polling timed out`,{cause:`Polling timed out after ${n}ms`});await l(r?t+(Math.random()-.5)*t*.2:t,i)}}catch(e){throw e}finally{i?.removeEventListener(`abort`,s)}}function g(e,t={}){let{retry:n=0,delay:r=0}=t,i=Date.now(),a=async t=>{try{await e();let t=Date.now()-i;console.log(`⚡[schedule.ts] Completed in ${t}ms`)}catch(e){if(console.log(`⚡[schedule.ts] err:`,e),t>0)console.log(`⚡[schedule.ts] Retrying in ${r}ms...`),setTimeout(()=>a(t-1),r);else{let e=Date.now()-i;console.log(`⚡[schedule.ts] Failed after ${e}ms`)}}};setTimeout(()=>a(n),0)}function _(e){if(e instanceof Promise)return e.then(e=>[null,e]).catch(e=>[e,null]);try{return[null,e()]}catch(t){return console.log(`\x1b[31m🛡 [shield]\x1b[0m ${e.name} failed →`,t),[t,null]}}export{c as a,m as c,d,a as f,t as h,o as i,f as l,n as m,g as n,u as o,i as p,h as r,p as s,_ as t,l as u};