nodality 1.0.221 → 1.1.0

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 (279) hide show
  1. package/API.md +227 -0
  2. package/bin/nodality.js +64 -0
  3. package/dist/animator.cjs.js +1 -1
  4. package/dist/animator.cjs.js.LICENSE.txt +1 -1
  5. package/dist/animator.esm.js +1 -1
  6. package/dist/animator.esm.js.LICENSE.txt +1 -1
  7. package/dist/audionew.cjs.js +1 -1
  8. package/dist/audionew.cjs.js.LICENSE.txt +1 -1
  9. package/dist/audionew.esm.js +1 -1
  10. package/dist/audionew.esm.js.LICENSE.txt +1 -1
  11. package/dist/base.cjs.js +1 -1
  12. package/dist/base.cjs.js.LICENSE.txt +1 -1
  13. package/dist/base.esm.js +1 -1
  14. package/dist/base.esm.js.LICENSE.txt +1 -1
  15. package/dist/beta-desktop-bar.cjs.js +1 -1
  16. package/dist/beta-desktop-bar.cjs.js.LICENSE.txt +1 -1
  17. package/dist/beta-desktop-bar.esm.js +1 -1
  18. package/dist/beta-desktop-bar.esm.js.LICENSE.txt +1 -1
  19. package/dist/beta-mobile-bar.cjs.js +1 -1
  20. package/dist/beta-mobile-bar.cjs.js.LICENSE.txt +1 -1
  21. package/dist/beta-mobile-bar.esm.js +1 -1
  22. package/dist/beta-mobile-bar.esm.js.LICENSE.txt +1 -1
  23. package/dist/bundle.umd.js +1 -1
  24. package/dist/bundle.umd.js.LICENSE.txt +131 -1
  25. package/dist/button.cjs.js +1 -1
  26. package/dist/button.cjs.js.LICENSE.txt +1 -1
  27. package/dist/button.esm.js +1 -1
  28. package/dist/button.esm.js.LICENSE.txt +1 -1
  29. package/dist/card-getter.cjs.js.LICENSE.txt +1 -1
  30. package/dist/card-getter.esm.js.LICENSE.txt +1 -1
  31. package/dist/center.cjs.js +1 -1
  32. package/dist/center.cjs.js.LICENSE.txt +1 -1
  33. package/dist/center.esm.js +1 -1
  34. package/dist/center.esm.js.LICENSE.txt +1 -1
  35. package/dist/checkbox.cjs.js +1 -1
  36. package/dist/checkbox.cjs.js.LICENSE.txt +1 -1
  37. package/dist/checkbox.esm.js +1 -1
  38. package/dist/checkbox.esm.js.LICENSE.txt +1 -1
  39. package/dist/code.cjs.js +1 -1
  40. package/dist/code.cjs.js.LICENSE.txt +1 -1
  41. package/dist/code.esm.js +1 -1
  42. package/dist/code.esm.js.LICENSE.txt +1 -1
  43. package/dist/container.cjs.js +1 -1
  44. package/dist/container.cjs.js.LICENSE.txt +1 -1
  45. package/dist/container.esm.js +1 -1
  46. package/dist/container.esm.js.LICENSE.txt +1 -1
  47. package/dist/data-list.cjs.js +1 -1
  48. package/dist/data-list.cjs.js.LICENSE.txt +1 -1
  49. package/dist/data-list.esm.js +1 -1
  50. package/dist/data-list.esm.js.LICENSE.txt +1 -1
  51. package/dist/designer.cjs.js +1 -1
  52. package/dist/designer.cjs.js.LICENSE.txt +97 -1
  53. package/dist/designer.esm.js +1 -1
  54. package/dist/designer.esm.js.LICENSE.txt +97 -1
  55. package/dist/element-mapper.cjs.js +1 -1
  56. package/dist/element-mapper.cjs.js.LICENSE.txt +17 -1
  57. package/dist/element-mapper.esm.js +1 -1
  58. package/dist/element-mapper.esm.js.LICENSE.txt +17 -1
  59. package/dist/finalresult.esm.js +1 -1
  60. package/dist/finalresult.esm.js.LICENSE.txt +158 -1
  61. package/dist/flex-card.cjs.js +1 -1
  62. package/dist/flex-card.cjs.js.LICENSE.txt +1 -1
  63. package/dist/flex-card.esm.js +1 -1
  64. package/dist/flex-card.esm.js.LICENSE.txt +1 -1
  65. package/dist/flex-grid.cjs.js +1 -1
  66. package/dist/flex-grid.cjs.js.LICENSE.txt +1 -1
  67. package/dist/flex-grid.esm.js +1 -1
  68. package/dist/flex-grid.esm.js.LICENSE.txt +1 -1
  69. package/dist/flex-row.cjs.js +1 -1
  70. package/dist/flex-row.cjs.js.LICENSE.txt +1 -1
  71. package/dist/flex-row.esm.js +1 -1
  72. package/dist/flex-row.esm.js.LICENSE.txt +1 -1
  73. package/dist/floating-input.cjs.js +1 -1
  74. package/dist/floating-input.cjs.js.LICENSE.txt +1 -1
  75. package/dist/floating-input.esm.js +1 -1
  76. package/dist/floating-input.esm.js.LICENSE.txt +1 -1
  77. package/dist/free.cjs.js +1 -1
  78. package/dist/free.cjs.js.LICENSE.txt +1 -1
  79. package/dist/free.esm.js +1 -1
  80. package/dist/free.esm.js.LICENSE.txt +1 -1
  81. package/dist/horizontal-scroller.cjs.js.LICENSE.txt +1 -1
  82. package/dist/horizontal-scroller.esm.js.LICENSE.txt +1 -1
  83. package/dist/image-picker.cjs.js +1 -1
  84. package/dist/image-picker.cjs.js.LICENSE.txt +1 -1
  85. package/dist/image-picker.esm.js +1 -1
  86. package/dist/image-picker.esm.js.LICENSE.txt +1 -1
  87. package/dist/image.cjs.js +1 -1
  88. package/dist/image.cjs.js.LICENSE.txt +1 -1
  89. package/dist/image.esm.js +1 -1
  90. package/dist/image.esm.js.LICENSE.txt +1 -1
  91. package/dist/index.cjs.js +1 -1
  92. package/dist/index.cjs.js.LICENSE.txt +158 -1
  93. package/dist/index.d.ts +962 -0
  94. package/dist/index.esm.js +1 -1
  95. package/dist/index.esm.js.LICENSE.txt +158 -1
  96. package/dist/keyframe-animation.cjs.js.LICENSE.txt +1 -1
  97. package/dist/keyframe-animation.esm.js.LICENSE.txt +1 -1
  98. package/dist/link-getter.cjs.js +1 -1
  99. package/dist/link-getter.cjs.js.LICENSE.txt +1 -1
  100. package/dist/link-getter.esm.js +1 -1
  101. package/dist/link-getter.esm.js.LICENSE.txt +1 -1
  102. package/dist/link.cjs.js +1 -1
  103. package/dist/link.cjs.js.LICENSE.txt +1 -1
  104. package/dist/link.esm.js +1 -1
  105. package/dist/link.esm.js.LICENSE.txt +1 -1
  106. package/dist/meta-adder.cjs.js +1 -1
  107. package/dist/meta-adder.cjs.js.LICENSE.txt +1 -1
  108. package/dist/meta-adder.esm.js +1 -1
  109. package/dist/meta-adder.esm.js.LICENSE.txt +1 -1
  110. package/dist/modal-2025.cjs.js +1 -1
  111. package/dist/modal-2025.cjs.js.LICENSE.txt +1 -1
  112. package/dist/modal-2025.esm.js +1 -1
  113. package/dist/modal-2025.esm.js.LICENSE.txt +1 -1
  114. package/dist/multiswitcher.cjs.js +1 -1
  115. package/dist/multiswitcher.cjs.js.LICENSE.txt +1 -1
  116. package/dist/multiswitcher.esm.js +1 -1
  117. package/dist/multiswitcher.esm.js.LICENSE.txt +1 -1
  118. package/dist/new-nav-bar.cjs.js +1 -1
  119. package/dist/new-nav-bar.cjs.js.LICENSE.txt +1 -1
  120. package/dist/new-nav-bar.esm.js +1 -1
  121. package/dist/new-nav-bar.esm.js.LICENSE.txt +1 -1
  122. package/dist/picker.cjs.js +1 -1
  123. package/dist/picker.cjs.js.LICENSE.txt +1 -1
  124. package/dist/picker.esm.js +1 -1
  125. package/dist/picker.esm.js.LICENSE.txt +1 -1
  126. package/dist/progress.cjs.js +1 -1
  127. package/dist/progress.cjs.js.LICENSE.txt +1 -1
  128. package/dist/progress.esm.js +1 -1
  129. package/dist/progress.esm.js.LICENSE.txt +1 -1
  130. package/dist/radio.cjs.js +1 -1
  131. package/dist/radio.cjs.js.LICENSE.txt +1 -1
  132. package/dist/radio.esm.js +1 -1
  133. package/dist/radio.esm.js.LICENSE.txt +1 -1
  134. package/dist/range.cjs.js +1 -1
  135. package/dist/range.cjs.js.LICENSE.txt +1 -1
  136. package/dist/range.esm.js +1 -1
  137. package/dist/range.esm.js.LICENSE.txt +1 -1
  138. package/dist/scroll-video.cjs.js.LICENSE.txt +1 -1
  139. package/dist/scroll-video.esm.js.LICENSE.txt +1 -1
  140. package/dist/side-bar.cjs.js +1 -1
  141. package/dist/side-bar.cjs.js.LICENSE.txt +1 -1
  142. package/dist/side-bar.esm.js +1 -1
  143. package/dist/side-bar.esm.js.LICENSE.txt +1 -1
  144. package/dist/side-nav-bar.cjs.js +1 -1
  145. package/dist/side-nav-bar.cjs.js.LICENSE.txt +1 -1
  146. package/dist/side-nav-bar.esm.js +1 -1
  147. package/dist/side-nav-bar.esm.js.LICENSE.txt +1 -1
  148. package/dist/simple-bar.cjs.js +1 -1
  149. package/dist/simple-bar.cjs.js.LICENSE.txt +1 -1
  150. package/dist/simple-bar.esm.js +1 -1
  151. package/dist/simple-bar.esm.js.LICENSE.txt +1 -1
  152. package/dist/slider-2025.cjs.js +1 -1
  153. package/dist/slider-2025.cjs.js.LICENSE.txt +1 -1
  154. package/dist/slider-2025.esm.js +1 -1
  155. package/dist/slider-2025.esm.js.LICENSE.txt +1 -1
  156. package/dist/spacer.cjs.js +1 -1
  157. package/dist/spacer.cjs.js.LICENSE.txt +1 -1
  158. package/dist/spacer.esm.js +1 -1
  159. package/dist/spacer.esm.js.LICENSE.txt +1 -1
  160. package/dist/stack.cjs.js +1 -1
  161. package/dist/stack.cjs.js.LICENSE.txt +1 -1
  162. package/dist/stack.esm.js +1 -1
  163. package/dist/stack.esm.js.LICENSE.txt +1 -1
  164. package/dist/stacker.cjs.js.LICENSE.txt +1 -1
  165. package/dist/stacker.esm.js.LICENSE.txt +1 -1
  166. package/dist/table.cjs.js +1 -1
  167. package/dist/table.cjs.js.LICENSE.txt +1 -1
  168. package/dist/table.esm.js +1 -1
  169. package/dist/table.esm.js.LICENSE.txt +1 -1
  170. package/dist/text-field.cjs.js +1 -1
  171. package/dist/text-field.cjs.js.LICENSE.txt +1 -1
  172. package/dist/text-field.esm.js +1 -1
  173. package/dist/text-field.esm.js.LICENSE.txt +1 -1
  174. package/dist/text.cjs.js +1 -1
  175. package/dist/text.cjs.js.LICENSE.txt +1 -1
  176. package/dist/text.esm.js +1 -1
  177. package/dist/text.esm.js.LICENSE.txt +1 -1
  178. package/dist/theme.cjs.js.LICENSE.txt +1 -1
  179. package/dist/theme.esm.js.LICENSE.txt +1 -1
  180. package/dist/transform-anim.cjs.js.LICENSE.txt +1 -1
  181. package/dist/transform-anim.esm.js.LICENSE.txt +1 -1
  182. package/dist/ulist.cjs.js +1 -1
  183. package/dist/ulist.cjs.js.LICENSE.txt +1 -1
  184. package/dist/ulist.esm.js +1 -1
  185. package/dist/ulist.esm.js.LICENSE.txt +1 -1
  186. package/dist/video.cjs.js +1 -1
  187. package/dist/video.cjs.js.LICENSE.txt +1 -1
  188. package/dist/video.esm.js +1 -1
  189. package/dist/video.esm.js.LICENSE.txt +1 -1
  190. package/dist/wrap.cjs.js +1 -1
  191. package/dist/wrap.cjs.js.LICENSE.txt +1 -1
  192. package/dist/wrap.esm.js +1 -1
  193. package/dist/wrap.esm.js.LICENSE.txt +1 -1
  194. package/dist/zoom-card.cjs.js +1 -1
  195. package/dist/zoom-card.cjs.js.LICENSE.txt +1 -1
  196. package/dist/zoom-card.esm.js +1 -1
  197. package/dist/zoom-card.esm.js.LICENSE.txt +1 -1
  198. package/examples/custom-raster-op.js +174 -0
  199. package/layout/animator.js +30 -2
  200. package/layout/audio.js +1 -1
  201. package/layout/audionew.js +1 -1
  202. package/layout/base.js +1 -1
  203. package/layout/beta-desktop-bar.js +1 -1
  204. package/layout/beta-mobile-bar.js +3 -2
  205. package/layout/button.js +1 -1
  206. package/layout/center.js +1 -1
  207. package/layout/checkbox.js +2 -2
  208. package/layout/circle.js +3 -2
  209. package/layout/code.js +3 -2
  210. package/layout/container.js +3 -4
  211. package/layout/dropdown-2025.js +1 -1
  212. package/layout/flex-card.js +1 -1
  213. package/layout/flex-grid.js +1 -1
  214. package/layout/flex-row.js +3 -2
  215. package/layout/form-components/custom.js +1 -1
  216. package/layout/form-components/data-list.js +2 -2
  217. package/layout/form-components/floating-input.js +2 -2
  218. package/layout/form-components/form-all.js +2 -2
  219. package/layout/form-components/form.js +1 -1
  220. package/layout/form-components/image-picker.js +1 -1
  221. package/layout/form-components/picker.js +2 -2
  222. package/layout/form-components/radio.js +2 -2
  223. package/layout/form-components/radiogroup.js +2 -2
  224. package/layout/form-components/range.js +2 -2
  225. package/layout/free.js +3 -4
  226. package/layout/grid-switcher.js +1 -1
  227. package/layout/grid.js +1 -1
  228. package/layout/horizontal-scroller.js +1 -1
  229. package/layout/image.js +1 -1
  230. package/layout/index.js +1 -1
  231. package/layout/link.js +5 -5
  232. package/layout/list.js +3 -4
  233. package/layout/meta-adder.js +1 -1
  234. package/layout/modal-2025.js +1 -1
  235. package/layout/morph.js +1003 -0
  236. package/layout/multiswitcher.js +11 -3
  237. package/layout/nav-bar.js +2 -3
  238. package/layout/nav-factor/custom-div.js +2 -2
  239. package/layout/new-nav-bar.js +11 -4
  240. package/layout/polygon.js +3 -4
  241. package/layout/prerender-site.js +1 -1
  242. package/layout/prerender.js +1 -1
  243. package/layout/progress.js +1 -1
  244. package/layout/row.js +1 -1
  245. package/layout/scroll-video.js +1 -1
  246. package/layout/side-bar.js +1 -1
  247. package/layout/side-nav-bar.js +1 -1
  248. package/layout/simple-bar.js +1 -1
  249. package/layout/slider-2025.js +1 -1
  250. package/layout/spacer.js +1 -1
  251. package/layout/stack.js +1 -1
  252. package/layout/svg.js +3 -4
  253. package/layout/switcher.js +1 -1
  254. package/layout/table.js +1 -1
  255. package/layout/text-field.js +1 -1
  256. package/layout/text.js +5 -5
  257. package/layout/ulist.js +1 -1
  258. package/layout/video.js +1 -1
  259. package/layout/wrap.js +1 -1
  260. package/layout/zoom-card.js +1 -1
  261. package/lib/card-getter.js +1 -1
  262. package/lib/codegen.js +62 -0
  263. package/lib/data.js +37 -1
  264. package/lib/designer.js +18 -1
  265. package/lib/element-mapper.js +351 -247
  266. package/lib/keyframe-animation.js +1 -1
  267. package/lib/link-getter.js +1 -1
  268. package/lib/morph-node.js +424 -0
  269. package/lib/raster-inspect.js +409 -0
  270. package/lib/raster-ops.js +1980 -81
  271. package/lib/raster-presets.js +329 -0
  272. package/lib/scroll-video.js +1 -1
  273. package/lib/seo.js +28 -1
  274. package/lib/stacker.js +1 -1
  275. package/lib/suggest.js +66 -0
  276. package/lib/theme.js +1 -1
  277. package/lib/transform-anim.js +1 -1
  278. package/lib/transition.js +205 -0
  279. package/package.json +20 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.0.220
2
+ * nodality v1.0.224
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see zoom-card.esm.js.LICENSE.txt */
2
- var e={};function t(e){return t="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},t(e)}e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n="nodality.theme.mode",r="nodality:theme",o={mode:function(){try{var e=localStorage.getItem(n);if("light"===e||"dark"===e)return e}catch(e){}return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(),tokens:{light:{},dark:{}},defaults:{light:{color:"#111"},dark:{}},setDefaults:function(e){return e&&"object"===t(e)&&(e.light&&(this.defaults.light=Object.assign({},this.defaults.light,e.light)),e.dark&&(this.defaults.dark=Object.assign({},this.defaults.dark,e.dark)),this._broadcast()),this},setTokens:function(e){return e&&"object"===t(e)&&(e.light&&Object.assign(this.tokens.light,e.light),e.dark&&Object.assign(this.tokens.dark,e.dark)),this},get current(){return this.tokens[this.mode]||{}},set:function(e){if("light"!==e&&"dark"!==e)return this;if(e===this.mode)return this;this.mode=e;try{localStorage.setItem(n,e)}catch(e){}return this._broadcast(),this},toggle:function(){return this.set("dark"===this.mode?"light":"dark")},subscribe:function(e){if("undefined"==typeof document)return function(){};var t=function(t){return e(t.detail.mode,t.detail.tokens)};document.addEventListener(r,t);try{e(this.mode,this.current)}catch(e){}return function(){return document.removeEventListener(r,t)}},_broadcast:function(){"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent(r,{detail:{mode:this.mode,tokens:this.current}}))}};function a(e){return a="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},a(e)}function i(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f={static:function(e){return{x:.5*e.w,y:.5*e.h,amt:1}},mouse:function(e){return{x:e.mouseX,y:e.mouseY,amt:1}},hover:function(e){return{x:e.mouseX,y:e.mouseY,amt:e.hover}},scroll:function(e){return{x:.5*e.w,y:e.h*e.scroll,amt:1}},time:function(e){return{x:e.w*(.5+.34*Math.cos(.6*e.t)),y:e.h*(.5+.34*Math.sin(.8*e.t)),amt:1}}},d=Object.keys(f),h={hexalize:{stage:"cell",decl:function(e){return"\n uniform float ".concat(e,"size;\n uniform float ").concat(e,"lift;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;")},code:function(e,t){return t.lift?"\n {\n vec2 hp = warped / ".concat(e,"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 vec2 ").concat(e,"AX = normalize(vec2(1.0, 1.7320508));\n vec2 ").concat(e,"c0 = hp - gv;\n // Seed with the owning cell. Its own hexagon always covers the\n // fragment at any scale >= 1, so there is always a winner.\n vec2 ").concat(e,"bestC = ").concat(e,"c0;\n float ").concat(e,"bestF = (1.0 - smoothstep(0.0, ").concat(e,"radius,\n length(").concat(e,"c0 * ").concat(e,"size - ").concat(e,"dpos))) * ").concat(e,"damt;\n float ").concat(e,"bestS = 1.0 + ").concat(e,"lift * ").concat(e,"bestF;\n").concat([[1,0],[-1,0],[.5,.8660254],[-.5,.8660254],[.5,-.8660254],[-.5,-.8660254]].map(function(t){var n,r,o=c(t,2);return n=o[0],r=o[1],"\n {\n vec2 c = ".concat(e,"c0 + vec2(").concat(n.toFixed(7),", ").concat(r.toFixed(7),");\n float f = 1.0 - smoothstep(0.0, ").concat(e,"radius,\n length(c * ").concat(e,"size - ").concat(e,"dpos));\n f *= ").concat(e,"damt;\n float s = 1.0 + ").concat(e,"lift * f;\n vec2 q = hp - c;\n float hd = max(dot(abs(q), ").concat(e,"AX), abs(q).x);\n // Covered by this cell's grown hexagon, and nearer than\n // whatever we have so far.\n if (hd <= 0.5 * s && s > ").concat(e,"bestS) {\n ").concat(e,"bestS = s; ").concat(e,"bestC = c; ").concat(e,"bestF = f;\n }\n }")}).join(""),"\n center = ").concat(e,"bestC * ").concat(e,"size;\n // Divide by the winner's scale: the border test then reaches\n // 0.5 further out (a bigger hexagon) and the sample moves in\n // toward the centre (its content magnified to match), both by\n // the same factor, so proportions are preserved exactly.\n gv = (hp - ").concat(e,"bestC) / max(").concat(e,"bestS, 1e-3);\n warped = center + gv * ").concat(e,'size;\n gv = abs(gv);\n // Border strength follows the SAME falloff as the scale, so a\n // cell that has not been raised draws no border at all. Away\n // from the pointer bestF is 0, which means scale 1, sampling\n // untouched and edge 0 — bit-identical to the source image, so\n // nothing reveals that an effect is attached until the pointer\n // arrives. Pair with by:"hover" for a fully flush resting\n // state; by:"mouse" holds amt at 1 and so keeps a permanent\n // hotspot wherever the pointer last was.\n edge = max(edge, smoothstep(0.44, 0.5,\n max(dot(gv, ').concat(e,"AX), gv.x)) * ").concat(e,"bestF);\n }"):"\n {\n vec2 hp = warped / ".concat(e,"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(e,"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(e,t){return{size:["1f",(e.size||24)*t],lift:["1f",null!=e.lift?e.lift:0],radius:["1f",(e.radius||200)*t]}}},offset:{stage:"warp",defaultDriver:"mouse",decl:function(e){return"uniform float ".concat(e,"strength; uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos; uniform float ").concat(e,"damt;")},code:function(e){return"\n {\n float d = length(warped - ".concat(e,"dpos);\n float fall = 1.0 - smoothstep(0.0, ").concat(e,"radius, d);\n vec2 dir = d > 0.5 ? (warped - ").concat(e,"dpos) / d : vec2(0.0);\n warped -= dir * ").concat(e,"strength * fall * ").concat(e,"damt;\n }")},uniforms:function(e,t){return{strength:["1f",(e.strength||20)*t],radius:["1f",(e.radius||260)*t]}}},duotone:{stage:"color",decl:function(e){return"uniform vec3 ".concat(e,"a; uniform vec3 ").concat(e,"b; uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos; uniform float ").concat(e,"damt;")},code:function(e,t){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n vec3 duo = mix(".concat(e,"a, ").concat(e,"b, lum);\n ").concat(t.by?"float mask = (1.0 - smoothstep(".concat(e,"radius * 0.35, ").concat(e,"radius,\n length(center - ").concat(e,"dpos))) * ").concat(e,"damt;"):"float mask = 1.0;","\n col = mix(col, duo, mask);\n }")},uniforms:function(e,t){var n=e.colors||["#104B87","#E8FF00"];return{a:["3fv",p(n[0])],b:["3fv",p(n[1])],radius:["1f",(e.radius||220)*t]}}},edges:{stage:"color",decl:function(e){return"uniform vec3 ".concat(e,"color; uniform float ").concat(e,"strength;")},code:function(e){return"\n {\n edgeCol = ".concat(e,"color;\n edgeCov = max(edgeCov, edge * ").concat(e,"strength);\n }")},uniforms:function(e){return{color:["3fv",p(e.color||"#FFFFFF")],strength:["1f",null!=e.strength?e.strength:1]}}},halftone:{stage:"color",decl:function(e){return"\n uniform float ".concat(e,"size;\n uniform float ").concat(e,"angle;\n uniform vec3 ").concat(e,"ink;\n uniform vec3 ").concat(e,"paper;\n uniform float ").concat(e,"soft;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;")},code:function(e,t){return"\n {\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n float sz = ".concat(e,"size;").concat(t.by?"\n float fd = 1.0 - smoothstep(0.0, ".concat(e,"radius, length(frag - ").concat(e,"dpos));\n sz *= 1.0 + fd * ").concat(e,"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(e,"angle), sa = sin(").concat(e,"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(e,"soft, length(cell));\n col = mix(").concat(e,"paper, ").concat(e,"ink, dm);\n }")},uniforms:function(e,t){return{size:["1f",(e.size||6)*t],angle:["1f",(null!=e.angle?e.angle:15)*Math.PI/180],ink:["3fv",p(e.ink||"#0B1B2B")],paper:["3fv",p(e.paper||"#FFFFFF")],soft:["1f",null!=e.softness?e.softness:.08],radius:["1f",(e.radius||220)*t]}}},dither:{stage:"color",decl:function(e){return"\n uniform float ".concat(e,"levels;\n uniform float ").concat(e,"size;\n uniform float ").concat(e,"amount;\n uniform vec3 ").concat(e,"ink;\n uniform vec3 ").concat(e,"paper;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;\n uniform float ").concat(e,"radius;\n // Bayer matrices by recursive bit-interleave rather than a\n // 64-entry table: WebGL1 has no constant array indexing, and\n // the nesting is exactly the recursive definition of the\n // ordered-dither matrix.\n float ").concat(e,"b2(vec2 a) {\n a = floor(a);\n return fract(a.x * 0.5 + a.y * a.y * 0.75);\n }\n float ").concat(e,"b4(vec2 a) { return ").concat(e,"b2(0.5 * a) * 0.25 + ").concat(e,"b2(a); }\n float ").concat(e,"b8(vec2 a) { return ").concat(e,"b4(0.5 * a) * 0.25 + ").concat(e,"b2(a); }")},code:function(e,t){return"\n {\n float sz = max(".concat(e,"size, 1e-3);").concat(t.by?"\n float fd = 1.0 - smoothstep(0.0, ".concat(e,"radius, length(frag - ").concat(e,"dpos));\n sz *= 1.0 + fd * ").concat(e,"damt * 1.8;"):"","\n // Centre the threshold on zero so dithering does not lift or\n // crush the overall exposure, only redistributes it.\n float t = ").concat(e,"b8(frag / sz) - 0.5;\n float lv = max(").concat(e,"levels, 1.0);\n ").concat(t.mono?"\n float lum = dot(col, vec3(0.299, 0.587, 0.114));\n float q = step(0.5, lum + t);\n vec3 dq = mix(".concat(e,"ink, ").concat(e,"paper, q);"):"\n // Per channel: scale to level index, offset by the threshold,\n // round, scale back. The +t before rounding is what turns a\n // hard band edge into an interleaved pattern of the two\n // neighbouring levels.\n vec3 dq = floor(col * lv + 0.5 + t) / lv;","\n col = mix(col, clamp(dq, 0.0, 1.0), clamp(").concat(e,"amount, 0.0, 1.0));\n }")},uniforms:function(e,t){return{levels:["1f",null!=e.levels?e.levels:6],size:["1f",(null!=e.size?e.size:1)*t],amount:["1f",null!=e.amount?e.amount:1],ink:["3fv",p(e.ink||"#0B1B2B")],paper:["3fv",p(e.paper||"#FFFFFF")],radius:["1f",(e.radius||220)*t]}}},aberration:{stage:"displace",chroma:!0,decl:function(e){return"\n uniform float ".concat(e,"amount;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;")},code:function(e,t){return"\n {\n vec2 ctr = ".concat(t.by?"".concat(e,"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(t.by?"float amt = ".concat(e,"amount * ").concat(e,"damt *\n (1.0 - smoothstep(0.0, ").concat(e,"radius, dl));"):"float amt = ".concat(e,"amount * (dl / max(length(u_res) * 0.5, 1.0));"),"\n chroma += dir * amt;\n }")},uniforms:function(e,t){return{amount:["1f",(null!=e.amount?e.amount:6)*t],radius:["1f",(e.radius||240)*t]}}},mask:{stage:"field",producesField:!0,defaultDriver:"static",decl:function(e){return"\n uniform vec2 ".concat(e,"dpos;\n uniform float ").concat(e,"damt;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"at;\n uniform vec2 ").concat(e,"remap;\n uniform float ").concat(e,"invert;")},code:function(e,t){var n=t.from||"radial",r=t.at?"(".concat(e,"at * u_res)"):"".concat(e,"dpos"),o="vertical"===n?"frag.y / max(u_res.y, 1.0)":"horizontal"===n?"frag.x / max(u_res.x, 1.0)":"1.0 - smoothstep(0.0, ".concat(e,"radius, length(frag - ").concat(r,"))");return"\n {\n float m = ".concat(o,";\n m = clamp((m - ").concat(e,"remap.x) / max(").concat(e,"remap.y - ").concat(e,"remap.x, 1e-4), 0.0, 1.0);\n m = mix(m, 1.0 - m, ").concat(e,"invert);\n ").concat(y(t.as||"mask")," *= m * ").concat(e,"damt;\n }")},uniforms:function(e,t){return{radius:["1f",(null!=e.radius?e.radius:260)*t],at:["2fv",e.at||[.5,.5]],remap:["2fv",e.remap||[0,1]],invert:["1f",e.invert?1:0]}}},noise:{stage:"field",producesField:!0,decl:function(e){return"\n uniform float ".concat(e,"scale;\n uniform float ").concat(e,"speed;\n uniform vec2 ").concat(e,"remap;\n uniform float ").concat(e,"amp;\n float ").concat(e,"h(vec2 v) {\n return fract(sin(dot(v, vec2(41.113, 289.717))) * 43758.545);\n }\n float ").concat(e,"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(e,"h(i), ").concat(e,"h(i + vec2(1.0, 0.0)), f.x),\n mix(").concat(e,"h(i + vec2(0.0, 1.0)), ").concat(e,"h(i + vec2(1.0, 1.0)), f.x), f.y);\n }")},code:function(e,t){return"\n {\n vec2 np = frag / max(u_res.y, 1.0) * ".concat(e,"scale;\n // Two octaves: enough structure to read as turbulence\n // without the cost of a full fBm.\n float n = ").concat(e,"n(np + u_time * ").concat(e,"speed) * 0.65 +\n ").concat(e,"n(np * 2.7 - u_time * ").concat(e,"speed * 0.6) * 0.35;\n n = clamp((n - ").concat(e,"remap.x) / max(").concat(e,"remap.y - ").concat(e,"remap.x, 1e-4), 0.0, 1.0);\n ").concat(y(t.as||"mask")," *= mix(1.0, n, ").concat(e,"amp);\n }")},uniforms:function(e){return{scale:["1f",null!=e.scale?e.scale:3],speed:["1f",null!=e.speed?e.speed:.3],remap:["2fv",e.remap||[0,1]],amp:["1f",null!=e.amount?e.amount:1]}}},copy:{stage:"color",defaultDriver:"static",decl:function(e){return"\n uniform vec2 ".concat(e,"dpos;\n uniform float ").concat(e,"damt;\n uniform float ").concat(e,"radius;\n uniform float ").concat(e,"scale;\n uniform float ").concat(e,"rotate;\n uniform float ").concat(e,"fade;\n uniform float ").concat(e,"amount;")},code:function(e,t){for(var n=Array.isArray(t.points)&&t.points.length>0,r=n?t.points.length:Math.max(1,Math.min(24,Math.round(t.count||5))),o="",a=function(a){var i,s=n?"vec2(".concat((+t.points[a][0]).toFixed(5),", ").concat((+t.points[a][1]).toFixed(5),") * u_res"):(i=a/r*Math.PI*2,"".concat(e,"dpos + vec2(").concat(Math.cos(i).toFixed(5),", ")+"".concat(Math.sin(i).toFixed(5),") * ").concat(e,"radius"));o+="\n {\n float ang = ".concat(e,"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(s,"));\n vec2 q = d / max(").concat(e,"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(e,"amount * ").concat(e,"damt\n * pow(").concat(e,"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 }")},i=0;i<r;i++)a(i);return o},uniforms:function(e,t){return{radius:["1f",(null!=e.radius?e.radius:110)*t],scale:["1f",null!=e.scale?e.scale:.5],rotate:["1f",null!=e.rotate?e.rotate:0],fade:["1f",null!=e.fade?e.fade:1],amount:["1f",null!=e.amount?e.amount:1]}}},merge:{stage:"color",decl:function(e){return"uniform float ".concat(e,"mix;")},code:function(){return""},uniforms:function(e){return{mix:["1f",null!=e.mix?e.mix:1]}}},echo:{stage:"color",decl:function(e){return"\n uniform sampler2D ".concat(e,"hist;\n uniform float ").concat(e,"strength;\n uniform vec3 ").concat(e,"tint;\n uniform float ").concat(e,"tintAmt;")},code:function(e){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(e,"hist, clamp(huv, 0.001, 0.999));\n float ha = clamp(h.a * ").concat(e,"strength, 0.0, 1.0);\n vec3 hc = mix(h.rgb, ").concat(e,"tint, ").concat(e,"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(e){return{strength:["1f",null!=e.strength?e.strength:.85],tint:["3fv",p(e.tint||"#7FD4FF")],tintAmt:["1f",e.tint?null!=e.tintAmount?e.tintAmount:.5:0]}},solver:{resolutions:function(e,t,n){return{frame:[t,n]}},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(e,t,n){var r=Math.min(n.dt,1/30),o=Math.pow(null!=t.decay?t.decay:.92,60*r);e.use("accumulate"),e.f2("u_texel",1/e.canvasW,1/e.canvasH),e.f1("u_decay",o),e.smp("u_content",e.content,0),e.smp("u_hist",e.read("history"),1),e.blit(e.write("history")),e.swap("history")}}},stir:{stage:["warp","color"],decl:function(e){return"\n uniform sampler2D ".concat(e,"vel;\n uniform sampler2D ").concat(e,"dye;\n uniform float ").concat(e,"strength;\n uniform float ").concat(e,"dyemix;\n uniform float ").concat(e,"intensity;\n uniform float ").concat(e,"sheen;\n uniform vec3 ").concat(e,"tint;")},code:function(e,t,n){return"warp"===n?"\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(e,"vel, clamp(fuv, 0.001, 0.999)).xy;\n warped += vec2(v.x, -v.y) * ").concat(e,"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(e,"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(e,"tint;\n float amt = clamp((1.0 - exp(-mag * ").concat(e,"intensity)) * ").concat(e,"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(e,"vel, clamp(suv, 0.001, 0.999)).xy);\n col = mix(col, ").concat(e,"tint, (1.0 - exp(-sp * 0.7)) * ").concat(e,"sheen);\n }")},uniforms:function(e,t){return{strength:["1f",(null!=e.strength?e.strength:26)*t],sheen:["1f",null!=e.sheen?e.sheen:.15],tint:["3fv",p(e.tint||"#7FD4FF")],dyemix:["1f",null!=e.dye?e.dye:.85],intensity:["1f",null!=e.intensity?e.intensity:1.6]}},solver:{resolutions:function(e){return{sim:Math.max(32,Math.min(e.resolution||128,512)),dye:Math.max(64,Math.min(e.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(e,t,n){var r=null!=e.dyeAmount?e.dyeAmount:.6;if(!e.rainbow){var o=p(e.tint||"#7FD4FF");return[o[0]*r,o[1]*r,o[2]*r]}var a=Math.atan2(n,t);return[(.5+.5*Math.cos(a))*r,(.5+.5*Math.cos(a+2.0944))*r,(.5+.5*Math.cos(a+4.1888))*r]},step:function(e,t,n){var r=Math.min(n.dt,1/30),o=1/e.res.sim,a=1/e.res.dye,i=function(e,t){return Math.pow(e,60*t)};if(n.moving){var s=null!=t.force?t.force:1;e.use("splat"),e.f1("u_radius",null!=t.radius?t.radius:.1),e.f1("u_aspect",n.aspect),e.f2("u_point",n.px,n.py),e.f2("u_texel",o,o),e.smp("u_src",e.read("velocity"),0),e.f3("u_amount",n.dx*s,n.dy*s,0),e.blit(e.write("velocity")),e.swap("velocity"),e.f2("u_texel",a,a),e.smp("u_src",e.read("dye"),0),e.f3("u_amount",n.col[0],n.col[1],n.col[2]),e.blit(e.write("dye")),e.swap("dye")}e.use("curl"),e.f2("u_texel",o,o),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("vorticity")),e.use("confine"),e.f2("u_texel",o,o),e.f1("u_eps",null!=t.curl?t.curl:2.2),e.f1("u_dt",r),e.smp("u_vel",e.read("velocity"),0),e.smp("u_curl",e.single("vorticity"),1),e.blit(e.write("velocity")),e.swap("velocity"),e.use("divergence"),e.f2("u_texel",o,o),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("divergence")),e.use("decay"),e.f2("u_texel",o,o),e.f1("u_value",i(null!=t.pressure?t.pressure:.8,r)),e.smp("u_tex",e.read("pressure"),0),e.blit(e.write("pressure")),e.swap("pressure"),e.use("jacobi"),e.f2("u_texel",o,o),e.smp("u_div",e.single("divergence"),1);for(var c=Math.max(1,Math.min(t.pressureIterations||6,40)),l=0;l<c;l++)e.smp("u_p",e.read("pressure"),0),e.blit(e.write("pressure")),e.swap("pressure");e.use("subtract"),e.f2("u_texel",o,o),e.smp("u_p",e.read("pressure"),0),e.smp("u_vel",e.read("velocity"),1),e.blit(e.write("velocity")),e.swap("velocity"),e.use("advect"),e.f1("u_dt",r),e.f2("u_texel",o,o),e.smp("u_vel",e.read("velocity"),0),e.smp("u_src",e.read("velocity"),0),e.f1("u_diss",i(null!=t.decay?t.decay:.985,r)),e.blit(e.write("velocity")),e.swap("velocity"),e.f2("u_texel",a,a),e.smp("u_vel",e.read("velocity"),0),e.smp("u_src",e.read("dye"),1),e.f1("u_diss",i(null!=t.dyeFade?t.dyeFade:.97,r)),e.blit(e.write("dye")),e.swap("dye")}}},blobs:{stage:"color",overlay:!0,mips:!0,decl:function(e){return"\n uniform vec3 ".concat(e,"blobs[").concat(12,"];\n uniform int ").concat(e,"count;\n uniform vec3 ").concat(e,"tint;\n uniform float ").concat(e,"refract;\n uniform float ").concat(e,"rim;\n uniform float ").concat(e,"alpha;\n uniform float ").concat(e,"irid;\n uniform float ").concat(e,"disp;\n uniform float ").concat(e,"frost;\n float ").concat(e,"hash(vec3 v) {\n return fract(sin(dot(v, vec3(21.9898, 63.233, 41.719))) * 41739.317);\n }\n float ").concat(e,"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(e,"hash(f);\n float c100 = ").concat(e,"hash(f + vec3(1.0, 0.0, 0.0));\n float c010 = ").concat(e,"hash(f + vec3(0.0, 1.0, 0.0));\n float c110 = ").concat(e,"hash(f + vec3(1.0, 1.0, 0.0));\n float c001 = ").concat(e,"hash(f + vec3(0.0, 0.0, 1.0));\n float c101 = ").concat(e,"hash(f + vec3(1.0, 0.0, 1.0));\n float c011 = ").concat(e,"hash(f + vec3(0.0, 1.0, 1.0));\n float c111 = ").concat(e,"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(e){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(e,"count) break;\n vec2 bd = frag - ").concat(e,"blobs[bi].xy;\n float br = ").concat(e,"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(e,"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(e,"refract / max(abs(tR.z), 0.3));\n vec2 oG = tG.xy * (").concat(e,"refract / max(abs(tG.z), 0.3));\n vec2 oB = tB.xy * (").concat(e,"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(e,"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(e,"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(e,"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(e,"noise(rf * 2.3 + u_time * 0.5);\n float nB = ").concat(e,"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(e,"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(e,"alpha);\n }\n }")},uniforms:function(e,t){return{tint:["3fv",p(e.color||"#EAF4EE")],refract:["1f",(null!=e.refract?e.refract:70)*t],rim:["1f",null!=e.rim?e.rim:.6],alpha:["1f",null!=e.alpha?e.alpha:1],irid:["1f",null!=e.iridescence?e.iridescence:.8],disp:["1f",null!=e.dispersion?e.dispersion:1],frost:["1f",null!=e.frost?e.frost:.25]}},init:function(e,t,n,r){for(var o=(e.radius||46)*t,a=Math.max(1,Math.min(null!=e.trail?e.trail:7,12)),i=[],s=0,c=0;c<a;c++){var l=Math.pow(.86,c);i.push(l),s+=l*l}for(var u=Math.sqrt(s),f=i.map(function(e){return o*e/u}),d=i.map(function(e,t){return.85*o*Math.pow(.955,t)}),h=function(e,t){return e+Math.random()*(t-e)},p=Math.max(0,Math.min((e.count||1)-1,12-a)),v=[],m=0;m<p;m++){var y=h(0,2*Math.PI),g=h(30,80)*t;v.push({x:h(o,n-o),y:h(o,r-o),r:o*h(.45,.8),vx:Math.cos(y)*g,vy:Math.sin(y)*g,phase:h(0,2*Math.PI)})}for(var x={x:.5*n,y:.55*r},b=[],w=0;w<a;w++)b.push({x:x.x,y:x.y});return{head:x,chain:b,nTrail:a,drifters:v,trailIdleR:f,trailMoveR:d,stretch:0,seg:.9*o}},tick:function(e,t){var n=Math.min(t.dt,.05),r=t.w,o=t.h,a=1-Math.exp(9*-n);e.head.x+=(t.mouseX-e.head.x)*a,e.head.y+=(t.mouseY-e.head.y)*a;var i=e.chain;i[0].x=e.head.x,i[0].y=e.head.y;for(var c=1-Math.exp(16*-n),l=1;l<i.length;l++){var u=i[l-1],f=i[l],d=u.x-f.x,h=u.y-f.y,p=Math.hypot(d,h)||1e-4,v=e.seg;p>v&&(f.x+=d*(1-v/p),f.y+=h*(1-v/p)),f.x+=(u.x-f.x)*c,f.y+=(u.y-f.y)*c}var m=i[i.length-1],y=Math.hypot(m.x-e.head.x,m.y-e.head.y),g=Math.max(1,e.seg*(e.nTrail-1)),x=Math.min(1,y/g);e.stretch+=(x-e.stretch)*(1-Math.exp(8*-n));var b,w=s(e.drifters);try{for(w.s();!(b=w.n()).done;){var _=b.value;_.x+=_.vx*n,_.y+=_.vy*n,_.x<_.r?(_.x=_.r,_.vx=Math.abs(_.vx)):_.x>r-_.r&&(_.x=r-_.r,_.vx=-Math.abs(_.vx)),_.y<_.r?(_.y=_.r,_.vy=Math.abs(_.vy)):_.y>o-_.r&&(_.y=o-_.r,_.vy=-Math.abs(_.vy)),_.phase+=1.6*n}}catch(e){w.e(e)}finally{w.f()}for(var k=new Float32Array(36),E=e.stretch,T=0;T<e.nTrail;T++){var A=i[T];k[3*T]=A.x,k[3*T+1]=A.y,k[3*T+2]=e.trailIdleR[T]+(e.trailMoveR[T]-e.trailIdleR[T])*E}return e.drifters.forEach(function(t,n){var r=e.nTrail+n;k[3*r]=t.x,k[3*r+1]=t.y,k[3*r+2]=t.r*(1+.12*Math.sin(t.phase))}),[{name:"blobs",kind:"3fv",value:k},{name:"count",kind:"1i",value:e.nTrail+e.drifters.length}]}}};function p(e){return[1,3,5].map(function(t){return parseInt(e.slice(t,t+2),16)/255})}Object.keys(h).concat("switch");var v="attribute vec2 a; void main(){ gl_Position = vec4(a, 0.0, 1.0); }",m={warp:["warped"],cell:["center","edge"],displace:["sampleP","chroma"],color:["col","edgeCol","edgeCov","ovCol","ovA"]},y=function(e){return"fld_".concat(String(e).replace(/[^A-Za-z0-9_]/g,""))},g=function(e){return!0===e.masked?"mask":"string"==typeof e.masked?e.masked:null},x=function(e){return"edge"===e||"edgeCov"===e||"ovA"===e?"float":"col"===e||"edgeCol"===e||"ovCol"===e?"vec3":"vec2"},b={over:function(e,t){return t},add:function(e,t){return"min(".concat(e," + ").concat(t,", vec3(1.0))")},screen:function(e,t){return"1.0 - (1.0 - ".concat(e,") * (1.0 - ").concat(t,")")},multiply:function(e,t){return"".concat(e," * ").concat(t)},difference:function(e,t){return"abs(".concat(e," - ").concat(t,")")},lighten:function(e,t){return"max(".concat(e,", ").concat(t,")")},darken:function(e,t){return"min(".concat(e,", ").concat(t,")")}};function w(e,t){var n,r=[],o=s(e||[]);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a&&a.op){var i={node:a,i:t.length};t.push(a),"merge"===a.op&&(i.a=w(a.a,t),i.b=w(a.b,t)),r.push(i)}}}catch(e){o.e(e)}finally{o.f()}return r}function _(e,t){var n,r=s(e);try{var o=function(){var e=n.value,r=e.node;if("merge"===r.op)return function(e,t){var n="u".concat(e.i,"_"),r=b[e.node.mode]||b.over,o={field:"",warp:"",cell:"",displace:"",color:""},a={field:"",warp:"",cell:"",displace:"",color:""};_(e.a||[],o),_(e.b||[],a),t.field+=o.field+a.field;for(var i=function(){var e=c[s];if(!o[e]&&!a[e])return 1;var i=m[e],l=" {\n";i.forEach(function(e,t){l+=" ".concat(x(e)," pre").concat(t," = ").concat(e,";\n")}),l+=o[e],i.forEach(function(e,t){l+=" ".concat(x(e)," bra").concat(t," = ").concat(e,";\n")}),i.forEach(function(e,t){l+=" ".concat(e," = pre").concat(t,";\n")}),l+=a[e],i.forEach(function(e,t){var o="vec3"===x(e)?r("bra".concat(t),e):e;l+=" ".concat(e," = mix(bra").concat(t,", ").concat(o,", ").concat(n,"mix);\n")}),l+=" }\n",t[e]+=l},s=0,c=["warp","cell","displace","color"];s<c.length;s++)i()}(e,t),0;var o=h[r.op];if(!o)return 0;var a="u".concat(e.i,"_"),i=Array.isArray(o.stage)?o.stage:[o.stage],s=g(r);i.forEach(function(e){var n=o.code(a,r,e)+"\n";if(s&&m[e]){var i=m[e],c=i.map(function(e,t){return" ".concat(x(e)," msv").concat(t," = ").concat(e,";")}).join("\n"),l=i.map(function(e,t){return" ".concat(e," = mix(msv").concat(t,", ").concat(e,", ").concat(y(s),");")}).join("\n");n=" {\n".concat(c,"\n").concat(n,"\n").concat(l,"\n }\n")}t["field"===e||"warp"===e||"cell"===e||"displace"===e?e:"color"]+=n})};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}var k=/\d(?:vw|vh|vmin|vmax|dvw|dvh|svw|svh|lvw|lvh)\b/i;var E={coarse:"(pointer: coarse)",fine:"(pointer: fine)",hover:"(hover: hover)","no-hover":"(hover: none)","reduced-motion":"(prefers-reduced-motion: reduce)",dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)"};function T(e){if("function"==typeof e)try{return!!e()}catch(e){return!1}if("boolean"==typeof e)return e;if("string"!=typeof e||""===e)return!1;var t=E[e]||e;if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia(t).matches}catch(e){return!1}}function A(e,t){if(!Array.isArray(e))return[];if((t||0)>8)return[];var n,r=[],o=s(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a&&"switch"===a.op){var i,c=s(A((T(a.when)?a.use:a.else)||[],(t||0)+1));try{for(c.s();!(i=c.n()).done;){var l=i.value;r.push(l)}}catch(e){c.e(e)}finally{c.f()}}else r.push(a)}}catch(e){o.e(e)}finally{o.f()}return r}var S=new Set(["IMG","VIDEO","CANVAS","IFRAME","INPUT","EMBED","OBJECT","TEXTAREA","SELECT","BR","HR","AREA","SOURCE","TRACK","WBR"]),C=["objectFit","objectPosition","borderRadius","imageRendering","filter"];function R(e,t){if(!e||"undefined"==typeof document||"undefined"==typeof window)return null;if(!t||0===t.length)return null;if(t.some(function(e){return e&&"switch"===e.op})&&0===(t=A(t,0)).length)return null;var n=[],r=w(t,n);if(t=n,"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return null;if(S.has(e.tagName)){var o=e.parentElement&&e.parentElement.hasAttribute&&e.parentElement.hasAttribute("data-nodality-raster-host")?e.parentElement:null;if(e=o||function(e){if(!e.parentNode)return null;var t,n={},r=s(C);try{for(r.s();!(t=r.n()).done;){var o=t.value;e.style[o]&&(n[o]=e.style[o])}}catch(e){r.e(e)}finally{r.f()}var a=document.createElement("div");return a.setAttribute("data-nodality-raster-host",e.tagName.toLowerCase()),a.style.cssText=e.style.cssText,e.parentNode.insertBefore(a,e),a.appendChild(e),e.removeAttribute("style"),Object.assign(e.style,n),e.style.display="block",e.style.width="100%",e.style.height="100%","static"===("function"==typeof getComputedStyle?getComputedStyle(a).position:"static")&&(a.style.position="relative"),a.style.width||(a.style.width="100%"),a.style.height||(a.style.height="100%"),a}(e),!e)return null}if(e.querySelector&&e.querySelector(":scope > canvas[data-nodality-raster]"))return null;var l=function(){var t=e.getBoundingClientRect();return{width:t.width>=2?t.width:e.scrollWidth||0,height:t.height>=2?t.height:e.scrollHeight||0}},u=l();if(u.width<2||u.height<2)return null;var p=Math.min(window.devicePixelRatio||1,2),m=t.some(function(e){return(h[e.op]||{}).overlay}),x=t.every(function(e){return(h[e.op]||{}).overlay}),b=!x&&!t.some(function(e){return!1===e.live}),E="undefined"!=typeof WebGL2RenderingContext&&"texElementImage2D"in WebGL2RenderingContext.prototype||"undefined"!=typeof WebGLRenderingContext&&"texElementImage2D"in WebGLRenderingContext.prototype,T=b&&E;b&&!T&&console.info("[nodality] HTML-in-Canvas API not available - raster ops fall back to snapshot capture.");var R=document.createElement("canvas");T&&R.setAttribute("layoutsubtree","");var D={alpha:!0,premultipliedAlpha:!1},M=R.getContext("webgl2",D)||R.getContext("webgl",D);if(!M)return null;var F="undefined"!=typeof WebGL2RenderingContext&&M instanceof WebGL2RenderingContext,I=F&&t.some(function(e){return(h[e.op]||{}).mips});T&&!("texElementImage2D"in M)&&(console.info("[nodality] texElementImage2D missing on the created context - snapshot fallback."),R.removeAttribute("layoutsubtree"),T=!1),"static"===window.getComputedStyle(e).position&&(e.style.position="relative"),R.width=Math.round(u.width*p),R.height=Math.round(u.height*p),R.setAttribute("data-nodality-raster",T?"live":"snapshot"),console.info("[nodality] raster backend:",T?"html-in-canvas (live)":"snapshot");var O=e;if(T){var L=document.createElement("div"),P=getComputedStyle(e),j="flex"===P.display||"inline-flex"===P.display;for(L.style.cssText="display:".concat(j?"flex":"block",";")+"width:".concat(u.width,"px;height:").concat(u.height,"px;"),j&&(L.style.flexDirection=P.flexDirection,L.style.alignItems=P.alignItems,L.style.justifyContent=P.justifyContent,L.style.gap=P.gap);e.firstChild;)L.appendChild(e.firstChild);R.appendChild(L),O=L,R.style.cssText="display:block;width:".concat(u.width,"px;height:").concat(u.height,"px;")}else if(R.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(u.width,"px;height:").concat(u.height,"px;")+"pointer-events:none;z-index:2147483000;",x)R.setAttribute("aria-hidden","true");else{R.setAttribute("role","img");var z=(e.textContent||"").replace(/\s+/g," ").trim();z&&R.setAttribute("aria-label",z.slice(0,300))}e.appendChild(R);var B=function(e,t){var n=M.createShader(e);if(M.shaderSource(n,t),M.compileShader(n),!M.getShaderParameter(n,M.COMPILE_STATUS))throw new Error("[nodality] raster shader: "+M.getShaderInfoLog(n));return n},W=M.createProgram();M.attachShader(W,B(M.VERTEX_SHADER,v)),M.attachShader(W,B(M.FRAGMENT_SHADER,function(e,t){var n="",r=new Set;t.forEach(function(e){var t=h[e.op];t&&t.producesField&&r.add(e.as||"mask");var n=g(e);n&&r.add(n)});var o=i(r).map(function(e){return" float ".concat(y(e)," = 1.0;")}).join("\n");t.forEach(function(e,t){var r=h[e.op];r&&(n+=r.decl("u".concat(t,"_"),e)+"\n")});var a={field:"",warp:"",cell:"",displace:"",color:""};_(e,a);var s=a.field,c=a.warp,l=a.cell,u=a.displace,f=a.color,d=t,p=d.some(function(e){return"edges"===e.op})?"":" col *= 1.0 - edge * 0.55;",v=d.some(function(e){return(h[e.op]||{}).chroma})?"\n vec2 cpx = vec2(chroma.x, -chroma.y) / u_res;\n col.r = texture2D(u_tex, clamp(uv + cpx, 0.001, 0.999)).r;\n col.b = texture2D(u_tex, clamp(uv - cpx, 0.001, 0.999)).b;":"";return"\nprecision highp float;\nuniform sampler2D u_tex;\nuniform vec2 u_res;\nuniform vec2 u_mouse;\nuniform float u_time;\n".concat(n,"\nvoid main() {\n vec2 frag = vec2(gl_FragCoord.x, u_res.y - gl_FragCoord.y);\n").concat(o,"\n").concat(s,"\n vec2 warped = frag;\n").concat(c,"\n vec2 center = warped;\n float edge = 0.0;\n").concat(l,"\n vec2 sampleP = warped;\n vec2 chroma = vec2(0.0);\n").concat(u,"\n vec2 uv = vec2(sampleP.x / u_res.x, 1.0 - sampleP.y / u_res.y);\n vec4 tex = texture2D(u_tex, clamp(uv, 0.001, 0.999));\n vec3 col = tex.rgb;").concat(v,"\n vec3 edgeCol = vec3(1.0);\n float edgeCov = 0.0;\n vec3 ovCol = vec3(0.0);\n float ovA = 0.0;\n").concat(f,"\n").concat(p,"\n // content OVER border\n float baseA = tex.a + edgeCov * (1.0 - tex.a);\n vec3 baseRGB = (col * tex.a + edgeCol * edgeCov * (1.0 - tex.a)) / max(baseA, 1e-4);\n // overlay OVER (content+border)\n float outA = ovA + baseA * (1.0 - ovA);\n vec3 outRGB = (ovCol * ovA + baseRGB * baseA * (1.0 - ovA)) / max(outA, 1e-4);\n gl_FragColor = vec4(outRGB, outA);\n}")}(r,t))),M.bindAttribLocation(W,0,"a"),M.linkProgram(W),M.useProgram(W),M.bindBuffer(M.ARRAY_BUFFER,M.createBuffer()),M.bufferData(M.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),M.STATIC_DRAW),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,M.FLOAT,!1,0,0);var U=function(e){return M.getUniformLocation(W,e)},N=function(e,t,n){"1f"===t?M.uniform1f(e,n):"1i"===t?M.uniform1i(e,n):"2fv"===t?M.uniform2fv(e,n):"3fv"===t&&M.uniform3fv(e,n)};t.forEach(function(e,t){var n=h[e.op];if(n&&n.uniforms){var r=n.uniforms(e,p);for(var o in r)N(U("u".concat(t,"_").concat(o)),r[o][0],r[o][1])}});var G=[];t.forEach(function(e,t){var n=h[e.op];n&&"function"==typeof n.init&&G.push({i:t,def:n,state:n.init(e,p,R.width,R.height)})});var X="undefined"!=typeof performance?performance.now():0,q=[];t.forEach(function(e,t){var n=h[e.op];if(n&&n.solver){var r=function(e,t){var n=h[e.op];if(!F||!M.getExtension("EXT_color_buffer_float"))return console.info("[nodality] '"+e.op+"' needs WebGL2 float render targets - op skipped."),null;M.getExtension("OES_texture_float_linear");var r=n.solver.resolutions(e,R.width,R.height),o={r:[M.R16F,M.RED],rg:[M.RG16F,M.RG],rgba:[M.RGBA16F,M.RGBA]},a=[],i=function(e,t,n,r){var i=c(o[n],2),s=i[0],l=i[1],u=M.createTexture();M.bindTexture(M.TEXTURE_2D,u);var f=r?M.LINEAR:M.NEAREST;M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,f),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,f),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texImage2D(M.TEXTURE_2D,0,s,e,t,0,l,M.HALF_FLOAT,null);var d=M.createFramebuffer();M.bindFramebuffer(M.FRAMEBUFFER,d),M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_2D,u,0);var h=M.checkFramebufferStatus(M.FRAMEBUFFER)===M.FRAMEBUFFER_COMPLETE;M.viewport(0,0,e,t),M.clearColor(0,0,0,1),M.clear(M.COLOR_BUFFER_BIT);var p={tex:u,fbo:d,w:e,h:t,ok:h};return a.push(p),p},s={},l=!0;for(var u in n.solver.targets){var f=n.solver.targets[u],d=r[f.res],p=c(Array.isArray(d)?d:[d,d],2),m=p[0],y=p[1];f.double?(s[u]={a:i(m,y,f.fmt,f.smooth),b:i(m,y,f.fmt,f.smooth)},l=l&&s[u].a.ok&&s[u].b.ok):(s[u]={a:i(m,y,f.fmt,f.smooth)},l=l&&s[u].a.ok)}M.bindFramebuffer(M.FRAMEBUFFER,null);var g=function(){return a.forEach(function(e){M.deleteFramebuffer(e.fbo),M.deleteTexture(e.tex)})};if(!l)return console.info("[nodality] '"+e.op+"' float targets incomplete - op skipped."),g(),null;var x={};try{for(var b in n.solver.programs){var w=M.createProgram();if(M.attachShader(w,B(M.VERTEX_SHADER,v)),M.attachShader(w,B(M.FRAGMENT_SHADER,n.solver.programs[b])),M.bindAttribLocation(w,0,"a"),M.linkProgram(w),!M.getProgramParameter(w,M.LINK_STATUS))throw new Error(b+": "+M.getProgramInfoLog(w));x[b]={prog:w,loc:{}}}}catch(t){for(var _ in console.warn("[nodality] '"+e.op+"' solver programs failed:",t),g(),x)M.deleteProgram(x[_].prog);return null}return M.useProgram(W),{i:t,node:e,def:n,res:r,targets:s,progs:x,cleanup:g,prevX:.5,prevY:.5,primed:!1}}(e,t);r&&q.push(r)}});var H=function(e,t){var n=null,r={res:e.res,use:function(t){n=e.progs[t],M.useProgram(n.prog)},u:function(e){return e in n.loc||(n.loc[e]=M.getUniformLocation(n.prog,e)),n.loc[e]},f1:function(e,t){M.uniform1f(r.u(e),t)},f2:function(e,t,n){M.uniform2f(r.u(e),t,n)},f3:function(e,t,n,o){M.uniform3f(r.u(e),t,n,o)},smp:function(e,t,n){M.activeTexture(M.TEXTURE0+n),M.bindTexture(M.TEXTURE_2D,t.tex),M.uniform1i(r.u(e),n)},read:function(t){return e.targets[t].a},write:function(t){return e.targets[t].b},single:function(t){return e.targets[t].a},content:{tex:Y},canvasW:R.width,canvasH:R.height,swap:function(t){var n=e.targets[t],r=n.a;n.a=n.b,n.b=r},blit:function(e){M.bindFramebuffer(M.FRAMEBUFFER,e.fbo),M.viewport(0,0,e.w,e.h),M.drawArrays(M.TRIANGLES,0,3)}},o=ie[0]/R.width,a=1-ie[1]/R.height,i=0,s=0;e.primed&&se&&(i=(o-e.prevX)/Math.max(t,.001),s=(a-e.prevY)/Math.max(t,.001)),e.prevX=o,e.prevY=a,e.primed=!0;var c=se&&Math.abs(i)+Math.abs(s)>.001;e.def.solver.step(r,e.node,{dt:t,px:o,py:a,dx:i,dy:s,moving:c,aspect:R.width/Math.max(R.height,1),col:e.def.solver.splatColor(e.node,i,s)})},Y=M.createTexture();M.bindTexture(M.TEXTURE_2D,Y),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,I?M.LINEAR_MIPMAP_LINEAR:M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.pixelStorei(M.UNPACK_FLIP_Y_WEBGL,!0);var V=function(){I&&M.generateMipmap(M.TEXTURE_2D)},$=!1,K=!1,Q=T?"live":"snapshot",Z=!1,J={color:"transparent","-webkit-text-fill-color":"transparent","-webkit-text-stroke-color":"transparent","background-color":"transparent","background-image":"none","border-color":"transparent","box-shadow":"none","text-shadow":"none"},ee=null,te=function(){if(e.style.visibility="",ee){var t,n=s(ee);try{for(n.s();!(t=n.n()).done;){var r=c(t.value,2),o=r[0],a=r[1];for(var i in J)a[i]?o.style.setProperty(i,a[i]):o.style.removeProperty(i);a.op?o.style.setProperty("opacity",a.op):o.style.removeProperty("opacity")}}catch(e){n.e(e)}finally{n.f()}ee=null,e.style.isolation="",R.style.zIndex=""}},ne=function(){if(m){var t=function(){var t="IMG"===e.tagName?e:e.querySelector?e.querySelector("img"):null;return t&&t.complete&&t.naturalWidth>0?t:null}();if(t)try{return M.bindTexture(M.TEXTURE_2D,Y),M.texImage2D(M.TEXTURE_2D,0,M.RGBA,M.RGBA,M.UNSIGNED_BYTE,t),V(),$=!0,Promise.resolve()}catch(e){}else if(!Z){var n="IMG"===e.tagName?e:e.querySelector&&e.querySelector("img");n&&(Z=!0,n.addEventListener("load",function(){K||ne()},{once:!0}))}}R.style.display="none",te();var r=function(e,t,n,r){var o=function(e){if(!e)return null;var t=null;if("IMG"===e.tagName)t=e;else if(e.children){var n=Array.prototype.filter.call(e.children,function(e){return!e.hasAttribute||!e.hasAttribute("data-nodality-raster")});1===n.length&&"IMG"===n[0].tagName&&(t=n[0])}if(!t||!t.complete||!t.naturalWidth)return null;try{if(new URL(t.currentSrc||t.src,location.href).origin!==location.origin)return null}catch(e){return null}return t}(e);return o?Promise.resolve(function(e,t,n,r){var o=Math.max(1,Math.round(t*r)),a=Math.max(1,Math.round(n*r)),i=e.naturalWidth,s=e.naturalHeight;if(!i||!s)return e;var c="fill",l="50% 50%";if("function"==typeof getComputedStyle){var u=getComputedStyle(e);c=u.objectFit||"fill",l=u.objectPosition||"50% 50%"}if("fill"===c)return e;var f=o/i,d=a/s,h="cover"===c?Math.max(f,d):"contain"===c?Math.min(f,d):"none"===c?1:"scale-down"===c?Math.min(1,Math.min(f,d)):Math.max(f,d),p=i*h,v=s*h,m=String(l).trim().split(/\s+/),y=function(e,t){if(null==e)return.5;if(e.endsWith("%"))return parseFloat(e)/100;if("left"===e||"top"===e)return 0;if("right"===e||"bottom"===e)return 1;if("center"===e)return.5;var n=parseFloat(e);return isNaN(n)?.5:n/(0===t?Math.max(o-p,1):Math.max(a-v,1))},g=y(m[0],0),x=y(m.length>1?m[1]:m[0],1),b=document.createElement("canvas");b.width=o,b.height=a;var w=b.getContext("2d");return w?(w.drawImage(e,(o-p)*g,(a-v)*x,p,v),b):e}(o,t,n,r)):new Promise(function(o,a){var s=(new XMLSerializer).serializeToString(function(e,t){for(var n=[e].concat(i(e.querySelectorAll("*"))),r=[t].concat(i(t.querySelectorAll("*"))),o=0;o<n.length&&o<r.length;o++){var a=r[o].style;if(a&&0!==a.length)for(var s=null,c=0,l=Array.from(a);c<l.length;c++){var u=l[c];if(k.test(a.getPropertyValue(u))){var f=(s=s||window.getComputedStyle(n[o])).getPropertyValue(u);f&&a.setProperty(u,f,a.getPropertyPriority(u))}}}return t}(e,e.cloneNode(!0))),c='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(t*r,'" height="').concat(n*r,'" viewBox="0 0 ').concat(t," ").concat(n,'">')+'<foreignObject width="100%" height="100%">'+'<div xmlns="http://www.w3.org/1999/xhtml">'.concat(s,"</div>")+"</foreignObject></svg>",l=new Image;l.onload=function(){return o(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(c)})}(e,u.width,u.height,p).then(function(t){K||(M.bindTexture(M.TEXTURE_2D,Y),M.texImage2D(M.TEXTURE_2D,0,M.RGBA,M.RGBA,M.UNSIGNED_BYTE,t),V(),$=!0,x||function(){if(!ee){ee=[];for(var t=0,n=[e].concat(i(e.querySelectorAll("*")));t<n.length;t++){var r=n[t];if(r!==R&&"CANVAS"!==r.tagName){var o={op:r.style.getPropertyValue("opacity")};for(var a in J)o[a]=r.style.getPropertyValue(a);for(var s in ee.push([r,o]),J)r.style.setProperty(s,J[s],"important");r!==e&&r.matches&&r.matches("img,svg,video,picture,iframe")&&r.style.setProperty("opacity","0","important")}}e.style.isolation="isolate",R.style.zIndex="-1"}}(),R.style.visibility="visible")}).catch(function(e){te(),console.warn("[nodality] raster snapshot failed:",e)});return R.style.display="",r},re=-1,oe=function(){if(!K&&"live"===Q){M.bindTexture(M.TEXTURE_2D,Y);var e,t=M.RGBA8||32856,n=[[M.TEXTURE_2D,t,O],[M.TEXTURE_2D,0,M.RGBA,M.RGBA,M.UNSIGNED_BYTE,O],[M.TEXTURE_2D,0,t,O],[M.TEXTURE_2D,0,O]];if(re>=0)e=[re];else{e=[0,1,2,3];var r={3:0,6:1,4:2}[M.texElementImage2D.length];null!=r&&(e.splice(e.indexOf(r),1),e.unshift(r))}var o,a=[],i=s(e);try{for(i.s();!(o=i.n()).done;){var c=o.value;try{return M.texElementImage2D.apply(M,n[c]),V(),re<0&&(re=c,console.info("[nodality] texElementImage2D signature discovered: form",c,"(declared arity "+M.texElementImage2D.length+")")),void($=!0)}catch(e){a.push("form"+c+" -> "+(e&&e.name?e.name:"?")+": "+(e&&e.message?e.message:e))}}}catch(e){i.e(e)}finally{i.f()}ae("texElementImage2D rejected all known signatures (arity "+M.texElementImage2D.length+"): "+a.join(" | "))}},ae=function(t){if(!K&&"live"===Q){for(Q="snapshot",console.warn("[nodality] live raster backend failed ("+t+") - falling back to snapshot."),R.removeEventListener("paint",oe);O.firstChild;)e.appendChild(O.firstChild);O.parentNode===R&&R.removeChild(O),R.removeAttribute("layoutsubtree"),R.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(u.width,"px;height:").concat(u.height,"px;")+"pointer-events:none;z-index:2147483000;",R.setAttribute("aria-hidden","true"),R.setAttribute("data-nodality-raster","snapshot-fallback"),ne()}};T&&(R.addEventListener("paint",oe),setTimeout(function(){K||"live"!==Q||$||ae("no paint event within 1500ms")},1500));var ie=[.5*R.width,.5*R.height],se=!1,ce=function(e){var t=R.getBoundingClientRect(),n=e.touches?e.touches[0]:e,r=[(n.clientX-t.left)*p,(n.clientY-t.top)*p];r[0]===ie[0]&&r[1]===ie[1]||(se=!0),ie=r};e.addEventListener("mousemove",ce,{passive:!0}),e.addEventListener("touchmove",ce,{passive:!0});var le=0,ue=0,fe=function(){le=1},de=function(){le=0};e.addEventListener("mouseenter",fe,{passive:!0}),e.addEventListener("mouseleave",de,{passive:!0});var he=[];t.forEach(function(e,t){var n=h[e.op]||{},r=e.by||n.defaultDriver;r&&f[r]?he.push({i:t,fn:f[r]}):e.by&&console.warn("[nodality] unknown driver '"+e.by+"' on op '"+e.op+"' - known drivers: "+d.join(", "))});var pe=function(){if("undefined"==typeof window)return.5;var t=e.getBoundingClientRect(),n=window.innerHeight||1;return Math.max(0,Math.min(1,(n-t.top)/(n+t.height)))},ve=0,me=!0,ye=function(){if(!K){if(me&&$){for(var e="undefined"!=typeof performance?performance.now():X+16,t=Math.max(0,(e-X)/1e3),n=0,r=q;n<r.length;n++){var o=r[n];H(o,t)}if(se=!1,M.bindFramebuffer(M.FRAMEBUFFER,null),M.useProgram(W),M.viewport(0,0,R.width,R.height),M.clearColor(0,0,0,0),M.clear(M.COLOR_BUFFER_BIT),M.uniform2f(U("u_res"),R.width,R.height),M.uniform2f(U("u_mouse"),ie[0],ie[1]),M.uniform1f(U("u_time"),e/1e3),he.length>0){ue+=(le-ue)*(1-Math.exp(8*-t));for(var a={mouseX:ie[0],mouseY:ie[1],w:R.width,h:R.height,t:e/1e3,hover:ue,scroll:pe()},i=0,c=he;i<c.length;i++){var l=c[i],u=l.fn(a);M.uniform2f(U("u".concat(l.i,"_dpos")),u.x,u.y),M.uniform1f(U("u".concat(l.i,"_damt")),u.amt)}}if(G.length>0)for(var f={w:R.width,h:R.height,mouseX:ie[0],mouseY:ie[1],dt:t,t:e/1e3},d=0,h=G;d<h.length;d++){var p,v=h[d],m=s(v.def.tick(v.state,f));try{for(m.s();!(p=m.n()).done;){var y=p.value;N(U("u".concat(v.i,"_").concat(y.name)),y.kind,y.value)}}catch(e){m.e(e)}finally{m.f()}}M.activeTexture(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Y),M.uniform1i(U("u_tex"),0);for(var g=1,x=0,b=q;x<b.length;x++){var w=b[x],_=w.def.solver.samplers;for(var k in _)M.activeTexture(M.TEXTURE0+g),M.bindTexture(M.TEXTURE_2D,w.targets[_[k]].a.tex),M.uniform1i(U("u".concat(w.i,"_").concat(k)),g),g++}M.activeTexture(M.TEXTURE0),X=e,M.drawArrays(M.TRIANGLES,0,3)}ve=requestAnimationFrame(ye)}},ge=null;"undefined"!=typeof IntersectionObserver&&(ge=new IntersectionObserver(function(e){var t=c(e,1)[0];me=t.isIntersecting})).observe(e);var xe=null,be=0,we=function(){if(!K){var e=l();if(!(e.width<2||e.height<2)){var t=Math.round(e.width*p),n=Math.round(e.height*p);u.width=e.width,u.height=e.height,R.style.width=e.width+"px",R.style.height=e.height+"px";var r=R.width!==t||R.height!==n;r&&(R.width=t,R.height=n),"snapshot"===Q?ne():r&&oe()}}};"undefined"!=typeof ResizeObserver&&(xe=new ResizeObserver(function(){!function(){if(!K){var e=l();e.width<2||e.height<2||Math.round(e.width)===Math.round(u.width)&&Math.round(e.height)===Math.round(u.height)||(u.width=e.width,u.height=e.height,R.style.width=e.width+"px",R.style.height=e.height+"px")}}(),clearTimeout(be),be=setTimeout(we,150)})).observe(e);var _e=0,ke=function(){clearTimeout(_e),_e=setTimeout(function(){if(!K)if("snapshot"!==Q){var t=e.clientWidth||e.parentElement&&e.parentElement.clientWidth||u.width;R.style.width=t+"px",setTimeout(function(){if(!K&&"live"===Q){var e=Math.max(2,Math.round(O.getBoundingClientRect().height))||u.height;u.width=t,u.height=e,R.style.height=e+"px",R.width=Math.round(t*p),R.height=Math.round(e*p),oe()}},50)}else we()},150)};return"undefined"!=typeof window&&window.addEventListener("resize",ke),"live"===Q?ve=requestAnimationFrame(ye):(ne().then(function(){ve=requestAnimationFrame(ye)}),"undefined"!=typeof document&&document.fonts&&"object"===a(document.fonts.ready)&&Promise.resolve(document.fonts.ready).then(we).catch(function(){})),{canvas:R,refresh:function(){return"live"===Q?oe():ne()},destroy:function(){K=!0,cancelAnimationFrame(ve),clearTimeout(be),clearTimeout(_e),ge&&ge.disconnect(),xe&&xe.disconnect(),"undefined"!=typeof window&&window.removeEventListener("resize",ke),e.removeEventListener("mousemove",ce),e.removeEventListener("touchmove",ce),e.removeEventListener("mouseenter",fe),e.removeEventListener("mouseleave",de),R.removeEventListener("paint",oe);for(var t=0,n=q;t<n.length;t++){var r=n[t];for(var o in r.cleanup(),r.progs)M.deleteProgram(r.progs[o].prog)}for(q.length=0;O!==e&&O.firstChild;)e.appendChild(O.firstChild);te(),e.style.visibility="",R.remove()}}}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||F(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=F(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function F(e,t){if(e){if("string"==typeof e)return I(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O(e){return O="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},O(e)}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P(r.key),r)}}function P(e){var t=function(e){if("object"!=O(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==O(t)?t:t+""}var j=function(){function e(){var t,n,r,a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r=function(e){if(e.transform||e.op){var t=e.op;e.transform||(t=e.op),t.duration||(t.duration="3s-ease-in-out"),a.setDefault=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0px";return 0===e.length?t+" ":e};var n=function(){var n="",r="",o="",i="",s="",c="",l="",u="",f="";if(0!==t.values.length){t.values.forEach(function(e){e.startsWith("tx:")&&(n=e.replace("tx:","")),e.startsWith("ty:")&&(r=e.replace("ty:","")),e.startsWith("tz:")?o=e.replace("tz:",""):e.startsWith("scale(")?i=e:e.startsWith("skew(")?s=e:e.startsWith("rotate(")?c=function(e){var t=e.match(/rotate\(([^)]+)\)/);if(!t)return e;var n=t[1].split(",").map(function(e){return e.trim()});return 1===n.length?"rotate(".concat(n[0],")"):2===n.length?"rotateX(".concat(n[0],") rotateY(").concat(n[1],")"):3===n.length?"rotateX(".concat(n[0],") rotateY(").concat(n[1],") rotate(").concat(n[2],")"):e}(e):e.startsWith("perspective(")?l=e:e.startsWith("matrix(")?u=e:e.startsWith("opacity:")&&(f=e.replace("opacity:",""))}),n=a.setDefault(n),r=a.setDefault(r),o=a.setDefault(o);var d="";if("0px"!=r&&"0px"!=n&&"0px"!=o?d+="translate3d(".concat(n,", ").concat(r,", ").concat(o,")"):"0px"==r&&"0px"==n||(d+="translate(".concat(n,", ").concat(r,")")),i&&(d+=" ".concat(i)),c&&(d+=" ".concat(c)),s&&(d+=" ".concat(s)),l&&(d+=" ".concat(l)),u&&(d+=" ".concat(u)),d){if(e.op.duration){var h=e.op.duration.replace(/^(\d+)(s)-/,function(e,t,n){return t/2+n+" "}),p="transform ".concat(h,", opacity ").concat(h);a.res.style.transition=p}else a.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";e.op.static&&(a.res.style.transition=""),(a.blastTarget||a.res).style.transform=d,a.res.style.opacity=f}else console.warn("[nodality] transform produced no geometric value - check `values`")}};t.on?a.res.addEventListener(t.on,function(){t.delay?setTimeout(function(){n()},t.delay):n()}):a._on(window,"load",function(){t.delay?setTimeout(function(){n()},t.delay):n()});var r=function(){var e="";t.values.forEach(function(t){t.startsWith("tx:")?e+="translateX(0) ":t.startsWith("ty:")?e+="translateY(0) ":t.startsWith("tz:")?e+="translateZ(0) ":t.startsWith("scale(")?e+="scale(1) ":t.startsWith("skew(")?e+="skew(0, 0) ":t.startsWith("rotate(")?e+="rotate(0) ":t.startsWith("perspective(")?e+="perspective(0) ":t.startsWith("matrix(")&&(e+="matrix(1, 0, 0, 1, 0, 0) "),a.res.style.opacity="1"}),e&&(a.res.style.transform=e.trim())};if(t.on)a.res.addEventListener("mouseout",function(){t.keep||r()});else{var o=1e3*parseFloat(t.duration),i=t.closeAfter?t.closeAfter:0;setTimeout(function(){t.keep||r()},o/2+i)}t.hardCSS&&(a.res.style.transform=t.hardCSS)}else console.warn("[nodality] reactOnTransform: unrecognised transform descriptor - ignored")},(n=P(n="reactOnTransform"))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.state={isExpanded:!1,isMovedUp:!1,isMovedDown:!1},this.openedElements=new WeakMap,"undefined"!=typeof document&&(this._themeUnsub=o.subscribe(function(e){return a._applyTheme(e)}),Promise.resolve().then(function(){return a._applyTheme(o.mode)}))}return t=e,n=[{key:"rasterize",value:function(e){var t=this;if(e&&0!==e.length&&!this._rasterHandle&&!this._rasterCancelled&&"undefined"!=typeof document&&"undefined"!=typeof setTimeout){var n=0,r=function(){if(!t._rasterHandle&&!t._rasterCancelled){if(t.res&&t.res.isConnected){try{t._rasterHandle=R(t.res,e)}catch(e){return void console.warn("[nodality] raster pipeline skipped:",e)}if(t._rasterHandle)return}++n<80&&(t._rasterTimer=setTimeout(r,50))}};this._rasterTimer=setTimeout(r,0),this._track(function(){return clearTimeout(t._rasterTimer)})}}},{key:"isHidden",value:function(e){e&&(this.res.style.display="none")}},{key:"theme",value:function(e){var t=this;return e&&"object"===O(e)?(this._themeMap=e,this._applyTheme(o.mode),this._themeUnsub||(this._themeUnsub=o.subscribe(function(e){return t._applyTheme(e)})),this):this}},{key:"_track",value:function(e){return"function"!=typeof e||(this._disposables||(this._disposables=[])).push(e),e}},{key:"_on",value:function(e,t,n,r){return e&&"function"==typeof e.addEventListener?(e.addEventListener(t,n,r),this._track(function(){return e.removeEventListener(t,n,r)}),n):n}},{key:"destroy",value:function(){if("function"==typeof this._themeUnsub&&(this._themeUnsub(),this._themeUnsub=null),this._rasterHandle&&"function"==typeof this._rasterHandle.destroy)try{this._rasterHandle.destroy()}catch(e){}if(this._rasterHandle=null,this._rasterCancelled=!0,this._disposables){var e,t=M(this._disposables);try{for(t.s();!(e=t.n()).done;){var n=e.value;try{n()}catch(e){}}}catch(e){t.e(e)}finally{t.f()}this._disposables.length=0}return this._responsiveTasks=null,this._responsiveHandler=null,this.res&&this.res.parentNode&&this.res.parentNode.removeChild(this.res),this}},{key:"_applyTheme",value:function(e){if(!this._noTheme&&this.res)if(this._themeMap){var t=this._themeMap[e];if(!t)return;for(var n in t)this.res.style[n]=t[n]}else{var r=o.defaults&&o.defaults[e];if(r)for(var a in this._themeOriginal||(this._themeOriginal={}),r)a in this._themeOriginal||(this._themeOriginal[a]=this.res.style[a]||""),this._themeOriginal[a]||(this.res.style[a]=r[a])}}},{key:"keySet",value:function(e){if(this.temporaryVal=1,Array.isArray(e)){for(var t=0;t<e.length;t++)e[t]&&null!=e[t].key&&(this.res.style[e[t].key]=e[t].value);return this}return this.res.style[e.key]=e.value,this}},{key:"commonMethods",value:function(e){var t={exact:"fontSize",cursor:"cursor",width:"width",maxWidth:"maxWidth",height:"height",maxHeight:"maxHeight",radius:"borderRadius",lineHeight:"lineHeight",background:"background",color:"color",font:"fontFamily",opacity:"opacity",gap:"gap",minHeight:"minHeight",position:"position",inset:"inset",top:"top",right:"right",bottom:"bottom",left:"left",zIndex:"zIndex",flex:"flex",flexShrink:"flexShrink",flexGrow:"flexGrow",flexBasis:"flexBasis",flexWrap:"flexWrap",alignSelf:"alignSelf",display:"display",gridTemplateColumns:"gridTemplateColumns",gridTemplateRows:"gridTemplateRows",rowGap:"rowGap",columnGap:"columnGap",letterSpacing:"letterSpacing",textTransform:"textTransform",whiteSpace:"whiteSpace",overflowWrap:"overflowWrap",wordBreak:"wordBreak",wordWrap:"wordWrap",boxShadow:"boxShadow",backdropFilter:"backdropFilter",WebkitBackdropFilter:"WebkitBackdropFilter",overflow:"overflow",overflowX:"overflowX",overflowY:"overflowY",WebkitOverflowScrolling:"WebkitOverflowScrolling",WebkitTapHighlightColor:"WebkitTapHighlightColor",minWidth:"minWidth",boxSizing:"boxSizing",pointerEvents:"pointerEvents",userSelect:"userSelect",WebkitUserSelect:"WebkitUserSelect",textAlign:"textAlign",transition:"transition"};for(var n in t)null!=e[n]&&(this.res.style[t[n]]=e[n]);return"string"==typeof e.transform&&(this.res.style.transform=e.transform),e.pad&&this.pad(e.pad),e.mar&&this.mar(e.mar),e.respad&&this.respad(e.respad),e.borderObj&&e.borderObj.width&&this.borderObj(e.borderObj),e.resmar&&this.resmar(e.resmar),e.hover&&this.hover(e.hover),e.size&&this.fluidCopy(e.size),e.resprop&&this.resprop(e.resprop,e),e.keySet&&this.keySet(e.keySet),e.noTheme&&(this._noTheme=!0),e.theme&&this.theme(e.theme),e.hide&&this.isHidden(e.hide),e.raster&&this.rasterize(e.raster),e.center&&this.center(e.center,{display:e.disp||e.display,flexDirection:e.flexDir||e.flexDirection}),e.transform&&"object"===O(e.transform)&&this.reactOnTransform(e.transform),void 0!==e.opacity&&(this.res.style.opacity=e.opacity),e.bold?this.res.style.fontWeight="bold":null!=e.weight&&(this.res.style.fontWeight=e.weight),this}},{key:"hover",value:function(e){var t=this;if(e.border){var n=e.border.width;this.res.style.border=n?"".concat(n,"px solid transparent"):"1px solid transparent"}var r=this.options&&this.options.borderObj;return r&&(this.res.style.border="".concat(r.width,"px solid ").concat(r.color)),this.prevColor=this.res.style.backgroundColor,this.foreColor=this.res.style.color,this.prevBorder=this.res.style.border,this.prevBoxShadow=this.res.style.boxShadow,e.animation&&(this.res.style.transition="".concat(e.animation),this.res.style.transitionProperty="background-color, color, border, box-shadow, transform"),this.prevTransform=this.res.style.transform,this.res.onmouseout=function(){t.res.style.backgroundColor="".concat(t.prevColor),t.res.style.color="".concat(t.foreColor),t.res.style.border=t.prevBorder,null==e.scale&&null==e.transform||(t.res.style.transform=t.prevTransform||""),null!=e.boxShadow&&(t.res.style.boxShadow=t.prevBoxShadow||"")},this.res.onmouseover=function(){if(t.res.style.color=e.color,t.res.style.backgroundColor=e.background,e.border){var n,r=e.border.width,o=null!==(n=e.border.color)&&void 0!==n?n:"#2ECC71";t.res.style.border=r?"".concat(r,"px solid ").concat(o):"1px solid #2ECC71"}if(null!=e.scale||null!=e.transform){var a=t.prevTransform?"".concat(t.prevTransform," "):"",i=[];null!=e.transform&&i.push(e.transform),null!=e.scale&&i.push("scale(".concat(e.scale,")")),t.res.style.transform="".concat(a).concat(i.join(" "))}null!=e.boxShadow&&(t.res.style.boxShadow=e.boxShadow)},this}},{key:"onScroll",value:function(e){var t=this,n=function(e){if(null==e)return{num:0,unit:"px"};var t=String(e).match(/^(-?[\d.]+)(.*)$/);return t?{num:parseFloat(t[1]),unit:t[2]||"px"}:{num:0,unit:"px"}},r=function(e){var n=e&&null!=e.tx?e.tx:"0px",r=e&&null!=e.ty?e.ty:"0px";t.res.style.transform="translate3d(".concat(n,", ").concat(r,", 0)")};"opacity"===e.value?this.res.style.opacity=e.valMin:"scale"===e.value?this.res.style.transform="scale(".concat(e.valMin,")"):"trn"===e.value&&r(e.valMin);var o=function(){if("trn"!==e.value){var o=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:e.valMin,max:e.valMax});"opacity"===e.value?t.res.style.opacity=o:"scale"===e.value&&(t.res.style.transform="scale(".concat(o,")"))}else{for(var a={},i=["tx","ty"],s=0;s<i.length;s++){var c=i[s],l=e.valMin&&null!=e.valMin[c],u=e.valMax&&null!=e.valMax[c];if(l||u){var f=n(l?e.valMin[c]:u?e.valMax[c]:"0px"),d=n(u?e.valMax[c]:l?e.valMin[c]:"0px"),h=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:f.num,max:d.num});a[c]="".concat(h).concat(f.unit)}}r(a)}};this._on(window,"scroll",o),0===e.from&&o()}},{key:"setAny",value:function(e){this[Object.keys(e)[0]]=[Object.values(e)[0]]}},{key:"setID",value:function(e){this.id=e}},{key:"setPrevText",value:function(e){this.prevText=e}},{key:"_setupResponsiveManager",value:function(){var e=this;this._responsiveTasks=this._responsiveTasks||[];var t=function(){e._responsiveTasks.forEach(function(e){e()})};this._responsiveHandler||(this._responsiveHandler=t,this._on(window,"resize",t)),setTimeout(function(){t()},0)}},{key:"resprop",value:function(t,n){var r=this;this.options=n;var o={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]},a=["resprop","breakpoint","value","values","range"],i={flexDir:"flexDirection",dir:"flexDirection",justify:"justifyContent",align:"alignItems",wrap:"flexWrap",bg:"background",radius:"borderRadius",z:"zIndex",exact:"fontSize"},s=function(e){var t=i[e]||e;return"undefined"==typeof console||"function"==typeof r[e]||t in r.res.style||console.warn('[nodality] resprop: "'.concat(e,'" is not a CSS property or component method — ignored.')+(i[e]?"":" Did you mean one of: ".concat(Object.keys(i).join(", "),"?"))),t};t.forEach(function(e){void 0!==o[e.breakpoint]?e.range=o[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[0,parseInt(e.breakpoint,10)]}),t.sort(function(e,t){return e.range[1]-t.range[1]});var c=t.find(function(e){return"default"===e.breakpoint});c||(c={breakpoint:"default",range:o.default},t.unshift(c));var l=new Set;t.forEach(function(e){Object.keys(e).forEach(function(e){a.includes(e)||"range"===e||l.add(e)})}),l.forEach(function(e){void 0===c[e]&&(c[e]=r.options[e]||"initial")}),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var n=e.viewportWidth(),o=c,i=0;i<t.length;i++){var u=t[i],f=D(u.range,2),d=f[0],h=f[1];if("default"!==u.breakpoint&&n>=d&&n<=h){o=u;break}}for(var p in l.forEach(function(e){if("keySet"===e){var t=c[e];t&&t.key&&(r.res.style[t.key]=t.value)}else r.res.style[s(e)]=c[e]}),o)if("exact"!==p){if(!a.includes(p)&&"range"!==p){var v=o[p];"keySet"===p&&v&&v.key?r.res.style[v.key]=v.value:"function"==typeof r[p]?r[p](v):r.res.style[s(p)]=v}}else r.res.style.fontSize=o[p]}),this._setupResponsiveManager()}},{key:"respad",value:function(t){var n=this,r={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]};t.forEach(function(e){void 0!==r[e.breakpoint]?e.range=r[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[parseInt(e.breakpoint,10),1e5]}),t.sort(function(e,t){return e.range[0]-t.range[0]});var o=t.find(function(e){return"default"===e.breakpoint});o||(o={breakpoint:"default",range:r.default},t.unshift(o)),void 0===o.values&&(o.values=this.options&&this.options.pad||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),a=o,i=0;i<t.length;i++){var s=t[i],c=D(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){a=s;break}}var f=void 0!==a.values?a.values:o.values;null!=f&&n.pad(f)}),this._setupResponsiveManager()}},{key:"resmar",value:function(t){var n=this,r={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]};t.forEach(function(e){void 0!==r[e.breakpoint]?e.range=r[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[parseInt(e.breakpoint,10),1e5]}),t.sort(function(e,t){return e.range[0]-t.range[0]});var o=t.find(function(e){return"default"===e.breakpoint});o||(o={breakpoint:"default",range:r.default},t.unshift(o)),void 0===o.values&&(o.values=this.options&&(this.options.mar||this.options.pad)||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),a=o,i=0;i<t.length;i++){var s=t[i],c=D(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){a=s;break}}var f=void 0!==a.values?a.values:o.values;null!=f&&n.mar(f)}),this._setupResponsiveManager()}},{key:"color",value:function(e){return this.res.style.color=e,this}},{key:"onTap",value:function(e){return this.res.addEventListener("click",e),this}},{key:"setArea",value:function(e){return this.res.style.gridArea=e,this}},{key:"font",value:function(e){return this.res.style.fontFamily=e,this}},{key:"radius",value:function(e){return this.res.style.borderRadius="number"==typeof e?"".concat(e,"px"):e,this}},{key:"width",value:function(e){return this.res.style.width=e,this}},{key:"scale",value:function(e){var t=this;return this.res.style.width,this.res.style.transition="0.5s all",this.res.addEventListener("mouseover",function(){t.res.style.width,t.res.style.transform="scale(1.04)"}),this.res.addEventListener("mouseout",function(){t.res.style.width,t.res.style.transform="scale(1.0)"}),this}},{key:"round",value:function(e){return this.deprecatedOption("round()","radius()"),this.radius(e)}},{key:"toCSS",value:function(){return this.css}},{key:"toHTMLA",value:function(){return this.html}},{key:"background",value:function(e){return this.res.style.background=e,this}},{key:"deprecatedOption",value:function(e,t){return console.error("nodality: `".concat(e,"` is deprecated — use `").concat(t,"` instead.")),this}},{key:"center",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.res.style,r=n.display||t.display||"",o=n.flexDirection||t.flexDirection||"",a=!0===e||"both"===e||"x"===e,i=!0===e||"both"===e||"y"===e;if(r.includes("grid"))return a&&(n.justifyItems="center",n.justifyContent="center"),i&&(n.alignItems="center",n.alignContent="center"),this;r.includes("flex")||(n.display="flex"),n.flexDirection||(n.flexDirection=o||"column");var s=(n.flexDirection||"column").startsWith("column");return(s?i:a)&&(n.justifyContent="center"),(s?a:i)&&(n.alignItems="center"),this}},{key:"isNumber",value:function(e){return"number"==typeof e&&!isNaN(e)}},{key:"pad",value:function(e){for(var t=0;t<e.length;t++)for(var n=Object.keys(e[t]),r=0;r<n.length;r++)for(var o=n[r],a=e[t][o],i=0;i<o.length;i++)switch(o[i]){case"a":this.res.style.padding=this.isNumber(a)?"".concat(a,"px"):a;break;case"t":this.res.style.paddingTop=this.isNumber(a)?"".concat(a,"px"):a;break;case"l":this.res.style.paddingLeft=this.isNumber(a)?"".concat(a,"px"):a;break;case"r":this.res.style.paddingRight=this.isNumber(a)?"".concat(a,"px"):a;break;case"b":this.res.style.paddingBottom=this.isNumber(a)?"".concat(a,"px"):a}return this}},{key:"as",value:function(e){return this.res.style.alignSelf=e,this}},{key:"mar",value:function(e){if("center"===e)return this.res.style.marginLeft="auto",this.res.style.marginRight="auto",this;for(var t=0;t<e.length;t++)for(var n=Object.keys(e[t]),r=0;r<n.length;r++){for(var o=n[r],a=e[t][o],i=0;i<o.length;i++)switch(o[i]){case"a":"auto"===a?(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"):this.res.style.margin=this.isNumber(a)?"".concat(a,"px"):a;break;case"t":this.res.style.marginTop=this.isNumber(a)?"".concat(a,"px"):a;break;case"l":this.res.style.marginLeft=this.isNumber(a)?"".concat(a,"px"):a;break;case"r":this.res.style.marginRight=this.isNumber(a)?"".concat(a,"px"):a;break;case"b":this.res.style.marginBottom=this.isNumber(a)?"".concat(a,"px"):a}"center"===o&&!0===a&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"),"auto"===a&&(o.includes("l")||o.includes("r"))&&(o.includes("l")&&(this.res.style.marginLeft="auto"),o.includes("r")&&(this.res.style.marginRight="auto"))}return this}},{key:"smartRange",value:function(e,t,n){e<t.min&&(e=t.min),e>t.max&&(e=t.max);var r=(e-t.min)/(t.max-t.min);return t.min>t.max&&(r=(e-t.max)/(t.min-t.max)),n.min+(n.max-n.min)*r}},{key:"gpos",value:function(e){return this.res.style.gridColumn=e.col,this.res.style.gridRow=e.row,this}},{key:"fluidCopy",value:function(e){if(e instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var t=document.createTextNode(this.text);return this.res.appendChild(t),this.res.style.fontSize=e.exact,this}if("S1"===e){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.625rem + 5.075vw)"}if("S2"===e){this.prevStylex=this.res.style,this.res=document.createElement("h2"),this.res.style.cssText=this.prevStylex.cssText;var r=document.createTextNode(this.text);this.res.appendChild(r),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===e){this.prevStylex=this.res.style,this.res=document.createElement("h3"),this.res.style.cssText=this.prevStylex.cssText;var o=document.createTextNode(this.text);this.res.appendChild(o),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===e){this.prevStylex=this.res.style,this.res=document.createElement("h4"),this.res.style.cssText=this.prevStylex.cssText;var a=document.createTextNode(this.text);this.res.appendChild(a),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===e){this.prevStylex=this.res.style,this.res=document.createElement("h5"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.125rem + 1.975vw)"}return"S6"===e&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setIndex",value:function(e){this.index=e}},{key:"borderObj",value:function(e){var t,n=null!==(t=e.type)&&void 0!==t?t:"solid";return this.res.style.border="".concat(e.width," ").concat(n," ").concat(e.color),void 0!==e.radius&&(this.res.style.borderRadius=e.radius),this}},{key:"setPref",value:function(e){this.preffersId=e}},{key:"setClass",value:function(e){this.class=e}},{key:"setTags",value:function(e){this.openTag=e.open,this.closeTag=e.close}},{key:"chainReact",value:function(t,n,r){var o=this;this.ap=!1,this.cta=0,this.once=!1;var a,i=M(t);try{for(i.s();!(a=i.n()).done;){var s=a.value;s.range||(s.range=["0px","999999px"])}}catch(e){i.e(e)}finally{i.f()}t.sort(function(e,t){return parseInt(e.range[0])-parseInt(t.range[0])});var c=function(a){var i=e.viewportWidth(),s=[],c=[];o.resCopy=o.res,o.storedQueries=t.map(function(e){return e.target}).filter(function(e){return null!=e});var l,u=M(t);try{for(u.s();!(l=u.n()).done;){var f=l.value;o.counterIndex++;var d=D(f.range,2),h=d[0],p=d[1],v=parseInt(h),m=parseInt(p),y=!0;if(f.target){y=!1;for(var g=0;g<f.target.length;g++)f.target[g]===n&&(y=!0)}i>=v&&i<=m&&y&&(s.push(f.log),c.push(f),f.op&&f.op.margin&&(o.useMargin=f.op.margin))}}catch(e){u.e(e)}finally{u.f()}if(r&&!r.includes("background")&&(o.res.style.background="",o.res.style.backgroundColor=""),o.res.style.textShadow="",r&&!r.includes("border")&&(o.res.style.border=""),r&&!r.includes("margin")&&(o.res.style.margin=""),o.res.style["-webkit-text-fill-color"]="",o.res.style["-webkit-text-stroke-color"]="",o.res.style["-webkit-text-stroke-width"]="",o.res.style.filter="",o.options.background&&(o.res.style.background=o.options.background),s.includes("gradient"),(s.includes("gradient")||s.includes("shadow"))&&(o.res.style.position="relative"),s.includes("blast")){var x,b=c.filter(function(e){return"blast"===e.log})[0].op.color,w=null!==(x=c.filter(function(e){return"blast"===e.log})[0].op.width)&&void 0!==x?x:"1px";"FlexRowLayoutElement"===o.getType()||"LayoutWrapperElement"===o.getType()?(o.res.style.border="".concat("number"==typeof w?w+"px":w," solid orange"),o.res.style.display="inline-block","FlexRowLayoutElement"===o.getType()&&(o.res.style.display="flex"),o.res.style.boxSizing="border-box",o.res.style.transformOrigin="center",o.blastTarget=o.res):(o.text,o.res.style["-webkit-text-fill-color"]="transparent",o.res.style["-webkit-text-stroke-color"]=b,o.res.style["-webkit-text-stroke-width"]="".concat(w))}if(s.includes("filter")){var _=c.filter(function(e){return"filter"===e.log})[0].op.filter;o.res.style.filter=_}if(s.includes("background")&&(o.res.style.backgroundColor="green"),s.includes("gradient")&&("LayoutWrapperElement"!==o.getType()&&"FlexRowLayoutElement"!==o.getType()&&(o.res.style["-webkit-text-fill-color"]="transparent"),o.res.style.background=o.globalGradient,"LayoutWrapperElement"!==o.getType()&&"FlexRowLayoutElement"!==o.getType()&&(o.res.style["background-clip"]="text")),s.includes("shadow")){var k,E,T,A,S=o.options.shadow.op,C=null!==(k=S.steps)&&void 0!==k?k:1,R=null!==(E=S.colors)&&void 0!==E?E:["gray"],F=null!==(T=S.movements)&&void 0!==T?T:["3px","3px"],I=null!==(A=S.radius)&&void 0!==A?A:"3px";if(1===F.length&&(F=[F[0],F[0]]),"FlexRowLayoutElement"===o.getType()||"LayoutWrapperElement"===o.getType()){for(var O=[],L=0;L<C;L++){var P,j=null!==(P=R[L])&&void 0!==P?P:R[0],z=F[0],B=F[1];O.push("".concat(z," ").concat(B," ").concat(I," ").concat(j))}o.res.style.boxShadow=O.join(", ")}else{for(var W=[],U=0;U<C;U++){var N,G=null!==(N=R[U])&&void 0!==N?N:R[0],X=F[0],q=F[1];W.push("drop-shadow(".concat(X," ").concat(q," ").concat(I," ").concat(G,")"))}o.res.style.filter=W.join(" ")}}if(s.includes("margin"))for(g=0;g<t.length;g++)if(t[g].op){var H=t[g].op.offsets;H&&void 0!==o.index&&(o.res.style.margin=H[Number(o.index)]+"px")}if(s.includes("spana")||s.includes("span")){var Y=document.createElement("div");if(Y.setAttribute("id","oroa"),Object.assign(Y.style,{position:"absolute",inset:"0",background:"linear-gradient(90deg, rgb(52,152,219), rgb(26,188,156))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",pointerEvents:"none"}),o.res&&o.res.querySelector("span"))return;o.res=o.resCopy,o.res.textContent="",o.options.span&&(Array.isArray(o.options.span)?o.options.span:[o.options.span]).forEach(function(e){if(e.op&&"span"===e.op.name&&Array.isArray(e.op.parts)){var t=0,n=o.prevText||"";if(e.op.parts.forEach(function(e){var r=e.text,a=e.style||{};if(t<n.length){var i=n.indexOf(r,t);if(i>t){var s=n.substring(t,i);o.res.appendChild(new o.constructor(s).setup({type:"span",id:a.id,animation:a.animation}).set({}).render())}t=i+r.length}var c=new o.constructor(r).setup({type:"span",id:a.id,animation:a.animation}).set(a).render();o.res.appendChild(c)}),t<n.length){var r=n.substring(t);o.res.appendChild(new o.constructor(r).setup({type:"span"}).set({}).render())}}})}else{var V=new o.constructor(o.prevText).set({}).render();o.prevText&&o.prevText.length>0&&a&&o.res.appendChild(V)}if(s.includes("animation")){if(o.options.animation&&!o.hasAnimated&&!o.options.animation.op.fireAt){o.hasAnimated=!0;var $=o.options.animation.op;o._on(window,"sidebar:open",function(){o.res.animate($.keyframesOpen,$.openOptions)}),o._on(window,"sidebar:closed",function(){o.res.animate($.keyframesClose,$.closeOptions)}),o.res.animate($.keyframesClose,{duration:0,fill:"forwards"}),o.openTag&&o.closeTag&&(o._on(window,o.openTag,function(){o.res.animate($.keyframesOpen,$.openOptions)}),o._on(window,o.closeTag,function(){o.res.animate($.keyframesClose,$.closeOptions)}))}if(o.options.animation&&o.options.animation.op.fireAt&&o.options.animation.op.fireAt.endsWith("px")){var K=o.options.animation.op;o.res.animate(K.keyframesClose,{duration:0,fill:"forwards"});var Q=function(){window.scrollY>parseFloat(K.fireAt)&&(o.res.animate(K.keyframesOpen,K.openOptions),window.removeEventListener("scroll",Q))};o._on(window,"scroll",Q)}if(o.options.animation&&"inview"===o.options.animation.op.fireAt){var Z=o.options.animation.op;o.res.animate(Z.keyframesClose,{duration:0,fill:"forwards"});var J=!1,ee=new IntersectionObserver(function(e,t){e.forEach(function(e){e.isIntersecting&&!J&&(J=!0,o.res.animate(Z.keyframesOpen,Z.openOptions),t.disconnect())})});ee.observe(o.res),o._track(function(){return ee.disconnect()})}}};this.options.animation||this._on(window,"resize",function(){return c()}),c()}},{key:"maxWidth",value:function(e){return this.res.style.maxWidth=e,this}},{key:"removeQuotesFromFirstWord",value:function(e){return e.replace(/"([^"]+)":/g,"$1:")}}],r=[{key:"viewportWidth",value:function(){if("undefined"==typeof window)return 0;var e=window.visualViewport;return e&&"number"==typeof e.width?e.width:window.innerWidth}}],n&&L(t.prototype,n),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();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 B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,W(r.key),r)}}function W(e){var t=function(e){if("object"!=z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==z(t)?t:t+""}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},G(e,t)}var X=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,n){return t=N(t),function(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)}(e,U()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))}(this,e)}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&&G(e,t)}(e,j),t=e,(n=[{key:"set",value:function(e){return this.imageUrl=e.url,this.createCard(),e.useBrightness&&(this.useBrightness=!0),e.useBrightness&&"\n useBrightness: ".concat(this.useBrightness),e.pad&&this.pad(e.pad),e.mar&&this.mar(e.mar),e.inpad&&this.inpad(e.inpad),e.inpad&&"\n inpad: {".concat(e.inpad,"}"),e.font&&(this.res.style.fontFamily=e.font),e.inpad&&"\n font: ".concat(e.font),this.addListeners(),this}},{key:"inpad",value:function(e){return this.res.children[1].style.boxSizing="border-box",this.res.children[1].style.padding=e,this}},{key:"items",value:function(e){for(var t=0;t<e.length;t++)this.res.children[1].appendChild(e[t].render());return this}},{key:"createCard",value:function(){var e=document.createElement("div");e.style.display="grid",e.style.width="300px",e.style.height="400px",e.setAttribute("id","AAA");var t=document.createElement("div");t.style.gridArea="1/1",t.style.height="400px",t.style.borderRadius="15px",t.style.boxShadow="0 4px 8px 0 rgba(0,0,0,0.2)",t.style.overflow="hidden";var n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.transition="0.9s",n.style.backgroundImage="url(".concat(this.imageUrl,")"),n.style.backgroundSize="cover",n.style.backgroundPostion="cover",n.style.backgroundRepeat="no-repeat",t.appendChild(n);var r=document.createElement("div");return r.style.gridArea="1/1",r.style.zIndex="1",e.appendChild(t),e.appendChild(r),this.res=e,this}},{key:"addListeners",value:function(){var e=this,t=this.res.children[0].children[0];return this.res.onmouseover=function(){t.style.transform="scale(1.3)",e.useBrightness&&(t.style.filter="brightness(31%)")},this.res.onmouseout=function(){t.style.transform="scale(1.0)",e.useBrightness&&(t.style.filter="brightness(100%)")},this}},{key:"render",value:function(e){if(!e)return this.res;this.options.id&&this.res.setAttribute("id",this.options.id),document.querySelector(e).appendChild(this.res)}}])&&B(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();export{X as ZoomCard};
2
+ import{applyRasterPipeline as e}from"../lib/raster-ops.js";var t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n="nodality.theme.mode",i="nodality:theme",s={mode:function(){try{var e=localStorage.getItem(n);if("light"===e||"dark"===e)return e}catch(e){}return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(),tokens:{light:{},dark:{}},defaults:{light:{color:"#111"},dark:{}},setDefaults:function(e){return e&&"object"===r(e)&&(e.light&&(this.defaults.light=Object.assign({},this.defaults.light,e.light)),e.dark&&(this.defaults.dark=Object.assign({},this.defaults.dark,e.dark)),this._broadcast()),this},setTokens:function(e){return e&&"object"===r(e)&&(e.light&&Object.assign(this.tokens.light,e.light),e.dark&&Object.assign(this.tokens.dark,e.dark)),this},get current(){return this.tokens[this.mode]||{}},set:function(e){if("light"!==e&&"dark"!==e)return this;if(e===this.mode)return this;this.mode=e;try{localStorage.setItem(n,e)}catch(e){}return this._broadcast(),this},toggle:function(){return this.set("dark"===this.mode?"light":"dark")},subscribe:function(e){if("undefined"==typeof document)return function(){};var t=function(t){return e(t.detail.mode,t.detail.tokens)};document.addEventListener(i,t);try{e(this.mode,this.current)}catch(e){}return function(){return document.removeEventListener(i,t)}},_broadcast:function(){"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent(i,{detail:{mode:this.mode,tokens:this.current}}))}};function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 s,o=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}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 h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(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 f=function(){function t(){var e,r,n,i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,n=function(e){if(e.transform||e.op){var t=e.op;e.transform||(t=e.op),t.duration||(t.duration="3s-ease-in-out"),i.setDefault=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0px";return 0===e.length?t+" ":e};var r=function(){var r="",n="",s="",o="",a="",l="",c="",u="",h="";if(0!==t.values.length){t.values.forEach(function(e){e.startsWith("tx:")&&(r=e.replace("tx:","")),e.startsWith("ty:")&&(n=e.replace("ty:","")),e.startsWith("tz:")?s=e.replace("tz:",""):e.startsWith("scale(")?o=e:e.startsWith("skew(")?a=e:e.startsWith("rotate(")?l=function(e){var t=e.match(/rotate\(([^)]+)\)/);if(!t)return e;var r=t[1].split(",").map(function(e){return e.trim()});return 1===r.length?"rotate(".concat(r[0],")"):2===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],")"):3===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],") rotate(").concat(r[2],")"):e}(e):e.startsWith("perspective(")?c=e:e.startsWith("matrix(")?u=e:e.startsWith("opacity:")&&(h=e.replace("opacity:",""))}),r=i.setDefault(r),n=i.setDefault(n),s=i.setDefault(s);var d="";if("0px"!=n&&"0px"!=r&&"0px"!=s?d+="translate3d(".concat(r,", ").concat(n,", ").concat(s,")"):"0px"==n&&"0px"==r||(d+="translate(".concat(r,", ").concat(n,")")),o&&(d+=" ".concat(o)),l&&(d+=" ".concat(l)),a&&(d+=" ".concat(a)),c&&(d+=" ".concat(c)),u&&(d+=" ".concat(u)),d){if(e.op.duration){var f=e.op.duration.replace(/^(\d+)(s)-/,function(e,t,r){return t/2+r+" "}),p="transform ".concat(f,", opacity ").concat(f);i.res.style.transition=p}else i.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";e.op.static&&(i.res.style.transition=""),(i.blastTarget||i.res).style.transform=d,i.res.style.opacity=h}else console.warn("[nodality] transform produced no geometric value - check `values`")}};t.on?i.res.addEventListener(t.on,function(){t.delay?setTimeout(function(){r()},t.delay):r()}):i._on(window,"load",function(){t.delay?setTimeout(function(){r()},t.delay):r()});var n=function(){var e="";t.values.forEach(function(t){t.startsWith("tx:")?e+="translateX(0) ":t.startsWith("ty:")?e+="translateY(0) ":t.startsWith("tz:")?e+="translateZ(0) ":t.startsWith("scale(")?e+="scale(1) ":t.startsWith("skew(")?e+="skew(0, 0) ":t.startsWith("rotate(")?e+="rotate(0) ":t.startsWith("perspective(")?e+="perspective(0) ":t.startsWith("matrix(")&&(e+="matrix(1, 0, 0, 1, 0, 0) "),i.res.style.opacity="1"}),e&&(i.res.style.transform=e.trim())};if(t.on)i.res.addEventListener("mouseout",function(){t.keep||n()});else{var s=1e3*parseFloat(t.duration),o=t.closeAfter?t.closeAfter:0;setTimeout(function(){t.keep||n()},s/2+o)}t.hardCSS&&(i.res.style.transform=t.hardCSS)}else console.warn("[nodality] reactOnTransform: unrecognised transform descriptor - ignored")},(r=d(r="reactOnTransform"))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,this.state={isExpanded:!1,isMovedUp:!1,isMovedDown:!1},this.openedElements=new WeakMap,"undefined"!=typeof document&&(this._themeUnsub=s.subscribe(function(e){return i._applyTheme(e)}),Promise.resolve().then(function(){return i._applyTheme(s.mode)}))}return r=t,n=[{key:"rasterize",value:function(t){var r=this;if(t&&0!==t.length&&!this._rasterHandle&&!this._rasterCancelled&&"undefined"!=typeof document&&"undefined"!=typeof setTimeout){var n=0,i=function(){if(!r._rasterHandle&&!r._rasterCancelled){if(r.res&&r.res.isConnected){try{r._rasterHandle=e(r.res,t)}catch(e){return void console.warn("[nodality] raster pipeline skipped:",e)}if(r._rasterHandle)return}++n<80&&(r._rasterTimer=setTimeout(i,50))}};this._rasterTimer=setTimeout(i,0),this._track(function(){return clearTimeout(r._rasterTimer)})}}},{key:"isHidden",value:function(e){e&&(this.res.style.display="none")}},{key:"theme",value:function(e){var t=this;return e&&"object"===u(e)?(this._themeMap=e,this._applyTheme(s.mode),this._themeUnsub||(this._themeUnsub=s.subscribe(function(e){return t._applyTheme(e)})),this):this}},{key:"_track",value:function(e){return"function"!=typeof e||(this._disposables||(this._disposables=[])).push(e),e}},{key:"_on",value:function(e,t,r,n){return e&&"function"==typeof e.addEventListener?(e.addEventListener(t,r,n),this._track(function(){return e.removeEventListener(t,r,n)}),r):r}},{key:"destroy",value:function(){if("function"==typeof this._themeUnsub&&(this._themeUnsub(),this._themeUnsub=null),this._rasterHandle&&"function"==typeof this._rasterHandle.destroy)try{this._rasterHandle.destroy()}catch(e){}if(this._rasterHandle=null,this._rasterCancelled=!0,this._disposables){var e,t=a(this._disposables);try{for(t.s();!(e=t.n()).done;){var r=e.value;try{r()}catch(e){}}}catch(e){t.e(e)}finally{t.f()}this._disposables.length=0}return this._responsiveTasks=null,this._responsiveHandler=null,this.res&&this.res.parentNode&&this.res.parentNode.removeChild(this.res),this}},{key:"_applyTheme",value:function(e){if(!this._noTheme&&this.res)if(this._themeMap){var t=this._themeMap[e];if(!t)return;for(var r in t)this.res.style[r]=t[r]}else{var n=s.defaults&&s.defaults[e];if(n)for(var i in this._themeOriginal||(this._themeOriginal={}),n)i in this._themeOriginal||(this._themeOriginal[i]=this.res.style[i]||""),this._themeOriginal[i]||(this.res.style[i]=n[i])}}},{key:"vars",value:function(e){if(!e||"object"!==u(e))return this;for(var t in e)this.res.style.setProperty(t,String(e[t]));return this}},{key:"keySet",value:function(e){if(this.temporaryVal=1,Array.isArray(e)){for(var t=0;t<e.length;t++)e[t]&&null!=e[t].key&&(this.res.style[e[t].key]=e[t].value);return this}return this.res.style[e.key]=e.value,this}},{key:"commonMethods",value:function(e){var t={exact:"fontSize",cursor:"cursor",width:"width",maxWidth:"maxWidth",height:"height",maxHeight:"maxHeight",radius:"borderRadius",lineHeight:"lineHeight",background:"background",color:"color",font:"fontFamily",opacity:"opacity",gap:"gap",minHeight:"minHeight",position:"position",inset:"inset",top:"top",right:"right",bottom:"bottom",left:"left",zIndex:"zIndex",flex:"flex",flexShrink:"flexShrink",flexGrow:"flexGrow",flexBasis:"flexBasis",flexWrap:"flexWrap",alignSelf:"alignSelf",display:"display",gridTemplateColumns:"gridTemplateColumns",gridTemplateRows:"gridTemplateRows",rowGap:"rowGap",columnGap:"columnGap",cols:"gridTemplateColumns",rows:"gridTemplateRows",areas:"gridTemplateAreas",area:"gridArea",letterSpacing:"letterSpacing",textTransform:"textTransform",whiteSpace:"whiteSpace",overflowWrap:"overflowWrap",wordBreak:"wordBreak",wordWrap:"wordWrap",boxShadow:"boxShadow",backdropFilter:"backdropFilter",WebkitBackdropFilter:"WebkitBackdropFilter",overflow:"overflow",overflowX:"overflowX",overflowY:"overflowY",WebkitOverflowScrolling:"WebkitOverflowScrolling",WebkitTapHighlightColor:"WebkitTapHighlightColor",minWidth:"minWidth",boxSizing:"boxSizing",pointerEvents:"pointerEvents",userSelect:"userSelect",WebkitUserSelect:"WebkitUserSelect",textAlign:"textAlign",transition:"transition"};for(var r in t)null!=e[r]&&(this.res.style[t[r]]=e[r]);return"string"==typeof e.transform&&(this.res.style.transform=e.transform),e.pad&&this.pad(e.pad),e.mar&&this.mar(e.mar),e.respad&&this.respad(e.respad),e.borderObj&&e.borderObj.width&&this.borderObj(e.borderObj),e.resmar&&this.resmar(e.resmar),e.hover&&this.hover(e.hover),e.size&&this.fluidCopy(e.size),e.resprop&&this.resprop(e.resprop,e),e.vars&&this.vars(e.vars),e.keySet&&this.keySet(e.keySet),e.noTheme&&(this._noTheme=!0),e.theme&&this.theme(e.theme),e.hide&&this.isHidden(e.hide),e.raster&&this.rasterize(e.raster),e.center&&this.center(e.center,{display:e.disp||e.display,flexDirection:e.flexDir||e.flexDirection}),e.transform&&"object"===u(e.transform)&&this.reactOnTransform(e.transform),void 0!==e.opacity&&(this.res.style.opacity=e.opacity),e.bold?this.res.style.fontWeight="bold":null!=e.weight&&(this.res.style.fontWeight=e.weight),this}},{key:"hover",value:function(e){var t=this;if(e.border){var r=e.border.width;this.res.style.border=r?"".concat(r,"px solid transparent"):"1px solid transparent"}var n=this.options&&this.options.borderObj;return n&&(this.res.style.border="".concat(n.width,"px solid ").concat(n.color)),this.prevColor=this.res.style.backgroundColor,this.foreColor=this.res.style.color,this.prevBorder=this.res.style.border,this.prevBoxShadow=this.res.style.boxShadow,e.animation&&(this.res.style.transition="".concat(e.animation),this.res.style.transitionProperty="background-color, color, border, box-shadow, transform"),this.prevTransform=this.res.style.transform,this.res.onmouseout=function(){t.res.style.backgroundColor="".concat(t.prevColor),t.res.style.color="".concat(t.foreColor),t.res.style.border=t.prevBorder,null==e.scale&&null==e.transform||(t.res.style.transform=t.prevTransform||""),null!=e.boxShadow&&(t.res.style.boxShadow=t.prevBoxShadow||"")},this.res.onmouseover=function(){if(t.res.style.color=e.color,t.res.style.backgroundColor=e.background,e.border){var r,n=e.border.width,i=null!==(r=e.border.color)&&void 0!==r?r:"#2ECC71";t.res.style.border=n?"".concat(n,"px solid ").concat(i):"1px solid #2ECC71"}if(null!=e.scale||null!=e.transform){var s=t.prevTransform?"".concat(t.prevTransform," "):"",o=[];null!=e.transform&&o.push(e.transform),null!=e.scale&&o.push("scale(".concat(e.scale,")")),t.res.style.transform="".concat(s).concat(o.join(" "))}null!=e.boxShadow&&(t.res.style.boxShadow=e.boxShadow)},this}},{key:"onScroll",value:function(e){var t=this,r=function(e){if(null==e)return{num:0,unit:"px"};var t=String(e).match(/^(-?[\d.]+)(.*)$/);return t?{num:parseFloat(t[1]),unit:t[2]||"px"}:{num:0,unit:"px"}},n=function(e){var r=e&&null!=e.tx?e.tx:"0px",n=e&&null!=e.ty?e.ty:"0px";t.res.style.transform="translate3d(".concat(r,", ").concat(n,", 0)")};"opacity"===e.value?this.res.style.opacity=e.valMin:"scale"===e.value?this.res.style.transform="scale(".concat(e.valMin,")"):"trn"===e.value&&n(e.valMin);var i=function(){if("trn"!==e.value){var i=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:e.valMin,max:e.valMax});"opacity"===e.value?t.res.style.opacity=i:"scale"===e.value&&(t.res.style.transform="scale(".concat(i,")"))}else{for(var s={},o=["tx","ty"],a=0;a<o.length;a++){var l=o[a],c=e.valMin&&null!=e.valMin[l],u=e.valMax&&null!=e.valMax[l];if(c||u){var h=r(c?e.valMin[l]:u?e.valMax[l]:"0px"),d=r(u?e.valMax[l]:c?e.valMin[l]:"0px"),f=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:h.num,max:d.num});s[l]="".concat(f).concat(h.unit)}}n(s)}};this._on(window,"scroll",i),0===e.from&&i()}},{key:"setAny",value:function(e){this[Object.keys(e)[0]]=[Object.values(e)[0]]}},{key:"setID",value:function(e){this.id=e}},{key:"setPrevText",value:function(e){this.prevText=e}},{key:"_setupResponsiveManager",value:function(){var e=this;this._responsiveTasks=this._responsiveTasks||[];var t=function(){e._responsiveTasks.forEach(function(e){e()})};this._responsiveHandler||(this._responsiveHandler=t,this._on(window,"resize",t)),setTimeout(function(){t()},0)}},{key:"resprop",value:function(e,r){var n=this;this.options=r;var i={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]},s=["resprop","breakpoint","value","values","range"],a={flexDir:"flexDirection",dir:"flexDirection",justify:"justifyContent",align:"alignItems",wrap:"flexWrap",bg:"background",radius:"borderRadius",z:"zIndex",exact:"fontSize"},l=function(e){var t=a[e]||e;return"undefined"==typeof console||"function"==typeof n[e]||t in n.res.style||console.warn('[nodality] resprop: "'.concat(e,'" is not a CSS property or component method — ignored.')+(a[e]?"":" Did you mean one of: ".concat(Object.keys(a).join(", "),"?"))),t};e.forEach(function(e){void 0!==i[e.breakpoint]?e.range=i[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[0,parseInt(e.breakpoint,10)]}),e.sort(function(e,t){return e.range[1]-t.range[1]});var c=e.find(function(e){return"default"===e.breakpoint});c||(c={breakpoint:"default",range:i.default},e.unshift(c));var u=new Set;e.forEach(function(e){Object.keys(e).forEach(function(e){s.includes(e)||"range"===e||u.add(e)})}),u.forEach(function(e){void 0===c[e]&&(c[e]=n.options[e]||"initial")}),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=t.viewportWidth(),i=c,a=0;a<e.length;a++){var h=e[a],d=o(h.range,2),f=d[0],p=d[1];if("default"!==h.breakpoint&&r>=f&&r<=p){i=h;break}}for(var y in u.forEach(function(e){if("keySet"===e){var t=c[e];t&&t.key&&(n.res.style[t.key]=t.value)}else n.res.style[l(e)]=c[e]}),i)if("exact"!==y){if(!s.includes(y)&&"range"!==y){var m=i[y];"keySet"===y&&m&&m.key?n.res.style[m.key]=m.value:"function"==typeof n[y]?n[y](m):n.res.style[l(y)]=m}}else n.res.style.fontSize=i[y]}),this._setupResponsiveManager()}},{key:"respad",value:function(e){var r=this,n={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]};e.forEach(function(e){void 0!==n[e.breakpoint]?e.range=n[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[parseInt(e.breakpoint,10),1e5]}),e.sort(function(e,t){return e.range[0]-t.range[0]});var i=e.find(function(e){return"default"===e.breakpoint});i||(i={breakpoint:"default",range:n.default},e.unshift(i)),void 0===i.values&&(i.values=this.options&&this.options.pad||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var n=t.viewportWidth(),s=i,a=0;a<e.length;a++){var l=e[a],c=o(l.range,2),u=c[0],h=c[1];if("default"!==l.breakpoint&&n>=u&&n<=h){s=l;break}}var d=void 0!==s.values?s.values:i.values;null!=d&&r.pad(d)}),this._setupResponsiveManager()}},{key:"resmar",value:function(e){var r=this,n={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]};e.forEach(function(e){void 0!==n[e.breakpoint]?e.range=n[e.breakpoint]:Array.isArray(e.breakpoint)&&2===e.breakpoint.length?e.range=[parseInt(e.breakpoint[0],10),parseInt(e.breakpoint[1],10)]:e.range=[parseInt(e.breakpoint,10),1e5]}),e.sort(function(e,t){return e.range[0]-t.range[0]});var i=e.find(function(e){return"default"===e.breakpoint});i||(i={breakpoint:"default",range:n.default},e.unshift(i)),void 0===i.values&&(i.values=this.options&&(this.options.mar||this.options.pad)||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var n=t.viewportWidth(),s=i,a=0;a<e.length;a++){var l=e[a],c=o(l.range,2),u=c[0],h=c[1];if("default"!==l.breakpoint&&n>=u&&n<=h){s=l;break}}var d=void 0!==s.values?s.values:i.values;null!=d&&r.mar(d)}),this._setupResponsiveManager()}},{key:"color",value:function(e){return this.res.style.color=e,this}},{key:"onTap",value:function(e){return this.res.addEventListener("click",e),this}},{key:"setArea",value:function(e){return this.res.style.gridArea=e,this}},{key:"font",value:function(e){return this.res.style.fontFamily=e,this}},{key:"radius",value:function(e){return this.res.style.borderRadius="number"==typeof e?"".concat(e,"px"):e,this}},{key:"width",value:function(e){return this.res.style.width=e,this}},{key:"scale",value:function(e){var t=this;return this.res.style.width,this.res.style.transition="0.5s all",this.res.addEventListener("mouseover",function(){t.res.style.width,t.res.style.transform="scale(1.04)"}),this.res.addEventListener("mouseout",function(){t.res.style.width,t.res.style.transform="scale(1.0)"}),this}},{key:"round",value:function(e){return this.deprecatedOption("round()","radius()"),this.radius(e)}},{key:"toCSS",value:function(){return this.css}},{key:"toHTMLA",value:function(){return this.html}},{key:"background",value:function(e){return this.res.style.background=e,this}},{key:"deprecatedOption",value:function(e,t){return console.error("nodality: `".concat(e,"` is deprecated — use `").concat(t,"` instead.")),this}},{key:"center",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.res.style,n=r.display||t.display||"",i=r.flexDirection||t.flexDirection||"",s=!0===e||"both"===e||"x"===e,o=!0===e||"both"===e||"y"===e;if(n.includes("grid"))return s&&(r.justifyItems="center",r.justifyContent="center"),o&&(r.alignItems="center",r.alignContent="center"),this;n.includes("flex")||(r.display="flex"),r.flexDirection||(r.flexDirection=i||"column");var a=(r.flexDirection||"column").startsWith("column");return(a?o:s)&&(r.justifyContent="center"),(a?s:o)&&(r.alignItems="center"),this}},{key:"isNumber",value:function(e){return"number"==typeof e&&!isNaN(e)}},{key:"pad",value:function(e){for(var t=0;t<e.length;t++)for(var r=Object.keys(e[t]),n=0;n<r.length;n++)for(var i=r[n],s=e[t][i],o=0;o<i.length;o++)switch(i[o]){case"a":this.res.style.padding=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.paddingTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.paddingLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.paddingRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.paddingBottom=this.isNumber(s)?"".concat(s,"px"):s}return this}},{key:"as",value:function(e){return this.res.style.alignSelf=e,this}},{key:"mar",value:function(e){if("center"===e)return this.res.style.marginLeft="auto",this.res.style.marginRight="auto",this;for(var t=0;t<e.length;t++)for(var r=Object.keys(e[t]),n=0;n<r.length;n++){for(var i=r[n],s=e[t][i],o=0;o<i.length;o++)switch(i[o]){case"a":"auto"===s?(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"):this.res.style.margin=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.marginTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.marginLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.marginRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.marginBottom=this.isNumber(s)?"".concat(s,"px"):s}"center"===i&&!0===s&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"),"auto"===s&&(i.includes("l")||i.includes("r"))&&(i.includes("l")&&(this.res.style.marginLeft="auto"),i.includes("r")&&(this.res.style.marginRight="auto"))}return this}},{key:"smartRange",value:function(e,t,r){e<t.min&&(e=t.min),e>t.max&&(e=t.max);var n=(e-t.min)/(t.max-t.min);return t.min>t.max&&(n=(e-t.max)/(t.min-t.max)),r.min+(r.max-r.min)*n}},{key:"gpos",value:function(e){return this.res.style.gridColumn=e.col,this.res.style.gridRow=e.row,this}},{key:"fluidCopy",value:function(e){if(e instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var t=document.createTextNode(this.text);return this.res.appendChild(t),this.res.style.fontSize=e.exact,this}if("S1"===e){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var r=document.createTextNode(this.text);this.res.appendChild(r),this.res.style.fontSize="calc(1.625rem + 5.075vw)"}if("S2"===e){this.prevStylex=this.res.style,this.res=document.createElement("h2"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===e){this.prevStylex=this.res.style,this.res=document.createElement("h3"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===e){this.prevStylex=this.res.style,this.res=document.createElement("h4"),this.res.style.cssText=this.prevStylex.cssText;var s=document.createTextNode(this.text);this.res.appendChild(s),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===e){this.prevStylex=this.res.style,this.res=document.createElement("h5"),this.res.style.cssText=this.prevStylex.cssText;var o=document.createTextNode(this.text);this.res.appendChild(o),this.res.style.fontSize="calc(1.125rem + 1.975vw)"}return"S6"===e&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setIndex",value:function(e){this.index=e}},{key:"borderObj",value:function(e){var t,r=null!==(t=e.type)&&void 0!==t?t:"solid";return this.res.style.border="".concat(e.width," ").concat(r," ").concat(e.color),void 0!==e.radius&&(this.res.style.borderRadius=e.radius),this}},{key:"setPref",value:function(e){this.preffersId=e}},{key:"setClass",value:function(e){this.class=e}},{key:"setTags",value:function(e){this.openTag=e.open,this.closeTag=e.close}},{key:"chainReact",value:function(e,r,n){var i=this;this.ap=!1,this.cta=0,this.once=!1;var s,l=a(e);try{for(l.s();!(s=l.n()).done;){var c=s.value;c.range||(c.range=["0px","999999px"])}}catch(e){l.e(e)}finally{l.f()}e.sort(function(e,t){return parseInt(e.range[0])-parseInt(t.range[0])});var u=function(s){var l=t.viewportWidth(),c=[],u=[];i.resCopy=i.res,i.storedQueries=e.map(function(e){return e.target}).filter(function(e){return null!=e});var h,d=a(e);try{for(d.s();!(h=d.n()).done;){var f=h.value;i.counterIndex++;var p=o(f.range,2),y=p[0],m=p[1],v=parseInt(y),b=parseInt(m),g=!0;if(f.target){g=!1;for(var k=0;k<f.target.length;k++)f.target[k]===r&&(g=!0)}l>=v&&l<=b&&g&&(c.push(f.log),u.push(f),f.op&&f.op.margin&&(i.useMargin=f.op.margin))}}catch(e){d.e(e)}finally{d.f()}if(n&&!n.includes("background")&&(i.res.style.background="",i.res.style.backgroundColor=""),i.res.style.textShadow="",n&&!n.includes("border")&&(i.res.style.border=""),n&&!n.includes("margin")&&(i.res.style.margin=""),i.res.style["-webkit-text-fill-color"]="",i.res.style["-webkit-text-stroke-color"]="",i.res.style["-webkit-text-stroke-width"]="",i.res.style.filter="",i.options.background&&(i.res.style.background=i.options.background),c.includes("gradient"),(c.includes("gradient")||c.includes("shadow"))&&(i.res.style.position="relative"),c.includes("blast")){var x,w=u.filter(function(e){return"blast"===e.log})[0].op.color,S=null!==(x=u.filter(function(e){return"blast"===e.log})[0].op.width)&&void 0!==x?x:"1px";"FlexRowLayoutElement"===i.getType()||"LayoutWrapperElement"===i.getType()?(i.res.style.border="".concat("number"==typeof S?S+"px":S," solid orange"),i.res.style.display="inline-block","FlexRowLayoutElement"===i.getType()&&(i.res.style.display="flex"),i.res.style.boxSizing="border-box",i.res.style.transformOrigin="center",i.blastTarget=i.res):(i.text,i.res.style["-webkit-text-fill-color"]="transparent",i.res.style["-webkit-text-stroke-color"]=w,i.res.style["-webkit-text-stroke-width"]="".concat(S))}if(c.includes("filter")){var T=u.filter(function(e){return"filter"===e.log})[0].op.filter;i.res.style.filter=T}if(c.includes("background")&&(i.res.style.backgroundColor="green"),c.includes("gradient")&&("LayoutWrapperElement"!==i.getType()&&"FlexRowLayoutElement"!==i.getType()&&(i.res.style["-webkit-text-fill-color"]="transparent"),i.res.style.background=i.globalGradient,"LayoutWrapperElement"!==i.getType()&&"FlexRowLayoutElement"!==i.getType()&&(i.res.style["background-clip"]="text")),c.includes("shadow")){var _,O,C,E,j=i.options.shadow.op,W=null!==(_=j.steps)&&void 0!==_?_:1,A=null!==(O=j.colors)&&void 0!==O?O:["gray"],I=null!==(C=j.movements)&&void 0!==C?C:["3px","3px"],R=null!==(E=j.radius)&&void 0!==E?E:"3px";if(1===I.length&&(I=[I[0],I[0]]),"FlexRowLayoutElement"===i.getType()||"LayoutWrapperElement"===i.getType()){for(var z=[],L=0;L<W;L++){var M,P=null!==(M=A[L])&&void 0!==M?M:A[0],B=I[0],H=I[1];z.push("".concat(B," ").concat(H," ").concat(R," ").concat(P))}i.res.style.boxShadow=z.join(", ")}else{for(var N=[],D=0;D<W;D++){var F,U=null!==(F=A[D])&&void 0!==F?F:A[0],Y=I[0],G=I[1];N.push("drop-shadow(".concat(Y," ").concat(G," ").concat(R," ").concat(U,")"))}i.res.style.filter=N.join(" ")}}if(c.includes("margin"))for(k=0;k<e.length;k++)if(e[k].op){var X=e[k].op.offsets;X&&void 0!==i.index&&(i.res.style.margin=X[Number(i.index)]+"px")}if(c.includes("spana")||c.includes("span")){var $=document.createElement("div");if($.setAttribute("id","oroa"),Object.assign($.style,{position:"absolute",inset:"0",background:"linear-gradient(90deg, rgb(52,152,219), rgb(26,188,156))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",pointerEvents:"none"}),i.res&&i.res.querySelector("span"))return;i.res=i.resCopy,i.res.textContent="",i.options.span&&(Array.isArray(i.options.span)?i.options.span:[i.options.span]).forEach(function(e){if(e.op&&"span"===e.op.name&&Array.isArray(e.op.parts)){var t=0,r=i.prevText||"";if(e.op.parts.forEach(function(e){var n=e.text,s=e.style||{};if(t<r.length){var o=r.indexOf(n,t);if(o>t){var a=r.substring(t,o);i.res.appendChild(new i.constructor(a).setup({type:"span",id:s.id,animation:s.animation}).set({}).render())}t=o+n.length}var l=new i.constructor(n).setup({type:"span",id:s.id,animation:s.animation}).set(s).render();i.res.appendChild(l)}),t<r.length){var n=r.substring(t);i.res.appendChild(new i.constructor(n).setup({type:"span"}).set({}).render())}}})}else{var Z=new i.constructor(i.prevText).set({}).render();i.prevText&&i.prevText.length>0&&s&&i.res.appendChild(Z)}if(c.includes("animation")){if(i.options.animation&&!i.hasAnimated&&!i.options.animation.op.fireAt){i.hasAnimated=!0;var q=i.options.animation.op;i._on(window,"sidebar:open",function(){i.res.animate(q.keyframesOpen,q.openOptions)}),i._on(window,"sidebar:closed",function(){i.res.animate(q.keyframesClose,q.closeOptions)}),i.res.animate(q.keyframesClose,{duration:0,fill:"forwards"}),i.openTag&&i.closeTag&&(i._on(window,i.openTag,function(){i.res.animate(q.keyframesOpen,q.openOptions)}),i._on(window,i.closeTag,function(){i.res.animate(q.keyframesClose,q.closeOptions)}))}if(i.options.animation&&i.options.animation.op.fireAt&&i.options.animation.op.fireAt.endsWith("px")){var Q=i.options.animation.op;i.res.animate(Q.keyframesClose,{duration:0,fill:"forwards"});var V=function(){window.scrollY>parseFloat(Q.fireAt)&&(i.res.animate(Q.keyframesOpen,Q.openOptions),window.removeEventListener("scroll",V))};i._on(window,"scroll",V)}if(i.options.animation&&"inview"===i.options.animation.op.fireAt){var J=i.options.animation.op;i.res.animate(J.keyframesClose,{duration:0,fill:"forwards"});var K=!1,ee=new IntersectionObserver(function(e,t){e.forEach(function(e){e.isIntersecting&&!K&&(K=!0,i.res.animate(J.keyframesOpen,J.openOptions),t.disconnect())})});ee.observe(i.res),i._track(function(){return ee.disconnect()})}}};this.options.animation||this._on(window,"resize",function(){return u()}),u()}},{key:"maxWidth",value:function(e){return this.res.style.maxWidth=e,this}},{key:"removeQuotesFromFirstWord",value:function(e){return e.replace(new RegExp('"([A-Za-z_$][A-Za-z0-9_$]*)"\\s*:',"g"),"$1:")}}],i=[{key:"viewportWidth",value:function(){if("undefined"==typeof window)return 0;var e=window.visualViewport;return e&&"number"==typeof e.width?e.width:window.innerWidth}}],n&&h(r.prototype,n),i&&h(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,i}();function p(e){return p="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},p(e)}function y(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 m(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}var k=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){return t=b(t),function(e,t){if(t&&("object"==p(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)}(e,v()?Reflect.construct(t,r||[],b(e).constructor):t.apply(e,r))}(this,e)}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&&g(e,t)}(e,f),t=e,(r=[{key:"set",value:function(e){return this.imageUrl=e.url,this.createCard(),e.useBrightness&&(this.useBrightness=!0),e.useBrightness&&"\n useBrightness: ".concat(this.useBrightness),e.pad&&this.pad(e.pad),e.mar&&this.mar(e.mar),e.inpad&&this.inpad(e.inpad),e.inpad&&"\n inpad: {".concat(e.inpad,"}"),e.font&&(this.res.style.fontFamily=e.font),e.inpad&&"\n font: ".concat(e.font),this.addListeners(),this}},{key:"inpad",value:function(e){return this.res.children[1].style.boxSizing="border-box",this.res.children[1].style.padding=e,this}},{key:"items",value:function(e){for(var t=0;t<e.length;t++)this.res.children[1].appendChild(e[t].render());return this}},{key:"createCard",value:function(){var e=document.createElement("div");e.style.display="grid",e.style.width="300px",e.style.height="400px",e.setAttribute("id","AAA");var t=document.createElement("div");t.style.gridArea="1/1",t.style.height="400px",t.style.borderRadius="15px",t.style.boxShadow="0 4px 8px 0 rgba(0,0,0,0.2)",t.style.overflow="hidden";var r=document.createElement("div");r.style.width="100%",r.style.height="100%",r.style.transition="0.9s",r.style.backgroundImage="url(".concat(this.imageUrl,")"),r.style.backgroundSize="cover",r.style.backgroundPostion="cover",r.style.backgroundRepeat="no-repeat",t.appendChild(r);var n=document.createElement("div");return n.style.gridArea="1/1",n.style.zIndex="1",e.appendChild(t),e.appendChild(n),this.res=e,this}},{key:"addListeners",value:function(){var e=this,t=this.res.children[0].children[0];return this.res.onmouseover=function(){t.style.transform="scale(1.3)",e.useBrightness&&(t.style.filter="brightness(31%)")},this.res.onmouseout=function(){t.style.transform="scale(1.0)",e.useBrightness&&(t.style.filter="brightness(100%)")},this}},{key:"render",value:function(e){if(!e)return this.res;this.options.id&&this.res.setAttribute("id",this.options.id),document.querySelector(e).appendChild(this.res)}}])&&y(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();export{k as ZoomCard};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.0.220
2
+ * nodality v1.0.224
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
@@ -0,0 +1,174 @@
1
+ /*!
2
+ * custom-raster-op.js — a raster op written from outside the library.
3
+ *
4
+ * The claim this file exists to make good on: an op you write is not a
5
+ * second-class citizen. It is the same shape as `halftone`, it is masked
6
+ * by the same `masked:` key, it is steered by the same drivers, it is
7
+ * listed by the same inspector, and it composes with first-party ops in
8
+ * either order. Nothing here reaches into the library's internals — the
9
+ * whole surface is `registerRasterOp` plus the contract below.
10
+ *
11
+ * import "nodality/examples/custom-raster-op";
12
+ *
13
+ * `nodality`, `nodality/raster` and `nodality/inspect` share one op
14
+ * registry — the ESM builds import lib/raster-ops.js rather than bundling
15
+ * a second copy of its module state. See RASTER-OPS-AUTHORING.md; the CJS
16
+ * and UMD builds are deliberate exceptions.
17
+ *
18
+ * let nodes = [
19
+ * { op: "pixelate", size: 14, target: ["#hero"] },
20
+ * // ...and because it declared stage "warp", it masks for free:
21
+ * { op: "mask", as: "spot", from: "radial", by: "mouse", radius: 260 },
22
+ * { op: "pixelate", size: 22, masked: "spot", target: ["#hero"] },
23
+ * ];
24
+ *
25
+ * ── The contract ─────────────────────────────────────────────────────
26
+ *
27
+ * `stage` which of the frame's five slots your GLSL is spliced into.
28
+ * This is the only field whose value you cannot get wrong
29
+ * quietly — registerRasterOp checks it against the vocabulary.
30
+ * `decl(p)` uniform declarations. EVERY name must be prefixed with `p`.
31
+ * `code(p)` the body. Read and write the stage's variables (below).
32
+ * `uniforms(node, dpr)` what to upload, as `{ name: [setter, value] }`.
33
+ * Runs every frame, so it allocates nothing it does not have to.
34
+ * `doc` summary + params. Optional — but without it the inspector has
35
+ * to guess your param list from your uniform names, which is
36
+ * wrong for any op whose two differ.
37
+ *
38
+ * `p` is a per-node prefix like `u3_`. It exists because the same op may
39
+ * appear twice in one chain, and two copies of `uniform float size` in
40
+ * one shader is a compile error. Prefix everything; never hardcode a
41
+ * uniform name.
42
+ *
43
+ * Stage variables, and what each stage may touch:
44
+ *
45
+ * field — write a scalar for later ops to read. Draws nothing.
46
+ * warp — `warped`: the coordinate space itself, in device px
47
+ * cell — `center`, `edge`: the sampling cell and its border
48
+ * displace — `sampleP`, `chroma`: where the texture is fetched
49
+ * color — `col`, `edgeCol`, `edgeCov`, `ovCol`, `ovA`
50
+ *
51
+ * Masking is applied by the pipeline, not by you: it snapshots the
52
+ * stage's variables before your code runs and lerps back toward that
53
+ * snapshot afterwards. So an op that stays inside its stage's variables
54
+ * is maskable the moment it is written, and an op that writes outside
55
+ * them silently escapes masking. That is the whole reason the stages are
56
+ * a closed list.
57
+ *
58
+ * Two rules that are about GPUs rather than about this library:
59
+ * - No per-frame allocation in `code()`. It runs once per rebuild, but
60
+ * `uniforms()` runs every frame — build arrays outside it.
61
+ * - Hash with polynomials, not `sin(dot(...)) * 43758.5453`. The sin
62
+ * trick banded badly on Apple silicon; see `noise` for the pattern.
63
+ */
64
+
65
+ import { registerRasterOp } from "../lib/raster-ops.js";
66
+
67
+ /**
68
+ * pixelate — quantise the coordinate space to a grid.
69
+ *
70
+ * Warp stage rather than displace, and that choice is the interesting
71
+ * part. Displace would move only the texture lookup, so a `hexalize`
72
+ * later in the chain would still compute its lattice from smooth
73
+ * coordinates and the two grids would disagree. Warping the space itself
74
+ * means every downstream op — cell, displace, colour — sees the blocky
75
+ * coordinates too, so `pixelate` composes with the built-ins instead of
76
+ * merely running near them.
77
+ *
78
+ * Snapping to the CENTRE of each block (the `+ 0.5`) rather than its
79
+ * corner keeps the image from creeping half a block up-left as `size`
80
+ * grows.
81
+ */
82
+ registerRasterOp("pixelate", {
83
+ stage: "warp",
84
+
85
+ // Whether a driver steers this op changes the GLSL, not just a value:
86
+ // with `by` the block size falls off around the focus, without it the
87
+ // whole element is quantised. Declaring `by` structural is what tells
88
+ // the pipeline to rebuild the shader when it changes, and the
89
+ // inspector to mark the control "↻" before you touch it.
90
+ structural: ["by"],
91
+
92
+ // Without this, `dpos`/`damt` are declared but never uploaded, because
93
+ // the pipeline only evaluates a driver for nodes that name one. They
94
+ // would read 0 and the op would do nothing. "static" means the focus
95
+ // is the element centre at full amount.
96
+ defaultDriver: "static",
97
+
98
+ doc: {
99
+ summary: "Quantises the coordinate space to a square grid, so the " +
100
+ "element renders as blocks. Warp stage, so everything downstream " +
101
+ "— cell grids, colour ops — sees the blocky coordinates too.",
102
+ params: {
103
+ size: { default: 12, unit: "px", summary: "block size" },
104
+ amount: {
105
+ default: 1, unit: "ratio",
106
+ summary: "blend between the smooth and quantised coordinates; " +
107
+ "0 is a no-op, so it is safe to animate to nothing",
108
+ },
109
+ radius: {
110
+ default: 240, unit: "px",
111
+ summary: "falloff around the driver focus. Only used when `by` " +
112
+ "names a driver; without one the whole element is quantised.",
113
+ },
114
+ },
115
+ },
116
+
117
+ decl: (p) => `
118
+ uniform float ${p}size;
119
+ uniform float ${p}amount;
120
+ uniform float ${p}radius;
121
+ uniform vec2 ${p}dpos;
122
+ uniform float ${p}damt;`,
123
+
124
+ // `warped` is in device pixels, which is why `size` is scaled by dpr
125
+ // in uniforms() rather than here: the shader should not have to know
126
+ // what a CSS pixel is.
127
+ //
128
+ // The `node.by` branch is resolved at COMPILE time, so a chain that
129
+ // never names a driver compiles to exactly the shader it would have
130
+ // without any driver support at all — no dead distance computation
131
+ // per fragment. That is the same trade `halftone` and `duotone` make.
132
+ code: (p, node) => `
133
+ {
134
+ vec2 blocky = (floor(warped / ${p}size) + 0.5) * ${p}size;
135
+ ${node.by
136
+ ? `float fall = (1.0 - smoothstep(0.0, ${p}radius,
137
+ length(warped - ${p}dpos))) * ${p}damt;`
138
+ : `float fall = 1.0;`}
139
+ warped = mix(warped, blocky, ${p}amount * fall);
140
+ }`,
141
+
142
+ // Phase I2: the CPU twin of code(), so a hit-test over this effect
143
+ // costs no GPU readback. Optional — an op without one still works,
144
+ // its queries just take the slower exact path. Declaring one is a
145
+ // promise the library CHECKS: the twin is compared against the GPU
146
+ // oracle across the parameter space, so drift is caught rather than
147
+ // believed.
148
+ map: (pt, node, ctx) => {
149
+ const size = Math.max(1, node.size != null ? node.size : 12) * ctx.dpr;
150
+ const amount = node.amount != null ? node.amount : 1;
151
+ let fall = 1;
152
+ if (node.by) {
153
+ const radius = (node.radius != null ? node.radius : 240) * ctx.dpr;
154
+ const d = Math.hypot(pt[0] - ctx.dpos[0], pt[1] - ctx.dpos[1]);
155
+ const t = Math.min(1, Math.max(0, d / (radius || 1e-6)));
156
+ fall = (1 - t * t * (3 - 2 * t)) * ctx.damt;
157
+ }
158
+ const k = amount * fall;
159
+ const bx = (Math.floor(pt[0] / size) + 0.5) * size;
160
+ const by = (Math.floor(pt[1] / size) + 0.5) * size;
161
+ return [pt[0] + (bx - pt[0]) * k, pt[1] + (by - pt[1]) * k];
162
+ },
163
+
164
+ uniforms: (node, dpr) => ({
165
+ // max() rather than a bare default: a size of 0 is a divide-by-zero
166
+ // in the shader, and the resulting NaN propagates to every op after
167
+ // this one — a whole-element black rectangle with no error anywhere.
168
+ size: ["1f", Math.max(1, node.size != null ? node.size : 12) * dpr],
169
+ amount: ["1f", node.amount != null ? node.amount : 1],
170
+ radius: ["1f", (node.radius != null ? node.radius : 240) * dpr],
171
+ }),
172
+ });
173
+
174
+ export {};