1function e(e){let t=e.querySelector(`canvas`);if(!t)return;let n=e.dataset,r=n.colorLight||`#FAFAFA`,i=n.colorBlue||`#ADCFE4`,a=n.ellipseColor||`#FFFFFF`,o=parseFloat(n.angle||`0.0783`),s=parseFloat(n.speed||`1`),c=parseFloat(n.flowAmount||`1`),l=n.interactive===`true`,u=n.animate!==`false`,d=parseFloat(n.mouseStrength||`0.7`),f=parseFloat(n.softness||`0.22`),p=parseFloat(n.ellipseX||`0.3325`),m=parseFloat(n.ellipseY||`0.7568`),h=parseFloat(n.ellipseSize||`1`),g=parseFloat(n.fps||`60`),_=parseFloat(n.renderScale||`0.6`),v=parseFloat(n.maxDpi||`1.5`),y=typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,b=typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: none), (pointer: coarse)`).matches;e.style.background=`linear-gradient(150deg, ${r}, ${i})`;let x=!1,S=0,C=null,w=()=>{if(x)return;let n=t.getContext(`webgl`,{antialias:!1,premultipliedAlpha:!1,powerPreference:`low-power`,depth:!1,stencil:!1})||t.getContext(`experimental-webgl`);if(!n)return;let S=(e,t)=>{let r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),n.getShaderParameter(r,n.COMPILE_STATUS)?r:(console.error(`[MediPulseGradient] Shader:`,n.getShaderInfoLog(r)),n.deleteShader(r),null)},w=S(n.VERTEX_SHADER,` 2 attribute vec2 aPos; 3 varying vec2 vUv; 4 void main() { 5 vUv = aPos * 0.5 + 0.5; 6 gl_Position = vec4(aPos, 0.0, 1.0); 7 } 8 `),T=S(n.FRAGMENT_SHADER,` 9 precision highp float; 10 varying vec2 vUv; 11 uniform vec2 uRes; 12 uniform float uTime; 13 uniform vec2 uMouse; 14 uniform float uMouseStrength; 15 uniform float uGradSpeed; 16 uniform float uFlowSpeed; 17 uniform float uFlow; 18 uniform float uAngle; 19 uniform float uSoft; 20 uniform float uSize; 21 uniform vec2 uCenter; 22 uniform vec3 uC0; 23 uniform vec3 uC1; 24 uniform vec3 uEllipse; 25 26 const float PI = 3.14159265359; 27 28 vec2 rot(vec2 c, float a){ 29 float s = sin(a), co = cos(a); 30 return vec2(c.x*co - c.y*s, c.x*s + c.y*co); 31 } 32 33 vec3 linear_from_srgb(vec3 c){ return pow(max(c, 0.0), vec3(2.2)); } 34 vec3 srgb_from_linear(vec3 c){ return pow(max(c, 0.0), vec3(1.0/2.2)); } 35 vec3 safeCbrt(vec3 v){ return sign(v) * pow(abs(v), vec3(1.0/3.0)); } 36 vec3 oklab_mix(vec3 lin1, vec3 lin2, float a){ 37 const mat3 k1 = mat3( 38 0.4121656120, 0.2118591070, 0.0883097947, 39 0.5362752080, 0.6807189584, 0.2818474174, 40 0.0514575653, 0.1074065790, 0.6302613616); 41 const mat3 k2 = mat3( 42 4.0767245293, -1.2681437731, -0.0041119885, 43 -3.3072168827, 2.6093323231, -0.7034763098, 44 0.2307590544, -0.3411344290, 1.7068625689); 45 vec3 l1 = safeCbrt(k1 * lin1); 46 vec3 l2 = safeCbrt(k1 * lin2); 47 vec3 l = mix(l1, l2, a); 48 l *= 1.0 + 0.025 * a * (1.0 - a); 49 return k2 * (l * l * l); 50 } 51 vec3 gradientColor(float p){ 52 p = clamp(p, 0.0, 1.0); 53 return srgb_from_linear(oklab_mix( 54 linear_from_srgb(uC0), 55 linear_from_srgb(uC1), p)); 56 } 57 58 vec3 hash33(vec3 p3){ 59 p3 = fract(p3 * vec3(0.1031, 0.11369, 0.13787)); 60 p3 += dot(p3, p3.yxz + 19.19); 61 return -1.0 + 2.0 * fract(vec3( 62 (p3.x + p3.y) * p3.z, 63 (p3.x + p3.z) * p3.y, 64 (p3.y + p3.z) * p3.x)); 65 } 66 float perlin(vec3 p){ 67 vec3 pi = floor(p); 68 vec3 pf = p - pi; 69 vec3 w = pf * pf * (3.0 - 2.0 * pf); 70 float n000 = dot(pf - vec3(0.,0.,0.), hash33(pi + vec3(0.,0.,0.))); 71 float n100 = dot(pf - vec3(1.,0.,0.), hash33(pi + vec3(1.,0.,0.))); 72 float n010 = dot(pf - vec3(0.,1.,0.), hash33(pi + vec3(0.,1.,0.))); 73 float n110 = dot(pf - vec3(1.,1.,0.), hash33(pi + vec3(1.,1.,0.))); 74 float n001 = dot(pf - vec3(0.,0.,1.), hash33(pi + vec3(0.,0.,1.))); 75 float n101 = dot(pf - vec3(1.,0.,1.), hash33(pi + vec3(1.,0.,1.))); 76 float n011 = dot(pf - vec3(0.,1.,1.), hash33(pi + vec3(0.,1.,1.))); 77 float n111 = dot(pf - vec3(1.,1.,1.), hash33(pi + vec3(1.,1.,1.))); 78 float nx00 = mix(n000, n100, w.x); 79 float nx01 = mix(n001, n101, w.x); 80 float nx10 = mix(n010, n110, w.x); 81 float nx11 = mix(n011, n111, w.x); 82 float nxy0 = mix(nx00, nx10, w.y); 83 float nxy1 = mix(nx01, nx11, w.y); 84 return mix(nxy0, nxy1, w.z); 85 } 86 87 vec2 flow(vec2 st, float aspect){ 88 vec2 aspectVec = vec2(aspect, 1.0); 89 vec2 invPos = vec2(0.5); 90 float sprd = (0.20 + 0.01) / ((aspect + 1.0) / 2.0); 91 float freq = 5.0 * sprd; 92 float amt = 0.012 * uFlow; 93 float t = 0.05 + uTime * 0.0166 * uFlowSpeed; 94 float rad = 6.0 * PI; 95 for (int i = 0; i < 8; i++) { 96 vec2 cst = clamp(st, -1.0, 2.0); 97 vec2 scaled = (cst - 0.5) * aspectVec + invPos; 98 float p = perlin(vec3((scaled - 0.5) * freq, t)) - 0.5; 99 float ang = p * rad; 100 st += vec2(cos(ang), sin(ang)) * amt; 101 } 102 return clamp(st, 0.0, 1.0); 103 } 104 105 float sdEllipse(vec2 p, vec2 ab){ 106 vec2 q = p / ab; 107 return (length(q) - 1.0) * min(ab.x, ab.y); 108 } 109 110 float hash21(vec2 p){ 111 return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); 112 } 113 114 void main(){ 115 float aspect = uRes.x / max(uRes.y, 1.0); 116 vec2 uvf = flow(vUv, aspect); 117 vec2 uv0 = vec2(uvf.x, 1.0 - uvf.y); 118 119 vec2 g = rot(uv0 - 0.5, (uAngle - 0.5) * 2.0 * PI); 120 float pos = (g.x + 0.5) - uTime * 0.01 * uGradSpeed; 121 float cyc = floor(pos); 122 float ap = mod(cyc, 2.0) < 0.5 123 ? 1.0 - fract(pos) 124 : fract(pos); 125 vec3 col = gradientColor(ap); 126 127 vec2 suv = uv0 - (uMouse - 0.5) * uMouseStrength; 128 vec2 px = suv * uRes; 129 float absH = uRes.y * uSize; 130 float absW = absH * 0.9823; 131 vec2 ctr = uCenter * uRes; 132 float d = sdEllipse(px - ctr, vec2(absW, absH) * 0.5); 133 float soft = uSoft * uRes.y; 134 float alpha = 1.0 - smoothstep(-soft, soft, d); 135 col = mix(col, uEllipse, alpha); 136
137 float dith = (hash21(uv0 * uRes) - 0.5) / 255.0; 138 col += dith; 139 140 gl_FragColor = vec4(col, 1.0); 141 } 142 `);if(!w||!T)return;let E=n.createProgram();if(n.attachShader(E,w),n.attachShader(E,T),n.linkProgram(E),!n.getProgramParameter(E,n.LINK_STATUS)){console.error(`[MediPulseGradient] Link:`,n.getProgramInfoLog(E));return}n.useProgram(E);let D=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,D),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),n.STATIC_DRAW);let O=n.getAttribLocation(E,`aPos`);n.enableVertexAttribArray(O),n.vertexAttribPointer(O,2,n.FLOAT,!1,0,0);let k={res:n.getUniformLocation(E,`uRes`),time:n.getUniformLocation(E,`uTime`),mouse:n.getUniformLocation(E,`uMouse`),mouseStrength:n.getUniformLocation(E,`uMouseStrength`),gradSpeed:n.getUniformLocation(E,`uGradSpeed`),flowSpeed:n.getUniformLocation(E,`uFlowSpeed`),flow:n.getUniformLocation(E,`uFlow`),angle:n.getUniformLocation(E,`uAngle`),soft:n.getUniformLocation(E,`uSoft`),size:n.getUniformLocation(E,`uSize`),center:n.getUniformLocation(E,`uCenter`),c0:n.getUniformLocation(E,`uC0`),c1:n.getUniformLocation(E,`uC1`),ellipse:n.getUniformLocation(E,`uEllipse`)},A=e=>{let t=String(e).trim();if(t[0]===`#`){let e=t.slice(1);e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let n=parseInt(e.slice(0,6),16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}let n=t.match(/[\d.]+/g);return n&&n.length>=3?[n[0]/255,n[1]/255,n[2]/255]:[1,1,1]};n.uniform3fv(k.c0,A(r)),n.uniform3fv(k.c1,A(i)),n.uniform3fv(k.ellipse,A(a)),n.uniform1f(k.gradSpeed,.25*s),n.uniform1f(k.flowSpeed,.3*s),n.uniform1f(k.flow,c),n.uniform1f(k.angle,o),n.uniform1f(k.soft,f),n.uniform1f(k.size,h),n.uniform2f(k.center,p,m),n.uniform1f(k.mouseStrength,l?d:0);let j={x:.5,y:.5},M={x:.5,y:.5},N=t=>{let n=e.getBoundingClientRect();M.x=(t.clientX-n.left)/Math.max(n.width,1),M.y=(t.clientY-n.top)/Math.max(n.height,1)},P=t=>{if(!t.touches.length)return;let n=e.getBoundingClientRect();M.x=(t.touches[0].clientX-n.left)/Math.max(n.width,1),M.y=(t.touches[0].clientY-n.top)/Math.max(n.height,1)};l&&!b&&(window.addEventListener(`mousemove`,N,{passive:!0}),window.addEventListener(`touchmove`,P,{passive:!0}));let F=Math.min(window.devicePixelRatio||1,v)*Math.max(.25,Math.min(1,_)),I=()=>{let r=Math.max(1,e.clientWidth),i=Math.max(1,e.clientHeight);t.width=Math.max(1,Math.round(r*F)),t.height=Math.max(1,Math.round(i*F)),n.viewport(0,0,t.width,t.height),n.uniform2f(k.res,t.width,t.height)};I();let L=new ResizeObserver(()=>{I(),W||G(0)});L.observe(e);let R=!0,z=new IntersectionObserver(e=>{R=e[0]?.isIntersecting??!0,R&&q()},{threshold:0});z.observe(e),t.style.opacity=`0`,t.style.transition=`opacity 600ms ease`;let B=0,V=40,H=0,U=g>0?1e3/g:0,W=u&&!y&&!b,G=e=>{V+=e*60*s,j.x=M.x,j.y=M.y,n.uniform1f(k.time,V),n.uniform2f(k.mouse,j.x,j.y),n.drawArrays(n.TRIANGLES,0,6),t.style.opacity===`0`&&(t.style.opacity=`1`)},K=e=>{if(!R||document.hidden){B=0;return}B=requestAnimationFrame(K);let t=e-H;if(U&&t<U)return;let n=Math.min(t/1e3,.1);H=e,G(n)},q=()=>{!W||B||!R||document.hidden||(H=performance.now(),B=requestAnimationFrame(K))},J=()=>{document.hidden||q()};document.addEventListener(`visibilitychange`,J),G(0),q(),C=()=>{cancelAnimationFrame(B),L.disconnect(),z.disconnect(),document.removeEventListener(`visibilitychange`,J),window.removeEventListener(`mousemove`,N),window.removeEventListener(`touchmove`,P),n.deleteProgram(E),n.deleteShader(w),n.deleteShader(T),n.deleteBuffer(D)}},T=window;S=typeof T.requestIdleCallback==`function`?T.requestIdleCallback(w,{timeout:1500}):window.setTimeout(w,300),window.addEventListener(`pagehide`,()=>{if(x=!0,S){let e=window;typeof e.cancelIdleCallback==`function`?e.cancelIdleCallback(S):clearTimeout(S)}C?.()})}document.querySelectorAll(`[data-mpg]`).forEach(e);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.