oops-ui 0.0.13 → 1.0.1

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 (172) hide show
  1. package/LICENSE +13 -1
  2. package/README.md +143 -0
  3. package/client.mjs +10 -0
  4. package/client.mjs.map +1 -0
  5. package/index.mjs +3 -0
  6. package/layoutUtil.mjs +10 -0
  7. package/layoutUtil.mjs.map +1 -0
  8. package/package.json +59 -108
  9. package/server.mjs +8 -0
  10. package/server.mjs.map +1 -0
  11. package/styles/common.css +1 -0
  12. package/styles/common.scss +143 -0
  13. package/styles/flex.scss +38 -0
  14. package/styles/header.scss +54 -0
  15. package/styles/image.scss +10 -0
  16. package/styles/input.scss +131 -0
  17. package/styles/loading-keyframes.scss +242 -0
  18. package/styles/reset.css +1 -0
  19. package/styles/reset.scss +90 -0
  20. package/styles/respond.scss +54 -0
  21. package/styles/root-normal-dark.scss +85 -0
  22. package/styles/root-normal-light.scss +83 -0
  23. package/styles/root-weird-dark.scss +1 -0
  24. package/styles/root.scss +326 -0
  25. package/styles/text.scss +111 -0
  26. package/styles/vars-color.scss +295 -0
  27. package/styles/vars-size.scss +6 -0
  28. package/type/components/ThemeContext/index.d.ts +25 -0
  29. package/type/components/ThemeContext/types.d.ts +28 -0
  30. package/type/components/button/button.d.ts +10 -0
  31. package/type/components/button/index.d.ts +9 -0
  32. package/type/components/image/index.d.ts +11 -0
  33. package/type/components/image/types.d.ts +13 -0
  34. package/type/components/image/useSrcChange.d.ts +11 -0
  35. package/type/components/layout/content.d.ts +17 -0
  36. package/type/components/layout/footer.d.ts +21 -0
  37. package/type/components/layout/get-value.d.ts +10 -0
  38. package/type/components/layout/header.d.ts +23 -0
  39. package/type/components/layout/index.d.ts +8 -0
  40. package/type/components/layout/is-fragment.d.ts +9 -0
  41. package/type/components/layout/layout.d.ts +55 -0
  42. package/type/components/layout/sidebar.d.ts +29 -0
  43. package/type/components/layout/types.d.ts +101 -0
  44. package/type/components/marquee/MarqueeEle.d.ts +15 -0
  45. package/type/components/marquee/index.d.ts +7 -0
  46. package/type/components/marquee/type.d.ts +9 -0
  47. package/type/components/menu/index.d.ts +6 -0
  48. package/type/components/menu/menu.d.ts +6 -0
  49. package/type/components/ripples/Content.d.ts +8 -0
  50. package/type/components/ripples/LazyRippleEle.d.ts +42 -0
  51. package/type/components/ripples/RipplesEle.d.ts +42 -0
  52. package/type/components/ripples/index.d.ts +11 -0
  53. package/type/components/ripples/types.d.ts +17 -0
  54. package/type/components/ripples/useOptionUpdate.d.ts +12 -0
  55. package/type/components/shared/EnLayoutContent/index.d.ts +19 -0
  56. package/type/components/shared/EnLayoutContent/types.d.ts +17 -0
  57. package/type/components/switch/SwitchContainer.d.ts +7 -0
  58. package/type/components/switch/SwitchContent.d.ts +10 -0
  59. package/type/components/switch/SwitchLabel.d.ts +9 -0
  60. package/type/components/switch/index.d.ts +14 -0
  61. package/type/customHooks/use-xcn/index.d.ts +14 -0
  62. package/type/customHooks/useAnimationFrame.d.ts +58 -0
  63. package/type/customHooks/useInputIsComposing.d.ts +44 -0
  64. package/type/customHooks/useRipples/buildBackground/create-background-color.d.ts +9 -0
  65. package/type/customHooks/useRipples/buildBackground/create-linear-gradient.d.ts +9 -0
  66. package/type/customHooks/useRipples/buildBackground/default-background/_createImageData.d.ts +13 -0
  67. package/type/customHooks/useRipples/buildBackground/default-background/circleDataList.d.ts +24 -0
  68. package/type/customHooks/useRipples/buildBackground/default-background/createCanvasElementBySize.d.ts +8 -0
  69. package/type/customHooks/useRipples/buildBackground/default-background/createDefault.d.ts +8 -0
  70. package/type/customHooks/useRipples/buildBackground/default-background/index.d.ts +18 -0
  71. package/type/customHooks/useRipples/buildBackground/load-image.d.ts +19 -0
  72. package/type/customHooks/useRipples/buildBackground/run-side.d.ts +15 -0
  73. package/type/customHooks/useRipples/buildBackground/type.d.ts +37 -0
  74. package/type/customHooks/useRipples/buildBackground/utils/bind-image.d.ts +10 -0
  75. package/type/customHooks/useRipples/buildBackground/utils/create-canvas-element.d.ts +9 -0
  76. package/type/customHooks/useRipples/buildBackground/utils/create-image-by-src.d.ts +8 -0
  77. package/type/customHooks/useRipples/buildBackground/utils/get-background-style.d.ts +9 -0
  78. package/type/customHooks/useRipples/buildBackground/utils/hide-css-background.d.ts +16 -0
  79. package/type/customHooks/useRipples/buildBackground/utils/restore-css-background.d.ts +13 -0
  80. package/type/customHooks/useRipples/callback/can-side.d.ts +14 -0
  81. package/type/customHooks/useRipples/callback/destroy.d.ts +9 -0
  82. package/type/customHooks/useRipples/callback/drop.d.ts +9 -0
  83. package/type/customHooks/useRipples/callback/extract-url.d.ts +8 -0
  84. package/type/customHooks/useRipples/callback/fade.d.ts +9 -0
  85. package/type/customHooks/useRipples/callback/get-new-image.d.ts +14 -0
  86. package/type/customHooks/useRipples/callback/reload-background.d.ts +12 -0
  87. package/type/customHooks/useRipples/callback/scale.d.ts +8 -0
  88. package/type/customHooks/useRipples/index.d.ts +45 -0
  89. package/type/customHooks/useRipples/init/index.d.ts +11 -0
  90. package/type/customHooks/useRipples/init/initEvent.d.ts +11 -0
  91. package/type/customHooks/useRipples/init/initShaders.d.ts +13 -0
  92. package/type/customHooks/useRipples/init/initTexture.d.ts +13 -0
  93. package/type/customHooks/useRipples/render/computeTextureBoundaries.d.ts +9 -0
  94. package/type/customHooks/useRipples/render/draw.d.ts +13 -0
  95. package/type/customHooks/useRipples/render/drawQuad.d.ts +13 -0
  96. package/{dist/types → type}/customHooks/useRipples/render/dropAtPointer.d.ts +8 -2
  97. package/type/customHooks/useRipples/render/index.d.ts +12 -0
  98. package/type/customHooks/useRipples/render/swapBufferIndices.d.ts +11 -0
  99. package/type/customHooks/useRipples/render/update.d.ts +11 -0
  100. package/type/customHooks/useRipples/rippersData/defaultData.d.ts +11 -0
  101. package/type/customHooks/useRipples/rippersData/fadeData.d.ts +51 -0
  102. package/{dist/types → type}/customHooks/useRipples/rippersData/index.d.ts +24 -18
  103. package/{dist/types → type}/customHooks/useRipples/rippersData/loadConfig.d.ts +12 -2
  104. package/type/customHooks/useRipples/rippersData/renderData.d.ts +80 -0
  105. package/type/customHooks/useRipples/rippersData/useOptions.d.ts +91 -0
  106. package/{dist/types → type}/customHooks/useRipples/rippersData/vertexSource.d.ts +17 -11
  107. package/type/customHooks/useRipples/ripple.html.d.ts +12 -0
  108. package/type/customHooks/useRipples/ripplesClass.d.ts +57 -0
  109. package/{dist/types → type}/customHooks/useRipples/tools.d.ts +18 -8
  110. package/type/customHooks/useRipples/types.d.ts +209 -0
  111. package/type/customHooks/useRipples/use-lazy-ripple.d.ts +15 -0
  112. package/{dist/types → type}/customHooks/useTimeId.d.ts +10 -6
  113. package/type/dog.d.ts +8 -0
  114. package/type/index.client.d.ts +20 -0
  115. package/type/index.d.ts +8 -0
  116. package/type/index.server.d.ts +8 -0
  117. package/type/storage/main-logic .d.ts +26 -0
  118. package/type/storage/storage-store.d.ts +14 -0
  119. package/type/utilities/cookie.d.ts +21 -0
  120. package/type/utilities/sys.d.ts +41 -0
  121. package/ReadMe.md +0 -17
  122. package/dist/BackgroundRipple/index.cjs +0 -1
  123. package/dist/BackgroundRipple/index.mjs +0 -1
  124. package/dist/index.cjs +0 -1
  125. package/dist/index.js +0 -1
  126. package/dist/index.mjs +0 -1
  127. package/dist/styles/common.css +0 -353
  128. package/dist/styles/common.scss +0 -504
  129. package/dist/types/components/button/button.d.ts +0 -2
  130. package/dist/types/components/button/index.d.ts +0 -3
  131. package/dist/types/components/button/style/index.d.ts +0 -1
  132. package/dist/types/components/index.d.ts +0 -1
  133. package/dist/types/components/layout/header.d.ts +0 -4
  134. package/dist/types/components/layout/index.d.ts +0 -0
  135. package/dist/types/components/layout/interface.d.ts +0 -8
  136. package/dist/types/components/layout/layout.d.ts +0 -14
  137. package/dist/types/components/menu/index.d.ts +0 -0
  138. package/dist/types/components/menu/menu.d.ts +0 -0
  139. package/dist/types/components/menu/style/index.d.ts +0 -0
  140. package/dist/types/components/ripples/RipplesEle.d.ts +0 -33
  141. package/dist/types/components/ripples/index.d.ts +0 -2
  142. package/dist/types/components/ripples/style/index.d.ts +0 -0
  143. package/dist/types/customHooks/index.d.ts +0 -5
  144. package/dist/types/customHooks/useAnimationFrame.d.ts +0 -41
  145. package/dist/types/customHooks/useInputIsComposing.d.ts +0 -45
  146. package/dist/types/customHooks/useRipples/defaultData.d.ts +0 -5
  147. package/dist/types/customHooks/useRipples/index.d.ts +0 -46
  148. package/dist/types/customHooks/useRipples/init/hideCssBackground.d.ts +0 -9
  149. package/dist/types/customHooks/useRipples/init/initEvent.d.ts +0 -5
  150. package/dist/types/customHooks/useRipples/init/initGL.d.ts +0 -5
  151. package/dist/types/customHooks/useRipples/init/initShaders.d.ts +0 -7
  152. package/dist/types/customHooks/useRipples/init/initTexture.d.ts +0 -7
  153. package/dist/types/customHooks/useRipples/init/loadImage.d.ts +0 -13
  154. package/dist/types/customHooks/useRipples/render/computeTextureBoundaries.d.ts +0 -7
  155. package/dist/types/customHooks/useRipples/render/drawQuad.d.ts +0 -7
  156. package/dist/types/customHooks/useRipples/render/render.d.ts +0 -7
  157. package/dist/types/customHooks/useRipples/render/step.d.ts +0 -6
  158. package/dist/types/customHooks/useRipples/render/swapBufferIndices.d.ts +0 -2
  159. package/dist/types/customHooks/useRipples/render/update.d.ts +0 -2
  160. package/dist/types/customHooks/useRipples/rippersData/createImageData.d.ts +0 -4
  161. package/dist/types/customHooks/useRipples/rippersData/renderData.d.ts +0 -85
  162. package/dist/types/customHooks/useRipples/ripple.html.d.ts +0 -3
  163. package/dist/types/customHooks/useRipples/ripplesClass.d.ts +0 -120
  164. package/dist/types/index.d.ts +0 -3
  165. package/dist/useAnimationFrame/index.cjs +0 -1
  166. package/dist/useAnimationFrame/index.mjs +0 -1
  167. package/dist/useInputIsComposing/index.cjs +0 -1
  168. package/dist/useInputIsComposing/index.mjs +0 -1
  169. package/dist/useRipples/index.cjs +0 -1
  170. package/dist/useRipples/index.mjs +0 -1
  171. package/dist/useTimeId/index.cjs +0 -1
  172. package/dist/useTimeId/index.mjs +0 -1
package/ReadMe.md DELETED
@@ -1,17 +0,0 @@
1
- # oops ui
2
-
3
- oops! A rudimentary React UI
4
-
5
- ## Other languages
6
-
7
- [English](https://github.com/lmssee/npm-oops-ui/blob/main/README.md) [中文](https://github.com/lmssee/npm-oops-ui/blob/main/自述文件.md)
8
-
9
- ## install
10
-
11
- ```sh
12
- npm install --save oops-ui
13
- ```
14
-
15
- ## use
16
-
17
- see [oops ui](https://lmssee.com/oops-ui)
@@ -1 +0,0 @@
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})();
@@ -1 +0,0 @@
1
- import*as e from"a-element-inline-style";import*as t from"react";var r={463:(t,r,n)=>{n.d(r,{n:()=>re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},l={},n.d(l,a),l);var a,l;function s(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 u(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 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 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 g="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(g))){var n=this.styleElement;n.id=g,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,x(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=x(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(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 _=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(" "):k(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,k(t)?t=s.width*parseFloat(t)/100:"auto"!==t&&(t=parseFloat(t)),k(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=k(g)?(s.left+(s.width-Number(t))*parseFloat(g)/100).toString():(s.left+parseFloat(g)).toString(),v=k(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 k(e){return e.endsWith("%")}function C(){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(u,this,[i,0]),Reflect.apply(u,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(u,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(C,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(),s=e.clientX-l.left-o,u=e.clientY-l.top-a;this.drop(s,u,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=s(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=s(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=s("\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,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(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(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=J(a=t),Z(n=K(i,V()?Reflect.construct(a,l||[],J(i).constructor):a.apply(i,l)),"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 _(y),Object.defineProperties(n,{defaults:{value:n.defaults,writable:!1,enumerable:!1,configurable:!1}}),r&&"boolean"!=typeof r.interactive&&delete r.interactive;var s=Y(Y({},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,K(n)):(w[n.sole].parentElement=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,zIndex:-1,pointerEvents:"none"})}(e),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)}(t,e),r=t,n=[{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,s=o.dropProgram,c=o.textures,f=o.framebuffers,p=o.bufferWriteIndex,h=o.bufferReadIndex,d=l.offsetWidth,m=l.offsetHeight,g=Math.max(d,m);r/=g;var v=new Float32Array([(2*e-d)/g,(m-2*t)/g]);i.viewport(0,0,a,a),i.bindFramebuffer(i.FRAMEBUFFER,f[p]),Reflect.apply(u,this,[c[h]]),i.useProgram(s.id),i.uniform2fv(s.locations.center,v),i.uniform1f(s.locations.radius,r),i.uniform1f(s.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}}],n&&q(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);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}},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:()=>s});var a=i(649),l=i(463);function s(e){var t=(0,a.useRef)(null);return function(e,t){(0,a.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,l.n)(t,e),e),a.default.createElement("canvas",{ref:t})}var u=o.z;export{u as BackgroundRipple};
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.oops=t():e.oops=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 DELETED
@@ -1 +0,0 @@
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(463);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),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}},463:(t,r,n)=>{n.d(r,{n:()=>re});var i=n(649);const o=(a={setStyle:()=>e.setStyle},l={},n.d(l,a),l);var a,l;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,x(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=x(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(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 _=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 M(){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 X="\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(X,"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(X,"\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(M,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(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=J(a=t),Z(n=K(i,V()?Reflect.construct(a,l||[],J(i).constructor):a.apply(i,l)),"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 _(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===e.parentElement||null===n.config||null===n.gl?(n.initState=!1,K(n)):(w[n.sole].parentElement=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,zIndex:-1,pointerEvents:"none"})}(e),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)}(t,e),r=t,n=[{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}}],n&&q(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(g);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}},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:()=>s.M,t3:()=>l.t,nC:()=>c.n,Oe:()=>u.O});var a=i(805),l=i(195),u=i(552),s=i(615),c=i(463),f=o.z_,p=o.MM,h=o.t3,d=o.nC,m=o.Oe;export{f as BackgroundRipple,p as useAnimationFrameId,h as useInputIsComposing,d as useRipples,m as useTimeId};