react-loadly
Version:
A professional React loaders package with high-performance, customizable loader components
3 lines (2 loc) • 41.9 kB
JavaScript
import e,{useMemo as t,useRef as a,useState as r,useEffect as n,useCallback as i}from"react";function l(e,t){return{...e,...t}}function o(e,t="40px"){return void 0===e?t:"number"==typeof e?`${e}px`:e}function s(e){const t={};return Object.entries(e).forEach(([e,a])=>{void 0!==a&&(t[e]=a)}),t}function d(e,t=1){return`${e/Math.max(t,.1)}ms`}function c(e){return`react-loadly-${e}`}function u(){if("undefined"==typeof window||!window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return!1}}function m(e=1,t=!0){if("undefined"!=typeof process&&"test"===process.env.NODE_ENV)return{duration:"0ms",playState:"paused",iterationCount:1};const a=t&&u();return{duration:a?"0ms":d(1e3,e),playState:a?"paused":"running",iterationCount:a?1:"infinite"}}function y(e="normal"){return e}function p(e="ease"){return e}function g(e,t,a="ease",r="normal",n="infinite"){return`${e} ${t} ${a} ${r} ${n}`}function h(e,t,a){return Math.min(Math.max(e,t),a)}function f(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function v(e,t){const a=f(e);return a?`rgba(${a.r}, ${a.g}, ${a.b}, ${h(t,0,1)})`:e}function b(e="loader"){return`${e}-${Math.random().toString(36).substr(2,9)}`}function x(e){if(null!=e)return"number"==typeof e?`${e}px`:"string"==typeof e?e.replace(/[<>'"]/g,""):void 0}function $(...e){return e.flat().filter(e=>"string"==typeof e&&e.trim()).join(" ")}const w=({size:t=8,color:a="var(--react-loadly-color)",opacity:r=1,className:n="",style:i={},animation:l,animationDuration:s,animationDelay:d,glowIntensity:c=0,"data-testid":u,...m})=>{const y=o(t),p={width:y,height:y,borderRadius:"50%",backgroundColor:a,opacity:r,animation:l?`${l} ${s||"1s"} infinite`:void 0,animationDelay:d,display:"inline-block",boxShadow:c>0?`0 0 ${10*c}px ${a}`:void 0,...i};return e.createElement("div",{className:`react-loadly-dot ${n}`.trim(),style:p,"data-testid":u,...m})},C=({width:t=30,height:a=4,color:r="var(--react-loadly-color)",opacity:n=1,borderRadius:i=2,className:l="",style:s={},animation:d,animationDuration:c,animationDelay:u,orientation:m="horizontal","data-testid":y,...p})=>{const g=o(t),h=o(a),f={width:"vertical"===m?h:g,height:"vertical"===m?g:h,backgroundColor:r,opacity:n,borderRadius:x(i),animation:d?`${d} ${c||"1s"} infinite`:void 0,animationDelay:u,display:"inline-block",...s};return e.createElement("div",{className:`react-loadly-line react-loadly-line-${m} ${l}`.trim(),style:f,"data-testid":y,...p})},E=({width:t=20,height:a=20,color:r="var(--react-loadly-color)",borderColor:n,borderWidth:i=0,borderRadius:l=0,opacity:s=1,className:d="",style:c={},animation:u,animationDuration:m,animationDelay:y,"data-testid":p,...g})=>{const h=o(t),f=o(a),v=x(i),b={width:h,height:f,backgroundColor:n?"transparent":r,border:n?`${v} solid ${n}`:void 0,borderRadius:x(l),opacity:s,animation:u?`${u} ${m||"1s"} infinite`:void 0,animationDelay:y,display:"inline-block",...c};return e.createElement("div",{className:`react-loadly-rectangle ${d}`.trim(),style:b,"data-testid":p,...g})},k=({size:t=20,color:a="var(--react-loadly-color)",borderColor:r,borderWidth:n=0,opacity:i=1,className:l="",style:s={},animation:d,animationDuration:c,animationDelay:u,"data-testid":m,...y})=>{const p=o(t),g=x(n),h={width:p,height:p,borderRadius:"50%",backgroundColor:r?"transparent":a,border:r?`${g} solid ${r}`:void 0,opacity:i,animation:d?`${d} ${c||"1s"} infinite`:void 0,animationDelay:u,display:"inline-block",...s};return e.createElement("div",{className:`react-loadly-circle ${l}`.trim(),style:h,"data-testid":m,...y})},N=({count:t=3,dotSize:a=8,color:r="var(--react-loadly-color)",secondaryColor:n,spacing:i=8,speed:l=1,arrangement:s="linear",className:c="",style:u={},animationType:m="wave","data-testid":y,...p})=>{const g=o(i),h=d(1200,l),f=e=>{if("circular"===s){const a=e/t*2*Math.PI,r=parseInt(g);return{position:"absolute",left:"50%",top:"50%",transform:`translate(-50%, -50%) translate(${Math.cos(a)*r}px, ${Math.sin(a)*r}px)`}}return{}},v=e=>.1*e/l+"s",b={...(()=>{switch(s){case"circular":return{display:"flex",alignItems:"center",justifyContent:"center",position:"relative",width:2*(parseInt(o(a))+parseInt(g))+"px",height:2*(parseInt(o(a))+parseInt(g))+"px"};case"grid":return{display:"grid",gridTemplateColumns:`repeat(${Math.ceil(Math.sqrt(t))}, 1fr)`,gap:g};default:return{display:"flex",alignItems:"center",gap:g}}})(),...u};return e.createElement("div",{className:`react-loadly-dot-cluster react-loadly-dot-cluster-${s} ${c}`.trim(),style:b,"data-testid":y,...p},Array.from({length:t},(t,i)=>e.createElement(w,{key:i,size:a,color:n&&i%2==1?n:r,animation:`react-loadly-${m}`,animationDuration:h,animationDelay:v(i),style:f(i),"data-testid":y?`${y}-dot-${i}`:void 0})))},I=({count:t=5,lineWidth:a=4,lineHeight:r=35,color:n="var(--react-loadly-color)",secondaryColor:i,spacing:l=6,speed:s=1,arrangement:c="parallel",orientation:u="vertical",className:m="",style:y={},animationType:p="wave","data-testid":g,...h})=>{const f=o(l),v=d(1e3,s),b=e=>{if("radial"===c){return{position:"absolute",left:"50%",top:"50%",transformOrigin:"center",transform:`translate(-50%, -50%) rotate(${e/t*2*Math.PI}rad)`}}if("staggered"===c){const a=.3+.7*Math.sin(e/t*Math.PI);return{height:"vertical"===u?parseInt(o(r))*a+"px":o(r)}}return{}},x=e=>.1*e/s+"s",$={...(()=>{switch(c){case"radial":return{display:"flex",alignItems:"center",justifyContent:"center",position:"relative",width:1.5*parseInt(o(r))+"px",height:1.5*parseInt(o(r))+"px"};case"staggered":return{display:"flex",alignItems:"flex-end",justifyContent:"center",gap:f};default:return{display:"flex",alignItems:"center",justifyContent:"center",gap:f}}})(),...y};return e.createElement("div",{className:`react-loadly-line-group react-loadly-line-group-${c} ${m}`.trim(),style:$,"data-testid":g,...h},Array.from({length:t},(t,l)=>e.createElement(C,{key:l,width:"horizontal"===u?a:r,height:"horizontal"===u?r:a,color:i&&l%2==1?i:n,orientation:u,animation:`react-loadly-${p}`,animationDuration:v,animationDelay:x(l),style:b(l),"data-testid":g?`${g}-line-${l}`:void 0})))},z=({count:t=4,shapeSize:a=16,color:r="var(--react-loadly-color)",secondaryColor:n,spacing:i=8,speed:l=1,arrangement:s="linear",shapeTypes:c=["circle","rectangle"],className:u="",style:m={},animationType:y="pulse",borderWidth:p=0,"data-testid":g,...h})=>{const f=o(i),v=d(800,l),b=e=>{if("circular"===s){const a=e/t*2*Math.PI,r=2*parseInt(f);return{position:"absolute",left:"50%",top:"50%",transform:`translate(-50%, -50%) translate(${Math.cos(a)*r}px, ${Math.sin(a)*r}px)`}}if("spiral"===s){const a=e/t*4*Math.PI,r=(e+1)*parseInt(f)/2;return{position:"absolute",left:"50%",top:"50%",transform:`translate(-50%, -50%) translate(${Math.cos(a)*r}px, ${Math.sin(a)*r}px)`}}return{}},x=e=>.15*e/l+"s",$={...(()=>{switch(s){case"circular":return{display:"flex",alignItems:"center",justifyContent:"center",position:"relative",width:2.5*(parseInt(o(a))+parseInt(f))+"px",height:2.5*(parseInt(o(a))+parseInt(f))+"px"};case"spiral":return{display:"flex",alignItems:"center",justifyContent:"center",position:"relative",width:3*(parseInt(o(a))+parseInt(f))+"px",height:3*(parseInt(o(a))+parseInt(f))+"px"};default:return{display:"flex",alignItems:"center",gap:f}}})(),...m},w=t=>{const i=(e=>c[e%c.length])(t),l=n&&t%2==1?n:r,o={key:t,color:p>0?void 0:l,borderColor:p>0?l:void 0,borderWidth:p>0?p:void 0,animation:`react-loadly-${y}`,animationDuration:v,animationDelay:x(t),style:b(t),"data-testid":g?`${g}-shape-${t}`:void 0};return"circle"===i?e.createElement(k,{...o,size:a}):e.createElement(E,{...o,width:a,height:a})};return e.createElement("div",{className:`react-loadly-shape-group react-loadly-shape-group-${s} ${u}`.trim(),style:$,"data-testid":g,...h},Array.from({length:t},(e,t)=>w(t)))},T={size:20,color:"var(--react-loadly-color)",speed:1,loading:!0,count:5,"aria-label":"Loading..."},L=a=>{const r=l(T,a),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},count:y=5,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("bars-loader"),[]),I=o(n),z=m(s);if(!d)return null;const L={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},M={width:"4px",height:I,backgroundColor:i,borderRadius:"2px",animation:`react-loadly-bars ${z.duration} ease-in-out infinite`,animationPlayState:z.playState},D=Array.from({length:y}).map((t,a)=>{const r=.1*a+"s",n=.5+a%3*.25;return e.createElement("div",{key:a,style:{...M,animationDelay:r,height:parseFloat(I)*n+"px"},"data-testid":f?`${f}-bar-${a}`:void 0})});return e.createElement("div",{className:$("react-loadly react-loadly-bars",c),style:L,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"4px"}},D),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},M={size:60,color:"var(--react-loadly-color)",speed:1,loading:!0,fluidity:1,amplitude:1,"aria-label":"Loading..."},D=a=>{const r=l(M,a),{size:n,color:i,secondaryColor:s,speed:c,loading:u,fluidity:m,amplitude:y,className:p="",style:g={},showText:h,loadingText:f="Loading...","aria-label":v,"data-testid":x,...w}=r,C=t(()=>b("blob-loader"),[]),E=o(n),k=d(2500,c);if(!u)return null;const N={display:"inline-flex",flexDirection:"column",alignItems:"center",...g},I={width:E,height:E,background:`linear-gradient(45deg, ${i}, ${s||i})`,borderRadius:"30% 70% 70% 30% / 30% 30% 70% 70%",animation:`blob-morph ${k} ease-in-out infinite`,filter:"blur(1px)",position:"relative"},z={position:"absolute",top:"20%",left:"20%",width:"60%",height:"60%",background:`radial-gradient(circle, ${s||i}, transparent)`,borderRadius:"40% 60% 60% 40% / 40% 40% 60% 60%",animation:`blob-inner ${k} ease-in-out infinite reverse`,opacity:.7};return e.createElement(e.Fragment,null,e.createElement("style",null,`\n @keyframes blob-morph {\n 0%, 100% {\n border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;\n transform: scale(1) rotate(0deg);\n }\n 25% {\n border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;\n transform: scale(${1+.1*(y??1)}) rotate(90deg);\n }\n 50% {\n border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;\n transform: scale(${1-.05*(y??1)}) rotate(180deg);\n }\n 75% {\n border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;\n transform: scale(${1+.08*(y??1)}) rotate(270deg);\n }\n }\n \n @keyframes blob-inner {\n 0%, 100% {\n border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%;\n transform: scale(1) rotate(0deg);\n }\n 33% {\n border-radius: 70% 30% 50% 50% / 30% 70% 30% 70%;\n transform: scale(${1.1+.1*(m??1)}) rotate(-120deg);\n }\n 66% {\n border-radius: 30% 70% 40% 60% / 70% 30% 70% 30%;\n transform: scale(${.9+.05*(m??1)}) rotate(-240deg);\n }\n }\n `),e.createElement("div",{className:$("react-loadly react-loadly-blob",p),style:N,role:"status","aria-label":v,"aria-live":"polite","aria-busy":u,"data-testid":x,...w},e.createElement("div",{style:I,"data-testid":x?`${x}-blob`:void 0},e.createElement("div",{style:z})),h&&e.createElement("div",{className:"react-loadly-text",id:`${C}-text`,"aria-live":"polite"},f),e.createElement("span",{className:"react-loadly-sr-only"},v)))},j={size:15,color:"var(--react-loadly-color)",speed:1,loading:!0,count:3,"aria-label":"Loading..."},R=a=>{const r=l(j,a),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},count:y=3,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("bounce-loader"),[]),I=o(n),z=m(s);if(!d)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},L={width:I,height:I,borderRadius:"50%",backgroundColor:i,animation:`react-loadly-bounce ${z.duration} ease-in-out infinite`,animationPlayState:z.playState},M=Array.from({length:y}).map((t,a)=>{const r=.1*a+"s";return e.createElement("div",{key:a,style:{...L,animationDelay:r},"data-testid":f?`${f}-ball-${a}`:void 0})});return e.createElement("div",{className:$("react-loadly react-loadly-bounce",c),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"8px"}},M),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},W={size:12,color:"var(--react-loadly-color)",speed:1,loading:!0,count:3,"aria-label":"Loading..."},S=a=>{const r=l(W,a),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},count:y=3,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("dots-loader"),[]),I=o(n),z=m(s);if(!d)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},L={width:I,height:I,borderRadius:"50%",backgroundColor:i,animation:`react-loadly-dots ${z.duration} ease-in-out infinite`,animationPlayState:z.playState},M=Array.from({length:y}).map((t,a)=>{const r=.2*a+"s";return e.createElement("div",{key:a,style:{...L,animationDelay:r},"data-testid":f?`${f}-dot-${a}`:void 0})});return e.createElement("div",{className:$("`react-loadly react-loadly-dots",c),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"6px"}},M),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},H={size:60,speed:1,loading:!0,animationType:"spin",glowIntensity:.3,"aria-label":"Loading..."},B=t=>{const a=l(H,t),{size:r,width:n,height:i,speed:o=1,loading:s,animationType:c,glowIntensity:u,className:m="",style:y={},color:p="var(--react-loadly-color)","aria-label":g,loadingText:h,showText:f,"data-testid":v,fullscreen:b,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,children:k,...N}=a;if(!s)return null;const I={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...b&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}},z=n||r,T=i||r,L={width:"number"==typeof z?`${z}px`:z,height:"number"==typeof T?`${T}px`:T,animation:(()=>{switch(c){case"pulse":return`react-loadly-pulse ${d(2e3,o)} infinite`;case"glow":return`react-loadly-glow ${d(2e3,o)} infinite`;case"bounce":return`react-loadly-bounce ${d(2e3,o)} infinite`;case"flip":return`react-loadly-flip ${d(2e3,o)} infinite`;default:return`react-loadly-spin ${d(2e3,o)} infinite`}})(),filter:(u??0)>0?`drop-shadow(0 0 ${20*(u??0)}px ${p})`:void 0,transformStyle:"preserve-3d",willChange:"transform",display:"flex",alignItems:"center",justifyContent:"center"},M={position:"absolute",top:"50%",left:"50%",width:"60%",height:"60%",borderRadius:"50%",backgroundColor:p,opacity:.3,transform:"translate(-50%, -50%)",animation:`react-loadly-pulse ${d(1500,1.5*o)} infinite`,zIndex:-1},D={position:"absolute",top:"50%",left:"50%",width:"120%",height:"120%",borderRadius:"50%",border:`2px solid ${p}`,opacity:.2,transform:"translate(-50%, -50%)",animation:`react-loadly-spin ${d(3e3,.8*o)} infinite reverse`,zIndex:-2};return e.createElement("div",{className:$("`react-loadly react-loadly-element-loader",m),style:I,role:"status","aria-label":g,"aria-live":"polite","aria-busy":s,"data-testid":v,...N},e.createElement("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:D}),e.createElement("div",{style:M}),e.createElement("div",{style:L,className:"react-loadly-element","data-testid":v?`${v}-element`:void 0},k)),f&&e.createElement("div",{className:"react-loadly-text","aria-live":"polite"},h||g),e.createElement("span",{className:"react-loadly-sr-only"},g))},P=({className:t=""})=>e.createElement("svg",{className:t,fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e.createElement("path",{clipRule:"evenodd",fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z"})),A=({className:t=""})=>e.createElement("svg",{className:t,fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e.createElement("path",{fillRule:"evenodd",d:"M9.243 3.03a1 1 0 01.727 1.213L9.53 6h2.94l.56-2.243a1 1 0 111.94.486L14.53 6H16a1 1 0 110 2h-1.97l-1 4H15a1 1 0 110 2h-2.47l-.56 2.242a1 1 0 11-1.94-.485L10.47 14H7.53l-.56 2.242a1 1 0 11-1.94-.485L5.47 14H4a1 1 0 110-2h1.97l1-4H5a1 1 0 110-2h2.47l.56-2.243a1 1 0 011.213-.727zM9.03 8l-1 4h2.94l1-4H9.03z",clipRule:"evenodd"})),F=({className:t=""})=>e.createElement("svg",{className:t,fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),q=({error:t="Something went wrong",onRetry:a,showRetry:r=!0,children:n,type:i="error",className:l="",style:o={},fullscreen:s,screenWidth:d,screenHeight:c,loaderCenter:u,screenBackground:m,...y})=>{const p={...o,...s&&{position:"fixed",top:0,left:0,width:d||"100vw",height:c||"100vh",backgroundColor:m||"var(--react-loadly-error-background)",zIndex:9999,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:u?"center":o.justifyContent}};return n?e.createElement("div",{className:`react-loadly-fallback ${l}`.trim(),style:p,...y},n):e.createElement("div",{className:`react-loadly-error ${l}`.trim(),style:p,role:"alert","aria-live":"polite",...y},(()=>{switch(i){case"network":return e.createElement(A,{className:"react-loadly-error-icon"});case"timeout":return e.createElement(F,{className:"react-loadly-error-icon"});default:return e.createElement(P,{className:"react-loadly-error-icon"})}})(),e.createElement("p",{className:"react-loadly-error-message"},(()=>{switch(i){case"network":return t||"Network connection failed. Please check your internet connection.";case"timeout":return t||"Loading timeout. The operation took too long to complete.";default:return t||"Something went wrong. Please try again."}})()),r&&a&&e.createElement("button",{className:"react-loadly-retry-button",onClick:a,type:"button","aria-label":"Retry loading"},"Try Again"))},X={size:60,color:"var(--react-loadly-color)",speed:1,loading:!0,fluidity:1,amplitude:1,"aria-label":"Loading..."},Y=a=>{const r=l(X,a),{size:n,color:i,secondaryColor:s,speed:c,loading:u,amplitude:m,className:y="",style:p={},showText:g,loadingText:h="Loading...","aria-label":f,"data-testid":v,fullscreen:x,screenWidth:w,screenHeight:C,loaderCenter:E,screenBackground:k,...N}=r,I=t(()=>b("flow-loader"),[]),z=o(n),T=parseInt(z),L=Math.max(.4*T,10),M=d(1500,c);if(!u)return null;const D={display:"inline-flex",flexDirection:"column",alignItems:"center",...p,...x&&{position:"fixed",top:0,left:0,width:w||"100vw",height:C||"100vh",backgroundColor:k||"var(--react-loadly-background)",zIndex:9999,justifyContent:E?"center":p.justifyContent}},j={width:z,height:`${L}px`,position:"relative",overflow:"hidden",borderRadius:`${Math.max(.2*T,4)}px`,backgroundColor:"rgba(0, 0, 0, 0.1)"},R=Math.max(Math.floor(T/15),3);return e.createElement(e.Fragment,null,e.createElement("style",null,`\n @keyframes flow-particle-${I} {\n 0% {\n transform: translateX(0) translateY(0) scale(0);\n opacity: 0;\n }\n 10% {\n transform: translateX(${Math.min(.1*T,10)}px) translateY(${Math.sin(.1)*(m??Math.min(5,L/4))}px) scale(1);\n opacity: 0.8;\n }\n 50% {\n transform: translateX(${Math.min(.5*T,.7*T)}px) translateY(${Math.sin(.5)*(m??Math.min(5,L/4))}px) scale(1);\n opacity: 0.8;\n }\n 90% {\n transform: translateX(${Math.min(.9*T,T-10)}px) translateY(${Math.sin(.9)*(m??Math.min(5,L/4))}px) scale(1);\n opacity: 0.8;\n }\n 100% {\n transform: translateX(${T}px) translateY(${Math.sin(1)*(m??Math.min(5,L/4))}px) scale(0);\n opacity: 0;\n }\n }\n `),e.createElement("div",{className:$("react-loadly react-loadly-flow",y),style:D,role:"status","aria-label":f,"aria-live":"polite","aria-busy":u,"data-testid":v,...N},e.createElement("div",{style:j,"data-testid":v?`${v}-container`:void 0},Array.from({length:R},(t,a)=>(t=>{const a=.2*t/(c??1),r=parseFloat(M)+100*t,n=Math.max(T/10,4),l=n+t%3*(n/2);return e.createElement("div",{key:t,style:{position:"absolute",width:`${l}px`,height:`${l}px`,borderRadius:"50%",background:t%2==0?i:s||i,animation:`flow-particle-${I} ${r}ms ease-in-out infinite`,animationDelay:`${a}s`,opacity:.8-.1*t,left:"0px",top:(L-l)/2+t%3*(L/(R+1))+"px"},"data-testid":v?`${v}-particle-${t}`:void 0})})(a))),g&&e.createElement("div",{className:"react-loadly-text",id:`${I}-text`,"aria-live":"polite"},h),e.createElement("span",{className:"react-loadly-sr-only"},f)))},O={size:40,color:"var(--react-loadly-color)",speed:1,loading:!0,count:4,"aria-label":"Loading..."},V=a=>{const r=l(O,a),{size:n,color:i,secondaryColor:s,speed:d=1,loading:c,count:u,className:m="",style:y={},showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("grid-loader"),[]),I=t(()=>{const e="number"==typeof n?n:parseInt(o(n)),t=Math.ceil(Math.sqrt(u||4));return Math.max(e/(1.5*t),8)},[n,u]);if(!c)return null;const z={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}};return e.createElement("div",{className:$("react-loadly react-loadly-grid",m),style:z,role:"status","aria-label":h,"aria-live":"polite","aria-busy":c,"data-testid":f,...k},e.createElement("div",{className:"react-loadly-grid-container",style:{display:"grid",gridTemplateColumns:`repeat(${Math.ceil(Math.sqrt(u||4))}, 1fr)`,gap:I/3+"px"},"data-testid":f?`${f}-grid`:void 0},Array.from({length:u||4}).map((t,a)=>e.createElement("div",{key:a,className:"react-loadly-grid-item",style:{width:`${I}px`,height:`${I}px`,backgroundColor:a%2==0?i:s||i,borderRadius:"20%",animation:`react-loadly-scale ${1.2/(d||1)}s ease-in-out infinite`,animationDelay:.1*a/(d||1)+"s"}}))),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},U={size:60,color:"var(--react-loadly-color)",speed:1,loading:!0,fluidity:1,amplitude:1,"aria-label":"Loading..."},_=a=>{const r=l(U,a),{size:n,color:i,secondaryColor:s,speed:c,loading:u,amplitude:m,className:y="",style:p={},showText:g,loadingText:h="Loading...","aria-label":f,"data-testid":v,fullscreen:x,screenWidth:w,screenHeight:C,loaderCenter:E,screenBackground:k,...N}=r,I=t(()=>b("liquid-loader"),[]),z=o(n),T=d(2e3,c);if(!u)return null;const L={display:"inline-flex",flexDirection:"column",alignItems:"center",...p,...x&&{position:"fixed",top:0,left:0,width:w||"100vw",height:C||"100vh",backgroundColor:k||"var(--react-loadly-background)",zIndex:9999,justifyContent:E?"center":p.justifyContent}},M={width:z,height:z,position:"relative",overflow:"hidden",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.1)"},D=50-10*(m??1),j={position:"absolute",bottom:0,left:0,width:"200%",height:"200%",background:`linear-gradient(180deg, ${i} 0%, ${s||i} 100%)`,borderRadius:"40%",animation:`react-loadly-liquid-wave ${T} ease-in-out infinite`,transform:"translate(-25%, 50%) rotate(0deg)",animationTimingFunction:"cubic-bezier(0.36, 0.45, 0.63, 0.53)"},R={...j,background:`linear-gradient(180deg, ${s||i} 0%, ${i} 100%)`,animation:`react-loadly-liquid-wave ${T} ease-in-out infinite reverse`,animationDelay:-.5/(c??1)+"s",opacity:.8};return e.createElement(e.Fragment,null,e.createElement("style",null,`\n @keyframes react-loadly-liquid-wave {\n 0%, 100% {\n transform: translate(-25%, 50%) rotate(0deg);\n }\n 50% {\n transform: translate(-25%, ${D}%) rotate(180deg);\n }\n }\n `),e.createElement("div",{className:$("react-loadly react-loadly-liquid",y),style:L,role:"status","aria-label":f,"aria-live":"polite","aria-busy":u,"data-testid":v,...N},e.createElement("div",{style:M,"data-testid":v?`${v}-container`:void 0},e.createElement("div",{style:j}),e.createElement("div",{style:R})),g&&e.createElement("div",{className:"react-loadly-text",id:`${I}-text`,"aria-live":"polite"},h),e.createElement("span",{className:"react-loadly-sr-only"},f)))},G={size:60,speed:1,loading:!0,animationType:"spin",glowIntensity:.3,"aria-label":"Loading...",alt:"Loading"},J=t=>{const a=l(G,t),{src:r,alt:n,size:i,speed:o,loading:s,animationType:c,glowIntensity:u,className:m="",style:y={},color:p="var(--react-loadly-color)","aria-label":g,loadingText:h,showText:f,"data-testid":v,fullscreen:b,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=a;if(!s)return null;const N={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...b&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}},I={width:"number"==typeof i?`${i}px`:i,height:"number"==typeof i?`${i}px`:i,animation:`react-loadly-${c} ${d(2e3,o)} infinite`,filter:(u??0)>0?`drop-shadow(0 0 ${20*(u??0)}px ${p})`:void 0};return e.createElement("div",{className:$("`react-loadly react-loadly-logo-spin",m),style:N,role:"status","aria-label":g,"aria-live":"polite","aria-busy":s,"data-testid":v,...k},e.createElement("img",{src:r,alt:n,style:I,className:"react-loadly-logo","data-testid":v?`${v}-logo`:void 0}),f&&e.createElement("div",{className:"react-loadly-text","aria-live":"polite"},h||g),e.createElement("span",{className:"react-loadly-sr-only"},g))},K={size:40,color:"var(--react-loadly-color)",speed:1,loading:!0,count:3,"aria-label":"Loading..."},Q=a=>{const r=l(K,a),{size:n,color:i,secondaryColor:s,speed:d,loading:c,count:u,className:m="",style:y={},showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,I=t(()=>b("pulse-loader"),[]),z=t(()=>{const e="number"==typeof n?n:parseInt(o(n));return Math.max(e/5,6)},[n]);if(!c)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}};return e.createElement("div",{className:$("react-loadly react-loadly-pulse",m),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":c,"data-testid":f,...k},e.createElement(N,{count:u,dotSize:z,color:i,secondaryColor:s,speed:d,arrangement:"linear",animationType:"pulse",spacing:z/2,"data-testid":f?`${f}-dots`:void 0}),p&&e.createElement("div",{className:"react-loadly-text",id:`${I}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},Z={size:60,color:"var(--react-loadly-color)",speed:1,loading:!0,borderWidth:4,"aria-label":"Loading..."},ee=t=>{const r=l(Z,t),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},borderWidth:y,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=a(b("ring-loader")),I=o(n),z=m(s);if(!d)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},L={position:"relative",width:I,height:I},M={boxSizing:"border-box",display:"block",position:"absolute",width:I,height:I,border:`${y}px solid transparent`,borderTop:`${y}px solid ${i}`,borderBottom:`${y}px solid ${i}`,borderRadius:"50%",animation:`react-loadly-ring ${z.duration} cubic-bezier(0.5, 0, 0.5, 1) infinite`,animationPlayState:z.playState},D=Array.from({length:4}).map((t,a)=>{const r=90*a+"deg",n=-.15*a+"s";return e.createElement("div",{key:a,style:{...M,transform:`rotate(${r})`,animationDelay:n},"data-testid":f?`${f}-segment-${a}`:void 0})});return e.createElement("div",{className:$("react-loadly react-loadly-ring",c),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:L},D),p&&e.createElement("div",{className:"react-loadly-text",id:`${N.current}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},te={size:15,color:"var(--react-loadly-color)",speed:1,loading:!0,count:2,"aria-label":"Loading..."},ae=a=>{const r=l(te,a),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},count:y=2,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("rotate-loader"),[]),I=o(n),z=m(s);if(!d)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},L={position:"relative",width:I,height:I},M={position:"absolute",width:I,height:I,border:"2px solid transparent",borderTopColor:i,borderBottomColor:i,borderRadius:"50%",animation:`react-loadly-ring ${z.duration} cubic-bezier(0.5, 0, 0.5, 1) infinite`,animationPlayState:z.playState,transform:"rotate(0deg)"},D=Array.from({length:y}).map((t,a)=>{const r=1-.2*a,n=2+a,i=-.15*a+"s";return e.createElement("div",{key:a,style:{...M,width:parseFloat(I)*r+"px",height:parseFloat(I)*r+"px",borderWidth:`${n}px`,animationDuration:parseFloat(z.duration)*(1+.5*a)+"ms",animationDelay:i},"data-testid":f?`${f}-element-${a}`:void 0})});return e.createElement("div",{className:$("react-loadly react-loadly-rotate",c),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:L},D),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},re={size:40,speed:1,loading:!0,lines:1,variant:"card",shimmer:!0,color:"#e2e8f0",highlightColor:"#f1f5f9",shimmerColor:"rgba(255, 255, 255, 0.6)",borderRadius:"4px",spacing:"8px",waveWidth:"200px",waveDirection:"left-to-right","aria-label":"Loading content..."},ne=t=>{const a=l(re,t),{size:r,width:n,height:i,speed:s,loading:d,className:c="",style:u={},lines:m=1,variant:y,borderRadius:p,spacing:g,shimmer:h,color:f,highlightColor:v,shimmerColor:b,waveWidth:x,waveDirection:w,showText:C,loadingText:E="Loading content...","aria-label":k,"data-testid":N,fullscreen:I,screenWidth:z,screenHeight:T,loaderCenter:L,screenBackground:M,...D}=a;if(!d)return null;const j={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...I&&{position:"fixed",top:0,left:0,width:z||"100vw",height:T||"100vh",backgroundColor:M||"var(--react-loadly-background)",zIndex:9999,justifyContent:L?"center":u.justifyContent}},R=(()=>{switch(y){case"avatar":return{width:n||r||"40px",height:i||r||"40px",borderRadius:p||"50%"};case"card":return{width:n||r||"300px",height:i||r||"200px",borderRadius:p||"8px"};default:return{width:n||r||"100%",height:i||r||"16px",borderRadius:p||"4px"}}})(),W=o(g,"8px"),S=o(x,"200px"),H={...{width:o(R.width),height:o(R.height),backgroundColor:f,borderRadius:o(R.borderRadius),position:"relative",overflow:"hidden"},...h&&{background:`linear-gradient(${"left-to-right"===w?"90deg":"right-to-left"===w?"270deg":"top-to-bottom"===w?"180deg":"0deg"}, ${f} 0%, ${v} 50%, ${f} 100%)`,backgroundSize:`${S} 100%`,animation:`react-loadly-shimmer ${1.5/(s||1)}s ease-in-out infinite`}};return e.createElement("div",{className:$("react-loadly react-loadly-skeleton",c),style:j,role:"status","aria-label":k,"aria-live":"polite","aria-busy":d,"data-testid":N,...D},e.createElement("div",{style:{display:"flex",flexDirection:"column",width:"100%"}},"card"===y?e.createElement("div",{style:H,"data-testid":N?`${N}-skeleton`:void 0},h&&e.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:`linear-gradient(90deg, transparent, ${b}, transparent)`,animation:`react-loadly-shimmer-overlay ${1.5/(s||1)}s ease-in-out infinite`}})):"avatar"===y?e.createElement("div",{style:H,"data-testid":N?`${N}-skeleton`:void 0},h&&e.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:"50%",background:`linear-gradient(90deg, transparent, ${b}, transparent)`,animation:`react-loadly-shimmer-overlay ${1.5/(s||1)}s ease-in-out infinite`}})):Array.from({length:m},(t,a)=>{const r=a===m-1&&m>1?"60%":"100%";return e.createElement("div",{key:a,style:{...H,width:r,marginBottom:a<m-1?W:0},"data-testid":N?`${N}-skeleton-${a}`:void 0},h&&e.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:`linear-gradient(90deg, transparent, ${b}, transparent)`,animation:`react-loadly-shimmer-overlay ${1.5/(s||1)}s ease-in-out infinite`,animationDelay:.1*a+"s"}}))})),C&&e.createElement("div",{className:"react-loadly-text","aria-live":"polite"},E),e.createElement("span",{className:"react-loadly-sr-only"},k))},ie={size:40,color:"var(--react-loadly-color)",speed:1,loading:!0,borderWidth:4,"aria-label":"Loading..."},le=t=>{const r=l(ie,t),{size:n,color:i,speed:s,loading:d,className:c="",style:u={},borderWidth:y,showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=a(b("spin-loader")),I=o(n),z=m(s);if(!d)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...u,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":u.justifyContent}},L={width:I,height:I,border:`${y}px solid transparent`,borderTop:`${y}px solid ${i}`,borderRadius:"50%",animation:`react-loadly-spin ${z.duration} linear infinite`,animationPlayState:z.playState};return e.createElement("div",{className:$("react-loadly react-loadly-spin",c),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":d,"data-testid":f,...k},e.createElement("div",{style:L,"data-testid":f?`${f}-spinner`:void 0}),p&&e.createElement("div",{className:"react-loadly-text",id:`${N.current}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},oe={speed:1,loading:!0,charDelay:100,"aria-label":"Loading...",loop:!0},se=t=>{const i=l(oe,t),{loadingText:o="loading...",speed:s=1,loading:d,charDelay:c=100,loop:u,className:m="",style:y={},color:p="var(--react-loadly-text-color)",fontFamily:g,fontWeight:h=500,"aria-label":f,"data-testid":v,fullscreen:b,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,size:k=18,...N}=i,[I,z]=r(""),[T,L]=r(!1),M=a(null);if(n(()=>{if(M.current&&(clearTimeout(M.current),M.current=null),!d||!o)return void z("");L(!0),z("");const e=(t=0)=>{t<o.length?(z(o.substring(0,t+1)),M.current=setTimeout(()=>e(t+1),c/s)):u?M.current=setTimeout(()=>{z(""),e(0)},2*c):L(!1)};return e(0),()=>{M.current&&clearTimeout(M.current)}},[d,o,c,s,u]),!d)return null;const D={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...b&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}},j={color:p,fontFamily:g,fontWeight:h,fontSize:k,whiteSpace:"pre"};return e.createElement("div",{className:$("react-loadly react-loadly-typing",m),style:D,role:"status","aria-label":f,"aria-live":"polite","aria-busy":d,"data-testid":v,...N},e.createElement("div",{style:j,"data-testid":v?`${v}-text`:void 0},I,e.createElement("span",{className:"react-loadly-typing-cursor",style:{display:T?"inline-block":"none",animation:`react-loadly-blink ${1/s}s step-end infinite`,marginLeft:"2px",verticalAlign:"baseline"}},"|")),e.createElement("span",{className:"react-loadly-sr-only"},f))},de={size:40,color:"var(--react-loadly-color)",speed:1,loading:!0,count:5,"aria-label":"Loading..."},ce=a=>{const r=l(de,a),{size:n,color:i,secondaryColor:s,speed:d,loading:c,count:u,className:m="",style:y={},showText:p,loadingText:g="Loading...","aria-label":h,"data-testid":f,fullscreen:v,screenWidth:x,screenHeight:w,loaderCenter:C,screenBackground:E,...k}=r,N=t(()=>b("wave-loader"),[]),z=t(()=>{const e="number"==typeof n?n:parseInt(o(n));return{width:Math.max(e/10,3),height:e,spacing:Math.max(e/8,4)}},[n]);if(!c)return null;const T={display:"inline-flex",flexDirection:"column",alignItems:"center",...y,...v&&{position:"fixed",top:0,left:0,width:x||"100vw",height:w||"100vh",backgroundColor:E||"var(--react-loadly-background)",zIndex:9999,justifyContent:C?"center":y.justifyContent}};return e.createElement("div",{className:$("react-loadly react-loadly-wave",m),style:T,role:"status","aria-label":h,"aria-live":"polite","aria-busy":c,"data-testid":f,...k},e.createElement(I,{count:u,lineWidth:z.width,lineHeight:z.height,color:i,secondaryColor:s,speed:d,arrangement:"staggered",orientation:"vertical",animationType:"wave",spacing:z.spacing,"data-testid":f?`${f}-lines`:void 0}),p&&e.createElement("div",{className:"react-loadly-text",id:`${N}-text`,"aria-live":"polite"},g),e.createElement("span",{className:"react-loadly-sr-only"},h))},ue=(e={})=>{const{initialLoading:t=!1,timeout:l,maxRetries:o=3,onLoadingChange:s,onError:d,onProgress:c}=e,[u,m]=r({isLoading:t,progress:0,error:null,retryCount:0}),y=a(null),p=a(null);n(()=>()=>{y.current&&clearTimeout(y.current),p.current&&clearTimeout(p.current)},[]),n(()=>(u.isLoading&&l?y.current=setTimeout(()=>{m(e=>({...e,isLoading:!1,error:"Loading timeout exceeded"})),d?.("Loading timeout exceeded")},l):y.current&&clearTimeout(y.current),()=>{y.current&&clearTimeout(y.current)}),[u.isLoading,l,d]),n(()=>{s?.(u.isLoading)},[u.isLoading,s]),n(()=>{void 0!==u.progress&&c?.(u.progress)},[u.progress,c]);const g=i(e=>{m(t=>({...t,isLoading:e,error:e?null:t.error,progress:e?0:t.progress}))},[]),h=i(e=>{const t=Math.min(Math.max(e,0),100);m(e=>({...e,progress:t,isLoading:!(t>=100)&&e.isLoading}))},[]),f=i(e=>{m(t=>({...t,error:e,isLoading:!1})),e&&d?.(e)},[d]),v=i(()=>{m(e=>{const t=(e.retryCount||0)+1;return t>o?(d?.("Maximum retry attempts exceeded"),{...e,error:"Maximum retry attempts exceeded",isLoading:!1}):{...e,retryCount:t,isLoading:!0,error:null,progress:0}});const e=Math.min(1e3*Math.pow(2,u.retryCount||0),3e4);p.current=setTimeout(()=>{m(e=>({...e,isLoading:!0}))},e)},[u.retryCount,o,d]),b=i(()=>{m({isLoading:!1,progress:0,error:null,retryCount:0}),y.current&&clearTimeout(y.current),p.current&&clearTimeout(p.current)},[]);return{state:u,setLoading:g,setProgress:h,setError:f,retry:v,reset:b}},me=(e,t={})=>e.reduce((e,a)=>(e[a]=ue(t),e),{}),ye=(e,t=[],a={})=>{const l=ue(a),[o,s]=r(null),d=i(async()=>{try{l.setLoading(!0),l.setError(null);const t=await e();return s(t),l.setProgress(100),t}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return l.setError(e),null}},[e,l]);return n(()=>{d()},t),{...l,data:o,execute:d}};export{L as BarsLoader,D as BlobLoader,R as BounceLoader,k as Circle,w as Dot,N as DotCluster,S as DotsLoader,B as ElementLoader,q as FallbackLoader,Y as FlowLoader,V as GridLoader,C as Line,I as LineGroup,_ as LiquidLoader,J as LogoSpinLoader,Q as PulseLoader,E as Rectangle,ee as RingLoader,ae as RotateLoader,z as ShapeGroup,ne as SkeletonLoader,le as SpinLoader,se as TypingLoader,ce as WaveLoader,h as clamp,$ as classNameGen,c as createAnimationName,g as createAnimationString,s as generateCSSVariables,b as generateId,y as getAnimationDirection,d as getAnimationDuration,p as getAnimationEasing,m as getOptimizedAnimationSettings,o as getSizeValue,f as hexToRgb,l as mergeProps,u as prefersReducedMotion,v as rgba,x as sanitizeCSSValue,ye as useAsyncLoader,ue as useLoaderState,me as useMultipleLoaderStates};
//# sourceMappingURL=index.esm.js.map