@react-hive/honey-utils 3.3.3 → 3.5.0

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/README.md CHANGED
@@ -574,6 +574,7 @@ function divide(a: number, b: number): number {
574
574
  - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
575
575
  - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
576
576
  - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
577
+ - `once<T extends (...args: any[]) => any>(fn: T): T` - Wraps a function so it can only be executed once. The result of the first invocation is cached and returned for all subsequent calls. Preserves both the original function’s parameter types and `this` binding.
577
578
 
578
579
  ### Type Guards
579
580
 
@@ -594,6 +595,8 @@ function divide(a: number, b: number): number {
594
595
  - `isMap(value: unknown): value is Map<unknown, unknown>` - Checks if a value is a `Map`.
595
596
  - `isSet(value: unknown): value is Set<unknown>` - Checks if a value is a `Set`.
596
597
  - `isSymbol(value: unknown): value is symbol` - Checks if a value is a `Symbol`.
598
+ - `isBlob(value: unknown): value is Blob` — Checks if a value is a `Blob`.
599
+ - `isError(value: unknown): value is Error` — Checks if a value is an `Error` object.
597
600
 
598
601
  ### Math Utilities
599
602
 
@@ -611,6 +614,8 @@ function divide(a: number, b: number): number {
611
614
  - `isContentEditableHtmlElement(element: HTMLElement): boolean` - Returns `true` if the element has `contenteditable="true"`, making it user-editable and implicitly focusable.
612
615
  - `isHtmlElementFocusable(element: Nullable<HTMLElement>): boolean` - Checks whether an element is considered focusable according to browser rules. Factors include: visibility, `display`, `disabled`, `tabindex`, native focusable tags, `contenteditable`, and presence of a non-null `tabindex`.
613
616
  - `getFocusableHtmlElements(container: HTMLElement): HTMLElement[]` - Returns all focusable descendant elements within a container, using `isHtmlElementFocusable` to filter them.
617
+ - `isLocalStorageReadable(): boolean` - Determines whether `localStorage` can be safely read from. This check works even when writes fail (e.g., due to `QuotaExceededError`) and ensures that calling `getItem()` does not throw in restricted environments.
618
+ - `getLocalStorageCapabilities(): LocalStorageCapabilities` - Detects the browser's read and write capabilities for `localStorage`. Readability is determined by safe execution of `getItem()`, while writability requires successful `setItem()` and `removeItem()`. Returns cached results after the first evaluation.
614
619
 
615
620
  ### File Utilities
616
621
 
@@ -618,8 +623,8 @@ function divide(a: number, b: number): number {
618
623
  - `parseFileName(fileName: string): [baseName: string, extension: string]` - Splits a file name into its base name and extension using the last `.` as the separator. Handles edge cases such as hidden files (`.gitignore`), multi-dot names (`archive.tar.gz`), and names ending with a dot (`"file."`). The extension is returned in lowercase.
619
624
  - `fileListToFiles(fileList: FileList | null): File[]` - Converts a `FileList` object (such as the one returned from an `<input type="file">`) into a standard array of `File` objects. Returns an empty array when the input is `null`.
620
625
  - `blobToFile(blob: Blob, fileName: string): File` - Converts a Blob object into a File object with the specified name.
621
- - `traverseFileSystemDirectory(directoryEntry: FileSystemDirectoryEntry, options?: TraverseDirectoryOptions): Promise<File[]>` — Recursively scans a directory using the File System API and returns all nested files as `File` objects. Supports skipping system files and reporting progress through an optional `onProgress` callback.
622
- - `readFilesFromDataTransfer(dataTransfer: DataTransfer | null, options?: TraverseDirectoryOptions): Promise<File[]>` — Extracts files from a `DataTransfer` object (e.g., drag-and-drop or paste events). Supports both regular files and entire directories via the non-standard `webkitGetAsEntry` API. Directories are traversed recursively using `traverseFileSystemDirectory`, producing a fully flattened list of all discovered `File` objects. Optional `options` allow skipping system files and receiving progress updates during traversal.
626
+ - `traverseFileSystemDirectory(directoryEntry: FileSystemDirectoryEntry, options?: TraverseDirectoryOptions): Promise<File[]>` — Recursively scans a directory using the File System API and returns all nested files as `File` objects. Supports skipping system files.
627
+ - `readFilesFromDataTransfer(dataTransfer: DataTransfer | null, options?: TraverseDirectoryOptions): Promise<File[]>` — Extracts files from a `DataTransfer` object (e.g., drag-and-drop or paste events). Supports both regular files and entire directories via the non-standard `webkitGetAsEntry` API. Directories are traversed recursively using `traverseFileSystemDirectory`, producing a fully flattened list of all discovered `File` objects.
623
628
 
624
629
  ### Asynchronous Utilities
625
630
 
package/dist/README.md CHANGED
@@ -574,6 +574,7 @@ function divide(a: number, b: number): number {
574
574
  - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
575
575
  - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
576
576
  - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
577
+ - `once<T extends (...args: any[]) => any>(fn: T): T` - Wraps a function so it can only be executed once. The result of the first invocation is cached and returned for all subsequent calls. Preserves both the original function’s parameter types and `this` binding.
577
578
 
578
579
  ### Type Guards
579
580
 
@@ -594,6 +595,8 @@ function divide(a: number, b: number): number {
594
595
  - `isMap(value: unknown): value is Map<unknown, unknown>` - Checks if a value is a `Map`.
595
596
  - `isSet(value: unknown): value is Set<unknown>` - Checks if a value is a `Set`.
596
597
  - `isSymbol(value: unknown): value is symbol` - Checks if a value is a `Symbol`.
598
+ - `isBlob(value: unknown): value is Blob` — Checks if a value is a `Blob`.
599
+ - `isError(value: unknown): value is Error` — Checks if a value is an `Error` object.
597
600
 
598
601
  ### Math Utilities
599
602
 
@@ -611,6 +614,8 @@ function divide(a: number, b: number): number {
611
614
  - `isContentEditableHtmlElement(element: HTMLElement): boolean` - Returns `true` if the element has `contenteditable="true"`, making it user-editable and implicitly focusable.
612
615
  - `isHtmlElementFocusable(element: Nullable<HTMLElement>): boolean` - Checks whether an element is considered focusable according to browser rules. Factors include: visibility, `display`, `disabled`, `tabindex`, native focusable tags, `contenteditable`, and presence of a non-null `tabindex`.
613
616
  - `getFocusableHtmlElements(container: HTMLElement): HTMLElement[]` - Returns all focusable descendant elements within a container, using `isHtmlElementFocusable` to filter them.
617
+ - `isLocalStorageReadable(): boolean` - Determines whether `localStorage` can be safely read from. This check works even when writes fail (e.g., due to `QuotaExceededError`) and ensures that calling `getItem()` does not throw in restricted environments.
618
+ - `getLocalStorageCapabilities(): LocalStorageCapabilities` - Detects the browser's read and write capabilities for `localStorage`. Readability is determined by safe execution of `getItem()`, while writability requires successful `setItem()` and `removeItem()`. Returns cached results after the first evaluation.
614
619
 
615
620
  ### File Utilities
616
621
 
@@ -618,8 +623,8 @@ function divide(a: number, b: number): number {
618
623
  - `parseFileName(fileName: string): [baseName: string, extension: string]` - Splits a file name into its base name and extension using the last `.` as the separator. Handles edge cases such as hidden files (`.gitignore`), multi-dot names (`archive.tar.gz`), and names ending with a dot (`"file."`). The extension is returned in lowercase.
619
624
  - `fileListToFiles(fileList: FileList | null): File[]` - Converts a `FileList` object (such as the one returned from an `<input type="file">`) into a standard array of `File` objects. Returns an empty array when the input is `null`.
620
625
  - `blobToFile(blob: Blob, fileName: string): File` - Converts a Blob object into a File object with the specified name.
621
- - `traverseFileSystemDirectory(directoryEntry: FileSystemDirectoryEntry, options?: TraverseDirectoryOptions): Promise<File[]>` — Recursively scans a directory using the File System API and returns all nested files as `File` objects. Supports skipping system files and reporting progress through an optional `onProgress` callback.
622
- - `readFilesFromDataTransfer(dataTransfer: DataTransfer | null, options?: TraverseDirectoryOptions): Promise<File[]>` — Extracts files from a `DataTransfer` object (e.g., drag-and-drop or paste events). Supports both regular files and entire directories via the non-standard `webkitGetAsEntry` API. Directories are traversed recursively using `traverseFileSystemDirectory`, producing a fully flattened list of all discovered `File` objects. Optional `options` allow skipping system files and receiving progress updates during traversal.
626
+ - `traverseFileSystemDirectory(directoryEntry: FileSystemDirectoryEntry, options?: TraverseDirectoryOptions): Promise<File[]>` — Recursively scans a directory using the File System API and returns all nested files as `File` objects. Supports skipping system files.
627
+ - `readFilesFromDataTransfer(dataTransfer: DataTransfer | null, options?: TraverseDirectoryOptions): Promise<File[]>` — Extracts files from a `DataTransfer` object (e.g., drag-and-drop or paste events). Supports both regular files and entire directories via the non-standard `webkitGetAsEntry` API. Directories are traversed recursively using `traverseFileSystemDirectory`, producing a fully flattened list of all discovered `File` objects.
623
628
 
624
629
  ### Asynchronous Utilities
625
630
 
package/dist/dom.d.ts CHANGED
@@ -108,4 +108,38 @@ export declare const isHtmlElementFocusable: (element: HTMLElement | null) => bo
108
108
  * @returns An array of focusable HTMLElements in DOM order.
109
109
  */
110
110
  export declare const getFocusableHtmlElements: (container: HTMLElement) => HTMLElement[];
111
+ /**
112
+ * Determines whether the browser environment allows safe read access to
113
+ * `localStorage`. Some platforms (e.g., Safari Private Mode, sandboxed iframes)
114
+ * expose `localStorage` but still throw when accessed.
115
+ *
116
+ * This function **only tests read access**, making it safe even when write
117
+ * operations would fail due to `QuotaExceededError` or storage restrictions.
118
+ *
119
+ * @returns `true` if `localStorage` exists and calling `getItem()` does not
120
+ * throw; otherwise `false`.
121
+ */
122
+ export declare const isLocalStorageReadable: () => boolean;
123
+ interface LocalStorageCapabilities {
124
+ readable: boolean;
125
+ writable: boolean;
126
+ }
127
+ /**
128
+ * Detects and returns the browser's `localStorage` read and write capabilities.
129
+ * The function is wrapped in `once()`, so capability detection is performed
130
+ * only on the first invocation and cached for all future calls.
131
+ *
132
+ * Detection logic:
133
+ * - **Readable**: Successfully calling `getItem()` without exceptions.
134
+ * - **Writable**: Successfully calling `setItem()` and `removeItem()` without
135
+ * triggering `QuotaExceededError` or other security restrictions.
136
+ *
137
+ * Edge-case behavior:
138
+ * - In some environments, storage may be readable but not writable (e.g.,
139
+ * Safari Private Mode or quota-full situations).
140
+ * - In SSR contexts or restricted frames, both capabilities will be `false`.
141
+ *
142
+ * @returns An object describing the available capabilities.
143
+ */
144
+ export declare const getLocalStorageCapabilities: () => LocalStorageCapabilities;
111
145
  export {};
package/dist/file.d.ts CHANGED
@@ -50,19 +50,6 @@ export declare const fileListToFiles: (fileList: FileList | null) => File[];
50
50
  * ```
51
51
  */
52
52
  export declare const blobToFile: (blob: Blob, fileName: string) => File;
53
- /**
54
- * A callback function invoked whenever a file is discovered during directory traversal.
55
- *
56
- * @param progress - An object containing details about the current traversal state.
57
- * @param progress.processed - The total number of files processed so far.
58
- * @param progress.currentFile - The `File` object for the file just discovered (if available).
59
- * @param progress.path - The full path of the file relative to the traversed directory (if available).
60
- */
61
- type TraverseDirectoryOnProgressHandler = (progress: {
62
- processed: number;
63
- currentFile?: File;
64
- path?: string;
65
- }) => void;
66
53
  interface TraverseDirectoryOptions {
67
54
  /**
68
55
  * A list of file names that should be ignored during traversal.
@@ -72,11 +59,6 @@ interface TraverseDirectoryOptions {
72
59
  * `.DS_Store`, `Thumbs.db`, `desktop.ini`, `.Spotlight-V100`, etc.
73
60
  */
74
61
  skipFiles?: string[];
75
- /**
76
- * Optional callback invoked each time a file is discovered.
77
- * Useful for progress tracking when traversing large or deeply nested directories.
78
- */
79
- onProgress?: TraverseDirectoryOnProgressHandler;
80
62
  }
81
63
  /**
82
64
  * Recursively scans a directory using the File System API and collects all nested files.
@@ -85,17 +67,12 @@ interface TraverseDirectoryOptions {
85
67
  * Directories themselves are not returned. To avoid unnecessary noise, certain system or
86
68
  * OS-generated files can be excluded via the `skipFiles` option.
87
69
  *
88
- * A progress callback (`onProgress`) may be provided to receive updates each time a file
89
- * is discovered. This is useful when working with large folders or deeply nested structures.
90
- *
91
70
  * @param directoryEntry - The starting directory entry to traverse.
92
71
  * @param options - Optional settings that control traversal behavior.
93
- * @param processed - Internal counter used to track the number of processed files
94
- * during recursive traversal. Not intended to be provided manually.
95
72
  *
96
73
  * @returns A promise resolving to a flat array of all collected `File` objects.
97
74
  */
98
- export declare const traverseFileSystemDirectory: (directoryEntry: FileSystemDirectoryEntry, { skipFiles, onProgress, }?: TraverseDirectoryOptions, processed?: number) => Promise<File[]>;
75
+ export declare const traverseFileSystemDirectory: (directoryEntry: FileSystemDirectoryEntry, { skipFiles, }?: TraverseDirectoryOptions) => Promise<File[]>;
99
76
  /**
100
77
  * Reads files from a `DataTransfer` object, supporting both individual files
101
78
  * and entire directories (when available through the non-standard `webkitGetAsEntry` API).
@@ -105,13 +82,9 @@ export declare const traverseFileSystemDirectory: (directoryEntry: FileSystemDir
105
82
  * they are traversed recursively using `traverseFileSystemDirectory`, returning a
106
83
  * fully flattened list of nested files.
107
84
  *
108
- * The `traverseOptions` parameter can be used to skip system files or receive
109
- * progress updates during directory traversal.
110
- *
111
85
  * @param dataTransfer - The `DataTransfer` instance from a drop or paste event.
112
86
  * If `null` or missing items, an empty array is returned.
113
87
  * @param traverseOptions - Optional settings passed to directory traversal.
114
- * Useful for skipping unwanted files or enabling `onProgress` callbacks.
115
88
  *
116
89
  * @returns A promise that resolves to a flat array of all extracted `File` objects.
117
90
  * This includes:
@@ -159,4 +159,23 @@ interface RetryOptions {
159
159
  * ```
160
160
  */
161
161
  export declare const retry: <Task extends (...args: unknown[]) => Promise<TaskResult>, TaskResult>(task: Task, { maxAttempts, delayMs, backoff, onRetry }?: RetryOptions) => ((...args: Parameters<Task>) => Promise<TaskResult>);
162
+ /**
163
+ * Wraps a function so that it can only be executed once.
164
+ * The wrapped function remembers (caches) the result of the first invocation
165
+ * and returns that same result for all subsequent calls, regardless of the arguments provided.
166
+ *
167
+ * Common use cases include:
168
+ * - initializing singletons
169
+ * - running setup logic only once
170
+ * - avoiding repeated expensive computations
171
+ *
172
+ * @template T - A function type whose return value should be cached.
173
+ *
174
+ * @param fn - The function to execute at most once.
175
+ *
176
+ * @returns A new function with the same signature as `fn`, but guaranteed to
177
+ * execute `fn` only on the first call and return the cached result
178
+ * thereafter.
179
+ */
180
+ export declare const once: <T extends (...args: any[]) => any>(fn: T) => T;
162
181
  export {};
package/dist/guards.d.ts CHANGED
@@ -23,6 +23,14 @@ export declare const isNil: (value: unknown) => value is null | undefined;
23
23
  * @returns `true` if the value is defined (not `null` or `undefined`); otherwise, `false`.
24
24
  */
25
25
  export declare const isDefined: <T>(value: T) => value is NonNullable<T>;
26
+ /**
27
+ * Checks if a value is undefined.
28
+ *
29
+ * @param value - The value to check.
30
+ *
31
+ * @returns `true` if the value is undefined; otherwise, `false`.
32
+ */
33
+ export declare const isUndefined: (value: unknown) => value is undefined;
26
34
  /**
27
35
  * Checks if a value is a number.
28
36
  *
@@ -63,6 +71,22 @@ export declare const isEmptyObject: (value: unknown) => value is Record<string,
63
71
  * @returns `true` if the value is a Date object; otherwise, `false`.
64
72
  */
65
73
  export declare const isDate: (value: unknown) => value is Date;
74
+ /**
75
+ * Checks if a value is a `Blob`.
76
+ *
77
+ * @param value - The value to check.
78
+ *
79
+ * @returns `true` if the value is a Blob object; otherwise, `false`.
80
+ */
81
+ export declare const isBlob: (value: unknown) => value is Blob;
82
+ /**
83
+ * Checks if a value is an `Error` object.
84
+ *
85
+ * @param value - The value to check.
86
+ *
87
+ * @returns `true` if the value is an Error instance; otherwise, `false`.
88
+ */
89
+ export declare const isError: (value: unknown) => value is Error;
66
90
  /**
67
91
  * Checks if a value is a valid Date object (not Invalid Date).
68
92
  *
@@ -103,14 +127,6 @@ export declare const isSet: (value: unknown) => value is Set<unknown>;
103
127
  * @returns `true` if the value is a Symbol; otherwise, `false`.
104
128
  */
105
129
  export declare const isSymbol: (value: unknown) => value is symbol;
106
- /**
107
- * Checks if a value is undefined.
108
- *
109
- * @param value - The value to check.
110
- *
111
- * @returns `true` if the value is undefined; otherwise, `false`.
112
- */
113
- export declare const isUndefined: (value: unknown) => value is undefined;
114
130
  /**
115
131
  * Checks if a value is a finite number.
116
132
  *
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!e)throw new Error(t)}e.r(t),e.d(t,{FOCUSABLE_HTML_TAGS:()=>ee,assert:()=>r,blobToFile:()=>ye,calculateEuclideanDistance:()=>K,calculateMovingSpeed:()=>J,calculatePercentage:()=>Q,camelToDashCase:()=>G,camelToWords:()=>V,chunk:()=>F,cloneBlob:()=>re,compact:()=>S,compose:()=>O,delay:()=>N,difference:()=>M,everyAsync:()=>_,fileListToFiles:()=>fe,filterParallel:()=>B,filterSequential:()=>X,findAsync:()=>Y,getDOMRectIntersectionRatio:()=>ne,getElementOffsetRect:()=>se,getFocusableHtmlElements:()=>le,hashString:()=>Z,intersection:()=>E,invokeIfFunction:()=>v,isAnchorHtmlElement:()=>ie,isArray:()=>w,isBool:()=>o,isContentEditableHtmlElement:()=>ae,isDate:()=>u,isDefined:()=>i,isEmptyArray:()=>A,isEmptyObject:()=>c,isFile:()=>ce,isFiniteNumber:()=>d,isFunction:()=>C,isHtmlElementFocusable:()=>oe,isInteger:()=>b,isMap:()=>m,isNil:()=>s,isNilOrEmptyString:()=>U,isNull:()=>n,isNumber:()=>a,isObject:()=>l,isPromise:()=>$,isRegExp:()=>y,isSet:()=>h,isString:()=>q,isSymbol:()=>p,isUndefined:()=>g,isValidDate:()=>f,noop:()=>k,not:()=>D,parse2DMatrix:()=>te,parseFileName:()=>ue,pipe:()=>T,readFilesFromDataTransfer:()=>he,reduceAsync:()=>H,retry:()=>R,runParallel:()=>L,runSequential:()=>j,someAsync:()=>I,splitStringIntoWords:()=>W,timeout:()=>x,toKebabCase:()=>z,traverseFileSystemDirectory:()=>me,unique:()=>P});const n=e=>null===e,s=e=>null==e,i=e=>null!=e,a=e=>"number"==typeof e,o=e=>"boolean"==typeof e,l=e=>"object"==typeof e,c=e=>l(e)&&!n(e)&&0===Object.keys(e).length,u=e=>e instanceof Date,f=e=>u(e)&&!isNaN(e.getTime()),y=e=>e instanceof RegExp,m=e=>e instanceof Map,h=e=>e instanceof Set,p=e=>"symbol"==typeof e,g=e=>void 0===e,d=e=>a(e)&&isFinite(e),b=e=>a(e)&&Number.isInteger(e),w=e=>Array.isArray(e),A=e=>w(e)&&0===e.length,S=e=>e.filter(Boolean),P=e=>[...new Set(e)],F=(e,t)=>(r(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,(n+1)*t))),E=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...r]=e;return P(t).filter(e=>r.every(t=>t.includes(e)))},M=(e,t)=>e.filter(e=>!t.includes(e)),T=(...e)=>t=>e.reduce((e,t)=>t(e),t),O=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),k=()=>{},C=e=>"function"==typeof e,D=e=>(...t)=>!e(...t),v=(e,...t)=>"function"==typeof e?e(...t):e,N=e=>new Promise(t=>setTimeout(t,e)),x=async(e,t,r="Operation timed out")=>{try{return await Promise.race([e,N(t).then(()=>Promise.reject(new Error(r)))])}finally{}},R=(e,{maxAttempts:t=3,delayMs:r=300,backoff:n=!0,onRetry:s}={})=>async(...i)=>{let a;for(let o=1;o<=t;o++)try{return await e(...i)}catch(e){if(a=e,o<t){s?.(o,e);const t=n?r*2**(o-1):r;await N(t)}}throw a},$=e=>C(e?.then),j=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(await t(e[n],n,e));return r},L=async(e,t)=>Promise.all(e.map(t)),X=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++){const s=e[n];await t(s,n,e)&&r.push(s)}return r},B=async(e,t)=>{const r=await L(e,async(e,r,n)=>!!await t(e,r,n)&&e);return S(r)},I=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return!0;return!1},_=async(e,t)=>{for(let r=0;r<e.length;r++)if(!await t(e[r],r,e))return!1;return!0},H=async(e,t,r)=>{let n=r;for(let r=0;r<e.length;r++)n=await t(n,e[r],r,e);return n},Y=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return e[r];return null},q=e=>"string"==typeof e,U=e=>""===e||s(e),z=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),G=e=>{const t=e.charAt(0),r=e.slice(1);return t.toLowerCase()+r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},V=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),W=e=>e.split(" ").filter(Boolean),Z=e=>{let t=5381;for(let r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(36)},K=(e,t,r,n)=>{const s=r-e,i=n-t;return Math.hypot(s,i)},J=(e,t)=>Math.abs(e/t),Q=(e,t)=>e*t/100,ee=["INPUT","SELECT","TEXTAREA","BUTTON","A"],te=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[r,n,s,i,a,o]=t[1].split(", ").map(parseFloat);return{translateX:a,translateY:o,scaleX:r,scaleY:i,skewX:s,skewY:n}},re=e=>new Blob([e],{type:e.type}),ne=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),se=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),ie=e=>"A"===e.tagName,ae=e=>"true"===e.getAttribute("contenteditable"),oe=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if("hidden"===t.visibility||"none"===t.display)return!1;if("disabled"in e&&e.disabled)return!1;const r=e.getAttribute("tabindex");return"-1"!==r&&(ee.includes(e.tagName)?!ie(e)||""!==e.href:!!ae(e)||null!==r)},le=e=>Array.from(e.querySelectorAll("*")).filter(oe),ce=e=>e instanceof File,ue=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},fe=e=>{if(!e)return[];const t=[];for(let r=0;r<e.length;r++)t.push(e[r]);return t},ye=(e,t)=>new File([e],t,{type:e.type}),me=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"],onProgress:r}={},n=0)=>{const s=new Set(t),i=await(async e=>{const t=e.createReader(),r=async()=>new Promise((e,n)=>{t.readEntries(async t=>{if(t.length)try{const n=await r();e([...t,...n])}catch(e){n(e)}else e([])},n)});return r()})(e);return(await L(i,async i=>{if(i.isDirectory)return me(i,{skipFiles:t,onProgress:r},n);if(!s.has(i.name)){const t=await new Promise((e,t)=>{i.file(e,t)});return r&&(n++,r({processed:n,path:`${e.fullPath}/${i.name}`,currentFile:t})),[t]}return[]})).flat()},he=async(e,t={})=>{const r=e?.items;if(!r)return[];let n=0;const s=[];for(let e=0;e<r.length;e++){const i=r[e];if("webkitGetAsEntry"in i){const e=i.webkitGetAsEntry?.();if(e?.isDirectory){s.push(me(e,{...t,onProgress:e=>{t.onProgress&&(n=e.processed,t.onProgress({...e,processed:n}))}},n));continue}if(e?.isFile){s.push(new Promise((r,s)=>{const i=e;i.file(e=>{r([e]),t.onProgress&&(n++,t.onProgress({processed:n,path:`${i.fullPath}/${i.name}`,currentFile:e}))},s)}));continue}}const a=i.getAsFile();a&&s.push(Promise.resolve([a]))}return(await Promise.all(s)).flat()};module.exports=t})();
1
+ (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!e)throw new Error(t)}e.r(t),e.d(t,{FOCUSABLE_HTML_TAGS:()=>ne,assert:()=>r,blobToFile:()=>we,calculateEuclideanDistance:()=>ee,calculateMovingSpeed:()=>te,calculatePercentage:()=>re,camelToDashCase:()=>Z,camelToWords:()=>K,chunk:()=>M,cloneBlob:()=>ae,compact:()=>_,compose:()=>k,delay:()=>N,difference:()=>P,everyAsync:()=>q,fileListToFiles:()=>pe,filterParallel:()=>Y,filterSequential:()=>H,findAsync:()=>z,getDOMRectIntersectionRatio:()=>oe,getElementOffsetRect:()=>se,getFocusableHtmlElements:()=>fe,getLocalStorageCapabilities:()=>de,hashString:()=>Q,intersection:()=>T,invokeIfFunction:()=>x,isAnchorHtmlElement:()=>le,isArray:()=>A,isBlob:()=>y,isBool:()=>l,isContentEditableHtmlElement:()=>ce,isDate:()=>f,isDefined:()=>a,isEmptyArray:()=>E,isEmptyObject:()=>u,isError:()=>m,isFile:()=>he,isFiniteNumber:()=>b,isFunction:()=>v,isHtmlElementFocusable:()=>ue,isInteger:()=>S,isLocalStorageReadable:()=>ye,isMap:()=>g,isNil:()=>i,isNilOrEmptyString:()=>V,isNull:()=>n,isNumber:()=>s,isObject:()=>c,isPromise:()=>j,isRegExp:()=>h,isSet:()=>p,isString:()=>G,isSymbol:()=>w,isUndefined:()=>o,isValidDate:()=>d,noop:()=>C,not:()=>D,once:()=>R,parse2DMatrix:()=>ie,parseFileName:()=>ge,pipe:()=>O,readFilesFromDataTransfer:()=>Se,reduceAsync:()=>U,retry:()=>L,runParallel:()=>X,runSequential:()=>B,someAsync:()=>$,splitStringIntoWords:()=>J,timeout:()=>I,toKebabCase:()=>W,traverseFileSystemDirectory:()=>be,unique:()=>F});const n=e=>null===e,i=e=>null==e,a=e=>null!=e,o=e=>void 0===e,s=e=>"number"==typeof e,l=e=>"boolean"==typeof e,c=e=>"object"==typeof e,u=e=>c(e)&&!n(e)&&0===Object.keys(e).length,f=e=>e instanceof Date,y=e=>e instanceof Blob,m=e=>e instanceof Error,d=e=>f(e)&&!isNaN(e.getTime()),h=e=>e instanceof RegExp,g=e=>e instanceof Map,p=e=>e instanceof Set,w=e=>"symbol"==typeof e,b=e=>s(e)&&isFinite(e),S=e=>s(e)&&Number.isInteger(e),A=e=>Array.isArray(e),E=e=>A(e)&&0===e.length,_=e=>e.filter(Boolean),F=e=>[...new Set(e)],M=(e,t)=>(r(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,(n+1)*t))),T=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...r]=e;return F(t).filter(e=>r.every(t=>t.includes(e)))},P=(e,t)=>e.filter(e=>!t.includes(e)),O=(...e)=>t=>e.reduce((e,t)=>t(e),t),k=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),C=()=>{},v=e=>"function"==typeof e,D=e=>(...t)=>!e(...t),x=(e,...t)=>"function"==typeof e?e(...t):e,N=e=>new Promise(t=>setTimeout(t,e)),I=async(e,t,r="Operation timed out")=>{try{return await Promise.race([e,N(t).then(()=>Promise.reject(new Error(r)))])}finally{}},L=(e,{maxAttempts:t=3,delayMs:r=300,backoff:n=!0,onRetry:i}={})=>async(...a)=>{let o;for(let s=1;s<=t;s++)try{return await e(...a)}catch(e){if(o=e,s<t){i?.(s,e);const t=n?r*2**(s-1):r;await N(t)}}throw o},R=e=>{let t,r=!1;return function(...n){return r||(r=!0,t=e.apply(this,n)),t}},j=e=>v(e?.then),B=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(await t(e[n],n,e));return r},X=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++){const i=e[n];await t(i,n,e)&&r.push(i)}return r},Y=async(e,t)=>{const r=await X(e,async(e,r,n)=>!!await t(e,r,n)&&e);return _(r)},$=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return!0;return!1},q=async(e,t)=>{for(let r=0;r<e.length;r++)if(!await t(e[r],r,e))return!1;return!0},U=async(e,t,r)=>{let n=r;for(let r=0;r<e.length;r++)n=await t(n,e[r],r,e);return n},z=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return e[r];return null},G=e=>"string"==typeof e,V=e=>""===e||i(e),W=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Z=e=>{const t=e.charAt(0),r=e.slice(1);return t.toLowerCase()+r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},K=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),J=e=>e.split(" ").filter(Boolean),Q=e=>{let t=5381;for(let r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(36)},ee=(e,t,r,n)=>{const i=r-e,a=n-t;return Math.hypot(i,a)},te=(e,t)=>Math.abs(e/t),re=(e,t)=>e*t/100,ne=["INPUT","SELECT","TEXTAREA","BUTTON","A"],ie=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[r,n,i,a,o,s]=t[1].split(", ").map(parseFloat);return{translateX:o,translateY:s,scaleX:r,scaleY:a,skewX:i,skewY:n}},ae=e=>new Blob([e],{type:e.type}),oe=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),se=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),le=e=>"A"===e.tagName,ce=e=>"true"===e.getAttribute("contenteditable"),ue=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if("hidden"===t.visibility||"none"===t.display)return!1;if("disabled"in e&&e.disabled)return!1;const r=e.getAttribute("tabindex");return"-1"!==r&&(ne.includes(e.tagName)?!le(e)||""!==e.href:!!ce(e)||null!==r)},fe=e=>Array.from(e.querySelectorAll("*")).filter(ue),ye=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},me={readable:!1,writable:!1},de=R(()=>{if("undefined"==typeof window||!window.localStorage)return me;try{window.localStorage.getItem("__test_read__"),me.readable=!0}catch{return me}try{const e="__test_write__";window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),me.writable=!0}catch{}return me}),he=e=>e instanceof File,ge=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},pe=e=>{if(!e)return[];const t=[];for(let r=0;r<e.length;r++)t.push(e[r]);return t},we=(e,t)=>new File([e],t,{type:e.type}),be=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const r=new Set(t),n=await(async e=>{const t=e.createReader(),r=async()=>new Promise((e,n)=>{t.readEntries(async t=>{if(t.length)try{const n=await r();e([...t,...n])}catch(e){n(e)}else e([])},n)});return r()})(e);return(await X(n,async e=>e.isDirectory?be(e,{skipFiles:t}):r.has(e.name)?[]:[await new Promise((t,r)=>{e.file(t,r)})])).flat()},Se=async(e,t={})=>{const r=e?.items;if(!r)return[];const n=[];for(let e=0;e<r.length;e++){const i=r[e];if("webkitGetAsEntry"in i){const e=i.webkitGetAsEntry?.();if(e?.isDirectory){n.push(be(e,t));continue}if(e?.isFile){n.push(new Promise((t,r)=>e.file(e=>t([e]),r)));continue}}const a=i.getAsFile();a&&n.push(Promise.resolve([a]))}return(await Promise.all(n)).flat()};module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map