oops-ui 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/BackgroundRipple/index.cjs +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/styles/common.css +7 -5
  6. package/dist/styles/common.scss +8 -5
  7. package/dist/types/components/ripples/RipplesEle.d.ts +1 -1
  8. package/dist/types/customHooks/useRipples/defaultData.d.ts +2 -12
  9. package/dist/types/customHooks/useRipples/index.d.ts +1 -1
  10. package/dist/types/customHooks/useRipples/init/hideCssBackground.d.ts +9 -0
  11. package/dist/types/customHooks/useRipples/init/initEvent.d.ts +5 -0
  12. package/dist/types/customHooks/useRipples/init/initGL.d.ts +5 -0
  13. package/dist/types/customHooks/useRipples/init/initShaders.d.ts +7 -0
  14. package/dist/types/customHooks/useRipples/init/initTexture.d.ts +7 -0
  15. package/dist/types/customHooks/useRipples/init/loadImage.d.ts +13 -0
  16. package/dist/types/customHooks/useRipples/render/computeTextureBoundaries.d.ts +7 -0
  17. package/dist/types/customHooks/useRipples/render/drawQuad.d.ts +7 -0
  18. package/dist/types/customHooks/useRipples/render/dropAtPointer.d.ts +7 -0
  19. package/dist/types/customHooks/useRipples/render/render.d.ts +7 -0
  20. package/dist/types/customHooks/useRipples/render/step.d.ts +6 -0
  21. package/dist/types/customHooks/useRipples/render/swapBufferIndices.d.ts +2 -0
  22. package/dist/types/customHooks/useRipples/render/update.d.ts +2 -0
  23. package/dist/types/customHooks/useRipples/rippersData/renderData.d.ts +85 -0
  24. package/dist/types/customHooks/useRipples/rippersData/vertexSource.d.ts +28 -0
  25. package/dist/types/customHooks/useRipples/ripple.html.d.ts +3 -0
  26. package/dist/types/customHooks/useRipples/ripplesClass.d.ts +12 -17
  27. package/dist/types/customHooks/useRipples/tools.d.ts +1 -25
  28. package/dist/useRipples/index.cjs +1 -1
  29. package/package.json +3 -7
  30. package/dist/BackgroundRipple/index.mjs +0 -1
  31. package/dist/types/customHooks/useRipples/interface.d.ts +0 -159
  32. package/dist/useAnimationFrame/index.mjs +0 -1
  33. package/dist/useInputIsComposing/index.mjs +0 -1
  34. package/dist/useRipples/index.mjs +0 -1
  35. package/dist/useTimeId/index.mjs +0 -1
@@ -1 +1 @@
1
- (()=>{"use strict";var e={982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,l=/uniform (\w+) (\w+)/g;null!==(o=l.exec(s));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(e){return e.endsWith("%")}function u(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var l=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){l=i[u];break}return l}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(u,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,j=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,C,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,I,void 0),P(n,j,[]),P(n,B,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var l=n.gl,u=1/O(M,n);k(I,n,new Float32Array([u,u])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return l.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=l.createTexture(),m=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,m),l.bindTexture(l.TEXTURE_2D,p),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,h.linearSupport?l.LINEAR:l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,O(M,n),O(M,n),0,l.RGBA,h.type,f),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,p,0),O(j,n).push(p),O(B,n).push(m)}return k(N,n,l.createBuffer()),l.bindBuffer(l.ARRAY_BUFFER,O(N,n)),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),l.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),l.clearColor(0,0,0,0),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(C,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,l=Math.max(o,a);r/=l;var u=new Float32Array([(2*e-o)/l,(a-2*t)/l]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,u),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,le).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,ue).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function le(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function ue(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(C,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,le).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(B,this)[O(W,this)]),Reflect.apply(s,this,[O(j,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,le).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):l(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var u=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*u,r=O(Z,this)*u}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,l(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),l(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=l(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=l(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(I,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(I,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect(),s=e.clientX-a.left-i,l=e.clientY-a.top-o;this.drop(s,l,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>s});var i=r(953),o=r.n(i),a=r(982);function s(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,a.useRipples)(t,e),e),e.children?o().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,o().createElement("canvas",{ref:t})):o().createElement("canvas",{ref:t})}module.exports["oops-ui"]=n})();
1
+ (()=>{"use strict";var e={231:(e,t,r)=>{r.d(t,{useRipples:()=>$});var n=r(953);const i=require("a-element-inline-style");function o(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var l=e+t,s=/uniform (\w+) (\w+)/g;null!==(o=s.exec(l));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),l=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,l),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var s=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){s=i[u];break}return s}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var h="lmssee_ripper_element_style",d=c((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"styleElement",document.createElement("style")),f(this,"canvas",void 0),f(this,"gl",void 0),f(this,"config",void 0),f(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),f(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(h))){var n=this.styleElement;n.id=h,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),m={imageUrl:"",resolution:256,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:1,raindropsTimeInterval:3600,idleFluctuations:!0};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,E(n.key),n)}}function y(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}Object.freeze(m);var R=y((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),b(this,"visible",!1),b(this,"running",!1),b(this,"perturbance",void 0),b(this,"resolution",void 0),b(this,"raindropsTimeInterval",void 0),b(this,"animationFrameId",0),b(this,"quad",null),b(this,"lastRaindropsFallTime",0),b(this,"parentElement",null),b(this,"backgroundInfo",{width:0,height:0}),b(this,"dropProgram",null),b(this,"updateProgram",null),b(this,"textures",[]),b(this,"backgroundTexture",[]),b(this,"textureDelta",null),b(this,"framebuffers",[]),b(this,"bufferWriteIndex",0),b(this,"bufferReadIndex",1),b(this,"originalInlineCss",""),b(this,"originalCssBackgroundImage",""),b(this,"events",{}),b(this,"accelerating",void 0),this.perturbance=t.perturbance,this.resolution=t.resolution,this.raindropsTimeInterval=t.raindropsTimeInterval,this.accelerating=t.accelerating})),T={};function _(){var e=this.gl,t=T[this.sole];e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function x(){var e=T[this.sole],t=e.bufferWriteIndex,r=e.bufferReadIndex;e.bufferWriteIndex=1-t,e.bufferReadIndex=1-r}function w(){var e=(T[this.sole]||{}).parentElement;if(e){var t=e.style.backgroundImage;if("none"!=t){var r=T[this.sole];r.originalInlineCss=t,r.originalCssBackgroundImage=window.getComputedStyle(e).backgroundImage,e.style.backgroundImage="none"}}}function P(){var e=T[this.sole],t=e.parentElement,r=e.originalInlineCss;t.style.backgroundImage=r||""}function S(){var e=this,t=this.gl,r=T[this.sole],n=r.parentElement,i=r.backgroundTexture,o=r.originalCssBackgroundImage,a=this.imageUrl||A(o)||A(window.getComputedStyle(n).backgroundImage);if(a!==this.imageSource)if(this.imageSource=a,this.imageSource){var l=new Image;l.onload=function(){var n=function(e){return!(e&e-1)},o=n(l.width)&&n(l.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),r.backgroundInfo={width:l.width,height:l.height},Reflect.apply(w,e,[])},l.onerror=function(){return Reflect.apply(F,e,[])},l.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,l.src=this.imageSource}else Reflect.apply(F,this,[])}function F(){var e=this.gl,t=T[this.sole].backgroundTexture;e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function A(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function O(){var e,t,r,n=T[this.sole],i=n.parentElement,o=window.getComputedStyle(i).backgroundSize,a=window.getComputedStyle(i).backgroundAttachment,l=(e=window.getComputedStyle(i).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):I(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),s={left:0,top:0,width:0,height:0};if("fixed"==a)s.height=window.innerHeight,s.left=window.screenX,s.top=window.screenY,s.width=window.innerWidth;else{var u=i.getBoundingClientRect();s.left=u.left,s.top=u.top,s.width=i.scrollWidth,s.height=i.scrollHeight}var c=n.backgroundInfo||{width:100,height:100},f=c.width,p=c.height;if("cover"==o){var h=Math.max(s.width/f,s.height/p);t=f*h,r=p*h}else if("contain"==o){var d=Math.min(s.width/f,s.height/p);t=f*d,r=p*d}else{var m=o.split(" ");t=m[0]||"",r=m[1]||t,I(t)?t=s.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),I(r)?r=s.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=f,r=p):("auto"==t&&(t=f*(Number(r)/p)),"auto"==r&&(r=p*(Number(t)/f)))}var g=l&&l[0]||"0%",v=l&&l[1]||"0%";g=I(g)?(s.left+(s.width-Number(t))*parseFloat(g)/100).toString():(s.left+parseFloat(g)).toString(),v=I(v)?(s.top+(s.height-Number(r))*parseFloat(v)/100).toString():(s.top+parseFloat(v)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(i.offsetLeft-Number(g))/t,(i.offsetTop-Number(v))/r]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+i.clientWidth/t,this.renderProgram.uniforms.topLeft[1]+i.clientHeight/r]);var y=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/y,this.canvas.height/y])}function I(e){return e.endsWith("%")}function D(){var e=this.gl,t=T[this.sole],r=t.perturbance,n=t.textures,i=t.backgroundTexture;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(a,this,[i,0]),Reflect.apply(a,this,[n[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,r),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),Reflect.apply(_,this,[]),e.disable(e.BLEND)}function U(){var e=this.gl,t=T[this.sole],r=t.resolution,n=t.updateProgram,i=t.textures,o=t.framebuffers,l=t.bufferWriteIndex,s=t.bufferReadIndex;e.viewport(0,0,r,r),e.bindFramebuffer(e.FRAMEBUFFER,o[l]),Reflect.apply(a,this,[i[s]]),e.useProgram(n.id),Reflect.apply(_,this,[]),Reflect.apply(x,this,[])}function k(){var e=this,t=T[this.sole],r=t.visible,n=t.raindropsTimeInterval,i=t.running,o=t.lastRaindropsFallTime;if(r){if(Reflect.apply(O,this,[]),this.idleFluctuations&&i){var a=Date.now();a-o>n&&(t.lastRaindropsFallTime=a,this.raindropsFall())}Reflect.apply(U,this,[]),Reflect.apply(D,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(k,e,[])}))}}function C(e,t,r){var n=T[this.sole].parentElement,i=window.getComputedStyle(n),o=parseInt(i.borderLeftWidth)||0,a=parseInt(i.borderTopWidth)||0,l=n.getBoundingClientRect(),s=e.clientX-l.left-o,u=e.clientY-l.top-a;this.drop(s,u,t,r)}function L(){var e=this,t=T[this.sole],r=t.visible,n=t.running,i=t.accelerating,o=t.parentElement,a=t.events,l=function(i){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&n&&e.interactive&&(t.lastRaindropsFallTime=Date.now(),Reflect.apply(C,e,[i,e.dropRadius*(o?1.5:1),o?.14:.01]))};a.mousemove=function(e){for(var t=i;t--;)l(e)},a.touchmove=a.touchstart=function(e){for(var t=e.touches,r=0;r<t.length;r++)l(t[r])},a.mousedown=function(e){return l(e,!0)},Object.keys(a).forEach((function(e){return o&&o.addEventListener(e,a[e],{passive:!0})}))}var j="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";function B(){var e=this.gl,t=T[this.sole],r=t.textureDelta;t.dropProgram=o(j,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e);var n=t.updateProgram=o(j,"\n precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl);e.uniform2fv(n.locations.delta,r),this.renderProgram=o("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,r)}function X(){var e=this.gl,t=T[this.sole].backgroundTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function M(){var e=this;if(this.config){var t=T[this.sole],r=t.resolution,n=t.textures,i=t.framebuffers,o=this.gl,a=1/r;t.textureDelta=new Float32Array([a,a]),this.config.extensions.forEach((function(e){return o.getExtension(e)})),this.updateSize=this.updateSize.bind(this),window.addEventListener("resize",this.updateSize);for(var l=this.config.arrayType,s=l?new l(r*r*4):null,u=this.config,c=0;c<2;c++){var f=o.createTexture(),p=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,p),o.bindTexture(o.TEXTURE_2D,f),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,u.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,u.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r,r,0,o.RGBA,u.type,s),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,f,0),n.push(f),i.push(p)}t.quad=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,t.quad),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),o.STATIC_DRAW),Reflect.apply(B,this,[]),Reflect.apply(X,this,[]),Reflect.apply(F,this,[]),Reflect.apply(S,this,[]),o.clearColor(0,0,0,0),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),t.visible=!0,t.running=!0,Reflect.apply(L,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(k,e,[])}))}}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,J(n.key),n)}}function H(e,t){if(t&&("object"==N(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Y=function(){return!!e})()}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},q(e)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}function V(e,t,r){return(t=J(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}var Q=new WeakMap,Z=function(e){function t(e,r){var n,o,a,l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,l=[e],a=q(a=t),V(n=H(o,Y()?Reflect.construct(a,l||[],q(o).constructor):a.apply(o,l)),"sole",Symbol("ripple")),V(n,"defaults",m),V(n,"interactive",n.defaults.interactive),V(n,"dropRadius",void 0),V(n,"crossOrigin",""),V(n,"imageUrl",void 0),V(n,"idleFluctuations",!0),function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}(n,Q,!1),V(n,"imageSource",""),V(n,"renderProgram",void 0),console.log("初始化参数",r),T[n.sole]=new R(m),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=G(G({},n.defaults),r);return n.accelerating=s.accelerating,n.dropRadius=s.dropRadius,n.resolution=s.resolution,n.interactive=s.interactive,n.perturbance=s.perturbance,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,n.playingState=s.playingState,n.raindropsTimeInterval=s.raindropsTimeInterval,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl?(n.initState=!1,H(n)):(T[n.sole].parentElement=e.parentElement,function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1,pointerEvents:"none"})}(e),Reflect.apply(M,n,[]),n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||(T[this.sole].accelerating=e)}},{key:"resolution",set:function(e){e<100||e>550||(T[this.sole].resolution=e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||(T[this.sole].perturbance=e)}},{key:"playingState",set:function(e){T[this.sole].running=!1!==e}},{key:"initialized",get:function(){return t=this,(e=Q).get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t));var e,t}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||(T[this.sole].raindropsTimeInterval=e)}},{key:"raindropsFall",value:function(){var e=T[this.sole].parentElement,t=window.getComputedStyle(e),r=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},n=t.width,i=t.height;this.drop(r(n),r(i),this.dropRadius,.03)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=T[this.sole],l=o.resolution,s=o.parentElement,u=o.dropProgram,c=o.textures,f=o.framebuffers,p=o.bufferWriteIndex,h=o.bufferReadIndex,d=s.offsetWidth,m=s.offsetHeight,g=Math.max(d,m);r/=g;var v=new Float32Array([(2*e-d)/g,(m-2*t)/g]);i.viewport(0,0,l,l),i.bindFramebuffer(i.FRAMEBUFFER,f[p]),Reflect.apply(a,this,[c[h]]),i.useProgram(u.id),i.uniform2fv(u.locations.center,v),i.uniform1f(u.locations.radius,r),i.uniform1f(u.locations.strength,n),Reflect.apply(_,this,[]),Reflect.apply(x,this,[])}},{key:"updateSize",value:function(){var e=T[this.sole].parentElement,t=e.offsetWidth,r=e.offsetHeight;t==this.canvas.width&&r==this.canvas.height||(this.canvas.width=t,this.canvas.height=r)}},{key:"destroy",value:function(){T[this.sole].animationFrameId&&window.cancelAnimationFrame(T[this.sole].animationFrameId);var e=T[this.sole],t=e.parentElement,r=e.events;t&&(Object.keys(r).forEach((function(e){return t.removeEventListener&&t.removeEventListener(e,r[e])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,Reflect.apply(P,this,[]);var n=T[this.sole];Object.keys(n).forEach((function(e){return n[e]=null})),T[this.sole]=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize)}},{key:"show",value:function(){T[this.sole].visible=!0,this.canvas.style.visibility="visible",Reflect.apply(w,this,[])}},{key:"hide",value:function(){T[this.sole].visible=!1,this.canvas.style.visibility="hidden",Reflect.apply(P,this,[])}},{key:"pause",value:function(){this.playingState=!1}},{key:"play",value:function(){this.playingState=!0}},{key:"changePlayingState",value:function(){this.playingState=!T[this.sole].running}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,Reflect.apply(S,this,[])):this[e]=t}}],n&&z(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(d);function $(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){var n=e.current;return r.current=new Z(n,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>l});var i=r(953),o=r.n(i),a=r(231);function l(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,a.useRipples)(t,e),e),o().createElement("canvas",{ref:t})}module.exports["oops-ui"]=n})();
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={805:(e,t,r)=>{r.d(t,{BackgroundRipple:()=>a});var n=r(953),i=r.n(n),o=r(982);function a(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,o.useRipples)(t,e),e),e.children?i().createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,i().createElement("canvas",{ref:t})):i().createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{useAnimationFrameId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{useInputIsComposing:()=>i});var n=r(953);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},982:(e,t,r)=>{r.d(t,{useRipples:()=>ye});var n=r(953);const i=require("a-element-inline-style");function o(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function a(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function u(e){return e.endsWith("%")}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function h(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}var m="lmssee_ripper_element_style",v=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(m))){var n=this.styleElement;n.id=m,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),g={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function R(e,t){if(t&&("object"==E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function P(e,t,r){S(e,t),t.set(e,r)}function S(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function F(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}function O(e,t){return e.get(D(e,t))}function k(e,t,r){return e.set(D(e,t),r),r}function D(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(g);var U=new WeakMap,M=new WeakMap,I=new WeakMap,L=new WeakMap,C=new WeakMap,B=new WeakMap,j=new WeakMap,W=new WeakMap,X=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakSet,ie=function(e){function t(e,r){var n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=_(t),R(e,w()?Reflect.construct(t,r||[],_(e).constructor):t.apply(e,r))}(this,t,[e]),S(o=n,a=ne),a.add(o),F(n,"defaults",g),F(n,"interactive",n.defaults.interactive),P(n,U,n.defaults.accelerating),P(n,M,n.defaults.resolution),P(n,I,n.defaults.perturbance),F(n,"dropRadius",void 0),F(n,"crossOrigin",""),F(n,"imageUrl",void 0),F(n,"idleFluctuations",!0),P(n,L,void 0),P(n,C,void 0),P(n,B,[]),P(n,j,[]),P(n,W,0),P(n,X,1),P(n,N,void 0),P(n,G,!1),P(n,z,!1),P(n,H,!1),P(n,Y,0),P(n,q,""),F(n,"imageSource",""),F(n,"renderProgram",void 0),P(n,K,void 0),P(n,V,void 0),P(n,J,void 0),P(n,Q,void 0),P(n,Z,void 0),P(n,$,void 0),P(n,ee,Date.now()),P(n,te,n.defaults.raindropsTimeInterval),P(n,re,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=b(b({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,R(n);var u=n.gl,l=1/O(M,n);k(C,n,new Float32Array([l,l])),k(L,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(O(M,n)*O(M,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,O(M,n),O(M,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),O(B,n).push(p),O(j,n).push(m)}return k(N,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,O(N,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),D(ne,n,de).call(n),D(ne,n,pe).call(n),D(ne,n,me).call(n),D(ne,n,ae).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),k(G,n,!0),k(z,n,!0),k(H,n,!0),D(ne,n,oe).call(n),k(Y,n,requestAnimationFrame((function(){return D(ne,n,se).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||k(U,this,e)}},{key:"resolution",set:function(e){e<100||e>550||k(M,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||k(I,this,e)}},{key:"playingState",set:function(e){k(z,this,!1!==e)}},{key:"initialized",get:function(){return O(H,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||k(te,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(O(L,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=O(L,this).offsetWidth,a=O(L,this).offsetHeight,u=Math.max(o,a);r/=u;var l=new Float32Array([(2*e-o)/u,(a-2*t)/u]);i.viewport(0,0,O(M,this),O(M,this)),i.bindFramebuffer(i.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),i.useProgram(O(J,this).id),i.uniform2fv(O(J,this).locations.center,l),i.uniform1f(O(J,this).locations.radius,r),i.uniform1f(O(J,this).locations.strength,n),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}},{key:"updateSize",value:function(){var e=O(L,this).offsetWidth,t=O(L,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=O(L,this);t&&(Object.keys(O(re,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,O(re,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),D(ne,this,ge).call(this),O(Y,this)&&window.cancelAnimationFrame(O(Y,this))}},{key:"show",value:function(){k(G,this,!0),this.canvas.style.visibility="visible",D(ne,this,ve).call(this)}},{key:"hide",value:function(){k(G,this,!1),this.canvas.style.visibility="hidden",D(ne,this,ge).call(this)}},{key:"pause",value:function(){k(z,this,!1)}},{key:"play",value:function(){k(z,this,!0)}},{key:"changePlayingState",value:function(){k(z,this,!O(z,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,D(ne,this,ae).call(this)):this[e]=t}}],n&&T(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function oe(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];O(G,e)&&O(z,e)&&e.interactive&&(k(ee,e,Date.now()),D(ne,e,Ee).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};O(re,this).mousemove=function(r){for(var n=O(U,e);n--;)t(r)},O(re,this).touchmove=O(re,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},O(re,this).mousedown=function(e){return t(e,!0)},Object.keys(O(re,this)).forEach((function(t){return O(L,e)&&O(L,e).addEventListener(t,O(re,e)[t],{passive:!0})}))}function ae(){var e=this,t=this.gl,r=this.imageUrl||o(O(q,this))||o(window.getComputedStyle(O(L,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,O(K,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),k(Q,e,n.width),k(Z,e,n.height),D(ne,e,ve).call(e)},n.onerror=function(){return D(ne,e,me).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else D(ne,this,me).call(this)}function se(){var e=this;O(G,this)&&(D(ne,this,he).call(this),O(z,this)&&D(ne,this,ce).call(this),D(ne,this,le).call(this),k(Y,this,requestAnimationFrame((function(){return D(ne,e,se).call(e)}))))}function ue(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,O(N,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function le(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[O(K,this),0]),Reflect.apply(s,this,[O(B,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,O(I,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),D(ne,this,ue).call(this),e.disable(e.BLEND)}function ce(){if(this.idleFluctuations){var e=Date.now();e-O(ee,this)>O(te,this)&&(k(ee,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,O(M,this),O(M,this)),t.bindFramebuffer(t.FRAMEBUFFER,O(j,this)[O(W,this)]),Reflect.apply(s,this,[O(B,this)[O(X,this)]]),t.useProgram(O(V,this).id),D(ne,this,ue).call(this),D(ne,this,fe).call(this)}function fe(){k(W,this,1-O(W,this)),k(X,this,1-O(X,this))}function he(){var e,t,r,n=window.getComputedStyle(O(L,this)).backgroundSize,i=window.getComputedStyle(O(L,this)).backgroundAttachment,o=(e=window.getComputedStyle(O(L,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):u(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:O(L,this).getBoundingClientRect().left,top:O(L,this).getBoundingClientRect().top,width:O(L,this).scrollWidth,height:O(L,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*s,r=O(Z,this)*s}else if("contain"==n){var l=Math.min(a.width/O(Q,this),a.height/O(Z,this));t=O(Q,this)*l,r=O(Z,this)*l}else{var c=n.split(" ");t=c[0]||"",r=c[1]||t,u(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),u(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=O(Q,this),r=O(Z,this)):("auto"==t&&(t=O(Q,this)*(Number(r)/O(Z,this))),"auto"==r&&(r=O(Z,this)*(Number(t)/O(Q,this))))}var f=o&&o[0]||"0%",h=o&&o[1]||"0%";f=u(f)?(a.left+(a.width-Number(t))*parseFloat(f)/100).toString():(a.left+parseFloat(f)).toString(),h=u(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(O(L,this).offsetLeft-Number(f))/Number(t),(O(L,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+O(L,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+O(L,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function de(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";k(J,this,a(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),k(V,this,a(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(O(V,this).locations.delta,O(C,this)),this.renderProgram=a("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,O(C,this))}function pe(){var e=this.gl;k(K,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,O(K,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function me(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,O(K,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ve(){var e=O(L,this).style.backgroundImage;"none"!=e&&(k($,this,e),k(q,this,window.getComputedStyle(O(L,this)).backgroundImage),O(L,this).style.backgroundImage="none")}function ge(){O(L,this).style.backgroundImage=O($,this)||""}function Ee(e,t,r){var n=window.getComputedStyle(O(L,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=O(L,this).getBoundingClientRect(),s=e.clientX-a.left-i,u=e.clientY-a.top-o;this.drop(s,u,t,r)}function ye(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){return r.current=new ie(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{useTimeId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>i.BackgroundRipple,useAnimationFrameId:()=>s.useAnimationFrameId,useInputIsComposing:()=>o.useInputIsComposing,useRipples:()=>u.useRipples,useTimeId:()=>a.useTimeId});var i=r(805),o=r(195),a=r(552),s=r(615),u=r(982);module.exports["oops-ui"]=n})();
1
+ (()=>{"use strict";var e={805:(e,t,r)=>{r.d(t,{BackgroundRipple:()=>a});var n=r(953),i=r.n(n),o=r(231);function a(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,o.useRipples)(t,e),e),i().createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{useAnimationFrameId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{useInputIsComposing:()=>i});var n=r(953);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},231:(e,t,r)=>{r.d(t,{useRipples:()=>$});var n=r(953);const i=require("a-element-inline-style");function o(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var l=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(l));){var s=o[2];a.locations[s]=r.getUniformLocation(a.id,s)}return a}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function l(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),l=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,l),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,s=0;s<i.length;s++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[s].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[s];break}return u}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function c(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){var t=function(e){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}var d="lmssee_ripper_element_style",h=c((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"styleElement",document.createElement("style")),f(this,"canvas",void 0),f(this,"gl",void 0),f(this,"config",void 0),f(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),f(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(d))){var n=this.styleElement;n.id=d,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(l,this,[])})),m={imageUrl:"",resolution:256,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:1,raindropsTimeInterval:3600,idleFluctuations:!0};function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,E(n.key),n)}}function y(e,t,r){return t&&g(e.prototype,t),r&&g(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}Object.freeze(m);var R=y((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),b(this,"visible",!1),b(this,"running",!1),b(this,"perturbance",void 0),b(this,"resolution",void 0),b(this,"raindropsTimeInterval",void 0),b(this,"animationFrameId",0),b(this,"quad",null),b(this,"lastRaindropsFallTime",0),b(this,"parentElement",null),b(this,"backgroundInfo",{width:0,height:0}),b(this,"dropProgram",null),b(this,"updateProgram",null),b(this,"textures",[]),b(this,"backgroundTexture",[]),b(this,"textureDelta",null),b(this,"framebuffers",[]),b(this,"bufferWriteIndex",0),b(this,"bufferReadIndex",1),b(this,"originalInlineCss",""),b(this,"originalCssBackgroundImage",""),b(this,"events",{}),b(this,"accelerating",void 0),this.perturbance=t.perturbance,this.resolution=t.resolution,this.raindropsTimeInterval=t.raindropsTimeInterval,this.accelerating=t.accelerating})),T={};function _(){var e=this.gl,t=T[this.sole];e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function x(){var e=T[this.sole],t=e.bufferWriteIndex,r=e.bufferReadIndex;e.bufferWriteIndex=1-t,e.bufferReadIndex=1-r}function w(){var e=(T[this.sole]||{}).parentElement;if(e){var t=e.style.backgroundImage;if("none"!=t){var r=T[this.sole];r.originalInlineCss=t,r.originalCssBackgroundImage=window.getComputedStyle(e).backgroundImage,e.style.backgroundImage="none"}}}function P(){var e=T[this.sole],t=e.parentElement,r=e.originalInlineCss;t.style.backgroundImage=r||""}function S(){var e=this,t=this.gl,r=T[this.sole],n=r.parentElement,i=r.backgroundTexture,o=r.originalCssBackgroundImage,a=this.imageUrl||A(o)||A(window.getComputedStyle(n).backgroundImage);if(a!==this.imageSource)if(this.imageSource=a,this.imageSource){var l=new Image;l.onload=function(){var n=function(e){return!(e&e-1)},o=n(l.width)&&n(l.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),r.backgroundInfo={width:l.width,height:l.height},Reflect.apply(w,e,[])},l.onerror=function(){return Reflect.apply(F,e,[])},l.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,l.src=this.imageSource}else Reflect.apply(F,this,[])}function F(){var e=this.gl,t=T[this.sole].backgroundTexture;e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function A(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function I(){var e,t,r,n=T[this.sole],i=n.parentElement,o=window.getComputedStyle(i).backgroundSize,a=window.getComputedStyle(i).backgroundAttachment,l=(e=window.getComputedStyle(i).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):O(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),u={left:0,top:0,width:0,height:0};if("fixed"==a)u.height=window.innerHeight,u.left=window.screenX,u.top=window.screenY,u.width=window.innerWidth;else{var s=i.getBoundingClientRect();u.left=s.left,u.top=s.top,u.width=i.scrollWidth,u.height=i.scrollHeight}var c=n.backgroundInfo||{width:100,height:100},f=c.width,p=c.height;if("cover"==o){var d=Math.max(u.width/f,u.height/p);t=f*d,r=p*d}else if("contain"==o){var h=Math.min(u.width/f,u.height/p);t=f*h,r=p*h}else{var m=o.split(" ");t=m[0]||"",r=m[1]||t,O(t)?t=u.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),O(r)?r=u.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=f,r=p):("auto"==t&&(t=f*(Number(r)/p)),"auto"==r&&(r=p*(Number(t)/f)))}var v=l&&l[0]||"0%",g=l&&l[1]||"0%";v=O(v)?(u.left+(u.width-Number(t))*parseFloat(v)/100).toString():(u.left+parseFloat(v)).toString(),g=O(g)?(u.top+(u.height-Number(r))*parseFloat(g)/100).toString():(u.top+parseFloat(g)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(i.offsetLeft-Number(v))/t,(i.offsetTop-Number(g))/r]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+i.clientWidth/t,this.renderProgram.uniforms.topLeft[1]+i.clientHeight/r]);var y=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/y,this.canvas.height/y])}function O(e){return e.endsWith("%")}function D(){var e=this.gl,t=T[this.sole],r=t.perturbance,n=t.textures,i=t.backgroundTexture;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(a,this,[i,0]),Reflect.apply(a,this,[n[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,r),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),Reflect.apply(_,this,[]),e.disable(e.BLEND)}function U(){var e=this.gl,t=T[this.sole],r=t.resolution,n=t.updateProgram,i=t.textures,o=t.framebuffers,l=t.bufferWriteIndex,u=t.bufferReadIndex;e.viewport(0,0,r,r),e.bindFramebuffer(e.FRAMEBUFFER,o[l]),Reflect.apply(a,this,[i[u]]),e.useProgram(n.id),Reflect.apply(_,this,[]),Reflect.apply(x,this,[])}function k(){var e=this,t=T[this.sole],r=t.visible,n=t.raindropsTimeInterval,i=t.running,o=t.lastRaindropsFallTime;if(r){if(Reflect.apply(I,this,[]),this.idleFluctuations&&i){var a=Date.now();a-o>n&&(t.lastRaindropsFallTime=a,this.raindropsFall())}Reflect.apply(U,this,[]),Reflect.apply(D,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(k,e,[])}))}}function C(e,t,r){var n=T[this.sole].parentElement,i=window.getComputedStyle(n),o=parseInt(i.borderLeftWidth)||0,a=parseInt(i.borderTopWidth)||0,l=n.getBoundingClientRect(),u=e.clientX-l.left-o,s=e.clientY-l.top-a;this.drop(u,s,t,r)}function L(){var e=this,t=T[this.sole],r=t.visible,n=t.running,i=t.accelerating,o=t.parentElement,a=t.events,l=function(i){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&n&&e.interactive&&(t.lastRaindropsFallTime=Date.now(),Reflect.apply(C,e,[i,e.dropRadius*(o?1.5:1),o?.14:.01]))};a.mousemove=function(e){for(var t=i;t--;)l(e)},a.touchmove=a.touchstart=function(e){for(var t=e.touches,r=0;r<t.length;r++)l(t[r])},a.mousedown=function(e){return l(e,!0)},Object.keys(a).forEach((function(e){return o&&o.addEventListener(e,a[e],{passive:!0})}))}var j="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";function B(){var e=this.gl,t=T[this.sole],r=t.textureDelta;t.dropProgram=o(j,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e);var n=t.updateProgram=o(j,"\n precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl);e.uniform2fv(n.locations.delta,r),this.renderProgram=o("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,r)}function X(){var e=this.gl,t=T[this.sole].backgroundTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function M(){var e=this;if(this.config){var t=T[this.sole],r=t.resolution,n=t.textures,i=t.framebuffers,o=this.gl,a=1/r;t.textureDelta=new Float32Array([a,a]),this.config.extensions.forEach((function(e){return o.getExtension(e)})),this.updateSize=this.updateSize.bind(this),window.addEventListener("resize",this.updateSize);for(var l=this.config.arrayType,u=l?new l(r*r*4):null,s=this.config,c=0;c<2;c++){var f=o.createTexture(),p=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,p),o.bindTexture(o.TEXTURE_2D,f),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r,r,0,o.RGBA,s.type,u),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,f,0),n.push(f),i.push(p)}t.quad=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,t.quad),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),o.STATIC_DRAW),Reflect.apply(B,this,[]),Reflect.apply(X,this,[]),Reflect.apply(F,this,[]),Reflect.apply(S,this,[]),o.clearColor(0,0,0,0),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),t.visible=!0,t.running=!0,Reflect.apply(L,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(k,e,[])}))}}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,J(n.key),n)}}function H(e,t){if(t&&("object"==N(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Y=function(){return!!e})()}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},q(e)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}function V(e,t,r){return(t=J(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}var Q=new WeakMap,Z=function(e){function t(e,r){var n,o,a,l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,l=[e],a=q(a=t),V(n=H(o,Y()?Reflect.construct(a,l||[],q(o).constructor):a.apply(o,l)),"sole",Symbol("ripple")),V(n,"defaults",m),V(n,"interactive",n.defaults.interactive),V(n,"dropRadius",void 0),V(n,"crossOrigin",""),V(n,"imageUrl",void 0),V(n,"idleFluctuations",!0),function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}(n,Q,!1),V(n,"imageSource",""),V(n,"renderProgram",void 0),console.log("初始化参数",r),T[n.sole]=new R(m),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var u=G(G({},n.defaults),r);return n.accelerating=u.accelerating,n.dropRadius=u.dropRadius,n.resolution=u.resolution,n.interactive=u.interactive,n.perturbance=u.perturbance,n.crossOrigin=u.crossOrigin,n.imageUrl=u.imageUrl,n.idleFluctuations=u.idleFluctuations,n.playingState=u.playingState,n.raindropsTimeInterval=u.raindropsTimeInterval,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl?(n.initState=!1,H(n)):(T[n.sole].parentElement=e.parentElement,function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,i.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1,pointerEvents:"none"})}(e),Reflect.apply(M,n,[]),n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||(T[this.sole].accelerating=e)}},{key:"resolution",set:function(e){e<100||e>550||(T[this.sole].resolution=e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||(T[this.sole].perturbance=e)}},{key:"playingState",set:function(e){T[this.sole].running=!1!==e}},{key:"initialized",get:function(){return t=this,(e=Q).get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t));var e,t}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||(T[this.sole].raindropsTimeInterval=e)}},{key:"raindropsFall",value:function(){var e=T[this.sole].parentElement,t=window.getComputedStyle(e),r=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},n=t.width,i=t.height;this.drop(r(n),r(i),this.dropRadius,.03)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=T[this.sole],l=o.resolution,u=o.parentElement,s=o.dropProgram,c=o.textures,f=o.framebuffers,p=o.bufferWriteIndex,d=o.bufferReadIndex,h=u.offsetWidth,m=u.offsetHeight,v=Math.max(h,m);r/=v;var g=new Float32Array([(2*e-h)/v,(m-2*t)/v]);i.viewport(0,0,l,l),i.bindFramebuffer(i.FRAMEBUFFER,f[p]),Reflect.apply(a,this,[c[d]]),i.useProgram(s.id),i.uniform2fv(s.locations.center,g),i.uniform1f(s.locations.radius,r),i.uniform1f(s.locations.strength,n),Reflect.apply(_,this,[]),Reflect.apply(x,this,[])}},{key:"updateSize",value:function(){var e=T[this.sole].parentElement,t=e.offsetWidth,r=e.offsetHeight;t==this.canvas.width&&r==this.canvas.height||(this.canvas.width=t,this.canvas.height=r)}},{key:"destroy",value:function(){T[this.sole].animationFrameId&&window.cancelAnimationFrame(T[this.sole].animationFrameId);var e=T[this.sole],t=e.parentElement,r=e.events;t&&(Object.keys(r).forEach((function(e){return t.removeEventListener&&t.removeEventListener(e,r[e])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,Reflect.apply(P,this,[]);var n=T[this.sole];Object.keys(n).forEach((function(e){return n[e]=null})),T[this.sole]=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize)}},{key:"show",value:function(){T[this.sole].visible=!0,this.canvas.style.visibility="visible",Reflect.apply(w,this,[])}},{key:"hide",value:function(){T[this.sole].visible=!1,this.canvas.style.visibility="hidden",Reflect.apply(P,this,[])}},{key:"pause",value:function(){this.playingState=!1}},{key:"play",value:function(){this.playingState=!0}},{key:"changePlayingState",value:function(){this.playingState=!T[this.sole].running}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,Reflect.apply(S,this,[])):this[e]=t}}],n&&z(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(h);function $(e,t){var r=(0,n.useRef)(null);return(0,n.useEffect)((function(){var n=e.current;return r.current=new Z(n,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{useTimeId:()=>i});var n=r(953);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},953:e=>{e.exports=require("react")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{BackgroundRipple:()=>i.BackgroundRipple,useAnimationFrameId:()=>l.useAnimationFrameId,useInputIsComposing:()=>o.useInputIsComposing,useRipples:()=>u.useRipples,useTimeId:()=>a.useTimeId});var i=r(805),o=r(195),a=r(552),l=r(615),u=r(231);module.exports["oops-ui"]=n})();
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.oopsUi=t():e.oopsUi=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return(e.getAttribute("style")||"").replace(/(;{2,})/gm,";").split(";").reduce(((t,r)=>{if(""!==r.trim()){const n=r.indexOf(":");let i=r.slice(0,n).trim();i=function(e){return e.startsWith("--")?e:e.replace(/([a-z])-([a-z])/g,((e,t,r)=>t.concat(r.toUpperCase())))}(i);const o=e.style[i];void 0!==o&&(t[i]=o)}return t}),{})}function n(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var l=e+t,s=/uniform (\w+) (\w+)/g;null!==(o=s.exec(l));){var u=o[2];a.locations[u]=r.getUniformLocation(a.id,u)}return a}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function o(e){var t,n,i=e.parentElement;e.width=i.clientWidth,e.height=i.clientHeight,n={position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1,pointerEvents:"none"},(t=e).setAttribute("style",function(e,t){return Object.keys(e).reduce(((r,n)=>{return t&&t.includes(n)?r:r+`${i=n,i.startsWith("--")?i:i.replace(/[A-Z]/gm,(e=>`-${e.toLowerCase()}`))}: ${e[n]};`;var i}),"")}({...r(t),...n}).replaceAll(/;;/gm,";"))}function a(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),l=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,l),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var s=null,u=0;u<i.length;u++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[u].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){s=i[u];break}return s}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function u(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){var t=function(e){if("object"!=l(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:t+""}e.r(t),e.d(t,{useRipples:()=>J});var p="lmssee_ripper_element_style",h=u((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"styleElement",document.createElement("style")),c(this,"canvas",void 0),c(this,"gl",void 0),c(this,"config",void 0),c(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),c(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(p))){var n=this.styleElement;n.id=p,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(a,this,[])})),d={imageUrl:"",resolution:256,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:1,raindropsTimeInterval:3600,idleFluctuations:!0};function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function v(e,t,r){return t&&g(e.prototype,t),r&&g(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function y(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}Object.freeze(d);var E=v((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),y(this,"visible",!1),y(this,"running",!1),y(this,"perturbance",void 0),y(this,"resolution",void 0),y(this,"raindropsTimeInterval",void 0),y(this,"animationFrameId",0),y(this,"quad",null),y(this,"lastRaindropsFallTime",0),y(this,"parentElement",null),y(this,"backgroundInfo",{width:0,height:0}),y(this,"dropProgram",null),y(this,"updateProgram",null),y(this,"textures",[]),y(this,"backgroundTexture",[]),y(this,"textureDelta",null),y(this,"framebuffers",[]),y(this,"bufferWriteIndex",0),y(this,"bufferReadIndex",1),y(this,"originalInlineCss",""),y(this,"originalCssBackgroundImage",""),y(this,"events",{}),y(this,"accelerating",void 0),this.perturbance=t.perturbance,this.resolution=t.resolution,this.raindropsTimeInterval=t.raindropsTimeInterval,this.accelerating=t.accelerating})),R={};function T(){var e=this.gl,t=R[this.sole];e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function x(){var e=R[this.sole],t=e.bufferWriteIndex,r=e.bufferReadIndex;e.bufferWriteIndex=1-t,e.bufferReadIndex=1-r}function _(){var e=(R[this.sole]||{}).parentElement;if(e){var t=e.style.backgroundImage;if("none"!=t){var r=R[this.sole];r.originalInlineCss=t,r.originalCssBackgroundImage=window.getComputedStyle(e).backgroundImage,e.style.backgroundImage="none"}}}function w(){var e=R[this.sole],t=e.parentElement,r=e.originalInlineCss;t.style.backgroundImage=r||""}function P(){var e=this,t=this.gl,r=R[this.sole],n=r.parentElement,i=r.backgroundTexture,o=r.originalCssBackgroundImage,a=this.imageUrl||F(o)||F(window.getComputedStyle(n).backgroundImage);if(a!==this.imageSource)if(this.imageSource=a,this.imageSource){var l=new Image;l.onload=function(){var n=function(e){return!(e&e-1)},o=n(l.width)&&n(l.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),r.backgroundInfo={width:l.width,height:l.height},Reflect.apply(_,e,[])},l.onerror=function(){return Reflect.apply(S,e,[])},l.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,l.src=this.imageSource}else Reflect.apply(S,this,[])}function S(){var e=this.gl,t=R[this.sole].backgroundTexture;e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function F(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function A(){var e,t,r,n=R[this.sole],i=n.parentElement,o=window.getComputedStyle(i).backgroundSize,a=window.getComputedStyle(i).backgroundAttachment,l=(e=window.getComputedStyle(i).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):O(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),s={left:0,top:0,width:0,height:0};if("fixed"==a)s.height=window.innerHeight,s.left=window.screenX,s.top=window.screenY,s.width=window.innerWidth;else{var u=i.getBoundingClientRect();s.left=u.left,s.top=u.top,s.width=i.scrollWidth,s.height=i.scrollHeight}var c=n.backgroundInfo||{width:100,height:100},f=c.width,p=c.height;if("cover"==o){var h=Math.max(s.width/f,s.height/p);t=f*h,r=p*h}else if("contain"==o){var d=Math.min(s.width/f,s.height/p);t=f*d,r=p*d}else{var m=o.split(" ");t=m[0]||"",r=m[1]||t,O(t)?t=s.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),O(r)?r=s.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=f,r=p):("auto"==t&&(t=f*(Number(r)/p)),"auto"==r&&(r=p*(Number(t)/f)))}var g=l&&l[0]||"0%",v=l&&l[1]||"0%";g=O(g)?(s.left+(s.width-Number(t))*parseFloat(g)/100).toString():(s.left+parseFloat(g)).toString(),v=O(v)?(s.top+(s.height-Number(r))*parseFloat(v)/100).toString():(s.top+parseFloat(v)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(i.offsetLeft-Number(g))/t,(i.offsetTop-Number(v))/r]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+i.clientWidth/t,this.renderProgram.uniforms.topLeft[1]+i.clientHeight/r]);var y=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/y,this.canvas.height/y])}function O(e){return e.endsWith("%")}function I(){var e=this.gl,t=R[this.sole],r=t.perturbance,n=t.textures,o=t.backgroundTexture;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(i,this,[o,0]),Reflect.apply(i,this,[n[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,r),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),Reflect.apply(T,this,[]),e.disable(e.BLEND)}function D(){var e=this.gl,t=R[this.sole],r=t.resolution,n=t.updateProgram,o=t.textures,a=t.framebuffers,l=t.bufferWriteIndex,s=t.bufferReadIndex;e.viewport(0,0,r,r),e.bindFramebuffer(e.FRAMEBUFFER,a[l]),Reflect.apply(i,this,[o[s]]),e.useProgram(n.id),Reflect.apply(T,this,[]),Reflect.apply(x,this,[])}function U(){var e=this,t=R[this.sole],r=t.visible,n=t.raindropsTimeInterval,i=t.running,o=t.lastRaindropsFallTime;if(r){if(Reflect.apply(A,this,[]),this.idleFluctuations&&i){var a=Date.now();a-o>n&&(t.lastRaindropsFallTime=a,this.raindropsFall())}Reflect.apply(D,this,[]),Reflect.apply(I,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(U,e,[])}))}}function C(e,t,r){var n=R[this.sole].parentElement,i=window.getComputedStyle(n),o=parseInt(i.borderLeftWidth)||0,a=parseInt(i.borderTopWidth)||0,l=n.getBoundingClientRect(),s=e.clientX-l.left-o,u=e.clientY-l.top-a;this.drop(s,u,t,r)}function k(){var e=this,t=R[this.sole],r=t.visible,n=t.running,i=t.accelerating,o=t.parentElement,a=t.events,l=function(i){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&n&&e.interactive&&(t.lastRaindropsFallTime=Date.now(),Reflect.apply(C,e,[i,e.dropRadius*(o?1.5:1),o?.14:.01]))};a.mousemove=function(e){for(var t=i;t--;)l(e)},a.touchmove=a.touchstart=function(e){for(var t=e.touches,r=0;r<t.length;r++)l(t[r])},a.mousedown=function(e){return l(e,!0)},Object.keys(a).forEach((function(e){return o&&o.addEventListener(e,a[e],{passive:!0})}))}var j="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";function L(){var e=this.gl,t=R[this.sole],r=t.textureDelta;t.dropProgram=n(j,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e);var i=t.updateProgram=n(j,"\n precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl);e.uniform2fv(i.locations.delta,r),this.renderProgram=n("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,r)}function B(){var e=this.gl,t=R[this.sole].backgroundTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function X(){var e=this;if(this.config){var t=R[this.sole],r=t.resolution,n=t.textures,i=t.framebuffers,o=this.gl,a=1/r;t.textureDelta=new Float32Array([a,a]),this.config.extensions.forEach((function(e){return o.getExtension(e)})),this.updateSize=this.updateSize.bind(this),window.addEventListener("resize",this.updateSize);for(var l=this.config.arrayType,s=l?new l(r*r*4):null,u=this.config,c=0;c<2;c++){var f=o.createTexture(),p=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,p),o.bindTexture(o.TEXTURE_2D,f),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,u.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,u.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r,r,0,o.RGBA,u.type,s),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,f,0),n.push(f),i.push(p)}t.quad=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,t.quad),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),o.STATIC_DRAW),Reflect.apply(L,this,[]),Reflect.apply(B,this,[]),Reflect.apply(S,this,[]),Reflect.apply(P,this,[]),o.clearColor(0,0,0,0),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),t.visible=!0,t.running=!0,Reflect.apply(k,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(U,e,[])}))}}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){$(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,K(n.key),n)}}function z(e,t){if(t&&("object"==M(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(H=function(){return!!e})()}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}function q(e,t){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},q(e,t)}function $(e,t,r){return(t=K(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K(e){var t=function(e){if("object"!=M(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==M(t)?t:t+""}var V=new WeakMap,Z=function(e){function t(e,r){var n,i,a,l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=this,l=[e],a=Y(a=t),$(n=z(i,H()?Reflect.construct(a,l||[],Y(i).constructor):a.apply(i,l)),"sole",Symbol("ripple")),$(n,"defaults",d),$(n,"interactive",n.defaults.interactive),$(n,"dropRadius",void 0),$(n,"crossOrigin",""),$(n,"imageUrl",void 0),$(n,"idleFluctuations",!0),function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}(n,V,!1),$(n,"imageSource",""),$(n,"renderProgram",void 0),console.log("初始化参数",r),R[n.sole]=new E(d),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=W(W({},n.defaults),r);return n.accelerating=s.accelerating,n.dropRadius=s.dropRadius,n.resolution=s.resolution,n.interactive=s.interactive,n.perturbance=s.perturbance,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,n.playingState=s.playingState,n.raindropsTimeInterval=s.raindropsTimeInterval,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl?(n.initState=!1,z(n)):(R[n.sole].parentElement=e.parentElement,o(e),Reflect.apply(X,n,[]),n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&q(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||(R[this.sole].accelerating=e)}},{key:"resolution",set:function(e){e<100||e>550||(R[this.sole].resolution=e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||(R[this.sole].perturbance=e)}},{key:"playingState",set:function(e){R[this.sole].running=!1!==e}},{key:"initialized",get:function(){return t=this,(e=V).get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t));var e,t}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||(R[this.sole].raindropsTimeInterval=e)}},{key:"raindropsFall",value:function(){var e=R[this.sole].parentElement,t=window.getComputedStyle(e),r=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},n=t.width,i=t.height;this.drop(r(n),r(i),this.dropRadius,.03)}},{key:"drop",value:function(e,t,r,n){var o=this.gl,a=R[this.sole],l=a.resolution,s=a.parentElement,u=a.dropProgram,c=a.textures,f=a.framebuffers,p=a.bufferWriteIndex,h=a.bufferReadIndex,d=s.offsetWidth,m=s.offsetHeight,g=Math.max(d,m);r/=g;var v=new Float32Array([(2*e-d)/g,(m-2*t)/g]);o.viewport(0,0,l,l),o.bindFramebuffer(o.FRAMEBUFFER,f[p]),Reflect.apply(i,this,[c[h]]),o.useProgram(u.id),o.uniform2fv(u.locations.center,v),o.uniform1f(u.locations.radius,r),o.uniform1f(u.locations.strength,n),Reflect.apply(T,this,[]),Reflect.apply(x,this,[])}},{key:"updateSize",value:function(){var e=R[this.sole].parentElement,t=e.offsetWidth,r=e.offsetHeight;t==this.canvas.width&&r==this.canvas.height||(this.canvas.width=t,this.canvas.height=r)}},{key:"destroy",value:function(){R[this.sole].animationFrameId&&window.cancelAnimationFrame(R[this.sole].animationFrameId);var e=R[this.sole],t=e.parentElement,r=e.events;t&&(Object.keys(r).forEach((function(e){return t.removeEventListener&&t.removeEventListener(e,r[e])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,Reflect.apply(w,this,[]);var n=R[this.sole];Object.keys(n).forEach((function(e){return n[e]=null})),R[this.sole]=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize)}},{key:"show",value:function(){R[this.sole].visible=!0,this.canvas.style.visibility="visible",Reflect.apply(_,this,[])}},{key:"hide",value:function(){R[this.sole].visible=!1,this.canvas.style.visibility="hidden",Reflect.apply(w,this,[])}},{key:"pause",value:function(){this.playingState=!1}},{key:"play",value:function(){this.playingState=!0}},{key:"changePlayingState",value:function(){this.playingState=!R[this.sole].running}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,Reflect.apply(P,this,[])):this[e]=t}}],n&&G(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(h);function J(e,t){var r=document.createElement("canvas");return e.appendChild(r),new Z(r,t)}return t})()));
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import*as e from"a-element-inline-style";import*as t from"react";var r={805:(e,t,r)=>{r.d(t,{z:()=>o});var n=r(649),i=r(566);function o(e){var t=(0,n.useRef)(null);return function(e,t){(0,n.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}((0,i.n)(t,e),e),e.children?n.default.createElement("div",{style:e.style,className:"lmssee-ripples"},e.children,n.default.createElement("canvas",{ref:t})):n.default.createElement("canvas",{ref:t})}},615:(e,t,r)=>{r.d(t,{M:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}},195:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(649);function i(e){var t=(0,n.useRef)(!1);return(0,n.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}},566:(t,r,n)=>{n.d(r,{n:()=>Te});var i=n(649);const o=(a={setStyle:()=>e.setStyle},s={},n.d(s,a),s);var a,s;function u(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function l(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var s=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(s));){var l=o[2];a.locations[l]=r.getUniformLocation(a.id,l)}return a}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function f(e){return e.endsWith("%")}function h(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,l=0;l<i.length;l++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[l].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[l];break}return u}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function m(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}var E="lmssee_ripper_element_style",y=m((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),v(this,"styleElement",document.createElement("style")),v(this,"canvas",void 0),v(this,"gl",void 0),v(this,"config",void 0),v(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),v(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(E))){var n=this.styleElement;n.id=E,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(h,this,[])})),b={imageUrl:"",resolution:360,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:3,raindropsTimeInterval:660,idleFluctuations:!0};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function x(e,t){if(t&&("object"==R(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(P=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function A(e,t,r){O(e,t),t.set(e,r)}function O(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function M(e,t){return e.get(L(e,t))}function U(e,t,r){return e.set(L(e,t),r),r}function L(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Object.freeze(b);var C=new WeakMap,I=new WeakMap,B=new WeakMap,W=new WeakMap,X=new WeakMap,j=new WeakMap,N=new WeakMap,G=new WeakMap,z=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakMap,K=new WeakMap,V=new WeakMap,J=new WeakMap,Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap,ne=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakSet,se=function(e){function t(e,r){var n,i,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,r){return t=S(t),x(e,P()?Reflect.construct(t,r||[],S(e).constructor):t.apply(e,r))}(this,t,[e]),O(i=n,a=ae),a.add(i),k(n,"defaults",b),k(n,"interactive",n.defaults.interactive),A(n,C,n.defaults.accelerating),A(n,I,n.defaults.resolution),A(n,B,n.defaults.perturbance),k(n,"dropRadius",void 0),k(n,"crossOrigin",""),k(n,"imageUrl",void 0),k(n,"idleFluctuations",!0),A(n,W,void 0),A(n,X,void 0),A(n,j,[]),A(n,N,[]),A(n,G,0),A(n,z,1),A(n,H,void 0),A(n,Y,!1),A(n,q,!1),A(n,K,!1),A(n,V,0),A(n,J,""),k(n,"imageSource",""),k(n,"renderProgram",void 0),A(n,Q,void 0),A(n,Z,void 0),A(n,$,void 0),A(n,ee,void 0),A(n,te,void 0),A(n,re,void 0),A(n,ne,Date.now()),A(n,ie,n.defaults.raindropsTimeInterval),A(n,oe,{mousemove:function(e){return console.log(e)},mousedown:function(e){return console.log(e)},touchmove:function(e){return console.log(e)},touchstart:function(e){return console.log(e)}}),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=w(w({},n.defaults),r);if(n.interactive=s.interactive,n.resolution=s.resolution,n.perturbance=s.perturbance,n.dropRadius=s.dropRadius,n.crossOrigin=s.crossOrigin,n.imageUrl=s.imageUrl,n.idleFluctuations=s.idleFluctuations,!1===n.initState||null===e.parentElement||null===n.config||null===n.gl)return n.initState=!1,x(n);var u=n.gl,l=1/M(I,n);U(X,n,new Float32Array([l,l])),U(W,n,e.parentElement),function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,o.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,pointerEvents:"none"})}(e),n.config.extensions.forEach((function(e){return u.getExtension(e)})),n.updateSize=n.updateSize.bind(n),window.addEventListener("resize",n.updateSize);for(var c=n.config.arrayType,f=c?new c(M(I,n)*M(I,n)*4):null,h=n.config,d=0;d<2;d++){var p=u.createTexture(),m=u.createFramebuffer();u.bindFramebuffer(u.FRAMEBUFFER,m),u.bindTexture(u.TEXTURE_2D,p),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,h.linearSupport?u.LINEAR:u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,M(I,n),M(I,n),0,u.RGBA,h.type,f),u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,p,0),M(j,n).push(p),M(N,n).push(m)}return U(H,n,u.createBuffer()),u.bindBuffer(u.ARRAY_BUFFER,M(H,n)),u.bufferData(u.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),u.STATIC_DRAW),L(ae,n,ve).call(n),L(ae,n,ge).call(n),L(ae,n,Ee).call(n),L(ae,n,le).call(n),u.clearColor(0,0,0,0),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),U(Y,n,!0),U(q,n,!0),U(K,n,!0),L(ae,n,ue).call(n),U(V,n,requestAnimationFrame((function(){return L(ae,n,ce).call(n)}))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),r=t,n=[{key:"accelerating",set:function(e){e>100||e<2||U(C,this,e)}},{key:"resolution",set:function(e){e<100||e>550||U(I,this,e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||U(B,this,e)}},{key:"playingState",set:function(e){U(q,this,!1!==e)}},{key:"initialized",get:function(){return M(K,this)}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||U(ie,this,e)}},{key:"raindropsFall",value:function(){var e=window.getComputedStyle(M(W,this)),t=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},r=e.width,n=e.height;this.drop(t(r),t(n),1.5*this.dropRadius,.14)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=M(W,this).offsetWidth,a=M(W,this).offsetHeight,s=Math.max(o,a);r/=s;var u=new Float32Array([(2*e-o)/s,(a-2*t)/s]);i.viewport(0,0,M(I,this),M(I,this)),i.bindFramebuffer(i.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),i.useProgram(M($,this).id),i.uniform2fv(M($,this).locations.center,u),i.uniform1f(M($,this).locations.radius,r),i.uniform1f(M($,this).locations.strength,n),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}},{key:"updateSize",value:function(){var e=M(W,this).offsetWidth,t=M(W,this).offsetHeight;e==this.canvas.width&&t==this.canvas.height||(this.canvas.width=e,this.canvas.height=t)}},{key:"destroy",value:function(){var e=this,t=M(W,this);t&&(Object.keys(M(oe,this)).forEach((function(r){return t.removeEventListener&&t.removeEventListener(r,M(oe,e)[r])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize),L(ae,this,be).call(this),M(V,this)&&window.cancelAnimationFrame(M(V,this))}},{key:"show",value:function(){U(Y,this,!0),this.canvas.style.visibility="visible",L(ae,this,ye).call(this)}},{key:"hide",value:function(){U(Y,this,!1),this.canvas.style.visibility="hidden",L(ae,this,be).call(this)}},{key:"pause",value:function(){U(q,this,!1)}},{key:"play",value:function(){U(q,this,!0)}},{key:"changePlayingState",value:function(){U(q,this,!M(q,this))}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,L(ae,this,le).call(this)):this[e]=t}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(y);function ue(){var e=this,t=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];M(Y,e)&&M(q,e)&&e.interactive&&(U(ne,e,Date.now()),L(ae,e,Re).call(e,t,e.dropRadius*(r?1.5:1),r?.14:.01))};M(oe,this).mousemove=function(r){for(var n=M(C,e);n--;)t(r)},M(oe,this).touchmove=M(oe,this).touchstart=function(e){for(var r=e.touches,n=0;n<r.length;n++)t(r[n])},M(oe,this).mousedown=function(e){return t(e,!0)},Object.keys(M(oe,this)).forEach((function(t){return M(W,e)&&M(W,e).addEventListener(t,M(oe,e)[t],{passive:!0})}))}function le(){var e=this,t=this.gl,r=this.imageUrl||u(M(J,this))||u(window.getComputedStyle(M(W,this)).backgroundImage);if(r!==this.imageSource)if(this.imageSource=r,this.imageSource){var n=new Image;n.onload=function(){var r=function(e){return!(e&e-1)},i=r(n.width)&&r(n.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,M(Q,e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n),U(ee,e,n.width),U(te,e,n.height),L(ae,e,ye).call(e)},n.onerror=function(){return L(ae,e,Ee).call(e)},n.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,n.src=this.imageSource}else L(ae,this,Ee).call(this)}function ce(){var e=this;M(Y,this)&&(L(ae,this,me).call(this),M(q,this)&&L(ae,this,de).call(this),L(ae,this,he).call(this),U(V,this,requestAnimationFrame((function(){return L(ae,e,ce).call(e)}))))}function fe(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,M(H,this)),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function he(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(c,this,[M(Q,this),0]),Reflect.apply(c,this,[M(j,this)[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,M(B,this)),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),L(ae,this,fe).call(this),e.disable(e.BLEND)}function de(){if(this.idleFluctuations){var e=Date.now();e-M(ne,this)>M(ie,this)&&(U(ne,this,e),this.raindropsFall())}var t=this.gl;t.viewport(0,0,M(I,this),M(I,this)),t.bindFramebuffer(t.FRAMEBUFFER,M(N,this)[M(G,this)]),Reflect.apply(c,this,[M(j,this)[M(z,this)]]),t.useProgram(M(Z,this).id),L(ae,this,fe).call(this),L(ae,this,pe).call(this)}function pe(){U(G,this,1-M(G,this)),U(z,this,1-M(z,this))}function me(){var e,t,r,n=window.getComputedStyle(M(W,this)).backgroundSize,i=window.getComputedStyle(M(W,this)).backgroundAttachment,o=(e=window.getComputedStyle(M(W,this)).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):f(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),a="fixed"==i?{left:window.scrollX,top:window.scrollY,width:window.innerWidth,height:window.innerHeight}:{left:M(W,this).getBoundingClientRect().left,top:M(W,this).getBoundingClientRect().top,width:M(W,this).scrollWidth,height:M(W,this).scrollHeight};if("cover"==n){var s=Math.max(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*s,r=M(te,this)*s}else if("contain"==n){var u=Math.min(a.width/M(ee,this),a.height/M(te,this));t=M(ee,this)*u,r=M(te,this)*u}else{var l=n.split(" ");t=l[0]||"",r=l[1]||t,f(t)?t=a.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),f(r)?r=a.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=M(ee,this),r=M(te,this)):("auto"==t&&(t=M(ee,this)*(Number(r)/M(te,this))),"auto"==r&&(r=M(te,this)*(Number(t)/M(ee,this))))}var c=o&&o[0]||"0%",h=o&&o[1]||"0%";c=f(c)?(a.left+(a.width-Number(t))*parseFloat(c)/100).toString():(a.left+parseFloat(c)).toString(),h=f(h)?(a.top+(a.height-Number(r))*parseFloat(h)/100).toString():(a.top+parseFloat(h)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(M(W,this).offsetLeft-Number(c))/Number(t),(M(W,this).offsetTop-Number(h))/Number(r)]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+M(W,this).clientWidth/Number(t),this.renderProgram.uniforms.topLeft[1]+M(W,this).clientHeight/Number(r)]);var d=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/d,this.canvas.height/d])}function ve(){var e=this.gl,t="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";U($,this,l(t,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e)),U(Z,this,l(t,"precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl)),e.uniform2fv(M(Z,this).locations.delta,M(X,this)),this.renderProgram=l("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,M(X,this))}function ge(){var e=this.gl;U(Q,this,e.createTexture()),e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function Ee(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,M(Q,this)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function ye(){var e=M(W,this).style.backgroundImage;"none"!=e&&(U(re,this,e),U(J,this,window.getComputedStyle(M(W,this)).backgroundImage),M(W,this).style.backgroundImage="none")}function be(){M(W,this).style.backgroundImage=M(re,this)||""}function Re(e,t,r){var n=window.getComputedStyle(M(W,this)),i=parseInt(n.borderLeftWidth)||0,o=parseInt(n.borderTopWidth)||0,a=M(W,this).getBoundingClientRect(),s=e.clientX-a.left-i,u=e.clientY-a.top-o;this.drop(s,u,t,r)}function Te(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){return r.current=new se(e.current,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}},552:(e,t,r)=>{r.d(t,{O:()=>i});var n=r(649);function i(){var e=(0,n.useRef)(void 0);return(0,n.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}},649:(e,r,n)=>{var i,o;e.exports=(i={default:()=>t.default,useEffect:()=>t.useEffect,useRef:()=>t.useRef},o={},n.d(o,i),o)}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};i.d(o,{z_:()=>a.z,MM:()=>l.M,t3:()=>s.t,nC:()=>c.n,Oe:()=>u.O});var a=i(805),s=i(195),u=i(552),l=i(615),c=i(566),f=o.z_,h=o.MM,d=o.t3,p=o.nC,m=o.Oe;export{f as BackgroundRipple,h as useAnimationFrameId,d as useInputIsComposing,p as useRipples,m as useTimeId};
1
+ import*as e from"react";import*as t from"a-element-inline-style";var r={d:(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},n={};r.d(n,{z_:()=>ne,MM:()=>ae,t3:()=>ie,nC:()=>re,Oe:()=>oe});const i=(o={default:()=>e.default,useEffect:()=>e.useEffect,useRef:()=>e.useRef},a={},r.d(a,o),a);var o,a;const l=(e=>{var t={};return r.d(t,e),t})({setStyle:()=>t.setStyle});function u(e,t,r,n){function i(e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error("compile error: "+r.getShaderInfoLog(n));return n}var o,a={id:r.createProgram(),uniforms:{},locations:{}};if(r.attachShader(a.id,i(r.VERTEX_SHADER,e)),r.attachShader(a.id,i(r.FRAGMENT_SHADER,t)),r.linkProgram(a.id),!r.getProgramParameter(a.id,r.LINK_STATUS))throw new Error("link error: "+r.getProgramInfoLog(a.id));r.useProgram(a.id),r.enableVertexAttribArray(0);for(var l=e+t,u=/uniform (\w+) (\w+)/g;null!==(o=u.exec(l));){var s=o[2];a.locations[s]=r.getUniformLocation(a.id,s)}return a}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.gl;r.activeTexture(r.TEXTURE0+(t||0)),r.bindTexture(r.TEXTURE_2D,e)}function c(){var e=this,t=function(){return e.initState=!1,null};if(!this.gl)return t();var r=this.gl,n=Object.fromEntries(["OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear"].reduce((function(e,t){var n=r.getExtension(t);return n&&e.push([t,n]),e}),[]));if(!n.OES_texture_float)return t();var i=[];function o(e,t,r){var i="OES_texture_"+e,o=i+"_linear",a=o in n;return{type:t,linearSupport:a,arrayType:r,extensions:a?[i,o]:[i]}}i.push(o("float",r.FLOAT,Float32Array)),n.OES_texture_half_float&&i.push(o("half_float",n.OES_texture_half_float.HALF_FLOAT_OES,null));var a=r.createTexture(),l=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,l),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var u=null,s=0;s<i.length;s++)if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,32,32,0,r.RGBA,i[s].type,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,a,0),r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE){u=i[s];break}return u}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function h(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}var v="lmssee_ripper_element_style",g=h((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,"styleElement",document.createElement("style")),d(this,"canvas",void 0),d(this,"gl",void 0),d(this,"config",void 0),d(this,"transparentPixels",function(){try{return new ImageData(32,32)}catch(e){return console.log(e&&""),document.createElement("canvas").getContext("2d").createImageData(32,32)}}()),d(this,"initState",!0),this.canvas=t;var r=t.getContext("webgl");if(null===r)return this.initState=!1,void(this.config=null);if(this.gl=r,null===document.querySelector("style#".concat(v))){var n=this.styleElement;n.id=v,n.innerHTML="\n .lmssee-ripples { \n position: relative; \n z-index: 0; \n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n transform: translate(0,0);\n }\n ";var i=document.head;i.prepend?i.prepend(n):i.insertBefore(n,i.firstChild)}this.config=Reflect.apply(c,this,[])})),y={imageUrl:"",resolution:256,dropRadius:10,perturbance:.03,interactive:!0,crossOrigin:"",playingState:!0,accelerating:1,raindropsTimeInterval:3600,idleFluctuations:!0};function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function R(e,t,r){return t&&E(e.prototype,t),r&&E(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function T(e,t,r){return(t=_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}Object.freeze(y);var x=R((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),T(this,"visible",!1),T(this,"running",!1),T(this,"perturbance",void 0),T(this,"resolution",void 0),T(this,"raindropsTimeInterval",void 0),T(this,"animationFrameId",0),T(this,"quad",null),T(this,"lastRaindropsFallTime",0),T(this,"parentElement",null),T(this,"backgroundInfo",{width:0,height:0}),T(this,"dropProgram",null),T(this,"updateProgram",null),T(this,"textures",[]),T(this,"backgroundTexture",[]),T(this,"textureDelta",null),T(this,"framebuffers",[]),T(this,"bufferWriteIndex",0),T(this,"bufferReadIndex",1),T(this,"originalInlineCss",""),T(this,"originalCssBackgroundImage",""),T(this,"events",{}),T(this,"accelerating",void 0),this.perturbance=t.perturbance,this.resolution=t.resolution,this.raindropsTimeInterval=t.raindropsTimeInterval,this.accelerating=t.accelerating})),w={};function P(){var e=this.gl,t=w[this.sole];e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_FAN,0,4)}function S(){var e=w[this.sole],t=e.bufferWriteIndex,r=e.bufferReadIndex;e.bufferWriteIndex=1-t,e.bufferReadIndex=1-r}function F(){var e=(w[this.sole]||{}).parentElement;if(e){var t=e.style.backgroundImage;if("none"!=t){var r=w[this.sole];r.originalInlineCss=t,r.originalCssBackgroundImage=window.getComputedStyle(e).backgroundImage,e.style.backgroundImage="none"}}}function A(){var e=w[this.sole],t=e.parentElement,r=e.originalInlineCss;t.style.backgroundImage=r||""}function O(){var e=this,t=this.gl,r=w[this.sole],n=r.parentElement,i=r.backgroundTexture,o=r.originalCssBackgroundImage,a=this.imageUrl||D(o)||D(window.getComputedStyle(n).backgroundImage);if(a!==this.imageSource)if(this.imageSource=a,this.imageSource){var l=new Image;l.onload=function(){var n=function(e){return!(e&e-1)},o=n(l.width)&&n(l.height)?t.REPEAT:t.CLAMP_TO_EDGE;t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),r.backgroundInfo={width:l.width,height:l.height},Reflect.apply(F,e,[])},l.onerror=function(){return Reflect.apply(I,e,[])},l.crossOrigin=this.imageSource.match(/^data:/)?null:this.crossOrigin,l.src=this.imageSource}else Reflect.apply(I,this,[])}function I(){var e=this.gl,t=w[this.sole].backgroundTexture;e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.transparentPixels)}function D(e){var t=/url\(["']?([^"']*)["']?\)/.exec(e);return null==t?null:t[1]}function U(){var e,t,r,n=w[this.sole],i=n.parentElement,o=window.getComputedStyle(i).backgroundSize,a=window.getComputedStyle(i).backgroundAttachment,l=(e=window.getComputedStyle(i).backgroundPosition,/\s+/.test(e)?e.replace(/center/,"50%").replace(/top|left/,"0%").replace(/bottom/,"100%").replace(/\s+/," ").split(" "):C(e)?[e,"50%"]:{center:["50%","50%"],top:["50%","0%"],bottom:["50%","100%"],left:["0%","50%"],right:["100%","50%"]}[e]),u={left:0,top:0,width:0,height:0};if("fixed"==a)u.height=window.innerHeight,u.left=window.screenX,u.top=window.screenY,u.width=window.innerWidth;else{var s=i.getBoundingClientRect();u.left=s.left,u.top=s.top,u.width=i.scrollWidth,u.height=i.scrollHeight}var c=n.backgroundInfo||{width:100,height:100},f=c.width,p=c.height;if("cover"==o){var h=Math.max(u.width/f,u.height/p);t=f*h,r=p*h}else if("contain"==o){var d=Math.min(u.width/f,u.height/p);t=f*d,r=p*d}else{var m=o.split(" ");t=m[0]||"",r=m[1]||t,C(t)?t=u.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),C(r)?r=u.height*parseFloat(r)/100:"auto"!==r&&(r=parseFloat(r)),"auto"==t&&"auto"==r?(t=f,r=p):("auto"==t&&(t=f*(Number(r)/p)),"auto"==r&&(r=p*(Number(t)/f)))}var v=l&&l[0]||"0%",g=l&&l[1]||"0%";v=C(v)?(u.left+(u.width-Number(t))*parseFloat(v)/100).toString():(u.left+parseFloat(v)).toString(),g=C(g)?(u.top+(u.height-Number(r))*parseFloat(g)/100).toString():(u.top+parseFloat(g)).toString(),this.renderProgram.uniforms.topLeft=new Float32Array([(i.offsetLeft-Number(v))/t,(i.offsetTop-Number(g))/r]),this.renderProgram.uniforms.bottomRight=new Float32Array([this.renderProgram.uniforms.topLeft[0]+i.clientWidth/t,this.renderProgram.uniforms.topLeft[1]+i.clientHeight/r]);var y=Math.max(this.canvas.width,this.canvas.height);this.renderProgram.uniforms.containerRatio=new Float32Array([this.canvas.width/y,this.canvas.height/y])}function C(e){return e.endsWith("%")}function k(){var e=this.gl,t=w[this.sole],r=t.perturbance,n=t.textures,i=t.backgroundTexture;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,this.canvas.width,this.canvas.height),e.enable(e.BLEND),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.useProgram(this.renderProgram.id),Reflect.apply(s,this,[i,0]),Reflect.apply(s,this,[n[0],1]),e.uniform1f(this.renderProgram.locations.perturbance,r),e.uniform2fv(this.renderProgram.locations.topLeft,this.renderProgram.uniforms.topLeft),e.uniform2fv(this.renderProgram.locations.bottomRight,this.renderProgram.uniforms.bottomRight),e.uniform2fv(this.renderProgram.locations.containerRatio,this.renderProgram.uniforms.containerRatio),e.uniform1i(this.renderProgram.locations.samplerBackground,0),e.uniform1i(this.renderProgram.locations.samplerRipples,1),Reflect.apply(P,this,[]),e.disable(e.BLEND)}function L(){var e=this.gl,t=w[this.sole],r=t.resolution,n=t.updateProgram,i=t.textures,o=t.framebuffers,a=t.bufferWriteIndex,l=t.bufferReadIndex;e.viewport(0,0,r,r),e.bindFramebuffer(e.FRAMEBUFFER,o[a]),Reflect.apply(s,this,[i[l]]),e.useProgram(n.id),Reflect.apply(P,this,[]),Reflect.apply(S,this,[])}function j(){var e=this,t=w[this.sole],r=t.visible,n=t.raindropsTimeInterval,i=t.running,o=t.lastRaindropsFallTime;if(r){if(Reflect.apply(U,this,[]),this.idleFluctuations&&i){var a=Date.now();a-o>n&&(t.lastRaindropsFallTime=a,this.raindropsFall())}Reflect.apply(L,this,[]),Reflect.apply(k,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(j,e,[])}))}}function B(e,t,r){var n=w[this.sole].parentElement,i=window.getComputedStyle(n),o=parseInt(i.borderLeftWidth)||0,a=parseInt(i.borderTopWidth)||0,l=n.getBoundingClientRect(),u=e.clientX-l.left-o,s=e.clientY-l.top-a;this.drop(u,s,t,r)}function X(){var e=this,t=w[this.sole],r=t.visible,n=t.running,i=t.accelerating,o=t.parentElement,a=t.events,l=function(i){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&n&&e.interactive&&(t.lastRaindropsFallTime=Date.now(),Reflect.apply(B,e,[i,e.dropRadius*(o?1.5:1),o?.14:.01]))};a.mousemove=function(e){for(var t=i;t--;)l(e)},a.touchmove=a.touchstart=function(e){for(var t=e.touches,r=0;r<t.length;r++)l(t[r])},a.mousedown=function(e){return l(e,!0)},Object.keys(a).forEach((function(e){return o&&o.addEventListener(e,a[e],{passive:!0})}))}var M="\n attribute vec2 vertex;\n varying vec2 coord;\n void main() {\n coord = vertex * 0.5 + 0.5;\n gl_Position = vec4(vertex, 0.0, 1.0);\n }";function N(){var e=this.gl,t=w[this.sole],r=t.textureDelta;t.dropProgram=u(M,"precision highp float;\n\n const float PI = 3.141592653589793;\n uniform sampler2D texture;\n uniform vec2 center;\n uniform float radius;\n uniform float strength;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n\n float drop = max(0.0, 1.0 - length(center * 0.5 + 0.5 - coord) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n gl_FragColor = info;\n }",e);var n=t.updateProgram=u(M,"\n precision highp float;\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 coord;\n\n void main() {\n vec4 info = texture2D(texture, coord);\n \n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n \n float average = (\n texture2D(texture, coord - dx).r +\n texture2D(texture, coord - dy).r +\n texture2D(texture, coord + dx).r +\n texture2D(texture, coord + dy).r\n ) * 0.25;\n \n info.g += (average - info.r) * 2.0;\n info.g *= 0.995;\n info.r += info.g;\n \n gl_FragColor = info;\n }\n ",this.gl);e.uniform2fv(n.locations.delta,r),this.renderProgram=u("\n precision highp float;\n\n attribute vec2 vertex;\n uniform vec2 topLeft;\n uniform vec2 bottomRight;\n uniform vec2 containerRatio;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n void main() {\n backgroundCoord = mix(topLeft, bottomRight, vertex * 0.5 + 0.5);\n backgroundCoord.y = 1.0 - backgroundCoord.y;\n ripplesCoord = vec2(vertex.x, -vertex.y) * containerRatio * 0.5 + 0.5;\n gl_Position = vec4(vertex.x, -vertex.y, 0.0, 1.0);\n }\n ","\n precision highp float;\n\n uniform sampler2D samplerBackground;\n uniform sampler2D samplerRipples;\n uniform vec2 delta;\n\n uniform float perturbance;\n varying vec2 ripplesCoord;\n varying vec2 backgroundCoord;\n\n void main() {\n float height = texture2D(samplerRipples, ripplesCoord).r;\n float heightX = texture2D(samplerRipples, vec2(ripplesCoord.x + delta.x, ripplesCoord.y)).r;\n float heightY = texture2D(samplerRipples, vec2(ripplesCoord.x, ripplesCoord.y + delta.y)).r;\n vec3 dx = vec3(delta.x, heightX - height, 0.0);\n vec3 dy = vec3(0.0, heightY - height, delta.y);\n vec2 offset = -normalize(cross(dy, dx)).xz;\n float specular = pow(max(0.0, dot(offset, normalize(vec2(-0.6, 1.0)))), 4.0);\n gl_FragColor = texture2D(samplerBackground, backgroundCoord + offset * perturbance) + specular;\n }",e),e.uniform2fv(this.renderProgram.locations.delta,r)}function W(){var e=this.gl,t=w[this.sole].backgroundTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}function G(){var e=this;if(this.config){var t=w[this.sole],r=t.resolution,n=t.textures,i=t.framebuffers,o=this.gl,a=1/r;t.textureDelta=new Float32Array([a,a]),this.config.extensions.forEach((function(e){return o.getExtension(e)})),this.updateSize=this.updateSize.bind(this),window.addEventListener("resize",this.updateSize);for(var l=this.config.arrayType,u=l?new l(r*r*4):null,s=this.config,c=0;c<2;c++){var f=o.createTexture(),p=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,p),o.bindTexture(o.TEXTURE_2D,f),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.linearSupport?o.LINEAR:o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r,r,0,o.RGBA,s.type,u),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,f,0),n.push(f),i.push(p)}t.quad=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,t.quad),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),o.STATIC_DRAW),Reflect.apply(N,this,[]),Reflect.apply(W,this,[]),Reflect.apply(I,this,[]),Reflect.apply(O,this,[]),o.clearColor(0,0,0,0),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),t.visible=!0,t.running=!0,Reflect.apply(X,this,[]),t.animationFrameId=requestAnimationFrame((function(){return Reflect.apply(j,e,[])}))}}function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){Z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function q(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$(n.key),n)}}function K(e,t){if(t&&("object"==z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(V=function(){return!!e})()}function J(e){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},J(e)}function Q(e,t){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Q(e,t)}function Z(e,t,r){return(t=$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e){var t=function(e){if("object"!=z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==z(t)?t:t+""}var ee=new WeakMap,te=function(){function e(t,r){var n,i,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i=this,a=[t],o=J(o=e),Z(n=K(i,V()?Reflect.construct(o,a||[],J(i).constructor):o.apply(i,a)),"sole",Symbol("ripple")),Z(n,"defaults",y),Z(n,"interactive",n.defaults.interactive),Z(n,"dropRadius",void 0),Z(n,"crossOrigin",""),Z(n,"imageUrl",void 0),Z(n,"idleFluctuations",!0),function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}(n,ee,!1),Z(n,"imageSource",""),Z(n,"renderProgram",void 0),console.log("初始化参数",r),w[n.sole]=new x(y),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var u=Y(Y({},n.defaults),r);return n.accelerating=u.accelerating,n.dropRadius=u.dropRadius,n.resolution=u.resolution,n.interactive=u.interactive,n.perturbance=u.perturbance,n.crossOrigin=u.crossOrigin,n.imageUrl=u.imageUrl,n.idleFluctuations=u.idleFluctuations,n.playingState=u.playingState,n.raindropsTimeInterval=u.raindropsTimeInterval,!1===n.initState||null===t.parentElement||null===n.config||null===n.gl?(n.initState=!1,K(n)):(w[n.sole].parentElement=t.parentElement,function(e){var t=e.parentElement;e.width=t.clientWidth,e.height=t.clientHeight,(0,l.setStyle)(e,{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:-1,pointerEvents:"none"})}(t),Reflect.apply(G,n,[]),n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Q(e,t)}(e,g),t=e,r=[{key:"accelerating",set:function(e){e>100||e<2||(w[this.sole].accelerating=e)}},{key:"resolution",set:function(e){e<100||e>550||(w[this.sole].resolution=e)}},{key:"perturbance",set:function(e){e<1e-4||e>1||(w[this.sole].perturbance=e)}},{key:"playingState",set:function(e){w[this.sole].running=!1!==e}},{key:"initialized",get:function(){return t=this,(e=ee).get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t));var e,t}},{key:"raindropsTimeInterval",set:function(e){e<10||e>12e3||(w[this.sole].raindropsTimeInterval=e)}},{key:"raindropsFall",value:function(){var e=w[this.sole].parentElement,t=window.getComputedStyle(e),r=function(e){return function(e=1,t=0){let r=Math.ceil(Number(t)),n=Math.floor(Number(e));return r>n&&([n,r]=[r,n]),Math.floor(Math.random()*(n-r+1)+r)}(parseInt(e))},n=t.width,i=t.height;this.drop(r(n),r(i),this.dropRadius,.03)}},{key:"drop",value:function(e,t,r,n){var i=this.gl,o=w[this.sole],a=o.resolution,l=o.parentElement,u=o.dropProgram,c=o.textures,f=o.framebuffers,p=o.bufferWriteIndex,h=o.bufferReadIndex,d=l.offsetWidth,m=l.offsetHeight,v=Math.max(d,m);r/=v;var g=new Float32Array([(2*e-d)/v,(m-2*t)/v]);i.viewport(0,0,a,a),i.bindFramebuffer(i.FRAMEBUFFER,f[p]),Reflect.apply(s,this,[c[h]]),i.useProgram(u.id),i.uniform2fv(u.locations.center,g),i.uniform1f(u.locations.radius,r),i.uniform1f(u.locations.strength,n),Reflect.apply(P,this,[]),Reflect.apply(S,this,[])}},{key:"updateSize",value:function(){var e=w[this.sole].parentElement,t=e.offsetWidth,r=e.offsetHeight;t==this.canvas.width&&r==this.canvas.height||(this.canvas.width=t,this.canvas.height=r)}},{key:"destroy",value:function(){w[this.sole].animationFrameId&&window.cancelAnimationFrame(w[this.sole].animationFrameId);var e=w[this.sole],t=e.parentElement,r=e.events;t&&(Object.keys(r).forEach((function(e){return t.removeEventListener&&t.removeEventListener(e,r[e])})),t.removeAttribute&&t.removeAttribute("data-ripples")),this.styleElement&&this.styleElement.remove(),this.gl=null,Reflect.apply(A,this,[]);var n=w[this.sole];Object.keys(n).forEach((function(e){return n[e]=null})),w[this.sole]=null,this.gl&&(this.gl=null),window.removeEventListener("resize",this.updateSize)}},{key:"show",value:function(){w[this.sole].visible=!0,this.canvas.style.visibility="visible",Reflect.apply(F,this,[])}},{key:"hide",value:function(){w[this.sole].visible=!1,this.canvas.style.visibility="hidden",Reflect.apply(A,this,[])}},{key:"pause",value:function(){this.playingState=!1}},{key:"play",value:function(){this.playingState=!0}},{key:"changePlayingState",value:function(){this.playingState=!w[this.sole].running}},{key:"set",value:function(e,t){"imageUrl"===e?(this.imageUrl=t,Reflect.apply(O,this,[])):this[e]=t}}],r&&q(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function re(e,t){var r=(0,i.useRef)(null);return(0,i.useEffect)((function(){var n=e.current;return r.current=new te(n,t&&t.option),function(){return r.current&&r.current.destroy()||void 0}}),[]),r}function ne(e){var t=(0,i.useRef)(null);return function(e,t){(0,i.useEffect)((function(){if(t.option&&e.current){var r=t.option;Object.keys(e.current.defaults).forEach((function(t){void 0!==r[t]&&e.current&&e.current.set(t,r[t])}))}}),[t.option])}(re(t,e),e),i.default.createElement("canvas",{ref:t})}function ie(e){var t=(0,i.useRef)(!1);return(0,i.useEffect)((function(){var r=e.current;if(r){var n=function(){return t.current=!0},i=function(){return t.current=!1};return r.addEventListener("compositionstart",n),r.addEventListener("compositionend",i),function(){r.removeEventListener("compositionstart",n),r.removeEventListener("compositionend",i)}}}),[]),t}function oe(){var e=(0,i.useRef)(void 0);return(0,i.useEffect)((function(){return function(){e.current&&clearTimeout(e.current)}}),[]),e}function ae(){var e=(0,i.useRef)(0);return(0,i.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}var le=n.z_,ue=n.MM,se=n.t3,ce=n.nC,fe=n.Oe;export{le as BackgroundRipple,ue as useAnimationFrameId,se as useInputIsComposing,ce as useRipples,fe as useTimeId};
@@ -39,9 +39,6 @@ span {
39
39
  left: auto;
40
40
  top: auto;
41
41
  box-sizing: border-box;
42
- margin: 0;
43
- padding: 0;
44
- border: 0;
45
42
  font: inherit;
46
43
  vertical-align: baseline;
47
44
  -webkit-user-drag: none;
@@ -49,8 +46,13 @@ span {
49
46
  user-select: none;
50
47
  }
51
48
 
52
- body {
53
- line-height: 1.4;
49
+ body,
50
+ html {
51
+ font-size: 14px;
52
+ line-height: 1.4rem;
53
+ margin: 0;
54
+ padding: 0;
55
+ border: 0;
54
56
  }
55
57
 
56
58
  a {
@@ -38,9 +38,7 @@ span {
38
38
  left: auto;
39
39
  top: auto;
40
40
  box-sizing: border-box;
41
- margin: 0;
42
- padding: 0;
43
- border: 0;
41
+
44
42
  font: inherit;
45
43
  vertical-align: baseline;
46
44
  -webkit-user-drag: none;
@@ -49,8 +47,13 @@ span {
49
47
  user-select: none;
50
48
  }
51
49
 
52
- body {
53
- line-height: 1.4;
50
+ body,
51
+ html {
52
+ font-size: 14px;
53
+ line-height: 1.4rem;
54
+ margin: 0;
55
+ padding: 0;
56
+ border: 0;
54
57
  }
55
58
 
56
59
  a {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BackgroundRipplesProps } from 'customHooks/useRipples/interface';
2
+ import { BackgroundRipplesProps } from 'customHooks/useRipples/types';
3
3
  /**************************************
4
4
  *
5
5
  * ### 一个 ripple 背景组件
@@ -1,15 +1,5 @@
1
+ import { RipplesDefaultData } from './types';
1
2
  /**************************
2
3
  * 默认值
3
4
  **************************/
4
- export declare const defaultData: {
5
- imageUrl: string;
6
- resolution: number;
7
- dropRadius: number;
8
- perturbance: number;
9
- interactive: boolean;
10
- crossOrigin: string;
11
- playingState: boolean;
12
- accelerating: number;
13
- raindropsTimeInterval: number;
14
- idleFluctuations: boolean;
15
- };
5
+ export declare const defaultData: RipplesDefaultData;
@@ -1,4 +1,4 @@
1
- import { BackgroundRipplesProps, RipplesOptions } from './interface';
1
+ import { BackgroundRipplesProps, RipplesOptions } from './types';
2
2
  import { Ripples } from './ripplesClass';
3
3
  /**************************************
4
4
  *
@@ -0,0 +1,9 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************
3
+ * 隐藏背景
4
+ **************************/
5
+ export declare function hideCssBackground(this: Ripples): void;
6
+ /**************************
7
+ * 恢复背景样式
8
+ **************************/
9
+ export declare function restoreCssBackground(this: Ripples): void;
@@ -0,0 +1,5 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************
3
+ * 初始化事件
4
+ **************************/
5
+ export declare function setupPointerEvents(this: Ripples): void;
@@ -0,0 +1,5 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************
3
+ * 初始化 webGL
4
+ **************************/
5
+ export declare function initGL(this: Ripples): void;
@@ -0,0 +1,7 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************************
3
+ *
4
+ * 初始化着色器
5
+ *
6
+ **************************************/
7
+ export declare function initShaders(this: Ripples): void;
@@ -0,0 +1,7 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************************
3
+ *
4
+ * 初始化纹理
5
+ *
6
+ **************************************/
7
+ export declare function initTexture(this: Ripples): void;
@@ -0,0 +1,13 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************************
3
+ *
4
+ * 加载
5
+ *
6
+ **************************************/
7
+ export declare function loadImage(this: Ripples): void;
8
+ /**************************************
9
+ *
10
+ * 设置透明的纹理
11
+ *
12
+ **************************************/
13
+ export declare function setTransparentTexture(this: Ripples): void;
@@ -0,0 +1,7 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************************
3
+ *
4
+ * 计算纹理边界
5
+ *
6
+ **************************************/
7
+ export declare function computeTextureBoundaries(this: Ripples): void;
@@ -0,0 +1,7 @@
1
+ import { Ripples } from '../ripplesClass';
2
+ /**************************************
3
+ *
4
+ * 绘制 GL 数据流
5
+ *
6
+ **************************************/
7
+ export declare function drawQuad(this: Ripples): void;