/* Socket Lib - Built with esbuild */
var y=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var A=(e,r)=>{for(var t in r)y(e,t,{get:r[t],enumerable:!0})},E=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of G(r))!M.call(e,o)&&o!==t&&y(e,o,{get:()=>r[o],enumerable:!(n=O(r,o))||n.enumerable});return e};var N=e=>E(y({},"__esModule",{value:!0}),e);var H={};A(H,{COLOR_INHERIT:()=>j,DIR_LTR:()=>p,DIR_NONE:()=>x,DIR_RANDOM:()=>a,DIR_RTL:()=>u,MODE_BI:()=>_,applyShimmer:()=>B});module.exports=N(H);var l=require("../ansi"),$=require("../arrays"),C=require("#env/ci");function k(e){return{__proto__:null,bold:/\x1b\[1m/.test(e),dim:/\x1b\[2m/.test(e),italic:/\x1b\[3m/.test(e),strikethrough:/\x1b\[9m/.test(e),underline:/\x1b\[4m/.test(e)}}function D(e){let r="";return e.bold&&(r+="\x1B[1m"),e.dim&&(r+="\x1B[2m"),e.italic&&(r+="\x1B[3m"),e.underline&&(r+="\x1B[4m"),e.strikethrough&&(r+="\x1B[9m"),r}const j="inherit",p="ltr",x="none",a="random",u="rtl",_="bi";function w(e,r=2.5){return e>r?0:(1-e/r)**2.5}function z(e,r,t){const n=Math.round(e[0]+(r[0]-e[0])*t),o=Math.round(e[1]+(r[1]-e[1])*t),s=Math.round(e[2]+(r[2]-e[2])*t);return[n,o,s]}function L(e,r,t,n,o){const s=Math.abs(r-t),m=w(s),b=D(o),i=(0,$.isArray)(n[0])?n[r%n.length]??[140,82,255]:n;if(m===0){const h=`\x1B[38;2;${i[0]};${i[1]};${i[2]}m`;return`${b}${h}${e}${l.ANSI_RESET}`}const d=z(i,[255,255,255],m),c=`\x1B[38;2;${d[0]};${d[1]};${d[2]}m`;return`${b}${c}${e}${l.ANSI_RESET}`}function P(e,r,t,n=2.5){const o=e+n+2;return t===u?e-r%o:r%o}function W(e){return e===a?Math.random()<.5?p:u:e===u?u:p}function B(e,r,t){const n={__proto__:null,...t},o=n.direction??x,s=n.shimmerWidth??2.5,m=n.color??[140,82,255],b=n.styles??k(e),i=(0,l.stripAnsi)(e);if((0,C.getCI)()||!i||o===x){const h=D(b),S=(0,$.isArray)(m[0]);return i.split("").map((R,T)=>{const f=S?m[T%m.length]??[140,82,255]:m,I=`\x1B[38;2;${f[0]};${f[1]};${f[2]}m`;return`${h}${I}${R}${l.ANSI_RESET}`}).join("")}const g=P(i.length,r.step,r.currentDir,s),d=i.split("").map((h,S)=>L(h,S,g,m,b)).join("");r.step+=r.speed;const c=i.length+s+2;return r.mode===_?r.step>=c&&(r.step=0,r.currentDir=r.currentDir===p?u:p):r.mode===a?r.step>=c&&(r.step=0,r.currentDir=W(a)):r.step>=c&&(r.step=0),d}0&&(module.exports={COLOR_INHERIT,DIR_LTR,DIR_NONE,DIR_RANDOM,DIR_RTL,MODE_BI,applyShimmer});
//# sourceMappingURL=text-shimmer.js.map
