@react-hive/honey-utils 4.3.0 → 5.0.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.
Files changed (54) hide show
  1. package/README.md +24 -12
  2. package/dist/README.md +24 -12
  3. package/dist/a11y/focus/is-html-element-focusable.d.ts +8 -6
  4. package/dist/a11y/focus/move-focus-within-container.d.ts +1 -1
  5. package/dist/array/chunk.d.ts +4 -1
  6. package/dist/array/compose.d.ts +7 -3
  7. package/dist/array/get-adjacent-items.d.ts +1 -1
  8. package/dist/array/index.d.ts +1 -0
  9. package/dist/array/intersection.d.ts +2 -1
  10. package/dist/array/is-array.d.ts +6 -0
  11. package/dist/array/is-empty-array.d.ts +7 -0
  12. package/dist/array/pipe.d.ts +5 -2
  13. package/dist/array/to-map-by.d.ts +48 -0
  14. package/dist/async/async.d.ts +10 -1
  15. package/dist/async/retry.d.ts +4 -3
  16. package/dist/dom/data-transfer.d.ts +22 -4
  17. package/dist/dom/dom.d.ts +7 -5
  18. package/dist/dom/transform/parse-2d-matrix.d.ts +5 -0
  19. package/dist/encoding/decode-base64-json.d.ts +22 -1
  20. package/dist/encoding/decode-base64.d.ts +23 -1
  21. package/dist/encoding/encode-base64-json.d.ts +16 -0
  22. package/dist/encoding/encode-base64.d.ts +20 -0
  23. package/dist/env/storage/local-storage-json.d.ts +1 -1
  24. package/dist/env/storage/local-storage.d.ts +1 -6
  25. package/dist/file.d.ts +3 -2
  26. package/dist/function/function.d.ts +12 -0
  27. package/dist/geometry/apply-inertia-step.d.ts +1 -1
  28. package/dist/geometry/layout/calculate-center-offset.d.ts +11 -1
  29. package/dist/geometry/layout/clamp-offset-to-overflow.d.ts +6 -0
  30. package/dist/geometry/resolve-bounded-delta.d.ts +1 -1
  31. package/dist/guards.d.ts +24 -3
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.dev.cjs +402 -97
  35. package/dist/index.dev.cjs.map +1 -1
  36. package/dist/index.mjs +1 -1
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/intersection/get-dom-rect-intersection-ratio.d.ts +8 -1
  39. package/dist/intersection/resolve-axis-delta.d.ts +7 -0
  40. package/dist/json/parse-json.d.ts +22 -1
  41. package/dist/math/hash-string.d.ts +1 -1
  42. package/dist/math/math.d.ts +17 -1
  43. package/dist/object.d.ts +7 -1
  44. package/dist/string/for-each-char.d.ts +1 -1
  45. package/dist/string/is-nil-or-empty-string.d.ts +1 -1
  46. package/dist/string/parse-file-name.d.ts +1 -1
  47. package/dist/tree/flatten-tree.d.ts +2 -2
  48. package/dist/tree/get-tree-children.d.ts +2 -2
  49. package/dist/tree/search-tree.d.ts +2 -2
  50. package/dist/tree/tree.types.d.ts +1 -1
  51. package/package.json +8 -7
  52. package/dist/geometry/apply-inertia-step.spec.d.ts +0 -1
  53. package/dist/geometry/resolve-bounded-delta.spec.d.ts +0 -1
  54. package/dist/id/generate-ephemeral-id.spec.d.ts +0 -1
@@ -1 +1,17 @@
1
+ /**
2
+ * Serialises a value as JSON and encodes it as base64 - a structured value carried in a URL query
3
+ * parameter, a cookie or a header.
4
+ *
5
+ * @template Value - The type of the value.
6
+ *
7
+ * @param value - Any JSON-serialisable value.
8
+ *
9
+ * @returns The base64 encoding of the value's JSON.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * encodeBase64Json({ name: 'Mike', age: 33 });
14
+ * // ➜ 'eyJuYW1lIjoiTWlrZSIsImFnZSI6MzN9'
15
+ * ```
16
+ */
1
17
  export declare const encodeBase64Json: <Value>(value: Value) => string;
@@ -1 +1,21 @@
1
+ /**
2
+ * Encodes a string as base64, by its UTF-8 bytes - so text outside Latin-1 (accents, emoji, any
3
+ * script), which `btoa` throws on, encodes as well.
4
+ *
5
+ * Uses `Uint8Array.prototype.toBase64` where the runtime has it, Node's `Buffer` otherwise, and
6
+ * `btoa` last.
7
+ *
8
+ * @param value - The string to encode.
9
+ *
10
+ * @returns The base64 encoding of the string's UTF-8 bytes.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * encodeBase64('Hello');
15
+ * // ➜ 'SGVsbG8='
16
+ *
17
+ * encodeBase64('Привіт');
18
+ * // ➜ '0J/RgNC40LLRltGC'
19
+ * ```
20
+ */
1
21
  export declare const encodeBase64: (value: string) => string;
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '~/types';
1
+ import type { Nullable } from '../../types';
2
2
  /**
3
3
  * Reads the value stored as JSON under a key in `localStorage`.
4
4
  *
@@ -10,11 +10,7 @@
10
10
  * throw; otherwise `false`.
11
11
  */
12
12
  export declare const isLocalStorageReadable: () => boolean;
13
- interface LocalStorageCapabilities {
14
- readable: boolean;
15
- writable: boolean;
16
- }
17
- interface LocalStorageCapabilities {
13
+ export interface LocalStorageCapabilities {
18
14
  readable: boolean;
19
15
  writable: boolean;
20
16
  }
@@ -37,4 +33,3 @@ interface LocalStorageCapabilities {
37
33
  * @returns An object describing the detected `localStorage` capabilities.
38
34
  */
39
35
  export declare const getLocalStorageCapabilities: () => LocalStorageCapabilities;
40
- export {};
package/dist/file.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '~/types';
1
+ import type { Nullable } from './types';
2
2
  /**
3
3
  * Checks if a value is a `File` object.
4
4
  *
@@ -50,7 +50,8 @@ interface TraverseDirectoryOptions {
50
50
  *
51
51
  * This function walks through all subdirectories, resolving each file into a `File` object.
52
52
  * Directories themselves are not returned. To avoid unnecessary noise, certain system or
53
- * OS-generated files can be excluded via the `skipFiles` option.
53
+ * OS-generated files and folders can be excluded via the `skipFiles` option - a folder named there
54
+ * is not entered.
54
55
  *
55
56
  * @param directoryEntry - The starting directory entry to traverse.
56
57
  * @param options - Optional settings that control traversal behavior.
@@ -1,3 +1,14 @@
1
+ /**
2
+ * A function that does nothing and returns `undefined` - a default for an optional callback, so the
3
+ * caller can call it without checking it is there.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const { onClose = noop } = props;
8
+ *
9
+ * onClose();
10
+ * ```
11
+ */
1
12
  export declare const noop: () => void;
2
13
  /**
3
14
  * Checks if a value is a function.
@@ -30,6 +41,7 @@ export declare const not: <Args extends unknown[]>(fn: (...args: Args) => any) =
30
41
  * Wraps a function so that it can only be executed once.
31
42
  * The wrapped function remembers (caches) the result of the first invocation
32
43
  * and returns that same result for all subsequent calls, regardless of the arguments provided.
44
+ * Where the first invocation throws, every call throws that same error - `fn` is not run again.
33
45
  *
34
46
  * Common use cases include:
35
47
  * - initializing singletons
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '~/types';
1
+ import type { Nullable } from '../types';
2
2
  export interface InertiaOptions {
3
3
  /**
4
4
  * Current velocity of the inertial motion.
@@ -21,6 +21,16 @@ export interface CalculateCenterOffsetOptions {
21
21
  /**
22
22
  * Calculates the raw offset required to center an element within a container along a single axis.
23
23
  *
24
- * @returns A negative offset value suitable for use in a CSS `translate` transform.
24
+ * @param options - The container's visible size, and the element's offset and size, along the axis.
25
+ *
26
+ * @returns The offset to translate the container by: negative for an element past the container's
27
+ * centre, positive for one before it, and `0` for one already centred. Clamp it with
28
+ * `clampOffsetToOverflow` to keep the container within its overflow.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * calculateCenterOffset({ containerSize: 100, elementOffset: 200, elementSize: 20 });
33
+ * // -160
34
+ * ```
25
35
  */
26
36
  export declare const calculateCenterOffset: ({ containerSize, elementOffset, elementSize, }: CalculateCenterOffsetOptions) => number;
@@ -5,5 +5,11 @@
5
5
  * @param overflowSize - Maximum overflow size along the axis.
6
6
  *
7
7
  * @returns Clamped negative offset, or `0` when no overflow exists.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * clampOffsetToOverflow(-160, 100); // -100
12
+ * clampOffsetToOverflow(40, 100); // 0
13
+ * ```
8
14
  */
9
15
  export declare const clampOffsetToOverflow: (offset: number, overflowSize: number) => number;
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '~/types';
1
+ import type { Nullable } from '../types';
2
2
  interface ResolveBoundedDeltaOptions {
3
3
  /**
4
4
  * Incremental change to apply to the current value.
package/dist/guards.d.ts CHANGED
@@ -1,3 +1,23 @@
1
+ /**
2
+ * Asserts that a condition holds, narrowing it for the code after the call.
3
+ *
4
+ * A `function` declaration rather than an arrow, which TypeScript needs for an `asserts` signature
5
+ * to narrow at the call site.
6
+ *
7
+ * @param condition - The condition expected to be truthy.
8
+ * @param message - The message of the error thrown when it is not.
9
+ *
10
+ * @throws {Error} When `condition` is falsy.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const user = users.find(user => user.id === id);
15
+ *
16
+ * assert(user, `User ${id} not found`);
17
+ *
18
+ * user.name; // `user` is no longer `undefined` here
19
+ * ```
20
+ */
1
21
  export declare function assert(condition: any, message: string): asserts condition;
2
22
  /**
3
23
  * Checks if a value is null.
@@ -48,15 +68,16 @@ export declare const isNumber: (value: unknown) => value is number;
48
68
  */
49
69
  export declare const isBool: (value: unknown) => value is boolean;
50
70
  /**
51
- * Checks if a value is an object.
71
+ * Checks if a value is an object - anything `typeof` calls `'object'` (plain objects, arrays,
72
+ * dates, maps, class instances), except `null`.
52
73
  *
53
74
  * @param value - The value to check.
54
75
  *
55
- * @returns `true` if the value is an object; otherwise, `false`.
76
+ * @returns `true` if the value is a non-null object; otherwise, `false`.
56
77
  */
57
78
  export declare const isObject: (value: unknown) => value is object;
58
79
  /**
59
- * Checks if a value is an empty object (no own enumerable properties).
80
+ * Checks if a value is an empty object (no own enumerable properties, symbol-keyed ones included).
60
81
  *
61
82
  * @param value - The value to check.
62
83
  *
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";const e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{DATA_TRANSFER_JSON_MIME:()=>le,FOCUSABLE_HTML_TAGS:()=>i,applyInertiaStep:()=>Fe,assert:()=>p,blobToFile:()=>Me,calculateCenterOffset:()=>pe,calculateEuclideanDistance:()=>Le,calculateMovingSpeed:()=>Ne,calculatePercentage:()=>_e,camelToDashCase:()=>Xe,camelToWords:()=>He,centerElementInContainer:()=>ye,chunk:()=>_,clamp:()=>je,clampOffsetToOverflow:()=>ge,cloneBlob:()=>n,compact:()=>$,compose:()=>f,decodeBase64:()=>tt,decodeBase64Json:()=>nt,definedProps:()=>ke,delay:()=>te,difference:()=>h,downloadFile:()=>ce,encodeBase64:()=>rt,encodeBase64Json:()=>at,everyAsync:()=>K,fileListToFiles:()=>Ie,filterParallel:()=>q,filterSequential:()=>V,findAsync:()=>ee,findCharIndices:()=>Je,flattenTree:()=>qe,forEachChar:()=>ze,generateEphemeralId:()=>Pe,getAdjacentItems:()=>R,getDOMRectIntersectionRatio:()=>Be,getDataTransferJson:()=>oe,getElementOffsetRect:()=>r,getFocusableHtmlElements:()=>s,getLocalStorageCapabilities:()=>Se,getTreeChildren:()=>Ge,getWordsInitials:()=>Ze,getXOverflowWidth:()=>he,getYOverflowHeight:()=>me,hasXOverflow:()=>fe,hasYOverflow:()=>de,hashString:()=>$e,hexWithAlpha:()=>Qe,intersection:()=>m,invokeIfFunction:()=>Ee,isAnchorHtmlElement:()=>a,isArray:()=>j,isBlob:()=>M,isBool:()=>A,isContentEditableHtmlElement:()=>l,isDate:()=>I,isDecimal:()=>L,isDefined:()=>w,isEmptyArray:()=>k,isEmptyObject:()=>v,isEnumValue:()=>N,isError:()=>O,isFile:()=>ve,isFiniteNumber:()=>B,isFunction:()=>U,isHtmlElementFocusable:()=>o,isInteger:()=>D,isLocalStorageReadable:()=>be,isMap:()=>T,isNil:()=>y,isNilOrEmptyString:()=>We,isNull:()=>g,isNumber:()=>S,isObject:()=>x,isPromise:()=>J,isRegExp:()=>E,isSet:()=>F,isString:()=>se,isSymbol:()=>P,isUndefined:()=>b,isValidDate:()=>C,moveFocusWithinContainer:()=>c,noop:()=>H,not:()=>W,once:()=>Y,parse2DMatrix:()=>we,parseFileName:()=>Ye,parseJson:()=>ae,pipe:()=>u,readFilesFromDataTransfer:()=>Ce,readLocalStorageJson:()=>Ae,reduceAsync:()=>Q,replaceHistorySearchParams:()=>ue,resolveAxisDelta:()=>De,resolveBoundedDelta:()=>Te,retry:()=>re,runParallel:()=>Z,runSequential:()=>z,searchTree:()=>Ke,setDataTransferJson:()=>ie,someAsync:()=>G,splitMapJoin:()=>Ve,splitStringIntoWords:()=>Ue,timeout:()=>ne,toKebabCase:()=>Re,toggleArrayItem:()=>X,traverseFileSystemDirectory:()=>Oe,unique:()=>d,writeLocalStorageJson:()=>xe});const n=e=>new Blob([e],{type:e.type}),r=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),a=e=>"A"===e.tagName,l=e=>"true"===e.getAttribute("contenteditable"),i=["INPUT","SELECT","TEXTAREA","BUTTON","A"],o=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 n=e.getAttribute("tabindex");return"-1"!==n&&(i.includes(e.tagName)?!a(e)||""!==e.href:!!l(e)||null!==n)},s=e=>Array.from(e.querySelectorAll("*")).filter(o),c=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const i=s(l);if(0===i.length)return;const o=i.indexOf(a);if(-1===o)return;let c;r?c=r(o,e,i):"next"===e?(c=o+1,c>=i.length&&(c=n?0:null)):(c=o-1,c<0&&(c=n?i.length-1:null)),null!==c&&i[c]?.focus()},u=(...e)=>t=>e.reduce((e,t)=>t(e),t),f=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),h=(e,t)=>e.filter(e=>!t.includes(e)),d=e=>[...new Set(e)],m=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return d(t).filter(e=>n.every(t=>t.includes(e)))};function p(e,t){if(!e)throw new Error(t)}const g=e=>null===e,y=e=>null==e,w=e=>null!=e,b=e=>void 0===e,S=e=>"number"==typeof e,A=e=>"boolean"==typeof e,x=e=>"object"==typeof e,v=e=>x(e)&&!g(e)&&0===Object.keys(e).length,I=e=>e instanceof Date,M=e=>e instanceof Blob,O=e=>e instanceof Error,C=e=>I(e)&&!isNaN(e.getTime()),E=e=>e instanceof RegExp,T=e=>e instanceof Map,F=e=>e instanceof Set,P=e=>"symbol"==typeof e,B=e=>S(e)&&isFinite(e),D=e=>S(e)&&Number.isInteger(e),L=e=>B(e)&&!Number.isInteger(e),N=(e,t)=>Object.values(e).includes(t),_=(e,t)=>(p(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),$=e=>e.filter(Boolean),j=e=>Array.isArray(e),k=e=>j(e)&&0===e.length,R=(e,t,n)=>{if(!e?.length||!t)return{previousItem:null,currentItem:null,nextItem:null};const r=e.findIndex(e=>n(e,t));return-1===r?{previousItem:null,currentItem:null,nextItem:null}:{previousItem:r>0?e[r-1]:null,currentItem:e[r],nextItem:r<e.length-1?e[r+1]:null}},X=(e,t,n)=>{const r=e.includes(t);return r===(n??!r)?e:r?h(e,[t]):[...e,t]},H=()=>{},U=e=>"function"==typeof e,W=e=>(...t)=>!e(...t),Y=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},J=e=>U(e?.then),z=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},Z=async(e,t)=>Promise.all(e.map(t)),V=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},q=async(e,t)=>{const n=await Z(e,async(e,n,r)=>!!await t(e,n,r)&&e);return $(n)},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},K=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Q=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},ee=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},te=e=>new Promise(t=>setTimeout(t,e)),ne=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,te(t).then(()=>Promise.reject(new Error(n)))])}finally{}},re=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await te(t)}}throw i},ae=e=>{try{return JSON.parse(e)}catch{return null}},le="application/json",ie=(e,t)=>{e.setData(le,JSON.stringify(t))},oe=e=>{const t=e.getData(le);return t?ae(t):null},se=e=>"string"==typeof e,ce=(e,{fileName:t,target:n}={})=>{if(b(document))return;const r=document.createElement("a");let a=null;try{const l=se(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{p(a,"Object URL should not be null"),URL.revokeObjectURL(a)},0)}},ue=e=>{const t=e.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${t?`?${t}`:""}${window.location.hash}`)},fe=e=>e.scrollWidth>e.clientWidth,he=e=>Math.max(0,e.scrollWidth-e.clientWidth),de=e=>e.scrollHeight>e.clientHeight,me=e=>Math.max(0,e.scrollHeight-e.clientHeight),pe=({containerSize:e,elementOffset:t,elementSize:n})=>-(t+n/2-e/2),ge=(e,t)=>t<=0?0:Math.max(-t,Math.min(e,0)),ye=(e,t,{axis:n="both",shouldClamp:r=!0}={})=>{let a=0,l=0;if("x"===n||"both"===n){const n=pe({containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth});a=r?ge(n,he(e)):n}if("y"===n||"both"===n){const n=pe({containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight});l=r?ge(n,me(e)):n}e.style.transform=`translate(${a}px, ${l}px)`},we=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[n,r,a,l,i,o]=t[1].split(", ").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},be=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},Se=()=>{if(!be())return{readable:!1,writable:!1};try{const e="__test_write__";return window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},Ae=e=>{try{const t=window.localStorage.getItem(e);return null===t?null:ae(t)}catch{return null}},xe=(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}},ve=e=>e instanceof File,Ie=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},Me=(e,t)=>new File([e],t,{type:e.type}),Oe=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await Z(r,async e=>e.isDirectory?Oe(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Ce=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if("webkitGetAsEntry"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Oe(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},Ee=(e,...t)=>"function"==typeof e?e(...t):e,Te=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},Fe=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=Te({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},Pe=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,Be=(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),De=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case"x":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Le=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Ne=(e,t)=>Math.abs(e/t),_e=(e,t)=>e*t/100,$e=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},je=(e,t,n)=>Math.min(Math.max(e,t),n),ke=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Re=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xe=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},He=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),Ue=e=>0===e.length?[]:e.split(" ").filter(Boolean),We=e=>""===e||y(e),Ye=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Je=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},ze=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},Ze=(e,t=1/0)=>0===e.length?"":Ue(e).slice(0,t).map(e=>e[0]).join("").toUpperCase(),Ve=(e,t,n,r=t)=>e.split(t).map((e,t)=>n(e.trim(),t)).join(r),qe=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];qe(s,t,n,r,a,l+1)}}),r),Ge=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Ke=(e,t,n,r)=>{const a=Ue(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const s=Ue(o.toLowerCase());if(a.every(e=>s.some(t=>t.startsWith(e))))if(b(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];b(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(g(o)||o!==n.parentId)&&(p(i,"[@react-hive/honey-utils]: Parent node was not found."),r.push(i))};t(i),r.push(i)}return r},[])},Qe=(e,t)=>{p(t>=0&&t<=1,`[@react-hive/honey-utils]: Alpha "${t}" must be a number between 0 and 1.`);const n=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);p(n,`[@react-hive/honey-utils]: Invalid hex format: ${e}`);const r=n[1];return`#${(3===r.length?r[0]+r[0]+r[1]+r[1]+r[2]+r[2]:r)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`},et=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,tt=e=>{if(!et.test(e))return null;try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode((e=>{if("function"==typeof Uint8Array.fromBase64)return Uint8Array.fromBase64(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64");const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n})(e))}catch{return null}},nt=e=>{const t=tt(e);return null===t?null:ae(t)},rt=e=>(e=>{if("function"==typeof e.toBase64)return e.toBase64();if("undefined"!=typeof Buffer)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)})((new TextEncoder).encode(e)),at=e=>rt(JSON.stringify(e));module.exports=t})();
1
+ (()=>{"use strict";const e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{DATA_TRANSFER_JSON_MIME:()=>oe,FOCUSABLE_HTML_TAGS:()=>o,applyInertiaStep:()=>Fe,assert:()=>p,blobToFile:()=>Ee,calculateCenterOffset:()=>ye,calculateEuclideanDistance:()=>De,calculateMovingSpeed:()=>$e,calculatePercentage:()=>_e,camelToDashCase:()=>He,camelToWords:()=>Ue,centerElementInContainer:()=>we,chunk:()=>$,clamp:()=>je,clampOffsetToOverflow:()=>ge,cloneBlob:()=>n,compact:()=>_,compose:()=>f,decodeBase64:()=>nt,decodeBase64Json:()=>rt,definedProps:()=>ke,delay:()=>ne,difference:()=>h,downloadFile:()=>ue,encodeBase64:()=>lt,encodeBase64Json:()=>at,everyAsync:()=>Q,fileListToFiles:()=>Me,filterParallel:()=>K,filterSequential:()=>G,findAsync:()=>te,findCharIndices:()=>ze,flattenTree:()=>Ke,forEachChar:()=>Ve,generateEphemeralId:()=>Pe,getAdjacentItems:()=>k,getDOMRectIntersectionRatio:()=>Ne,getDataTransferJson:()=>se,getElementOffsetRect:()=>r,getFocusableHtmlElements:()=>s,getLocalStorageCapabilities:()=>Ae,getTreeChildren:()=>Ze,getWordsInitials:()=>qe,getXOverflowWidth:()=>de,getYOverflowHeight:()=>pe,hasXOverflow:()=>he,hasYOverflow:()=>me,hashString:()=>Re,hexWithAlpha:()=>et,intersection:()=>m,invokeIfFunction:()=>Te,isAnchorHtmlElement:()=>l,isArray:()=>R,isBlob:()=>M,isBool:()=>A,isContentEditableHtmlElement:()=>a,isDate:()=>I,isDecimal:()=>B,isDefined:()=>w,isEmptyArray:()=>j,isEmptyObject:()=>v,isEnumValue:()=>D,isError:()=>E,isFile:()=>Ie,isFiniteNumber:()=>P,isFunction:()=>W,isHtmlElementFocusable:()=>i,isInteger:()=>N,isLocalStorageReadable:()=>Se,isMap:()=>T,isNil:()=>g,isNilOrEmptyString:()=>Ye,isNull:()=>y,isNumber:()=>S,isObject:()=>x,isPromise:()=>z,isRegExp:()=>C,isSet:()=>L,isString:()=>ce,isSymbol:()=>F,isUndefined:()=>b,isValidDate:()=>O,moveFocusWithinContainer:()=>c,noop:()=>U,not:()=>Y,once:()=>J,parse2DMatrix:()=>be,parseFileName:()=>Je,parseJson:()=>ae,pipe:()=>u,readFilesFromDataTransfer:()=>Ce,readLocalStorageJson:()=>xe,reduceAsync:()=>ee,replaceHistorySearchParams:()=>fe,resolveAxisDelta:()=>Be,resolveBoundedDelta:()=>Le,retry:()=>le,runParallel:()=>q,runSequential:()=>V,searchTree:()=>Qe,setDataTransferJson:()=>ie,someAsync:()=>Z,splitMapJoin:()=>Ge,splitStringIntoWords:()=>We,timeout:()=>re,toKebabCase:()=>Xe,toMapBy:()=>H,toggleArrayItem:()=>X,traverseFileSystemDirectory:()=>Oe,unique:()=>d,writeLocalStorageJson:()=>ve});const n=e=>new Blob([e],{type:e.type}),r=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),l=e=>"A"===e.tagName,a=e=>{const t=e.getAttribute("contenteditable");return null!==t&&["","true","plaintext-only"].includes(t.toLowerCase())},o=["INPUT","SELECT","TEXTAREA","BUTTON","A"],i=e=>{if(!e)return!1;if("hidden"===window.getComputedStyle(e).visibility)return!1;for(let t=e;t;t=t.parentElement)if("none"===window.getComputedStyle(t).display)return!1;if(e.matches(":disabled"))return!1;const t=(e=>{const t=null===e?null:/^\s*([+-]?\d+)/.exec(e);return t?parseInt(t[1],10):null})(e.getAttribute("tabindex"));return null!==t?t>=0:o.includes(e.tagName)?!l(e)||""!==e.href:a(e)},s=e=>Array.from(e.querySelectorAll("*")).filter(i),c=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const l=document.activeElement,a=t??l?.parentElement;if(!l||!a)return;const o=s(a);if(0===o.length)return;const i=o.indexOf(l);if(-1===i)return;let c;r?c=r(i,e,o):"next"===e?(c=i+1,c>=o.length&&(c=n?0:null)):(c=i-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()},u=(...e)=>t=>e.reduce((e,t)=>t(e),t),f=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),h=(e,t)=>e.filter(e=>!t.includes(e)),d=e=>[...new Set(e)],m=(...e)=>{if(0===e.length)return[];const[t,...n]=e;return d(t).filter(e=>n.every(t=>t.includes(e)))};function p(e,t){if(!e)throw new Error(t)}const y=e=>null===e,g=e=>null==e,w=e=>null!=e,b=e=>void 0===e,S=e=>"number"==typeof e,A=e=>"boolean"==typeof e,x=e=>"object"==typeof e&&null!==e,v=e=>x(e)&&Reflect.ownKeys(e).every(t=>!Object.prototype.propertyIsEnumerable.call(e,t)),I=e=>e instanceof Date,M=e=>e instanceof Blob,E=e=>e instanceof Error,O=e=>I(e)&&!isNaN(e.getTime()),C=e=>e instanceof RegExp,T=e=>e instanceof Map,L=e=>e instanceof Set,F=e=>"symbol"==typeof e,P=e=>S(e)&&isFinite(e),N=e=>S(e)&&Number.isInteger(e),B=e=>P(e)&&!Number.isInteger(e),D=(e,t)=>Object.values(e).includes(t),$=(e,t)=>(p(Number.isInteger(t)&&t>0,"Chunk size must be a positive whole number"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),_=e=>e.filter(Boolean),R=e=>Array.isArray(e),j=e=>R(e)&&0===e.length,k=(e,t,n)=>{if(!e?.length||!t)return{previousItem:null,currentItem:null,nextItem:null};const r=e.findIndex(e=>n(e,t));return-1===r?{previousItem:null,currentItem:null,nextItem:null}:{previousItem:r>0?e[r-1]:null,currentItem:e[r],nextItem:r<e.length-1?e[r+1]:null}},X=(e,t,n)=>{const r=e.includes(t);return r===(n??!r)?e:r?h(e,[t]):[...e,t]};function H(e,t,n){const r=new Map;return e.forEach((e,l)=>{r.set(t(e,l),n?n(e,l):e)}),r}const U=()=>{},W=e=>"function"==typeof e,Y=e=>(...t)=>!e(...t),J=e=>{let t,n,r=!1,l=!1;return function(...a){if(!r){r=!0;try{t=e.apply(this,a)}catch(e){l=!0,n=e}}if(l)throw n;return t}},z=e=>W(e?.then),V=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},q=async(e,t)=>Promise.all(e.map(t)),G=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const l=e[r];await t(l,r,e)&&n.push(l)}return n},K=async(e,t)=>{const n=await q(e,t);return e.filter((e,t)=>n[t])},Z=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},Q=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},ee=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},te=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},ne=e=>new Promise(t=>setTimeout(t,e)),re=async(e,t,n="Operation timed out")=>{let r=null;try{return await Promise.race([e,new Promise((e,l)=>{r=setTimeout(()=>l(new Error(n)),t)})])}finally{null!==r&&clearTimeout(r)}},le=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:l}={})=>{const a=Math.max(1,t);return async(...t)=>{let o;for(let i=1;i<=a;i++)try{return await e(...t)}catch(e){if(o=e,i<a){l?.(i,e);const t=r?n*2**(i-1):n;await ne(t)}}throw o}},ae=e=>{try{return JSON.parse(e)}catch{return null}},oe="application/json",ie=(e,t)=>{e.setData(oe,JSON.stringify(t))},se=e=>{const t=e.getData(oe);return t?ae(t):null},ce=e=>"string"==typeof e,ue=(e,{fileName:t,target:n}={})=>{if("undefined"==typeof document)return;const r=document.createElement("a");let l=null;try{const a=ce(e)?e:l=URL.createObjectURL(e);r.href=a,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),l&&setTimeout(()=>{p(l,"Object URL should not be null"),URL.revokeObjectURL(l)},0)}},fe=e=>{const t=e.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${t?`?${t}`:""}${window.location.hash}`)},he=e=>e.scrollWidth>e.clientWidth,de=e=>Math.max(0,e.scrollWidth-e.clientWidth),me=e=>e.scrollHeight>e.clientHeight,pe=e=>Math.max(0,e.scrollHeight-e.clientHeight),ye=({containerSize:e,elementOffset:t,elementSize:n})=>-(t+n/2-e/2)||0,ge=(e,t)=>t<=0?0:Math.max(-t,Math.min(e,0)),we=(e,t,{axis:n="both",shouldClamp:r=!0}={})=>{let l=0,a=0;if("x"===n||"both"===n){const n=ye({containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth});l=r?ge(n,de(e)):n}if("y"===n||"both"===n){const n=ye({containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight});a=r?ge(n,pe(e)):n}e.style.transform=`translate(${l}px, ${a}px)`},be=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[n,r,l,a,o,i]=t[1].split(", ").map(parseFloat);return{translateX:o,translateY:i,scaleX:n,scaleY:a,skewX:l,skewY:r}},Se=()=>{if("undefined"==typeof window)return!1;try{return!!window.localStorage&&(window.localStorage.getItem("__non_existing_key__"),!0)}catch{return!1}},Ae=()=>{if(!Se())return{readable:!1,writable:!1};try{const e="__test_write__";return window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},xe=e=>{try{const t=window.localStorage.getItem(e);return null===t?null:ae(t)}catch{return null}},ve=(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}},Ie=e=>e instanceof File,Me=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},Ee=(e,t)=>new File([e],t,{type:e.type}),Oe=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await q(r,async e=>n.has(e.name)?[]:e.isDirectory?Oe(e,{skipFiles:t}):[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Ce=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const l=n[e];if("webkitGetAsEntry"in l){const e=l.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Oe(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const a=l.getAsFile();a&&r.push(Promise.resolve([a]))}return(await Promise.all(r)).flat()},Te=(e,...t)=>"function"==typeof e?e(...t):e,Le=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const l=t+e;return e<0?t<=n?null:Math.max(l,n):e>0?t>=r?null:Math.min(l,r):null},Fe=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:l,friction:a=.002,minVelocityPxMs:o=.01,emaAlpha:i=.2})=>{if(Math.abs(r)<o)return null;const s=Le({delta:r*l,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-a*l),u=i>0?r*(1-i)+c*i:c;return Math.abs(u)<o?null:{value:s,velocityPxMs:u}},Pe=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,Ne=(e,t)=>{const n=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)),r=t.width*t.height;return r<=0?0:n/r},Be=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const l=r?-1:1,a=e=>l*e||0;switch(t){case"x":return{deltaX:a(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:a(e.deltaY)};default:return{deltaX:a(e.deltaX),deltaY:a(e.deltaY)}}},De=(e,t,n,r)=>{const l=n-e,a=r-t;return Math.hypot(l,a)},$e=(e,t)=>Math.abs(e/t),_e=(e,t)=>e*t/100,Re=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},je=(e,t,n)=>Math.min(Math.max(e,t),n),ke=e=>{const t={};return Reflect.ownKeys(e).forEach(n=>{if(!Object.prototype.propertyIsEnumerable.call(e,n))return;const r=e[n];void 0!==r&&(t[n]=r)}),t},Xe=e=>e.replace(/([\p{Ll}\p{N}])(\p{Lu})/gu,"$1-$2").toLowerCase(),He=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/\p{Lu}/gu,e=>`-${e.toLowerCase()}`)},Ue=e=>e.replace(/([\p{Ll}\p{N}])(\p{Lu})/gu,"$1 $2").replace(/(\p{Lu})(\p{Lu}\p{Ll})/gu,"$1 $2"),We=e=>0===e.length?[]:e.split(" ").filter(Boolean),Ye=e=>""===e||g(e),Je=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},ze=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Ve=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let l=0;l<r;l++){const a=e[l],o={charIndex:l,prevChar:l>0?e[l-1]:null,nextChar:l<r-1?e[l+1]:null};n?.(a,o)||t(a,o)}},qe=(e,t=1/0)=>0===e.length?"":We(e).slice(0,t).map(e=>String.fromCodePoint(e.codePointAt(0))).join("").toUpperCase(),Ge=(e,t,n,r=t)=>e.split(t).map((e,t)=>n(e.trim(),t)).join(r),Ke=(e,t,n,r=[],l=void 0,a=0)=>(e?.forEach(e=>{const{[n]:o,...i}=e,s=e[n],c=Array.isArray(s);if(r.push({...i,parentId:l,depthLevel:a,childCount:c?s.length:0}),c){const l=e[t];Ke(s,t,n,r,l,a+1)}}),r),Ze=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Qe=(e,t,n,r)=>{const l=We(r.toLowerCase());if(!l.length)return e;const a=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,o)=>{const i=o[n];if(!i)return r;if(r.some(e=>e[t]===o[t]))return r;const s=We(i.toLowerCase());if(l.every(e=>s.some(t=>t.startsWith(e))))if(b(o.parentId)){r.push(o);const n=l=>{l.childCount&&e.forEach(e=>{e.parentId===l[t]&&(r.push(e),n(e))})};n(o)}else{const t=n=>{const l=a[n.parentId],o=e[l];b(o.parentId)||t(o);const i=r.length?r[r.length-1].parentId:null;(y(i)||i!==n.parentId)&&(p(o,"[@react-hive/honey-utils]: Parent node was not found."),r.push(o))};t(o),r.push(o)}return r},[])},et=(e,t)=>{p(t>=0&&t<=1,`[@react-hive/honey-utils]: Alpha "${t}" must be a number between 0 and 1.`);const n=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);p(n,`[@react-hive/honey-utils]: Invalid hex format: ${e}`);const r=n[1];return`#${(3===r.length?r[0]+r[0]+r[1]+r[1]+r[2]+r[2]:r)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`},tt=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,nt=e=>{if(!tt.test(e))return null;try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode((e=>{if("function"==typeof Uint8Array.fromBase64)return Uint8Array.fromBase64(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64");const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n})(e))}catch{return null}},rt=e=>{const t=nt(e);return null===t?null:ae(t)},lt=e=>(e=>{if("function"==typeof e.toBase64)return e.toBase64();if("undefined"!=typeof Buffer)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)})((new TextEncoder).encode(e)),at=e=>lt(JSON.stringify(e));module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map