nodality 1.0.190 → 1.0.191

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 (192) hide show
  1. package/dist/animator.cjs.js +1 -1
  2. package/dist/animator.esm.js +1 -1
  3. package/dist/audionew.cjs.js +1 -1
  4. package/dist/audionew.esm.js +1 -1
  5. package/dist/base.cjs.js +1 -1
  6. package/dist/base.esm.js +1 -1
  7. package/dist/beta-desktop-bar.cjs.js +1 -1
  8. package/dist/beta-desktop-bar.esm.js +1 -1
  9. package/dist/beta-mobile-bar.cjs.js +1 -1
  10. package/dist/beta-mobile-bar.esm.js +1 -1
  11. package/dist/bundle.umd.js +1 -1
  12. package/dist/button.cjs.js +1 -1
  13. package/dist/button.esm.js +1 -1
  14. package/dist/center.cjs.js +1 -1
  15. package/dist/center.esm.js +1 -1
  16. package/dist/checkbox.cjs.js +1 -1
  17. package/dist/checkbox.esm.js +1 -1
  18. package/dist/code.cjs.js +1 -1
  19. package/dist/code.esm.js +1 -1
  20. package/dist/container.cjs.js +1 -1
  21. package/dist/container.esm.js +1 -1
  22. package/dist/data-list.cjs.js +1 -1
  23. package/dist/data-list.esm.js +1 -1
  24. package/dist/designer.cjs.js +1 -1
  25. package/dist/designer.esm.js +1 -1
  26. package/dist/dropdown.cjs.js +1 -1
  27. package/dist/dropdown.esm.js +1 -1
  28. package/dist/element-mapper.cjs.js +1 -1
  29. package/dist/element-mapper.esm.js +1 -1
  30. package/dist/finalresult.esm.js +1 -1
  31. package/dist/flex-card.cjs.js +1 -1
  32. package/dist/flex-card.esm.js +1 -1
  33. package/dist/flex-grid.cjs.js +1 -1
  34. package/dist/flex-grid.esm.js +1 -1
  35. package/dist/flex-row.cjs.js +1 -1
  36. package/dist/flex-row.esm.js +1 -1
  37. package/dist/floating-input.cjs.js +1 -1
  38. package/dist/floating-input.esm.js +1 -1
  39. package/dist/free.cjs.js +1 -1
  40. package/dist/free.esm.js +1 -1
  41. package/dist/horizontal-scroller.cjs.js +1 -1
  42. package/dist/horizontal-scroller.esm.js +1 -1
  43. package/dist/image-picker.cjs.js +1 -1
  44. package/dist/image-picker.esm.js +1 -1
  45. package/dist/image.cjs.js +1 -1
  46. package/dist/image.esm.js +1 -1
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +1 -1
  49. package/dist/link-getter.cjs.js +1 -1
  50. package/dist/link-getter.esm.js +1 -1
  51. package/dist/link.cjs.js +1 -1
  52. package/dist/link.esm.js +1 -1
  53. package/dist/meta-adder.cjs.js +1 -1
  54. package/dist/meta-adder.esm.js +1 -1
  55. package/dist/modal-2025.cjs.js +1 -1
  56. package/dist/modal-2025.esm.js +1 -1
  57. package/dist/multiswitcher.cjs.js +1 -1
  58. package/dist/multiswitcher.esm.js +1 -1
  59. package/dist/new-nav-bar.cjs.js +1 -1
  60. package/dist/new-nav-bar.esm.js +1 -1
  61. package/dist/picker.cjs.js +1 -1
  62. package/dist/picker.esm.js +1 -1
  63. package/dist/progress.cjs.js +1 -1
  64. package/dist/progress.esm.js +1 -1
  65. package/dist/radio.cjs.js +1 -1
  66. package/dist/radio.esm.js +1 -1
  67. package/dist/range.cjs.js +1 -1
  68. package/dist/range.esm.js +1 -1
  69. package/dist/side-bar.cjs.js +1 -1
  70. package/dist/side-bar.esm.js +1 -1
  71. package/dist/side-nav-bar.cjs.js +1 -1
  72. package/dist/side-nav-bar.esm.js +1 -1
  73. package/dist/simple-bar.cjs.js +1 -1
  74. package/dist/simple-bar.esm.js +1 -1
  75. package/dist/slider-2025.cjs.js +1 -1
  76. package/dist/slider-2025.esm.js +1 -1
  77. package/dist/spacer.cjs.js +1 -1
  78. package/dist/spacer.esm.js +1 -1
  79. package/dist/stack.cjs.js +1 -1
  80. package/dist/stack.esm.js +1 -1
  81. package/dist/table.cjs.js +1 -1
  82. package/dist/table.esm.js +1 -1
  83. package/dist/text-field.cjs.js +1 -1
  84. package/dist/text-field.esm.js +1 -1
  85. package/dist/text.cjs.js +1 -1
  86. package/dist/text.esm.js +1 -1
  87. package/dist/ulist.cjs.js +1 -1
  88. package/dist/ulist.esm.js +1 -1
  89. package/dist/video.cjs.js +1 -1
  90. package/dist/video.esm.js +1 -1
  91. package/dist/wrap.cjs.js +1 -1
  92. package/dist/wrap.esm.js +1 -1
  93. package/dist/zoom-card.cjs.js +1 -1
  94. package/dist/zoom-card.esm.js +1 -1
  95. package/layout/animator.js +1 -1
  96. package/layout/audio.js +1 -1
  97. package/layout/audionew.js +1 -1
  98. package/layout/base-2.js +1 -1
  99. package/layout/base.js +1 -1
  100. package/layout/beta-desktop-bar.js +1 -1
  101. package/layout/beta-mobile-bar.js +1 -1
  102. package/layout/box.js +1 -1
  103. package/layout/button.js +1 -1
  104. package/layout/cards.js +1 -1
  105. package/layout/center.js +1 -1
  106. package/layout/checkbox.js +1 -1
  107. package/layout/circle.js +1 -1
  108. package/layout/clean-row.js +1 -1
  109. package/layout/code.js +1 -1
  110. package/layout/container.js +1 -1
  111. package/layout/custom.js +1 -1
  112. package/layout/div-image.js +1 -1
  113. package/layout/dropdown-2025.js +1 -1
  114. package/layout/dropdown.js +1 -1
  115. package/layout/empty-element.js +1 -1
  116. package/layout/external-stylesheet.js +1 -1
  117. package/layout/flex-card.js +1 -1
  118. package/layout/flex-grid.js +1 -1
  119. package/layout/flex-row.js +1 -1
  120. package/layout/footer.js +1 -1
  121. package/layout/form-components/custom.js +1 -1
  122. package/layout/form-components/data-list.js +1 -1
  123. package/layout/form-components/floating-input.js +1 -1
  124. package/layout/form-components/form-all.js +1 -1
  125. package/layout/form-components/form.js +1 -1
  126. package/layout/form-components/image-picker.js +1 -1
  127. package/layout/form-components/picker.js +1 -1
  128. package/layout/form-components/radio.js +1 -1
  129. package/layout/form-components/radiogroup.js +1 -1
  130. package/layout/form-components/range.js +1 -1
  131. package/layout/free.js +1 -1
  132. package/layout/grid-new.js +1 -1
  133. package/layout/grid-switcher.js +1 -1
  134. package/layout/grid.js +1 -1
  135. package/layout/group.js +1 -1
  136. package/layout/header.js +1 -1
  137. package/layout/horizontal-scroller.js +1 -1
  138. package/layout/image-old.js +1 -1
  139. package/layout/image.js +1 -1
  140. package/layout/index.js +1 -1
  141. package/layout/label.js +1 -1
  142. package/layout/link.js +1 -1
  143. package/layout/list-OLD.js +1 -1
  144. package/layout/list.js +1 -1
  145. package/layout/meta-adder.js +1 -1
  146. package/layout/modal-2025.js +1 -1
  147. package/layout/modernwrap.js +1 -1
  148. package/layout/multiswitcher.js +1 -1
  149. package/layout/multiswitcherBeta.js +1 -1
  150. package/layout/nav-bar.js +1 -1
  151. package/layout/nav-factor/custom-div.js +1 -1
  152. package/layout/navBar-OLD.js +1 -1
  153. package/layout/new-flat-adder.js +1 -1
  154. package/layout/new-nav-bar.js +1 -1
  155. package/layout/offset-container.js +1 -1
  156. package/layout/polygon.js +1 -1
  157. package/layout/prerender-site.js +1 -1
  158. package/layout/prerender.js +1 -1
  159. package/layout/progress.js +1 -1
  160. package/layout/row.js +1 -1
  161. package/layout/saved-new-nav-bar.js +1 -1
  162. package/layout/scroll-video.js +1 -1
  163. package/layout/side-bar.js +1 -1
  164. package/layout/side-nav-bar.js +1 -1
  165. package/layout/simple-bar.js +1 -1
  166. package/layout/slider-2025.js +1 -1
  167. package/layout/spacer.js +1 -1
  168. package/layout/stack.js +1 -1
  169. package/layout/styler.js +1 -1
  170. package/layout/svg.js +1 -1
  171. package/layout/switcher.js +1 -1
  172. package/layout/table.js +1 -1
  173. package/layout/text-field.js +1 -1
  174. package/layout/text.js +1 -1
  175. package/layout/ulist.js +1 -1
  176. package/layout/video.js +1 -1
  177. package/layout/without-new.js +1 -1
  178. package/layout/wrap.js +1 -1
  179. package/layout/zoom-card.js +1 -1
  180. package/lib/card-getter.js +1 -1
  181. package/lib/data.js +1 -1
  182. package/lib/designer.js +1 -1
  183. package/lib/element-mapper.js +1 -1
  184. package/lib/keyframe-animation.js +1 -1
  185. package/lib/link-getter.js +1 -1
  186. package/lib/raster-ops.js +77 -1
  187. package/lib/scroll-video.js +1 -1
  188. package/lib/seo.js +1 -1
  189. package/lib/stacker.js +1 -1
  190. package/lib/theme.js +1 -1
  191. package/lib/transform-anim.js +1 -1
  192. package/package.json +1 -1
package/dist/stack.esm.js CHANGED
@@ -1 +1 @@
1
- function t(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=function(t,e){if(t){if("string"==typeof t)return n(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,i=!0,u=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return i=t.done,t},e:function(t){u=!0,c=t},f:function(){try{i||null==o.return||o.return()}finally{if(u)throw c}}}}function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,o=Array(n);e<n;e++)o[e]=t[e];return o}!function(){try{var t=localStorage.getItem("nodality.theme.mode");if("light"===t||"dark"===t)return t}catch(t){}"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}();var e={static:function(t){return{x:.5*t.w,y:.5*t.h,amt:1}},mouse:function(t){return{x:t.mouseX,y:t.mouseY,amt:1}},hover:function(t){return{x:t.mouseX,y:t.mouseY,amt:t.hover}},scroll:function(t){return{x:.5*t.w,y:t.h*t.scroll,amt:1}},time:function(t){return{x:t.w*(.5+.34*Math.cos(.6*t.t)),y:t.h*(.5+.34*Math.sin(.8*t.t)),amt:1}}},o=(Object.keys(e),{hexalize:{stage:"cell",decl:function(t){return"uniform float ".concat(t,"size;")},code:function(t){return"\n {\n vec2 hp = warped / ".concat(t,"size;\n vec2 hr = vec2(1.0, 1.7320508), hh = hr * 0.5;\n vec2 ha = mod(hp, hr) - hh, hb = mod(hp - hh, hr) - hh;\n vec2 gv = dot(ha, ha) < dot(hb, hb) ? ha : hb;\n center = (hp - gv) * ").concat(t,"size;\n gv = abs(gv);\n edge = max(edge, smoothstep(0.44, 0.5,\n max(dot(gv, normalize(vec2(1.0, 1.7320508))), gv.x)));\n }")},uniforms:function(t,n){return{size:["1f",(t.size||24)*n]}}},offset:{stage:"warp",defaultDriver:"mouse",decl:function(t){return"uniform float ".concat(t,"strength; uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos; uniform float ").concat(t,"damt;")},code:function(t){return"\n {\n float d = length(warped - ".concat(t,"dpos);\n float fall = 1.0 - smoothstep(0.0, ").concat(t,"radius, d);\n vec2 dir = d > 0.5 ? (warped - ").concat(t,"dpos) / d : vec2(0.0);\n warped -= dir * ").concat(t,"strength * fall * ").concat(t,"damt;\n }")},uniforms:function(t,n){return{strength:["1f",(t.strength||20)*n],radius:["1f",(t.radius||260)*n]}}},duotone:{stage:"color",decl:function(t){return"uniform vec3 ".concat(t,"a; uniform vec3 ").concat(t,"b; uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos; uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n vec3 duo = mix(".concat(t,"a, ").concat(t,"b, lum);\n ").concat(n.by?"float mask = (1.0 - smoothstep(".concat(t,"radius * 0.35, ").concat(t,"radius,\n length(center - ").concat(t,"dpos))) * ").concat(t,"damt;"):"float mask = 1.0;","\n col = mix(col, duo, mask);\n }")},uniforms:function(t,n){var e=t.colors||["#104B87","#E8FF00"];return{a:["3fv",r(e[0])],b:["3fv",r(e[1])],radius:["1f",(t.radius||220)*n]}}},edges:{stage:"color",decl:function(t){return"uniform vec3 ".concat(t,"color; uniform float ").concat(t,"strength;")},code:function(t){return"\n {\n edgeCol = ".concat(t,"color;\n edgeCov = max(edgeCov, edge * ").concat(t,"strength);\n }")},uniforms:function(t){return{color:["3fv",r(t.color||"#FFFFFF")],strength:["1f",null!=t.strength?t.strength:1]}}},halftone:{stage:"color",decl:function(t){return"\n uniform float ".concat(t,"size;\n uniform float ").concat(t,"angle;\n uniform vec3 ").concat(t,"ink;\n uniform vec3 ").concat(t,"paper;\n uniform float ").concat(t,"soft;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos;\n uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n float sz = ".concat(t,"size;").concat(n.by?"\n float fd = 1.0 - smoothstep(0.0, ".concat(t,"radius, length(frag - ").concat(t,"dpos));\n sz *= 1.0 + fd * ").concat(t,"damt * 1.8;"):"","\n // Screen angle: rotating the grid is what stops the dots\n // reading as a horizontal/vertical texture.\n float ca = cos(").concat(t,"angle), sa = sin(").concat(t,"angle);\n vec2 rp = vec2(ca * frag.x - sa * frag.y,\n sa * frag.x + ca * frag.y) / max(sz, 1.0);\n vec2 cell = fract(rp) - 0.5;\n // Dot radius from tone: darker tone prints a bigger dot.\n // sqrt because ink coverage goes as area, not radius.\n float rr = sqrt(clamp(1.0 - lum, 0.0, 1.0)) * 0.55;\n float dm = smoothstep(rr, rr - ").concat(t,"soft, length(cell));\n col = mix(").concat(t,"paper, ").concat(t,"ink, dm);\n }")},uniforms:function(t,n){return{size:["1f",(t.size||6)*n],angle:["1f",(null!=t.angle?t.angle:15)*Math.PI/180],ink:["3fv",r(t.ink||"#0B1B2B")],paper:["3fv",r(t.paper||"#FFFFFF")],soft:["1f",null!=t.softness?t.softness:.08],radius:["1f",(t.radius||220)*n]}}},aberration:{stage:"displace",chroma:!0,decl:function(t){return"\n uniform float ".concat(t,"amount;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos;\n uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n vec2 ctr = ".concat(n.by?"".concat(t,"dpos"):"u_res * 0.5",";\n vec2 dv = sampleP - ctr;\n float dl = length(dv);\n vec2 dir = dl > 0.5 ? dv / dl : vec2(0.0);\n ").concat(n.by?"float amt = ".concat(t,"amount * ").concat(t,"damt *\n (1.0 - smoothstep(0.0, ").concat(t,"radius, dl));"):"float amt = ".concat(t,"amount * (dl / max(length(u_res) * 0.5, 1.0));"),"\n chroma += dir * amt;\n }")},uniforms:function(t,n){return{amount:["1f",(null!=t.amount?t.amount:6)*n],radius:["1f",(t.radius||240)*n]}}},mask:{stage:"field",producesField:!0,defaultDriver:"static",decl:function(t){return"\n uniform vec2 ".concat(t,"dpos;\n uniform float ").concat(t,"damt;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"at;\n uniform vec2 ").concat(t,"remap;\n uniform float ").concat(t,"invert;")},code:function(t,n){var e=n.from||"radial",o=n.at?"(".concat(t,"at * u_res)"):"".concat(t,"dpos"),r="vertical"===e?"frag.y / max(u_res.y, 1.0)":"horizontal"===e?"frag.x / max(u_res.x, 1.0)":"1.0 - smoothstep(0.0, ".concat(t,"radius, length(frag - ").concat(o,"))");return"\n {\n float m = ".concat(r,";\n m = clamp((m - ").concat(t,"remap.x) / max(").concat(t,"remap.y - ").concat(t,"remap.x, 1e-4), 0.0, 1.0);\n m = mix(m, 1.0 - m, ").concat(t,"invert);\n ").concat(a(n.as||"mask")," *= m * ").concat(t,"damt;\n }")},uniforms:function(t,n){return{radius:["1f",(null!=t.radius?t.radius:260)*n],at:["2fv",t.at||[.5,.5]],remap:["2fv",t.remap||[0,1]],invert:["1f",t.invert?1:0]}}},noise:{stage:"field",producesField:!0,decl:function(t){return"\n uniform float ".concat(t,"scale;\n uniform float ").concat(t,"speed;\n uniform vec2 ").concat(t,"remap;\n uniform float ").concat(t,"amp;\n float ").concat(t,"h(vec2 v) {\n return fract(sin(dot(v, vec2(41.113, 289.717))) * 43758.545);\n }\n float ").concat(t,"n(vec2 v) {\n vec2 i = floor(v), f = v - i;\n f = f * f * (3.0 - 2.0 * f);\n return mix(mix(").concat(t,"h(i), ").concat(t,"h(i + vec2(1.0, 0.0)), f.x),\n mix(").concat(t,"h(i + vec2(0.0, 1.0)), ").concat(t,"h(i + vec2(1.0, 1.0)), f.x), f.y);\n }")},code:function(t,n){return"\n {\n vec2 np = frag / max(u_res.y, 1.0) * ".concat(t,"scale;\n // Two octaves: enough structure to read as turbulence\n // without the cost of a full fBm.\n float n = ").concat(t,"n(np + u_time * ").concat(t,"speed) * 0.65 +\n ").concat(t,"n(np * 2.7 - u_time * ").concat(t,"speed * 0.6) * 0.35;\n n = clamp((n - ").concat(t,"remap.x) / max(").concat(t,"remap.y - ").concat(t,"remap.x, 1e-4), 0.0, 1.0);\n ").concat(a(n.as||"mask")," *= mix(1.0, n, ").concat(t,"amp);\n }")},uniforms:function(t){return{scale:["1f",null!=t.scale?t.scale:3],speed:["1f",null!=t.speed?t.speed:.3],remap:["2fv",t.remap||[0,1]],amp:["1f",null!=t.amount?t.amount:1]}}},copy:{stage:"color",defaultDriver:"static",decl:function(t){return"\n uniform vec2 ".concat(t,"dpos;\n uniform float ").concat(t,"damt;\n uniform float ").concat(t,"radius;\n uniform float ").concat(t,"scale;\n uniform float ").concat(t,"rotate;\n uniform float ").concat(t,"fade;\n uniform float ").concat(t,"amount;")},code:function(t,n){for(var e=Array.isArray(n.points)&&n.points.length>0,o=e?n.points.length:Math.max(1,Math.min(24,Math.round(n.count||5))),r="",a=function(a){var c,i=e?"vec2(".concat((+n.points[a][0]).toFixed(5),", ").concat((+n.points[a][1]).toFixed(5),") * u_res"):(c=a/o*Math.PI*2,"".concat(t,"dpos + vec2(").concat(Math.cos(c).toFixed(5),", ")+"".concat(Math.sin(c).toFixed(5),") * ").concat(t,"radius"));r+="\n {\n float ang = ".concat(t,"rotate * ").concat((a+1).toFixed(1),";\n float cs = cos(ang), sn = sin(ang);\n // Inverse transform: to draw a stamp scaled by s about a\n // centre c, fetch from the source at (frag - c) / s.\n vec2 d = mat2(cs, -sn, sn, cs) * (frag - (").concat(i,"));\n vec2 q = d / max(").concat(t,"scale, 1e-3) + u_res * 0.5;\n vec2 quv = vec2(q.x / u_res.x, 1.0 - q.y / u_res.y);\n vec2 inside = step(vec2(0.0), quv) * step(quv, vec2(1.0));\n vec4 s = texture2D(u_tex, clamp(quv, 0.0, 1.0));\n float w = s.a * inside.x * inside.y * ").concat(t,"amount * ").concat(t,"damt\n * pow(").concat(t,"fade, ").concat(a.toFixed(1),");\n // Straight-alpha OVER, newest stamp on top.\n float na = w + ovA * (1.0 - w);\n ovCol = (s.rgb * w + ovCol * ovA * (1.0 - w)) / max(na, 1e-4);\n ovA = na;\n }")},c=0;c<o;c++)a(c);return r},uniforms:function(t,n){return{radius:["1f",(null!=t.radius?t.radius:110)*n],scale:["1f",null!=t.scale?t.scale:.5],rotate:["1f",null!=t.rotate?t.rotate:0],fade:["1f",null!=t.fade?t.fade:1],amount:["1f",null!=t.amount?t.amount:1]}}},merge:{stage:"color",decl:function(t){return"uniform float ".concat(t,"mix;")},code:function(){return""},uniforms:function(t){return{mix:["1f",null!=t.mix?t.mix:1]}}},echo:{stage:"color",decl:function(t){return"\n uniform sampler2D ".concat(t,"hist;\n uniform float ").concat(t,"strength;\n uniform vec3 ").concat(t,"tint;\n uniform float ").concat(t,"tintAmt;")},code:function(t){return"\n {\n // Sampled in screen space: the trail records where things\n // WERE, which is not where a warp op would fetch them from.\n vec2 huv = vec2(frag.x / u_res.x, 1.0 - frag.y / u_res.y);\n vec4 h = texture2D(".concat(t,"hist, clamp(huv, 0.001, 0.999));\n float ha = clamp(h.a * ").concat(t,"strength, 0.0, 1.0);\n vec3 hc = mix(h.rgb, ").concat(t,"tint, ").concat(t,"tintAmt);\n // Straight-alpha OVER into the border layer so an edges op\n // in the same chain still composites correctly.\n float na = ha + edgeCov * (1.0 - ha);\n edgeCol = (hc * ha + edgeCol * edgeCov * (1.0 - ha)) / max(na, 1e-4);\n edgeCov = na;\n }")},uniforms:function(t){return{strength:["1f",null!=t.strength?t.strength:.85],tint:["3fv",r(t.tint||"#7FD4FF")],tintAmt:["1f",t.tint?null!=t.tintAmount?t.tintAmount:.5:0]}},solver:{resolutions:function(t,n,e){return{frame:[n,e]}},targets:{history:{double:!0,res:"frame",fmt:"rgba",smooth:!0}},samplers:{hist:"history"},programs:{accumulate:"\nprecision highp float;\nuniform sampler2D u_content;\nuniform sampler2D u_hist;\nuniform vec2 u_texel;\nuniform float u_decay;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec4 c = texture2D(u_content, uv);\n vec4 h = texture2D(u_hist, uv) * u_decay;\n gl_FragColor = max(c, h);\n}"},splatColor:function(){return[0,0,0]},step:function(t,n,e){var o=Math.min(e.dt,1/30),r=Math.pow(null!=n.decay?n.decay:.92,60*o);t.use("accumulate"),t.f2("u_texel",1/t.canvasW,1/t.canvasH),t.f1("u_decay",r),t.smp("u_content",t.content,0),t.smp("u_hist",t.read("history"),1),t.blit(t.write("history")),t.swap("history")}}},stir:{stage:["warp","color"],decl:function(t){return"\n uniform sampler2D ".concat(t,"vel;\n uniform sampler2D ").concat(t,"dye;\n uniform float ").concat(t,"strength;\n uniform float ").concat(t,"dyemix;\n uniform float ").concat(t,"intensity;\n uniform float ").concat(t,"sheen;\n uniform vec3 ").concat(t,"tint;")},code:function(t,n,e){return"warp"===e?"\n {\n // frag/warped are top-down pixels, the field is bottom-up\n // [0,1]: flip y going in, and flip the y of the vector coming\n // out so the content drags WITH the pointer.\n vec2 fuv = vec2(warped.x / u_res.x, 1.0 - warped.y / u_res.y);\n vec2 v = texture2D(".concat(t,"vel, clamp(fuv, 0.001, 0.999)).xy;\n warped += vec2(v.x, -v.y) * ").concat(t,"strength;\n }"):"\n {\n // Sampled at the CONTINUOUS warped position, never at the\n // cell centre: a cell op upstream (hexalize) snaps the cell\n // centre to one point per tile, which would quantise the\n // liquid into flat per-hex patches instead of smooth swirls.\n vec2 suv = vec2(warped.x / u_res.x, 1.0 - warped.y / u_res.y);\n vec3 dc = texture2D(".concat(t,"dye, clamp(suv, 0.001, 0.999)).rgb;\n float mag = length(dc);\n // Colour is carried IN the dye field and advected with it, so\n // a ribbon keeps its hue while the flow folds it. Deriving\n // colour from the local flow direction instead would make\n // neighbouring pixels jump hue and read as confetti.\n vec3 liquid = mag > 1e-4 ? clamp(dc / mag * 1.25, 0.0, 1.0) : ").concat(t,"tint;\n float amt = clamp((1.0 - exp(-mag * ").concat(t,"intensity)) * ").concat(t,"dyemix, 0.0, 1.0);\n // Straight-alpha OVER so a later overlay op (blobs) still\n // composites correctly on top of the liquid.\n float na = amt + ovA * (1.0 - amt);\n ovCol = (liquid * amt + ovCol * ovA * (1.0 - amt)) / max(na, 1e-4);\n ovA = na;\n\n // Faint sheen on the content itself where the flow is fast.\n float sp = length(texture2D(").concat(t,"vel, clamp(suv, 0.001, 0.999)).xy);\n col = mix(col, ").concat(t,"tint, (1.0 - exp(-sp * 0.7)) * ").concat(t,"sheen);\n }")},uniforms:function(t,n){return{strength:["1f",(null!=t.strength?t.strength:26)*n],sheen:["1f",null!=t.sheen?t.sheen:.15],tint:["3fv",r(t.tint||"#7FD4FF")],dyemix:["1f",null!=t.dye?t.dye:.85],intensity:["1f",null!=t.intensity?t.intensity:1.6]}},solver:{resolutions:function(t){return{sim:Math.max(32,Math.min(t.resolution||128,512)),dye:Math.max(64,Math.min(t.dyeResolution||512,1024))}},targets:{velocity:{double:!0,res:"sim",fmt:"rg",smooth:!0},dye:{double:!0,res:"dye",fmt:"rgba",smooth:!0},pressure:{double:!0,res:"sim",fmt:"r",smooth:!1},divergence:{double:!1,res:"sim",fmt:"r",smooth:!1},vorticity:{double:!1,res:"sim",fmt:"r",smooth:!1}},samplers:{vel:"velocity",dye:"dye"},programs:{splat:"\nprecision highp float;\nuniform sampler2D u_src;\nuniform vec2 u_texel;\nuniform vec2 u_point;\nuniform vec3 u_amount;\nuniform float u_radius;\nuniform float u_aspect;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec2 d = uv - u_point;\n if (u_aspect >= 1.0) d.y /= u_aspect; else d.x *= u_aspect;\n float g = exp(-dot(d, d) / max(u_radius * u_radius, 1e-6));\n gl_FragColor = vec4(texture2D(u_src, uv).xyz + u_amount * g, 1.0);\n}",advect:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform sampler2D u_src;\nuniform vec2 u_texel;\nuniform float u_dt;\nuniform float u_diss;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec2 back = uv - texture2D(u_vel, uv).xy * u_dt;\n gl_FragColor = vec4(texture2D(u_src, clamp(back, 0.0, 1.0)).xyz * u_diss, 1.0);\n}",curl:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_vel, uv + vec2(u_texel.x, 0.0)).y;\n float l = texture2D(u_vel, uv - vec2(u_texel.x, 0.0)).y;\n float t = texture2D(u_vel, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_vel, uv - vec2(0.0, u_texel.y)).x;\n gl_FragColor = vec4(0.5 * ((r - l) - (t - b)), 0.0, 0.0, 1.0);\n}",confine:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform sampler2D u_curl;\nuniform vec2 u_texel;\nuniform float u_eps;\nuniform float u_dt;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_curl, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_curl, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_curl, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_curl, uv - vec2(0.0, u_texel.y)).x;\n float c = texture2D(u_curl, uv).x;\n vec2 grad = 0.5 * vec2(abs(r) - abs(l), abs(t) - abs(b));\n vec2 n = grad / (length(grad) + 1e-5);\n vec2 force = u_eps * c * vec2(n.y, -n.x);\n vec2 v = texture2D(u_vel, uv).xy + force * u_dt;\n gl_FragColor = vec4(clamp(v, -64.0, 64.0), 0.0, 1.0);\n}",divergence:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_vel, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_vel, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_vel, uv + vec2(0.0, u_texel.y)).y;\n float b = texture2D(u_vel, uv - vec2(0.0, u_texel.y)).y;\n vec2 c = texture2D(u_vel, uv).xy;\n if (uv.x - u_texel.x < 0.0) l = -c.x;\n if (uv.x + u_texel.x > 1.0) r = -c.x;\n if (uv.y - u_texel.y < 0.0) b = -c.y;\n if (uv.y + u_texel.y > 1.0) t = -c.y;\n gl_FragColor = vec4(0.5 * ((r - l) + (t - b)), 0.0, 0.0, 1.0);\n}",jacobi:"\nprecision highp float;\nuniform sampler2D u_p;\nuniform sampler2D u_div;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_p, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_p, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_p, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_p, uv - vec2(0.0, u_texel.y)).x;\n float d = texture2D(u_div, uv).x;\n gl_FragColor = vec4((r + l + t + b - d) * 0.25, 0.0, 0.0, 1.0);\n}",subtract:"\nprecision highp float;\nuniform sampler2D u_p;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_p, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_p, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_p, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_p, uv - vec2(0.0, u_texel.y)).x;\n vec2 v = texture2D(u_vel, uv).xy - 0.5 * vec2(r - l, t - b);\n gl_FragColor = vec4(v, 0.0, 1.0);\n}",decay:"\nprecision highp float;\nuniform sampler2D u_tex;\nuniform vec2 u_texel;\nuniform float u_value;\nvoid main() {\n gl_FragColor = texture2D(u_tex, gl_FragCoord.xy * u_texel) * u_value;\n}"},splatColor:function(t,n,e){var o=null!=t.dyeAmount?t.dyeAmount:.6;if(!t.rainbow){var a=r(t.tint||"#7FD4FF");return[a[0]*o,a[1]*o,a[2]*o]}var c=Math.atan2(e,n);return[(.5+.5*Math.cos(c))*o,(.5+.5*Math.cos(c+2.0944))*o,(.5+.5*Math.cos(c+4.1888))*o]},step:function(t,n,e){var o=Math.min(e.dt,1/30),r=1/t.res.sim,a=1/t.res.dye,c=function(t,n){return Math.pow(t,60*n)};if(e.moving){var i=null!=n.force?n.force:1;t.use("splat"),t.f1("u_radius",null!=n.radius?n.radius:.1),t.f1("u_aspect",e.aspect),t.f2("u_point",e.px,e.py),t.f2("u_texel",r,r),t.smp("u_src",t.read("velocity"),0),t.f3("u_amount",e.dx*i,e.dy*i,0),t.blit(t.write("velocity")),t.swap("velocity"),t.f2("u_texel",a,a),t.smp("u_src",t.read("dye"),0),t.f3("u_amount",e.col[0],e.col[1],e.col[2]),t.blit(t.write("dye")),t.swap("dye")}t.use("curl"),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.blit(t.single("vorticity")),t.use("confine"),t.f2("u_texel",r,r),t.f1("u_eps",null!=n.curl?n.curl:2.2),t.f1("u_dt",o),t.smp("u_vel",t.read("velocity"),0),t.smp("u_curl",t.single("vorticity"),1),t.blit(t.write("velocity")),t.swap("velocity"),t.use("divergence"),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.blit(t.single("divergence")),t.use("decay"),t.f2("u_texel",r,r),t.f1("u_value",c(null!=n.pressure?n.pressure:.8,o)),t.smp("u_tex",t.read("pressure"),0),t.blit(t.write("pressure")),t.swap("pressure"),t.use("jacobi"),t.f2("u_texel",r,r),t.smp("u_div",t.single("divergence"),1);for(var u=Math.max(1,Math.min(n.pressureIterations||6,40)),l=0;l<u;l++)t.smp("u_p",t.read("pressure"),0),t.blit(t.write("pressure")),t.swap("pressure");t.use("subtract"),t.f2("u_texel",r,r),t.smp("u_p",t.read("pressure"),0),t.smp("u_vel",t.read("velocity"),1),t.blit(t.write("velocity")),t.swap("velocity"),t.use("advect"),t.f1("u_dt",o),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.smp("u_src",t.read("velocity"),0),t.f1("u_diss",c(null!=n.decay?n.decay:.985,o)),t.blit(t.write("velocity")),t.swap("velocity"),t.f2("u_texel",a,a),t.smp("u_vel",t.read("velocity"),0),t.smp("u_src",t.read("dye"),1),t.f1("u_diss",c(null!=n.dyeFade?n.dyeFade:.97,o)),t.blit(t.write("dye")),t.swap("dye")}}},blobs:{stage:"color",overlay:!0,mips:!0,decl:function(t){return"\n uniform vec3 ".concat(t,"blobs[").concat(12,"];\n uniform int ").concat(t,"count;\n uniform vec3 ").concat(t,"tint;\n uniform float ").concat(t,"refract;\n uniform float ").concat(t,"rim;\n uniform float ").concat(t,"alpha;\n uniform float ").concat(t,"irid;\n uniform float ").concat(t,"disp;\n uniform float ").concat(t,"frost;\n float ").concat(t,"hash(vec3 v) {\n return fract(sin(dot(v, vec3(21.9898, 63.233, 41.719))) * 41739.317);\n }\n float ").concat(t,"noise(vec3 v) {\n vec3 f = floor(v);\n vec3 r = v - f;\n r = r * r * (3.0 - 2.0 * r);\n float c000 = ").concat(t,"hash(f);\n float c100 = ").concat(t,"hash(f + vec3(1.0, 0.0, 0.0));\n float c010 = ").concat(t,"hash(f + vec3(0.0, 1.0, 0.0));\n float c110 = ").concat(t,"hash(f + vec3(1.0, 1.0, 0.0));\n float c001 = ").concat(t,"hash(f + vec3(0.0, 0.0, 1.0));\n float c101 = ").concat(t,"hash(f + vec3(1.0, 0.0, 1.0));\n float c011 = ").concat(t,"hash(f + vec3(0.0, 1.0, 1.0));\n float c111 = ").concat(t,"hash(f + vec3(1.0, 1.0, 1.0));\n return mix(\n mix(mix(c000, c100, r.x), mix(c010, c110, r.x), r.y),\n mix(mix(c001, c101, r.x), mix(c011, c111, r.x), r.y), r.z);\n }")},code:function(t){return"\n {\n float field = 0.0;\n vec2 grad = vec2(0.0);\n for (int bi = 0; bi < ".concat(12,"; bi++) {\n if (bi >= ").concat(t,"count) break;\n vec2 bd = frag - ").concat(t,"blobs[bi].xy;\n float br = ").concat(t,"blobs[bi].z;\n float dd = max(dot(bd, bd), 1.0);\n field += (br * br) / dd;\n grad += (-2.0 * (br * br) / (dd * dd)) * bd;\n }\n float bmask = smoothstep(0.6, 1.0, field);\n if (bmask > 0.003) {\n float gmag = length(grad);\n vec2 g2 = gmag > 1e-6 ? -grad / gmag : vec2(0.0);\n // Pseudo-3D surface normal from the 2D field. For a\n // metaball field (sum of r^2/d^2), 1/sqrt(field) IS the\n // normalized radial position: 0 at the centre, 1 at the\n // surface. That yields a true hemisphere profile — the\n // curvature (and therefore refraction) varies smoothly\n // across the WHOLE disc, not just an edge annulus.\n float s = clamp(inversesqrt(max(field, 1e-4)), 0.0, 1.0);\n vec3 n = normalize(vec3(g2 * s, sqrt(max(1.0 - s * s, 0.004))));\n vec3 rd = vec3(0.0, 0.0, -1.0);\n\n // Dispersion: refract each channel with a slightly\n // different index (water-glass ~1.33). Near the rim the\n // exit direction flattens (|z| -> 0), so the sampling\n // offsets stretch — producing the smooth concentric\n // colour-fringed bands of a thick lens.\n float ca = 0.03 * ").concat(t,"disp;\n vec3 tR = refract(rd, n, 1.0 / (1.33 - ca));\n vec3 tG = refract(rd, n, 1.0 / 1.33);\n vec3 tB = refract(rd, n, 1.0 / (1.33 + ca));\n vec2 oR = tR.xy * (").concat(t,"refract / max(abs(tR.z), 0.3));\n vec2 oG = tG.xy * (").concat(t,"refract / max(abs(tG.z), 0.3));\n vec2 oB = tB.xy * (").concat(t,"refract / max(abs(tB.z), 0.3));\n\n // Blur grows with how far the ray was bent (mip bias), so\n // strongly-refracted regions smear smoothly instead of\n // showing sharp displaced copies. frost adds a base blur.\n float lod = ").concat(t,"frost * 5.0 + log2(1.0 + length(oG) * 0.035);\n vec2 px = 1.0 / u_res;\n vec4 sG = texture2D(u_tex, clamp(uv + oG * px, 0.002, 0.998), lod);\n vec3 refr;\n refr.r = texture2D(u_tex, clamp(uv + oR * px, 0.002, 0.998), lod).r;\n refr.g = sG.g;\n refr.b = texture2D(u_tex, clamp(uv + oB * px, 0.002, 0.998), lod).b;\n // Blend in (approximately) linear light for clean fringes.\n refr = pow(max(refr, 0.0), vec3(2.2));\n\n vec3 tintLin = pow(").concat(t,"tint, vec3(2.2));\n vec3 bodyLin = mix(tintLin * 0.35, refr, sG.a);\n\n // Glass darkens toward the silhouette (absorption), the\n // opposite of an additive glow ring.\n float edge = pow(1.0 - clamp(n.z, 0.0, 1.0), 1.5);\n bodyLin *= 1.0 - 0.35 * ").concat(t,"rim * edge;\n vec3 body = pow(max(bodyLin, 0.0), vec3(1.0 / 2.2));\n\n // Sparse iridescent glints: two drifting value-noise\n // fields sampled on the reflection direction, one warm\n // one cool, sharpened hard so only sparkles survive.\n vec3 rf = reflect(rd, n);\n float nA = ").concat(t,"noise(rf * 2.3 + u_time * 0.5);\n float nB = ").concat(t,"noise(rf * 2.3 - u_time * 0.5);\n vec3 glint = pow(max(vec3(0.30, 0.52, 0.86) * nA +\n vec3(0.80, 0.56, 0.34) * nB, 0.0), vec3(6.0));\n body += glint * ").concat(t,"irid;\n\n // Small hard specular from a fixed key light.\n vec3 L = normalize(vec3(-0.5, 0.7, 0.6));\n float spec = pow(max(dot(reflect(-L, n), vec3(0.0, 0.0, 1.0)), 0.0), 60.0);\n body += spec * 0.35;\n\n ovCol = body;\n ovA = max(ovA, bmask * ").concat(t,"alpha);\n }\n }")},uniforms:function(t,n){return{tint:["3fv",r(t.color||"#EAF4EE")],refract:["1f",(null!=t.refract?t.refract:70)*n],rim:["1f",null!=t.rim?t.rim:.6],alpha:["1f",null!=t.alpha?t.alpha:1],irid:["1f",null!=t.iridescence?t.iridescence:.8],disp:["1f",null!=t.dispersion?t.dispersion:1],frost:["1f",null!=t.frost?t.frost:.25]}},init:function(t,n,e,o){for(var r=(t.radius||46)*n,a=Math.max(1,Math.min(null!=t.trail?t.trail:7,12)),c=[],i=0,u=0;u<a;u++){var l=Math.pow(.86,u);c.push(l),i+=l*l}for(var s=Math.sqrt(i),f=c.map(function(t){return r*t/s}),d=c.map(function(t,n){return.85*r*Math.pow(.955,n)}),m=function(t,n){return t+Math.random()*(n-t)},v=Math.max(0,Math.min((t.count||1)-1,12-a)),h=[],p=0;p<v;p++){var x=m(0,2*Math.PI),y=m(30,80)*n;h.push({x:m(r,e-r),y:m(r,o-r),r:r*m(.45,.8),vx:Math.cos(x)*y,vy:Math.sin(x)*y,phase:m(0,2*Math.PI)})}for(var g={x:.5*e,y:.55*o},_=[],b=0;b<a;b++)_.push({x:g.x,y:g.y});return{head:g,chain:_,nTrail:a,drifters:h,trailIdleR:f,trailMoveR:d,stretch:0,seg:.9*r}},tick:function(n,e){var o=Math.min(e.dt,.05),r=e.w,a=e.h,c=1-Math.exp(9*-o);n.head.x+=(e.mouseX-n.head.x)*c,n.head.y+=(e.mouseY-n.head.y)*c;var i=n.chain;i[0].x=n.head.x,i[0].y=n.head.y;for(var u=1-Math.exp(16*-o),l=1;l<i.length;l++){var s=i[l-1],f=i[l],d=s.x-f.x,m=s.y-f.y,v=Math.hypot(d,m)||1e-4,h=n.seg;v>h&&(f.x+=d*(1-h/v),f.y+=m*(1-h/v)),f.x+=(s.x-f.x)*u,f.y+=(s.y-f.y)*u}var p=i[i.length-1],x=Math.hypot(p.x-n.head.x,p.y-n.head.y),y=Math.max(1,n.seg*(n.nTrail-1)),g=Math.min(1,x/y);n.stretch+=(g-n.stretch)*(1-Math.exp(8*-o));var _,b=t(n.drifters);try{for(b.s();!(_=b.n()).done;){var w=_.value;w.x+=w.vx*o,w.y+=w.vy*o,w.x<w.r?(w.x=w.r,w.vx=Math.abs(w.vx)):w.x>r-w.r&&(w.x=r-w.r,w.vx=-Math.abs(w.vx)),w.y<w.r?(w.y=w.r,w.vy=Math.abs(w.vy)):w.y>a-w.r&&(w.y=a-w.r,w.vy=-Math.abs(w.vy)),w.phase+=1.6*o}}catch(t){b.e(t)}finally{b.f()}for(var D=new Float32Array(36),F=n.stretch,M=0;M<n.nTrail;M++){var k=i[M];D[3*M]=k.x,D[3*M+1]=k.y,D[3*M+2]=n.trailIdleR[M]+(n.trailMoveR[M]-n.trailIdleR[M])*F}return n.drifters.forEach(function(t,e){var o=n.nTrail+e;D[3*o]=t.x,D[3*o+1]=t.y,D[3*o+2]=t.r*(1+.12*Math.sin(t.phase))}),[{name:"blobs",kind:"3fv",value:D},{name:"count",kind:"1i",value:n.nTrail+n.drifters.length}]}}});function r(t){return[1,3,5].map(function(n){return parseInt(t.slice(n,n+2),16)/255})}Object.keys(o).concat("switch");var a=function(t){return"fld_".concat(String(t).replace(/[^A-Za-z0-9_]/g,""))};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function i(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,u(o.key),o)}}function u(t){var n=function(t){if("object"!=c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=c(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(n)?n:n+""}var l=function(){return t=function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.res=null,this.st=n},(n=[{key:"setup",value:function(){var t=document.createElement("div");return t.style.display="grid",this.res=t,this.st&&this.sticky(),this}},{key:"set",value:function(t){return this.setup(),t.height&&(this.res.style.height=t.height),t.sticky&&this.sticky(),this}},{key:"sticky",value:function(){return this.res.style.position="sticky",this.res.style.top=0,this}},{key:"add",value:function(t){this.children=t;for(var n=0;n<t.length;n++){var e=t[n].render();e.style.gridColumn=1,e.style.gridRow=1,this.res.appendChild(e)}return this}},{key:"toCode",value:function(){var t="new Stack().set({})";if(this.children.length>0){var n=this.children.map(function(t){return t.toCode()}).join(",\n");t+=".add([\n \n ".concat(n," \n \n])")}return[t]}},{key:"render",value:function(t){if(!t)return this.res;document.querySelector("body").style.margin=0,document.querySelector("body").style.padding=0,document.querySelector(t).appendChild(this.res)}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();export{l as Stack};
1
+ function t(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=function(t,e){if(t){if("string"==typeof t)return n(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,i=!0,u=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return i=t.done,t},e:function(t){u=!0,c=t},f:function(){try{i||null==o.return||o.return()}finally{if(u)throw c}}}}function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,o=Array(n);e<n;e++)o[e]=t[e];return o}!function(){try{var t=localStorage.getItem("nodality.theme.mode");if("light"===t||"dark"===t)return t}catch(t){}"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}();var e={static:function(t){return{x:.5*t.w,y:.5*t.h,amt:1}},mouse:function(t){return{x:t.mouseX,y:t.mouseY,amt:1}},hover:function(t){return{x:t.mouseX,y:t.mouseY,amt:t.hover}},scroll:function(t){return{x:.5*t.w,y:t.h*t.scroll,amt:1}},time:function(t){return{x:t.w*(.5+.34*Math.cos(.6*t.t)),y:t.h*(.5+.34*Math.sin(.8*t.t)),amt:1}}},o=(Object.keys(e),{hexalize:{stage:"cell",decl:function(t){return"uniform float ".concat(t,"size;")},code:function(t){return"\n {\n vec2 hp = warped / ".concat(t,"size;\n vec2 hr = vec2(1.0, 1.7320508), hh = hr * 0.5;\n vec2 ha = mod(hp, hr) - hh, hb = mod(hp - hh, hr) - hh;\n vec2 gv = dot(ha, ha) < dot(hb, hb) ? ha : hb;\n center = (hp - gv) * ").concat(t,"size;\n gv = abs(gv);\n edge = max(edge, smoothstep(0.44, 0.5,\n max(dot(gv, normalize(vec2(1.0, 1.7320508))), gv.x)));\n }")},uniforms:function(t,n){return{size:["1f",(t.size||24)*n]}}},offset:{stage:"warp",defaultDriver:"mouse",decl:function(t){return"uniform float ".concat(t,"strength; uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos; uniform float ").concat(t,"damt;")},code:function(t){return"\n {\n float d = length(warped - ".concat(t,"dpos);\n float fall = 1.0 - smoothstep(0.0, ").concat(t,"radius, d);\n vec2 dir = d > 0.5 ? (warped - ").concat(t,"dpos) / d : vec2(0.0);\n warped -= dir * ").concat(t,"strength * fall * ").concat(t,"damt;\n }")},uniforms:function(t,n){return{strength:["1f",(t.strength||20)*n],radius:["1f",(t.radius||260)*n]}}},duotone:{stage:"color",decl:function(t){return"uniform vec3 ".concat(t,"a; uniform vec3 ").concat(t,"b; uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos; uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n vec3 duo = mix(".concat(t,"a, ").concat(t,"b, lum);\n ").concat(n.by?"float mask = (1.0 - smoothstep(".concat(t,"radius * 0.35, ").concat(t,"radius,\n length(center - ").concat(t,"dpos))) * ").concat(t,"damt;"):"float mask = 1.0;","\n col = mix(col, duo, mask);\n }")},uniforms:function(t,n){var e=t.colors||["#104B87","#E8FF00"];return{a:["3fv",r(e[0])],b:["3fv",r(e[1])],radius:["1f",(t.radius||220)*n]}}},edges:{stage:"color",decl:function(t){return"uniform vec3 ".concat(t,"color; uniform float ").concat(t,"strength;")},code:function(t){return"\n {\n edgeCol = ".concat(t,"color;\n edgeCov = max(edgeCov, edge * ").concat(t,"strength);\n }")},uniforms:function(t){return{color:["3fv",r(t.color||"#FFFFFF")],strength:["1f",null!=t.strength?t.strength:1]}}},halftone:{stage:"color",decl:function(t){return"\n uniform float ".concat(t,"size;\n uniform float ").concat(t,"angle;\n uniform vec3 ").concat(t,"ink;\n uniform vec3 ").concat(t,"paper;\n uniform float ").concat(t,"soft;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos;\n uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n float sz = ".concat(t,"size;").concat(n.by?"\n float fd = 1.0 - smoothstep(0.0, ".concat(t,"radius, length(frag - ").concat(t,"dpos));\n sz *= 1.0 + fd * ").concat(t,"damt * 1.8;"):"","\n // Screen angle: rotating the grid is what stops the dots\n // reading as a horizontal/vertical texture.\n float ca = cos(").concat(t,"angle), sa = sin(").concat(t,"angle);\n vec2 rp = vec2(ca * frag.x - sa * frag.y,\n sa * frag.x + ca * frag.y) / max(sz, 1.0);\n vec2 cell = fract(rp) - 0.5;\n // Dot radius from tone: darker tone prints a bigger dot.\n // sqrt because ink coverage goes as area, not radius.\n float rr = sqrt(clamp(1.0 - lum, 0.0, 1.0)) * 0.55;\n float dm = smoothstep(rr, rr - ").concat(t,"soft, length(cell));\n col = mix(").concat(t,"paper, ").concat(t,"ink, dm);\n }")},uniforms:function(t,n){return{size:["1f",(t.size||6)*n],angle:["1f",(null!=t.angle?t.angle:15)*Math.PI/180],ink:["3fv",r(t.ink||"#0B1B2B")],paper:["3fv",r(t.paper||"#FFFFFF")],soft:["1f",null!=t.softness?t.softness:.08],radius:["1f",(t.radius||220)*n]}}},aberration:{stage:"displace",chroma:!0,decl:function(t){return"\n uniform float ".concat(t,"amount;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"dpos;\n uniform float ").concat(t,"damt;")},code:function(t,n){return"\n {\n vec2 ctr = ".concat(n.by?"".concat(t,"dpos"):"u_res * 0.5",";\n vec2 dv = sampleP - ctr;\n float dl = length(dv);\n vec2 dir = dl > 0.5 ? dv / dl : vec2(0.0);\n ").concat(n.by?"float amt = ".concat(t,"amount * ").concat(t,"damt *\n (1.0 - smoothstep(0.0, ").concat(t,"radius, dl));"):"float amt = ".concat(t,"amount * (dl / max(length(u_res) * 0.5, 1.0));"),"\n chroma += dir * amt;\n }")},uniforms:function(t,n){return{amount:["1f",(null!=t.amount?t.amount:6)*n],radius:["1f",(t.radius||240)*n]}}},mask:{stage:"field",producesField:!0,defaultDriver:"static",decl:function(t){return"\n uniform vec2 ".concat(t,"dpos;\n uniform float ").concat(t,"damt;\n uniform float ").concat(t,"radius;\n uniform vec2 ").concat(t,"at;\n uniform vec2 ").concat(t,"remap;\n uniform float ").concat(t,"invert;")},code:function(t,n){var e=n.from||"radial",o=n.at?"(".concat(t,"at * u_res)"):"".concat(t,"dpos"),r="vertical"===e?"frag.y / max(u_res.y, 1.0)":"horizontal"===e?"frag.x / max(u_res.x, 1.0)":"1.0 - smoothstep(0.0, ".concat(t,"radius, length(frag - ").concat(o,"))");return"\n {\n float m = ".concat(r,";\n m = clamp((m - ").concat(t,"remap.x) / max(").concat(t,"remap.y - ").concat(t,"remap.x, 1e-4), 0.0, 1.0);\n m = mix(m, 1.0 - m, ").concat(t,"invert);\n ").concat(a(n.as||"mask")," *= m * ").concat(t,"damt;\n }")},uniforms:function(t,n){return{radius:["1f",(null!=t.radius?t.radius:260)*n],at:["2fv",t.at||[.5,.5]],remap:["2fv",t.remap||[0,1]],invert:["1f",t.invert?1:0]}}},noise:{stage:"field",producesField:!0,decl:function(t){return"\n uniform float ".concat(t,"scale;\n uniform float ").concat(t,"speed;\n uniform vec2 ").concat(t,"remap;\n uniform float ").concat(t,"amp;\n float ").concat(t,"h(vec2 v) {\n return fract(sin(dot(v, vec2(41.113, 289.717))) * 43758.545);\n }\n float ").concat(t,"n(vec2 v) {\n vec2 i = floor(v), f = v - i;\n f = f * f * (3.0 - 2.0 * f);\n return mix(mix(").concat(t,"h(i), ").concat(t,"h(i + vec2(1.0, 0.0)), f.x),\n mix(").concat(t,"h(i + vec2(0.0, 1.0)), ").concat(t,"h(i + vec2(1.0, 1.0)), f.x), f.y);\n }")},code:function(t,n){return"\n {\n vec2 np = frag / max(u_res.y, 1.0) * ".concat(t,"scale;\n // Two octaves: enough structure to read as turbulence\n // without the cost of a full fBm.\n float n = ").concat(t,"n(np + u_time * ").concat(t,"speed) * 0.65 +\n ").concat(t,"n(np * 2.7 - u_time * ").concat(t,"speed * 0.6) * 0.35;\n n = clamp((n - ").concat(t,"remap.x) / max(").concat(t,"remap.y - ").concat(t,"remap.x, 1e-4), 0.0, 1.0);\n ").concat(a(n.as||"mask")," *= mix(1.0, n, ").concat(t,"amp);\n }")},uniforms:function(t){return{scale:["1f",null!=t.scale?t.scale:3],speed:["1f",null!=t.speed?t.speed:.3],remap:["2fv",t.remap||[0,1]],amp:["1f",null!=t.amount?t.amount:1]}}},copy:{stage:"color",defaultDriver:"static",decl:function(t){return"\n uniform vec2 ".concat(t,"dpos;\n uniform float ").concat(t,"damt;\n uniform float ").concat(t,"radius;\n uniform float ").concat(t,"scale;\n uniform float ").concat(t,"rotate;\n uniform float ").concat(t,"fade;\n uniform float ").concat(t,"amount;")},code:function(t,n){for(var e=Array.isArray(n.points)&&n.points.length>0,o=e?n.points.length:Math.max(1,Math.min(24,Math.round(n.count||5))),r="",a=function(a){var c,i=e?"vec2(".concat((+n.points[a][0]).toFixed(5),", ").concat((+n.points[a][1]).toFixed(5),") * u_res"):(c=a/o*Math.PI*2,"".concat(t,"dpos + vec2(").concat(Math.cos(c).toFixed(5),", ")+"".concat(Math.sin(c).toFixed(5),") * ").concat(t,"radius"));r+="\n {\n float ang = ".concat(t,"rotate * ").concat((a+1).toFixed(1),";\n float cs = cos(ang), sn = sin(ang);\n // Inverse transform: to draw a stamp scaled by s about a\n // centre c, fetch from the source at (frag - c) / s.\n vec2 d = mat2(cs, -sn, sn, cs) * (frag - (").concat(i,"));\n vec2 q = d / max(").concat(t,"scale, 1e-3) + u_res * 0.5;\n vec2 quv = vec2(q.x / u_res.x, 1.0 - q.y / u_res.y);\n vec2 inside = step(vec2(0.0), quv) * step(quv, vec2(1.0));\n vec4 s = texture2D(u_tex, clamp(quv, 0.0, 1.0));\n float w = s.a * inside.x * inside.y * ").concat(t,"amount * ").concat(t,"damt\n * pow(").concat(t,"fade, ").concat(a.toFixed(1),");\n // Straight-alpha OVER, newest stamp on top.\n float na = w + ovA * (1.0 - w);\n ovCol = (s.rgb * w + ovCol * ovA * (1.0 - w)) / max(na, 1e-4);\n ovA = na;\n }")},c=0;c<o;c++)a(c);return r},uniforms:function(t,n){return{radius:["1f",(null!=t.radius?t.radius:110)*n],scale:["1f",null!=t.scale?t.scale:.5],rotate:["1f",null!=t.rotate?t.rotate:0],fade:["1f",null!=t.fade?t.fade:1],amount:["1f",null!=t.amount?t.amount:1]}}},merge:{stage:"color",decl:function(t){return"uniform float ".concat(t,"mix;")},code:function(){return""},uniforms:function(t){return{mix:["1f",null!=t.mix?t.mix:1]}}},echo:{stage:"color",decl:function(t){return"\n uniform sampler2D ".concat(t,"hist;\n uniform float ").concat(t,"strength;\n uniform vec3 ").concat(t,"tint;\n uniform float ").concat(t,"tintAmt;")},code:function(t){return"\n {\n // Sampled in screen space: the trail records where things\n // WERE, which is not where a warp op would fetch them from.\n vec2 huv = vec2(frag.x / u_res.x, 1.0 - frag.y / u_res.y);\n vec4 h = texture2D(".concat(t,"hist, clamp(huv, 0.001, 0.999));\n float ha = clamp(h.a * ").concat(t,"strength, 0.0, 1.0);\n vec3 hc = mix(h.rgb, ").concat(t,"tint, ").concat(t,"tintAmt);\n // Straight-alpha OVER into the border layer so an edges op\n // in the same chain still composites correctly.\n float na = ha + edgeCov * (1.0 - ha);\n edgeCol = (hc * ha + edgeCol * edgeCov * (1.0 - ha)) / max(na, 1e-4);\n edgeCov = na;\n }")},uniforms:function(t){return{strength:["1f",null!=t.strength?t.strength:.85],tint:["3fv",r(t.tint||"#7FD4FF")],tintAmt:["1f",t.tint?null!=t.tintAmount?t.tintAmount:.5:0]}},solver:{resolutions:function(t,n,e){return{frame:[n,e]}},targets:{history:{double:!0,res:"frame",fmt:"rgba",smooth:!0}},samplers:{hist:"history"},programs:{accumulate:"\nprecision highp float;\nuniform sampler2D u_content;\nuniform sampler2D u_hist;\nuniform vec2 u_texel;\nuniform float u_decay;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec4 c = texture2D(u_content, uv);\n vec4 h = texture2D(u_hist, uv) * u_decay;\n gl_FragColor = max(c, h);\n}"},splatColor:function(){return[0,0,0]},step:function(t,n,e){var o=Math.min(e.dt,1/30),r=Math.pow(null!=n.decay?n.decay:.92,60*o);t.use("accumulate"),t.f2("u_texel",1/t.canvasW,1/t.canvasH),t.f1("u_decay",r),t.smp("u_content",t.content,0),t.smp("u_hist",t.read("history"),1),t.blit(t.write("history")),t.swap("history")}}},stir:{stage:["warp","color"],decl:function(t){return"\n uniform sampler2D ".concat(t,"vel;\n uniform sampler2D ").concat(t,"dye;\n uniform float ").concat(t,"strength;\n uniform float ").concat(t,"dyemix;\n uniform float ").concat(t,"intensity;\n uniform float ").concat(t,"sheen;\n uniform vec3 ").concat(t,"tint;")},code:function(t,n,e){return"warp"===e?"\n {\n // frag/warped are top-down pixels, the field is bottom-up\n // [0,1]: flip y going in, and flip the y of the vector coming\n // out so the content drags WITH the pointer.\n vec2 fuv = vec2(warped.x / u_res.x, 1.0 - warped.y / u_res.y);\n vec2 v = texture2D(".concat(t,"vel, clamp(fuv, 0.001, 0.999)).xy;\n warped += vec2(v.x, -v.y) * ").concat(t,"strength;\n }"):"\n {\n // Sampled at the CONTINUOUS warped position, never at the\n // cell centre: a cell op upstream (hexalize) snaps the cell\n // centre to one point per tile, which would quantise the\n // liquid into flat per-hex patches instead of smooth swirls.\n vec2 suv = vec2(warped.x / u_res.x, 1.0 - warped.y / u_res.y);\n vec3 dc = texture2D(".concat(t,"dye, clamp(suv, 0.001, 0.999)).rgb;\n float mag = length(dc);\n // Colour is carried IN the dye field and advected with it, so\n // a ribbon keeps its hue while the flow folds it. Deriving\n // colour from the local flow direction instead would make\n // neighbouring pixels jump hue and read as confetti.\n vec3 liquid = mag > 1e-4 ? clamp(dc / mag * 1.25, 0.0, 1.0) : ").concat(t,"tint;\n float amt = clamp((1.0 - exp(-mag * ").concat(t,"intensity)) * ").concat(t,"dyemix, 0.0, 1.0);\n // Straight-alpha OVER so a later overlay op (blobs) still\n // composites correctly on top of the liquid.\n float na = amt + ovA * (1.0 - amt);\n ovCol = (liquid * amt + ovCol * ovA * (1.0 - amt)) / max(na, 1e-4);\n ovA = na;\n\n // Faint sheen on the content itself where the flow is fast.\n float sp = length(texture2D(").concat(t,"vel, clamp(suv, 0.001, 0.999)).xy);\n col = mix(col, ").concat(t,"tint, (1.0 - exp(-sp * 0.7)) * ").concat(t,"sheen);\n }")},uniforms:function(t,n){return{strength:["1f",(null!=t.strength?t.strength:26)*n],sheen:["1f",null!=t.sheen?t.sheen:.15],tint:["3fv",r(t.tint||"#7FD4FF")],dyemix:["1f",null!=t.dye?t.dye:.85],intensity:["1f",null!=t.intensity?t.intensity:1.6]}},solver:{resolutions:function(t){return{sim:Math.max(32,Math.min(t.resolution||128,512)),dye:Math.max(64,Math.min(t.dyeResolution||512,1024))}},targets:{velocity:{double:!0,res:"sim",fmt:"rg",smooth:!0},dye:{double:!0,res:"dye",fmt:"rgba",smooth:!0},pressure:{double:!0,res:"sim",fmt:"r",smooth:!1},divergence:{double:!1,res:"sim",fmt:"r",smooth:!1},vorticity:{double:!1,res:"sim",fmt:"r",smooth:!1}},samplers:{vel:"velocity",dye:"dye"},programs:{splat:"\nprecision highp float;\nuniform sampler2D u_src;\nuniform vec2 u_texel;\nuniform vec2 u_point;\nuniform vec3 u_amount;\nuniform float u_radius;\nuniform float u_aspect;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec2 d = uv - u_point;\n if (u_aspect >= 1.0) d.y /= u_aspect; else d.x *= u_aspect;\n float g = exp(-dot(d, d) / max(u_radius * u_radius, 1e-6));\n gl_FragColor = vec4(texture2D(u_src, uv).xyz + u_amount * g, 1.0);\n}",advect:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform sampler2D u_src;\nuniform vec2 u_texel;\nuniform float u_dt;\nuniform float u_diss;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n vec2 back = uv - texture2D(u_vel, uv).xy * u_dt;\n gl_FragColor = vec4(texture2D(u_src, clamp(back, 0.0, 1.0)).xyz * u_diss, 1.0);\n}",curl:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_vel, uv + vec2(u_texel.x, 0.0)).y;\n float l = texture2D(u_vel, uv - vec2(u_texel.x, 0.0)).y;\n float t = texture2D(u_vel, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_vel, uv - vec2(0.0, u_texel.y)).x;\n gl_FragColor = vec4(0.5 * ((r - l) - (t - b)), 0.0, 0.0, 1.0);\n}",confine:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform sampler2D u_curl;\nuniform vec2 u_texel;\nuniform float u_eps;\nuniform float u_dt;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_curl, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_curl, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_curl, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_curl, uv - vec2(0.0, u_texel.y)).x;\n float c = texture2D(u_curl, uv).x;\n vec2 grad = 0.5 * vec2(abs(r) - abs(l), abs(t) - abs(b));\n vec2 n = grad / (length(grad) + 1e-5);\n vec2 force = u_eps * c * vec2(n.y, -n.x);\n vec2 v = texture2D(u_vel, uv).xy + force * u_dt;\n gl_FragColor = vec4(clamp(v, -64.0, 64.0), 0.0, 1.0);\n}",divergence:"\nprecision highp float;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_vel, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_vel, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_vel, uv + vec2(0.0, u_texel.y)).y;\n float b = texture2D(u_vel, uv - vec2(0.0, u_texel.y)).y;\n vec2 c = texture2D(u_vel, uv).xy;\n if (uv.x - u_texel.x < 0.0) l = -c.x;\n if (uv.x + u_texel.x > 1.0) r = -c.x;\n if (uv.y - u_texel.y < 0.0) b = -c.y;\n if (uv.y + u_texel.y > 1.0) t = -c.y;\n gl_FragColor = vec4(0.5 * ((r - l) + (t - b)), 0.0, 0.0, 1.0);\n}",jacobi:"\nprecision highp float;\nuniform sampler2D u_p;\nuniform sampler2D u_div;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_p, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_p, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_p, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_p, uv - vec2(0.0, u_texel.y)).x;\n float d = texture2D(u_div, uv).x;\n gl_FragColor = vec4((r + l + t + b - d) * 0.25, 0.0, 0.0, 1.0);\n}",subtract:"\nprecision highp float;\nuniform sampler2D u_p;\nuniform sampler2D u_vel;\nuniform vec2 u_texel;\nvoid main() {\n vec2 uv = gl_FragCoord.xy * u_texel;\n float r = texture2D(u_p, uv + vec2(u_texel.x, 0.0)).x;\n float l = texture2D(u_p, uv - vec2(u_texel.x, 0.0)).x;\n float t = texture2D(u_p, uv + vec2(0.0, u_texel.y)).x;\n float b = texture2D(u_p, uv - vec2(0.0, u_texel.y)).x;\n vec2 v = texture2D(u_vel, uv).xy - 0.5 * vec2(r - l, t - b);\n gl_FragColor = vec4(v, 0.0, 1.0);\n}",decay:"\nprecision highp float;\nuniform sampler2D u_tex;\nuniform vec2 u_texel;\nuniform float u_value;\nvoid main() {\n gl_FragColor = texture2D(u_tex, gl_FragCoord.xy * u_texel) * u_value;\n}"},splatColor:function(t,n,e){var o=null!=t.dyeAmount?t.dyeAmount:.6;if(!t.rainbow){var a=r(t.tint||"#7FD4FF");return[a[0]*o,a[1]*o,a[2]*o]}var c=Math.atan2(e,n);return[(.5+.5*Math.cos(c))*o,(.5+.5*Math.cos(c+2.0944))*o,(.5+.5*Math.cos(c+4.1888))*o]},step:function(t,n,e){var o=Math.min(e.dt,1/30),r=1/t.res.sim,a=1/t.res.dye,c=function(t,n){return Math.pow(t,60*n)};if(e.moving){var i=null!=n.force?n.force:1;t.use("splat"),t.f1("u_radius",null!=n.radius?n.radius:.1),t.f1("u_aspect",e.aspect),t.f2("u_point",e.px,e.py),t.f2("u_texel",r,r),t.smp("u_src",t.read("velocity"),0),t.f3("u_amount",e.dx*i,e.dy*i,0),t.blit(t.write("velocity")),t.swap("velocity"),t.f2("u_texel",a,a),t.smp("u_src",t.read("dye"),0),t.f3("u_amount",e.col[0],e.col[1],e.col[2]),t.blit(t.write("dye")),t.swap("dye")}t.use("curl"),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.blit(t.single("vorticity")),t.use("confine"),t.f2("u_texel",r,r),t.f1("u_eps",null!=n.curl?n.curl:2.2),t.f1("u_dt",o),t.smp("u_vel",t.read("velocity"),0),t.smp("u_curl",t.single("vorticity"),1),t.blit(t.write("velocity")),t.swap("velocity"),t.use("divergence"),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.blit(t.single("divergence")),t.use("decay"),t.f2("u_texel",r,r),t.f1("u_value",c(null!=n.pressure?n.pressure:.8,o)),t.smp("u_tex",t.read("pressure"),0),t.blit(t.write("pressure")),t.swap("pressure"),t.use("jacobi"),t.f2("u_texel",r,r),t.smp("u_div",t.single("divergence"),1);for(var u=Math.max(1,Math.min(n.pressureIterations||6,40)),l=0;l<u;l++)t.smp("u_p",t.read("pressure"),0),t.blit(t.write("pressure")),t.swap("pressure");t.use("subtract"),t.f2("u_texel",r,r),t.smp("u_p",t.read("pressure"),0),t.smp("u_vel",t.read("velocity"),1),t.blit(t.write("velocity")),t.swap("velocity"),t.use("advect"),t.f1("u_dt",o),t.f2("u_texel",r,r),t.smp("u_vel",t.read("velocity"),0),t.smp("u_src",t.read("velocity"),0),t.f1("u_diss",c(null!=n.decay?n.decay:.985,o)),t.blit(t.write("velocity")),t.swap("velocity"),t.f2("u_texel",a,a),t.smp("u_vel",t.read("velocity"),0),t.smp("u_src",t.read("dye"),1),t.f1("u_diss",c(null!=n.dyeFade?n.dyeFade:.97,o)),t.blit(t.write("dye")),t.swap("dye")}}},blobs:{stage:"color",overlay:!0,mips:!0,decl:function(t){return"\n uniform vec3 ".concat(t,"blobs[").concat(12,"];\n uniform int ").concat(t,"count;\n uniform vec3 ").concat(t,"tint;\n uniform float ").concat(t,"refract;\n uniform float ").concat(t,"rim;\n uniform float ").concat(t,"alpha;\n uniform float ").concat(t,"irid;\n uniform float ").concat(t,"disp;\n uniform float ").concat(t,"frost;\n float ").concat(t,"hash(vec3 v) {\n return fract(sin(dot(v, vec3(21.9898, 63.233, 41.719))) * 41739.317);\n }\n float ").concat(t,"noise(vec3 v) {\n vec3 f = floor(v);\n vec3 r = v - f;\n r = r * r * (3.0 - 2.0 * r);\n float c000 = ").concat(t,"hash(f);\n float c100 = ").concat(t,"hash(f + vec3(1.0, 0.0, 0.0));\n float c010 = ").concat(t,"hash(f + vec3(0.0, 1.0, 0.0));\n float c110 = ").concat(t,"hash(f + vec3(1.0, 1.0, 0.0));\n float c001 = ").concat(t,"hash(f + vec3(0.0, 0.0, 1.0));\n float c101 = ").concat(t,"hash(f + vec3(1.0, 0.0, 1.0));\n float c011 = ").concat(t,"hash(f + vec3(0.0, 1.0, 1.0));\n float c111 = ").concat(t,"hash(f + vec3(1.0, 1.0, 1.0));\n return mix(\n mix(mix(c000, c100, r.x), mix(c010, c110, r.x), r.y),\n mix(mix(c001, c101, r.x), mix(c011, c111, r.x), r.y), r.z);\n }")},code:function(t){return"\n {\n float field = 0.0;\n vec2 grad = vec2(0.0);\n for (int bi = 0; bi < ".concat(12,"; bi++) {\n if (bi >= ").concat(t,"count) break;\n vec2 bd = frag - ").concat(t,"blobs[bi].xy;\n float br = ").concat(t,"blobs[bi].z;\n float dd = max(dot(bd, bd), 1.0);\n field += (br * br) / dd;\n grad += (-2.0 * (br * br) / (dd * dd)) * bd;\n }\n float bmask = smoothstep(0.6, 1.0, field);\n if (bmask > 0.003) {\n float gmag = length(grad);\n vec2 g2 = gmag > 1e-6 ? -grad / gmag : vec2(0.0);\n // Pseudo-3D surface normal from the 2D field. For a\n // metaball field (sum of r^2/d^2), 1/sqrt(field) IS the\n // normalized radial position: 0 at the centre, 1 at the\n // surface. That yields a true hemisphere profile — the\n // curvature (and therefore refraction) varies smoothly\n // across the WHOLE disc, not just an edge annulus.\n float s = clamp(inversesqrt(max(field, 1e-4)), 0.0, 1.0);\n vec3 n = normalize(vec3(g2 * s, sqrt(max(1.0 - s * s, 0.004))));\n vec3 rd = vec3(0.0, 0.0, -1.0);\n\n // Dispersion: refract each channel with a slightly\n // different index (water-glass ~1.33). Near the rim the\n // exit direction flattens (|z| -> 0), so the sampling\n // offsets stretch — producing the smooth concentric\n // colour-fringed bands of a thick lens.\n float ca = 0.03 * ").concat(t,"disp;\n vec3 tR = refract(rd, n, 1.0 / (1.33 - ca));\n vec3 tG = refract(rd, n, 1.0 / 1.33);\n vec3 tB = refract(rd, n, 1.0 / (1.33 + ca));\n vec2 oR = tR.xy * (").concat(t,"refract / max(abs(tR.z), 0.3));\n vec2 oG = tG.xy * (").concat(t,"refract / max(abs(tG.z), 0.3));\n vec2 oB = tB.xy * (").concat(t,"refract / max(abs(tB.z), 0.3));\n\n // Blur grows with how far the ray was bent (mip bias), so\n // strongly-refracted regions smear smoothly instead of\n // showing sharp displaced copies. frost adds a base blur.\n float lod = ").concat(t,"frost * 5.0 + log2(1.0 + length(oG) * 0.035);\n vec2 px = 1.0 / u_res;\n vec4 sG = texture2D(u_tex, clamp(uv + oG * px, 0.002, 0.998), lod);\n vec3 refr;\n refr.r = texture2D(u_tex, clamp(uv + oR * px, 0.002, 0.998), lod).r;\n refr.g = sG.g;\n refr.b = texture2D(u_tex, clamp(uv + oB * px, 0.002, 0.998), lod).b;\n // Blend in (approximately) linear light for clean fringes.\n refr = pow(max(refr, 0.0), vec3(2.2));\n\n vec3 tintLin = pow(").concat(t,"tint, vec3(2.2));\n vec3 bodyLin = mix(tintLin * 0.35, refr, sG.a);\n\n // Glass darkens toward the silhouette (absorption), the\n // opposite of an additive glow ring.\n float edge = pow(1.0 - clamp(n.z, 0.0, 1.0), 1.5);\n bodyLin *= 1.0 - 0.35 * ").concat(t,"rim * edge;\n vec3 body = pow(max(bodyLin, 0.0), vec3(1.0 / 2.2));\n\n // Sparse iridescent glints: two drifting value-noise\n // fields sampled on the reflection direction, one warm\n // one cool, sharpened hard so only sparkles survive.\n vec3 rf = reflect(rd, n);\n float nA = ").concat(t,"noise(rf * 2.3 + u_time * 0.5);\n float nB = ").concat(t,"noise(rf * 2.3 - u_time * 0.5);\n vec3 glint = pow(max(vec3(0.30, 0.52, 0.86) * nA +\n vec3(0.80, 0.56, 0.34) * nB, 0.0), vec3(6.0));\n body += glint * ").concat(t,"irid;\n\n // Small hard specular from a fixed key light.\n vec3 L = normalize(vec3(-0.5, 0.7, 0.6));\n float spec = pow(max(dot(reflect(-L, n), vec3(0.0, 0.0, 1.0)), 0.0), 60.0);\n body += spec * 0.35;\n\n ovCol = body;\n ovA = max(ovA, bmask * ").concat(t,"alpha);\n }\n }")},uniforms:function(t,n){return{tint:["3fv",r(t.color||"#EAF4EE")],refract:["1f",(null!=t.refract?t.refract:70)*n],rim:["1f",null!=t.rim?t.rim:.6],alpha:["1f",null!=t.alpha?t.alpha:1],irid:["1f",null!=t.iridescence?t.iridescence:.8],disp:["1f",null!=t.dispersion?t.dispersion:1],frost:["1f",null!=t.frost?t.frost:.25]}},init:function(t,n,e,o){for(var r=(t.radius||46)*n,a=Math.max(1,Math.min(null!=t.trail?t.trail:7,12)),c=[],i=0,u=0;u<a;u++){var l=Math.pow(.86,u);c.push(l),i+=l*l}for(var s=Math.sqrt(i),f=c.map(function(t){return r*t/s}),d=c.map(function(t,n){return.85*r*Math.pow(.955,n)}),m=function(t,n){return t+Math.random()*(n-t)},v=Math.max(0,Math.min((t.count||1)-1,12-a)),h=[],p=0;p<v;p++){var x=m(0,2*Math.PI),y=m(30,80)*n;h.push({x:m(r,e-r),y:m(r,o-r),r:r*m(.45,.8),vx:Math.cos(x)*y,vy:Math.sin(x)*y,phase:m(0,2*Math.PI)})}for(var g={x:.5*e,y:.55*o},_=[],b=0;b<a;b++)_.push({x:g.x,y:g.y});return{head:g,chain:_,nTrail:a,drifters:h,trailIdleR:f,trailMoveR:d,stretch:0,seg:.9*r}},tick:function(n,e){var o=Math.min(e.dt,.05),r=e.w,a=e.h,c=1-Math.exp(9*-o);n.head.x+=(e.mouseX-n.head.x)*c,n.head.y+=(e.mouseY-n.head.y)*c;var i=n.chain;i[0].x=n.head.x,i[0].y=n.head.y;for(var u=1-Math.exp(16*-o),l=1;l<i.length;l++){var s=i[l-1],f=i[l],d=s.x-f.x,m=s.y-f.y,v=Math.hypot(d,m)||1e-4,h=n.seg;v>h&&(f.x+=d*(1-h/v),f.y+=m*(1-h/v)),f.x+=(s.x-f.x)*u,f.y+=(s.y-f.y)*u}var p=i[i.length-1],x=Math.hypot(p.x-n.head.x,p.y-n.head.y),y=Math.max(1,n.seg*(n.nTrail-1)),g=Math.min(1,x/y);n.stretch+=(g-n.stretch)*(1-Math.exp(8*-o));var _,b=t(n.drifters);try{for(b.s();!(_=b.n()).done;){var w=_.value;w.x+=w.vx*o,w.y+=w.vy*o,w.x<w.r?(w.x=w.r,w.vx=Math.abs(w.vx)):w.x>r-w.r&&(w.x=r-w.r,w.vx=-Math.abs(w.vx)),w.y<w.r?(w.y=w.r,w.vy=Math.abs(w.vy)):w.y>a-w.r&&(w.y=a-w.r,w.vy=-Math.abs(w.vy)),w.phase+=1.6*o}}catch(t){b.e(t)}finally{b.f()}for(var D=new Float32Array(36),F=n.stretch,M=0;M<n.nTrail;M++){var C=i[M];D[3*M]=C.x,D[3*M+1]=C.y,D[3*M+2]=n.trailIdleR[M]+(n.trailMoveR[M]-n.trailIdleR[M])*F}return n.drifters.forEach(function(t,e){var o=n.nTrail+e;D[3*o]=t.x,D[3*o+1]=t.y,D[3*o+2]=t.r*(1+.12*Math.sin(t.phase))}),[{name:"blobs",kind:"3fv",value:D},{name:"count",kind:"1i",value:n.nTrail+n.drifters.length}]}}});function r(t){return[1,3,5].map(function(n){return parseInt(t.slice(n,n+2),16)/255})}Object.keys(o).concat("switch");var a=function(t){return"fld_".concat(String(t).replace(/[^A-Za-z0-9_]/g,""))};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function i(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,u(o.key),o)}}function u(t){var n=function(t){if("object"!=c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=c(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(n)?n:n+""}new Set(["IMG","VIDEO","CANVAS","IFRAME","INPUT","EMBED","OBJECT","TEXTAREA","SELECT","BR","HR","AREA","SOURCE","TRACK","WBR"]);var l=function(){return t=function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.res=null,this.st=n},(n=[{key:"setup",value:function(){var t=document.createElement("div");return t.style.display="grid",this.res=t,this.st&&this.sticky(),this}},{key:"set",value:function(t){return this.setup(),t.height&&(this.res.style.height=t.height),t.sticky&&this.sticky(),this}},{key:"sticky",value:function(){return this.res.style.position="sticky",this.res.style.top=0,this}},{key:"add",value:function(t){this.children=t;for(var n=0;n<t.length;n++){var e=t[n].render();e.style.gridColumn=1,e.style.gridRow=1,this.res.appendChild(e)}return this}},{key:"toCode",value:function(){var t="new Stack().set({})";if(this.children.length>0){var n=this.children.map(function(t){return t.toCode()}).join(",\n");t+=".add([\n \n ".concat(n," \n \n])")}return[t]}},{key:"render",value:function(t){if(!t)return this.res;document.querySelector("body").style.margin=0,document.querySelector("body").style.padding=0,document.querySelector(t).appendChild(this.res)}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();export{l as Stack};