@bgskinner2/ts-utils 1.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.
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ function F(e,t){let r={};for(let[n,o]of Object.entries(t)){let s=e[o];typeof s=="function"&&(r[n]=s.bind(e))}return r}var k=class e{static includes(t,r){return t.includes(r)}static createFixedLengthArray(t,r){if(t.length!==r)throw new Error(`Array must have exactly ${r} elements`);return t}static readAllItems(t){return[...t]}static map(t,r){return t.map(r)}static forEachUnion(t,r){(Array.isArray(t[0])?[].concat(...t):t).forEach(r)}static forEach(t,r){t.forEach(r)}static reduce(t,r,n){return t.reduce(r,n)}static flat(t){return t.reduce((r,n)=>r.concat(n),[])}static flatMap(t,r){return t.reduce((n,o,s)=>{let i=r(o,s);return n.concat(i)},[])}static filter(t,r){return t.filter(r)}static filterNonNullable(t){return e.filter(t,r=>r!=null)}},pt=F(k,{arrayIncludes:"includes",arrayMap:"map",arrayFilter:"filter",arrayFlat:"flat",arrayReduce:"reduce",arrayForEach:"forEach",arrayFlatMap:"flatMap",arrayFilterNonNullable:"filterNonNullable"}),{arrayMap:ar,arrayFilter:ur,arrayIncludes:cr,arrayReduce:lr,arrayFlat:pr,arrayFlatMap:dr,arrayForEach:mr,arrayFilterNonNullable:Tr}=pt;var x=class{static keys(t){return Object.keys(t)}static entries(t){return t?Object.entries(t):[]}static fromEntries(t){return Object.fromEntries(t)}static values(t){return Object.values(t)}static has(t,r){if(!r)return!1;let n=r.split("."),o=t;for(let s of n){if(o==null||typeof o!="object"||!(s in o))return!1;o=o[s]}return!0}static get(t,r){if(!r)return;let n=r.split("."),o=t;for(let s of n){if(o==null||typeof o!="object"||!(s in o))return;o=o[s]}return o}static set(t,r,n){if(!r)return;let o=r.split("."),s=t;for(let i=0;i<o.length-1;i++){let a=o[i];if(typeof s!="object"||s===null)return;let u=s;(!(a in u)||typeof u[a]!="object"||u[a]===null)&&(u[a]={}),s=u[a]}typeof s=="object"&&s!==null&&(s[o[o.length-1]]=n)}},dt=F(x,{objectKeys:"keys",objectEntries:"entries",objectFromEntries:"fromEntries",objectValues:"values",objectHas:"has",objectGet:"get",objectSet:"set"}),{objectKeys:br,objectEntries:gr,objectFromEntries:xr,objectValues:hr,objectHas:Sr,objectGet:kr,objectSet:Rr}=dt;var S=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),de=e=>Number.isInteger(e),m=e=>typeof e=="string",b=e=>typeof e=="string"&&e.length>0&&e.trim().length>0,M=e=>typeof e=="boolean",h=e=>typeof e=="bigint",K=e=>typeof e=="symbol",z=e=>m(e)||S(e)||M(e)||h(e);var Or=Object.freeze(["div","span","a","p","ul","li"]),me=Object.freeze(["b","i","p","ul","li","a","span","div","br","strong","em","u","code","pre","blockquote"]),Te={allowedKeys:["arrowleft","arrowright","arrowup","arrowdown","backspace","delete","tab"],clearKeys:["backspace","delete"],copyShortcut:{key:"c",modifiers:["ctrl","meta"]},pasteShortcut:{key:"v",modifiers:["ctrl","meta"]}};var fe=Object.freeze(["log","warn","error","info","debug","table"]),T={isoRegex:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,camelCase:/^[a-z]+(?:[A-Z][a-z0-9]*)*$/,kebabCase:/^[a-z0-9]+(?:-[a-z0-9]+)*$/,snakeCase:/^[a-z0-9]+(?:_[a-z0-9]+)*$/,hexString:/^[0-9a-fA-F]+$/,hexColor:/^[0-9A-Fa-f]{6}$/,letterSeparator:/[^A-Za-z]+/g,camelCaseBoundary:/(?:^\w|[A-Z]|\b\w)/g,kebabCaseBoundary:/([a-z0-9])([A-Z])/g,whitespace:/\s+/g,wordBoundarySplitter:/[^A-Za-z0-9]+/g,USPhoneNumber:/^(?:\+1\s?)?(?:\(\d{3}\)|\d{3})[-.\s]?\d{3}[-.\s]?\d{4}$/,EUPhoneNumber:/^\+?\d{1,4}[\s.-]?\d{2,4}([\s.-]?\d{2,4}){1,3}$/,genericPhoneNumber:/^\+?(\d[\d\s-().]{6,}\d)$/,genericEmail:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,emailRegex:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/,imageSrcRegex:/<img[^>]+src="([^">]+)"/i,singleAlphabetChar:/^[a-zA-Z]$/,htmlDetection:new RegExp(`<\\/?(${me.join("|")})\\b[^>]*>|&[a-z]+;`,"i"),stackTracePrefix:/^\s*at\s+/},Q={reset:"\x1B[0m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",bold:"\x1B[1m",underline:"\x1B[4m"};var mt={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0,autoFocus:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,valueLink:!0},Tt={action:!0,formAction:!0,onCaptured:!0,precedence:!0,blocking:!0},ft={autoFocus:!0,readOnly:!0,noValidate:!0,spellCheck:!0,tabIndex:!0,autoComplete:!0,autoCorrect:!0,autoCapitalize:!0},yt={popover:!0,popoverTarget:!0,popoverTargetAction:!0,inert:!0,loading:!0,fetchpriority:!0,fetchPriority:!0,enterKeyHint:!0,shadowRoot:!0,disablePictureInPicture:!0,playsInline:!0},bt={paintOrder:!0,vectorEffect:!0,imageRendering:!0,shapeRendering:!0,textAnchor:!0,ariaHasPopup:!0,ariaLabel:!0,ariaLabelledBy:!0,alignmentBaseline:!0,baselineShift:!0,dominantBaseline:!0},gt={about:!0,datatype:!0,inlist:!0,prefix:!0,property:!0,resource:!0,typeof:!0,vocab:!0,itemProp:!0,itemScope:!0,itemType:!0,itemID:!0,itemRef:!0},xt={autoCapitalize:!0,autoCorrect:!0,autoSave:!0,color:!0,incremental:!0,results:!0,security:!0,unselectable:!0,on:!0,option:!0,fallback:!0},ht={abbr:!0,accept:!0,acceptCharset:!0,accessKey:!0,action:!0,allow:!0,allowFullScreen:!0,allowPaymentRequest:!0,alt:!0,async:!0,autoComplete:!0,autoFocus:!0,autoPlay:!0,capture:!0,cellPadding:!0,cellSpacing:!0,challenge:!0,charSet:!0,checked:!0,cite:!0,classID:!0,className:!0,cols:!0,colSpan:!0,content:!0,contentEditable:!0,contextMenu:!0,controls:!0,controlsList:!0,coords:!0,crossOrigin:!0,data:!0,dateTime:!0,decoding:!0,default:!0,defer:!0,dir:!0,disabled:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,download:!0,draggable:!0,encType:!0,enterKeyHint:!0,form:!0,formAction:!0,formEncType:!0,formMethod:!0,formNoValidate:!0,formTarget:!0,frameBorder:!0,headers:!0,height:!0,hidden:!0,high:!0,href:!0,hrefLang:!0,htmlFor:!0,httpEquiv:!0,id:!0,inputMode:!0,integrity:!0,is:!0,keyParams:!0,keyType:!0,kind:!0,label:!0,lang:!0,list:!0,loading:!0,loop:!0,low:!0,marginHeight:!0,marginWidth:!0,max:!0,maxLength:!0,media:!0,mediaGroup:!0,method:!0,min:!0,minLength:!0,multiple:!0,muted:!0,name:!0,nonce:!0,noValidate:!0,open:!0,optimum:!0,pattern:!0,placeholder:!0,playsInline:!0,poster:!0,preload:!0,profile:!0,radioGroup:!0,readOnly:!0,referrerPolicy:!0,rel:!0,required:!0,reversed:!0,role:!0,rows:!0,rowSpan:!0,sandbox:!0,scope:!0,scoped:!0,scrolling:!0,seamless:!0,selected:!0,shape:!0,size:!0,sizes:!0,slot:!0,span:!0,spellCheck:!0,src:!0,srcDoc:!0,srcLang:!0,srcSet:!0,start:!0,step:!0,style:!0,summary:!0,tabIndex:!0,target:!0,title:!0,translate:!0,type:!0,useMap:!0,value:!0,width:!0,wmode:!0,wrap:!0},St={alignmentBaseline:!0,baselineShift:!0,clip:!0,clipPath:!0,clipRule:!0,color:!0,colorInterpolation:!0,colorInterpolationFilters:!0,colorProfile:!0,colorRendering:!0,cursor:!0,direction:!0,display:!0,dominantBaseline:!0,enableBackground:!0,fill:!0,fillOpacity:!0,fillRule:!0,filter:!0,floodColor:!0,floodOpacity:!0,imageRendering:!0,lightingColor:!0,markerEnd:!0,markerMid:!0,markerStart:!0,mask:!0,opacity:!0,overflow:!0,paintOrder:!0,pointerEvents:!0,shapeRendering:!0,stopColor:!0,stopOpacity:!0,stroke:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeLinecap:!0,strokeLinejoin:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0,textAnchor:!0,textDecoration:!0,textRendering:!0,unicodeBidi:!0,vectorEffect:!0,visibility:!0,wordSpacing:!0,writingMode:!0},kt={cx:!0,cy:!0,d:!0,dx:!0,dy:!0,fr:!0,fx:!0,fy:!0,height:!0,points:!0,r:!0,rx:!0,ry:!0,transform:!0,version:!0,viewBox:!0,width:!0,x:!0,x1:!0,x2:!0,y:!0,y1:!0,y2:!0,z:!0},Rt={accumulate:!0,additive:!0,allowReorder:!0,amplitude:!0,attributeName:!0,attributeType:!0,autoReverse:!0,begin:!0,bias:!0,by:!0,calcMode:!0,decelerate:!0,diffuseConstant:!0,divisor:!0,dur:!0,edgeMode:!0,elevation:!0,end:!0,exponent:!0,externalResourcesRequired:!0,filterRes:!0,filterUnits:!0,from:!0,in:!0,in2:!0,intercept:!0,k:!0,k1:!0,k2:!0,k3:!0,k4:!0,kernelMatrix:!0,kernelUnitLength:!0,keyPoints:!0,keySplines:!0,keyTimes:!0,limitingConeAngle:!0,mode:!0,numOctaves:!0,operator:!0,order:!0,orient:!0,orientation:!0,origin:!0,pathLength:!0,primitiveUnits:!0,repeatCount:!0,repeatDur:!0,restart:!0,result:!0,rotate:!0,scale:!0,seed:!0,slope:!0,spacing:!0,specularConstant:!0,specularExponent:!0,speed:!0,spreadMethod:!0,startOffset:!0,stdDeviation:!0,stitchTiles:!0,surfaceScale:!0,targetX:!0,targetY:!0,to:!0,values:!0,xChannelSelector:!0,yChannelSelector:!0,zoomAndPan:!0},At={accentHeight:!0,alphabetic:!0,arabicForm:!0,ascent:!0,bbox:!0,capHeight:!0,descent:!0,fontFamily:!0,fontSize:!0,fontSizeAdjust:!0,fontStretch:!0,fontStyle:!0,fontVariant:!0,fontWeight:!0,format:!0,g1:!0,g2:!0,glyphName:!0,glyphOrientationHorizontal:!0,glyphOrientationVertical:!0,glyphRef:!0,hanging:!0,horizAdvX:!0,horizOriginX:!0,ideographic:!0,kerning:!0,lengthAdjust:!0,letterSpacing:!0,local:!0,mathematical:!0,overlinePosition:!0,overlineThickness:!0,panose1:!0,refX:!0,refY:!0,renderingIntent:!0,strikethroughPosition:!0,strikethroughThickness:!0,string:!0,systemLanguage:!0,tableValues:!0,textLength:!0,u1:!0,u2:!0,underlinePosition:!0,underlineThickness:!0,unicode:!0,unicodeRange:!0,unitsPerEm:!0,vAlphabetic:!0,vHanging:!0,vIdeographic:!0,vMathematical:!0,values:!0,vertAdvY:!0,vertOriginX:!0,vertOriginY:!0,widths:!0,xHeight:!0},wt={clipPathUnits:!0,contentScriptType:!0,contentStyleType:!0,gradientTransform:!0,gradientUnits:!0,markerHeight:!0,markerUnits:!0,markerWidth:!0,maskContentUnits:!0,maskUnits:!0,offset:!0,patternContentUnits:!0,patternTransform:!0,patternUnits:!0,preserveAlpha:!0,preserveAspectRatio:!0,requiredExtensions:!0,requiredFeatures:!0,viewTarget:!0,xlinkActuate:!0,xlinkArcrole:!0,xlinkHref:!0,xlinkRole:!0,xlinkShow:!0,xlinkTitle:!0,xlinkType:!0,xmlBase:!0,xmlns:!0,xmlnsXlink:!0,xmlLang:!0,xmlSpace:!0},Ot={for:!0,class:!0,autofocus:!0},ee={...xt,...gt,...bt,...yt,...ft,...Tt,...mt,...Ot,...wt,...At,...Rt,...kt,...St,...ht},Ir=Object.keys(ee);var B=e=>e===null,C=e=>typeof e>"u",R=e=>e!=null,w=e=>e==null,g=e=>typeof e=="function",l=e=>!B(e)&&!O(e)&&typeof e=="object",O=e=>Array.isArray(e),ye=e=>e instanceof Map,be=e=>e instanceof Set,ge=e=>e instanceof WeakMap,xe=e=>e instanceof WeakSet;function he(e,t){return e instanceof t}var H=e=>typeof e=="string"&&T.camelCase.test(e),Se=e=>typeof e=="string"&&T.snakeCase.test(e),ke=e=>typeof e=="string"&&T.kebabCase.test(e),L=e=>{if(!b(e))return!1;try{return Array.isArray(JSON.parse(e))}catch{return!1}},U=e=>{if(!b(e))return!1;try{let t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}},Re=e=>m(e)&&T.htmlDetection.test(e),Ae=e=>t=>!(!b(t)||t.length%2!==0||!T.hexString.test(t)||!C(e)&&t.length!==e),V=e=>L(e)||U(e);var E=e=>{if(!b(e))return!1;try{return new URL(e),!0}catch{return!1}},I=e=>{if(typeof window>"u"||typeof location>"u"||!b(e))return!1;if(e.startsWith("/"))return!0;try{return new URL(e,location.origin).hostname===location.hostname}catch{return!1}};var we=e=>{let t=new Set(e);return r=>!C(r)&&t.has(r)},Oe=e=>t=>(m(t)||S(t)||K(t))&&t in e,d=e=>t=>l(t)&&e in t,W=e=>t=>(m(t)||S(t)||K(t)||M(t))&&e.includes(t),P=(e,t)=>Array.isArray(t)&&t.every(e),Ce=(e,t)=>l(e)&&x.values(e).every(t),Ne=e=>t=>!t||!l(t)?!1:e.every(r=>d(r)(t)&&R(t[r]));var J=e=>{if(!l(e))return!1;let t="type"in e&&e.type==="Buffer",r="data"in e&&P(S,e.data);return t&&r},q=e=>O(e)&&e.length===3&&e.every(t=>S(t)&&t>=0&&t<=255),Ee=e=>b(e)?[T.USPhoneNumber,T.EUPhoneNumber,T.genericPhoneNumber].some(t=>t.test(e)):!1,Ie=e=>m(e)&&T.emailRegex.test(e);var y={isString:m,isNumber:S,isBoolean:M,isBigInt:h,isNil:w,isDefined:R,isInteger:de,isNonEmptyString:b,isSymbol:K,isPrimitive:z,isNull:B,isFunction:g,isObject:l,isArray:O,isMap:ye,isSet:be,isWeakMap:ge,isWeakSet:xe,isUndefined:C,isInstanceOf:he},en={isEmail:Ie,isPhone:Ee,isUrlAbsolute:E,isUrlInternal:I,isJsonString:V,isHTMLString:Re,isCamelCase:H,isSnakeCase:Se,isKebabCase:ke,isHexByteString:Ae,isJSONObjectString:U,isJSONArrayString:L,isRGBTuple:q,isBufferLikeObject:J},tn={isArrayOf:P,isRecordOf:Ce,isKeyOfObject:Oe,isKeyInObject:d,isKeyOfArray:W,isInArray:we,hasKeys:Ne};var Pe=e=>{let t=Object.create(null);return r=>{if(r in t)return t[r];let n=e(r);return t[r]=n,n}};var Ct=x.keys(ee).join("|"),Nt=new RegExp(`^((${Ct})|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$`),te=Pe(e=>Nt.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91),re=e=>m(e)&&te(e),Ge=e=>m(e[0])&&re(e[0]);var Et=(e,t)=>d("$$typeof")(e)&&e.$$typeof===t,je=e=>R(e)&&(g(e)||l(e)&&"current"in e),Me=e=>!B(e)&&l(e)&&"current"in e,Ke=e=>!!e&&d("then")(e)&&g(e.then),X=e=>l(e)&&d("containerInfo")(e),Be=e=>l(e)&&d("children")(e)&&R(e.children),Le=e=>g(e)||d("prototype")(e)&&l(e.prototype)&&d("render")(e.prototype)&&g(e.prototype.render),Ue=e=>Et(e,Symbol.for("react.forward_ref"));import{isValidElement as ne,Fragment as It}from"react";var oe=e=>w(e)||z(e)||ne(e)||X(e)||P(oe,e),se=e=>ne(e),De=e=>ne(e)&&e.type===It,ve=e=>se(e)&&!w(e.props)&&d("onClick")(e.props)&&g(e.props.onClick),ie=e=>l(e)&&d("type")(e)&&d("props")(e)&&l(e.props)&&(m(e.type)||g(e.type)),_e=(e,t)=>ie(e)&&t.includes(e.type),$e=e=>g(e)&&(l(e)||g(e))&&(d("displayName")(e)||d("name")(e)||d("type")(e));var Nn={isRef:je,isRefObject:Me,isPromise:Ke,isReactPortal:X,hasChildren:Be,isComponentType:Le,isForwardRef:Ue,isValidReactNode:oe,isReactElement:se,isFragment:De,hasOnClick:ve,isElementLike:ie,isElementOfType:_e,hasNameMetadata:$e,isDOMPropKey:re,isDOMEntry:Ge,isPropValid:te};var Fe=(e,t,r)=>{if(!t(e))throw new Error(r??"Validation failed for value")},p=(e,t)=>(r,n)=>Fe(r,e,n),Pt=p(y.isNumber,"isNumber"),Gt=p(y.isInteger,"isInteger"),jt=p(y.isString,"isString"),Mt=p(y.isNonEmptyString,"isNonEmptyString"),Kt=p(y.isBoolean,"isBoolean"),Bt=p(y.isBigInt,"isBigInt"),Lt=p(y.isSymbol,"isSymbol"),Ut=p(y.isNull,"isNull"),Dt=p(y.isUndefined,"isUndefined"),vt=p(y.isDefined,"isDefined"),_t=p(y.isNil,"isNil"),$t=p(y.isFunction,"isFunction"),Ft=p(y.isObject,"isObject"),zt=p(y.isArray,"isArray"),Ht=p(y.isMap,"isMap"),Vt=p(y.isSet,"isSet"),Wt=p(y.isWeakMap,"isWeakMap"),Jt=p(y.isWeakSet,"isWeakSet"),qt=p(H,"isCamelCase"),Xt=p(J,"isBufferLikeObject"),Zt=p(L,"isJSONArrayString"),Yt=p(U,"isJSONObjectString"),Qt=p(V,"isJsonString"),er=p(E,"isAbsoluteUrl"),tr=p(I,"isInternalUrl"),ae=p(q,"isRGBTuple"),Pn={assertValue:Fe,makeAssert:p,assertIsNumber:Pt,assertIsInteger:Gt,assertIsString:jt,assertIsNonEmptyString:Mt,assertIsBoolean:Kt,assertIsBigInt:Bt,assertIsSymbol:Lt,assertIsNull:Ut,assertIsUndefined:Dt,assertIsDefined:vt,assertIsNil:_t,assertIsFunction:$t,assertObject:Ft,assertIsArray:zt,assertIsMap:Ht,assertIsSet:Vt,assertIsWeakMap:Wt,assertIsWeakSet:Jt,assertIsCamelCase:qt,assertIsBufferLikeObject:Xt,assertIsJSONArrayString:Zt,assertIsJSONObjectString:Yt,assertIsJsonString:Qt,assertIsAbsoluteUrl:er,assertIsInternalUrl:tr,assertIsRGBTuple:ae};var Z=e=>e[0].toUpperCase()+e.slice(1),ze=e=>w(e)||!b(e)?"":e.replace(T.letterSeparator," ").replace(T.camelCaseBoundary,(r,n)=>n===0?r.toLowerCase():r.toUpperCase()).replace(T.whitespace,""),He=e=>w(e)||!b(e)?"":e.replace(T.wordBoundarySplitter," ").replace(T.kebabCaseBoundary,"$1 $2").trim().split(T.whitespace).join("-").toLowerCase(),Ve=e=>w(e)||!b(e)?"":e.replace(T.wordBoundarySplitter," ").replace(T.kebabCaseBoundary,"$1 $2").trim().split(T.whitespace).join("_").toLowerCase();var We=e=>{let{keys:t,prefix:r,suffix:n}=e,o=k.map(t,s=>{let i=r?`${r}${s.charAt(0).toUpperCase()+s.slice(1)}${n}`:`${s.charAt(0).toLowerCase()+s.slice(1)}${n}`;return[s,i]});return x.fromEntries(o)},Je=(e,t)=>x.fromEntries(k.map(e,r=>{let n=r[t],{[t]:o,...s}=r;return[n,s]})),ue=e=>k.map(e,Z),qe=e=>ue(x.keys(e).map(String).filter(t=>/^[A-Za-z]/.test(t)));var _n={capitalizedKeys:qe,capitalizeArray:ue,toKeyByField:Je,generateKeyMap:We,toSnakeCase:Ve,toKebabCase:He,toCamelCase:ze,capitalizeString:Z};function N(e,t="yellow"){return`${Q[t]}${e}${Q.reset}`}var rr={log:e=>N(e,"yellow"),info:e=>N(e,"cyan"),error:e=>N(e,"red"),debug:e=>N(e,"magenta"),warn:e=>N(e,"yellow"),table:e=>e},ce=e=>{if(C(e))return"";if(m(e))return e;try{return JSON.stringify(e,(t,r)=>h(r)?r.toString():r,2)}catch{return String(e)}},Xe=e=>{let{preferredIndex:t=3,fallbackIndex:r=2,topParent:n=!1,stripPathPrefix:o=process.cwd()}=e,s=new Error().stack;if(!s)return"unknown";let i=s.split(`
2
+ `).slice(1).map(u=>u.replace(T.stackTracePrefix,"").trim()).filter(Boolean),a=n?[...i].reverse().find(u=>!u.includes("node_modules"))??i.at(-1):i[t]??i[r]??i.at(-1);return o?a?.replace(o,"")??"unknown":a??"unknown"},nr=(e,...t)=>{let r=process.env.NODE_ENV!=="production",{enabled:n=!0,overrideDev:o=!1}=e;if(!n||!r&&!o)return;let s="log",i=t[0];if(m(i)&&W(fe)(i)&&(s=i),s==="table"){let c=k.map(t.slice(1),f=>f&&l(f)&&"current"in f?f.current.map(j=>({key:j.key,duration:j.end!=null&&j.start!=null?`${(j.end-j.start).toFixed(2)}ms`:"in progress"})):f);console.table(c.flat());return}let a=rr[s],u=t.map(c=>{let f=l(c)?ce(c):String(c);return a?a(f):f});(console[s]??console.log)(...u)};var D=class{};D.highlight=N,D.serialize=ce,D.getCallerLocation=Xe;function Ze(e,t={}){let r=(c,f)=>c.key.toLowerCase()!==f.key?!1:f.modifiers.some(A=>A==="ctrl"?c.ctrlKey:A==="meta"?c.metaKey:A==="alt"?c.altKey:A==="shift"?c.shiftKey:!1),n={...Te,...t},o=e.key.toLowerCase(),s=r(e,n.copyShortcut),i=r(e,n.pasteShortcut),a=n.clearKeys.includes(o),u=n.allowedKeys.includes(o);return{isPaste:i,isCopy:s,isClear:a,isAllowedKey:u,shouldBlockTyping:!u&&!s&&!i}}var v=new Map,or=200;async function Ye(e,t={}){if(typeof window>"u")return;let{fetchPriority:r="low"}=t,o=(O(e)?e:[e]).filter(s=>!v.has(s)).map(s=>new Promise(i=>{let a=new Image;a.fetchPriority=r,a.src=s;let u=()=>{if(v.size>=or){let c=v.keys().next().value;c&&v.delete(c)}v.set(s,!0),i()};a.complete?u():d("decode")(a)&&g(a.decode)?a.decode().then(u).catch(u):(a.onload=u,a.onerror=u)}));o.length!==0&&await Promise.all(o)}function Qe(e){return e?m(e)?e:(d("default")(e),d("default")(e)&&e.default&&l(e.default)&&d("src")(e.default)?e.default.src:l(e)&&d("src")(e)&&m(e.src)?e.src:""):""}var to={getKeyboardAction:Ze,preloadImages:Ye,normalizeImageSrc:Qe};var et=class{static toNum(t){return h(t)?Number(t):t}static round(t,r=0){let n=Math.pow(10,r);return Math.round(t*n)/n}static clamp(t,r,n){return Math.max(r,Math.min(n,t))}static getPercentage(t,r,n=0){if(r===0||r===0n)return 0;if(h(t)||h(r)){let o=BigInt(10**(n+2));return Number(BigInt(t)*100n*o/BigInt(r))/Number(o)}return this.round(t/r*100,n)}static computeMean(t){if(!t.length)return 0;let r=t.map(n=>this.toNum(n));return r.reduce((n,o)=>n+o,0)/r.length}static isAnomaly(t,r,n,o=2){return n===0?!1:Math.abs(t-r)>n*o}static computeRatio(t,r,n=2){return this.getPercentage(t,r,n)}static welfordUpdate(t,r){if(!t)return{welford:{count:1,mean:r,squaredDeviationSum:0},stdDev:0};let{count:n,mean:o,squaredDeviationSum:s}=t,i=n+1,a=r-o,u=o+a/i,c=s+a*(r-u),f=i>1?c/(i-1):0,A=Math.sqrt(f);return{welford:{count:i,mean:u,squaredDeviationSum:c},stdDev:A}}static computeDelta(t,r){if(h(t)&&h(r)){let n=t-r,o=n<0n?-n:n;return{netDelta:n,absDelta:o}}if(S(t)&&S(r)){let n=t-r,o=Math.abs(n);return{netDelta:n,absDelta:o}}throw new Error("Incompatible types: current and past must both be number or both be bigint.")}static computePercentageChange(t,r,n=1n){if(r===0||r===0n)return 0;if(h(t)||h(r)){let o=BigInt(t),s=BigInt(r);return Number((o-s)*(100n*n)/s)/Number(n)}return(t-r)/r*100}};var _=e=>{let t=e.startsWith("#")?e.slice(1):e;if(!T.hexColor.test(t))throw new Error(`Invalid hex color: "${e}"`);let r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[r,n,o]},$=e=>m(e)?_(e):(ae(e),e),Y=e=>{let[t,r,n]=$(e),o=s=>{let i=s/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(t)+.7152*o(r)+.0722*o(n)},le=(e,t)=>Y($(e))<t,tt=e=>le(e,.179),pe=(e,t)=>Y($(e))>t,rt=(e,t)=>{let{mode:r="tailwind",threshold:n=.179}=t??{},o=pe(e,n);return r==="css"?o?"#000000":"#ffffff":o?"text-black":"text-white"},nt=e=>{let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=e.replace(t,(o,s,i,a)=>s+s+i+i+a+a),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:null},ot=(e,t,r)=>{let n={r:Math.round(e.r+(t.r-e.r)*r),g:Math.round(e.g+(t.g-e.g)*r),b:Math.round(e.b+(t.b-e.b)*r)};return`rgb(${n.r}, ${n.g}, ${n.b})`};function st(e){let[t,r,n]=_(e).map(f=>f/255),o=Math.max(t,r,n),s=Math.min(t,r,n),i=(o+s)/2,a=0,u=0,c=o-s;return c!==0&&(u=i>.5?c/(2-o-s):c/(o+s),o===t?a=((r-n)/c+(r<n?6:0))*60:o===r?a=((n-t)/c+2)*60:o===n&&(a=((t-r)/c+4)*60)),{h:a,s:u,l:i}}var it=e=>{let[t,r,n]=_(e);return[t/255,r/255,n/255]};var lo={hexToNormalizedRGB:it,hexToHSL:st,interpolateColor:ot,hexToRGBShorthand:nt,contrastTextColor:rt,isLumGreaterThan:pe,isDarkColor:tt,isLumLessThan:le,getLuminance:Y,validateRGB:$,hexToRGB:_};function at(e){if(!R(e))return"";if(m(e))return e;if(e instanceof URL)return e.toString();if(l(e)&&(d("pathname")(e)||d("query")(e))){let{pathname:t="",query:r,hash:n=""}=e,o="";if(l(r)){let a=new URLSearchParams;x.entries(r).forEach(([c,f])=>{R(f)&&(O(f)?k.forEach(f,A=>a.append(c,String(A))):a.append(c,String(f)))});let u=a.toString();u&&(o=`?${u}`)}let s=t||"",i=n&&!n.startsWith("#")?`#${n}`:n||"";return`${s}${o}${i}`}return""}var ut=e=>{if(!I(e))return"/";let t=e.trim();return t?t.startsWith("/")?t:E(t)?new URL(t).pathname||"/":`/${t}`:"/"},ct=e=>{if(!e)return"";if(!e.includes("#"))return e;try{let t=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(e,t);return typeof window<"u"&&r.origin===window.location.origin?`${r.pathname}${r.search}`:`${r.origin}${r.pathname}${r.search}`}catch{return e.split("#")[0]}},lt=({event:e,href:t,behavior:r="smooth",block:n="start"})=>{if(typeof window>"u"||!t.startsWith("#")||/iPad|iPhone|iPod/.test(navigator.userAgent))return!1;let s=t.replace(/^#/,""),i=document.getElementById(s);return i?(e?.preventDefault(),i.scrollIntoView({behavior:r,block:n}),!0):!1};var G=class{};G.normalize=at,G.extractRelativePath=ut,G.stripHash=ct,G.handleHashScroll=lt;export{Q as ANSI_COLOR_CODES,k as ArrayUtils,Pn as AssertionUtils,tn as CollectionTypeGuards,lo as ColorUtils,et as ComputationUtils,y as CoreTypeGuards,Te as DEFAULT_KEYBOARD_CONFIG,D as DebugUtils,to as DomUtils,en as FormatTypeGuards,Or as HTML_TAGS,fe as LOG_TYPES,G as LinkUtils,x as ObjectUtils,T as REGEX_CONSTANTS,Nn as ReactTypeGuards,pt as RenamedArrayMethods,dt as RenamedObjectMethods,me as SAFE_HTML_TAGS,_n as TransformersUtils,ee as VALID_DOM_PROPS,Ir as VALID_DOM_TESTING_KEYS,ur as arrayFilter,Tr as arrayFilterNonNullable,pr as arrayFlat,dr as arrayFlatMap,mr as arrayForEach,cr as arrayIncludes,ar as arrayMap,lr as arrayReduce,er as assertIsAbsoluteUrl,zt as assertIsArray,Bt as assertIsBigInt,Kt as assertIsBoolean,Xt as assertIsBufferLikeObject,qt as assertIsCamelCase,vt as assertIsDefined,$t as assertIsFunction,Gt as assertIsInteger,tr as assertIsInternalUrl,Zt as assertIsJSONArrayString,Yt as assertIsJSONObjectString,Qt as assertIsJsonString,Ht as assertIsMap,_t as assertIsNil,Mt as assertIsNonEmptyString,Ut as assertIsNull,Pt as assertIsNumber,ae as assertIsRGBTuple,Vt as assertIsSet,jt as assertIsString,Lt as assertIsSymbol,Dt as assertIsUndefined,Wt as assertIsWeakMap,Jt as assertIsWeakSet,Ft as assertObject,ue as capitalizeArray,Z as capitalizeString,qe as capitalizedKeys,rt as contrastTextColor,ut as extractRelativePath,We as generateKeyMap,Xe as getCallerLocation,Ze as getKeyboardAction,Y as getLuminance,lt as handleInternalHashScroll,Be as hasChildren,Ne as hasDefinedKeys,$e as hasNameMetadata,ve as hasOnClick,st as hexToHSL,it as hexToNormalizedRGB,_ as hexToRGB,nt as hexToRGBShorthand,N as highlight,ot as interpolateColor,E as isAbsoluteUrl,O as isArray,P as isArrayOf,h as isBigInt,M as isBoolean,J as isBufferLikeObject,H as isCamelCase,Le as isComponentType,Ge as isDOMEntry,re as isDOMPropKey,tt as isDarkColor,R as isDefined,ie as isElementLike,_e as isElementOfType,Ie as isEmail,Ue as isForwardRef,De as isFragment,g as isFunction,Re as isHTMLString,Ae as isHexByteString,we as isInArray,he as isInstanceOf,de as isInteger,I as isInternalUrl,L as isJSONArrayString,U as isJSONObjectString,V as isJsonString,ke as isKebabCase,d as isKeyInObject,W as isKeyOfArray,Oe as isKeyOfObject,pe as isLumGreaterThan,le as isLumLessThan,ye as isMap,w as isNil,b as isNonEmptyString,B as isNull,S as isNumber,l as isObject,Ee as isPhoneNumber,z as isPrimitive,Ke as isPromise,te as isPropValid,q as isRGBTuple,se as isReactElement,X as isReactPortal,Ce as isRecordOf,je as isRef,Me as isRefObject,be as isSet,Se as isSnakeCase,m as isString,K as isSymbol,C as isUndefined,oe as isValidReactNode,ge as isWeakMap,xe as isWeakSet,nr as logDev,Qe as normalizeImageSrc,at as normalizeUrl,gr as objectEntries,xr as objectFromEntries,kr as objectGet,Sr as objectHas,br as objectKeys,Rr as objectSet,hr as objectValues,Ye as preloadImages,ce as serialize,ct as stripHash,ze as toCamelCase,He as toKebabCase,Je as toKeyByField,Ve as toSnakeCase,$ as validateRGB};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/managers/util-managers.ts","../src/lib/common/array.ts","../src/lib/common/object.ts","../src/lib/guards/core/primitives.ts","../src/constants/dom.ts","../src/constants/common.ts","../src/constants/react-props.ts","../src/lib/guards/core/reference.ts","../src/lib/guards/core/string-guards.ts","../src/lib/guards/core/link-guards.ts","../src/lib/guards/core/composite.ts","../src/lib/guards/core/refined.ts","../src/lib/guards/core/index.ts","../src/lib/common/memoize.ts","../src/lib/guards/react/dom-guards.ts","../src/lib/guards/react/react-primitive.ts","../src/lib/guards/react/node-guards.ts","../src/lib/guards/react/index.ts","../src/lib/validations/assertions.ts","../src/lib/transformers/string-transformers.ts","../src/lib/transformers/object-transformers.ts","../src/lib/transformers/index.ts","../src/lib/debug/debug.ts","../src/lib/debug/index.ts","../src/lib/dom/events.ts","../src/lib/dom/media.ts","../src/lib/dom/index.ts","../src/lib/computation/index.ts","../src/lib/color/color.ts","../src/lib/color/index.ts","../src/lib/link/link-utils.ts","../src/lib/link/index.ts"],"sourcesContent":["import { TStaticMethods } from '../types';\n\n/** @see {@link ManagerDocs.exportStaticMethods} */\nfunction exportAndRenameStaticMethods<\n T extends new (...args: unknown[]) => unknown,\n R extends Record<string, keyof TStaticMethods<T>>,\n>(cls: T, renameMap: R): { [K in keyof R]: TStaticMethods<T>[R[K]] } {\n const result = {} as { [K in keyof R]: TStaticMethods<T>[R[K]] };\n\n for (const [newKey, oldKey] of Object.entries(renameMap) as [\n keyof R,\n keyof TStaticMethods<T>,\n ][]) {\n const prop = cls[oldKey] as unknown;\n\n // Only bind if it’s a function\n if (typeof prop === 'function') {\n // Infer type of function parameters and return\n result[newKey] = (prop as (...args: unknown[]) => unknown).bind(\n cls,\n ) as TStaticMethods<T>[R[typeof newKey]];\n }\n }\n\n return result;\n}\n\nfunction exportStaticMethods<T extends new (...args: unknown[]) => unknown>(\n cls: T,\n): TStaticMethods<T> {\n const result = {} as TStaticMethods<T>;\n\n for (const key of Object.getOwnPropertyNames(cls)) {\n if (key === 'prototype' || key === 'name' || key === 'length') continue;\n\n const typedKey = key as keyof T;\n const prop = cls[typedKey];\n\n if (typeof prop === 'function') {\n // Cast via unknown first to satisfy TypeScript\n (result as unknown as Record<keyof TStaticMethods<T>, unknown>)[\n typedKey as keyof TStaticMethods<T>\n ] = prop.bind(cls);\n }\n }\n\n return result;\n}\n\nexport { exportAndRenameStaticMethods, exportStaticMethods };\n","import type { TFixedLengthArray } from '../../types';\nimport { exportAndRenameStaticMethods } from '../../managers';\n\n/**\n * ## 🧩 Available Methods\n *\n * - `includes` β€” Type-safe `Array.includes` helper for union narrowing.\n * - `createFixedLengthArray` β€” Ensures arrays have a fixed compile-time length.\n * - `readAllItems` β€” Returns a shallow copy of an array.\n * - `map` β€” Type-safe wrapper around `Array.map`.\n * - `forEachUnion` β€” Handles arrays with union element types safely.\n * - `forEach` β€” Standard, type-safe `forEach` wrapper.\n * - `reduce` β€” Strictly typed reduction helper.\n * - `flat` β€” One-level flattening helper.\n * - `flatMap` β€” Safe flatMap alternative with strong typing.\n * - `filter` β€” Generic and narrowed type-safe filter.\n * - `filterNonNullable` β€” Removes nullish values safely.\n *\n * ---\n * @see {@link CommonUtilsDocs.ArrayUtils}\n */\nclass ArrayUtils {\n /** @see {@link ArrayUtilsDocs.includes} */\n static includes<T extends U, U>(arr: ReadonlyArray<T>, el: U): el is T {\n return arr.includes(el as T);\n }\n\n /** @see {@link ArrayUtilsDocs.createFixedLengthArray} */\n static createFixedLengthArray<T>(\n items: T[],\n length: number,\n ): TFixedLengthArray<T[]> {\n if (items.length !== length) {\n throw new Error(`Array must have exactly ${length} elements`);\n }\n return items satisfies TFixedLengthArray<T[]>;\n }\n\n /**\n * Returns a shallow copy of an array.\n *\n * @typeParam T - Type of array elements.\n * @param arr - Array to copy.\n * @returns A new array containing all items.\n *\n * @example\n * const original = [1, 2, 3];\n * const copy = ArrayUtils.readAllItems(original);\n * copy.push(4); // Does not affect `original`\n */\n static readAllItems<T>(arr: ReadonlyArray<T>): T[] {\n return [...arr]; // Simply returns a shallow copy of the array\n }\n /** 🧠 Safe map wrapper with correct inference */\n static map<T, U>(\n arr: ReadonlyArray<T>,\n fn: (value: T, index: number, array: ReadonlyArray<T>) => U,\n ): U[] {\n return arr.map(fn);\n }\n /**\n * 🧠 Type-safe forEach for arrays that might be union types.\n * Helps TypeScript narrow union members while iterating.\n *\n * Supports both:\n * - Single arrays: `T[]`\n * - Union of arrays: `T[][]`\n *\n * @typeParam T - The type of array elements.\n *\n * @param arr - The array or array of arrays to iterate over.\n * @param fn - Callback executed for each element.\n *\n * @example\n * // Single array\n * const numbers = [1, 2, 3];\n * ArrayUtils.forEachUnion(numbers, (num, idx) => {\n * console.log(num * 2, idx);\n * });\n *\n * @example\n * // Union of arrays\n * const arrays: number[][] = [[1, 2], [3, 4]];\n * ArrayUtils.forEachUnion(arrays, (num, idx) => {\n * console.log(num * 2, idx);\n * });\n */\n static forEachUnion<T>(\n arr: T[] | T[][],\n fn: (item: T, index: number) => void,\n ): void {\n // Flatten the array if it’s an array of arrays\n const flatArr: T[] = Array.isArray(arr[0])\n ? ([] as T[]).concat(...(arr as T[][]))\n : (arr as T[]);\n flatArr.forEach(fn);\n }\n /** 🧠 Safe forEach wrapper with correct inference */\n static forEach<T>(\n arr: ReadonlyArray<T>,\n fn: (value: T, index: number, array: ReadonlyArray<T>) => void,\n ): void {\n arr.forEach(fn);\n }\n static reduce<T, U>(\n arr: ReadonlyArray<T>,\n fn: (\n accumulator: U,\n current: T,\n index: number,\n array: ReadonlyArray<T>,\n ) => U,\n initialValue: U,\n ): U {\n return arr.reduce(fn, initialValue);\n }\n /** 🧠 Type-safe flat for 1-level nested arrays */\n static flat<T>(arr: ReadonlyArray<T | T[]>): T[] {\n return arr.reduce<T[]>((acc, val) => acc.concat(val as T | T[]), []);\n }\n\n /** 🧠 Type-safe flatMap */\n static flatMap<T, U>(\n arr: ReadonlyArray<T>,\n fn: (item: T, index: number) => U | U[],\n ): U[] {\n return arr.reduce<U[]>((acc, item, i) => {\n const result = fn(item, i);\n return acc.concat(result as U[]);\n }, []);\n }\n\n /**\n * 🧠 Type-safe filter wrapper\n * Preserves TypeScript type inference.\n *\n * @example\n * const numbers: (number | null)[] = [1, 2, null, 4];\n * const validNumbers = ArrayUtils.filter(numbers, (n): n is number => n != null);\n */\n static filter<T, S extends T>(\n arr: ReadonlyArray<T>,\n predicate: (value: T, index: number, array: ReadonlyArray<T>) => value is S,\n ): S[];\n static filter<T>(\n arr: ReadonlyArray<T>,\n predicate: (value: T, index: number, array: ReadonlyArray<T>) => boolean,\n ): T[];\n static filter<T>(\n arr: ReadonlyArray<T>,\n predicate: (value: T, index: number, array: ReadonlyArray<T>) => boolean,\n ): T[] {\n return arr.filter(predicate);\n }\n /**\n * Shortcut for filtering out null or undefined values.\n */\n static filterNonNullable<T>(arr: ReadonlyArray<T | null | undefined>): T[] {\n return ArrayUtils.filter(arr, (item): item is T => item != null);\n }\n}\n\n//\n// πŸ”„ HYBRID EXPORT PATTERN β€” ArrayUtils\n// -----------------------------------------------------------------------------\n// Purpose:\n// This pattern exposes both the organized utility class (`ArrayUtils`) and\n// individually tree-shakable function exports (like `arrayMap`, `arrayFilter`, etc.).\n//\n// βœ… Why:\n// - Developers can import *just what they need* for better bundle optimization.\n// - Retains full class form (`ArrayUtils`) for grouped documentation or organized access.\n// - Maintains type safety and clear naming via consistent prefixes (e.g. `arrayMap`).\n//\n// 🧱 Structure:\n// 1. `ArrayUtils` β€” full static utility class (namespaced usage).\n// 2. `RenamedArrayMethods` β€” plain object with all renamed, bound statics.\n// 3. Individual tree-shakable exports β€” destructured for direct imports.\n//\n// πŸ’‘ Example Usage:\n// ```ts\n// // Import only what you need (tree-shakable)\n// import { arrayMap, arrayFilter } from '@/utils';\n//\n// const doubled = arrayMap([1, 2, 3], n => n * 2);\n// const clean = arrayFilter(doubled, n => n > 2);\n//\n// // Or use grouped access\n// import { RenamedArrayMethods } from '@/utils';\n// RenamedArrayMethods.arrayMap([1, 2, 3], n => n * 2);\n//\n// // Or access via the class itself\n// import { ArrayUtils } from '@/utils';\n// ArrayUtils.map([1, 2, 3], n => n * 2);\n// ```\n// -----------------------------------------------------------------------------\n\nexport const RenamedArrayMethods = exportAndRenameStaticMethods(ArrayUtils, {\n arrayIncludes: 'includes',\n arrayMap: 'map',\n arrayFilter: 'filter',\n arrayFlat: 'flat',\n arrayReduce: 'reduce',\n arrayForEach: 'forEach',\n arrayFlatMap: 'flatMap',\n arrayFilterNonNullable: 'filterNonNullable',\n});\n\n// Directly export the destructured functions for tree-shaking\nexport const {\n arrayMap,\n arrayFilter,\n arrayIncludes,\n arrayReduce,\n arrayFlat,\n arrayFlatMap,\n arrayForEach,\n arrayFilterNonNullable,\n} = RenamedArrayMethods;\n\n// Export the full class if needed\nexport { ArrayUtils };\n","import { exportAndRenameStaticMethods } from '../../managers';\n\n/**\n * ## 🧩 Available Methods\n *\n * - `keys` β€” Returns the keys of an object with full type inference.\n * - `entries` β€” Returns typed key-value pairs of an object.\n * - `fromEntries` β€” Builds a typed object from key-value entry tuples.\n * - `values` β€” Returns the values of an object with inferred types.\n * - `has` β€” Checks if a nested property exists via dot notation.\n * - `get` β€” Safely retrieves a nested property using a dot path.\n * - `set` β€” Safely sets a nested property using a dot path.\n *\n * ---\n * @see {@link CommonUtilsDocs.ObjectUtils}\n */\nclass ObjectUtils {\n /**\n * Returns the keys of an object while protecting key inference.\n *\n * @template Obj - The object type\n * @param {Obj} obj - The object to extract keys from\n */\n static keys<Obj extends object>(obj: Obj) {\n return Object.keys(obj) as (keyof Obj)[];\n }\n /**\n * Returns the key-value pairs of an object while protecting type inference.\n *\n * @template T - The object type\n * @param {T} obj - The object to extract key-value pairs from\n */\n static entries<T extends Record<string, unknown>>(\n obj: T,\n ): [keyof T, T[keyof T]][] {\n return obj ? (Object.entries(obj) as [keyof T, T[keyof T]][]) : [];\n }\n /**\n * Constructs an object from an array of entries with type safety.\n */\n\n // static fromEntries<K extends string, V>(entries: [K, V][]): Record<K, V> {\n // return Object.fromEntries(entries) as Record<K, V>;\n // }\n static fromEntries<\n K extends string | number | symbol = string, // default key type\n V = unknown,\n >(entries: [K, V][]): Record<K, V> {\n return Object.fromEntries(entries) as Record<K, V>;\n }\n /**\n * Returns the values of an object while protecting type inference.\n *\n * @template Obj - The object type\n * @param {Obj} obj - The object to extract values from\n */\n static values<Obj extends object>(obj: Obj) {\n return Object.values(obj) as Obj[keyof Obj][];\n }\n\n /**\n * Checks if a nested property exists in an object using dot notation.\n * @param obj - The object to check.\n * @param path - Dot-separated path like 'user.profile.name'\n */\n static has<Obj extends object>(obj: Obj, path: string): boolean {\n if (!path) return false;\n\n const keys = path.split('.');\n let current: unknown = obj;\n\n for (const key of keys) {\n // Only check 'in' if current is an object\n if (current == null || typeof current !== 'object' || !(key in current)) {\n return false;\n }\n // TypeScript knows current is object here, so we can index with key\n current = (current as Record<string, unknown>)[key];\n }\n\n return true;\n }\n\n /**\n * Safely gets a nested property from an object using dot notation.\n * @param obj - The object to access.\n * @param path - Dot-separated path like 'user.profile.name'\n */\n static get<Obj extends object, Path extends string>(\n obj: Obj,\n path: Path,\n ): unknown {\n if (!path) return undefined;\n const keys = path.split('.');\n let current: unknown = obj;\n for (const key of keys) {\n if (current == null || typeof current !== 'object' || !(key in current)) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[key];\n }\n return current;\n }\n\n /**\n * Safely sets a nested property on an object using dot notation.\n * Creates intermediate objects as needed.\n * @param obj - The object to modify.\n * @param path - Dot-separated path like 'user.profile.name'\n * @param value - The value to set\n */\n static set<Obj extends object>(obj: Obj, path: string, value: unknown): void {\n if (!path) return;\n\n const keys = path.split('.');\n let current: unknown = obj;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n\n if (typeof current !== 'object' || current === null) {\n // Should never happen if obj is valid, but safeguard\n return;\n }\n\n const record = current as Record<string, unknown>;\n\n if (\n !(key in record) ||\n typeof record[key] !== 'object' ||\n record[key] === null\n ) {\n record[key] = {};\n }\n\n current = record[key];\n }\n\n if (typeof current === 'object' && current !== null) {\n (current as Record<string, unknown>)[keys[keys.length - 1]] = value;\n }\n }\n}\n//\n// πŸ”„ HYBRID EXPORT PATTERN\n// -----------------------------------------------------------------------------\n// We export both:\n// 1. The full `ObjectUtils` class (for grouped, named usage)\n// 2. Individually renamed functions for tree-shakable, direct imports\n// -----------------------------------------------------------------------------\nexport const RenamedObjectMethods = exportAndRenameStaticMethods(ObjectUtils, {\n objectKeys: 'keys',\n objectEntries: 'entries',\n objectFromEntries: 'fromEntries',\n objectValues: 'values',\n objectHas: 'has',\n objectGet: 'get',\n objectSet: 'set',\n});\n\n// -----------------------------------------------------------------------------\n// 🧩 Tree-shakable direct exports\n// -----------------------------------------------------------------------------\nexport const {\n objectKeys,\n objectEntries,\n objectFromEntries,\n objectValues,\n objectHas,\n objectGet,\n objectSet,\n} = RenamedObjectMethods;\n\n// -----------------------------------------------------------------------------\n// 🧱 Export full utility class (optional grouped import)\n// -----------------------------------------------------------------------------\nexport { ObjectUtils };\n","import { TTypeGuard } from '../../../types';\n\nexport const isNumber: TTypeGuard<number> = (value): value is number =>\n typeof value === 'number' && !Number.isNaN(value) && Number.isFinite(value);\n\nexport const isInteger: TTypeGuard<number> = (value): value is number =>\n Number.isInteger(value);\n\nexport const isString: TTypeGuard<string> = (value): value is string =>\n typeof value === 'string';\n\nexport const isNonEmptyString: TTypeGuard<string> = (value): value is string =>\n typeof value === 'string' && value.length > 0 && value.trim().length > 0;\n\nexport const isBoolean: TTypeGuard<boolean> = (value): value is boolean =>\n typeof value === 'boolean';\n\n/**\n * Checks if the value is a bigint.\n *\n * @example\n * ```ts\n * PrimitiveTypeGuards.isBigInt(123n); // true\n * PrimitiveTypeGuards.isBigInt(123); // false\n * ```\n */\nexport const isBigInt: TTypeGuard<bigint> = (value): value is bigint =>\n typeof value === 'bigint';\n\n/**\n * Checks whether a value is a `symbol`.\n *\n * In JavaScript, a `symbol` is a unique and immutable primitive value that can be used as a key\n * for object properties. Each symbol is guaranteed to be unique, even if two symbols have the same\n * description.\n *\n * Key points:\n * - Symbols are often used to add unique property keys to objects without risk of name collisions.\n * - `typeof value === 'symbol'` is used to check if a value is a symbol.\n *\n * @example\n * ```ts\n * const sym1 = Symbol('foo');\n * const sym2 = Symbol('foo');\n *\n * isSymbol(sym1); // true\n * isSymbol(sym2); // true\n * isSymbol('foo'); // false\n *\n * const obj = { [sym1]: 123 };\n * console.log(obj[sym1]); // 123\n * ```\n */\nexport const isSymbol: TTypeGuard<symbol> = (value): value is symbol =>\n typeof value === 'symbol';\n\nexport const isPrimitive = (\n value: unknown,\n): value is string | number | boolean =>\n isString(value) || isNumber(value) || isBoolean(value) || isBigInt(value);\n","import type { TKeyboardConfig } from '../types';\n/* prettier-ignore */ const HTML_TAGS = Object.freeze(['div', 'span', 'a', 'p', 'ul', 'li'] as const);\n/* prettier-ignore */ const SAFE_HTML_TAGS = Object.freeze([ 'b', 'i', 'p', 'ul', 'li', 'a', 'span', 'div', 'br', 'strong', 'em', 'u', 'code', 'pre', 'blockquote' ] as const);\nconst DEFAULT_KEYBOARD_CONFIG: Required<TKeyboardConfig> = {\n allowedKeys: [\n 'arrowleft',\n 'arrowright',\n 'arrowup',\n 'arrowdown',\n 'backspace',\n 'delete',\n 'tab',\n ],\n clearKeys: ['backspace', 'delete'],\n copyShortcut: {\n key: 'c',\n modifiers: ['ctrl', 'meta'],\n },\n pasteShortcut: {\n key: 'v',\n modifiers: ['ctrl', 'meta'],\n },\n} satisfies Required<TKeyboardConfig>;\n\nexport { DEFAULT_KEYBOARD_CONFIG, SAFE_HTML_TAGS, HTML_TAGS };\n","import { SAFE_HTML_TAGS } from './dom';\n\nconst LOG_TYPES = Object.freeze([\n 'log',\n 'warn',\n 'error',\n 'info',\n 'debug',\n 'table',\n] as const);\n\nconst REGEX_CONSTANTS = {\n isoRegex:\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$/,\n camelCase: /^[a-z]+(?:[A-Z][a-z0-9]*)*$/,\n kebabCase: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n snakeCase: /^[a-z0-9]+(?:_[a-z0-9]+)*$/,\n hexString: /^[0-9a-fA-F]+$/,\n hexColor: /^[0-9A-Fa-f]{6}$/,\n letterSeparator: /[^A-Za-z]+/g,\n camelCaseBoundary: /(?:^\\w|[A-Z]|\\b\\w)/g,\n kebabCaseBoundary: /([a-z0-9])([A-Z])/g,\n whitespace: /\\s+/g,\n wordBoundarySplitter: /[^A-Za-z0-9]+/g,\n USPhoneNumber: /^(?:\\+1\\s?)?(?:\\(\\d{3}\\)|\\d{3})[-.\\s]?\\d{3}[-.\\s]?\\d{4}$/,\n EUPhoneNumber: /^\\+?\\d{1,4}[\\s.-]?\\d{2,4}([\\s.-]?\\d{2,4}){1,3}$/,\n genericPhoneNumber: /^\\+?(\\d[\\d\\s-().]{6,}\\d)$/,\n genericEmail: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n emailRegex:\n /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z]{2,}$/,\n imageSrcRegex: /<img[^>]+src=\"([^\">]+)\"/i,\n singleAlphabetChar: /^[a-zA-Z]$/,\n htmlDetection: new RegExp(\n `<\\\\/?(${SAFE_HTML_TAGS.join('|')})\\\\b[^>]*>|&[a-z]+;`,\n 'i',\n ),\n stackTracePrefix: /^\\s*at\\s+/,\n} as const;\n\nconst ANSI_COLOR_CODES = {\n reset: '\\x1b[0m',\n black: '\\x1b[30m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n magenta: '\\x1b[35m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n bold: '\\x1b[1m',\n underline: '\\x1b[4m',\n} as const;\n\nexport { REGEX_CONSTANTS, ANSI_COLOR_CODES, LOG_TYPES };\n","import type { TPropMap } from '../types';\n\n/**\n * VALID_DOM_PROPS\n *\n * This list of valid HTML and SVG attributes is initialized from the\n * @emotion/is-prop-valid source:\n * https://github.com\n *\n * WHY THIS EXISTS:\n * To remove the dependency on @emotion/is-prop-valid in this utility package\n * while maintaining the same robust prop-filtering logic used by styled-components\n * and emotion. This prevents \"unknown prop\" warnings when forwarding props to\n * primitive DOM elements.\n *\n * MODIFICATIONS & EXTENSIONS:\n * 1. Categorization: The original flat list has been broken into logical\n * groups (HTML, SVG, Metadata, etc.) for better maintainability.\n * 2. React 19+ Support: Added modern attributes missing from the legacy\n * emotion snapshot, including 'popover', 'inert', 'fetchPriority',\n * and React 19's function-based 'action'/'formAction' props.\n * 3. Performance: Merged into a Set for O(1) lookup speed during render.\n * 4. Consistency: Ensured React-specific camelCase mappings (className,\n * htmlFor, tabIndex) are prioritized.\n *\n * @see https://react.dev\n * @see https://developer.mozilla.org\n */\nconst BASE_REACT_PROPS = {\n // react props\n // https://github.com/facebook/react/blob/5495a7f24aef85ba6937truetrue1ce962673ca9f5fde6/src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js\n children: true,\n dangerouslySetInnerHTML: true,\n key: true,\n ref: true,\n autoFocus: true,\n defaultValue: true,\n defaultChecked: true,\n innerHTML: true,\n suppressContentEditableWarning: true,\n suppressHydrationWarning: true,\n // deprecated react prop\n valueLink: true,\n} as const;\n/**\n * Props introduced or expanded in React 19.\n * Some attributes now accept functions for form actions\n * and new resource-prioritization attributes were added.\n */\nconst REACT_19_PROPS = {\n action: true, // Now supports functions\n formAction: true, // Now supports functions\n onCaptured: true, // New for Form Action tracking\n precedence: true, // For <link rel=\"stylesheet\"> prioritization\n blocking: true, // For render-blocking resources\n} as const;\n\n/**\n * HTML attributes that must be camelCased when used in React.\n * React normalizes these instead of the lowercase HTML versions.\n */\nconst REACT_CAMEL_CASE_PROPS = {\n autoFocus: true,\n readOnly: true,\n noValidate: true,\n spellCheck: true,\n tabIndex: true,\n autoComplete: true,\n autoCorrect: true,\n autoCapitalize: true,\n} as const;\n/**\n * Modern HTML attributes supported by browsers and usable in React.\n * Includes newer platform features like popovers, lazy loading,\n * fetch priority hints, and Declarative Shadow DOM.\n */\nconst MODERN_HTML_PROPS = {\n popover: true,\n popoverTarget: true,\n popoverTargetAction: true,\n // https://html.spec.whatwg.org/multipage/interaction.html#inert\n inert: true,\n loading: true, // Lazy-loading for img/iframe\n fetchpriority: true,\n fetchPriority: true,\n enterKeyHint: true, // Virtual keyboard label\n shadowRoot: true, // Declarative Shadow DOM\n disablePictureInPicture: true,\n playsInline: true,\n} as const;\n/**\n * Mixed SVG + accessibility props commonly used in React.\n * Includes SVG rendering attributes and camelCased ARIA props\n * that React expects instead of their kebab-case equivalents.\n */\nconst SVG_AND_A11Y_PROPS = {\n paintOrder: true,\n vectorEffect: true,\n imageRendering: true,\n shapeRendering: true,\n textAnchor: true,\n ariaHasPopup: true, // Correct camelCase for aria-haspopup\n ariaLabel: true,\n ariaLabelledBy: true,\n // Add these for SVG completeness\n alignmentBaseline: true,\n baselineShift: true,\n dominantBaseline: true,\n} as const;\n/**\n * Semantic metadata attributes from RDFa and HTML Microdata.\n * Used for structured data, linked data, and SEO metadata.\n */\nconst METADATA_PROPS = {\n about: true,\n datatype: true,\n inlist: true,\n prefix: true,\n property: true,\n resource: true,\n typeof: true,\n vocab: true, // RDFa\n itemProp: true,\n itemScope: true,\n itemType: true,\n itemID: true,\n itemRef: true, // Microdata\n} as const;\n/**\n * Non-standard, vendor-specific, or platform-specific attributes.\n * Includes WebKit/Blink extensions, IE legacy attributes, and\n * attributes used by ecosystems like AMP.\n */\nconst SPECIALIZED_PROPS = {\n // autoCapitalize and autoCorrect are supported in Mobile Safari for\n // keyboard hints.\n autoCapitalize: true,\n autoCorrect: true,\n autoSave: true, // autoSave allows WebKit/Blink to persist values of input fields on page reloads\n color: true, // Safari mask-icon\n incremental: true, // Webkit search\n // results show looking glass icon and recent searches on input\n // search fields in WebKit/Blink\n results: true,\n // IE-only attribute that specifies security restrictions on an iframe\n // as an alternative to the sandbox attribute on IE<1true\n security: true,\n // IE-only attribute that controls focus behavior\n unselectable: true,\n // used in amp html for eventing purposes\n // https://amp.dev/documentation/guides-and-tutorials/learn/common_attributes/\n on: true,\n // used in amp html for indicating that the option is selectable\n // https://amp.dev/documentation/components/amp-selector/\n option: true,\n // https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/placeholders/\n fallback: true,\n} as const;\n/**\n * Standard HTML attributes supported by modern browsers and React DOM.\n * Covers the majority of attributes used across HTML elements.\n */\nconst STANDARD_HTML_PROPS = {\n abbr: true,\n accept: true,\n acceptCharset: true,\n accessKey: true,\n action: true,\n allow: true,\n allowFullScreen: true,\n allowPaymentRequest: true,\n alt: true,\n // specifies target context for links with `preload` type\n // as: true,\n async: true,\n autoComplete: true,\n autoFocus: true,\n autoPlay: true,\n capture: true,\n cellPadding: true,\n cellSpacing: true,\n\n challenge: true,\n charSet: true,\n checked: true,\n cite: true,\n classID: true,\n className: true,\n cols: true,\n colSpan: true,\n\n content: true,\n contentEditable: true,\n contextMenu: true,\n controls: true,\n controlsList: true,\n coords: true,\n crossOrigin: true,\n\n data: true, // For `<object />` acts as `src`.\n dateTime: true,\n\n decoding: true,\n default: true,\n defer: true,\n dir: true,\n\n disabled: true,\n disablePictureInPicture: true,\n disableRemotePlayback: true,\n download: true,\n draggable: true,\n\n encType: true,\n enterKeyHint: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: true,\n formTarget: true,\n frameBorder: true,\n headers: true,\n\n height: true,\n hidden: true,\n high: true,\n href: true,\n hrefLang: true,\n htmlFor: true,\n httpEquiv: true,\n id: true,\n inputMode: true,\n integrity: true,\n is: true,\n keyParams: true,\n keyType: true,\n kind: true,\n label: true,\n lang: true,\n list: true,\n loading: true,\n loop: true,\n low: true,\n\n marginHeight: true,\n marginWidth: true,\n max: true,\n maxLength: true,\n media: true,\n mediaGroup: true,\n method: true,\n min: true,\n minLength: true,\n\n multiple: true,\n muted: true,\n name: true,\n nonce: true,\n noValidate: true,\n open: true,\n optimum: true,\n pattern: true,\n placeholder: true,\n playsInline: true,\n poster: true,\n preload: true,\n profile: true,\n radioGroup: true,\n readOnly: true,\n referrerPolicy: true,\n rel: true,\n required: true,\n reversed: true,\n role: true,\n rows: true,\n rowSpan: true,\n sandbox: true,\n scope: true,\n scoped: true,\n scrolling: true,\n seamless: true,\n selected: true,\n shape: true,\n size: true,\n sizes: true,\n slot: true,\n span: true,\n spellCheck: true,\n src: true,\n srcDoc: true,\n srcLang: true,\n srcSet: true,\n start: true,\n step: true,\n style: true,\n summary: true,\n tabIndex: true,\n target: true,\n title: true,\n translate: true,\n type: true,\n useMap: true,\n value: true,\n width: true,\n wmode: true,\n wrap: true,\n} as const;\n/**\n * SVG presentation attributes controlling visual rendering.\n * These map closely to CSS-like presentation properties\n * applied directly to SVG elements.\n */\nconst SVG_PRESENTATION_PROPS = {\n alignmentBaseline: true,\n baselineShift: true,\n clip: true,\n clipPath: true,\n clipRule: true,\n color: true,\n colorInterpolation: true,\n colorInterpolationFilters: true,\n colorProfile: true,\n colorRendering: true,\n cursor: true,\n direction: true,\n display: true,\n dominantBaseline: true,\n enableBackground: true,\n fill: true,\n fillOpacity: true,\n fillRule: true,\n filter: true,\n floodColor: true,\n floodOpacity: true,\n imageRendering: true,\n lightingColor: true,\n markerEnd: true,\n markerMid: true,\n markerStart: true,\n mask: true,\n opacity: true,\n overflow: true,\n paintOrder: true,\n pointerEvents: true,\n shapeRendering: true,\n stopColor: true,\n stopOpacity: true,\n stroke: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeLinecap: true,\n strokeLinejoin: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n textAnchor: true,\n textDecoration: true,\n textRendering: true,\n unicodeBidi: true,\n vectorEffect: true,\n visibility: true,\n wordSpacing: true,\n writingMode: true,\n} as const;\n/**\n * SVG geometry attributes defining shapes and layout.\n * These determine coordinates, radii, paths, and element\n * positioning within the SVG viewport.\n */\nconst SVG_GEOMETRY_PROPS = {\n cx: true,\n cy: true,\n d: true,\n dx: true,\n dy: true,\n fr: true,\n fx: true,\n fy: true,\n height: true,\n points: true,\n r: true,\n rx: true,\n ry: true,\n transform: true,\n version: true,\n viewBox: true,\n width: true,\n x: true,\n x1: true,\n x2: true,\n y: true,\n y1: true,\n y2: true,\n z: true,\n} as const;\n/**\n * SVG animation and filter attributes.\n * Used for SMIL animations and SVG filter primitives.\n */\nconst SVG_ANIMATION_FILTER_PROPS = {\n accumulate: true,\n additive: true,\n allowReorder: true,\n amplitude: true,\n attributeName: true,\n attributeType: true,\n autoReverse: true,\n begin: true,\n bias: true,\n by: true,\n calcMode: true,\n decelerate: true,\n diffuseConstant: true,\n divisor: true,\n dur: true,\n edgeMode: true,\n elevation: true,\n end: true,\n exponent: true,\n externalResourcesRequired: true,\n filterRes: true,\n filterUnits: true,\n from: true,\n in: true,\n in2: true,\n intercept: true,\n k: true,\n k1: true,\n k2: true,\n k3: true,\n k4: true,\n kernelMatrix: true,\n kernelUnitLength: true,\n keyPoints: true,\n keySplines: true,\n keyTimes: true,\n limitingConeAngle: true,\n mode: true,\n numOctaves: true,\n operator: true,\n order: true,\n orient: true,\n orientation: true,\n origin: true,\n pathLength: true,\n primitiveUnits: true,\n repeatCount: true,\n repeatDur: true,\n restart: true,\n result: true,\n rotate: true,\n scale: true,\n seed: true,\n slope: true,\n spacing: true,\n specularConstant: true,\n specularExponent: true,\n speed: true,\n spreadMethod: true,\n startOffset: true,\n stdDeviation: true,\n stitchTiles: true,\n surfaceScale: true,\n targetX: true,\n targetY: true,\n to: true,\n values: true,\n xChannelSelector: true,\n yChannelSelector: true,\n zoomAndPan: true,\n} as const;\n/**\n * SVG typography and text layout attributes.\n * Defines font behavior, glyph metrics, and text rendering.\n */\nconst SVG_TEXT_PROPS = {\n accentHeight: true,\n alphabetic: true,\n arabicForm: true,\n ascent: true,\n bbox: true,\n capHeight: true,\n descent: true,\n fontFamily: true,\n fontSize: true,\n fontSizeAdjust: true,\n fontStretch: true,\n fontStyle: true,\n fontVariant: true,\n fontWeight: true,\n format: true,\n g1: true,\n g2: true,\n glyphName: true,\n glyphOrientationHorizontal: true,\n glyphOrientationVertical: true,\n glyphRef: true,\n hanging: true,\n horizAdvX: true,\n horizOriginX: true,\n ideographic: true,\n kerning: true,\n lengthAdjust: true,\n letterSpacing: true,\n local: true,\n mathematical: true,\n overlinePosition: true,\n overlineThickness: true,\n panose1: true,\n refX: true,\n refY: true,\n renderingIntent: true,\n strikethroughPosition: true,\n strikethroughThickness: true,\n string: true,\n systemLanguage: true,\n tableValues: true,\n textLength: true,\n u1: true,\n u2: true,\n underlinePosition: true,\n underlineThickness: true,\n unicode: true,\n unicodeRange: true,\n unitsPerEm: true,\n vAlphabetic: true,\n vHanging: true,\n vIdeographic: true,\n vMathematical: true,\n values: true,\n vertAdvY: true,\n vertOriginX: true,\n vertOriginY: true,\n widths: true,\n xHeight: true,\n} as const;\n\n/**\n * SVG namespace and linking attributes.\n * Includes XML namespaces and XLink references used\n * in advanced SVG definitions.\n */\nconst SVG_NAMESPACE_PROPS = {\n clipPathUnits: true,\n contentScriptType: true,\n contentStyleType: true,\n gradientTransform: true,\n gradientUnits: true,\n markerHeight: true,\n markerUnits: true,\n markerWidth: true,\n maskContentUnits: true,\n maskUnits: true,\n offset: true,\n patternContentUnits: true,\n patternTransform: true,\n patternUnits: true,\n preserveAlpha: true,\n preserveAspectRatio: true,\n requiredExtensions: true,\n requiredFeatures: true,\n viewTarget: true,\n xlinkActuate: true,\n xlinkArcrole: true,\n xlinkHref: true,\n xlinkRole: true,\n xlinkShow: true,\n xlinkTitle: true,\n xlinkType: true,\n xmlBase: true,\n xmlns: true,\n xmlnsXlink: true,\n xmlLang: true,\n xmlSpace: true,\n} as const;\n/**\n * Compatibility attributes for non-React environments\n * (primarily Preact and legacy HTML attribute forms).\n */\nconst COMPAT_PROPS = {\n // For preact. We have this code here even though Emotion doesn't support\n // Preact, since @emotion/is-prop-valid is used by some libraries outside of\n // the context of Emotion.\n for: true,\n class: true,\n autofocus: true,\n} as const;\n\nexport const VALID_DOM_PROPS = {\n ...SPECIALIZED_PROPS,\n ...METADATA_PROPS,\n ...SVG_AND_A11Y_PROPS,\n ...MODERN_HTML_PROPS,\n ...REACT_CAMEL_CASE_PROPS,\n ...REACT_19_PROPS,\n ...BASE_REACT_PROPS,\n ...COMPAT_PROPS,\n ...SVG_NAMESPACE_PROPS,\n ...SVG_TEXT_PROPS,\n ...SVG_ANIMATION_FILTER_PROPS,\n ...SVG_GEOMETRY_PROPS,\n ...SVG_PRESENTATION_PROPS,\n ...STANDARD_HTML_PROPS,\n} satisfies TPropMap;\nexport const VALID_DOM_TESTING_KEYS = Object.keys(VALID_DOM_PROPS);\n","import { TTypeGuard, TAnyFunction } from '../../../types';\n\nexport const isNull: TTypeGuard<null> = <T>(term: T | null): term is null =>\n term === null;\n\nexport const isUndefined: TTypeGuard<undefined> = (value): value is undefined =>\n typeof value === 'undefined';\n\nexport const isDefined: TTypeGuard<unknown> = (\n value,\n): value is NonNullable<unknown> => value !== null && value !== undefined;\n\nexport const isNil: TTypeGuard<null | undefined> = (\n value,\n): value is null | undefined => value == null;\n\nexport const isFunction: TTypeGuard<TAnyFunction> = (\n value: unknown,\n): value is TAnyFunction => typeof value === 'function';\n\nexport const isObject: TTypeGuard<object> = <T extends object, U>(\n term: T | U,\n): term is NonNullable<T> =>\n !isNull(term) && !isArray(term) && typeof term === 'object';\n\nexport const isArray: TTypeGuard<unknown[]> = <T, U>(\n term: Array<T> | U,\n): term is Array<T> => Array.isArray(term);\n\nexport const isMap: TTypeGuard<Map<unknown, unknown>> = <K, V, U>(\n term: Map<K, V> | U,\n): term is Map<K, V> => term instanceof Map;\n\nexport const isSet: TTypeGuard<Set<unknown>> = <T, U>(\n term: Set<T> | U,\n): term is Set<T> => term instanceof Set;\n\n/**\n * Checks if the given value is an instance of `WeakMap`.\n *\n * A **WeakMap** is a special kind of `Map` where:\n * - **Keys must be objects** (not primitives)\n * - Keys are **held weakly**, meaning if there are no other references to the key object,\n * it can be garbage-collected automatically\n * - It does **not** support iteration (`.keys()`, `.values()`, `.entries()` are not available)\n * - It is ideal for **storing private metadata** about objects without preventing cleanup\n *\n * 🧠 Useful for:\n * - Caching computed data for objects\n * - Associating data with DOM elements without memory leaks\n *\n * πŸ“š **Learn more:**\n * - [MDN β€” WeakMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)\n *\n * @example\n * ```ts\n * const weakMap = new WeakMap<object, number>();\n * const obj = {};\n *\n * weakMap.set(obj, 42);\n *\n * ReferenceTypeGuards.isWeakMap(weakMap); // true\n * ReferenceTypeGuards.isWeakMap(new Map()); // false\n * ReferenceTypeGuards.isWeakMap({}); // false\n * ```\n */\nexport const isWeakMap: TTypeGuard<WeakMap<object, unknown>> = <\n K extends object,\n V,\n U,\n>(\n term: WeakMap<K, V> | U,\n): term is WeakMap<K, V> => term instanceof WeakMap;\n\n/**\n * Checks if the given value is an instance of `WeakSet`.\n *\n * A **WeakSet** is a special kind of `Set` where:\n * - It can only store **object values** (no primitives)\n * - Objects are **held weakly**, meaning if there are no other references to an object,\n * it can be garbage-collected automatically\n * - It is **not iterable** β€” you can’t get its contents or size\n * - Commonly used to track object presence without memory leaks\n *\n * 🧠 Useful for:\n * - Tracking which objects have been processed\n * - Marking objects as β€œseen” in caches or graph traversals\n *\n * πŸ“š **Learn more:**\n * - [MDN β€” WeakSet](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet)\n *\n * @example\n * ```ts\n * const weakSet = new WeakSet<object>();\n * const obj = {};\n *\n * weakSet.add(obj);\n *\n * ReferenceTypeGuards.isWeakSet(weakSet); // true\n * ReferenceTypeGuards.isWeakSet(new Set()); // false\n * ReferenceTypeGuards.isWeakSet([]); // false\n * ```\n */\nexport const isWeakSet: TTypeGuard<WeakSet<object>> = <T extends object, U>(\n term: WeakSet<T> | U,\n): term is WeakSet<T> => term instanceof WeakSet;\n\nexport function isInstanceOf<T extends object, Args extends unknown[]>(\n value: unknown,\n constructor: new (...args: Args) => T,\n): value is T {\n return value instanceof constructor;\n}\n","import type {\n TTypeGuard,\n TCamelCase,\n TJSONArrayString,\n TJSONObjectString,\n TJSONDataString,\n THexByteString,\n TSnakeCase,\n TKebabCase,\n} from '../../../types';\nimport { isNonEmptyString, isString } from './primitives';\nimport { REGEX_CONSTANTS } from '../../../constants';\nimport { isUndefined } from './reference';\n\n/**\n * Checks if the value is a camelCase string.\n *\n * By default, this checks that:\n * - The string starts with a lowercase letter\n * - Only contains alphanumeric characters\n * - No separators like `_`, `-`, or spaces\n *\n * You can think of this in terms of the `TCamelCase` type:\n * ```ts\n * type Example = TCamelCase<'my-variable'>; // 'myVariable'\n * ```\n *\n * Optionally, camelCase strings may preserve consecutive uppercase letters\n * using `TCamelCaseOptions['preserveConsecutiveUppercase']`. For example:\n * ```ts\n * type Example1 = TCamelCase<'FOO-BAR'>; // 'fooBAR' if preserveConsecutiveUppercase = true\n * type Example2 = TCamelCase<'FOO-BAR', { preserveConsecutiveUppercase: false }>; // 'fooBar'\n * ```\n *\n * @example\n * ```ts\n * TypeGuardUtils.isCamelCase('myVariable'); // true\n * TypeGuardUtils.isCamelCase('myVariable2'); // true\n * TypeGuardUtils.isCamelCase('MyVariable'); // false (starts with uppercase)\n * TypeGuardUtils.isCamelCase('my_variable'); // false (contains underscore)\n * TypeGuardUtils.isCamelCase('fooBAR'); // true if preserveConsecutiveUppercase is considered\n * ```\n */\nexport const isCamelCase: TTypeGuard<TCamelCase<string>> = (\n value,\n): value is TCamelCase<string> =>\n typeof value === 'string' && REGEX_CONSTANTS.camelCase.test(value);\n\nexport const isSnakeCase: TTypeGuard<TSnakeCase<string>> = (\n value,\n): value is TSnakeCase<string> =>\n typeof value === 'string' && REGEX_CONSTANTS.snakeCase.test(value);\n\nexport const isKebabCase: TTypeGuard<TKebabCase<string>> = (\n value,\n): value is TKebabCase<string> =>\n typeof value === 'string' && REGEX_CONSTANTS.kebabCase.test(value);\n\nexport const isJSONArrayString: TTypeGuard<TJSONArrayString> = (\n value: unknown,\n): value is TJSONArrayString => {\n if (!isNonEmptyString(value)) return false;\n try {\n return Array.isArray(JSON.parse(value));\n } catch {\n return false;\n }\n};\n\nexport const isJSONObjectString: TTypeGuard<TJSONObjectString> = (\n value: unknown,\n): value is TJSONObjectString => {\n if (!isNonEmptyString(value)) return false;\n try {\n const parsed = JSON.parse(value);\n return (\n typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)\n );\n } catch {\n return false;\n }\n};\nexport const isHTMLString: TTypeGuard<string> = (\n value: unknown,\n): value is string => {\n return isString(value) && REGEX_CONSTANTS.htmlDetection.test(value);\n};\n\n/**\n * Checks whether a string is a valid hexadecimal representation.\n *\n * A hexadecimal string consists of characters 0–9, a–f, or A–F,\n * and is often used for binary data encoding, color codes, cryptographic hashes, etc.\n *\n * Key points:\n * - The value must be a non-empty string.\n * - Only characters `[0-9a-fA-F]` are allowed.\n * - The length must be even, unless `expectedLength` is provided.\n * - If `expectedLength` is specified, the string must match that exact length.\n * - Returns a TypeScript type guard, so it narrows the type to `string` when used.\n *\n * Example usage:\n * ```ts\n * isHexString(\"0a1b2c\"); // true\n * isHexString(\"0a1b2z\"); // false (invalid character 'z')\n * isHexString(\"0a1b2c\", 6); // true\n * isHexString(\"0a1b2c\", 8); // false (length mismatch)\n * ```\n *\n * Use case:\n * - Validating inputs for cryptographic functions.\n * - Ensuring a string is a valid hex color code.\n * - Checking serialized binary data in hexadecimal format.\n *\n * @param value - The value to check.\n * @param expectedLength - Optional length the hex string must match exactly.\n * @returns `true` if `value` is a valid hexadecimal string; otherwise `false`.\n *\n * @typeParam T - N/A\n */\nexport const isHexByteString = (\n expectedLength?: number,\n): TTypeGuard<THexByteString> => {\n return (value: unknown): value is THexByteString => {\n if (!isNonEmptyString(value)) return false;\n if (value.length % 2 !== 0) return false;\n if (!REGEX_CONSTANTS.hexString.test(value)) return false;\n if (!isUndefined(expectedLength) && value.length !== expectedLength)\n return false;\n return true;\n };\n};\n\n/**\n * Checks whether a string contains valid JSON.\n *\n * This type guard ensures that:\n * - The value is a non-empty string.\n * - The string can be parsed successfully using `JSON.parse()`.\n *\n * Key points:\n * - Returns a TypeScript type guard, narrowing the type to `string`.\n * - Invalid JSON or non-string values return `false`.\n * - Useful for validating dynamic input or API responses.\n *\n * Example usage:\n * ```ts\n * isJsonString('{\"foo\": 1}'); // true\n * isJsonString('[\"a\", \"b\"]'); // true\n * isJsonString('not json'); // false\n * isJsonString(''); // false\n * ```\n *\n * Use case:\n * - Safely validate strings before parsing them as JSON.\n * - Guard input data in APIs, configuration files, or user inputs.\n *\n * @param value - The value to validate.\n * @returns `true` if `value` is a string containing valid JSON; otherwise `false`.\n */\nexport const isJsonString: TTypeGuard<TJSONDataString> = (\n value: unknown,\n): value is TJSONDataString =>\n isJSONArrayString(value) || isJSONObjectString(value);\n","import type { TTypeGuard, TAbsoluteURL, TInternalUrl } from '../../../types';\nimport { isNonEmptyString } from './primitives';\n\n/**\n * ## 🧩 isValidUrl β€” Type Guard for Absolute URLs\n *\n * Checks whether a given string is a valid absolute URL according to the\n * browser's `URL` constructor. Returns `true` if the string can be parsed\n * as a valid URL, otherwise `false`.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Ensures the string is non-empty and a valid URL.\n * - πŸ”Ή Provides a **TypeScript type guard** (`url is string`) for safe narrowing.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * isValidUrl('https://example.com'); // true\n * isValidUrl('ftp://example.com'); // true\n * isValidUrl('not a url'); // false\n * isValidUrl(''); // false\n * ```\n *\n * ---\n *\n * @param url - The value to validate as a URL.\n * @returns `true` if `url` is a non-empty valid absolute URL string.\n */\nexport const isAbsoluteUrl: TTypeGuard<TAbsoluteURL> = (\n url: unknown,\n): url is TAbsoluteURL => {\n if (!isNonEmptyString(url)) return false;\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n};\n/**\n * ## 🏠 isInternalUrl β€” Type Guard for Same-Origin or Relative Links\n *\n * Checks if a value is a valid internal URL. A URL is considered \"internal\" if it\n * is a relative path (starts with `/`) or an absolute URL that matches the\n * current window's origin (same domain).\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Distinguish between internal navigation and external outbound links.\n * - πŸ”Ή Validate relative paths for client-side routing.\n * - πŸ”Ή Ensure a URL belongs to the current application's hostname.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * // Assuming current origin is 'https://myapp.com'\n * isInternalUrl('/dashboard'); // true\n * isInternalUrl('https://myapp.com'); // true\n * isInternalUrl('https://google.com'); // false\n * isInternalUrl('mailto:test@test.com'); // false\n * ```\n *\n * ---\n *\n * ### ⚠️ Environment Note\n * - This guard requires a **browser environment** (`window.location`).\n * - In SSR or Node.js environments, it will consistently return `false`.\n *\n * ---\n *\n * @param url - The value to validate as an internal link.\n * @returns `true` if `url` is a non-empty string belonging to the current origin.\n */\nexport const isInternalUrl: TTypeGuard<TInternalUrl> = (\n url: unknown,\n): url is TInternalUrl => {\n if (\n typeof window === 'undefined' ||\n typeof location === 'undefined' ||\n !isNonEmptyString(url)\n ) {\n return false;\n }\n if (url.startsWith('/')) return true;\n try {\n const parsed = new URL(url, location.origin);\n return parsed.hostname === location.hostname;\n } catch {\n return false;\n }\n};\n","import type { TTypeGuard } from '../../../types';\nimport { isObject, isUndefined, isDefined } from './reference';\nimport { isBoolean, isNumber, isSymbol, isString } from './primitives';\nimport { ObjectUtils } from '../../common/object';\n\n/**\n * ## 🧩 isInArray β€” Type Guard Factory for Array Membership\n *\n * Creates a **type guard** that checks whether a value exists in a given array.\n * Internally, it uses a `Set` for **O(1) lookup**, making repeated checks more efficient.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Verify that a value is included in a predefined array of allowed values.\n * - πŸ”Ή Provide a **TypeScript type guard** so that the compiler can narrow types.\n * - πŸ”Ή Optimized for repeated checks by creating a `Set` once per factory call.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * // Store the returned type guard for repeated checks\n * const isAllowedColor = isInArray(['red', 'green', 'blue'] as const);\n * isAllowedColor('red'); // true\n * isAllowedColor('yellow'); // false\n *\n * const isAllowedNumber = isInArray([1, 2, 3] as const);\n * isAllowedNumber(2); // true\n * isAllowedNumber(4); // false\n *\n * // Or invoke inline without storing the guard\n * isInArray(['red', 'green', 'blue'] as const)('green'); // true\n * ```\n *\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - This is a **factory function**: you first pass the array, then use the returned function as a type guard.\n * - The returned guard checks for `undefined` and only returns `true` if the value exists in the array.\n * - Use this guard when you need **repeated membership checks** on a fixed array of values.\n *\n * @typeParam T - The type of elements in the target array.\n * @param target - The array of allowed values.\n * @returns A type guard function that narrows `unknown` to `T | undefined`.\n */\nexport const isInArray = <T>(\n target: readonly T[],\n): TTypeGuard<T | undefined> => {\n const set = new Set(target);\n return (value: unknown): value is T | undefined =>\n !isUndefined(value) && set.has(value as T);\n};\n\n/**\n * Checks whether a value is a valid key of a given object.\n *\n * This function returns a **TypeScript type guard**, allowing you to safely\n * access object properties with dynamic keys while retaining full type safety.\n *\n * Key points:\n * - Works with `string`, `number`, and `symbol` keys.\n * - Returns a type guard `(key: unknown) => key is keyof T`.\n * - Useful for runtime checks before accessing object properties dynamically.\n *\n * @typeParam T - The type of the target object.\n * @param obj - The object whose keys should be checked against.\n * @param key - The value to check if it is a valid key of `obj`.\n * @returns `true` if `key` exists in `obj`; otherwise `false`.\n *\n * @example\n * ```ts\n * const user = { id: 1, name: 'Alice', email: 'alice@example.com' };\n *\n * isKeyOfObject(user, 'name'); // true βœ… 'name' is a valid key\n * isKeyOfObject(user, 'password'); // false ❌ 'password' is not a valid key\n * ```\n */\nexport const isKeyOfObject =\n <T extends object>(obj: T): TTypeGuard<keyof T> =>\n (key: unknown): key is keyof T =>\n (isString(key) || isNumber(key) || isSymbol(key)) && key in obj;\n\n/**\n * Type guard that checks whether a given unknown value is an object\n * and contains a specific property key.\n *\n * Unlike `isKeyOfObject(obj)(key)` which only narrows the *key* type,\n * this guard narrows the *object* itself. After calling this function,\n * TypeScript knows that:\n *\n * - `obj` is a non-null object\n * - `obj` contains the property `key`\n * - you can safely access `obj[key]`\n *\n * This is the preferred guard to use when you need to safely access\n * dynamic or unknown object properties, such as when validating\n * external or untyped data (e.g., errors from Supabase or fetch APIs).\n *\n * @example\n * if (isKeyInObject(\"message\")(err)) {\n * console.log(err.message); // fully typed and safe\n * }\n *\n * @param key - The property key to check for.\n * @returns A type guard that checks if an unknown value is an object\n * containing the specified key.\n */\nexport const isKeyInObject =\n <K extends PropertyKey>(key: K) =>\n (obj: unknown): obj is Record<K, unknown> =>\n isObject(obj) && key in obj;\n\n/**\n * ## 🧩 isKeyOfArray β€” Type Guard for Allowed Primitive Keys\n *\n * Checks if a value is one of the keys in a given readonly array of allowed keys.\n * This is a **type-safe type guard** for primitive keys (`string | number | symbol`)\n * that exist in a known array. It is useful for narrowing a value to a specific set\n * of literal keys at runtime.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Only works with **primitive keys**: `string`, `number`, or `symbol`.\n * - πŸ”Ή Returns a **TypeScript type guard** (`key is T[number]`) for type inference.\n * - πŸ”Ή Uses `Array.includes` to check for membership in the allowed keys array.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * const allowedKeys = ['id', 'name', 'age'] as const;\n * const key: unknown = 'name';\n *\n * if (isKeyOfArray(allowedKeys)(key)) {\n * // βœ… TypeScript now knows `key` is 'id' | 'name' | 'age'\n * console.log(key); // 'name'\n * }\n *\n * const invalidKey: unknown = 'email';\n * isKeyOfArray(allowedKeys)(invalidKey); // false\n *\n * // Inline usage\n * isKeyOfArray(['x', 'y', 'z'] as const)('x'); // true\n * isKeyOfArray(['x', 'y', 'z'] as const)('a'); // false\n * ```\n *\n * ---\n *\n * @typeParam T - A readonly tuple or array of allowed keys.\n * @param keys - The array of valid keys.\n * @returns A type guard function that returns `true` if the value is included in `keys`.\n */\nexport const isKeyOfArray =\n <T extends readonly (string | number | symbol)[]>(\n keys: T,\n ): TTypeGuard<T[number]> =>\n (key: unknown): key is T[number] =>\n (isString(key) || isNumber(key) || isSymbol(key) || isBoolean(key)) &&\n keys.includes(key as T[number]);\n\n/**\n * ## 🧩 isArrayOf β€” Type Guard for Arrays of Specific Types\n *\n * Checks if a value is an array where **all elements satisfy a given type guard**.\n * This allows TypeScript to narrow types safely and perform runtime validation.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Verify that a value is an array.\n * - πŸ”Ή Ensure that **every element** matches a specific type guard.\n * - πŸ”Ή Enable **type-safe operations** on arrays after the check.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * import { isArrayOf, isNumber, isString } from '@/utils/guards/composite';\n *\n * const arr1: unknown = [1, 2, 3];\n * if (isArrayOf(isNumber, arr1)) {\n * // βœ… arr1 is now typed as number[]\n * const sum = arr1.reduce((a, b) => a + b, 0);\n * }\n *\n * const arr2: unknown = ['a', 'b', 3];\n * isArrayOf(isString, arr2); // false\n * ```\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - The **type guard is passed as a parameter**, making this function highly composable.\n * - Use for arrays of primitives or arrays of objects validated by another type guard.\n *\n * @typeParam T - Type of array elements.\n * @param typeGuard - Type guard function for the array elements.\n * @param value - Value to validate.\n * @returns `true` if `value` is an array and all elements pass the type guard.\n */\nexport const isArrayOf = <T>(\n typeGuard: TTypeGuard<T>,\n value: unknown,\n): value is T[] => Array.isArray(value) && value.every(typeGuard);\n\n/**\n * ## 🧩 isRecordOf β€” Type Guard for Objects with Uniform Value Types\n *\n * Checks if a value is an object where **all property values satisfy a given type guard**.\n * Useful for ensuring that a record has uniform value types and for type-safe access.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Verify that a value is an object (non-null).\n * - πŸ”Ή Ensure that every property value passes a provided type guard.\n * - πŸ”Ή Enable **type-safe operations** on objects with consistent value types.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * import { isRecordOf, isNumber, isBoolean } from '@/utils/guards/composite';\n *\n * const obj1: unknown = { a: 1, b: 2 };\n * if (isRecordOf(obj1, isNumber)) {\n * // βœ… obj1 is now typed as Record<string, number>\n * const sum = Object.values(obj1).reduce((a, b) => a + b, 0);\n * }\n *\n * const obj2: unknown = { a: 1, b: '2' };\n * isRecordOf(obj2, isNumber); // false\n *\n * const obj3: unknown = { foo: true, bar: false };\n * isRecordOf(obj3, isBoolean); // true\n * ```\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - Works only with **plain objects** (non-null) and string keys.\n * - Supports composability by accepting any type guard for property values.\n *\n * @typeParam V - Type of the values in the record.\n * @param value - Value to check.\n * @param typeGuard - Type guard function applied to each property value.\n * @returns `true` if `value` is an object and all property values pass the type guard.\n */\nexport const isRecordOf = <V>(\n value: unknown,\n typeGuard: TTypeGuard<V>,\n): value is Record<string, V> =>\n isObject(value) && ObjectUtils.values(value).every(typeGuard);\n/**\n * ## πŸ”‘ hasDefinedKeys β€” Type Guard Factory for Required Object Properties\n *\n * Creates a type guard that ensures an object contains a specific set of **required keys**\n * and that their values are **defined** (not `undefined`).\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Validate that an object implements a specific interface or shape.\n * - πŸ”Ή Ensure critical properties exist and are not `undefined`.\n * - πŸ”Ή Narrow an `unknown` object to a specific type `T` for safe property access.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * import { hasDefinedKeys } from '@/utils/guards/composite';\n *\n * interface User { id: string; name: string; age?: number; }\n *\n * // Create a guard for required fields\n * const isUser = hasDefinedKeys<User>(['id', 'name']);\n *\n * const data: unknown = { id: 'u1', name: 'Alice' };\n *\n * if (isUser(data)) {\n * // βœ… data is now typed as User\n * console.log(data.id, data.name);\n * }\n *\n * const invalid: unknown = { id: 'u2' };\n * isUser(invalid); // false (missing 'name')\n * ```\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - This is a **factory function**; it returns a new type guard function.\n * - It checks for the existence of the key *and* that the value is not `undefined`.\n * - Ideal for validating API responses or configuration objects.\n *\n * @typeParam T - The target object type to validate against.\n * @param requiredKeys - An array of keys from type `T` that must be present and defined.\n * @returns A type guard function that returns `true` if all `requiredKeys` are found and defined.\n */\nexport const hasDefinedKeys = <T extends object>(\n requiredKeys: (keyof T)[],\n): ((value: unknown) => value is T) => {\n return (value: unknown): value is T => {\n if (!value || !isObject(value)) return false;\n return requiredKeys.every(\n (key) => isKeyInObject(key)(value) && isDefined(value[key]),\n );\n };\n};\n","import type { TTypeGuard, TBufferLikeObject, TRGB } from '../../../types';\nimport { isNumber, isNonEmptyString, isString } from './primitives';\nimport { REGEX_CONSTANTS } from '../../../constants';\nimport { isObject, isArray } from './reference';\nimport { isArrayOf } from './composite';\n\n/**\n * Checks if a value is a **Buffer-like object**.\n *\n * A Buffer-like object is an object with the following shape:\n * ```ts\n * {\n * type: 'Buffer';\n * data: number[];\n * }\n * ```\n *\n * This guard validates:\n * - βœ… The value is a non-null object\n * - βœ… The `type` property exists and is exactly `'Buffer'`\n * - βœ… The `data` property exists and is an array of numbers\n *\n * ---\n * ### Key Points\n * - Uses `isObject` to ensure the value is an object\n * - Uses `isArrayOf(isNumber)` to check that `data` contains only numbers\n * - This is a **composite type guard** because it combines multiple primitive/reference checks\n *\n * ---\n * ### Example Usage\n * ```ts\n * const buf = { type: 'Buffer', data: [1, 2, 3] };\n * const notBuf = { type: 'Buffer', data: ['a', 'b'] };\n *\n * isBufferLikeObject(buf); // true\n * isBufferLikeObject(notBuf); // false\n * ```\n *\n * ---\n * @param value - The value to check\n * @returns `true` if the value is a Buffer-like object, otherwise `false`\n */\nexport const isBufferLikeObject: TTypeGuard<TBufferLikeObject> = (\n value: unknown,\n): value is TBufferLikeObject => {\n if (!isObject(value)) return false;\n\n const hasTypeBuffer = 'type' in value && value.type === 'Buffer';\n const hasNumberArrayData =\n 'data' in value && isArrayOf(isNumber, (value as { data: unknown }).data);\n\n return hasTypeBuffer && hasNumberArrayData;\n};\n/**\n * ## 🎨 isRGBTuple β€” Type Guard for Color Values\n *\n * Validates if a value is an array of exactly three numbers, each representing\n * a standard 8-bit color channel (0-255).\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Verify the value is an array with a `length` of 3.\n * - πŸ”Ή Ensure every element is a number within the range [0, 255].\n * - πŸ”Ή Provide a **TypeScript type guard** (`TRGB`) for safe tuple access.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * isRGBTuple([255, 0, 0]); // true (Red)\n * isRGBTuple([0, 256, 0]); // false (Out of range)\n * isRGBTuple([128, 128]); // false (Wrong length)\n * ```\n */\nexport const isRGBTuple: TTypeGuard<TRGB> = (input: unknown): input is TRGB => {\n return (\n isArray(input) &&\n input.length === 3 &&\n input.every((n) => isNumber(n) && n >= 0 && n <= 255)\n );\n};\n/**\n * ## πŸ“ž isPhoneNumber β€” Type Guard for International Formats\n *\n * Validates whether a string matches common phone number patterns, including\n * US, EU, and generic international formats.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Test strings against a set of optimized regular expressions.\n * - πŸ”Ή Support multiple geographical formats (US/EU/Global).\n * - πŸ”Ή Ensure the value is a non-empty string before testing.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * isPhoneNumber('+1-202-555-0101'); // true\n * isPhoneNumber('06 12 34 56 78'); // true\n * isPhoneNumber('123-abc'); // false\n * ```\n */\nexport const isPhoneNumber: TTypeGuard<string> = (\n value: unknown,\n): value is string => {\n if (!isNonEmptyString(value)) return false;\n\n return [\n REGEX_CONSTANTS.USPhoneNumber,\n REGEX_CONSTANTS.EUPhoneNumber,\n REGEX_CONSTANTS.genericPhoneNumber,\n ].some((regex) => regex.test(value));\n};\n\n/**\n * ## πŸ“§ isEmail β€” Type Guard for Email Addresses\n *\n * Validates if a string conforms to a standard email address format using\n * a robust regular expression.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Verify the string contains a valid local part, '@' symbol, and domain.\n * - πŸ”Ή Perform a high-speed check suitable for form validation or data cleaning.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * isEmail('hello@world.com'); // true\n * isEmail('invalid-email@'); // false\n * isEmail(12345); // false\n * ```\n */\nexport const isEmail: TTypeGuard<string> = (\n value: unknown,\n): value is string => {\n return isString(value) && REGEX_CONSTANTS.emailRegex.test(value);\n};\n","import {\n isJsonString,\n isHexByteString,\n isHTMLString,\n isJSONObjectString,\n isJSONArrayString,\n isKebabCase,\n isSnakeCase,\n isCamelCase,\n} from './string-guards';\nimport { isAbsoluteUrl, isInternalUrl } from './link-guards';\nimport {\n isNumber,\n isInteger,\n isString,\n isNonEmptyString,\n isBoolean,\n isBigInt,\n isSymbol,\n isPrimitive,\n} from './primitives';\nimport {\n isEmail,\n isPhoneNumber,\n isRGBTuple,\n isBufferLikeObject,\n} from './refined';\nimport {\n isNull,\n isFunction,\n isObject,\n isArray,\n isMap,\n isSet,\n isWeakMap,\n isWeakSet,\n isNil,\n isUndefined,\n isDefined,\n isInstanceOf,\n} from './reference';\nimport {\n hasDefinedKeys,\n isRecordOf,\n isArrayOf,\n isKeyOfArray,\n isKeyOfObject,\n isInArray,\n isKeyInObject,\n} from './composite';\n\nexport const CoreTypeGuards = {\n // Primitives\n isString,\n isNumber,\n isBoolean,\n isBigInt,\n isNil,\n isDefined,\n isInteger,\n isNonEmptyString,\n isSymbol,\n isPrimitive,\n isNull,\n isFunction,\n isObject,\n isArray,\n isMap,\n isSet,\n isWeakMap,\n isWeakSet,\n isUndefined,\n isInstanceOf,\n} as const;\nexport const FormatTypeGuards = {\n isEmail,\n isPhone: isPhoneNumber,\n isUrlAbsolute: isAbsoluteUrl,\n isUrlInternal: isInternalUrl,\n isJsonString,\n isHTMLString,\n isCamelCase,\n isSnakeCase,\n isKebabCase,\n isHexByteString,\n isJSONObjectString,\n isJSONArrayString,\n isRGBTuple,\n isBufferLikeObject,\n} as const;\n\nexport const CollectionTypeGuards = {\n isArrayOf,\n isRecordOf,\n isKeyOfObject,\n isKeyInObject,\n isKeyOfArray,\n isInArray,\n hasKeys: hasDefinedKeys,\n} as const;\n\nexport * from './reference';\nexport * from './primitives';\nexport * from './composite';\nexport * from './refined';\nexport * from './link-guards';\nexport * from './string-guards';\n","/**\n * Simple memoization utility for functions with a single string argument.\n *\n * This creates a cache (using Object.create(null) for a \"pure\" object) to store\n * the results of function calls. If the function is called again with the same\n * string, the cached result is returned instantly instead of re-calculating.\n *\n * USE CASE:\n * Highly effective for expensive operations that run frequently during render\n * cycles, such as Regex-based prop validation (isPropValid) or theme lookups.\n *\n * @param fn - The function to be memoized.\n * @returns A wrapped version of the function that caches its results.\n *\n * @example\n * const expensiveCheck = memoize((str: string) => someRegex.test(str));\n * expensiveCheck('className'); // Calculated and cached\n * expensiveCheck('className'); // Returned from cache (O(1) lookup)\n */\nexport const memoize = <T>(fn: (arg: string) => T) => {\n const cache: Record<string, T> = Object.create(null);\n\n return (arg: string): T => {\n if (arg in cache) {\n return cache[arg]; // Return the \"remembered\" result\n }\n const result = fn(arg); // Run the actual logic\n cache[arg] = result; // Save it for next time\n return result;\n };\n};\n","// lib/guards/dom.ts\nimport { VALID_DOM_PROPS } from '../../../constants';\nimport { ObjectUtils } from '../../common';\nimport type { TTypeGuard } from '../../../types';\nimport type { ElementType, ComponentPropsWithoutRef } from 'react';\nimport { isString } from '../core/primitives';\nimport { memoize } from '../../common/memoize';\n\n// 1. Build the regex string once at module load\n// Note: If VALID_DOM_PROPS is a Set, use [...VALID_DOM_PROPS].join('|')\nconst allDomKeys = ObjectUtils.keys(VALID_DOM_PROPS).join('|');\n\nconst reactPropsRegex = new RegExp(\n `^((${allDomKeys})|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$`,\n);\n/**\n * Validates if a property is a standard DOM/SVG attribute or event handler.\n * Memoized to ensure O(1) lookups after the first check.\n */\nexport const isPropValid = memoize((prop: string): boolean => {\n return (\n reactPropsRegex.test(prop) ||\n (prop.charCodeAt(0) === 111 /* o */ &&\n prop.charCodeAt(1) === 110 /* n */ &&\n prop.charCodeAt(2) < 91) /* Z+1 */\n );\n});\n/**\n * Type guard to check if a value is a valid DOM property string.\n */\nexport const isDOMPropKey: TTypeGuard<string> = (\n value: unknown,\n): value is string => isString(value) && isPropValid(value);\n/**\n * Checks if a key-value entry represents a valid DOM property for a specific element.\n */\nexport const isDOMEntry = <TElement extends ElementType>(\n entry: [PropertyKey, unknown],\n): entry is [\n Extract<keyof ComponentPropsWithoutRef<TElement>, string>,\n unknown,\n] => isString(entry[0]) && isDOMPropKey(entry[0]);\n","// lib/react/guards/primitive.ts\nimport type { TTypeGuard } from '../../../types';\nimport type {\n Ref,\n RefObject,\n ReactNode,\n ComponentType,\n ReactPortal,\n ForwardRefExoticComponent,\n} from 'react';\nimport { isKeyInObject } from '../core/composite';\nimport { isDefined, isFunction, isObject, isNull } from '../core/reference';\n/**\n * Internal helper to check if a value is a React-internal object\n * by validating its hidden `$$typeof` symbol.\n */\nconst hasReactSymbol = (value: unknown, symbol: symbol): boolean =>\n isKeyInObject('$$typeof')(value) && value.$$typeof === symbol;\n\n/**\n * ## 🧩 isRef β€” Type Guard for React Refs\n *\n * Validates if a value is a valid React Ref, covering both **Functional (Callback) Refs**\n * and **Object Refs** (created via `useRef` or `createRef`).\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * isRef((el) => { console.log(el) }); // true (Callback Ref)\n * isRef({ current: document.createElement('div') }); // true (Object Ref)\n * ```\n *\n * @template T - The type of the element or value being referenced.\n */\nexport const isRef = <T>(value: unknown): value is Ref<T> =>\n isDefined(value) &&\n (isFunction(value) || (isObject(value) && 'current' in value));\n\n/**\n * ## 🧩 isRefObject β€” Type Guard for Persistent Ref Objects\n *\n * Specifically checks if a value is a `RefObject` (an object containing a `.current` property).\n * This effectively narrows the type away from Callback Refs.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * const myRef = useRef(null);\n * if (isRefObject(myRef)) {\n * // βœ… Safely access myRef.current\n * }\n * ```\n */\nexport const isRefObject = <T>(ref: Ref<T>): ref is RefObject<T | null> =>\n !isNull(ref) && isObject(ref) && 'current' in ref;\n\n/**\n * ## 🧩 isPromise β€” Type Guard for Async Thenables\n *\n * Checks if a value is a `Promise` or a \"Thenable\" object by validating\n * the existence of a `.then()` method.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * if (isPromise(data)) {\n * data.then((res) => console.log(res));\n * }\n * ```\n */\nexport const isPromise = <T>(value: unknown): value is Promise<T> =>\n !!value && isKeyInObject('then')(value) && isFunction(value.then);\n\n/**\n * ## 🧩 isReactPortal β€” Type Guard for Portals\n *\n * Checks if a value is a `ReactPortal` created via `ReactDOM.createPortal`.\n * Validates the existence of the internal `containerInfo` property.\n */\nexport const isReactPortal: TTypeGuard<ReactPortal> = (\n value: unknown,\n): value is ReactPortal =>\n isObject(value) && isKeyInObject('containerInfo')(value);\n\n/**\n * ## 🧩 hasChildren β€” Type Guard for Prop Objects with Children\n *\n * Validates if an object contains a defined `children` property.\n * Useful for verifying props in HOCs or wrapper components.\n */\nexport const hasChildren = (value: unknown): value is { children: ReactNode } =>\n isObject(value) &&\n isKeyInObject('children')(value) &&\n isDefined(value.children);\n\n/**\n * ## 🧩 isComponentType β€” Type Guard for React Components\n *\n * Determines if a value is a valid React Component (Function Component or Class Component).\n * For classes, it validates the existence of a `render` method on the prototype.\n */\nexport const isComponentType: TTypeGuard<ComponentType<unknown>> = (\n value: unknown,\n): value is ComponentType<unknown> =>\n isFunction(value) ||\n (isKeyInObject('prototype')(value) &&\n isObject(value.prototype) &&\n isKeyInObject('render')(value.prototype) &&\n isFunction(value.prototype.render));\n/**\n * ## 🧩 isForwardRef β€” Type Guard for ForwardRef Components\n *\n * Validates if a component is wrapped in `React.forwardRef` by checking\n * the internal `$$typeof` symbol.\n */\nexport const isForwardRef: TTypeGuard<ForwardRefExoticComponent<object>> = (\n value: unknown,\n): value is ForwardRefExoticComponent<object> =>\n hasReactSymbol(value, Symbol.for('react.forward_ref'));\n","// lib/react/guards/node.ts\nimport type {\n TTypeGuard,\n TNamedComponent,\n TElementLike,\n THTMLTags,\n} from '../../../types';\nimport type { ReactElement, ReactNode, MouseEvent } from 'react';\nimport { isPrimitive, isString } from '../core/primitives';\nimport { isArrayOf, isKeyInObject } from '../core/composite';\nimport { isNil, isFunction, isObject } from '../core/reference';\nimport { isReactPortal } from './react-primitive';\nimport { isValidElement, Fragment } from 'react';\n\n/**\n * ## 🌳 isValidReactNode β€” Type Guard for all Renderable Content\n *\n * Validates if a value is a valid `ReactNode` (anything React can render).\n * This includes primitives, JSX elements, Portals, and recursive arrays of nodes.\n */\nexport const isValidReactNode: TTypeGuard<ReactNode> = (\n value: unknown,\n): value is ReactNode =>\n isNil(value) ||\n isPrimitive(value) ||\n isValidElement(value) ||\n isReactPortal(value) || // Added portal support\n isArrayOf(isValidReactNode, value);\n\n/**\n * ## 🌳 isReactElement β€” Type Guard for JSX Elements\n *\n * Validates if a value is a `ReactElement` (JSX).\n * Uses React's internal security checks to ensure the object is a legitimate element.\n */\nexport const isReactElement: TTypeGuard<ReactElement> = (\n value: unknown,\n): value is ReactElement => isValidElement(value);\n\n/**\n * ## 🌳 isFragment β€” Type Guard for React Fragments\n *\n * Narrow check to determine if a React Element is specifically a `<React.Fragment>`.\n */\nexport const isFragment: TTypeGuard<ReactElement> = (\n value: unknown,\n): value is ReactElement => isValidElement(value) && value.type === Fragment;\n/**\n * ## 🌳 hasOnClick β€” Type Guard for Interactive Elements\n *\n * Checks if a React Element has a valid `onClick` function in its props.\n * Useful for safely injecting behavior during `React.cloneElement`.\n *\n * ---\n * ### πŸ“˜ Example Usage\n * ```ts\n * if (hasOnClick(child)) {\n * return React.cloneElement(child, {\n * onClick: (e) => { console.log('Clicked!'); child.props.onClick(e); }\n * });\n * }\n * ```\n */\nexport const hasOnClick: TTypeGuard<\n ReactElement<{ onClick?: (e: MouseEvent<HTMLElement>) => void }>\n> = (\n value: unknown,\n): value is ReactElement<{\n onClick?: (e: MouseEvent<HTMLElement>) => void;\n}> => {\n return (\n isReactElement(value) &&\n !isNil(value.props) &&\n isKeyInObject('onClick')(value.props) &&\n isFunction(value.props.onClick)\n );\n};\n/**\n * ## 🌳 isElementLike β€” Type Guard for Duck-Typed Elements\n *\n * Checks if an object \"looks like\" a React element (has type and props).\n * Useful for processing JSON-serialized components or objects from other environments.\n */\nexport const isElementLike: TTypeGuard<TElementLike> = (\n element: unknown,\n): element is TElementLike =>\n isObject(element) &&\n isKeyInObject('type')(element) &&\n isKeyInObject('props')(element) &&\n isObject(element.props) &&\n (isString(element.type) || isFunction(element.type));\n\n/**\n * ## 🌳 isElementOfType β€” Type Guard for Specific HTML Tags\n *\n * Validates if an element-like object matches a specific set of allowed HTML tags.\n *\n * @param allowedTypes - An array or string of tags to validate against (e.g., 'div' or ['a', 'button']).\n */\nexport const isElementOfType = <T extends THTMLTags>(\n element: unknown,\n allowedTypes: THTMLTags,\n): element is { type: THTMLTags; props: object } =>\n isElementLike(element) && allowedTypes.includes(element.type as T);\n\n/**\n * ## 🌳 hasNameMetadata β€” Type Guard for Named Components\n *\n * Checks if a React component type has identifying metadata like `displayName` or `name`.\n * Essential for debugging utilities or logging component names.\n */\nexport const hasNameMetadata = (type: unknown): type is TNamedComponent =>\n isFunction(type) &&\n (isObject(type) || isFunction(type)) &&\n (isKeyInObject('displayName')(type) ||\n isKeyInObject('name')(type) ||\n isKeyInObject('type')(type));\n","import { isDOMPropKey, isDOMEntry, isPropValid } from './dom-guards';\nimport {\n isValidReactNode,\n isReactElement,\n isFragment,\n hasOnClick,\n isElementLike,\n isElementOfType,\n hasNameMetadata,\n} from './node-guards';\nimport {\n isRef,\n isRefObject,\n isPromise,\n isReactPortal,\n hasChildren,\n isComponentType,\n isForwardRef,\n} from './react-primitive';\n\nconst ReactTypeGuards = {\n isRef,\n isRefObject,\n isPromise,\n isReactPortal,\n hasChildren,\n isComponentType,\n isForwardRef,\n isValidReactNode,\n isReactElement,\n isFragment,\n hasOnClick,\n isElementLike,\n isElementOfType,\n hasNameMetadata,\n isDOMPropKey,\n isDOMEntry,\n isPropValid,\n} as const;\n\nexport {\n isRef,\n isRefObject,\n isPromise,\n isReactPortal,\n hasChildren,\n isComponentType,\n isForwardRef,\n isValidReactNode,\n isReactElement,\n isFragment,\n hasOnClick,\n isElementLike,\n isElementOfType,\n hasNameMetadata,\n isDOMPropKey,\n isDOMEntry,\n isPropValid,\n ReactTypeGuards,\n};\n","import {\n CoreTypeGuards,\n isRGBTuple,\n isCamelCase,\n isBufferLikeObject,\n isJSONArrayString,\n isJSONObjectString,\n isJsonString,\n isAbsoluteUrl,\n isInternalUrl,\n} from '../guards';\nimport type {\n TAssert,\n TTypeGuard,\n TRGB,\n TInternalUrl,\n TAbsoluteURL,\n TAnyFunction,\n TJSONObjectString,\n TJSONArrayString,\n TJSONDataString,\n TBufferLikeObject,\n} from '../../types';\n/**\n * Asserts that a given value passes a type guard check.\n *\n * Throws an error if the value does not satisfy the provided type guard.\n * This is useful for runtime type validation while preserving TypeScript type narrowing.\n *\n * @template T - The expected type the value should satisfy.\n * @param value - The value to validate.\n * @param typeGuard - A type guard function that returns `true` if the value is of type `T`.\n * @param message - Optional custom error message to throw if validation fails.\n *\n * @throws {Error} If the value does not satisfy the type guard.\n *\n * @example\n * ```ts\n * const isString = (v: unknown): v is string => typeof v === 'string';\n * const myValue: unknown = \"hello\";\n * assertValue(myValue, isString); // narrows type of myValue to string\n * ```\n */\nconst assertValue = <T>(\n value: unknown,\n typeGuard: TTypeGuard<T>,\n message?: string,\n): asserts value is T => {\n if (!typeGuard(value)) {\n throw new Error(message ?? 'Validation failed for value');\n }\n};\n/**\n * Creates a reusable assertion function for a specific type guard.\n *\n * This higher-order utility generates a function that asserts values of the guarded type,\n * optionally attaching a key for error context.\n *\n * @template T - The type the guard asserts.\n * @param guard - A type guard function for type `T`.\n * @param _key - Optional key or label used for context (currently unused, can be used in error messages).\n * @returns A function `(value, message?) => void` that asserts the value is of type `T`.\n *\n * @example\n * ```ts\n * const isNumber = (v: unknown): v is number => typeof v === 'number';\n * const assertNumber = makeAssert(isNumber, 'myNumber');\n *\n * const value: unknown = 42;\n * assertNumber(value); // Narrows value type to number\n * ```\n */\nconst makeAssert = <T>(guard: TTypeGuard<T>, _key: string): TAssert<T> => {\n return (value: unknown, message?: string) =>\n assertValue(value, guard, message);\n};\n\n// -------------------- Generate assertion functions --------------------\n\n// Primitive asserts\n/* prettier-ignore */ export const assertIsNumber: TAssert<number> = makeAssert(CoreTypeGuards.isNumber, 'isNumber');\n/* prettier-ignore */ export const assertIsInteger: TAssert<number> = makeAssert(CoreTypeGuards.isInteger, 'isInteger');\n/* prettier-ignore */ export const assertIsString: TAssert<string> = makeAssert(CoreTypeGuards.isString, 'isString');\n/* prettier-ignore */ export const assertIsNonEmptyString: TAssert<string> = makeAssert(CoreTypeGuards.isNonEmptyString, 'isNonEmptyString');\n/* prettier-ignore */ export const assertIsBoolean: TAssert<boolean> = makeAssert(CoreTypeGuards.isBoolean, 'isBoolean');\n/* prettier-ignore */ export const assertIsBigInt: TAssert<bigint> = makeAssert(CoreTypeGuards.isBigInt, 'isBigInt');\n/* prettier-ignore */ export const assertIsSymbol: TAssert<symbol> = makeAssert(CoreTypeGuards.isSymbol, 'isSymbol');\n\n// Reference asserts\n/* prettier-ignore */ export const assertIsNull: TAssert<null> = makeAssert(CoreTypeGuards.isNull, 'isNull');\n/* prettier-ignore */ export const assertIsUndefined: TAssert<undefined> = makeAssert(CoreTypeGuards.isUndefined, 'isUndefined');\n/* prettier-ignore */ export const assertIsDefined: TAssert<NonNullable<unknown>> = makeAssert(CoreTypeGuards.isDefined, 'isDefined');\n/* prettier-ignore */ export const assertIsNil: TAssert<null | undefined> = makeAssert(CoreTypeGuards.isNil, 'isNil');\n/* prettier-ignore */ export const assertIsFunction: TAssert<TAnyFunction> = makeAssert(CoreTypeGuards.isFunction, 'isFunction');\n/* prettier-ignore */ export const assertObject: TAssert<object> = makeAssert(CoreTypeGuards.isObject, 'isObject');\n/* prettier-ignore */ export const assertIsArray: TAssert<unknown[]> = makeAssert(CoreTypeGuards.isArray, 'isArray');\n/* prettier-ignore */ export const assertIsMap: TAssert<Map<unknown, unknown>> = makeAssert(CoreTypeGuards.isMap, 'isMap');\n/* prettier-ignore */ export const assertIsSet: TAssert<Set<unknown>> = makeAssert(CoreTypeGuards.isSet, 'isSet');\n/* prettier-ignore */ export const assertIsWeakMap: TAssert<WeakMap<object, unknown>> = makeAssert(CoreTypeGuards.isWeakMap, 'isWeakMap');\n/* prettier-ignore */ export const assertIsWeakSet: TAssert<WeakSet<object>> = makeAssert(CoreTypeGuards.isWeakSet, 'isWeakSet');\n\n// Refined / Composite asserts\n/* prettier-ignore */ export const assertIsCamelCase: TAssert<string> = makeAssert(isCamelCase, 'isCamelCase');\n/* prettier-ignore */ export const assertIsBufferLikeObject: TAssert<TBufferLikeObject> = makeAssert(isBufferLikeObject, 'isBufferLikeObject');\n/* prettier-ignore */ export const assertIsJSONArrayString: TAssert<TJSONArrayString> = makeAssert(isJSONArrayString, 'isJSONArrayString');\n/* prettier-ignore */ export const assertIsJSONObjectString: TAssert<TJSONObjectString> = makeAssert(isJSONObjectString, 'isJSONObjectString');\n/* prettier-ignore */ export const assertIsJsonString: TAssert<TJSONDataString> = makeAssert(isJsonString, 'isJsonString');\n/* prettier-ignore */ export const assertIsAbsoluteUrl: TAssert<TAbsoluteURL> = makeAssert(isAbsoluteUrl, 'isAbsoluteUrl');\n/* prettier-ignore */ export const assertIsInternalUrl: TAssert<TInternalUrl> = makeAssert(isInternalUrl, 'isInternalUrl');\n/* prettier-ignore */ export const assertIsRGBTuple: TAssert<TRGB> = makeAssert(isRGBTuple, 'isRGBTuple');\n\nexport const AssertionUtils = {\n // creators\n assertValue,\n makeAssert,\n // Primitive\n assertIsNumber,\n assertIsInteger,\n assertIsString,\n assertIsNonEmptyString,\n assertIsBoolean,\n assertIsBigInt,\n assertIsSymbol,\n\n // Reference\n assertIsNull,\n assertIsUndefined,\n assertIsDefined,\n assertIsNil,\n assertIsFunction,\n assertObject,\n assertIsArray,\n assertIsMap,\n assertIsSet,\n assertIsWeakMap,\n assertIsWeakSet,\n\n // Refined / Composite\n assertIsCamelCase,\n assertIsBufferLikeObject,\n assertIsJSONArrayString,\n assertIsJSONObjectString,\n assertIsJsonString,\n assertIsAbsoluteUrl,\n assertIsInternalUrl,\n assertIsRGBTuple,\n} as const;\n","import { TCamelCase, TSnakeCase, TKebabCase } from '../../types';\nimport { isNil, isNonEmptyString } from '../guards';\nimport { REGEX_CONSTANTS } from '../../constants';\n/**\n * ## πŸ”  capitalizeString β€” Capitalize First Letter\n *\n * Converts the first character of a string to uppercase while preserving\n * the rest of the string.\n *\n * This utility also preserves **TypeScript literal inference**\n * using the built-in `Capitalize<T>` type.\n *\n * ---\n *\n * ### Example\n *\n * ```ts\n * capitalizeString('hello'); // \"Hello\"\n * capitalizeString('userName'); // \"UserName\"\n * ```\n *\n * @param str - String to capitalize\n * @returns String with first letter capitalized\n */\nexport const capitalizeString = <S extends string>(str: S): Capitalize<S> => {\n return (str[0].toUpperCase() + str.slice(1)) as Capitalize<S>;\n};\n/**\n * ## πŸͺ toCamelCase β€” Convert String to camelCase\n *\n * Converts a string from various formats (`snake_case`, `kebab-case`,\n * space-separated, etc.) into **camelCase**.\n *\n * This utility:\n * - Normalizes separators (`-`, `_`, spaces)\n * - Converts word boundaries to camel casing\n * - Returns an empty string if the value is invalid\n *\n * ---\n *\n * ### Example\n *\n * ```ts\n * toCamelCase('hello-world'); // \"helloWorld\"\n * toCamelCase('user_name'); // \"userName\"\n * toCamelCase('Hello World'); // \"helloWorld\"\n * ```\n *\n * @param value - String to transform\n */\n\nexport const toCamelCase = <T extends TCamelCase<string>>(\n value: T | string,\n): TCamelCase<T | string> => {\n if (isNil(value) || !isNonEmptyString(value)) return '';\n const cleaned = value.replace(REGEX_CONSTANTS.letterSeparator, ' ');\n return cleaned\n .replace(REGEX_CONSTANTS.camelCaseBoundary, (word, idx) =>\n idx === 0 ? word.toLowerCase() : word.toUpperCase(),\n )\n .replace(REGEX_CONSTANTS.whitespace, '');\n};\n/**\n * ## 🧡 toKebabCase β€” Convert String to kebab-case\n *\n * Converts a string into **kebab-case**, commonly used for\n * URLs, CSS class names, and HTML attributes.\n *\n * The function:\n * - Normalizes camelCase boundaries\n * - Splits words by separators\n * - Joins them using `-`\n *\n * ---\n *\n * ### Example\n *\n * ```ts\n * toKebabCase('helloWorld'); // \"hello-world\"\n * toKebabCase('User Name'); // \"user-name\"\n * toKebabCase('user_name'); // \"user-name\"\n * ```\n *\n * @param value - String to transform\n */\nexport const toKebabCase = <T extends string>(\n value: T | string,\n): TKebabCase<T | string> => {\n if (isNil(value) || !isNonEmptyString(value)) return '';\n const cleaned = value.replace(REGEX_CONSTANTS.wordBoundarySplitter, ' ');\n const withBoundaries = cleaned.replace(\n REGEX_CONSTANTS.kebabCaseBoundary,\n '$1 $2',\n );\n return withBoundaries\n .trim()\n .split(REGEX_CONSTANTS.whitespace)\n .join('-')\n .toLowerCase();\n};\n/**\n * ## 🐍 toSnakeCase β€” Convert String to snake_case\n *\n * Converts a string into **snake_case**, commonly used for\n * database fields, environment variables, and backend APIs.\n *\n * The function:\n * - Splits words by separators and camelCase boundaries\n * - Joins them using `_`\n *\n * ---\n *\n * ### Example\n *\n * ```ts\n * toSnakeCase('helloWorld'); // \"hello_world\"\n * toSnakeCase('User Name'); // \"user_name\"\n * toSnakeCase('user-name'); // \"user_name\"\n * ```\n *\n * @param value - String to transform\n */\nexport const toSnakeCase = <T extends string>(\n value: T | string,\n): TSnakeCase<T | string> => {\n if (isNil(value) || !isNonEmptyString(value)) return '';\n const cleaned = value.replace(REGEX_CONSTANTS.wordBoundarySplitter, ' ');\n // Step 2: Insert spaces before uppercase letters (camelCase boundaries)\n const withBoundaries = cleaned.replace(\n REGEX_CONSTANTS.kebabCaseBoundary,\n '$1 $2',\n );\n\n return withBoundaries\n .trim()\n .split(REGEX_CONSTANTS.whitespace)\n .join('_')\n .toLowerCase();\n};\n","import { ObjectUtils, ArrayUtils } from '../common';\nimport { capitalizeString } from './string-transformers';\n/**\n * ## πŸ”‘ generateKeyMap β€” Create a Typed Key Transformation Map\n *\n * Generates an object mapping original keys to transformed string values\n * using an optional **prefix** and required **suffix**.\n *\n * This is useful when generating standardized property names such as\n * getter/setter names, CSS class maps, or API field mappings.\n *\n * ---\n *\n * ### βš™οΈ Behavior\n * - Iterates through the provided `keys` array.\n * - Builds a new string for each key using:\n * - Optional `prefix`\n * - Capitalized original key\n * - Required `suffix`\n * - Returns a **fully typed mapping object** where:\n *\n * ```\n * key -> transformedValue\n * ```\n *\n * ---\n *\n * ### πŸ“˜ Example\n *\n * ```ts\n * const map = generateKeyMap({\n * keys: ['name', 'email'] as const,\n * prefix: 'get',\n * suffix: 'Value',\n * });\n *\n * // Result:\n * // {\n * // name: \"getNameValue\",\n * // email: \"getEmailValue\"\n * // }\n * ```\n *\n * ---\n *\n * @typeParam K - Keys to transform\n * @typeParam P - Optional prefix string\n * @typeParam S - Required suffix string\n */\nexport const generateKeyMap = <\n K extends string,\n P extends string | undefined = undefined,\n S extends string = string,\n>(data: {\n keys: readonly K[];\n prefix?: P;\n suffix: S;\n}) => {\n const { keys, prefix, suffix } = data;\n\n const entries = ArrayUtils.map(keys, (key) => {\n const camel = prefix\n ? `${prefix}${key.charAt(0).toUpperCase() + key.slice(1)}${suffix}`\n : `${key.charAt(0).toLowerCase() + key.slice(1)}${suffix}`;\n\n return [key, camel] as [\n K,\n P extends string ? `${P}${Capitalize<K>}${S}` : `${K}${S}`,\n ];\n });\n\n return ObjectUtils.fromEntries(entries) satisfies Record<\n K,\n P extends string ? `${P}${Capitalize<K>}${S}` : `${K}${S}`\n >;\n};\n/**\n * ## πŸ—‚οΈ toKeyByField β€” Convert Array to Keyed Object\n *\n * Converts an array of objects into a **record keyed by a specific field**.\n *\n * The specified key field becomes the **object key**, and the remaining\n * properties are preserved as the value.\n *\n * This is useful for quickly creating lookup tables from API responses\n * or normalized datasets.\n *\n * ---\n *\n * ### πŸ“˜ Example\n *\n * ```ts\n * const users = [\n * { id: 1, name: 'Alice' },\n * { id: 2, name: 'Bob' },\n * ];\n *\n * const map = toKeyByField(users, 'id');\n *\n * // Result:\n * // {\n * // 1: { name: 'Alice' },\n * // 2: { name: 'Bob' }\n * // }\n * ```\n *\n * ---\n *\n * @param rows - Array of objects to transform\n * @param keyField - Property used as the object key\n */\nexport const toKeyByField = <\n RowType extends Record<Key, string | number | symbol>,\n Key extends keyof RowType,\n>(\n rows: RowType[],\n keyField: Key,\n): Record<RowType[Key], Omit<RowType, Key>> => {\n return ObjectUtils.fromEntries<RowType[Key], Omit<RowType, Key>>(\n ArrayUtils.map(rows, (row) => {\n const key: RowType[Key] = row[keyField];\n const { [keyField]: _, ...rest } = row;\n return [key, rest] satisfies [RowType[Key], Omit<RowType, Key>];\n }),\n ) satisfies Record<RowType[Key], Omit<RowType, Key>>;\n};\n/**\n * ## πŸ”  capitalizeArray β€” Capitalize All Strings in an Array\n *\n * Transforms every string in an array so that the **first letter is capitalized**.\n *\n * Uses the `capitalizeString` utility internally and preserves the\n * literal type relationship using `Capitalize<T>`.\n *\n * ---\n *\n * ### πŸ“˜ Example\n *\n * ```ts\n * capitalizeArray(['name', 'email']);\n *\n * // Result:\n * // ['Name', 'Email']\n * ```\n *\n * ---\n *\n * @param arr - Array of strings to capitalize\n */\nexport const capitalizeArray = <T extends string>(\n arr: readonly T[],\n): Capitalize<T>[] => ArrayUtils.map(arr, capitalizeString);\n/**\n * ## πŸ”  capitalizedKeys β€” Get Capitalized Object Keys\n *\n * Extracts keys from an object and returns them as an array of\n * **capitalized strings**.\n *\n * Only keys that **start with a letter** are included.\n *\n * This is useful when generating UI labels, enum-like lists,\n * or metadata from object shapes.\n *\n * ---\n *\n * ### πŸ“˜ Example\n *\n * ```ts\n * const user = {\n * id: 1,\n * name: 'Alice',\n * };\n *\n * capitalizedKeys(user);\n *\n * // Result:\n * // ['Id', 'Name']\n * ```\n *\n * ---\n *\n * @param obj - Object whose keys should be capitalized\n */\nexport const capitalizedKeys = <T extends Record<string, unknown>>(\n obj: T,\n): Capitalize<keyof T & string>[] =>\n capitalizeArray(\n ObjectUtils.keys(obj)\n .map(String) // Convert all keys to string\n .filter((key) => /^[A-Za-z]/.test(key)),\n );\n","import {\n toSnakeCase,\n toKebabCase,\n toCamelCase,\n capitalizeString,\n} from './string-transformers';\nimport {\n capitalizedKeys,\n capitalizeArray,\n toKeyByField,\n generateKeyMap,\n} from './object-transformers';\n\nconst TransformersUtils = {\n capitalizedKeys,\n capitalizeArray,\n toKeyByField,\n generateKeyMap,\n toSnakeCase,\n toKebabCase,\n toCamelCase,\n capitalizeString,\n} as const;\n\nexport {\n TransformersUtils,\n capitalizedKeys,\n capitalizeArray,\n toKeyByField,\n generateKeyMap,\n toSnakeCase,\n toKebabCase,\n toCamelCase,\n capitalizeString,\n};\n","import {\n isString,\n isUndefined,\n isBigInt,\n isObject,\n isKeyOfArray,\n} from '../guards/core';\nimport { REGEX_CONSTANTS, ANSI_COLOR_CODES, LOG_TYPES } from '../../constants';\nimport {\n TGetCallerLocationOptions,\n TLogOptions,\n THighlighterMap,\n TLogType,\n TTableItem,\n} from '../../types';\nimport { ArrayUtils } from '../common';\n\nexport function highlight(\n text: string,\n colorCode: keyof typeof ANSI_COLOR_CODES = 'yellow',\n) {\n return `${ANSI_COLOR_CODES[colorCode]}${text}${ANSI_COLOR_CODES.reset}`;\n}\n\n/** Common terminal color mappings */\nexport const logTypeHighlighters: THighlighterMap = {\n log: (t) => highlight(t, 'yellow'),\n info: (t) => highlight(t, 'cyan'),\n error: (t) => highlight(t, 'red'),\n debug: (t) => highlight(t, 'magenta'),\n warn: (t) => highlight(t, 'yellow'),\n table: (t) => t,\n};\n\n/**\n * Safely serializes any value into a readable string.\n *\n * - Handles objects, BigInts, and circular structures gracefully.\n * - Pretty-prints JSON for readability.\n *\n * @example\n * ```ts\n * DebugUtils.serialize({ foo: 'bar' });\n * // => \"{\\n \\\"foo\\\": \\\"bar\\\"\\n}\"\n * ```\n */\nexport const serialize = (data: unknown): string => {\n if (isUndefined(data)) return '';\n if (isString(data)) return data;\n\n try {\n return JSON.stringify(\n data,\n (_, value) => (isBigInt(value) ? value.toString() : value),\n 2,\n );\n } catch {\n return String(data);\n }\n};\n\n/**\n * UTIL LOCATION: DEBUG UTILS\n *\n *\n * Retrieves the caller's location (file, line, and column) from the stack trace.\n *\n * Useful for logging, debugging, and tracing where a function was called from.\n *\n * It works by inspecting `Error().stack` and extracting relevant frames.\n *\n * @param preferredIndex - The zero-based stack frame index to prioritize (default: 3).\n * @param fallbackIndex - The fallback frame index if the preferred frame doesn’t exist (default: 2).\n * @param topParent - If `true`, returns the top-most relevant stack frame in your code (skipping `node_modules`).\n * @param stripPathPrefix - If provided, removes this prefix (e.g., your project root path) from the returned string.\n *\n * @returns A string describing the caller’s location, e.g. `\"src/utils/core/debug.ts:42:15\"`.\n *\n * @example\n * ```ts\n * import { DebugUtils } from '@/utils/core/debug';\n *\n * function exampleFunction() {\n * console.log(DebugUtils.getCallerLocation());\n * }\n *\n * exampleFunction();\n * // Example output:\n * // \"src/utils/core/debug.ts:12:5\"\n * ```\n *\n * @example\n * ```ts\n * // Get the top-most relevant frame (ignoring node_modules)\n * console.log(DebugUtils.getCallerLocation(3, 2, true));\n * // Example output:\n * // \"src/server/api/user.ts:88:17\"\n * ```\n *\n * @example\n * ```ts\n * // Strip out the absolute path prefix for cleaner logs\n * console.log(DebugUtils.getCallerLocation(3, 2, false, process.cwd()));\n * // Example output:\n * // \"/src/services/logger.ts:54:9\"\n * ```\n */\nexport const getCallerLocation = (\n options: TGetCallerLocationOptions,\n): string => {\n const {\n preferredIndex = 3,\n fallbackIndex = 2,\n topParent = false,\n stripPathPrefix = process.cwd(),\n } = options;\n\n const stack = new Error().stack;\n if (!stack) return 'unknown';\n\n const lines = stack\n .split('\\n')\n .slice(1)\n .map((line) => line.replace(REGEX_CONSTANTS.stackTracePrefix, '').trim())\n .filter(Boolean);\n\n const line = topParent\n ? ([...lines].reverse().find((l) => !l.includes('node_modules')) ??\n lines.at(-1))\n : (lines[preferredIndex] ?? lines[fallbackIndex] ?? lines.at(-1));\n\n return stripPathPrefix\n ? (line?.replace(stripPathPrefix, '') ?? 'unknown')\n : (line ?? 'unknown');\n};\n\n/**\n * Logs messages to the console **only in development environment** unless overridden.\n * Supports standard log types ('log', 'warn', 'error', 'info', 'debug') as well as\n * table logging for structured data.\n *\n * @remarks\n * - If the first argument matches a log type in `LOG_TYPES`, it is treated as the type.\n * - Table logs are automatically formatted if the items contain a `current` array of objects.\n * - Each message is stringified if it is an object.\n * - Optional highlighters can be applied via `logTypeHighlighters`.\n *\n * @param options - Configuration options for this log call\n * @param options.enabled - Whether this log should be enabled (default: true)\n * @param options.overrideDev - Force logging even in production (default: false)\n * @param args - Messages to log. If the first item is a log type string, it is used as the type.\n *\n * @example\n * ```ts\n * logDev({}, 'info', 'Server started on port', 3000);\n *\n * logDev({ overrideDev: true }, 'error', new Error('Something failed'));\n *\n * logDev({}, 'table', { current: [{ key: 'task1', start: 0, end: 120 }] });\n * ```\n *\n */\nexport const logDev = (options: TLogOptions, ...args: unknown[]) => {\n const isDev = process.env.NODE_ENV !== 'production';\n const { enabled = true, overrideDev = false } = options;\n\n if (!enabled) return;\n if (!isDev && !overrideDev) return;\n\n // // Determine log type\n let type: TLogType = 'log';\n const currentType = args[0];\n if (isString(currentType) && isKeyOfArray(LOG_TYPES)(currentType)) {\n type = currentType;\n }\n\n // Handle table logs separately\n if (type === 'table') {\n // skip first argument, which is the log type string\n const tableData = ArrayUtils.map(args.slice(1), (item: unknown) => {\n if (item && isObject(item) && 'current' in item) {\n const curr = (item as { current: TTableItem[] }).current;\n return curr.map((l) => ({\n key: l.key,\n duration:\n l.end != null && l.start != null\n ? `${(l.end - l.start).toFixed(2)}ms`\n : 'in progress',\n }));\n }\n return item;\n });\n console.table(tableData.flat());\n return;\n }\n\n const highlighter = logTypeHighlighters[type];\n const messages = args.map((msg) => {\n let text = isObject(msg) ? serialize(msg) : String(msg);\n\n return highlighter ? highlighter(text) : text;\n });\n\n (console[type] ?? console.log)(...messages);\n};\n","import { logDev, highlight, getCallerLocation, serialize } from './debug';\n\nclass DebugUtils {\n // Map individual functions to static properties\n public static readonly highlight = highlight;\n public static readonly serialize = serialize;\n public static readonly getCallerLocation = getCallerLocation;\n}\n\nexport { logDev, getCallerLocation, serialize, highlight, DebugUtils };\n","import type {\n TKeyboardConfig,\n TShortcutDefinition,\n TKeyboardActionResult,\n} from '../../types';\nimport { DEFAULT_KEYBOARD_CONFIG } from '../../constants';\n/**\n * Interprets a keyboard event and returns semantic information about the user's intent.\n *\n * This utility analyzes a `KeyboardEvent` and classifies it into meaningful actions\n * such as copy, paste, clear, or typing, based on a configurable keyboard policy.\n *\n * It is framework-agnostic (works with native DOM or React keyboard events) and\n * performs **no side effects**. Consumers decide how to respond to the result.\n *\n * ### Features\n * - Detects copy and paste shortcuts across platforms (Mac / Windows).\n * - Supports configurable allowed keys and clear keys.\n * - Fully data-driven via `TKeyboardConfig`.\n * - Pure and easily unit-testable.\n *\n * ### Example\n * ```ts\n * const action = getKeyboardAction(event, {\n * allowedKeys: ['tab', 'enter'],\n * clearKeys: ['escape'],\n * });\n *\n * if (action.isPaste) {\n * updateWorkflow({ source: 'paste' });\n * }\n *\n * if (action.shouldBlockTyping) {\n * event.preventDefault();\n * }\n * ```\n *\n * ### Default Behavior\n * When no config is provided, the function uses `DEFAULT_KEYBOARD_CONFIG`,\n * which includes standard navigation keys, copy/paste shortcuts, and\n * backspace/delete as clear actions.\n *\n * @param event - The keyboard event to interpret (native or React keyboard event).\n * @param config - Optional configuration to customize allowed keys, shortcuts, and clear behavior.\n * @returns An object describing the interpreted keyboard action.\n */\nexport function getKeyboardAction(\n event: KeyboardEvent,\n config: TKeyboardConfig = {},\n): TKeyboardActionResult {\n const matchesShortcut = (\n event: KeyboardEvent,\n shortcut: TShortcutDefinition,\n ): boolean => {\n if (event.key.toLowerCase() !== shortcut.key) {\n return false;\n }\n\n return shortcut.modifiers.some((modifier) => {\n if (modifier === 'ctrl') return event.ctrlKey;\n if (modifier === 'meta') return event.metaKey;\n if (modifier === 'alt') return event.altKey;\n if (modifier === 'shift') return event.shiftKey;\n return false;\n });\n };\n const mergedConfig = {\n ...DEFAULT_KEYBOARD_CONFIG,\n ...config,\n };\n\n const key = event.key.toLowerCase();\n\n const isCopy = matchesShortcut(event, mergedConfig.copyShortcut);\n const isPaste = matchesShortcut(event, mergedConfig.pasteShortcut);\n const isClear = mergedConfig.clearKeys.includes(key);\n const isAllowedKey = mergedConfig.allowedKeys.includes(key);\n\n return {\n isPaste,\n isCopy,\n isClear,\n isAllowedKey,\n shouldBlockTyping: !isAllowedKey && !isCopy && !isPaste,\n };\n}\n","// lib/dom/media.ts\nimport {\n isArray,\n isKeyInObject,\n isFunction,\n isString,\n isObject,\n} from '../guards';\nimport type { TBaseImageObject } from '../../types';\n\nconst PRELOAD_CACHE = new Map<string, true>();\nconst MAX_CACHE_SIZE = 200;\n\n/**\n * Preloads images with PRELOAD caching.\n *\n * This utility:\n * - Uses `Image.decode()` if supported by the browser for faster, async decoding.\n * - Falls back to `onload` / `onerror` events if `decode()` is not available.\n * - Skips URLs that are already cached in the LRU cache.\n *\n * This is useful for preloading images in a performant way, avoiding repeated network requests\n * and controlling memory usage with an LRU cache.\n *\n * @param urls - Array of image URLs to preload\n * @returns A promise that resolves when all images have been preloaded\n *\n * @example\n * ```ts\n * import { preloadImages } from './lib/network/images';\n *\n * const images = [\n * '/images/photo1.jpg',\n * '/images/photo2.jpg',\n * '/images/photo3.jpg',\n * ];\n *\n * // Preload images before rendering a gallery\n * await preloadImages(images);\n * console.log('All images are preloaded and cached!');\n * ```\n */\nexport async function preloadImages(\n urls: string | string[],\n options: { fetchPriority?: HTMLImageElement['fetchPriority'] } = {},\n): Promise<void> {\n if (typeof window === 'undefined') return;\n const { fetchPriority = 'low' } = options;\n const urlArray = isArray(urls) ? urls : [urls];\n const tasks = urlArray\n .filter((src) => !PRELOAD_CACHE.has(src))\n .map((src) => {\n return new Promise<void>((resolve) => {\n const img: HTMLImageElement = new Image();\n img.fetchPriority = fetchPriority;\n img.src = src;\n\n const done = () => {\n if (PRELOAD_CACHE.size >= MAX_CACHE_SIZE) {\n const firstKey = PRELOAD_CACHE.keys().next().value;\n if (firstKey) PRELOAD_CACHE.delete(firstKey);\n }\n\n PRELOAD_CACHE.set(src, true);\n resolve();\n };\n\n if (img.complete) {\n // Already loaded by browser\n done();\n } else if (isKeyInObject('decode')(img) && isFunction(img.decode)) {\n // Decode to ensure image is in memory\n img.decode().then(done).catch(done);\n } else {\n // Fallback\n img.onload = done;\n img.onerror = done;\n }\n });\n });\n\n if (tasks.length === 0) return;\n await Promise.all(tasks);\n}\n/**\n * Normalizes a variety of image sources into a plain string URL.\n * @template T - The shape of the image object, defaulting to our base structure.\n */\nexport function normalizeImageSrc<T extends TBaseImageObject>(\n src: string | T | { default: T } | null | undefined,\n): string {\n if (!src) return '';\n\n // 1. Handle string URLs\n if (isString(src)) return src;\n isKeyInObject('default')(src);\n // 2. Handle CommonJS/Bundler default exports\n if (\n isKeyInObject('default')(src) &&\n src.default &&\n isObject(src.default) &&\n isKeyInObject('src')(src.default)\n ) {\n return (src.default as T).src;\n }\n\n // 3. Handle standard objects (Next.js StaticImageData, Vite, etc.)\n if (isObject(src) && isKeyInObject('src')(src) && isString(src.src)) {\n return src.src;\n }\n\n return '';\n}\n","import { getKeyboardAction } from './events';\nimport { preloadImages, normalizeImageSrc } from './media';\n\nconst DomUtils = {\n getKeyboardAction,\n preloadImages,\n normalizeImageSrc,\n} as const;\n\nexport { getKeyboardAction, preloadImages, normalizeImageSrc, DomUtils };\n","import { isBigInt, isNumber } from '../guards/core/primitives';\ntype TWelfordState = {\n count: number;\n mean: number;\n squaredDeviationSum: number;\n};\nexport class ComputationUtils {\n private static toNum(v: number | bigint): number {\n return isBigInt(v) ? Number(v) : v;\n }\n static round(value: number, decimals = 0): number {\n const factor = Math.pow(10, decimals);\n return Math.round(value * factor) / factor;\n }\n /** forces a number to stay within a specific range */\n static clamp(val: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, val));\n }\n static getPercentage(\n value: number | bigint,\n total: number | bigint,\n decimals = 0,\n ): number {\n if (total === 0 || total === 0n) return 0;\n\n if (isBigInt(value) || isBigInt(total)) {\n const p = BigInt(10 ** (decimals + 2));\n return Number((BigInt(value) * 100n * p) / BigInt(total)) / Number(p);\n }\n\n return this.round((value / total) * 100, decimals);\n }\n static computeMean(arr: (number | bigint)[]): number {\n if (!arr.length) return 0;\n const numbers = arr.map((v) => this.toNum(v));\n return numbers.reduce((sum, v) => sum + v, 0) / numbers.length;\n }\n /**\n * Determines if a value is a statistical outlier based on standard deviations.\n * Useful for performance alerting (e.g., test duration spikes).\n */\n static isAnomaly(\n value: number,\n mean: number,\n stdDev: number,\n threshold = 2,\n ): boolean {\n if (stdDev === 0) return false;\n return Math.abs(value - mean) > stdDev * threshold;\n }\n /**\n * Generates a pass/fail ratio as a human-readable percentage.\n * Leverages getPercentage for BigInt safety and consistent rounding.\n */\n static computeRatio(\n achieved: number | bigint,\n total: number | bigint,\n decimals = 2,\n ): number {\n return this.getPercentage(achieved, total, decimals);\n }\n /**\n * Incrementally updates Welford's running mean and variance.\n *\n * High-level:\n * - Efficiently calculates running mean and variance without storing all samples.\n * - Perfect for streaming data like oracle price feeds.\n *\n * https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\n *\n * @param state - Previous Welford state, or undefined if this is the first sample\n * @param newValue - The new data point to incorporate\n * @returns Object containing:\n * - welford: updated state (count, mean, squaredDeviationSum)\n * - stdDev: current standard deviation based on updated state\n */\n static welfordUpdate(\n state: TWelfordState | undefined,\n newValue: number,\n ): { welford: TWelfordState; stdDev: number } {\n if (!state) {\n return {\n welford: { count: 1, mean: newValue, squaredDeviationSum: 0 },\n stdDev: 0,\n };\n }\n\n const {\n count: prevCount,\n mean: prevMean,\n squaredDeviationSum: prevSqDev,\n } = state;\n\n const newCount = prevCount + 1;\n const delta = newValue - prevMean;\n const newMean = prevMean + delta / newCount;\n const newSquaredDeviationSum = prevSqDev + delta * (newValue - newMean);\n\n const variance = newCount > 1 ? newSquaredDeviationSum / (newCount - 1) : 0;\n const stdDev = Math.sqrt(variance);\n\n return {\n welford: {\n count: newCount,\n mean: newMean,\n squaredDeviationSum: newSquaredDeviationSum,\n },\n stdDev,\n };\n }\n /* prettier-ignore */ static computeDelta(current: bigint, past: bigint): { netDelta: bigint; absDelta: bigint };\n /* prettier-ignore */ static computeDelta(current: number, past: number): { netDelta: number; absDelta: number };\n /* prettier-ignore */ static computeDelta(\n current: number | bigint,\n past: number | bigint,\n ): { netDelta: number | bigint; absDelta: number | bigint } {\n \n if (isBigInt(current) && isBigInt(past)) {\n const netDelta = current - past;\n const absDelta = netDelta < 0n ? -netDelta : netDelta;\n return { netDelta, absDelta };\n }\n\n if (isNumber(current) && isNumber(past)) {\n const netDelta = current - past;\n const absDelta = Math.abs(netDelta);\n return { netDelta, absDelta };\n }\n throw new Error(\"Incompatible types: current and past must both be number or both be bigint.\");\n }\n static computePercentageChange(\n current: number | bigint,\n past: number | bigint,\n scale = 1n,\n ): number {\n if (past === 0 || past === 0n) return 0;\n\n if (isBigInt(current) || isBigInt(past)) {\n const curr = BigInt(current);\n const prev = BigInt(past);\n // Use a passed-in scale or default to 1 (no scaling)\n return Number(((curr - prev) * (100n * scale)) / prev) / Number(scale);\n }\n return ((current - past) / past) * 100;\n }\n}\n","import { REGEX_CONSTANTS } from '../../constants';\nimport { TRGB, TCssRGB } from '../../types';\nimport { isString } from '../guards';\nimport { assertIsRGBTuple } from '../validations';\n\nexport const hexToRGB = (hex: string): TRGB => {\n const normalized = hex.startsWith('#') ? hex.slice(1) : hex;\n\n if (!REGEX_CONSTANTS.hexColor.test(normalized)) {\n throw new Error(`Invalid hex color: \"${hex}\"`);\n }\n\n const r = parseInt(normalized.slice(0, 2), 16);\n const g = parseInt(normalized.slice(2, 4), 16);\n const b = parseInt(normalized.slice(4, 6), 16);\n\n return [r, g, b];\n};\n\nexport const validateRGB = (input: TRGB | string): TRGB => {\n if (isString(input)) return hexToRGB(input);\n assertIsRGBTuple(input);\n return input satisfies TRGB;\n};\n\nexport const getLuminance = (rgb: TRGB | string): number => {\n const [r, g, b] = validateRGB(rgb);\n\n const transform = (channel: number) => {\n const c = channel / 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n };\n\n return 0.2126 * transform(r) + 0.7152 * transform(g) + 0.0722 * transform(b);\n};\n\n/**\n * ## πŸŒ— isLumLessThan β€” Check if a Color’s Luminance is Below a Threshold\n *\n * Determines whether the luminance of a color (in RGB array or HEX format)\n * is less than the specified threshold. Uses `getLuminance()` internally.\n *\n * @param color - RGB tuple or HEX color string (e.g. `[255,255,255]` or `\"#ffffff\"`)\n * @param threshold - A number between 0 and 1 representing the luminance cutoff.\n * @returns `true` if the color’s luminance is less than the threshold.\n *\n * @example\n * ```ts\n * isLumLessThan('#000000', 0.2); // true\n * isLumLessThan([255,255,255], 0.2); // false\n * ```\n */\nexport const isLumLessThan = (\n color: TRGB | string,\n threshold: number,\n): boolean => getLuminance(validateRGB(color)) < threshold;\n\n/**\n * ## πŸŒ‘ isDarkColor β€” Check if a Color is Perceptually Dark\n *\n * Determines whether a color is \"dark\" based on a standard WCAG-inspired\n * luminance threshold (0.179). Works with both HEX and RGB formats.\n *\n * @param color - RGB tuple or HEX color string.\n * @returns `true` if the color is considered dark.\n *\n * @example\n * ```ts\n * isDarkColor('#000000'); // true\n * isDarkColor('#ffffff'); // false\n * ```\n */\nexport const isDarkColor = (color: TRGB | string): boolean =>\n isLumLessThan(color, 0.179);\n\n/**\n * ## β˜€οΈ isLumGreaterThan β€” Check if a Color’s Luminance Exceeds a Threshold\n *\n * Determines whether the luminance of a color is above the given threshold.\n *\n * @param color - RGB tuple or HEX color string.\n * @param threshold - A number between 0 and 1 representing the luminance cutoff.\n * @returns `true` if the color’s luminance is greater than the threshold.\n *\n * @example\n * ```ts\n * isLumGreaterThan('#ffffff', 0.2); // true\n * isLumGreaterThan('#222222', 0.2); // false\n * ```\n */\nexport const isLumGreaterThan = (\n color: TRGB | string,\n threshold: number,\n): boolean => getLuminance(validateRGB(color)) > threshold;\n\n/**\n * ## 🎨 contrastTextColor β€” Returns an Accessible Text Color Based on Background\n *\n * Dynamically selects a readable text color (`black` or `white`) depending on\n * the background color’s luminance.\n *\n * The function can return:\n * - **Tailwind classes** (e.g. `'text-black'` / `'text-white'`)\n * - **CSS color values** (e.g. `'#000000'` / `'#ffffff'`)\n *\n * ---\n *\n * @param color - RGB tuple or HEX color string.\n * @param options - Optional configuration for return format and threshold.\n * @returns A string representing the contrasting text color (Tailwind or CSS).\n *\n * ---\n *\n * @example\n * ```ts\n * // Tailwind mode (default)\n * contrastTextColor('#000000');\n * // β†’ 'text-white'\n *\n * // CSS mode\n * contrastTextColor('#ffffff', { mode: 'css' });\n * // β†’ '#000000'\n *\n * // Custom threshold\n * contrastTextColor([120,120,120], { threshold: 0.2 });\n * // β†’ 'text-white'\n * ```\n */\nexport const contrastTextColor = (\n color: TRGB | string,\n options?: {\n mode?: 'tailwind' | 'css';\n threshold?: number;\n },\n): string => {\n const { mode = 'tailwind', threshold = 0.179 } = options ?? {};\n const isLight = isLumGreaterThan(color, threshold);\n\n if (mode === 'css') {\n return isLight ? '#000000' : '#ffffff';\n }\n\n // Default: Tailwind-compatible class names\n return isLight ? 'text-black' : 'text-white';\n};\n\n/**\n * ## 🎨 hexToRGBShorthand β€” Convert Hex Color to RGB Array\n *\n * Converts a **hex color string** into an RGB array `[r, g, b]`.\n * Supports both **3-character shorthand** (e.g., `#abc`) and **6-character hex** (e.g., `#aabbcc`).\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - Convert a user-friendly or CSS hex color into a numeric RGB array.\n * - Handles shorthand hex and expands it automatically.\n * - Returns `null` for invalid hex strings.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * hexToRGBShorthand('#abc'); // [170, 187, 204]\n * hexToRGBShorthand('#aabbcc'); // [170, 187, 204]\n * hexToRGBShorthand('invalid'); // null\n * ```\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - Input must be a valid 3- or 6-character hex string (case-insensitive).\n * - Output is always a `[number, number, number]` array if valid.\n */\nexport const hexToRGBShorthand = (\n hex: string,\n): [number, number, number] | null => {\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n const fullHex = hex.replace(\n shorthandRegex,\n (_m, r, g, b) => r + r + g + g + b + b,\n );\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(fullHex);\n if (!result) return null;\n\n return [\n parseInt(result[1], 16),\n parseInt(result[2], 16),\n parseInt(result[3], 16),\n ];\n};\n\n/**\n * ## 🎨 interpolateColor β€” Linear Interpolation Between Two RGB Colors\n *\n * Interpolates between two RGB colors based on a `factor` and returns a **CSS rgb() string**.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - Blend two colors linearly using a numeric factor between `0` and `1`.\n * - `factor = 0` returns the `start` color.\n * - `factor = 1` returns the `end` color.\n * - Any value in-between returns the proportional mix.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * interpolateColor(\n * { r: 255, g: 0, b: 0 },\n * { r: 0, g: 0, b: 255 },\n * 0.5\n * );\n * // β†’ \"rgb(128, 0, 128)\"\n *\n * interpolateColor(\n * { r: 0, g: 255, b: 0 },\n * { r: 0, g: 0, b: 0 },\n * 0.25\n * );\n * // β†’ \"rgb(0, 191, 0)\"\n * ```\n *\n * ---\n *\n * ### πŸ“Œ Notes\n * - `start` and `end` colors must have `r`, `g`, `b` values as numbers.\n * - `factor` should ideally be in `[0, 1]`, but values outside will extrapolate.\n * - Returns a **valid CSS rgb() string** ready to use in style properties.\n */\nexport const interpolateColor = (\n start: { r: number; g: number; b: number },\n end: { r: number; g: number; b: number },\n factor: number,\n): TCssRGB => {\n const result = {\n r: Math.round(start.r + (end.r - start.r) * factor),\n g: Math.round(start.g + (end.g - start.g) * factor),\n b: Math.round(start.b + (end.b - start.b) * factor),\n };\n\n return `rgb(${result.r}, ${result.g}, ${result.b})`;\n};\n/**\n * Converts a hex color string to an HSL (Hue, Saturation, Lightness) object.\n *\n * @param hex - A hexadecimal color string (e.g., \"#ff0000\" or \"ff0000\")\n * @returns An object with:\n * - h: hue in degrees [0, 360)\n * - s: saturation [0, 1]\n * - l: lightness [0, 1]\n *\n * @example\n * hexToHSL(\"#ff0000\") // { h: 0, s: 1, l: 0.5 }\n */\nexport function hexToHSL(hex: string): { h: number; s: number; l: number } {\n // Convert hex to RGB and normalize to [0,1]\n const [r, g, b] = hexToRGB(hex).map((v) => v / 255);\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n\n let h = 0;\n let s = 0;\n const d = max - min;\n\n if (d !== 0) {\n // Calculate saturation\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n // Calculate hue\n if (max === r) {\n h = ((g - b) / d + (g < b ? 6 : 0)) * 60;\n } else if (max === g) {\n h = ((b - r) / d + 2) * 60;\n } else if (max === b) {\n h = ((r - g) / d + 4) * 60;\n }\n }\n\n return { h, s, l };\n}\n/**\n * Converts a hexadecimal color string to a normalized RGB tuple.\n *\n * This function takes a standard hex color (like `#ff0000` or `ff0000`) and\n * converts it to an RGB representation where each channel is a decimal number\n * between 0 and 1 instead of 0–255. This format is commonly used in graphics\n * and WebGL contexts (like Three.js or shaders) that expect normalized RGB values.\n *\n * @param hex - A hexadecimal color string, either in 3-digit shorthand (`#f00`)\n * or 6-digit full form (`#ff0000`). The leading `#` is optional.\n *\n * @returns A tuple `[r, g, b]` where each component is a number between 0 and 1:\n * - `r` = red channel normalized (0–1)\n * - `g` = green channel normalized (0–1)\n * - `b` = blue channel normalized (0–1)\n *\n * @example\n * hexToNormalizedRGB(\"#ff0000\"); // [1, 0, 0] β†’ pure red\n * hexToNormalizedRGB(\"00ff00\"); // [0, 1, 0] β†’ pure green\n * hexToNormalizedRGB(\"#0000ff\"); // [0, 0, 1] β†’ pure blue\n */\nexport const hexToNormalizedRGB = (hex: string): [number, number, number] => {\n const [r, g, b] = hexToRGB(hex); // returns 0–255\n return [r / 255, g / 255, b / 255];\n};\n","import {\n hexToNormalizedRGB,\n hexToHSL,\n interpolateColor,\n hexToRGBShorthand,\n contrastTextColor,\n isLumGreaterThan,\n isDarkColor,\n isLumLessThan,\n getLuminance,\n validateRGB,\n hexToRGB,\n} from './color';\n\nconst ColorUtils = {\n hexToNormalizedRGB,\n hexToHSL,\n interpolateColor,\n hexToRGBShorthand,\n contrastTextColor,\n isLumGreaterThan,\n isDarkColor,\n isLumLessThan,\n getLuminance,\n validateRGB,\n hexToRGB,\n} as const;\n\nexport {\n hexToNormalizedRGB,\n hexToHSL,\n interpolateColor,\n hexToRGBShorthand,\n contrastTextColor,\n isLumGreaterThan,\n isDarkColor,\n isLumLessThan,\n getLuminance,\n validateRGB,\n hexToRGB,\n ColorUtils,\n};\n","import type { TGenericUrlObject, THashScrollOptions } from '../../types';\nimport {\n isDefined,\n isString,\n isObject,\n isKeyInObject,\n isArray,\n isInternalUrl,\n isAbsoluteUrl,\n} from '../guards/core';\nimport { ObjectUtils, ArrayUtils } from '../common';\n\n/**\n * Normalize various URL inputs to a string.\n *\n * @param href - The input URL, which can be a string, URL instance, or object with pathname/query/hash.\n * @returns A normalized string URL.\n *\n * @example\n * LinkUtils.normalizeUrl('https://example.com/path?query=1#hash');\n * // 'https://example.com/path?query=1#hash'\n *\n * @example\n * LinkUtils.normalizeUrl({ pathname: '/path', query: { q: '1' }, hash: '#section' });\n * // '/path?q=1#section'\n */\nexport function normalizeUrl(\n href?: string | URL | TGenericUrlObject | null,\n): string {\n if (!isDefined(href)) return '';\n\n // 1. Handle simple strings\n if (isString(href)) return href;\n\n // 2. Handle native URL instances\n if (href instanceof URL) return href.toString();\n\n // 3. Handle UrlObjects (Next.js / Node)\n if (\n isObject(href) &&\n (isKeyInObject('pathname')(href) || isKeyInObject('query')(href))\n ) {\n const { pathname = '', query, hash = '' } = href;\n\n let queryString = '';\n\n if (isObject(query)) {\n const params = new URLSearchParams();\n\n // Cleanly iterate and append valid query params\n ObjectUtils.entries(query).forEach(([key, value]) => {\n if (isDefined(value)) {\n // Handle arrays (e.g. ?tag=a&tag=b) or primitives\n if (isArray(value)) {\n ArrayUtils.forEach(value, (v) => params.append(key, String(v)));\n } else {\n params.append(key, String(value));\n }\n }\n });\n\n const search = params.toString();\n if (search) queryString = `?${search}`;\n }\n\n const cleanPath = pathname || '';\n const cleanHash = hash && !hash.startsWith('#') ? `#${hash}` : hash || '';\n\n return `${cleanPath}${queryString}${cleanHash}`;\n }\n\n return '';\n}\n/**\n * ## 🧩 extractRelativePath β€” Extracts Relative Paths\n *\n * Extracts the relative path from an internal URL or absolute URL pointing\n * to the same origin. Ensures that the returned path always starts with `/`.\n *\n * ---\n *\n * ### βš™οΈ Core Purpose\n * - πŸ”Ή Converts internal absolute URLs to relative paths.\n * - πŸ”Ή Preserves already relative paths.\n * - πŸ”Ή Safely handles invalid or external URLs by returning `/`.\n *\n * ---\n *\n * ### πŸ“˜ Example Usage\n * ```ts\n * LinkUtils.extractRelativePath('/about');\n * // '/about'\n *\n * LinkUtils.extractRelativePath('https://example.com/about?query=1');\n * // '/about'\n *\n * LinkUtils.extractRelativePath('https://external.com/page');\n * // '/'\n * ```\n *\n * ---\n *\n * @param url - The input URL string or unknown value.\n * @returns A string representing the relative path, always starting with `/`.\n */\nexport const extractRelativePath = (url?: unknown): string => {\n if (!isInternalUrl(url)) return '/';\n\n const trimmedUrl = url.trim();\n if (!trimmedUrl) return '/';\n\n if (trimmedUrl.startsWith('/')) return trimmedUrl;\n\n if (isAbsoluteUrl(trimmedUrl)) {\n const parsed = new URL(trimmedUrl);\n return parsed.pathname || '/';\n }\n\n return `/${trimmedUrl}`;\n};\n/**\n * Removes the hash fragment from a URL string while preserving path and query.\n */\nexport const stripHash = (url?: string): string => {\n if (!url) return '';\n\n // Simple string split is faster and SSR-safe for 90% of cases\n if (!url.includes('#')) return url;\n\n try {\n // If window exists, we can use the URL constructor for more accuracy\n const base =\n typeof window !== 'undefined'\n ? window.location.origin\n : 'http://localhost';\n const parsed = new URL(url, base);\n\n // Return path + search (and origin if it's external)\n const isInternal =\n typeof window !== 'undefined' && parsed.origin === window.location.origin;\n return isInternal\n ? `${parsed.pathname}${parsed.search}`\n : `${parsed.origin}${parsed.pathname}${parsed.search}`;\n } catch {\n // Fallback for malformed URLs\n return url.split('#')[0];\n }\n};\n\nexport const handleInternalHashScroll = ({\n event,\n href,\n behavior = 'smooth',\n block = 'start',\n}: THashScrollOptions): boolean => {\n if (typeof window === 'undefined') return false;\n if (!href.startsWith('#')) return false;\n\n // iOS Safari has broken scrollIntoView behavior\n const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);\n if (isIOS) return false;\n\n const id = href.replace(/^#/, '');\n const element = document.getElementById(id);\n if (!element) return false;\n\n event?.preventDefault();\n\n element.scrollIntoView({\n behavior,\n block,\n });\n\n return true;\n};\n","import {\n normalizeUrl,\n handleInternalHashScroll,\n extractRelativePath,\n stripHash,\n} from './link-utils';\n\nclass LinkUtils {\n public static readonly normalize = normalizeUrl;\n public static readonly extractRelativePath = extractRelativePath;\n public static readonly stripHash = stripHash;\n public static readonly handleHashScroll = handleInternalHashScroll;\n}\n\nexport {\n normalizeUrl,\n handleInternalHashScroll,\n extractRelativePath,\n stripHash,\n LinkUtils,\n};\n"],"mappings":"AAGA,SAASA,EAGPC,EAAQC,EAA2D,CAC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EAAE,EAC1BgC,EAAU,SAAS,eAAeD,CAAE,EAC1C,OAAKC,GAELJ,GAAO,eAAe,EAEtBI,EAAQ,eAAe,CACrB,SAAAH,EACA,MAAAC,CACF,CAAC,EAEM,IATc,EAUvB,ECvKA,IAAMG,EAAN,KAAgB,CAKhB,EALMA,EACmB,UAAYC,GAD/BD,EAEmB,oBAAsBE,GAFzCF,EAGmB,UAAYG,GAH/BH,EAImB,iBAAmBI","names":["exportAndRenameStaticMethods","cls","renameMap","result","newKey","oldKey","prop","ArrayUtils","_ArrayUtils","arr","el","items","length","fn","initialValue","acc","val","item","i","result","predicate","RenamedArrayMethods","exportAndRenameStaticMethods","arrayMap","arrayFilter","arrayIncludes","arrayReduce","arrayFlat","arrayFlatMap","arrayForEach","arrayFilterNonNullable","ObjectUtils","obj","entries","path","keys","current","key","value","record","RenamedObjectMethods","exportAndRenameStaticMethods","objectKeys","objectEntries","objectFromEntries","objectValues","objectHas","objectGet","objectSet","isNumber","value","isInteger","isString","isNonEmptyString","isBoolean","isBigInt","isSymbol","isPrimitive","HTML_TAGS","SAFE_HTML_TAGS","DEFAULT_KEYBOARD_CONFIG","LOG_TYPES","REGEX_CONSTANTS","SAFE_HTML_TAGS","ANSI_COLOR_CODES","BASE_REACT_PROPS","REACT_19_PROPS","REACT_CAMEL_CASE_PROPS","MODERN_HTML_PROPS","SVG_AND_A11Y_PROPS","METADATA_PROPS","SPECIALIZED_PROPS","STANDARD_HTML_PROPS","SVG_PRESENTATION_PROPS","SVG_GEOMETRY_PROPS","SVG_ANIMATION_FILTER_PROPS","SVG_TEXT_PROPS","SVG_NAMESPACE_PROPS","COMPAT_PROPS","VALID_DOM_PROPS","VALID_DOM_TESTING_KEYS","isNull","term","isUndefined","value","isDefined","isNil","isFunction","isObject","isArray","isMap","isSet","isWeakMap","isWeakSet","isInstanceOf","constructor","isCamelCase","value","REGEX_CONSTANTS","isSnakeCase","isKebabCase","isJSONArrayString","isNonEmptyString","isJSONObjectString","parsed","isHTMLString","isString","isHexByteString","expectedLength","isUndefined","isJsonString","isAbsoluteUrl","url","isNonEmptyString","isInternalUrl","isInArray","target","set","value","isUndefined","isKeyOfObject","obj","key","isString","isNumber","isSymbol","isKeyInObject","isObject","isKeyOfArray","keys","isBoolean","isArrayOf","typeGuard","isRecordOf","ObjectUtils","hasDefinedKeys","requiredKeys","isDefined","isBufferLikeObject","value","isObject","hasTypeBuffer","hasNumberArrayData","isArrayOf","isNumber","isRGBTuple","input","isArray","n","isPhoneNumber","isNonEmptyString","REGEX_CONSTANTS","regex","isEmail","isString","CoreTypeGuards","isString","isNumber","isBoolean","isBigInt","isNil","isDefined","isInteger","isNonEmptyString","isSymbol","isPrimitive","isNull","isFunction","isObject","isArray","isMap","isSet","isWeakMap","isWeakSet","isUndefined","isInstanceOf","FormatTypeGuards","isEmail","isPhoneNumber","isAbsoluteUrl","isInternalUrl","isJsonString","isHTMLString","isCamelCase","isSnakeCase","isKebabCase","isHexByteString","isJSONObjectString","isJSONArrayString","isRGBTuple","isBufferLikeObject","CollectionTypeGuards","isArrayOf","isRecordOf","isKeyOfObject","isKeyInObject","isKeyOfArray","isInArray","hasDefinedKeys","memoize","fn","cache","arg","result","allDomKeys","ObjectUtils","VALID_DOM_PROPS","reactPropsRegex","isPropValid","memoize","prop","isDOMPropKey","value","isString","isDOMEntry","entry","hasReactSymbol","value","symbol","isKeyInObject","isRef","isDefined","isFunction","isObject","isRefObject","ref","isNull","isPromise","isReactPortal","hasChildren","isComponentType","isForwardRef","isValidElement","Fragment","isValidReactNode","value","isNil","isPrimitive","isReactPortal","isArrayOf","isReactElement","isFragment","hasOnClick","isKeyInObject","isFunction","isElementLike","element","isObject","isString","isElementOfType","allowedTypes","hasNameMetadata","type","ReactTypeGuards","isRef","isRefObject","isPromise","isReactPortal","hasChildren","isComponentType","isForwardRef","isValidReactNode","isReactElement","isFragment","hasOnClick","isElementLike","isElementOfType","hasNameMetadata","isDOMPropKey","isDOMEntry","isPropValid","assertValue","value","typeGuard","message","makeAssert","guard","_key","assertIsNumber","CoreTypeGuards","assertIsInteger","assertIsString","assertIsNonEmptyString","assertIsBoolean","assertIsBigInt","assertIsSymbol","assertIsNull","assertIsUndefined","assertIsDefined","assertIsNil","assertIsFunction","assertObject","assertIsArray","assertIsMap","assertIsSet","assertIsWeakMap","assertIsWeakSet","assertIsCamelCase","isCamelCase","assertIsBufferLikeObject","isBufferLikeObject","assertIsJSONArrayString","isJSONArrayString","assertIsJSONObjectString","isJSONObjectString","assertIsJsonString","isJsonString","assertIsAbsoluteUrl","isAbsoluteUrl","assertIsInternalUrl","isInternalUrl","assertIsRGBTuple","isRGBTuple","AssertionUtils","capitalizeString","str","toCamelCase","value","isNil","isNonEmptyString","REGEX_CONSTANTS","word","idx","toKebabCase","toSnakeCase","generateKeyMap","data","keys","prefix","suffix","entries","ArrayUtils","key","camel","ObjectUtils","toKeyByField","rows","keyField","row","_","rest","capitalizeArray","arr","capitalizeString","capitalizedKeys","obj","TransformersUtils","capitalizedKeys","capitalizeArray","toKeyByField","generateKeyMap","toSnakeCase","toKebabCase","toCamelCase","capitalizeString","highlight","text","colorCode","ANSI_COLOR_CODES","logTypeHighlighters","t","serialize","data","isUndefined","isString","_","value","isBigInt","getCallerLocation","options","preferredIndex","fallbackIndex","topParent","stripPathPrefix","stack","lines","line","REGEX_CONSTANTS","l","logDev","args","isDev","enabled","overrideDev","type","currentType","isKeyOfArray","LOG_TYPES","tableData","ArrayUtils","item","isObject","highlighter","messages","msg","DebugUtils","highlight","serialize","getCallerLocation","getKeyboardAction","event","config","matchesShortcut","shortcut","modifier","mergedConfig","DEFAULT_KEYBOARD_CONFIG","key","isCopy","isPaste","isClear","isAllowedKey","PRELOAD_CACHE","MAX_CACHE_SIZE","preloadImages","urls","options","fetchPriority","tasks","isArray","src","resolve","img","done","firstKey","isKeyInObject","isFunction","normalizeImageSrc","isString","isObject","DomUtils","getKeyboardAction","preloadImages","normalizeImageSrc","ComputationUtils","v","isBigInt","value","decimals","factor","val","min","max","total","p","arr","numbers","sum","mean","stdDev","threshold","achieved","state","newValue","prevCount","prevMean","prevSqDev","newCount","delta","newMean","newSquaredDeviationSum","variance","current","past","netDelta","absDelta","isNumber","scale","curr","prev","hexToRGB","hex","normalized","REGEX_CONSTANTS","g","b","validateRGB","input","isString","assertIsRGBTuple","getLuminance","rgb","r","transform","channel","c","isLumLessThan","color","threshold","isDarkColor","isLumGreaterThan","contrastTextColor","options","mode","isLight","hexToRGBShorthand","shorthandRegex","fullHex","_m","result","interpolateColor","start","end","factor","hexToHSL","v","max","min","l","h","s","d","hexToNormalizedRGB","ColorUtils","hexToNormalizedRGB","hexToHSL","interpolateColor","hexToRGBShorthand","contrastTextColor","isLumGreaterThan","isDarkColor","isLumLessThan","getLuminance","validateRGB","hexToRGB","normalizeUrl","href","isDefined","isString","isObject","isKeyInObject","pathname","query","hash","queryString","params","ObjectUtils","key","value","isArray","ArrayUtils","v","search","cleanPath","cleanHash","extractRelativePath","url","isInternalUrl","trimmedUrl","isAbsoluteUrl","stripHash","base","parsed","handleInternalHashScroll","event","behavior","block","id","element","LinkUtils","normalizeUrl","extractRelativePath","stripHash","handleInternalHashScroll"]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@bgskinner2/ts-utils",
3
+ "version": "1.0.0",
4
+ "description": "A collection of high-performance TypeScript utilities and React type guards.",
5
+ "author": "Brennan Skinner",
6
+ "license": "ISC",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "dev": "tsup src/index.ts --format cjs,esm --watch --dts",
24
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean --minify",
25
+ "test": "jest",
26
+ "cov:test": "jest --coverage",
27
+ "lint": "eslint '**/*.{ts,tsx}' --max-warnings=0",
28
+ "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
29
+ "format": "prettier --write '**/*.{ts,tsx,js,json,md}'",
30
+ "format:check": "prettier --check '**/*.{ts,tsx,js,json,md}'",
31
+ "prepublishOnly": "npm run build && npm test"
32
+ },
33
+ "keywords": [
34
+ "typescript",
35
+ "utils",
36
+ "react",
37
+ "guards"
38
+ ],
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.38.0",
41
+ "@types/jest": "^30.0.0",
42
+ "@types/mocha": "^10.0.10",
43
+ "@types/node-fetch": "^2.6.13",
44
+ "@types/react": "^19.2.14",
45
+ "@types/react-dom": "^19.2.3",
46
+ "@types/react-test-renderer": "^19.1.0",
47
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
48
+ "@typescript-eslint/parser": "^8.46.2",
49
+ "eslint": "^9.38.0",
50
+ "eslint-config-prettier": "^10.1.8",
51
+ "eslint-plugin-prettier": "^5.5.4",
52
+ "globals": "^17.4.0",
53
+ "jest": "^30.2.0",
54
+ "jest-environment-jsdom": "^30.3.0",
55
+ "prettier": "^3.6.2",
56
+ "react": "^19.2.4",
57
+ "react-dom": "^19.2.4",
58
+ "ts-jest": "^29.4.5",
59
+ "ts-node": "^10.9.2",
60
+ "tsup": "^8.5.1",
61
+ "typescript": "^5.9.3"
62
+ },
63
+ "peerDependencies": {
64
+ "react": ">=16.8.0",
65
+ "react-dom": ">=16.8.0"
66
+ }
67
+ }