nodality 1.3.1 → 1.3.3

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 (285) hide show
  1. package/dist/animator.cjs.js +1 -1
  2. package/dist/animator.cjs.js.LICENSE.txt +1 -1
  3. package/dist/animator.esm.js +1 -1
  4. package/dist/animator.esm.js.LICENSE.txt +1 -1
  5. package/dist/audionew.cjs.js +1 -1
  6. package/dist/audionew.cjs.js.LICENSE.txt +1 -1
  7. package/dist/audionew.esm.js +1 -1
  8. package/dist/audionew.esm.js.LICENSE.txt +1 -1
  9. package/dist/base.cjs.js +1 -1
  10. package/dist/base.cjs.js.LICENSE.txt +1 -1
  11. package/dist/base.esm.js +1 -1
  12. package/dist/base.esm.js.LICENSE.txt +1 -1
  13. package/dist/beta-desktop-bar.cjs.js +1 -1
  14. package/dist/beta-desktop-bar.cjs.js.LICENSE.txt +1 -1
  15. package/dist/beta-desktop-bar.esm.js +1 -1
  16. package/dist/beta-desktop-bar.esm.js.LICENSE.txt +1 -1
  17. package/dist/beta-mobile-bar.cjs.js +1 -1
  18. package/dist/beta-mobile-bar.cjs.js.LICENSE.txt +1 -1
  19. package/dist/beta-mobile-bar.esm.js +1 -1
  20. package/dist/beta-mobile-bar.esm.js.LICENSE.txt +1 -1
  21. package/dist/bundle.umd.js +1 -1
  22. package/dist/bundle.umd.js.LICENSE.txt +1 -1
  23. package/dist/button.cjs.js +1 -1
  24. package/dist/button.cjs.js.LICENSE.txt +1 -1
  25. package/dist/button.esm.js +1 -1
  26. package/dist/button.esm.js.LICENSE.txt +1 -1
  27. package/dist/card-getter.cjs.js.LICENSE.txt +1 -1
  28. package/dist/card-getter.esm.js.LICENSE.txt +1 -1
  29. package/dist/center.cjs.js +1 -1
  30. package/dist/center.cjs.js.LICENSE.txt +1 -1
  31. package/dist/center.esm.js +1 -1
  32. package/dist/center.esm.js.LICENSE.txt +1 -1
  33. package/dist/checkbox.cjs.js +1 -1
  34. package/dist/checkbox.cjs.js.LICENSE.txt +1 -1
  35. package/dist/checkbox.esm.js +1 -1
  36. package/dist/checkbox.esm.js.LICENSE.txt +1 -1
  37. package/dist/code.cjs.js +1 -1
  38. package/dist/code.cjs.js.LICENSE.txt +1 -1
  39. package/dist/code.esm.js +1 -1
  40. package/dist/code.esm.js.LICENSE.txt +1 -1
  41. package/dist/container.cjs.js +1 -1
  42. package/dist/container.cjs.js.LICENSE.txt +1 -1
  43. package/dist/container.esm.js +1 -1
  44. package/dist/container.esm.js.LICENSE.txt +1 -1
  45. package/dist/data-list.cjs.js +1 -1
  46. package/dist/data-list.cjs.js.LICENSE.txt +1 -1
  47. package/dist/data-list.esm.js +1 -1
  48. package/dist/data-list.esm.js.LICENSE.txt +1 -1
  49. package/dist/designer.cjs.js +1 -1
  50. package/dist/designer.cjs.js.LICENSE.txt +1 -1
  51. package/dist/designer.esm.js +1 -1
  52. package/dist/designer.esm.js.LICENSE.txt +1 -1
  53. package/dist/element-mapper.cjs.js +1 -1
  54. package/dist/element-mapper.cjs.js.LICENSE.txt +1 -1
  55. package/dist/element-mapper.esm.js +1 -1
  56. package/dist/element-mapper.esm.js.LICENSE.txt +1 -1
  57. package/dist/finalresult.esm.js +1 -1
  58. package/dist/finalresult.esm.js.LICENSE.txt +1 -1
  59. package/dist/flex-card.cjs.js +1 -1
  60. package/dist/flex-card.cjs.js.LICENSE.txt +1 -1
  61. package/dist/flex-card.esm.js +1 -1
  62. package/dist/flex-card.esm.js.LICENSE.txt +1 -1
  63. package/dist/flex-grid.cjs.js +1 -1
  64. package/dist/flex-grid.cjs.js.LICENSE.txt +1 -1
  65. package/dist/flex-grid.esm.js +1 -1
  66. package/dist/flex-grid.esm.js.LICENSE.txt +1 -1
  67. package/dist/flex-row.cjs.js +1 -1
  68. package/dist/flex-row.cjs.js.LICENSE.txt +1 -1
  69. package/dist/flex-row.esm.js +1 -1
  70. package/dist/flex-row.esm.js.LICENSE.txt +1 -1
  71. package/dist/floating-input.cjs.js +1 -1
  72. package/dist/floating-input.cjs.js.LICENSE.txt +1 -1
  73. package/dist/floating-input.esm.js +1 -1
  74. package/dist/floating-input.esm.js.LICENSE.txt +1 -1
  75. package/dist/free.cjs.js +1 -1
  76. package/dist/free.cjs.js.LICENSE.txt +1 -1
  77. package/dist/free.esm.js +1 -1
  78. package/dist/free.esm.js.LICENSE.txt +1 -1
  79. package/dist/horizontal-scroller.cjs.js.LICENSE.txt +1 -1
  80. package/dist/horizontal-scroller.esm.js.LICENSE.txt +1 -1
  81. package/dist/image-picker.cjs.js +1 -1
  82. package/dist/image-picker.cjs.js.LICENSE.txt +1 -1
  83. package/dist/image-picker.esm.js +1 -1
  84. package/dist/image-picker.esm.js.LICENSE.txt +1 -1
  85. package/dist/image.cjs.js +1 -1
  86. package/dist/image.cjs.js.LICENSE.txt +1 -1
  87. package/dist/image.esm.js +1 -1
  88. package/dist/image.esm.js.LICENSE.txt +1 -1
  89. package/dist/index.cjs.js +1 -1
  90. package/dist/index.cjs.js.LICENSE.txt +1 -1
  91. package/dist/index.d.ts +1 -1
  92. package/dist/index.esm.js +1 -1
  93. package/dist/index.esm.js.LICENSE.txt +1 -1
  94. package/dist/keyframe-animation.cjs.js.LICENSE.txt +1 -1
  95. package/dist/keyframe-animation.esm.js.LICENSE.txt +1 -1
  96. package/dist/link-getter.cjs.js +1 -1
  97. package/dist/link-getter.cjs.js.LICENSE.txt +1 -1
  98. package/dist/link-getter.esm.js +1 -1
  99. package/dist/link-getter.esm.js.LICENSE.txt +1 -1
  100. package/dist/link.cjs.js +1 -1
  101. package/dist/link.cjs.js.LICENSE.txt +1 -1
  102. package/dist/link.esm.js +1 -1
  103. package/dist/link.esm.js.LICENSE.txt +1 -1
  104. package/dist/meta-adder.cjs.js +1 -1
  105. package/dist/meta-adder.cjs.js.LICENSE.txt +1 -1
  106. package/dist/meta-adder.esm.js +1 -1
  107. package/dist/meta-adder.esm.js.LICENSE.txt +1 -1
  108. package/dist/modal-2025.cjs.js +1 -1
  109. package/dist/modal-2025.cjs.js.LICENSE.txt +1 -1
  110. package/dist/modal-2025.esm.js +1 -1
  111. package/dist/modal-2025.esm.js.LICENSE.txt +1 -1
  112. package/dist/multiswitcher.cjs.js +1 -1
  113. package/dist/multiswitcher.cjs.js.LICENSE.txt +1 -1
  114. package/dist/multiswitcher.esm.js +1 -1
  115. package/dist/multiswitcher.esm.js.LICENSE.txt +1 -1
  116. package/dist/new-nav-bar.cjs.js +1 -1
  117. package/dist/new-nav-bar.cjs.js.LICENSE.txt +1 -1
  118. package/dist/new-nav-bar.esm.js +1 -1
  119. package/dist/new-nav-bar.esm.js.LICENSE.txt +1 -1
  120. package/dist/picker.cjs.js +1 -1
  121. package/dist/picker.cjs.js.LICENSE.txt +1 -1
  122. package/dist/picker.esm.js +1 -1
  123. package/dist/picker.esm.js.LICENSE.txt +1 -1
  124. package/dist/progress.cjs.js +1 -1
  125. package/dist/progress.cjs.js.LICENSE.txt +1 -1
  126. package/dist/progress.esm.js +1 -1
  127. package/dist/progress.esm.js.LICENSE.txt +1 -1
  128. package/dist/radio.cjs.js +1 -1
  129. package/dist/radio.cjs.js.LICENSE.txt +1 -1
  130. package/dist/radio.esm.js +1 -1
  131. package/dist/radio.esm.js.LICENSE.txt +1 -1
  132. package/dist/range.cjs.js +1 -1
  133. package/dist/range.cjs.js.LICENSE.txt +1 -1
  134. package/dist/range.esm.js +1 -1
  135. package/dist/range.esm.js.LICENSE.txt +1 -1
  136. package/dist/scroll-video.cjs.js.LICENSE.txt +1 -1
  137. package/dist/scroll-video.esm.js.LICENSE.txt +1 -1
  138. package/dist/side-bar.cjs.js +1 -1
  139. package/dist/side-bar.cjs.js.LICENSE.txt +1 -1
  140. package/dist/side-bar.esm.js +1 -1
  141. package/dist/side-bar.esm.js.LICENSE.txt +1 -1
  142. package/dist/side-nav-bar.cjs.js +1 -1
  143. package/dist/side-nav-bar.cjs.js.LICENSE.txt +1 -1
  144. package/dist/side-nav-bar.esm.js +1 -1
  145. package/dist/side-nav-bar.esm.js.LICENSE.txt +1 -1
  146. package/dist/simple-bar.cjs.js +1 -1
  147. package/dist/simple-bar.cjs.js.LICENSE.txt +1 -1
  148. package/dist/simple-bar.esm.js +1 -1
  149. package/dist/simple-bar.esm.js.LICENSE.txt +1 -1
  150. package/dist/slider-2025.cjs.js +1 -1
  151. package/dist/slider-2025.cjs.js.LICENSE.txt +1 -1
  152. package/dist/slider-2025.esm.js +1 -1
  153. package/dist/slider-2025.esm.js.LICENSE.txt +1 -1
  154. package/dist/spacer.cjs.js +1 -1
  155. package/dist/spacer.cjs.js.LICENSE.txt +1 -1
  156. package/dist/spacer.esm.js +1 -1
  157. package/dist/spacer.esm.js.LICENSE.txt +1 -1
  158. package/dist/stack.cjs.js +1 -1
  159. package/dist/stack.cjs.js.LICENSE.txt +1 -1
  160. package/dist/stack.esm.js +1 -1
  161. package/dist/stack.esm.js.LICENSE.txt +1 -1
  162. package/dist/stacker.cjs.js.LICENSE.txt +1 -1
  163. package/dist/stacker.esm.js.LICENSE.txt +1 -1
  164. package/dist/table.cjs.js +1 -1
  165. package/dist/table.cjs.js.LICENSE.txt +1 -1
  166. package/dist/table.esm.js +1 -1
  167. package/dist/table.esm.js.LICENSE.txt +1 -1
  168. package/dist/text-field.cjs.js +1 -1
  169. package/dist/text-field.cjs.js.LICENSE.txt +1 -1
  170. package/dist/text-field.esm.js +1 -1
  171. package/dist/text-field.esm.js.LICENSE.txt +1 -1
  172. package/dist/text.cjs.js +1 -1
  173. package/dist/text.cjs.js.LICENSE.txt +1 -1
  174. package/dist/text.esm.js +1 -1
  175. package/dist/text.esm.js.LICENSE.txt +1 -1
  176. package/dist/theme.cjs.js.LICENSE.txt +1 -1
  177. package/dist/theme.esm.js.LICENSE.txt +1 -1
  178. package/dist/transform-anim.cjs.js.LICENSE.txt +1 -1
  179. package/dist/transform-anim.esm.js.LICENSE.txt +1 -1
  180. package/dist/ulist.cjs.js +1 -1
  181. package/dist/ulist.cjs.js.LICENSE.txt +1 -1
  182. package/dist/ulist.esm.js +1 -1
  183. package/dist/ulist.esm.js.LICENSE.txt +1 -1
  184. package/dist/video.cjs.js +1 -1
  185. package/dist/video.cjs.js.LICENSE.txt +1 -1
  186. package/dist/video.esm.js +1 -1
  187. package/dist/video.esm.js.LICENSE.txt +1 -1
  188. package/dist/wrap.cjs.js +1 -1
  189. package/dist/wrap.cjs.js.LICENSE.txt +1 -1
  190. package/dist/wrap.esm.js +1 -1
  191. package/dist/wrap.esm.js.LICENSE.txt +1 -1
  192. package/dist/zoom-card.cjs.js +1 -1
  193. package/dist/zoom-card.cjs.js.LICENSE.txt +1 -1
  194. package/dist/zoom-card.esm.js +1 -1
  195. package/dist/zoom-card.esm.js.LICENSE.txt +1 -1
  196. package/layout/animator.js +30 -2
  197. package/layout/audio.js +1 -1
  198. package/layout/audionew.js +1 -1
  199. package/layout/base.js +1 -1
  200. package/layout/beta-desktop-bar.js +1 -1
  201. package/layout/beta-mobile-bar.js +1 -1
  202. package/layout/button.js +1 -1
  203. package/layout/center.js +1 -1
  204. package/layout/checkbox.js +1 -1
  205. package/layout/circle.js +1 -1
  206. package/layout/code.js +1 -1
  207. package/layout/container.js +1 -1
  208. package/layout/dropdown-2025.js +1 -1
  209. package/layout/flex-card.js +1 -1
  210. package/layout/flex-grid.js +1 -1
  211. package/layout/flex-row.js +1 -1
  212. package/layout/form-components/custom.js +1 -1
  213. package/layout/form-components/data-list.js +1 -1
  214. package/layout/form-components/floating-input.js +1 -1
  215. package/layout/form-components/form-all.js +1 -1
  216. package/layout/form-components/form.js +1 -1
  217. package/layout/form-components/image-picker.js +1 -1
  218. package/layout/form-components/picker.js +77 -7
  219. package/layout/form-components/radio.js +1 -1
  220. package/layout/form-components/radiogroup.js +1 -1
  221. package/layout/form-components/range.js +1 -1
  222. package/layout/free.js +1 -1
  223. package/layout/grid-switcher.js +1 -1
  224. package/layout/grid.js +1 -1
  225. package/layout/horizontal-scroller.js +1 -1
  226. package/layout/image.js +1 -1
  227. package/layout/index.js +1 -1
  228. package/layout/link.js +1 -1
  229. package/layout/list.js +1 -1
  230. package/layout/meta-adder.js +1 -1
  231. package/layout/modal-2025.js +1 -1
  232. package/layout/morph.js +1 -1
  233. package/layout/multiswitcher.js +1 -1
  234. package/layout/nav-bar.js +1 -1
  235. package/layout/nav-factor/custom-div.js +1 -1
  236. package/layout/new-nav-bar.js +1 -1
  237. package/layout/polygon.js +1 -1
  238. package/layout/prerender-site.js +1 -1
  239. package/layout/prerender.js +1 -1
  240. package/layout/progress.js +1 -1
  241. package/layout/row.js +1 -1
  242. package/layout/scroll-video.js +1 -1
  243. package/layout/side-bar.js +1 -1
  244. package/layout/side-nav-bar.js +1 -1
  245. package/layout/simple-bar.js +1 -1
  246. package/layout/slider-2025.js +1 -1
  247. package/layout/spacer.js +1 -1
  248. package/layout/stack.js +1 -1
  249. package/layout/svg.js +1 -1
  250. package/layout/switcher.js +1 -1
  251. package/layout/table.js +1 -1
  252. package/layout/text-field.js +1 -1
  253. package/layout/text.js +1 -1
  254. package/layout/ulist.js +1 -1
  255. package/layout/video.js +1 -1
  256. package/layout/wrap.js +1 -1
  257. package/layout/zoom-card.js +1 -1
  258. package/lib/agent-surface.js +1 -1
  259. package/lib/card-getter.js +1 -1
  260. package/lib/check-page.js +45 -5
  261. package/lib/codegen.js +1 -1
  262. package/lib/data.js +1 -1
  263. package/lib/designer.js +8 -2
  264. package/lib/element-mapper.js +6 -2
  265. package/lib/element-params.generated.js +1 -1
  266. package/lib/keyframe-animation.js +1 -1
  267. package/lib/link-getter.js +1 -1
  268. package/lib/morph-node.js +1 -1
  269. package/lib/normalize-spec.js +1 -1
  270. package/lib/parse-html.js +1 -1
  271. package/lib/raster-inspect.js +1 -1
  272. package/lib/raster-ops.js +1 -1
  273. package/lib/raster-presets.js +1 -1
  274. package/lib/resolve-refs.js +1 -1
  275. package/lib/scroll-video.js +1 -1
  276. package/lib/seo.js +1 -1
  277. package/lib/stacker.js +1 -1
  278. package/lib/suggest.js +1 -1
  279. package/lib/theme.js +1 -1
  280. package/lib/transform-anim.js +1 -1
  281. package/lib/transition.js +1 -1
  282. package/lib/validate-nodes.js +1 -1
  283. package/lib/webmcp-adapter.js +71 -6
  284. package/package.json +1 -1
  285. package/schema.json +68 -32
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see animator.cjs.js.LICENSE.txt */
2
- (()=>{"use strict";var 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]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}e.r(t),e.d(t,{Animator:()=>$});var r="nodality.theme.mode",a="nodality:theme",o={mode:function(){try{var e=localStorage.getItem(r);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"===n(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"===n(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(r,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(a,t);try{e(this.mode,this.current)}catch(e){}return function(){return document.removeEventListener(a,t)}},_broadcast:function(){"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent(a,{detail:{mode:this.mode,tokens:this.current}}))}};function i(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,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,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function l(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,a,o,i,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||u(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 u(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}function f(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 d={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}}},h=Object.keys(d),m={hexalize:{doc:{summary:"Hexagonal cell grid. Snaps sampling to a hex lattice and draws cell borders; with `lift`, cells near the driver swell toward the viewer and their content magnifies to match.",params:{size:{default:24,unit:"px",summary:"lattice pitch — the width of one cell"},lift:{default:0,unit:"ratio",structural:!0,summary:"how much bigger a cell gets at the focus: 0.3 renders the nearest hexagons at 1.3x. 0 compiles the cheap path entirely away, so crossing zero rebuilds."},radius:{default:200,unit:"px",summary:"falloff distance around the driver focus"}}},structuralOnToggle:["lift"],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,a=l(t,2);return n=a[0],r=a[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]}},map:function(e,t){return t.lift?null:e}},offset:{doc:{summary:"Pushes the coordinate space away from the driver focus. Warp stage, so cell grids and borders move WITH the content instead of staying a fixed screen-space lattice.",params:{strength:{default:20,unit:"px",summary:"how far the space is pushed at full amount"},radius:{default:260,unit:"px",summary:"falloff distance around the focus"}}},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]}},map:function(e,t,n){var r,a,o,i=(t.strength||20)*n.dpr,s=(t.radius||260)*n.dpr,c=e[0]-n.dpos[0],l=e[1]-n.dpos[1],u=Math.hypot(c,l),f=1-(r=s,a=u,(o=Math.min(1,Math.max(0,(a-0)/(r-0||1e-6))))*o*(3-2*o));if(!(u>.5))return e;var d=i*f*n.damt/u;return[e[0]-c*d,e[1]-l*d]}},flow:{doc:{summary:"Curl-noise current. The coordinate space drifts along a divergence-free field, so content slides as if carried by water. Divergence-free means the flow never piles up or tears.",params:{strength:{default:18,unit:"px",summary:"how far the current carries the space"},scale:{default:120,unit:"px",summary:"size of one eddy — small is turbulent, large is a slow drift"},speed:{default:.25,unit:"seconds",summary:"how fast the field evolves; 0 freezes it"},seed:{default:0,unit:"count",summary:"picks a different field of the same character"},radius:{default:320,unit:"px",summary:"falloff around the focus. Only used when `by` names a driver; without one the current covers the whole element."}}},structural:["by"],stage:"warp",decl:function(e){return"\n uniform float ".concat(e,"scale;\n uniform float ").concat(e,"strength;\n uniform float ").concat(e,"speed;\n uniform float ").concat(e,"seed;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;\n // Polynomial bit-mixing hash, deliberately NOT the usual\n // fract(sin(dot(...))). Trig-based hashes disagree across GPU\n // vendors — sin's precision at large arguments is not\n // specified — so the same seed would render a different field\n // on different hardware. This one is multiply/fract only, so\n // the field is at least stable per-device. (Determinism rule,\n // MORPH-IMPL-SPEC §2.9.5a.)\n float ").concat(e,"h(vec2 v) {\n vec3 q = fract(vec3(v.xyx) * 0.1031 + ").concat(e,"seed);\n q += dot(q, q.yzx + 33.33);\n return fract((q.x + q.y) * q.z);\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 }\n // The potential. Two octaves: enough structure to read as a\n // current without the cost of a full fBm.\n float ").concat(e,"psi(vec2 v) {\n return ").concat(e,"n(v) * 0.65 + ").concat(e,"n(v * 2.3 + 11.0) * 0.35;\n }")},code:function(e,t){return"\n {\n float sc = max(".concat(e,"scale, 1.0);\n vec2 drift = vec2(0.0, u_time * ").concat(e,"speed);").concat(t.by?"\n float fall = 1.0 - smoothstep(0.0, ".concat(e,"radius, length(warped - ").concat(e,"dpos));\n float amt = ").concat(e,"strength * fall * ").concat(e,"damt;"):"\n float amt = ".concat(e,"strength;"),"\n // Three fixed Euler steps along curl(psi). Fixed count, not\n // adaptive: the step budget is a compile-time property so the\n // shader cost cannot vary with the content.\n for (int i = 0; i < 3; i++) {\n vec2 q = warped / sc + drift;\n float e = 0.35;\n float dy = ").concat(e,"psi(q + vec2(0.0, e)) - ").concat(e,"psi(q - vec2(0.0, e));\n float dx = ").concat(e,"psi(q + vec2(e, 0.0)) - ").concat(e,"psi(q - vec2(e, 0.0));\n // curl of a 2D scalar potential = (dpsi/dy, -dpsi/dx)\n warped += vec2(dy, -dx) / (2.0 * e) * amt * 0.3333;\n }\n }")},uniforms:function(e,t){return{scale:["1f",(null!=e.scale?e.scale:120)*t],strength:["1f",(null!=e.strength?e.strength:18)*t],speed:["1f",null!=e.speed?e.speed:.25],seed:["1f",null!=e.seed?e.seed:0],radius:["1f",(null!=e.radius?e.radius:320)*t]}}},duotone:{doc:{summary:"Maps luminance onto a two-colour ramp. With `by`, the mapping is confined to a spot around the driver focus and the rest of the element keeps its own colour.",params:{colors:{default:["#104B87","#E8FF00"],unit:"color",summary:"[shadow, highlight] — the two ends of the ramp"},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by"],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:{doc:{summary:"Draws the cell borders a cell-stage op produced. On its own it shows nothing — it colours `edge`, which only hexalize (or another cell op) writes.",params:{color:{default:"#FFFFFF",unit:"color",summary:"border colour"},strength:{default:1,unit:"ratio",summary:"border opacity"}}},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:{doc:{summary:"Print halftone: the image is redrawn as a grid of ink dots on paper, dot size following local luminance.",params:{size:{default:6,unit:"px",summary:"dot pitch"},angle:{default:15,unit:"deg",summary:"screen angle of the dot grid"},ink:{default:"#0B1B2B",unit:"color",summary:"dot colour"},paper:{default:"#FFFFFF",unit:"color",summary:"background colour"},softness:{default:.08,unit:"ratio",summary:"dot edge softness — 0 is a hard stencil"},amount:{default:1,unit:"ratio",summary:"blend back toward the un-screened image; 0 is identity. Keyframe it to 0 at both ends of a transition so the shader hands over to the real element without a pop."},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by"],stage:"color",decl:function(e){return"\n uniform float ".concat(e,"size;\n uniform float ").concat(e,"amount;\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(col, mix(").concat(e,"paper, ").concat(e,"ink, dm), clamp(").concat(e,"amount, 0.0, 1.0));\n }")},uniforms:function(e,t){return{size:["1f",(e.size||6)*t],amount:["1f",null!=e.amount?e.amount:1],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:{doc:{summary:"Ordered (Bayer) dithering to a small palette — the look of an 8-bit display, and the one op that gets sharper as the element gets smaller.",params:{size:{default:1,unit:"px",summary:"size of one dither cell; 1 is per-pixel"},levels:{default:6,unit:"count",summary:"quantisation steps per channel"},amount:{default:1,unit:"ratio",summary:"blend back toward the undithered image"},mono:{default:!1,unit:"bool",structural:!0,summary:"quantise luminance to ink/paper instead of per-channel colour. A different shader, so toggling rebuilds."},ink:{default:"#0B1B2B",unit:"color",summary:"dark end, mono only"},paper:{default:"#FFFFFF",unit:"color",summary:"light end, mono only"},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by","mono"],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:{movesCoords:!1,doc:{summary:"Chromatic aberration: the three colour channels are sampled at slightly different offsets, like a cheap lens.",params:{amount:{default:6,unit:"px",summary:"channel separation"},radius:{default:240,unit:"px",summary:"falloff around the focus when `by` names a driver"}}},structural:["by"],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:{doc:{summary:'Writes a scalar FIELD for later ops to read — draws nothing itself. Give a downstream op `masked: "name"` and it applies only where this field is high. This is how any op becomes local without knowing anything about masking.',params:{as:{default:"mask",unit:"name",structural:!0,summary:"name of the field written. Consumers name it in `masked:`."},from:{default:"radial",unit:"name",structural:!0,summary:"field shape — compiled in, so changing it rebuilds"},at:{default:[.5,.5],unit:"point",structural:!0,summary:"centre as a fraction of the element box; survives resizes"},radius:{default:260,unit:"px",summary:"field radius"},invert:{default:!1,unit:"bool",summary:"swap inside and outside"},remap:{default:[0,1],unit:"range",summary:"rescale the field's output range"}}},structural:["as","from","at"],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"),a="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(a,";\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(E(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:{doc:{summary:"Writes an animated noise FIELD. Same contract as `mask` — it draws nothing; downstream ops read it via `masked:`. Use it to make any other op flicker, breathe or crawl.",params:{as:{default:"mask",unit:"name",structural:!0,summary:"name of the field written"},scale:{default:3,unit:"ratio",summary:"noise frequency across the element"},speed:{default:.3,unit:"seconds",summary:"how fast it evolves; 0 freezes it"},amount:{default:1,unit:"ratio",summary:"blend between flat 1.0 and full noise"},remap:{default:[0,1],unit:"range",summary:"rescale the field's output range"}}},structural:["as"],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(E(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:{multiSample:!0,doc:{summary:"Stamps extra copies of the element over itself. Copies sample the ORIGINAL texture, not the result of earlier colour ops, so a copy of a halftoned element is a copy of the unhalftoned source.",params:{count:{default:5,unit:"count",structural:!0,summary:'stamps arranged in a ring around the focus. The loop is unrolled at compile time, so this rebuilds — not something to animate. This default is the shader\'s; the DOM path that an element of type "copy" takes uses 3 instead.'},points:{default:null,unit:"point",structural:!0,summary:"explicit [[x,y], ...] in fractions of the element box, instead of a ring. Survives resizes. Overrides `count`."},radius:{default:110,unit:"px",summary:"ring radius when using `count`"},scale:{default:.5,unit:"ratio",summary:"size of each copy"},rotate:{default:0,unit:"deg",summary:"rotation applied per copy"},fade:{default:1,unit:"ratio",summary:"opacity falloff across the set"},amount:{default:1,unit:"ratio",summary:"overall blend of the copies over the original"},animation:{default:!1,unit:"bool",readBy:"element-mapper",summary:'DOM path only. An element of type "copy" is built by the mapper rather than by the shader, and this asks that mapper for animated copies; the shader path ignores it. Declared because the mapper has always read it and the docs have always taught it, while the registry did not list it – so the validator reported a documented, working node as an unknown parameter.'}}},structural:["count","points"],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))),a="",o=function(o){var i,s=n?"vec2(".concat((+t.points[o][0]).toFixed(5),", ").concat((+t.points[o][1]).toFixed(5),") * u_res"):(i=o/r*Math.PI*2,"".concat(e,"dpos + vec2(").concat(Math.cos(i).toFixed(5),", ")+"".concat(Math.sin(i).toFixed(5),") * ").concat(e,"radius"));a+="\n {\n float ang = ".concat(e,"rotate * ").concat((o+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(o.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++)o(i);return a},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:{doc:{summary:"Runs two sub-chains over the same source and blends the results. The only op that takes other ops as arguments — everything else composes by sequence, this composes in parallel.",params:{a:{default:null,summary:"first branch: an array of nodes",structural:!0},b:{default:null,summary:"second branch: an array of nodes",structural:!0},mode:{default:"over",unit:"name",structural:!0,summary:"how the branches combine: over, add, screen, multiply, difference, lighten. Compiled in, so it rebuilds."},mix:{default:1,unit:"ratio",summary:"how far to blend b into a"}}},structural:["mode","a","b"],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:{doc:{summary:"Temporal accumulation — a fading trail of what CHANGED. Typing smears, a ticking counter leaves a comet. The one op that does nothing on the snapshot backend, because a frozen image has no motion to record.",params:{strength:{default:.85,unit:"ratio",summary:"opacity of the trail"},decay:{default:.92,unit:"ratio",summary:"per-second persistence — higher is a longer tail"},tint:{default:"#7FD4FF",unit:"color",summary:"colour pushed into the trail"},tintAmount:{default:.5,unit:"ratio",summary:"how far the trail is tinted"}}},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),a=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",a),e.smp("u_content",e.content,0),e.smp("u_hist",e.read("history"),1),e.blit(e.write("history")),e.swap("history")}}},stir:{doc:{summary:"Stirred liquid: a real fluid simulation the content is dragged through. STATEFUL — it owns a ping-pong pair of render targets that evolve frame to frame, so it is the most expensive op here.",params:{strength:{default:26,unit:"px",summary:"how far the fluid carries the content"},force:{default:1,unit:"ratio",summary:"how hard the pointer pushes the fluid"},radius:{default:.1,unit:"ratio",summary:"splat size, as a fraction of the sim grid"},curl:{default:2.2,unit:"ratio",summary:"vorticity — how much the fluid curls into eddies"},decay:{default:.985,unit:"ratio",summary:"per-second velocity persistence"},pressure:{default:.8,unit:"ratio",summary:"pressure retained between frames"},pressureIterations:{default:6,unit:"count",summary:"solver iterations; higher is stiffer and slower"},intensity:{default:1.6,unit:"ratio",summary:"brightness of the dye layer"},sheen:{default:.15,unit:"ratio",summary:"specular highlight on the surface"},tint:{default:"#7FD4FF",unit:"color",summary:"dye colour, unless `rainbow`"},rainbow:{default:!1,unit:"bool",summary:"cycle dye hue instead of using `tint`"},dye:{default:.85,unit:"ratio",summary:"how much dye colour reaches the final image"},dyeAmount:{default:.6,unit:"ratio",summary:"how much dye each splat injects"},dyeFade:{default:.97,unit:"ratio",summary:"per-second dye persistence"},resolution:{default:128,unit:"count",summary:"velocity grid size, clamped 32..512"},dyeResolution:{default:512,unit:"count",summary:"dye grid size, clamped 64..1024"}}},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 a=p(e.tint||"#7FD4FF");return[a[0]*r,a[1]*r,a[2]*r]}var o=Math.atan2(n,t);return[(.5+.5*Math.cos(o))*r,(.5+.5*Math.cos(o+2.0944))*r,(.5+.5*Math.cos(o+4.1888))*r]},step:function(e,t,n){var r=Math.min(n.dt,1/30),a=1/e.res.sim,o=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",a,a),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",o,o),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",a,a),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("vorticity")),e.use("confine"),e.f2("u_texel",a,a),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",a,a),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("divergence")),e.use("decay"),e.f2("u_texel",a,a),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",a,a),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",a,a),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",a,a),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",o,o),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:{doc:{summary:"Liquid-glass blobs that follow the pointer: a chain of metaballs refracting the content behind them, stretching apart on a fast flick and relaxing back to a single circle at rest.",params:{count:{default:1,unit:"count",structural:!0,summary:"independent drifting blobs, on top of the trail chain"},trail:{default:7,unit:"count",structural:!0,summary:"blobs in the follow-the-leader chain. Unrolled at compile time, so it rebuilds."},radius:{default:46,unit:"px",summary:"blob radius at rest"},color:{default:"#EAF4EE",unit:"color",summary:"glass tint"},refract:{default:70,unit:"px",summary:"how far the glass bends what is behind it"},rim:{default:.6,unit:"ratio",summary:"brightness of the rim light"},alpha:{default:1,unit:"ratio",summary:"overall opacity"},iridescence:{default:.8,unit:"ratio",summary:"colour shift across the rim"},dispersion:{default:1,unit:"ratio",summary:"per-channel refraction spread"},frost:{default:.25,unit:"ratio",summary:"blur of what shows through"}}},structural:["count","trail"],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 a=(e.radius||46)*t,o=Math.max(1,Math.min(null!=e.trail?e.trail:7,12)),i=[],s=0,c=0;c<o;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 a*e/u}),d=i.map(function(e,t){return.85*a*Math.pow(.955,t)}),h=function(e,t){return e+Math.random()*(t-e)},m=Math.max(0,Math.min((e.count||1)-1,12-o)),p=[],v=0;v<m;v++){var y=h(0,2*Math.PI),g=h(30,80)*t;p.push({x:h(a,n-a),y:h(a,r-a),r:a*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<o;w++)b.push({x:x.x,y:x.y});return{head:x,chain:b,nTrail:o,drifters:p,trailIdleR:f,trailMoveR:d,stretch:0,seg:.9*a}},tick:function(e,t){var n=Math.min(t.dt,.05),r=t.w,a=t.h,o=1-Math.exp(9*-n);e.head.x+=(t.mouseX-e.head.x)*o,e.head.y+=(t.mouseY-e.head.y)*o;var i=e.chain;i[0].x=e.head.x,i[0].y=e.head.y;for(var s=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,m=Math.hypot(d,h)||1e-4,p=e.seg;m>p&&(f.x+=d*(1-p/m),f.y+=h*(1-p/m)),f.x+=(u.x-f.x)*s,f.y+=(u.y-f.y)*s}var v=i[i.length-1],y=Math.hypot(v.x-e.head.x,v.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=c(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>a-_.r&&(_.y=a-_.r,_.vy=-Math.abs(_.vy)),_.phase+=1.6*n}}catch(e){w.e(e)}finally{w.f()}for(var E=new Float32Array(36),T=e.stretch,k=0;k<e.nTrail;k++){var A=i[k];E[3*k]=A.x,E[3*k+1]=A.y,E[3*k+2]=e.trailIdleR[k]+(e.trailMoveR[k]-e.trailIdleR[k])*T}return e.drifters.forEach(function(t,n){var r=e.nTrail+n;E[3*r]=t.x,E[3*r+1]=t.y,E[3*r+2]=t.r*(1+.12*Math.sin(t.phase))}),[{name:"blobs",kind:"3fv",value:E},{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(m).concat("switch");var v=["px","ratio","deg","count","seconds"];function y(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;var r,a=c(n);try{for(a.s();!(r=a.n()).done;){var o=r.value;if("number"!=typeof o||!Number.isFinite(o))return!1}}catch(e){a.e(e)}finally{a.f()}var i=m[e],s=i&&i.doc&&i.doc.params&&i.doc.params[t];return!!s&&v.includes(s.unit)}function g(e,t){var n=e.length-1,r=Math.min(1,Math.max(0,t))*n,a=Math.min(n-1,Math.floor(r));return e[a]+(e[a+1]-e[a])*(r-a)}var x={linear:function(e){return e},in:function(e){return e*e*e},out:function(e){return 1-Math.pow(1-e,3)},"in-out":function(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},back:function(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)}},b=Object.keys(x);var w="attribute vec2 a; void main(){ gl_Position = vec4(a, 0.0, 1.0); }",_={warp:["warped"],cell:["center","edge"],displace:["sampleP","chroma"],color:["col","edgeCol","edgeCov","ovCol","ovA"]},E=(["field"].concat(i(Object.keys(_))),"what steers the effect: ".concat(h.join(", "),". "),"easing for this node's local progress: ".concat(b.join(", ")),function(e){return"fld_".concat(String(e).replace(/[^A-Za-z0-9_]/g,""))}),T=function(e){return!0===e.masked?"mask":"string"==typeof e.masked?e.masked:null},k=function(e){return"edge"===e||"edgeCov"===e||"ovA"===e?"float":"col"===e||"edgeCol"===e||"ovCol"===e?"vec3":"vec2"},A={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 R(e,t){var n,r=[],a=c(e||[]);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o&&o.op){var i={node:o,i:t.length};t.push(o),"merge"===o.op&&(i.a=R(o.a,t),i.b=R(o.b,t)),r.push(i)}}}catch(e){a.e(e)}finally{a.f()}return r}function S(e,t){var n,r=c(e);try{var a=function(){var e=n.value,r=e.node;if("merge"===r.op)return function(e,t){var n="u".concat(e.i,"_"),r=A[e.node.mode]||A.over,a={field:"",warp:"",cell:"",displace:"",color:""},o={field:"",warp:"",cell:"",displace:"",color:""};S(e.a||[],a),S(e.b||[],o),t.field+=a.field+o.field;for(var i=function(){var e=c[s];if(!a[e]&&!o[e])return 1;var i=_[e],l=" {\n";i.forEach(function(e,t){l+=" ".concat(k(e)," pre").concat(t," = ").concat(e,";\n")}),l+=a[e],i.forEach(function(e,t){l+=" ".concat(k(e)," bra").concat(t," = ").concat(e,";\n")}),i.forEach(function(e,t){l+=" ".concat(e," = pre").concat(t,";\n")}),l+=o[e],i.forEach(function(e,t){var a="vec3"===k(e)?r("bra".concat(t),e):e;l+=" ".concat(e," = mix(bra").concat(t,", ").concat(a,", ").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 a=m[r.op];if(!a)return 0;var o="u".concat(e.i,"_"),i=Array.isArray(a.stage)?a.stage:[a.stage],s=T(r);i.forEach(function(e){var n=a.code(o,r,e)+"\n";if(s&&_[e]){var i=_[e],c=i.map(function(e,t){return" ".concat(k(e)," msv").concat(t," = ").concat(e,";")}).join("\n"),l=i.map(function(e,t){return" ".concat(e," = mix(msv").concat(t,", ").concat(e,", ").concat(E(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;)a()}catch(e){r.e(e)}finally{r.f()}}function F(e,t,n,r){var a=r&&r.fade||"opaque",o="",s=new Set;t.forEach(function(e){var t=m[e.op];t&&t.producesField&&s.add(e.as||"mask");var n=T(e);n&&s.add(n)});var c=i(s).map(function(e){return" float ".concat(E(e)," = 1.0;")}).join("\n");t.forEach(function(e,t){var n=m[e.op];n&&(o+=n.decl("u".concat(t,"_"),e)+"\n")});var l=function(e){var t=e&&e.node&&e.node.side;if("old"!==t&&"new"!==t)return null;var n=m[e.node.op],a=n?Array.isArray(n.stage)?n.stage:[n.stage]:[];return a.every(function(e){return"color"===e})?r?t:(console.warn('[nodality] side:"'.concat(t,'" has no meaning without a ')+"transition — there is only one image. Ignoring it."),null):(console.warn('[nodality] "'.concat(e.node.op,'" is a ').concat(a.join("+")," op, ")+'so side:"'.concat(t,'" cannot apply to it — a sided op must be colour-only, ')+"because both sides share one sampling coordinate. Running it on the blended result instead."),null)},u=e.filter(function(e){return!l(e)}),f=e.filter(function(e){return"old"===l(e)}),d=e.filter(function(e){return"new"===l(e)}),h={field:"",warp:"",cell:"",displace:"",color:""};S(u,h);var p=function(e,t){if(!e.length)return"";var n={field:"",warp:"",cell:"",displace:"",color:""};if(S(e,n),!n.color)return"";var r=_.color.filter(function(e){return"col"!==e}).map(function(e){return" ".concat(k(e)," ").concat(e," = ").concat("vec3"===k(e)?"vec3(0.0)":"0.0",";")}).join("\n");return" {\n vec2 frag = p;\n vec3 col = ".concat(t,".rgb;\n").concat(r,"\n").concat(n.color,"\n ").concat(t,".rgb = col;\n }\n")},v=p(f,"o"),y=p(d,"n"),g=h.field,x=h.warp,b=h.cell,w=h.displace,A=h.color,R=t,F=R.some(function(e){return"edges"===e.op})?"":" col *= 1.0 - edge * 0.55;",M=R.some(function(e){return(m[e.op]||{}).chroma})?r?"\n vec2 cdev = vec2(chroma.x, chroma.y);\n col.r = nodSampleAt(sampleP + cdev).r;\n col.b = nodSampleAt(sampleP - cdev).b;":"\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;":"",C=n?"u_probe + vec2(0.5)":"gl_FragCoord.xy";return"\nprecision highp float;\nuniform sampler2D u_tex;\nuniform vec2 u_res;\nuniform vec2 u_mouse;\nuniform float u_time;\nuniform float u_t; // phase T1: transition progress, 0..1\n\n// Op uniforms are declared HERE, above the transition helpers, because a\n// per-side op's code is emitted inside nodSampleAt. GLSL requires\n// declaration before use, and with the declarations further down every\n// sided op failed to compile with \"'u0_amount' : undeclared identifier\".\n".concat(n?"uniform vec2 u_probe;\n":"").concat(o,"\n").concat(r?"\n// ── phase T2: transition mode ──────────────────────────────────────\n// Two captures instead of one. u_tex is the NEW element, u_old the\n// frozen OLD one, and u_box is the content box they are both drawn\n// into — lerped from the old rect to the new rect by u_t. So geometry\n// (the box) and pixels (the effect chain) stay separate problems, which\n// is the split View Transitions also makes and the one that keeps this\n// maintainable.\nuniform sampler2D u_old;\n".concat(r&&r.newImage?"uniform sampler2D u_newimg;":"",'\n// Phase T2, gap 2. TWO boxes, not one. With a single shared box the\n// only expressible motion is "both sides march together", so the classic\n// "old slides out while new slides in" was impossible. Each capture now\n// interpolates in its own rect, which keeps per-side motion in the\n// GEOMETRY tier (P-3) instead of needing per-side op scoping.\nuniform vec4 u_boxOld; // x, y, w, h — device px, top-down\nuniform vec4 u_boxNew;\n\n// sRGB <-> linear. A naive crossfade in gamma space dips visibly in\n// brightness at mid-fade on photographic content; this is the classic\n// artifact and it is why the mix below is not just mix().\nvec3 nodToLinear(vec3 c) { return pow(c, vec3(2.2)); }\nvec3 nodToSRGB(vec3 c) { return pow(c, vec3(1.0 / 2.2)); }\n\n// Premultiplied, so anti-aliased edges over transparency do not pick up\n// a dark halo as the two sides cross.\nvec4 nodBlend(vec4 a, vec4 b, float t, float d) {\n vec3 pa = nodToLinear(a.rgb) * a.a;\n vec3 pb = nodToLinear(b.rgb) * b.a;\n').concat("morph"===a?"\n // MORPH — a per-pixel CHOICE, not a mix. d is a stable hash of the\n // output pixel, so each pixel flips from old to new at its own point\n // in t. At any instant almost every pixel is showing exactly ONE\n // side, and the two contents are never both legible at once.\n //\n // A uniform crossfade cannot do this: at t=0.5 it is by definition\n // 50% of each, which reads as a double exposure the moment the two\n // states differ much — a wide nav bar and a small card, say.\n float k = smoothstep(d - 0.12, d + 0.12, t);\n vec3 pm = pa * (1.0 - k) + pb * k;\n float al = a.a * (1.0 - k) + b.a * k;":"dissolve"===a?'\n // DISSOLVE — a true cross-dissolve: alpha lerps between the two.\n // Correct, and the right choice when one side really should fade to\n // nothing. Wrong for a shape morph, because any region covered by\n // only ONE side is translucent for the whole transition and the\n // morph reads as "everything is disappearing".\n vec3 pm = mix(pa, pb, t);\n float al = mix(a.a, b.a, t);':"\n // OPAQUE (default) — the colour crosses over without the shape\n // thinning out. The coverage-weighted lerp already gives that for\n // free, and it is worth seeing why:\n //\n // both sides cover a.a = b.a = 1 -> w = 1 at every t. Solid\n // throughout. No mid-fade.\n // only the old b.a = 0 -> w = 1-t. Releases.\n // only the new a.a = 0 -> w = t. Arrives.\n //\n // So one expression covers the union case AND each side's release,\n // linearly, with no curve to pop against.\n vec3 pm = pa * (1.0 - t) + pb * t;\n float al = a.a * (1.0 - t) + b.a * t;","\n return vec4(nodToSRGB(pm / max(al, 1e-4)), al);\n}\n\n// EVERY fetch in transition mode goes through here. A displace-stage op\n// that sampled u_tex directly — aberration does exactly that for its\n// per-channel taps — would show fringes from the new capture only, with\n// the old one silently absent from those channels.\n// Takes a position in DEVICE PX (sampleP space), not uv, because the two\n// captures no longer share a uv. Each is mapped through its own box and\n// masked to it, then blended.\nvec2 nodBoxUV(vec4 box, vec2 p) {\n return vec2((p.x - box.x) / max(box.z, 1.0),\n 1.0 - (p.y - box.y) / max(box.w, 1.0));\n}\nfloat nodInBox(vec2 uv) {\n return step(0.0, uv.x) * step(uv.x, 1.0) * step(0.0, uv.y) * step(uv.y, 1.0);\n}\nvec4 nodSampleAt(vec2 p) {\n vec2 uo = nodBoxUV(u_boxOld, p);\n vec2 un = nodBoxUV(u_boxNew, p);\n vec4 o = texture2D(u_old, clamp(uo, 0.001, 0.999));\n // With newImage the new side is a capture of the ELEMENT, so both\n // sides can travel between their own rects and converge into one\n // shape. Without it the new side is the HOST capture, which can only\n // be mapped 1:1 — the destination then sits at its final place from\n // t=0 while the old shrinks toward it, and the result reads as two\n // things on screen at once rather than one thing morphing.\n vec4 n = texture2D(").concat(r&&r.newImage?"u_newimg":"u_tex",",\n clamp(un, 0.001, 0.999));\n o.a *= nodInBox(uo);\n n.a *= nodInBox(un);\n").concat(v).concat(y,"\n // The threshold each pixel flips at. Mostly a COHERENT ramp down the\n // box with a little grain on top — pure white noise chooses correctly\n // (never two legible images at once) but reads as television static\n // rather than as one thing becoming another. The ramp makes it a\n // wipe; the grain keeps the edge from looking like a ruler.\n float grain = fract(sin(dot(floor(p / 3.0), vec2(12.9898, 78.233))) * 43758.5453);\n float ramp = clamp(un.y, 0.0, 1.0);\n float d = ramp * 0.82 + grain * 0.18;\n return nodBlend(o, n, u_t, d);\n}"):"","\nvoid main() {\n vec2 fc = ").concat(C,";\n vec2 frag = vec2(fc.x, u_res.y - fc.y);\n").concat(c,"\n").concat(g,"\n vec2 warped = frag;\n").concat(x,"\n vec2 center = warped;\n float edge = 0.0;\n").concat(b,"\n vec2 sampleP = warped;\n vec2 chroma = vec2(0.0);\n").concat(w).concat(n?"\n vec2 q = clamp(sampleP / u_res, 0.0, 1.0) * 255.0;\n vec2 hi = floor(q);\n vec2 lo = floor(fract(q) * 255.0);\n gl_FragColor = vec4(hi.x, lo.x, hi.y, lo.y) / 255.0;\n}":"\n".concat(r?"\n // uv stays defined, as the NEW box's, for ops that reference it.\n vec2 uv = nodBoxUV(u_boxNew, sampleP);\n vec4 tex = nodSampleAt(sampleP);":"\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(M,"\n vec3 edgeCol = vec3(1.0);\n float edgeCov = 0.0;\n vec3 ovCol = vec3(0.0);\n float ovA = 0.0;\n").concat(A,"\n").concat(F,"\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}"))}var M=/\d(?:vw|vh|vmin|vmax|dvw|dvh|svw|svh|lvw|lvh)\b/i,C=["color","font-family","font-size","font-weight","font-style","line-height","letter-spacing","text-align","text-transform","text-decoration-color","white-space","word-break"],D=["background-color","background-image","background-size","background-position","background-repeat","background-clip","border-radius","box-shadow","opacity","outline-color"],P=new Set(["none","rgba(0, 0, 0, 0)","transparent","0px","auto","1","repeat","0% 0%","border-box","0% 0% / auto repeat scroll padding-box border-box"]);var I={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 L(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=I[e]||e;if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia(t).matches}catch(e){return!1}}function O(e,t){if(!Array.isArray(e))return[];if((t||0)>8)return[];var n,r=[],a=c(e);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o&&"switch"===o.op){var i,s=c(O((L(o.when)?o.use:o.else)||[],(t||0)+1));try{for(s.s();!(i=s.n()).done;){var l=i.value;r.push(l)}}catch(e){s.e(e)}finally{s.f()}}else r.push(o)}}catch(e){a.e(e)}finally{a.f()}return r}var U=new Set(["IMG","VIDEO","CANVAS","IFRAME","INPUT","EMBED","OBJECT","TEXTAREA","SELECT","BR","HR","AREA","SOURCE","TRACK","WBR"]),B=["objectFit","objectPosition","borderRadius","imageRendering","filter"],z=new Set,N=["op","masked","live"],W=!1;function X(e,t,n){var r=t,a=n&&n.transition||null;if(!e||"undefined"==typeof document||"undefined"==typeof window)return null;if(!(t&&0!==t.length||a))return null;if(t||(t=[]),t.some(function(e){return e&&"switch"===e.op})&&0===(t=O(t,0)).length&&!a)return null;var o=[],u=R(t,o);if(t=o,"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return null;if(U.has(e.tagName)){var f=e.parentElement&&e.parentElement.hasAttribute&&e.parentElement.hasAttribute("data-nodality-raster-host")?e.parentElement:null;if(e=f||function(e){if(!e.parentNode)return null;var t,n={},r=c(B);try{for(r.s();!(t=r.n()).done;){var a=t.value;e.style[a]&&(n[a]=e.style[a])}}catch(e){r.e(e)}finally{r.f()}var o=document.createElement("div");return o.setAttribute("data-nodality-raster-host",e.tagName.toLowerCase()),o.style.cssText=e.style.cssText,e.parentNode.insertBefore(o,e),o.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(o).position:"static")&&(o.style.position="relative"),o.style.width||(o.style.width="100%"),o.style.height||(o.style.height="100%"),o}(e),!e)return null}if(e.querySelector&&e.querySelector(":scope > canvas[data-nodality-raster]"))return null;var p=function(){var t=e.getBoundingClientRect();return{width:t.width>=2?t.width:e.scrollWidth||0,height:t.height>=2?t.height:e.scrollHeight||0}},v=p();if(v.width<2||v.height<2)return null;var b=Math.max(1,Math.min(n&&n.resolution?n.resolution:window.devicePixelRatio||1,3)),_=t.some(function(e){return(m[e.op]||{}).overlay}),E=t.length>0&&!a&&t.every(function(e){return(m[e.op]||{}).overlay}),k=!(!a||!0!==a.live),A=!E&&(!a||k)&&!t.some(function(e){return!1===e.live}),S="undefined"!=typeof WebGL2RenderingContext&&"texElementImage2D"in WebGL2RenderingContext.prototype||"undefined"!=typeof WebGLRenderingContext&&"texElementImage2D"in WebGLRenderingContext.prototype,I=A&&S;A&&!I&&console.info("[nodality] HTML-in-Canvas API not available - raster ops fall back to snapshot capture.");var L=document.createElement("canvas");I&&L.setAttribute("layoutsubtree","");var j={alpha:!0,premultipliedAlpha:!1},G=L.getContext("webgl2",j)||L.getContext("webgl",j);if(!G)return null;var q="undefined"!=typeof WebGL2RenderingContext&&G instanceof WebGL2RenderingContext,H=q&&t.some(function(e){return(m[e.op]||{}).mips});I&&!("texElementImage2D"in G)&&(console.info("[nodality] texElementImage2D missing on the created context - snapshot fallback."),L.removeAttribute("layoutsubtree"),I=!1),"static"===window.getComputedStyle(e).position&&(e.style.position="relative"),L.width=Math.round(v.width*b),L.height=Math.round(v.height*b),L.setAttribute("data-nodality-raster",I?"live":"snapshot"),console.info("[nodality] raster backend:",I?"html-in-canvas (live)":"snapshot");var Y={width:v.width,height:v.height},V=e;if(I){var K=document.createElement("div"),$=getComputedStyle(e),Z="flex"===$.display||"inline-flex"===$.display,Q="grid"===$.display||"inline-grid"===$.display,J=function(e){return parseFloat(e)||0},ee=J($.paddingLeft)+J($.paddingRight),te=J($.paddingTop)+J($.paddingBottom);for(Y.width=Math.max(2,v.width-ee),Y.height=Math.max(2,v.height-te),K.style.cssText="display:".concat(Z||Q?$.display:"block",";")+"width:".concat(Y.width,"px;height:").concat(Y.height,"px;"),Q&&(K.style.gridTemplateColumns=$.gridTemplateColumns,K.style.gridTemplateRows=$.gridTemplateRows,K.style.gridTemplateAreas=$.gridTemplateAreas,K.style.gap=$.gap,K.style.alignItems=$.alignItems,K.style.justifyItems=$.justifyItems),Z&&(K.style.flexDirection=$.flexDirection,K.style.alignItems=$.alignItems,K.style.justifyContent=$.justifyContent,K.style.gap=$.gap);e.firstChild;)K.appendChild(e.firstChild);L.appendChild(K),V=K,L.style.cssText="display:block;width:".concat(Y.width,"px;height:").concat(Y.height,"px;")}else if(L.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(v.width,"px;height:").concat(v.height,"px;")+"pointer-events:none;z-index:2147483000;",E)L.setAttribute("aria-hidden","true");else{L.setAttribute("role","img");var ne=(e.textContent||"").replace(/\s+/g," ").trim();ne&&L.setAttribute("aria-label",ne.slice(0,300))}e.appendChild(L);var re=function(e,t){var n=G.createShader(e);if(G.shaderSource(n,t),G.compileShader(n),!G.getShaderParameter(n,G.COMPILE_STATUS))throw new Error("[nodality] raster shader: "+G.getShaderInfoLog(n));return n},ae=G.createProgram();G.attachShader(ae,re(G.VERTEX_SHADER,w)),G.attachShader(ae,re(G.FRAGMENT_SHADER,F(u,t,!1,a))),G.bindAttribLocation(ae,0,"a"),G.linkProgram(ae),G.useProgram(ae),G.bindBuffer(G.ARRAY_BUFFER,G.createBuffer()),G.bufferData(G.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),G.STATIC_DRAW),G.enableVertexAttribArray(0),G.vertexAttribPointer(0,2,G.FLOAT,!1,0,0);var oe=function(e){return G.getUniformLocation(ae,e)},ie=function(e,t,n){"1f"===t?G.uniform1f(e,n):"1i"===t?G.uniform1i(e,n):"2fv"===t?G.uniform2fv(e,n):"3fv"===t&&G.uniform3fv(e,n)},se=0,ce=t.map(function(e,t){return{node:e,i:t}}).filter(function(e){return function(e){for(var t in e)if(y(e.op,t,e[t]))return!0;return!1}(e.node)}),le=function(e,n){t.forEach(function(t,r){if(!n||n.has(r)){var a=m[t.op];if(a&&a.uniforms){var o=a.uniforms(function(e,t){var n=null,r=e.window||e.ease?function(e,t){var n=Math.min(1,Math.max(0,t)),r=e.window;Array.isArray(r)&&2===r.length&&r[1]!==r[0]&&(n=Math.min(1,Math.max(0,(n-r[0])/(r[1]-r[0]))));var a=e.ease&&x[e.ease];return a?a(n):n}(e,t):t;for(var a in e)y(e.op,a,e[a])&&((n=n||Object.assign({},e))[a]=g(e[a],r));return n||e}(t,se),b);for(var i in o)ie(e("u".concat(r,"_").concat(i)),o[i][0],o[i][1])}}})};le(oe);var ue=new Set(ce.map(function(e){return e.i})),fe=[];t.forEach(function(e,t){var n=m[e.op];n&&"function"==typeof n.init&&fe.push({i:t,def:n,state:n.init(e,b,L.width,L.height)})});var de="undefined"!=typeof performance?performance.now():0,he=[];t.forEach(function(e,t){var n=m[e.op];if(n&&n.solver){var r=function(e,t){var n=m[e.op];if(!q||!G.getExtension("EXT_color_buffer_float"))return console.info("[nodality] '"+e.op+"' needs WebGL2 float render targets - op skipped."),null;G.getExtension("OES_texture_float_linear");var r=n.solver.resolutions(e,L.width,L.height),a={r:[G.R16F,G.RED],rg:[G.RG16F,G.RG],rgba:[G.RGBA16F,G.RGBA]},o=[],i=function(e,t,n,r){var i=l(a[n],2),s=i[0],c=i[1],u=G.createTexture();G.bindTexture(G.TEXTURE_2D,u);var f=r?G.LINEAR:G.NEAREST;G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,f),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,f),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.texImage2D(G.TEXTURE_2D,0,s,e,t,0,c,G.HALF_FLOAT,null);var d=G.createFramebuffer();G.bindFramebuffer(G.FRAMEBUFFER,d),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,u,0);var h=G.checkFramebufferStatus(G.FRAMEBUFFER)===G.FRAMEBUFFER_COMPLETE;G.viewport(0,0,e,t),G.clearColor(0,0,0,1),G.clear(G.COLOR_BUFFER_BIT);var m={tex:u,fbo:d,w:e,h:t,ok:h};return o.push(m),m},s={},c=!0;for(var u in n.solver.targets){var f=n.solver.targets[u],d=r[f.res],h=l(Array.isArray(d)?d:[d,d],2),p=h[0],v=h[1];f.double?(s[u]={a:i(p,v,f.fmt,f.smooth),b:i(p,v,f.fmt,f.smooth)},c=c&&s[u].a.ok&&s[u].b.ok):(s[u]={a:i(p,v,f.fmt,f.smooth)},c=c&&s[u].a.ok)}G.bindFramebuffer(G.FRAMEBUFFER,null);var y=function(){return o.forEach(function(e){G.deleteFramebuffer(e.fbo),G.deleteTexture(e.tex)})};if(!c)return console.info("[nodality] '"+e.op+"' float targets incomplete - op skipped."),y(),null;var g={};try{for(var x in n.solver.programs){var b=G.createProgram();if(G.attachShader(b,re(G.VERTEX_SHADER,w)),G.attachShader(b,re(G.FRAGMENT_SHADER,n.solver.programs[x])),G.bindAttribLocation(b,0,"a"),G.linkProgram(b),!G.getProgramParameter(b,G.LINK_STATUS))throw new Error(x+": "+G.getProgramInfoLog(b));g[x]={prog:b,loc:{}}}}catch(t){for(var _ in console.warn("[nodality] '"+e.op+"' solver programs failed:",t),y(),g)G.deleteProgram(g[_].prog);return null}return G.useProgram(ae),{i:t,node:e,def:n,res:r,targets:s,progs:g,cleanup:y,prevX:.5,prevY:.5,primed:!1}}(e,t);r&&he.push(r)}});var me=function(e,t){var n=null,r={res:e.res,use:function(t){n=e.progs[t],G.useProgram(n.prog)},u:function(e){return e in n.loc||(n.loc[e]=G.getUniformLocation(n.prog,e)),n.loc[e]},f1:function(e,t){G.uniform1f(r.u(e),t)},f2:function(e,t,n){G.uniform2f(r.u(e),t,n)},f3:function(e,t,n,a){G.uniform3f(r.u(e),t,n,a)},smp:function(e,t,n){G.activeTexture(G.TEXTURE0+n),G.bindTexture(G.TEXTURE_2D,t.tex),G.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:pe},canvasW:L.width,canvasH:L.height,swap:function(t){var n=e.targets[t],r=n.a;n.a=n.b,n.b=r},blit:function(e){G.bindFramebuffer(G.FRAMEBUFFER,e.fbo),G.viewport(0,0,e.w,e.h),G.drawArrays(G.TRIANGLES,0,3)}},a=De[0]/L.width,o=1-De[1]/L.height,i=0,s=0;e.primed&&Pe&&(i=(a-e.prevX)/Math.max(t,.001),s=(o-e.prevY)/Math.max(t,.001)),e.prevX=a,e.prevY=o,e.primed=!0;var c=Pe&&Math.abs(i)+Math.abs(s)>.001;e.def.solver.step(r,e.node,{dt:t,px:a,py:o,dx:i,dy:s,moving:c,aspect:L.width/Math.max(L.height,1),col:e.def.solver.splatColor(e.node,i,s)})},pe=G.createTexture();G.bindTexture(G.TEXTURE_2D,pe),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,H?G.LINEAR_MIPMAP_LINEAR:G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,!0);var ve=function(){H&&G.generateMipmap(G.TEXTURE_2D)},ye=!1,ge=null,xe=null;if(a&&a.oldImage){ge=G.createTexture(),G.bindTexture(G.TEXTURE_2D,ge),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);try{G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,a.oldImage)}catch(e){console.warn("[nodality] transition: old capture upload failed:",e),G.deleteTexture(ge),ge=null}}if(a&&a.newImage){xe=G.createTexture(),G.bindTexture(G.TEXTURE_2D,xe),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);try{G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,a.newImage)}catch(e){console.warn("[nodality] transition: new capture upload failed:",e),G.deleteTexture(xe),xe=null}}var be=!1,we=I?"live":"snapshot",_e=!1,Ee={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"},Te=null,ke=function(){if(!Te){!function(){if(!W&&"undefined"!=typeof document){W=!0;var e=document.createElement("style");e.setAttribute("data-nodality","selection"),e.textContent="[data-nodality-ink]::selection,[data-nodality-ink] *::selection{color:var(--nod-ink);-webkit-text-fill-color:var(--nod-ink)}[data-nodality-ink]::-moz-selection,[data-nodality-ink] *::-moz-selection{color:var(--nod-ink);-webkit-text-fill-color:var(--nod-ink)}",(document.head||document.documentElement).appendChild(e)}}(),Te=[],e.setAttribute("data-nodality-ink","");for(var t=[e].concat(i(e.querySelectorAll("*"))).filter(function(e){return e!==L&&"CANVAS"!==e.tagName}),n=t.map(function(e){return getComputedStyle(e).color}),r=0;r<t.length;r++){var a=t[r],o={op:a.style.getPropertyValue("opacity"),ink:a.style.getPropertyValue("--nod-ink")};for(var s in Ee)o[s]=a.style.getPropertyValue(s);for(var c in Te.push([a,o]),a.style.setProperty("--nod-ink",n[r]),Ee)a.style.setProperty(c,Ee[c],"important");a!==e&&a.matches&&a.matches("img,svg,video,picture,iframe")&&a.style.setProperty("opacity","0","important")}e.style.isolation="isolate",L.style.zIndex="-1"}},Ae=function(){if(e.style.visibility="",e.removeAttribute("data-nodality-ink"),Te){var t,n=c(Te);try{for(n.s();!(t=n.n()).done;){var r=l(t.value,2),a=r[0],o=r[1];for(var i in Ee)o[i]?a.style.setProperty(i,o[i]):a.style.removeProperty(i);o.op?a.style.setProperty("opacity",o.op):a.style.removeProperty("opacity"),o.ink?a.style.setProperty("--nod-ink",o.ink):a.style.removeProperty("--nod-ink")}}catch(e){n.e(e)}finally{n.f()}Te=null,e.style.isolation="",L.style.zIndex=""}},Re=function(){if(!a)return!1;var t=se>=1,n=V!==e,r=a.standDownAtStart&&se<=0,o=t&&!n||r?"hidden":"visible";return L.style.visibility!==o&&(L.style.visibility=o),t||r?Te&&Ae():Te||ke(),!0},Se=function(){if(_){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 G.bindTexture(G.TEXTURE_2D,pe),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,t),ve(),ye=!0,Promise.resolve()}catch(e){}else if(!_e){var n="IMG"===e.tagName?e:e.querySelector&&e.querySelector("img");n&&(_e=!0,n.addEventListener("load",function(){be||Se()},{once:!0}))}}L.style.display="none",Ae();var r=function(e,t,n,r){var a=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 a?Promise.resolve(function(e,t,n,r){var a=Math.max(1,Math.round(t*r)),o=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=a/i,d=o/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),m=i*h,p=s*h,v=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(a-m,1):Math.max(o-p,1))},g=y(v[0],0),x=y(v.length>1?v[1]:v[0],1),b=document.createElement("canvas");b.width=a,b.height=o;var w=b.getContext("2d");return w?(w.drawImage(e,(a-m)*g,(o-p)*x,m,p),b):e}(a,t,n,r)):new Promise(function(a,o){var s=(new XMLSerializer).serializeToString(function(e,t){for(var n=[e].concat(i(e.querySelectorAll("*"))),r=[t].concat(i(t.querySelectorAll("*"))),a=0;a<n.length&&a<r.length;a++){var o=r[a].style;if(o){if(o.length>0)for(var s=null,l=0,u=Array.from(o);l<u.length;l++){var f=u[l];if(M.test(o.getPropertyValue(f))){var d=(s=s||window.getComputedStyle(n[a])).getPropertyValue(f);d&&o.setProperty(f,d,o.getPropertyPriority(f))}}var h,m=window.getComputedStyle(n[a]),p=n[a].parentElement,v=0!==a&&p?window.getComputedStyle(p):null,y=c(C);try{for(y.s();!(h=y.n()).done;){var g=h.value,x=m.getPropertyValue(g);x&&(v&&v.getPropertyValue(g)===x||o.getPropertyValue(g)||o.setProperty(g,x))}}catch(e){y.e(e)}finally{y.f()}var b,w=c(D);try{for(w.s();!(b=w.n()).done;){var _=b.value;if(!o.getPropertyValue(_)){var E=m.getPropertyValue(_);E&&!P.has(E)&&o.setProperty(_,E)}}}catch(e){w.e(e)}finally{w.f()}}}return t}(e,e.cloneNode(!0))),l='<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>",u=document.createElement("img");u.onload=function(){return a(u)},u.onerror=o,u.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l)})}(e,v.width,v.height,b).then(function(e){be||(G.bindTexture(G.TEXTURE_2D,pe),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,e),ve(),ye=!0,Re()||(E||ke(),L.style.visibility="visible"))}).catch(function(e){Ae(),console.warn("[nodality] raster snapshot failed:",e)});return L.style.display="",r},Fe=-1,Me=function(){if(!be&&"live"===we){G.bindTexture(G.TEXTURE_2D,pe);var e,t=G.RGBA8||32856,n=[[G.TEXTURE_2D,t,V],[G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,V],[G.TEXTURE_2D,0,t,V],[G.TEXTURE_2D,0,V]];if(Fe>=0)e=[Fe];else{e=[0,1,2,3];var r={3:0,6:1,4:2}[G.texElementImage2D.length];null!=r&&(e.splice(e.indexOf(r),1),e.unshift(r))}var a,o=[],i=c(e);try{for(i.s();!(a=i.n()).done;){var s=a.value;try{return G.texElementImage2D.apply(G,n[s]),ve(),Fe<0&&(Fe=s,console.info("[nodality] texElementImage2D signature discovered: form",s,"(declared arity "+G.texElementImage2D.length+")")),void(ye=!0)}catch(e){o.push("form"+s+" -> "+(e&&e.name?e.name:"?")+": "+(e&&e.message?e.message:e))}}}catch(e){i.e(e)}finally{i.f()}Ce("texElementImage2D rejected all known signatures (arity "+G.texElementImage2D.length+"): "+o.join(" | "))}},Ce=function(t){if(!be&&"live"===we){for(we="snapshot",console.warn("[nodality] live raster backend failed ("+t+") - falling back to snapshot."),L.removeEventListener("paint",Me);V.firstChild;)e.appendChild(V.firstChild);V.parentNode===L&&L.removeChild(V),L.removeAttribute("layoutsubtree"),L.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(v.width,"px;height:").concat(v.height,"px;")+"pointer-events:none;z-index:2147483000;",L.setAttribute("aria-hidden","true"),L.setAttribute("data-nodality-raster","snapshot-fallback"),Se()}};I&&(L.addEventListener("paint",Me),setTimeout(function(){be||"live"!==we||ye||Ce("no paint event within 1500ms")},1500));var De=[.5*L.width,.5*L.height],Pe=!1,Ie=function(e){var t=L.getBoundingClientRect(),n=e.touches?e.touches[0]:e,r=[(n.clientX-t.left)*b,(n.clientY-t.top)*b];r[0]===De[0]&&r[1]===De[1]||(Pe=!0),De=r};e.addEventListener("mousemove",Ie,{passive:!0}),e.addEventListener("touchmove",Ie,{passive:!0});var Le=0,Oe=0,Ue=function(){Le=1},Be=function(){Le=0};e.addEventListener("mouseenter",Ue,{passive:!0}),e.addEventListener("mouseleave",Be,{passive:!0});var ze=[];t.forEach(function(e,t){var n=m[e.op]||{},r=e.by||n.defaultDriver;r&&d[r]?ze.push({i:t,fn:d[r]}):e.by&&console.warn("[nodality] unknown driver '"+e.by+"' on op '"+e.op+"' - known drivers: "+h.join(", "))});var Ne=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)))},We=0,Xe=null,je=function(e,t){G.uniform2f(e("u_res"),t.res[0],t.res[1]),G.uniform2f(e("u_mouse"),t.mouse[0],t.mouse[1]),G.uniform1f(e("u_time"),t.time),G.uniform1f(e("u_t"),t.t);var n,r=c(t.drivers);try{for(r.s();!(n=r.n()).done;){var o=n.value;G.uniform2f(e("u".concat(o.i,"_dpos")),o.x,o.y),G.uniform1f(e("u".concat(o.i,"_damt")),o.amt)}}catch(e){r.e(e)}finally{r.f()}var i,s=c(t.dyn);try{for(s.s();!(i=s.n()).done;){var l,u=i.value,f=c(u.ups);try{for(f.s();!(l=f.n()).done;){var d=l.value;ie(e("u".concat(u.i,"_").concat(d.name)),d.kind,d.value)}}catch(e){f.e(e)}finally{f.f()}}}catch(e){s.e(e)}finally{s.f()}G.activeTexture(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,pe),G.uniform1i(e("u_tex"),0);var h=1;if(a&&ge){G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,ge),G.uniform1i(e("u_old"),h),h++;var m=t.t,p=function(e,t){return[(e.x+(t.x-e.x)*m)*b,(e.y+(t.y-e.y)*m)*b,(e.w+(t.w-e.w)*m)*b,(e.h+(t.h-e.h)*m)*b]},v=p(a.oldRect,a.oldTo||a.newRect),y=p(a.newFrom||a.oldRect,a.newRect);G.uniform4f(e("u_boxOld"),v[0],v[1],v[2],v[3]),G.uniform4f(e("u_boxNew"),y[0],y[1],y[2],y[3]),xe&&(G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,xe),G.uniform1i(e("u_newimg"),h),h++)}for(var g=0,x=he;g<x.length;g++){var w=x[g],_=w.def.solver.samplers;for(var E in _)G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,w.targets[_[E]].a.tex),G.uniform1i(e("u".concat(w.i,"_").concat(E)),h),h++}G.activeTexture(G.TEXTURE0)},Ge=null,qe=["warp","cell","displace"],He=function(e,n,r){if(be||!Xe||!ye)return null;var o=L.getBoundingClientRect();if(o.width&&o.height&&(!r||!r.gpu)){var i=L.width/o.width,s=L.height/o.height,l=(e-o.left)*i,f=(n-o.top)*s;if(l>=0&&f>=0&&l<L.width&&f<L.height){var d=Math.floor(l),h=Math.floor(L.height-f),p=function(e,n){if(!Xe)return null;var r,a={},o=c(Xe.drivers);try{for(o.s();!(r=o.n()).done;){var i=r.value;a[i.i]=i}}catch(e){o.e(e)}finally{o.f()}for(var s=[e,n],l=0,u=qe;l<u.length;l++)for(var f=u[l],d=0;d<t.length;d++){var h=t[d],p=m[h.op];if(p&&(Array.isArray(p.stage)?p.stage:[p.stage]).includes(f)){if(T(h))return null;if("function"!=typeof p.map){if(!1===p.movesCoords)continue;return null}var v=a[d],y=p.map(s,h,{res:Xe.res,dpr:b,dpos:v?[v.x,v.y]:[Xe.res[0]/2,Xe.res[1]/2],damt:v?v.amt:1,time:Xe.time,mouse:Xe.mouse});if(!y)return null;s=y}}return s}(d+.5,L.height-h-.5);if(p)return{x:o.left+Math.min(Math.max(p[0],0),L.width)/i,y:o.top+Math.min(Math.max(p[1],0),L.height)/s}}}var v=function(){if(Ge)return Ge;var e=G.createProgram();if(G.attachShader(e,re(G.VERTEX_SHADER,w)),G.attachShader(e,re(G.FRAGMENT_SHADER,F(u,t,!0,a))),G.bindAttribLocation(e,0,"a"),G.linkProgram(e),!G.getProgramParameter(e,G.LINK_STATUS))return console.warn("[nodality] probe program failed:",G.getProgramInfoLog(e)),G.deleteProgram(e),Ge={broken:!0};var n=G.createTexture();G.bindTexture(G.TEXTURE_2D,n),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,1,1,0,G.RGBA,G.UNSIGNED_BYTE,null),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.NEAREST),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.NEAREST),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);var r=G.createFramebuffer();G.bindFramebuffer(G.FRAMEBUFFER,r),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,n,0);var o=G.checkFramebufferStatus(G.FRAMEBUFFER);if(G.bindFramebuffer(G.FRAMEBUFFER,null),o!==G.FRAMEBUFFER_COMPLETE)return console.warn("[nodality] probe framebuffer incomplete:",o),G.deleteProgram(e),G.deleteFramebuffer(r),G.deleteTexture(n),Ge={broken:!0};var i={},s=function(t){return t in i?i[t]:i[t]=G.getUniformLocation(e,t)};return G.useProgram(e),le(s),G.useProgram(ae),Ge={prog:e,fbo:r,tex:n,px:new Uint8Array(4),U:s}}();if(v.broken)return null;var y=L.getBoundingClientRect();if(!y.width||!y.height)return null;var g=L.width/y.width,x=L.height/y.height,_=(e-y.left)*g,E=(n-y.top)*x;if(_<0||E<0||_>=L.width||E>=L.height)return null;var k=Math.floor(_),A=Math.floor(L.height-E);G.bindFramebuffer(G.FRAMEBUFFER,v.fbo),G.useProgram(v.prog),G.viewport(0,0,1,1),G.uniform2f(v.U("u_probe"),k,A),je(v.U,Xe),G.drawArrays(G.TRIANGLES,0,3),G.readPixels(0,0,1,1,G.RGBA,G.UNSIGNED_BYTE,v.px),G.bindFramebuffer(G.FRAMEBUFFER,null),G.useProgram(ae),G.viewport(0,0,L.width,L.height);var R=v.px,S=(R[0]+R[1]/255)/255,M=(R[2]+R[3]/255)/255;return{x:y.left+S*L.width/g,y:y.top+M*L.height/x}},Ye="__nodalityRetargeted",Ve=!t.some(function(e){return!1===e.interactive}),Ke="data-nodality-hover",$e=t.some(function(e){return!0===e.hoverAttr}),Ze=[],Qe=function(t){for(var n=[],r=t;r&&r!==e.parentNode;r=r.parentElement)n.push(r);for(var a=new Set(n),o=0,i=Ze;o<i.length;o++){var s=i[o];a.has(s)||s.removeAttribute(Ke)}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.hasAttribute(Ke)||u.setAttribute(Ke,"")}Ze=n},Je=0,et=function(t){if(Ve&&!be&&!t[Ye]){if("pointermove"===t.type||"mousemove"===t.type){var n="undefined"!=typeof performance?performance.now():0;if(n-Je<12)return;Je=n}var r=He(t.clientX,t.clientY);if(r){var a=V!==e;if(!(!a&&Math.abs(r.x-t.clientX)<.5&&Math.abs(r.y-t.clientY)<.5)){var o,i,s,l,u=a?(o=r.x,i=r.y,s=null,(l=function(e){var t,n=c(e.children);try{for(n.s();!(t=n.n()).done;){var r=t.value,a=r.getBoundingClientRect();a.width&&a.height&&(o<a.left||o>a.right||i<a.top||i>a.bottom||(s=r,l(r)))}}catch(e){n.e(e)}finally{n.f()}})(V),s):"function"==typeof document.elementFromPoint?document.elementFromPoint(r.x,r.y):null;if(u&&u!==t.target&&e.contains(u)){if($e&&Qe(u),"pointerdown"===t.type||"mousedown"===t.type||"click"===t.type){var f=u.closest&&u.closest("a, button, input, select, textarea, [tabindex]");f&&"function"==typeof f.focus&&f.focus({preventScroll:!0})}t.stopPropagation(),t.cancelable&&t.preventDefault(),u.dispatchEvent(function(e,t,n){var r=new("undefined"!=typeof PointerEvent&&e instanceof PointerEvent?PointerEvent:MouseEvent)(e.type,{bubbles:!0,cancelable:e.cancelable,composed:!0,view:e.view||("undefined"!=typeof window?window:null),detail:e.detail,clientX:t,clientY:n,screenX:e.screenX+(t-e.clientX),screenY:e.screenY+(n-e.clientY),ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,button:e.button,buttons:e.buttons,relatedTarget:e.relatedTarget,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,pressure:e.pressure});return r[Ye]=!0,r}(t,r.x,r.y))}}}}},tt=["pointerdown","pointerup","pointermove","click","dblclick","contextmenu","mousedown","mouseup"],nt=function(){$e&&Qe(null)};if(Ve){var rt,at=c(tt);try{for(at.s();!(rt=at.n()).done;){var ot=rt.value;e.addEventListener(ot,et,!0)}}catch(e){at.e(e)}finally{at.f()}e.addEventListener("pointerleave",nt,!0)}var it=!0,st=function(){if(!be){if(Re(),it&&ye){for(var e="undefined"!=typeof performance?performance.now():de+16,t=Math.max(0,(e-de)/1e3),n=0,r=he;n<r.length;n++){var a=r[n];me(a,t)}Pe=!1,G.bindFramebuffer(G.FRAMEBUFFER,null),G.useProgram(ae),G.viewport(0,0,L.width,L.height),G.clearColor(0,0,0,0),G.clear(G.COLOR_BUFFER_BIT);var o={res:[L.width,L.height],mouse:[De[0],De[1]],time:e/1e3,t:se,drivers:[],dyn:[]};if(ze.length>0){Oe+=(Le-Oe)*(1-Math.exp(8*-t));for(var i={mouseX:De[0],mouseY:De[1],w:L.width,h:L.height,t:e/1e3,hover:Oe,scroll:Ne()},s=0,c=ze;s<c.length;s++){var l=c[s],u=l.fn(i);o.drivers.push({i:l.i,x:u.x,y:u.y,amt:u.amt})}}if(fe.length>0)for(var f={w:L.width,h:L.height,mouseX:De[0],mouseY:De[1],dt:t,t:e/1e3},d=0,h=fe;d<h.length;d++){var m=h[d];o.dyn.push({i:m.i,ups:m.def.tick(m.state,f)})}Xe=o,je(oe,o),de=e,G.drawArrays(G.TRIANGLES,0,3)}We=requestAnimationFrame(st)}},ct=null;"undefined"!=typeof IntersectionObserver&&(ct=new IntersectionObserver(function(e){var t=l(e,1)[0];it=t.isIntersecting})).observe(e);var lt=null,ut=0,ft=function(){if(!be){var e=p();if(!(e.width<2||e.height<2)){var t=Math.round(e.width*b),n=Math.round(e.height*b);v.width=e.width,v.height=e.height,L.style.width=e.width+"px",L.style.height=e.height+"px";var r=L.width!==t||L.height!==n;r&&(L.width=t,L.height=n),"snapshot"===we?Se():r&&Me()}}};"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(function(){"live"!==we&&(function(){if(!be){var e=p();e.width<2||e.height<2||Math.round(e.width)===Math.round(v.width)&&Math.round(e.height)===Math.round(v.height)||(v.width=e.width,v.height=e.height,L.style.width=e.width+"px",L.style.height=e.height+"px")}}(),clearTimeout(ut),ut=setTimeout(ft,150))})).observe(e);var dt=0,ht=function(){clearTimeout(dt),dt=setTimeout(function(){if(!be)if("snapshot"!==we){var t=e.clientWidth||e.parentElement&&e.parentElement.clientWidth||v.width;L.style.width=t+"px",setTimeout(function(){if(!be&&"live"===we){var e=Math.max(2,Math.round(V.getBoundingClientRect().height))||v.height;v.width=t,v.height=e,L.style.height=e+"px",L.width=Math.round(t*b),L.height=Math.round(e*b),Me()}},50)}else ft()},150)};"undefined"!=typeof window&&window.addEventListener("resize",ht),"live"===we?We=requestAnimationFrame(st):(Se().then(function(){We=requestAnimationFrame(st)}),"undefined"!=typeof document&&document.fonts&&"object"===s(document.fonts.ready)&&Promise.resolve(document.fonts.ready).then(ft).catch(function(){}));var mt=function(t,n,r,a,o){"function"==typeof CustomEvent&&"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent("nodality:raster-param",{detail:{pipeline:pt,el:e,index:t,key:n,value:r,prev:a,how:o}}))},pt={canvas:L,nodes:t,get backend(){return we},sourceAt:function(e,t,n){return He(e,t,n)},get progress(){return se},setProgress:function(e){var t=Math.min(1,Math.max(0,Number(e)||0));return t===se||(se=t,ce.length&&(G.useProgram(ae),le(oe,ue),Ge&&!Ge.broken&&(G.useProgram(Ge.prog),le(Ge.U,ue),G.useProgram(ae))),Re()),se},setParam:function(e,n,r){var a=t[e];if(!a||be)return!1;var o=a[n];if(a[n]=r,function(e,t,n,r){if(N.includes(t))return!0;var a=m[e];if(!a)return!0;if((a.structural||[]).includes(t))return!0;if((a.structuralOnToggle||[]).includes(t))return!n!=!r;if(a.uniforms)try{if(t in a.uniforms(Object.assign({op:e},function(e,t,n){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},t,n)),1))return!1}catch(e){}return!0}(a.op,n,r,o))return pt.rebuild(),mt(e,n,r,o,"rebuild"),"rebuild";var i=m[a.op];if(i&&i.uniforms){var c=i.uniforms(a,b);for(var l in G.useProgram(ae),c)ie(oe("u".concat(e,"_").concat(l)),c[l][0],c[l][1]);if(Ge&&!Ge.broken){for(var u in G.useProgram(Ge.prog),c)ie(Ge.U("u".concat(e,"_").concat(u)),c[u][0],c[u][1]);G.useProgram(ae)}}return mt(e,n,r,o,"uniform"),"uniform"},rebuild:function(){if(be)return null;var t=e;return pt.destroy(),X(t,r)}};return z.add(pt),Object.assign(pt,{refresh:function(){return"live"===we?Me():Se()},destroy:function(){z.delete(pt),be=!0,cancelAnimationFrame(We),clearTimeout(ut),clearTimeout(dt),ct&&ct.disconnect(),lt&&lt.disconnect(),"undefined"!=typeof window&&window.removeEventListener("resize",ht),e.removeEventListener("mousemove",Ie),e.removeEventListener("touchmove",Ie);for(var t=0,n=tt;t<n.length;t++){var r=n[t];e.removeEventListener(r,et,!0)}e.removeEventListener("pointerleave",nt,!0),Qe(null),e.removeEventListener("mouseenter",Ue),e.removeEventListener("mouseleave",Be),L.removeEventListener("paint",Me);for(var a=0,o=he;a<o.length;a++){var i=o[a];for(var s in i.cleanup(),i.progs)G.deleteProgram(i.progs[s].prog)}for(he.length=0,Ge&&!Ge.broken&&(G.deleteProgram(Ge.prog),G.deleteFramebuffer(Ge.fbo),G.deleteTexture(Ge.tex)),Ge=null,ge&&(G.deleteTexture(ge),ge=null),xe&&(G.deleteTexture(xe),xe=null);V!==e&&V.firstChild;)e.appendChild(V.firstChild);Ae(),e.style.visibility="",L.remove()}})}function j(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,a,o,i,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||q(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 G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=q(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,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,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function q(e,t){if(e){if("string"==typeof e)return H(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)?H(e,t):void 0}}function H(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 Y(e){return Y="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},Y(e)}function V(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,K(r.key),r)}}function K(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var $=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+" "}),m="transform ".concat(h,", opacity ").concat(h);a.res.style.transition=m}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=K(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=X(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"===Y(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=G(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:"vars",value:function(e){if(!e||"object"!==Y(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 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.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"===Y(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,a=null!==(n=e.border.color)&&void 0!==n?n:"#2ECC71";t.res.style.border=r?"".concat(r,"px solid ").concat(a):"1px solid #2ECC71"}if(null!=e.scale||null!=e.transform){var o=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(o).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 a=function(){if("trn"!==e.value){var a=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:e.valMin,max:e.valMax});"opacity"===e.value?t.res.style.opacity=a:"scale"===e.value&&(t.res.style.transform="scale(".concat(a,")"))}else{for(var o={},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});o[c]="".concat(h).concat(f.unit)}}r(o)}};this._on(window,"scroll",a),0===e.from&&a()}},{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 a={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]},o=["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!==a[e.breakpoint]?e.range=a[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:a.default},t.unshift(c));var l=new Set;t.forEach(function(e){Object.keys(e).forEach(function(e){o.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(),a=c,i=0;i<t.length;i++){var u=t[i],f=j(u.range,2),d=f[0],h=f[1];if("default"!==u.breakpoint&&n>=d&&n<=h){a=u;break}}for(var m 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]}),a)if("exact"!==m){if(!o.includes(m)&&"range"!==m){var p=a[m];"keySet"===m&&p&&p.key?r.res.style[p.key]=p.value:"function"==typeof r[m]?r[m](p):r.res.style[s(m)]=p}}else r.res.style.fontSize=a[m]}),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 a=t.find(function(e){return"default"===e.breakpoint});a||(a={breakpoint:"default",range:r.default},t.unshift(a)),void 0===a.values&&(a.values=this.options&&this.options.pad||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),o=a,i=0;i<t.length;i++){var s=t[i],c=j(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){o=s;break}}var f=void 0!==o.values?o.values:a.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 a=t.find(function(e){return"default"===e.breakpoint});a||(a={breakpoint:"default",range:r.default},t.unshift(a)),void 0===a.values&&(a.values=this.options&&(this.options.mar||this.options.pad)||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),o=a,i=0;i<t.length;i++){var s=t[i],c=j(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){o=s;break}}var f=void 0!==o.values?o.values:a.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||"",a=n.flexDirection||t.flexDirection||"",o=!0===e||"both"===e||"x"===e,i=!0===e||"both"===e||"y"===e;if(r.includes("grid"))return o&&(n.justifyItems="center",n.justifyContent="center"),i&&(n.alignItems="center",n.alignContent="center"),this;r.includes("flex")||(n.display="flex"),n.flexDirection||(n.flexDirection=a||"column");var s=(n.flexDirection||"column").startsWith("column");return(s?i:o)&&(n.justifyContent="center"),(s?o: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 a=n[r],o=e[t][a],i=0;i<a.length;i++)switch(a[i]){case"a":this.res.style.padding=this.isNumber(o)?"".concat(o,"px"):o;break;case"t":this.res.style.paddingTop=this.isNumber(o)?"".concat(o,"px"):o;break;case"l":this.res.style.paddingLeft=this.isNumber(o)?"".concat(o,"px"):o;break;case"r":this.res.style.paddingRight=this.isNumber(o)?"".concat(o,"px"):o;break;case"b":this.res.style.paddingBottom=this.isNumber(o)?"".concat(o,"px"):o}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 a=n[r],o=e[t][a],i=0;i<a.length;i++)switch(a[i]){case"a":"auto"===o?(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"):this.res.style.margin=this.isNumber(o)?"".concat(o,"px"):o;break;case"t":this.res.style.marginTop=this.isNumber(o)?"".concat(o,"px"):o;break;case"l":this.res.style.marginLeft=this.isNumber(o)?"".concat(o,"px"):o;break;case"r":this.res.style.marginRight=this.isNumber(o)?"".concat(o,"px"):o;break;case"b":this.res.style.marginBottom=this.isNumber(o)?"".concat(o,"px"):o}"center"===a&&!0===o&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"),"auto"===o&&(a.includes("l")||a.includes("r"))&&(a.includes("l")&&(this.res.style.marginLeft="auto"),a.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 a=document.createTextNode(this.text);this.res.appendChild(a),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 o=document.createTextNode(this.text);this.res.appendChild(o),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 a=this;this.ap=!1,this.cta=0,this.once=!1;var o,i=G(t);try{for(i.s();!(o=i.n()).done;){var s=o.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(o){var i=e.viewportWidth(),s=[],c=[];a.resCopy=a.res,a.storedQueries=t.map(function(e){return e.target}).filter(function(e){return null!=e});var l,u=G(t);try{for(u.s();!(l=u.n()).done;){var f=l.value;a.counterIndex++;var d=j(f.range,2),h=d[0],m=d[1],p=parseInt(h),v=parseInt(m),y=!0;if(f.target){y=!1;for(var g=0;g<f.target.length;g++){var x=function(e){return"string"==typeof e&&"#"===e.charAt(0)?e.slice(1):e};x(f.target[g])===x(n)&&(y=!0)}}i>=p&&i<=v&&y&&(s.push(f.log),c.push(f),f.op&&f.op.margin&&(a.useMargin=f.op.margin))}}catch(e){u.e(e)}finally{u.f()}if(r&&!r.includes("background")&&(a.res.style.background="",a.res.style.backgroundColor=""),a.res.style.textShadow="",r&&!r.includes("border")&&(a.res.style.border=""),r&&!r.includes("margin")&&(a.res.style.margin=""),a.res.style["-webkit-text-fill-color"]="",a.res.style["-webkit-text-stroke-color"]="",a.res.style["-webkit-text-stroke-width"]="",a.res.style.filter="",a.options.background&&(a.res.style.background=a.options.background),s.includes("gradient"),(s.includes("gradient")||s.includes("shadow"))&&(a.res.style.position="relative"),s.includes("blast")){var b,w=c.filter(function(e){return"blast"===e.log})[0].op.color,_=null!==(b=c.filter(function(e){return"blast"===e.log})[0].op.width)&&void 0!==b?b:"1px";"FlexRowLayoutElement"===a.getType()||"LayoutWrapperElement"===a.getType()?(a.res.style.border="".concat("number"==typeof _?_+"px":_," solid orange"),a.res.style.display="inline-block","FlexRowLayoutElement"===a.getType()&&(a.res.style.display="flex"),a.res.style.boxSizing="border-box",a.res.style.transformOrigin="center",a.blastTarget=a.res):(a.text,a.res.style["-webkit-text-fill-color"]="transparent",a.res.style["-webkit-text-stroke-color"]=w,a.res.style["-webkit-text-stroke-width"]="".concat(_))}if(s.includes("filter")){var E=c.filter(function(e){return"filter"===e.log})[0].op.filter;a.res.style.filter=E}if(s.includes("background")&&(a.res.style.backgroundColor="green"),s.includes("gradient")&&a.globalGradient&&("LayoutWrapperElement"!==a.getType()&&"FlexRowLayoutElement"!==a.getType()&&(a.res.style["-webkit-text-fill-color"]="transparent"),a.res.style.background=a.globalGradient,"LayoutWrapperElement"!==a.getType()&&"FlexRowLayoutElement"!==a.getType()&&(a.res.style["background-clip"]="text")),s.includes("shadow")){var T,k,A,R,S=a.options.shadow.op,F=null!==(T=S.steps)&&void 0!==T?T:1,M=null!==(k=S.colors)&&void 0!==k?k:["gray"],C=null!==(A=S.movements)&&void 0!==A?A:["3px","3px"],D=null!==(R=S.radius)&&void 0!==R?R:"3px";if(1===C.length&&(C=[C[0],C[0]]),"FlexRowLayoutElement"===a.getType()||"LayoutWrapperElement"===a.getType()){for(var P=[],I=0;I<F;I++){var L,O=null!==(L=M[I])&&void 0!==L?L:M[0],U=C[0],B=C[1];P.push("".concat(U," ").concat(B," ").concat(D," ").concat(O))}a.res.style.boxShadow=P.join(", ")}else{for(var z=[],N=0;N<F;N++){var W,X=null!==(W=M[N])&&void 0!==W?W:M[0],q=C[0],H=C[1];z.push("drop-shadow(".concat(q," ").concat(H," ").concat(D," ").concat(X,")"))}a.res.style.filter=z.join(" ")}}if(s.includes("margin"))for(g=0;g<t.length;g++)if(t[g].op){var Y=t[g].op.offsets;Y&&void 0!==a.index&&(a.res.style.margin=Y[Number(a.index)]+"px")}if(s.includes("spana")||s.includes("span")){var V=document.createElement("div");if(V.setAttribute("id","oroa"),Object.assign(V.style,{position:"absolute",inset:"0",background:"linear-gradient(90deg, rgb(52,152,219), rgb(26,188,156))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",pointerEvents:"none"}),a.res&&a.res.querySelector("span"))return;a.res=a.resCopy,a.res.textContent="",a.options.span&&(Array.isArray(a.options.span)?a.options.span:[a.options.span]).forEach(function(e){if(e.op&&"span"===e.op.name&&Array.isArray(e.op.parts)){var t=0,n=a.prevText||"";if(e.op.parts.forEach(function(e){var r=e.text,o=e.style||{};if(t<n.length){var i=n.indexOf(r,t);if(i>t){var s=n.substring(t,i);a.res.appendChild(new a.constructor(s).setup({type:"span",id:o.id,animation:o.animation}).set({}).render())}t=i+r.length}var c=new a.constructor(r).setup({type:"span",id:o.id,animation:o.animation}).set(o).render();a.res.appendChild(c)}),t<n.length){var r=n.substring(t);a.res.appendChild(new a.constructor(r).setup({type:"span"}).set({}).render())}}})}else{var K=new a.constructor(a.prevText).set({}).render();a.prevText&&a.prevText.length>0&&o&&a.res.appendChild(K)}if(s.includes("animation")){if(a.options.animation&&!a.hasAnimated&&!a.options.animation.op.fireAt){a.hasAnimated=!0;var $=a.options.animation.op;a._on(window,"sidebar:open",function(){a.res.animate($.keyframesOpen,$.openOptions)}),a._on(window,"sidebar:closed",function(){a.res.animate($.keyframesClose,$.closeOptions)}),a.res.animate($.keyframesClose,{duration:0,fill:"forwards"}),a.openTag&&a.closeTag&&(a._on(window,a.openTag,function(){a.res.animate($.keyframesOpen,$.openOptions)}),a._on(window,a.closeTag,function(){a.res.animate($.keyframesClose,$.closeOptions)}))}if(a.options.animation&&a.options.animation.op.fireAt&&a.options.animation.op.fireAt.endsWith("px")){var Z=a.options.animation.op;a.res.animate(Z.keyframesClose,{duration:0,fill:"forwards"});var Q=function(){window.scrollY>parseFloat(Z.fireAt)&&(a.res.animate(Z.keyframesOpen,Z.openOptions),window.removeEventListener("scroll",Q))};a._on(window,"scroll",Q)}if(a.options.animation&&"inview"===a.options.animation.op.fireAt){var J=a.options.animation.op;a.res.animate(J.keyframesClose,{duration:0,fill:"forwards"});var ee=!1,te=new IntersectionObserver(function(e,t){e.forEach(function(e){e.isIntersecting&&!ee&&(ee=!0,a.res.animate(J.keyframesOpen,J.openOptions),t.disconnect())})});te.observe(a.res),a._track(function(){return te.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(new RegExp('"([A-Za-z_$][A-Za-z0-9_$]*)"\\s*:',"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&&V(t.prototype,n),r&&V(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();module.exports=t})();
2
+ (()=>{"use strict";var 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]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}e.r(t),e.d(t,{Animator:()=>Q,resetDeprecationNotices:()=>Z});var r="nodality.theme.mode",a="nodality:theme",o={mode:function(){try{var e=localStorage.getItem(r);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"===n(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"===n(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(r,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(a,t);try{e(this.mode,this.current)}catch(e){}return function(){return document.removeEventListener(a,t)}},_broadcast:function(){"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent(a,{detail:{mode:this.mode,tokens:this.current}}))}};function i(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,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,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function l(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,a,o,i,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||u(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 u(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}function f(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 d={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}}},h=Object.keys(d),m={hexalize:{doc:{summary:"Hexagonal cell grid. Snaps sampling to a hex lattice and draws cell borders; with `lift`, cells near the driver swell toward the viewer and their content magnifies to match.",params:{size:{default:24,unit:"px",summary:"lattice pitch — the width of one cell"},lift:{default:0,unit:"ratio",structural:!0,summary:"how much bigger a cell gets at the focus: 0.3 renders the nearest hexagons at 1.3x. 0 compiles the cheap path entirely away, so crossing zero rebuilds."},radius:{default:200,unit:"px",summary:"falloff distance around the driver focus"}}},structuralOnToggle:["lift"],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,a=l(t,2);return n=a[0],r=a[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]}},map:function(e,t){return t.lift?null:e}},offset:{doc:{summary:"Pushes the coordinate space away from the driver focus. Warp stage, so cell grids and borders move WITH the content instead of staying a fixed screen-space lattice.",params:{strength:{default:20,unit:"px",summary:"how far the space is pushed at full amount"},radius:{default:260,unit:"px",summary:"falloff distance around the focus"}}},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]}},map:function(e,t,n){var r,a,o,i=(t.strength||20)*n.dpr,s=(t.radius||260)*n.dpr,c=e[0]-n.dpos[0],l=e[1]-n.dpos[1],u=Math.hypot(c,l),f=1-(r=s,a=u,(o=Math.min(1,Math.max(0,(a-0)/(r-0||1e-6))))*o*(3-2*o));if(!(u>.5))return e;var d=i*f*n.damt/u;return[e[0]-c*d,e[1]-l*d]}},flow:{doc:{summary:"Curl-noise current. The coordinate space drifts along a divergence-free field, so content slides as if carried by water. Divergence-free means the flow never piles up or tears.",params:{strength:{default:18,unit:"px",summary:"how far the current carries the space"},scale:{default:120,unit:"px",summary:"size of one eddy — small is turbulent, large is a slow drift"},speed:{default:.25,unit:"seconds",summary:"how fast the field evolves; 0 freezes it"},seed:{default:0,unit:"count",summary:"picks a different field of the same character"},radius:{default:320,unit:"px",summary:"falloff around the focus. Only used when `by` names a driver; without one the current covers the whole element."}}},structural:["by"],stage:"warp",decl:function(e){return"\n uniform float ".concat(e,"scale;\n uniform float ").concat(e,"strength;\n uniform float ").concat(e,"speed;\n uniform float ").concat(e,"seed;\n uniform float ").concat(e,"radius;\n uniform vec2 ").concat(e,"dpos;\n uniform float ").concat(e,"damt;\n // Polynomial bit-mixing hash, deliberately NOT the usual\n // fract(sin(dot(...))). Trig-based hashes disagree across GPU\n // vendors — sin's precision at large arguments is not\n // specified — so the same seed would render a different field\n // on different hardware. This one is multiply/fract only, so\n // the field is at least stable per-device. (Determinism rule,\n // MORPH-IMPL-SPEC §2.9.5a.)\n float ").concat(e,"h(vec2 v) {\n vec3 q = fract(vec3(v.xyx) * 0.1031 + ").concat(e,"seed);\n q += dot(q, q.yzx + 33.33);\n return fract((q.x + q.y) * q.z);\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 }\n // The potential. Two octaves: enough structure to read as a\n // current without the cost of a full fBm.\n float ").concat(e,"psi(vec2 v) {\n return ").concat(e,"n(v) * 0.65 + ").concat(e,"n(v * 2.3 + 11.0) * 0.35;\n }")},code:function(e,t){return"\n {\n float sc = max(".concat(e,"scale, 1.0);\n vec2 drift = vec2(0.0, u_time * ").concat(e,"speed);").concat(t.by?"\n float fall = 1.0 - smoothstep(0.0, ".concat(e,"radius, length(warped - ").concat(e,"dpos));\n float amt = ").concat(e,"strength * fall * ").concat(e,"damt;"):"\n float amt = ".concat(e,"strength;"),"\n // Three fixed Euler steps along curl(psi). Fixed count, not\n // adaptive: the step budget is a compile-time property so the\n // shader cost cannot vary with the content.\n for (int i = 0; i < 3; i++) {\n vec2 q = warped / sc + drift;\n float e = 0.35;\n float dy = ").concat(e,"psi(q + vec2(0.0, e)) - ").concat(e,"psi(q - vec2(0.0, e));\n float dx = ").concat(e,"psi(q + vec2(e, 0.0)) - ").concat(e,"psi(q - vec2(e, 0.0));\n // curl of a 2D scalar potential = (dpsi/dy, -dpsi/dx)\n warped += vec2(dy, -dx) / (2.0 * e) * amt * 0.3333;\n }\n }")},uniforms:function(e,t){return{scale:["1f",(null!=e.scale?e.scale:120)*t],strength:["1f",(null!=e.strength?e.strength:18)*t],speed:["1f",null!=e.speed?e.speed:.25],seed:["1f",null!=e.seed?e.seed:0],radius:["1f",(null!=e.radius?e.radius:320)*t]}}},duotone:{doc:{summary:"Maps luminance onto a two-colour ramp. With `by`, the mapping is confined to a spot around the driver focus and the rest of the element keeps its own colour.",params:{colors:{default:["#104B87","#E8FF00"],unit:"color",summary:"[shadow, highlight] — the two ends of the ramp"},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by"],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:{doc:{summary:"Draws the cell borders a cell-stage op produced. On its own it shows nothing — it colours `edge`, which only hexalize (or another cell op) writes.",params:{color:{default:"#FFFFFF",unit:"color",summary:"border colour"},strength:{default:1,unit:"ratio",summary:"border opacity"}}},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:{doc:{summary:"Print halftone: the image is redrawn as a grid of ink dots on paper, dot size following local luminance.",params:{size:{default:6,unit:"px",summary:"dot pitch"},angle:{default:15,unit:"deg",summary:"screen angle of the dot grid"},ink:{default:"#0B1B2B",unit:"color",summary:"dot colour"},paper:{default:"#FFFFFF",unit:"color",summary:"background colour"},softness:{default:.08,unit:"ratio",summary:"dot edge softness — 0 is a hard stencil"},amount:{default:1,unit:"ratio",summary:"blend back toward the un-screened image; 0 is identity. Keyframe it to 0 at both ends of a transition so the shader hands over to the real element without a pop."},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by"],stage:"color",decl:function(e){return"\n uniform float ".concat(e,"size;\n uniform float ").concat(e,"amount;\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(col, mix(").concat(e,"paper, ").concat(e,"ink, dm), clamp(").concat(e,"amount, 0.0, 1.0));\n }")},uniforms:function(e,t){return{size:["1f",(e.size||6)*t],amount:["1f",null!=e.amount?e.amount:1],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:{doc:{summary:"Ordered (Bayer) dithering to a small palette — the look of an 8-bit display, and the one op that gets sharper as the element gets smaller.",params:{size:{default:1,unit:"px",summary:"size of one dither cell; 1 is per-pixel"},levels:{default:6,unit:"count",summary:"quantisation steps per channel"},amount:{default:1,unit:"ratio",summary:"blend back toward the undithered image"},mono:{default:!1,unit:"bool",structural:!0,summary:"quantise luminance to ink/paper instead of per-channel colour. A different shader, so toggling rebuilds."},ink:{default:"#0B1B2B",unit:"color",summary:"dark end, mono only"},paper:{default:"#FFFFFF",unit:"color",summary:"light end, mono only"},radius:{default:220,unit:"px",summary:"spot size when `by` names a driver"}}},structural:["by","mono"],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:{movesCoords:!1,doc:{summary:"Chromatic aberration: the three colour channels are sampled at slightly different offsets, like a cheap lens.",params:{amount:{default:6,unit:"px",summary:"channel separation"},radius:{default:240,unit:"px",summary:"falloff around the focus when `by` names a driver"}}},structural:["by"],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:{doc:{summary:'Writes a scalar FIELD for later ops to read — draws nothing itself. Give a downstream op `masked: "name"` and it applies only where this field is high. This is how any op becomes local without knowing anything about masking.',params:{as:{default:"mask",unit:"name",structural:!0,summary:"name of the field written. Consumers name it in `masked:`."},from:{default:"radial",unit:"name",structural:!0,summary:"field shape — compiled in, so changing it rebuilds"},at:{default:[.5,.5],unit:"point",structural:!0,summary:"centre as a fraction of the element box; survives resizes"},radius:{default:260,unit:"px",summary:"field radius"},invert:{default:!1,unit:"bool",summary:"swap inside and outside"},remap:{default:[0,1],unit:"range",summary:"rescale the field's output range"}}},structural:["as","from","at"],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"),a="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(a,";\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(E(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:{doc:{summary:"Writes an animated noise FIELD. Same contract as `mask` — it draws nothing; downstream ops read it via `masked:`. Use it to make any other op flicker, breathe or crawl.",params:{as:{default:"mask",unit:"name",structural:!0,summary:"name of the field written"},scale:{default:3,unit:"ratio",summary:"noise frequency across the element"},speed:{default:.3,unit:"seconds",summary:"how fast it evolves; 0 freezes it"},amount:{default:1,unit:"ratio",summary:"blend between flat 1.0 and full noise"},remap:{default:[0,1],unit:"range",summary:"rescale the field's output range"}}},structural:["as"],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(E(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:{multiSample:!0,doc:{summary:"Stamps extra copies of the element over itself. Copies sample the ORIGINAL texture, not the result of earlier colour ops, so a copy of a halftoned element is a copy of the unhalftoned source.",params:{count:{default:5,unit:"count",structural:!0,summary:'stamps arranged in a ring around the focus. The loop is unrolled at compile time, so this rebuilds — not something to animate. This default is the shader\'s; the DOM path that an element of type "copy" takes uses 3 instead.'},points:{default:null,unit:"point",structural:!0,summary:"explicit [[x,y], ...] in fractions of the element box, instead of a ring. Survives resizes. Overrides `count`."},radius:{default:110,unit:"px",summary:"ring radius when using `count`"},scale:{default:.5,unit:"ratio",summary:"size of each copy"},rotate:{default:0,unit:"deg",summary:"rotation applied per copy"},fade:{default:1,unit:"ratio",summary:"opacity falloff across the set"},amount:{default:1,unit:"ratio",summary:"overall blend of the copies over the original"},animation:{default:!1,unit:"bool",readBy:"element-mapper",summary:'DOM path only. An element of type "copy" is built by the mapper rather than by the shader, and this asks that mapper for animated copies; the shader path ignores it. Declared because the mapper has always read it and the docs have always taught it, while the registry did not list it – so the validator reported a documented, working node as an unknown parameter.'}}},structural:["count","points"],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))),a="",o=function(o){var i,s=n?"vec2(".concat((+t.points[o][0]).toFixed(5),", ").concat((+t.points[o][1]).toFixed(5),") * u_res"):(i=o/r*Math.PI*2,"".concat(e,"dpos + vec2(").concat(Math.cos(i).toFixed(5),", ")+"".concat(Math.sin(i).toFixed(5),") * ").concat(e,"radius"));a+="\n {\n float ang = ".concat(e,"rotate * ").concat((o+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(o.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++)o(i);return a},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:{doc:{summary:"Runs two sub-chains over the same source and blends the results. The only op that takes other ops as arguments — everything else composes by sequence, this composes in parallel.",params:{a:{default:null,summary:"first branch: an array of nodes",structural:!0},b:{default:null,summary:"second branch: an array of nodes",structural:!0},mode:{default:"over",unit:"name",structural:!0,summary:"how the branches combine: over, add, screen, multiply, difference, lighten. Compiled in, so it rebuilds."},mix:{default:1,unit:"ratio",summary:"how far to blend b into a"}}},structural:["mode","a","b"],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:{doc:{summary:"Temporal accumulation — a fading trail of what CHANGED. Typing smears, a ticking counter leaves a comet. The one op that does nothing on the snapshot backend, because a frozen image has no motion to record.",params:{strength:{default:.85,unit:"ratio",summary:"opacity of the trail"},decay:{default:.92,unit:"ratio",summary:"per-second persistence — higher is a longer tail"},tint:{default:"#7FD4FF",unit:"color",summary:"colour pushed into the trail"},tintAmount:{default:.5,unit:"ratio",summary:"how far the trail is tinted"}}},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),a=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",a),e.smp("u_content",e.content,0),e.smp("u_hist",e.read("history"),1),e.blit(e.write("history")),e.swap("history")}}},stir:{doc:{summary:"Stirred liquid: a real fluid simulation the content is dragged through. STATEFUL — it owns a ping-pong pair of render targets that evolve frame to frame, so it is the most expensive op here.",params:{strength:{default:26,unit:"px",summary:"how far the fluid carries the content"},force:{default:1,unit:"ratio",summary:"how hard the pointer pushes the fluid"},radius:{default:.1,unit:"ratio",summary:"splat size, as a fraction of the sim grid"},curl:{default:2.2,unit:"ratio",summary:"vorticity — how much the fluid curls into eddies"},decay:{default:.985,unit:"ratio",summary:"per-second velocity persistence"},pressure:{default:.8,unit:"ratio",summary:"pressure retained between frames"},pressureIterations:{default:6,unit:"count",summary:"solver iterations; higher is stiffer and slower"},intensity:{default:1.6,unit:"ratio",summary:"brightness of the dye layer"},sheen:{default:.15,unit:"ratio",summary:"specular highlight on the surface"},tint:{default:"#7FD4FF",unit:"color",summary:"dye colour, unless `rainbow`"},rainbow:{default:!1,unit:"bool",summary:"cycle dye hue instead of using `tint`"},dye:{default:.85,unit:"ratio",summary:"how much dye colour reaches the final image"},dyeAmount:{default:.6,unit:"ratio",summary:"how much dye each splat injects"},dyeFade:{default:.97,unit:"ratio",summary:"per-second dye persistence"},resolution:{default:128,unit:"count",summary:"velocity grid size, clamped 32..512"},dyeResolution:{default:512,unit:"count",summary:"dye grid size, clamped 64..1024"}}},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 a=p(e.tint||"#7FD4FF");return[a[0]*r,a[1]*r,a[2]*r]}var o=Math.atan2(n,t);return[(.5+.5*Math.cos(o))*r,(.5+.5*Math.cos(o+2.0944))*r,(.5+.5*Math.cos(o+4.1888))*r]},step:function(e,t,n){var r=Math.min(n.dt,1/30),a=1/e.res.sim,o=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",a,a),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",o,o),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",a,a),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("vorticity")),e.use("confine"),e.f2("u_texel",a,a),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",a,a),e.smp("u_vel",e.read("velocity"),0),e.blit(e.single("divergence")),e.use("decay"),e.f2("u_texel",a,a),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",a,a),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",a,a),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",a,a),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",o,o),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:{doc:{summary:"Liquid-glass blobs that follow the pointer: a chain of metaballs refracting the content behind them, stretching apart on a fast flick and relaxing back to a single circle at rest.",params:{count:{default:1,unit:"count",structural:!0,summary:"independent drifting blobs, on top of the trail chain"},trail:{default:7,unit:"count",structural:!0,summary:"blobs in the follow-the-leader chain. Unrolled at compile time, so it rebuilds."},radius:{default:46,unit:"px",summary:"blob radius at rest"},color:{default:"#EAF4EE",unit:"color",summary:"glass tint"},refract:{default:70,unit:"px",summary:"how far the glass bends what is behind it"},rim:{default:.6,unit:"ratio",summary:"brightness of the rim light"},alpha:{default:1,unit:"ratio",summary:"overall opacity"},iridescence:{default:.8,unit:"ratio",summary:"colour shift across the rim"},dispersion:{default:1,unit:"ratio",summary:"per-channel refraction spread"},frost:{default:.25,unit:"ratio",summary:"blur of what shows through"}}},structural:["count","trail"],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 a=(e.radius||46)*t,o=Math.max(1,Math.min(null!=e.trail?e.trail:7,12)),i=[],s=0,c=0;c<o;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 a*e/u}),d=i.map(function(e,t){return.85*a*Math.pow(.955,t)}),h=function(e,t){return e+Math.random()*(t-e)},m=Math.max(0,Math.min((e.count||1)-1,12-o)),p=[],v=0;v<m;v++){var y=h(0,2*Math.PI),g=h(30,80)*t;p.push({x:h(a,n-a),y:h(a,r-a),r:a*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<o;w++)b.push({x:x.x,y:x.y});return{head:x,chain:b,nTrail:o,drifters:p,trailIdleR:f,trailMoveR:d,stretch:0,seg:.9*a}},tick:function(e,t){var n=Math.min(t.dt,.05),r=t.w,a=t.h,o=1-Math.exp(9*-n);e.head.x+=(t.mouseX-e.head.x)*o,e.head.y+=(t.mouseY-e.head.y)*o;var i=e.chain;i[0].x=e.head.x,i[0].y=e.head.y;for(var s=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,m=Math.hypot(d,h)||1e-4,p=e.seg;m>p&&(f.x+=d*(1-p/m),f.y+=h*(1-p/m)),f.x+=(u.x-f.x)*s,f.y+=(u.y-f.y)*s}var v=i[i.length-1],y=Math.hypot(v.x-e.head.x,v.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=c(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>a-_.r&&(_.y=a-_.r,_.vy=-Math.abs(_.vy)),_.phase+=1.6*n}}catch(e){w.e(e)}finally{w.f()}for(var E=new Float32Array(36),T=e.stretch,k=0;k<e.nTrail;k++){var A=i[k];E[3*k]=A.x,E[3*k+1]=A.y,E[3*k+2]=e.trailIdleR[k]+(e.trailMoveR[k]-e.trailIdleR[k])*T}return e.drifters.forEach(function(t,n){var r=e.nTrail+n;E[3*r]=t.x,E[3*r+1]=t.y,E[3*r+2]=t.r*(1+.12*Math.sin(t.phase))}),[{name:"blobs",kind:"3fv",value:E},{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(m).concat("switch");var v=["px","ratio","deg","count","seconds"];function y(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;var r,a=c(n);try{for(a.s();!(r=a.n()).done;){var o=r.value;if("number"!=typeof o||!Number.isFinite(o))return!1}}catch(e){a.e(e)}finally{a.f()}var i=m[e],s=i&&i.doc&&i.doc.params&&i.doc.params[t];return!!s&&v.includes(s.unit)}function g(e,t){var n=e.length-1,r=Math.min(1,Math.max(0,t))*n,a=Math.min(n-1,Math.floor(r));return e[a]+(e[a+1]-e[a])*(r-a)}var x={linear:function(e){return e},in:function(e){return e*e*e},out:function(e){return 1-Math.pow(1-e,3)},"in-out":function(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},back:function(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)}},b=Object.keys(x);var w="attribute vec2 a; void main(){ gl_Position = vec4(a, 0.0, 1.0); }",_={warp:["warped"],cell:["center","edge"],displace:["sampleP","chroma"],color:["col","edgeCol","edgeCov","ovCol","ovA"]},E=(["field"].concat(i(Object.keys(_))),"what steers the effect: ".concat(h.join(", "),". "),"easing for this node's local progress: ".concat(b.join(", ")),function(e){return"fld_".concat(String(e).replace(/[^A-Za-z0-9_]/g,""))}),T=function(e){return!0===e.masked?"mask":"string"==typeof e.masked?e.masked:null},k=function(e){return"edge"===e||"edgeCov"===e||"ovA"===e?"float":"col"===e||"edgeCol"===e||"ovCol"===e?"vec3":"vec2"},A={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 R(e,t){var n,r=[],a=c(e||[]);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o&&o.op){var i={node:o,i:t.length};t.push(o),"merge"===o.op&&(i.a=R(o.a,t),i.b=R(o.b,t)),r.push(i)}}}catch(e){a.e(e)}finally{a.f()}return r}function S(e,t){var n,r=c(e);try{var a=function(){var e=n.value,r=e.node;if("merge"===r.op)return function(e,t){var n="u".concat(e.i,"_"),r=A[e.node.mode]||A.over,a={field:"",warp:"",cell:"",displace:"",color:""},o={field:"",warp:"",cell:"",displace:"",color:""};S(e.a||[],a),S(e.b||[],o),t.field+=a.field+o.field;for(var i=function(){var e=c[s];if(!a[e]&&!o[e])return 1;var i=_[e],l=" {\n";i.forEach(function(e,t){l+=" ".concat(k(e)," pre").concat(t," = ").concat(e,";\n")}),l+=a[e],i.forEach(function(e,t){l+=" ".concat(k(e)," bra").concat(t," = ").concat(e,";\n")}),i.forEach(function(e,t){l+=" ".concat(e," = pre").concat(t,";\n")}),l+=o[e],i.forEach(function(e,t){var a="vec3"===k(e)?r("bra".concat(t),e):e;l+=" ".concat(e," = mix(bra").concat(t,", ").concat(a,", ").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 a=m[r.op];if(!a)return 0;var o="u".concat(e.i,"_"),i=Array.isArray(a.stage)?a.stage:[a.stage],s=T(r);i.forEach(function(e){var n=a.code(o,r,e)+"\n";if(s&&_[e]){var i=_[e],c=i.map(function(e,t){return" ".concat(k(e)," msv").concat(t," = ").concat(e,";")}).join("\n"),l=i.map(function(e,t){return" ".concat(e," = mix(msv").concat(t,", ").concat(e,", ").concat(E(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;)a()}catch(e){r.e(e)}finally{r.f()}}function F(e,t,n,r){var a=r&&r.fade||"opaque",o="",s=new Set;t.forEach(function(e){var t=m[e.op];t&&t.producesField&&s.add(e.as||"mask");var n=T(e);n&&s.add(n)});var c=i(s).map(function(e){return" float ".concat(E(e)," = 1.0;")}).join("\n");t.forEach(function(e,t){var n=m[e.op];n&&(o+=n.decl("u".concat(t,"_"),e)+"\n")});var l=function(e){var t=e&&e.node&&e.node.side;if("old"!==t&&"new"!==t)return null;var n=m[e.node.op],a=n?Array.isArray(n.stage)?n.stage:[n.stage]:[];return a.every(function(e){return"color"===e})?r?t:(console.warn('[nodality] side:"'.concat(t,'" has no meaning without a ')+"transition — there is only one image. Ignoring it."),null):(console.warn('[nodality] "'.concat(e.node.op,'" is a ').concat(a.join("+")," op, ")+'so side:"'.concat(t,'" cannot apply to it — a sided op must be colour-only, ')+"because both sides share one sampling coordinate. Running it on the blended result instead."),null)},u=e.filter(function(e){return!l(e)}),f=e.filter(function(e){return"old"===l(e)}),d=e.filter(function(e){return"new"===l(e)}),h={field:"",warp:"",cell:"",displace:"",color:""};S(u,h);var p=function(e,t){if(!e.length)return"";var n={field:"",warp:"",cell:"",displace:"",color:""};if(S(e,n),!n.color)return"";var r=_.color.filter(function(e){return"col"!==e}).map(function(e){return" ".concat(k(e)," ").concat(e," = ").concat("vec3"===k(e)?"vec3(0.0)":"0.0",";")}).join("\n");return" {\n vec2 frag = p;\n vec3 col = ".concat(t,".rgb;\n").concat(r,"\n").concat(n.color,"\n ").concat(t,".rgb = col;\n }\n")},v=p(f,"o"),y=p(d,"n"),g=h.field,x=h.warp,b=h.cell,w=h.displace,A=h.color,R=t,F=R.some(function(e){return"edges"===e.op})?"":" col *= 1.0 - edge * 0.55;",M=R.some(function(e){return(m[e.op]||{}).chroma})?r?"\n vec2 cdev = vec2(chroma.x, chroma.y);\n col.r = nodSampleAt(sampleP + cdev).r;\n col.b = nodSampleAt(sampleP - cdev).b;":"\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;":"",C=n?"u_probe + vec2(0.5)":"gl_FragCoord.xy";return"\nprecision highp float;\nuniform sampler2D u_tex;\nuniform vec2 u_res;\nuniform vec2 u_mouse;\nuniform float u_time;\nuniform float u_t; // phase T1: transition progress, 0..1\n\n// Op uniforms are declared HERE, above the transition helpers, because a\n// per-side op's code is emitted inside nodSampleAt. GLSL requires\n// declaration before use, and with the declarations further down every\n// sided op failed to compile with \"'u0_amount' : undeclared identifier\".\n".concat(n?"uniform vec2 u_probe;\n":"").concat(o,"\n").concat(r?"\n// ── phase T2: transition mode ──────────────────────────────────────\n// Two captures instead of one. u_tex is the NEW element, u_old the\n// frozen OLD one, and u_box is the content box they are both drawn\n// into — lerped from the old rect to the new rect by u_t. So geometry\n// (the box) and pixels (the effect chain) stay separate problems, which\n// is the split View Transitions also makes and the one that keeps this\n// maintainable.\nuniform sampler2D u_old;\n".concat(r&&r.newImage?"uniform sampler2D u_newimg;":"",'\n// Phase T2, gap 2. TWO boxes, not one. With a single shared box the\n// only expressible motion is "both sides march together", so the classic\n// "old slides out while new slides in" was impossible. Each capture now\n// interpolates in its own rect, which keeps per-side motion in the\n// GEOMETRY tier (P-3) instead of needing per-side op scoping.\nuniform vec4 u_boxOld; // x, y, w, h — device px, top-down\nuniform vec4 u_boxNew;\n\n// sRGB <-> linear. A naive crossfade in gamma space dips visibly in\n// brightness at mid-fade on photographic content; this is the classic\n// artifact and it is why the mix below is not just mix().\nvec3 nodToLinear(vec3 c) { return pow(c, vec3(2.2)); }\nvec3 nodToSRGB(vec3 c) { return pow(c, vec3(1.0 / 2.2)); }\n\n// Premultiplied, so anti-aliased edges over transparency do not pick up\n// a dark halo as the two sides cross.\nvec4 nodBlend(vec4 a, vec4 b, float t, float d) {\n vec3 pa = nodToLinear(a.rgb) * a.a;\n vec3 pb = nodToLinear(b.rgb) * b.a;\n').concat("morph"===a?"\n // MORPH — a per-pixel CHOICE, not a mix. d is a stable hash of the\n // output pixel, so each pixel flips from old to new at its own point\n // in t. At any instant almost every pixel is showing exactly ONE\n // side, and the two contents are never both legible at once.\n //\n // A uniform crossfade cannot do this: at t=0.5 it is by definition\n // 50% of each, which reads as a double exposure the moment the two\n // states differ much — a wide nav bar and a small card, say.\n float k = smoothstep(d - 0.12, d + 0.12, t);\n vec3 pm = pa * (1.0 - k) + pb * k;\n float al = a.a * (1.0 - k) + b.a * k;":"dissolve"===a?'\n // DISSOLVE — a true cross-dissolve: alpha lerps between the two.\n // Correct, and the right choice when one side really should fade to\n // nothing. Wrong for a shape morph, because any region covered by\n // only ONE side is translucent for the whole transition and the\n // morph reads as "everything is disappearing".\n vec3 pm = mix(pa, pb, t);\n float al = mix(a.a, b.a, t);':"\n // OPAQUE (default) — the colour crosses over without the shape\n // thinning out. The coverage-weighted lerp already gives that for\n // free, and it is worth seeing why:\n //\n // both sides cover a.a = b.a = 1 -> w = 1 at every t. Solid\n // throughout. No mid-fade.\n // only the old b.a = 0 -> w = 1-t. Releases.\n // only the new a.a = 0 -> w = t. Arrives.\n //\n // So one expression covers the union case AND each side's release,\n // linearly, with no curve to pop against.\n vec3 pm = pa * (1.0 - t) + pb * t;\n float al = a.a * (1.0 - t) + b.a * t;","\n return vec4(nodToSRGB(pm / max(al, 1e-4)), al);\n}\n\n// EVERY fetch in transition mode goes through here. A displace-stage op\n// that sampled u_tex directly — aberration does exactly that for its\n// per-channel taps — would show fringes from the new capture only, with\n// the old one silently absent from those channels.\n// Takes a position in DEVICE PX (sampleP space), not uv, because the two\n// captures no longer share a uv. Each is mapped through its own box and\n// masked to it, then blended.\nvec2 nodBoxUV(vec4 box, vec2 p) {\n return vec2((p.x - box.x) / max(box.z, 1.0),\n 1.0 - (p.y - box.y) / max(box.w, 1.0));\n}\nfloat nodInBox(vec2 uv) {\n return step(0.0, uv.x) * step(uv.x, 1.0) * step(0.0, uv.y) * step(uv.y, 1.0);\n}\nvec4 nodSampleAt(vec2 p) {\n vec2 uo = nodBoxUV(u_boxOld, p);\n vec2 un = nodBoxUV(u_boxNew, p);\n vec4 o = texture2D(u_old, clamp(uo, 0.001, 0.999));\n // With newImage the new side is a capture of the ELEMENT, so both\n // sides can travel between their own rects and converge into one\n // shape. Without it the new side is the HOST capture, which can only\n // be mapped 1:1 — the destination then sits at its final place from\n // t=0 while the old shrinks toward it, and the result reads as two\n // things on screen at once rather than one thing morphing.\n vec4 n = texture2D(").concat(r&&r.newImage?"u_newimg":"u_tex",",\n clamp(un, 0.001, 0.999));\n o.a *= nodInBox(uo);\n n.a *= nodInBox(un);\n").concat(v).concat(y,"\n // The threshold each pixel flips at. Mostly a COHERENT ramp down the\n // box with a little grain on top — pure white noise chooses correctly\n // (never two legible images at once) but reads as television static\n // rather than as one thing becoming another. The ramp makes it a\n // wipe; the grain keeps the edge from looking like a ruler.\n float grain = fract(sin(dot(floor(p / 3.0), vec2(12.9898, 78.233))) * 43758.5453);\n float ramp = clamp(un.y, 0.0, 1.0);\n float d = ramp * 0.82 + grain * 0.18;\n return nodBlend(o, n, u_t, d);\n}"):"","\nvoid main() {\n vec2 fc = ").concat(C,";\n vec2 frag = vec2(fc.x, u_res.y - fc.y);\n").concat(c,"\n").concat(g,"\n vec2 warped = frag;\n").concat(x,"\n vec2 center = warped;\n float edge = 0.0;\n").concat(b,"\n vec2 sampleP = warped;\n vec2 chroma = vec2(0.0);\n").concat(w).concat(n?"\n vec2 q = clamp(sampleP / u_res, 0.0, 1.0) * 255.0;\n vec2 hi = floor(q);\n vec2 lo = floor(fract(q) * 255.0);\n gl_FragColor = vec4(hi.x, lo.x, hi.y, lo.y) / 255.0;\n}":"\n".concat(r?"\n // uv stays defined, as the NEW box's, for ops that reference it.\n vec2 uv = nodBoxUV(u_boxNew, sampleP);\n vec4 tex = nodSampleAt(sampleP);":"\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(M,"\n vec3 edgeCol = vec3(1.0);\n float edgeCov = 0.0;\n vec3 ovCol = vec3(0.0);\n float ovA = 0.0;\n").concat(A,"\n").concat(F,"\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}"))}var M=/\d(?:vw|vh|vmin|vmax|dvw|dvh|svw|svh|lvw|lvh)\b/i,C=["color","font-family","font-size","font-weight","font-style","line-height","letter-spacing","text-align","text-transform","text-decoration-color","white-space","word-break"],D=["background-color","background-image","background-size","background-position","background-repeat","background-clip","border-radius","box-shadow","opacity","outline-color"],P=new Set(["none","rgba(0, 0, 0, 0)","transparent","0px","auto","1","repeat","0% 0%","border-box","0% 0% / auto repeat scroll padding-box border-box"]);var I={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 L(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=I[e]||e;if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia(t).matches}catch(e){return!1}}function O(e,t){if(!Array.isArray(e))return[];if((t||0)>8)return[];var n,r=[],a=c(e);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o&&"switch"===o.op){var i,s=c(O((L(o.when)?o.use:o.else)||[],(t||0)+1));try{for(s.s();!(i=s.n()).done;){var l=i.value;r.push(l)}}catch(e){s.e(e)}finally{s.f()}}else r.push(o)}}catch(e){a.e(e)}finally{a.f()}return r}var U=new Set(["IMG","VIDEO","CANVAS","IFRAME","INPUT","EMBED","OBJECT","TEXTAREA","SELECT","BR","HR","AREA","SOURCE","TRACK","WBR"]),B=["objectFit","objectPosition","borderRadius","imageRendering","filter"],z=new Set,N=["op","masked","live"],W=!1;function X(e,t,n){var r=t,a=n&&n.transition||null;if(!e||"undefined"==typeof document||"undefined"==typeof window)return null;if(!(t&&0!==t.length||a))return null;if(t||(t=[]),t.some(function(e){return e&&"switch"===e.op})&&0===(t=O(t,0)).length&&!a)return null;var o=[],u=R(t,o);if(t=o,"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return null;if(U.has(e.tagName)){var f=e.parentElement&&e.parentElement.hasAttribute&&e.parentElement.hasAttribute("data-nodality-raster-host")?e.parentElement:null;if(e=f||function(e){if(!e.parentNode)return null;var t,n={},r=c(B);try{for(r.s();!(t=r.n()).done;){var a=t.value;e.style[a]&&(n[a]=e.style[a])}}catch(e){r.e(e)}finally{r.f()}var o=document.createElement("div");return o.setAttribute("data-nodality-raster-host",e.tagName.toLowerCase()),o.style.cssText=e.style.cssText,e.parentNode.insertBefore(o,e),o.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(o).position:"static")&&(o.style.position="relative"),o.style.width||(o.style.width="100%"),o.style.height||(o.style.height="100%"),o}(e),!e)return null}if(e.querySelector&&e.querySelector(":scope > canvas[data-nodality-raster]"))return null;var p=function(){var t=e.getBoundingClientRect();return{width:t.width>=2?t.width:e.scrollWidth||0,height:t.height>=2?t.height:e.scrollHeight||0}},v=p();if(v.width<2||v.height<2)return null;var b=Math.max(1,Math.min(n&&n.resolution?n.resolution:window.devicePixelRatio||1,3)),_=t.some(function(e){return(m[e.op]||{}).overlay}),E=t.length>0&&!a&&t.every(function(e){return(m[e.op]||{}).overlay}),k=!(!a||!0!==a.live),A=!E&&(!a||k)&&!t.some(function(e){return!1===e.live}),S="undefined"!=typeof WebGL2RenderingContext&&"texElementImage2D"in WebGL2RenderingContext.prototype||"undefined"!=typeof WebGLRenderingContext&&"texElementImage2D"in WebGLRenderingContext.prototype,I=A&&S;A&&!I&&console.info("[nodality] HTML-in-Canvas API not available - raster ops fall back to snapshot capture.");var L=document.createElement("canvas");I&&L.setAttribute("layoutsubtree","");var j={alpha:!0,premultipliedAlpha:!1},G=L.getContext("webgl2",j)||L.getContext("webgl",j);if(!G)return null;var q="undefined"!=typeof WebGL2RenderingContext&&G instanceof WebGL2RenderingContext,H=q&&t.some(function(e){return(m[e.op]||{}).mips});I&&!("texElementImage2D"in G)&&(console.info("[nodality] texElementImage2D missing on the created context - snapshot fallback."),L.removeAttribute("layoutsubtree"),I=!1),"static"===window.getComputedStyle(e).position&&(e.style.position="relative"),L.width=Math.round(v.width*b),L.height=Math.round(v.height*b),L.setAttribute("data-nodality-raster",I?"live":"snapshot"),console.info("[nodality] raster backend:",I?"html-in-canvas (live)":"snapshot");var Y={width:v.width,height:v.height},V=e;if(I){var K=document.createElement("div"),$=getComputedStyle(e),Z="flex"===$.display||"inline-flex"===$.display,Q="grid"===$.display||"inline-grid"===$.display,J=function(e){return parseFloat(e)||0},ee=J($.paddingLeft)+J($.paddingRight),te=J($.paddingTop)+J($.paddingBottom);for(Y.width=Math.max(2,v.width-ee),Y.height=Math.max(2,v.height-te),K.style.cssText="display:".concat(Z||Q?$.display:"block",";")+"width:".concat(Y.width,"px;height:").concat(Y.height,"px;"),Q&&(K.style.gridTemplateColumns=$.gridTemplateColumns,K.style.gridTemplateRows=$.gridTemplateRows,K.style.gridTemplateAreas=$.gridTemplateAreas,K.style.gap=$.gap,K.style.alignItems=$.alignItems,K.style.justifyItems=$.justifyItems),Z&&(K.style.flexDirection=$.flexDirection,K.style.alignItems=$.alignItems,K.style.justifyContent=$.justifyContent,K.style.gap=$.gap);e.firstChild;)K.appendChild(e.firstChild);L.appendChild(K),V=K,L.style.cssText="display:block;width:".concat(Y.width,"px;height:").concat(Y.height,"px;")}else if(L.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(v.width,"px;height:").concat(v.height,"px;")+"pointer-events:none;z-index:2147483000;",E)L.setAttribute("aria-hidden","true");else{L.setAttribute("role","img");var ne=(e.textContent||"").replace(/\s+/g," ").trim();ne&&L.setAttribute("aria-label",ne.slice(0,300))}e.appendChild(L);var re=function(e,t){var n=G.createShader(e);if(G.shaderSource(n,t),G.compileShader(n),!G.getShaderParameter(n,G.COMPILE_STATUS))throw new Error("[nodality] raster shader: "+G.getShaderInfoLog(n));return n},ae=G.createProgram();G.attachShader(ae,re(G.VERTEX_SHADER,w)),G.attachShader(ae,re(G.FRAGMENT_SHADER,F(u,t,!1,a))),G.bindAttribLocation(ae,0,"a"),G.linkProgram(ae),G.useProgram(ae),G.bindBuffer(G.ARRAY_BUFFER,G.createBuffer()),G.bufferData(G.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),G.STATIC_DRAW),G.enableVertexAttribArray(0),G.vertexAttribPointer(0,2,G.FLOAT,!1,0,0);var oe=function(e){return G.getUniformLocation(ae,e)},ie=function(e,t,n){"1f"===t?G.uniform1f(e,n):"1i"===t?G.uniform1i(e,n):"2fv"===t?G.uniform2fv(e,n):"3fv"===t&&G.uniform3fv(e,n)},se=0,ce=t.map(function(e,t){return{node:e,i:t}}).filter(function(e){return function(e){for(var t in e)if(y(e.op,t,e[t]))return!0;return!1}(e.node)}),le=function(e,n){t.forEach(function(t,r){if(!n||n.has(r)){var a=m[t.op];if(a&&a.uniforms){var o=a.uniforms(function(e,t){var n=null,r=e.window||e.ease?function(e,t){var n=Math.min(1,Math.max(0,t)),r=e.window;Array.isArray(r)&&2===r.length&&r[1]!==r[0]&&(n=Math.min(1,Math.max(0,(n-r[0])/(r[1]-r[0]))));var a=e.ease&&x[e.ease];return a?a(n):n}(e,t):t;for(var a in e)y(e.op,a,e[a])&&((n=n||Object.assign({},e))[a]=g(e[a],r));return n||e}(t,se),b);for(var i in o)ie(e("u".concat(r,"_").concat(i)),o[i][0],o[i][1])}}})};le(oe);var ue=new Set(ce.map(function(e){return e.i})),fe=[];t.forEach(function(e,t){var n=m[e.op];n&&"function"==typeof n.init&&fe.push({i:t,def:n,state:n.init(e,b,L.width,L.height)})});var de="undefined"!=typeof performance?performance.now():0,he=[];t.forEach(function(e,t){var n=m[e.op];if(n&&n.solver){var r=function(e,t){var n=m[e.op];if(!q||!G.getExtension("EXT_color_buffer_float"))return console.info("[nodality] '"+e.op+"' needs WebGL2 float render targets - op skipped."),null;G.getExtension("OES_texture_float_linear");var r=n.solver.resolutions(e,L.width,L.height),a={r:[G.R16F,G.RED],rg:[G.RG16F,G.RG],rgba:[G.RGBA16F,G.RGBA]},o=[],i=function(e,t,n,r){var i=l(a[n],2),s=i[0],c=i[1],u=G.createTexture();G.bindTexture(G.TEXTURE_2D,u);var f=r?G.LINEAR:G.NEAREST;G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,f),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,f),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.texImage2D(G.TEXTURE_2D,0,s,e,t,0,c,G.HALF_FLOAT,null);var d=G.createFramebuffer();G.bindFramebuffer(G.FRAMEBUFFER,d),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,u,0);var h=G.checkFramebufferStatus(G.FRAMEBUFFER)===G.FRAMEBUFFER_COMPLETE;G.viewport(0,0,e,t),G.clearColor(0,0,0,1),G.clear(G.COLOR_BUFFER_BIT);var m={tex:u,fbo:d,w:e,h:t,ok:h};return o.push(m),m},s={},c=!0;for(var u in n.solver.targets){var f=n.solver.targets[u],d=r[f.res],h=l(Array.isArray(d)?d:[d,d],2),p=h[0],v=h[1];f.double?(s[u]={a:i(p,v,f.fmt,f.smooth),b:i(p,v,f.fmt,f.smooth)},c=c&&s[u].a.ok&&s[u].b.ok):(s[u]={a:i(p,v,f.fmt,f.smooth)},c=c&&s[u].a.ok)}G.bindFramebuffer(G.FRAMEBUFFER,null);var y=function(){return o.forEach(function(e){G.deleteFramebuffer(e.fbo),G.deleteTexture(e.tex)})};if(!c)return console.info("[nodality] '"+e.op+"' float targets incomplete - op skipped."),y(),null;var g={};try{for(var x in n.solver.programs){var b=G.createProgram();if(G.attachShader(b,re(G.VERTEX_SHADER,w)),G.attachShader(b,re(G.FRAGMENT_SHADER,n.solver.programs[x])),G.bindAttribLocation(b,0,"a"),G.linkProgram(b),!G.getProgramParameter(b,G.LINK_STATUS))throw new Error(x+": "+G.getProgramInfoLog(b));g[x]={prog:b,loc:{}}}}catch(t){for(var _ in console.warn("[nodality] '"+e.op+"' solver programs failed:",t),y(),g)G.deleteProgram(g[_].prog);return null}return G.useProgram(ae),{i:t,node:e,def:n,res:r,targets:s,progs:g,cleanup:y,prevX:.5,prevY:.5,primed:!1}}(e,t);r&&he.push(r)}});var me=function(e,t){var n=null,r={res:e.res,use:function(t){n=e.progs[t],G.useProgram(n.prog)},u:function(e){return e in n.loc||(n.loc[e]=G.getUniformLocation(n.prog,e)),n.loc[e]},f1:function(e,t){G.uniform1f(r.u(e),t)},f2:function(e,t,n){G.uniform2f(r.u(e),t,n)},f3:function(e,t,n,a){G.uniform3f(r.u(e),t,n,a)},smp:function(e,t,n){G.activeTexture(G.TEXTURE0+n),G.bindTexture(G.TEXTURE_2D,t.tex),G.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:pe},canvasW:L.width,canvasH:L.height,swap:function(t){var n=e.targets[t],r=n.a;n.a=n.b,n.b=r},blit:function(e){G.bindFramebuffer(G.FRAMEBUFFER,e.fbo),G.viewport(0,0,e.w,e.h),G.drawArrays(G.TRIANGLES,0,3)}},a=De[0]/L.width,o=1-De[1]/L.height,i=0,s=0;e.primed&&Pe&&(i=(a-e.prevX)/Math.max(t,.001),s=(o-e.prevY)/Math.max(t,.001)),e.prevX=a,e.prevY=o,e.primed=!0;var c=Pe&&Math.abs(i)+Math.abs(s)>.001;e.def.solver.step(r,e.node,{dt:t,px:a,py:o,dx:i,dy:s,moving:c,aspect:L.width/Math.max(L.height,1),col:e.def.solver.splatColor(e.node,i,s)})},pe=G.createTexture();G.bindTexture(G.TEXTURE_2D,pe),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,H?G.LINEAR_MIPMAP_LINEAR:G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,!0);var ve=function(){H&&G.generateMipmap(G.TEXTURE_2D)},ye=!1,ge=null,xe=null;if(a&&a.oldImage){ge=G.createTexture(),G.bindTexture(G.TEXTURE_2D,ge),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);try{G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,a.oldImage)}catch(e){console.warn("[nodality] transition: old capture upload failed:",e),G.deleteTexture(ge),ge=null}}if(a&&a.newImage){xe=G.createTexture(),G.bindTexture(G.TEXTURE_2D,xe),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);try{G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,a.newImage)}catch(e){console.warn("[nodality] transition: new capture upload failed:",e),G.deleteTexture(xe),xe=null}}var be=!1,we=I?"live":"snapshot",_e=!1,Ee={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"},Te=null,ke=function(){if(!Te){!function(){if(!W&&"undefined"!=typeof document){W=!0;var e=document.createElement("style");e.setAttribute("data-nodality","selection"),e.textContent="[data-nodality-ink]::selection,[data-nodality-ink] *::selection{color:var(--nod-ink);-webkit-text-fill-color:var(--nod-ink)}[data-nodality-ink]::-moz-selection,[data-nodality-ink] *::-moz-selection{color:var(--nod-ink);-webkit-text-fill-color:var(--nod-ink)}",(document.head||document.documentElement).appendChild(e)}}(),Te=[],e.setAttribute("data-nodality-ink","");for(var t=[e].concat(i(e.querySelectorAll("*"))).filter(function(e){return e!==L&&"CANVAS"!==e.tagName}),n=t.map(function(e){return getComputedStyle(e).color}),r=0;r<t.length;r++){var a=t[r],o={op:a.style.getPropertyValue("opacity"),ink:a.style.getPropertyValue("--nod-ink")};for(var s in Ee)o[s]=a.style.getPropertyValue(s);for(var c in Te.push([a,o]),a.style.setProperty("--nod-ink",n[r]),Ee)a.style.setProperty(c,Ee[c],"important");a!==e&&a.matches&&a.matches("img,svg,video,picture,iframe")&&a.style.setProperty("opacity","0","important")}e.style.isolation="isolate",L.style.zIndex="-1"}},Ae=function(){if(e.style.visibility="",e.removeAttribute("data-nodality-ink"),Te){var t,n=c(Te);try{for(n.s();!(t=n.n()).done;){var r=l(t.value,2),a=r[0],o=r[1];for(var i in Ee)o[i]?a.style.setProperty(i,o[i]):a.style.removeProperty(i);o.op?a.style.setProperty("opacity",o.op):a.style.removeProperty("opacity"),o.ink?a.style.setProperty("--nod-ink",o.ink):a.style.removeProperty("--nod-ink")}}catch(e){n.e(e)}finally{n.f()}Te=null,e.style.isolation="",L.style.zIndex=""}},Re=function(){if(!a)return!1;var t=se>=1,n=V!==e,r=a.standDownAtStart&&se<=0,o=t&&!n||r?"hidden":"visible";return L.style.visibility!==o&&(L.style.visibility=o),t||r?Te&&Ae():Te||ke(),!0},Se=function(){if(_){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 G.bindTexture(G.TEXTURE_2D,pe),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,t),ve(),ye=!0,Promise.resolve()}catch(e){}else if(!_e){var n="IMG"===e.tagName?e:e.querySelector&&e.querySelector("img");n&&(_e=!0,n.addEventListener("load",function(){be||Se()},{once:!0}))}}L.style.display="none",Ae();var r=function(e,t,n,r){var a=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 a?Promise.resolve(function(e,t,n,r){var a=Math.max(1,Math.round(t*r)),o=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=a/i,d=o/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),m=i*h,p=s*h,v=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(a-m,1):Math.max(o-p,1))},g=y(v[0],0),x=y(v.length>1?v[1]:v[0],1),b=document.createElement("canvas");b.width=a,b.height=o;var w=b.getContext("2d");return w?(w.drawImage(e,(a-m)*g,(o-p)*x,m,p),b):e}(a,t,n,r)):new Promise(function(a,o){var s=(new XMLSerializer).serializeToString(function(e,t){for(var n=[e].concat(i(e.querySelectorAll("*"))),r=[t].concat(i(t.querySelectorAll("*"))),a=0;a<n.length&&a<r.length;a++){var o=r[a].style;if(o){if(o.length>0)for(var s=null,l=0,u=Array.from(o);l<u.length;l++){var f=u[l];if(M.test(o.getPropertyValue(f))){var d=(s=s||window.getComputedStyle(n[a])).getPropertyValue(f);d&&o.setProperty(f,d,o.getPropertyPriority(f))}}var h,m=window.getComputedStyle(n[a]),p=n[a].parentElement,v=0!==a&&p?window.getComputedStyle(p):null,y=c(C);try{for(y.s();!(h=y.n()).done;){var g=h.value,x=m.getPropertyValue(g);x&&(v&&v.getPropertyValue(g)===x||o.getPropertyValue(g)||o.setProperty(g,x))}}catch(e){y.e(e)}finally{y.f()}var b,w=c(D);try{for(w.s();!(b=w.n()).done;){var _=b.value;if(!o.getPropertyValue(_)){var E=m.getPropertyValue(_);E&&!P.has(E)&&o.setProperty(_,E)}}}catch(e){w.e(e)}finally{w.f()}}}return t}(e,e.cloneNode(!0))),l='<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>",u=document.createElement("img");u.onload=function(){return a(u)},u.onerror=o,u.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l)})}(e,v.width,v.height,b).then(function(e){be||(G.bindTexture(G.TEXTURE_2D,pe),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,e),ve(),ye=!0,Re()||(E||ke(),L.style.visibility="visible"))}).catch(function(e){Ae(),console.warn("[nodality] raster snapshot failed:",e)});return L.style.display="",r},Fe=-1,Me=function(){if(!be&&"live"===we){G.bindTexture(G.TEXTURE_2D,pe);var e,t=G.RGBA8||32856,n=[[G.TEXTURE_2D,t,V],[G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,V],[G.TEXTURE_2D,0,t,V],[G.TEXTURE_2D,0,V]];if(Fe>=0)e=[Fe];else{e=[0,1,2,3];var r={3:0,6:1,4:2}[G.texElementImage2D.length];null!=r&&(e.splice(e.indexOf(r),1),e.unshift(r))}var a,o=[],i=c(e);try{for(i.s();!(a=i.n()).done;){var s=a.value;try{return G.texElementImage2D.apply(G,n[s]),ve(),Fe<0&&(Fe=s,console.info("[nodality] texElementImage2D signature discovered: form",s,"(declared arity "+G.texElementImage2D.length+")")),void(ye=!0)}catch(e){o.push("form"+s+" -> "+(e&&e.name?e.name:"?")+": "+(e&&e.message?e.message:e))}}}catch(e){i.e(e)}finally{i.f()}Ce("texElementImage2D rejected all known signatures (arity "+G.texElementImage2D.length+"): "+o.join(" | "))}},Ce=function(t){if(!be&&"live"===we){for(we="snapshot",console.warn("[nodality] live raster backend failed ("+t+") - falling back to snapshot."),L.removeEventListener("paint",Me);V.firstChild;)e.appendChild(V.firstChild);V.parentNode===L&&L.removeChild(V),L.removeAttribute("layoutsubtree"),L.style.cssText="position:absolute;top:0;left:0;"+"width:".concat(v.width,"px;height:").concat(v.height,"px;")+"pointer-events:none;z-index:2147483000;",L.setAttribute("aria-hidden","true"),L.setAttribute("data-nodality-raster","snapshot-fallback"),Se()}};I&&(L.addEventListener("paint",Me),setTimeout(function(){be||"live"!==we||ye||Ce("no paint event within 1500ms")},1500));var De=[.5*L.width,.5*L.height],Pe=!1,Ie=function(e){var t=L.getBoundingClientRect(),n=e.touches?e.touches[0]:e,r=[(n.clientX-t.left)*b,(n.clientY-t.top)*b];r[0]===De[0]&&r[1]===De[1]||(Pe=!0),De=r};e.addEventListener("mousemove",Ie,{passive:!0}),e.addEventListener("touchmove",Ie,{passive:!0});var Le=0,Oe=0,Ue=function(){Le=1},Be=function(){Le=0};e.addEventListener("mouseenter",Ue,{passive:!0}),e.addEventListener("mouseleave",Be,{passive:!0});var ze=[];t.forEach(function(e,t){var n=m[e.op]||{},r=e.by||n.defaultDriver;r&&d[r]?ze.push({i:t,fn:d[r]}):e.by&&console.warn("[nodality] unknown driver '"+e.by+"' on op '"+e.op+"' - known drivers: "+h.join(", "))});var Ne=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)))},We=0,Xe=null,je=function(e,t){G.uniform2f(e("u_res"),t.res[0],t.res[1]),G.uniform2f(e("u_mouse"),t.mouse[0],t.mouse[1]),G.uniform1f(e("u_time"),t.time),G.uniform1f(e("u_t"),t.t);var n,r=c(t.drivers);try{for(r.s();!(n=r.n()).done;){var o=n.value;G.uniform2f(e("u".concat(o.i,"_dpos")),o.x,o.y),G.uniform1f(e("u".concat(o.i,"_damt")),o.amt)}}catch(e){r.e(e)}finally{r.f()}var i,s=c(t.dyn);try{for(s.s();!(i=s.n()).done;){var l,u=i.value,f=c(u.ups);try{for(f.s();!(l=f.n()).done;){var d=l.value;ie(e("u".concat(u.i,"_").concat(d.name)),d.kind,d.value)}}catch(e){f.e(e)}finally{f.f()}}}catch(e){s.e(e)}finally{s.f()}G.activeTexture(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,pe),G.uniform1i(e("u_tex"),0);var h=1;if(a&&ge){G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,ge),G.uniform1i(e("u_old"),h),h++;var m=t.t,p=function(e,t){return[(e.x+(t.x-e.x)*m)*b,(e.y+(t.y-e.y)*m)*b,(e.w+(t.w-e.w)*m)*b,(e.h+(t.h-e.h)*m)*b]},v=p(a.oldRect,a.oldTo||a.newRect),y=p(a.newFrom||a.oldRect,a.newRect);G.uniform4f(e("u_boxOld"),v[0],v[1],v[2],v[3]),G.uniform4f(e("u_boxNew"),y[0],y[1],y[2],y[3]),xe&&(G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,xe),G.uniform1i(e("u_newimg"),h),h++)}for(var g=0,x=he;g<x.length;g++){var w=x[g],_=w.def.solver.samplers;for(var E in _)G.activeTexture(G.TEXTURE0+h),G.bindTexture(G.TEXTURE_2D,w.targets[_[E]].a.tex),G.uniform1i(e("u".concat(w.i,"_").concat(E)),h),h++}G.activeTexture(G.TEXTURE0)},Ge=null,qe=["warp","cell","displace"],He=function(e,n,r){if(be||!Xe||!ye)return null;var o=L.getBoundingClientRect();if(o.width&&o.height&&(!r||!r.gpu)){var i=L.width/o.width,s=L.height/o.height,l=(e-o.left)*i,f=(n-o.top)*s;if(l>=0&&f>=0&&l<L.width&&f<L.height){var d=Math.floor(l),h=Math.floor(L.height-f),p=function(e,n){if(!Xe)return null;var r,a={},o=c(Xe.drivers);try{for(o.s();!(r=o.n()).done;){var i=r.value;a[i.i]=i}}catch(e){o.e(e)}finally{o.f()}for(var s=[e,n],l=0,u=qe;l<u.length;l++)for(var f=u[l],d=0;d<t.length;d++){var h=t[d],p=m[h.op];if(p&&(Array.isArray(p.stage)?p.stage:[p.stage]).includes(f)){if(T(h))return null;if("function"!=typeof p.map){if(!1===p.movesCoords)continue;return null}var v=a[d],y=p.map(s,h,{res:Xe.res,dpr:b,dpos:v?[v.x,v.y]:[Xe.res[0]/2,Xe.res[1]/2],damt:v?v.amt:1,time:Xe.time,mouse:Xe.mouse});if(!y)return null;s=y}}return s}(d+.5,L.height-h-.5);if(p)return{x:o.left+Math.min(Math.max(p[0],0),L.width)/i,y:o.top+Math.min(Math.max(p[1],0),L.height)/s}}}var v=function(){if(Ge)return Ge;var e=G.createProgram();if(G.attachShader(e,re(G.VERTEX_SHADER,w)),G.attachShader(e,re(G.FRAGMENT_SHADER,F(u,t,!0,a))),G.bindAttribLocation(e,0,"a"),G.linkProgram(e),!G.getProgramParameter(e,G.LINK_STATUS))return console.warn("[nodality] probe program failed:",G.getProgramInfoLog(e)),G.deleteProgram(e),Ge={broken:!0};var n=G.createTexture();G.bindTexture(G.TEXTURE_2D,n),G.texImage2D(G.TEXTURE_2D,0,G.RGBA,1,1,0,G.RGBA,G.UNSIGNED_BYTE,null),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.NEAREST),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.NEAREST),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE);var r=G.createFramebuffer();G.bindFramebuffer(G.FRAMEBUFFER,r),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,n,0);var o=G.checkFramebufferStatus(G.FRAMEBUFFER);if(G.bindFramebuffer(G.FRAMEBUFFER,null),o!==G.FRAMEBUFFER_COMPLETE)return console.warn("[nodality] probe framebuffer incomplete:",o),G.deleteProgram(e),G.deleteFramebuffer(r),G.deleteTexture(n),Ge={broken:!0};var i={},s=function(t){return t in i?i[t]:i[t]=G.getUniformLocation(e,t)};return G.useProgram(e),le(s),G.useProgram(ae),Ge={prog:e,fbo:r,tex:n,px:new Uint8Array(4),U:s}}();if(v.broken)return null;var y=L.getBoundingClientRect();if(!y.width||!y.height)return null;var g=L.width/y.width,x=L.height/y.height,_=(e-y.left)*g,E=(n-y.top)*x;if(_<0||E<0||_>=L.width||E>=L.height)return null;var k=Math.floor(_),A=Math.floor(L.height-E);G.bindFramebuffer(G.FRAMEBUFFER,v.fbo),G.useProgram(v.prog),G.viewport(0,0,1,1),G.uniform2f(v.U("u_probe"),k,A),je(v.U,Xe),G.drawArrays(G.TRIANGLES,0,3),G.readPixels(0,0,1,1,G.RGBA,G.UNSIGNED_BYTE,v.px),G.bindFramebuffer(G.FRAMEBUFFER,null),G.useProgram(ae),G.viewport(0,0,L.width,L.height);var R=v.px,S=(R[0]+R[1]/255)/255,M=(R[2]+R[3]/255)/255;return{x:y.left+S*L.width/g,y:y.top+M*L.height/x}},Ye="__nodalityRetargeted",Ve=!t.some(function(e){return!1===e.interactive}),Ke="data-nodality-hover",$e=t.some(function(e){return!0===e.hoverAttr}),Ze=[],Qe=function(t){for(var n=[],r=t;r&&r!==e.parentNode;r=r.parentElement)n.push(r);for(var a=new Set(n),o=0,i=Ze;o<i.length;o++){var s=i[o];a.has(s)||s.removeAttribute(Ke)}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.hasAttribute(Ke)||u.setAttribute(Ke,"")}Ze=n},Je=0,et=function(t){if(Ve&&!be&&!t[Ye]){if("pointermove"===t.type||"mousemove"===t.type){var n="undefined"!=typeof performance?performance.now():0;if(n-Je<12)return;Je=n}var r=He(t.clientX,t.clientY);if(r){var a=V!==e;if(!(!a&&Math.abs(r.x-t.clientX)<.5&&Math.abs(r.y-t.clientY)<.5)){var o,i,s,l,u=a?(o=r.x,i=r.y,s=null,(l=function(e){var t,n=c(e.children);try{for(n.s();!(t=n.n()).done;){var r=t.value,a=r.getBoundingClientRect();a.width&&a.height&&(o<a.left||o>a.right||i<a.top||i>a.bottom||(s=r,l(r)))}}catch(e){n.e(e)}finally{n.f()}})(V),s):"function"==typeof document.elementFromPoint?document.elementFromPoint(r.x,r.y):null;if(u&&u!==t.target&&e.contains(u)){if($e&&Qe(u),"pointerdown"===t.type||"mousedown"===t.type||"click"===t.type){var f=u.closest&&u.closest("a, button, input, select, textarea, [tabindex]");f&&"function"==typeof f.focus&&f.focus({preventScroll:!0})}t.stopPropagation(),t.cancelable&&t.preventDefault(),u.dispatchEvent(function(e,t,n){var r=new("undefined"!=typeof PointerEvent&&e instanceof PointerEvent?PointerEvent:MouseEvent)(e.type,{bubbles:!0,cancelable:e.cancelable,composed:!0,view:e.view||("undefined"!=typeof window?window:null),detail:e.detail,clientX:t,clientY:n,screenX:e.screenX+(t-e.clientX),screenY:e.screenY+(n-e.clientY),ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,button:e.button,buttons:e.buttons,relatedTarget:e.relatedTarget,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,pressure:e.pressure});return r[Ye]=!0,r}(t,r.x,r.y))}}}}},tt=["pointerdown","pointerup","pointermove","click","dblclick","contextmenu","mousedown","mouseup"],nt=function(){$e&&Qe(null)};if(Ve){var rt,at=c(tt);try{for(at.s();!(rt=at.n()).done;){var ot=rt.value;e.addEventListener(ot,et,!0)}}catch(e){at.e(e)}finally{at.f()}e.addEventListener("pointerleave",nt,!0)}var it=!0,st=function(){if(!be){if(Re(),it&&ye){for(var e="undefined"!=typeof performance?performance.now():de+16,t=Math.max(0,(e-de)/1e3),n=0,r=he;n<r.length;n++){var a=r[n];me(a,t)}Pe=!1,G.bindFramebuffer(G.FRAMEBUFFER,null),G.useProgram(ae),G.viewport(0,0,L.width,L.height),G.clearColor(0,0,0,0),G.clear(G.COLOR_BUFFER_BIT);var o={res:[L.width,L.height],mouse:[De[0],De[1]],time:e/1e3,t:se,drivers:[],dyn:[]};if(ze.length>0){Oe+=(Le-Oe)*(1-Math.exp(8*-t));for(var i={mouseX:De[0],mouseY:De[1],w:L.width,h:L.height,t:e/1e3,hover:Oe,scroll:Ne()},s=0,c=ze;s<c.length;s++){var l=c[s],u=l.fn(i);o.drivers.push({i:l.i,x:u.x,y:u.y,amt:u.amt})}}if(fe.length>0)for(var f={w:L.width,h:L.height,mouseX:De[0],mouseY:De[1],dt:t,t:e/1e3},d=0,h=fe;d<h.length;d++){var m=h[d];o.dyn.push({i:m.i,ups:m.def.tick(m.state,f)})}Xe=o,je(oe,o),de=e,G.drawArrays(G.TRIANGLES,0,3)}We=requestAnimationFrame(st)}},ct=null;"undefined"!=typeof IntersectionObserver&&(ct=new IntersectionObserver(function(e){var t=l(e,1)[0];it=t.isIntersecting})).observe(e);var lt=null,ut=0,ft=function(){if(!be){var e=p();if(!(e.width<2||e.height<2)){var t=Math.round(e.width*b),n=Math.round(e.height*b);v.width=e.width,v.height=e.height,L.style.width=e.width+"px",L.style.height=e.height+"px";var r=L.width!==t||L.height!==n;r&&(L.width=t,L.height=n),"snapshot"===we?Se():r&&Me()}}};"undefined"!=typeof ResizeObserver&&(lt=new ResizeObserver(function(){"live"!==we&&(function(){if(!be){var e=p();e.width<2||e.height<2||Math.round(e.width)===Math.round(v.width)&&Math.round(e.height)===Math.round(v.height)||(v.width=e.width,v.height=e.height,L.style.width=e.width+"px",L.style.height=e.height+"px")}}(),clearTimeout(ut),ut=setTimeout(ft,150))})).observe(e);var dt=0,ht=function(){clearTimeout(dt),dt=setTimeout(function(){if(!be)if("snapshot"!==we){var t=e.clientWidth||e.parentElement&&e.parentElement.clientWidth||v.width;L.style.width=t+"px",setTimeout(function(){if(!be&&"live"===we){var e=Math.max(2,Math.round(V.getBoundingClientRect().height))||v.height;v.width=t,v.height=e,L.style.height=e+"px",L.width=Math.round(t*b),L.height=Math.round(e*b),Me()}},50)}else ft()},150)};"undefined"!=typeof window&&window.addEventListener("resize",ht),"live"===we?We=requestAnimationFrame(st):(Se().then(function(){We=requestAnimationFrame(st)}),"undefined"!=typeof document&&document.fonts&&"object"===s(document.fonts.ready)&&Promise.resolve(document.fonts.ready).then(ft).catch(function(){}));var mt=function(t,n,r,a,o){"function"==typeof CustomEvent&&"undefined"!=typeof document&&document.dispatchEvent(new CustomEvent("nodality:raster-param",{detail:{pipeline:pt,el:e,index:t,key:n,value:r,prev:a,how:o}}))},pt={canvas:L,nodes:t,get backend(){return we},sourceAt:function(e,t,n){return He(e,t,n)},get progress(){return se},setProgress:function(e){var t=Math.min(1,Math.max(0,Number(e)||0));return t===se||(se=t,ce.length&&(G.useProgram(ae),le(oe,ue),Ge&&!Ge.broken&&(G.useProgram(Ge.prog),le(Ge.U,ue),G.useProgram(ae))),Re()),se},setParam:function(e,n,r){var a=t[e];if(!a||be)return!1;var o=a[n];if(a[n]=r,function(e,t,n,r){if(N.includes(t))return!0;var a=m[e];if(!a)return!0;if((a.structural||[]).includes(t))return!0;if((a.structuralOnToggle||[]).includes(t))return!n!=!r;if(a.uniforms)try{if(t in a.uniforms(Object.assign({op:e},function(e,t,n){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},t,n)),1))return!1}catch(e){}return!0}(a.op,n,r,o))return pt.rebuild(),mt(e,n,r,o,"rebuild"),"rebuild";var i=m[a.op];if(i&&i.uniforms){var c=i.uniforms(a,b);for(var l in G.useProgram(ae),c)ie(oe("u".concat(e,"_").concat(l)),c[l][0],c[l][1]);if(Ge&&!Ge.broken){for(var u in G.useProgram(Ge.prog),c)ie(Ge.U("u".concat(e,"_").concat(u)),c[u][0],c[u][1]);G.useProgram(ae)}}return mt(e,n,r,o,"uniform"),"uniform"},rebuild:function(){if(be)return null;var t=e;return pt.destroy(),X(t,r)}};return z.add(pt),Object.assign(pt,{refresh:function(){return"live"===we?Me():Se()},destroy:function(){z.delete(pt),be=!0,cancelAnimationFrame(We),clearTimeout(ut),clearTimeout(dt),ct&&ct.disconnect(),lt&&lt.disconnect(),"undefined"!=typeof window&&window.removeEventListener("resize",ht),e.removeEventListener("mousemove",Ie),e.removeEventListener("touchmove",Ie);for(var t=0,n=tt;t<n.length;t++){var r=n[t];e.removeEventListener(r,et,!0)}e.removeEventListener("pointerleave",nt,!0),Qe(null),e.removeEventListener("mouseenter",Ue),e.removeEventListener("mouseleave",Be),L.removeEventListener("paint",Me);for(var a=0,o=he;a<o.length;a++){var i=o[a];for(var s in i.cleanup(),i.progs)G.deleteProgram(i.progs[s].prog)}for(he.length=0,Ge&&!Ge.broken&&(G.deleteProgram(Ge.prog),G.deleteFramebuffer(Ge.fbo),G.deleteTexture(Ge.tex)),Ge=null,ge&&(G.deleteTexture(ge),ge=null),xe&&(G.deleteTexture(xe),xe=null);V!==e&&V.firstChild;)e.appendChild(V.firstChild);Ae(),e.style.visibility="",L.remove()}})}function j(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,a,o,i,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||q(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 G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=q(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,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,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function q(e,t){if(e){if("string"==typeof e)return H(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)?H(e,t):void 0}}function H(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 Y(e){return Y="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},Y(e)}function V(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,K(r.key),r)}}function K(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var $=new Set;function Z(){$.clear()}var Q=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+" "}),m="transform ".concat(h,", opacity ").concat(h);a.res.style.transition=m}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=K(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=X(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"===Y(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=G(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:"vars",value:function(e){if(!e||"object"!==Y(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 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.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"===Y(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,a=null!==(n=e.border.color)&&void 0!==n?n:"#2ECC71";t.res.style.border=r?"".concat(r,"px solid ").concat(a):"1px solid #2ECC71"}if(null!=e.scale||null!=e.transform){var o=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(o).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 a=function(){if("trn"!==e.value){var a=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:e.valMin,max:e.valMax});"opacity"===e.value?t.res.style.opacity=a:"scale"===e.value&&(t.res.style.transform="scale(".concat(a,")"))}else{for(var o={},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});o[c]="".concat(h).concat(f.unit)}}r(o)}};this._on(window,"scroll",a),0===e.from&&a()}},{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 a={default:[0,1e5],xs:[0,575],sm:[576,767],md:[768,991],lg:[992,1199],xl:[1200,1399],xxl:[1400,1e5]},o=["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!==a[e.breakpoint]?e.range=a[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:a.default},t.unshift(c));var l=new Set;t.forEach(function(e){Object.keys(e).forEach(function(e){o.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(),a=c,i=0;i<t.length;i++){var u=t[i],f=j(u.range,2),d=f[0],h=f[1];if("default"!==u.breakpoint&&n>=d&&n<=h){a=u;break}}for(var m 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]}),a)if("exact"!==m){if(!o.includes(m)&&"range"!==m){var p=a[m];"keySet"===m&&p&&p.key?r.res.style[p.key]=p.value:"function"==typeof r[m]?r[m](p):r.res.style[s(m)]=p}}else r.res.style.fontSize=a[m]}),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 a=t.find(function(e){return"default"===e.breakpoint});a||(a={breakpoint:"default",range:r.default},t.unshift(a)),void 0===a.values&&(a.values=this.options&&this.options.pad||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),o=a,i=0;i<t.length;i++){var s=t[i],c=j(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){o=s;break}}var f=void 0!==o.values?o.values:a.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 a=t.find(function(e){return"default"===e.breakpoint});a||(a={breakpoint:"default",range:r.default},t.unshift(a)),void 0===a.values&&(a.values=this.options&&(this.options.mar||this.options.pad)||null),this._responsiveTasks=this._responsiveTasks||[],this._responsiveTasks.push(function(){for(var r=e.viewportWidth(),o=a,i=0;i<t.length;i++){var s=t[i],c=j(s.range,2),l=c[0],u=c[1];if("default"!==s.breakpoint&&r>=l&&r<=u){o=s;break}}var f=void 0!==o.values?o.values:a.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){var n="nodality: `".concat(e,"` is deprecated — use `").concat(t,"` instead.");return $.has(n)||($.add(n),console.error(n)),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||"",a=n.flexDirection||t.flexDirection||"",o=!0===e||"both"===e||"x"===e,i=!0===e||"both"===e||"y"===e;if(r.includes("grid"))return o&&(n.justifyItems="center",n.justifyContent="center"),i&&(n.alignItems="center",n.alignContent="center"),this;r.includes("flex")||(n.display="flex"),n.flexDirection||(n.flexDirection=a||"column");var s=(n.flexDirection||"column").startsWith("column");return(s?i:o)&&(n.justifyContent="center"),(s?o: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 a=n[r],o=e[t][a],i=0;i<a.length;i++)switch(a[i]){case"a":this.res.style.padding=this.isNumber(o)?"".concat(o,"px"):o;break;case"t":this.res.style.paddingTop=this.isNumber(o)?"".concat(o,"px"):o;break;case"l":this.res.style.paddingLeft=this.isNumber(o)?"".concat(o,"px"):o;break;case"r":this.res.style.paddingRight=this.isNumber(o)?"".concat(o,"px"):o;break;case"b":this.res.style.paddingBottom=this.isNumber(o)?"".concat(o,"px"):o}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 a=n[r],o=e[t][a],i=0;i<a.length;i++)switch(a[i]){case"a":"auto"===o?(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"):this.res.style.margin=this.isNumber(o)?"".concat(o,"px"):o;break;case"t":this.res.style.marginTop=this.isNumber(o)?"".concat(o,"px"):o;break;case"l":this.res.style.marginLeft=this.isNumber(o)?"".concat(o,"px"):o;break;case"r":this.res.style.marginRight=this.isNumber(o)?"".concat(o,"px"):o;break;case"b":this.res.style.marginBottom=this.isNumber(o)?"".concat(o,"px"):o}"center"===a&&!0===o&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"),"auto"===o&&(a.includes("l")||a.includes("r"))&&(a.includes("l")&&(this.res.style.marginLeft="auto"),a.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 a=document.createTextNode(this.text);this.res.appendChild(a),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 o=document.createTextNode(this.text);this.res.appendChild(o),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 a=this;this.ap=!1,this.cta=0,this.once=!1;var o,i=G(t);try{for(i.s();!(o=i.n()).done;){var s=o.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(o){var i=e.viewportWidth(),s=[],c=[];a.resCopy=a.res,a.storedQueries=t.map(function(e){return e.target}).filter(function(e){return null!=e});var l,u=G(t);try{for(u.s();!(l=u.n()).done;){var f=l.value;a.counterIndex++;var d=j(f.range,2),h=d[0],m=d[1],p=parseInt(h),v=parseInt(m),y=!0;if(f.target){y=!1;for(var g=0;g<f.target.length;g++){var x=function(e){return"string"==typeof e&&"#"===e.charAt(0)?e.slice(1):e};x(f.target[g])===x(n)&&(y=!0)}}i>=p&&i<=v&&y&&(s.push(f.log),c.push(f),f.op&&f.op.margin&&(a.useMargin=f.op.margin))}}catch(e){u.e(e)}finally{u.f()}if(r&&!r.includes("background")&&(a.res.style.background="",a.res.style.backgroundColor=""),a.res.style.textShadow="",r&&!r.includes("border")&&(a.res.style.border=""),r&&!r.includes("margin")&&(a.res.style.margin=""),a.res.style["-webkit-text-fill-color"]="",a.res.style["-webkit-text-stroke-color"]="",a.res.style["-webkit-text-stroke-width"]="",a.res.style.filter="",a.options.background&&(a.res.style.background=a.options.background),s.includes("gradient"),(s.includes("gradient")||s.includes("shadow"))&&(a.res.style.position="relative"),s.includes("blast")){var b,w=c.filter(function(e){return"blast"===e.log})[0].op.color,_=null!==(b=c.filter(function(e){return"blast"===e.log})[0].op.width)&&void 0!==b?b:"1px";"FlexRowLayoutElement"===a.getType()||"LayoutWrapperElement"===a.getType()?(a.res.style.border="".concat("number"==typeof _?_+"px":_," solid orange"),a.res.style.display="inline-block","FlexRowLayoutElement"===a.getType()&&(a.res.style.display="flex"),a.res.style.boxSizing="border-box",a.res.style.transformOrigin="center",a.blastTarget=a.res):(a.text,a.res.style["-webkit-text-fill-color"]="transparent",a.res.style["-webkit-text-stroke-color"]=w,a.res.style["-webkit-text-stroke-width"]="".concat(_))}if(s.includes("filter")){var E=c.filter(function(e){return"filter"===e.log})[0].op.filter;a.res.style.filter=E}if(s.includes("background")&&(a.res.style.backgroundColor="green"),s.includes("gradient")&&a.globalGradient&&("LayoutWrapperElement"!==a.getType()&&"FlexRowLayoutElement"!==a.getType()&&(a.res.style["-webkit-text-fill-color"]="transparent"),a.res.style.background=a.globalGradient,"LayoutWrapperElement"!==a.getType()&&"FlexRowLayoutElement"!==a.getType()&&(a.res.style["background-clip"]="text")),s.includes("shadow")){var T,k,A,R,S=a.options.shadow.op,F=null!==(T=S.steps)&&void 0!==T?T:1,M=null!==(k=S.colors)&&void 0!==k?k:["gray"],C=null!==(A=S.movements)&&void 0!==A?A:["3px","3px"],D=null!==(R=S.radius)&&void 0!==R?R:"3px";if(1===C.length&&(C=[C[0],C[0]]),"FlexRowLayoutElement"===a.getType()||"LayoutWrapperElement"===a.getType()){for(var P=[],I=0;I<F;I++){var L,O=null!==(L=M[I])&&void 0!==L?L:M[0],U=C[0],B=C[1];P.push("".concat(U," ").concat(B," ").concat(D," ").concat(O))}a.res.style.boxShadow=P.join(", ")}else{for(var z=[],N=0;N<F;N++){var W,X=null!==(W=M[N])&&void 0!==W?W:M[0],q=C[0],H=C[1];z.push("drop-shadow(".concat(q," ").concat(H," ").concat(D," ").concat(X,")"))}a.res.style.filter=z.join(" ")}}if(s.includes("margin"))for(g=0;g<t.length;g++)if(t[g].op){var Y=t[g].op.offsets;Y&&void 0!==a.index&&(a.res.style.margin=Y[Number(a.index)]+"px")}if(s.includes("spana")||s.includes("span")){var V=document.createElement("div");if(V.setAttribute("id","oroa"),Object.assign(V.style,{position:"absolute",inset:"0",background:"linear-gradient(90deg, rgb(52,152,219), rgb(26,188,156))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",pointerEvents:"none"}),a.res&&a.res.querySelector("span"))return;a.res=a.resCopy,a.res.textContent="",a.options.span&&(Array.isArray(a.options.span)?a.options.span:[a.options.span]).forEach(function(e){if(e.op&&"span"===e.op.name&&Array.isArray(e.op.parts)){var t=0,n=a.prevText||"";if(e.op.parts.forEach(function(e){var r=e.text,o=e.style||{};if(t<n.length){var i=n.indexOf(r,t);if(i>t){var s=n.substring(t,i);a.res.appendChild(new a.constructor(s).setup({type:"span",id:o.id,animation:o.animation}).set({}).render())}t=i+r.length}var c=new a.constructor(r).setup({type:"span",id:o.id,animation:o.animation}).set(o).render();a.res.appendChild(c)}),t<n.length){var r=n.substring(t);a.res.appendChild(new a.constructor(r).setup({type:"span"}).set({}).render())}}})}else{var K=new a.constructor(a.prevText).set({}).render();a.prevText&&a.prevText.length>0&&o&&a.res.appendChild(K)}if(s.includes("animation")){if(a.options.animation&&!a.hasAnimated&&!a.options.animation.op.fireAt){a.hasAnimated=!0;var $=a.options.animation.op;a._on(window,"sidebar:open",function(){a.res.animate($.keyframesOpen,$.openOptions)}),a._on(window,"sidebar:closed",function(){a.res.animate($.keyframesClose,$.closeOptions)}),a.res.animate($.keyframesClose,{duration:0,fill:"forwards"}),a.openTag&&a.closeTag&&(a._on(window,a.openTag,function(){a.res.animate($.keyframesOpen,$.openOptions)}),a._on(window,a.closeTag,function(){a.res.animate($.keyframesClose,$.closeOptions)}))}if(a.options.animation&&a.options.animation.op.fireAt&&a.options.animation.op.fireAt.endsWith("px")){var Z=a.options.animation.op;a.res.animate(Z.keyframesClose,{duration:0,fill:"forwards"});var Q=function(){window.scrollY>parseFloat(Z.fireAt)&&(a.res.animate(Z.keyframesOpen,Z.openOptions),window.removeEventListener("scroll",Q))};a._on(window,"scroll",Q)}if(a.options.animation&&"inview"===a.options.animation.op.fireAt){var J=a.options.animation.op;a.res.animate(J.keyframesClose,{duration:0,fill:"forwards"});var ee=!1,te=new IntersectionObserver(function(e,t){e.forEach(function(e){e.isIntersecting&&!ee&&(ee=!0,a.res.animate(J.keyframesOpen,J.openOptions),t.disconnect())})});te.observe(a.res),a._track(function(){return te.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(new RegExp('"([A-Za-z_$][A-Za-z0-9_$]*)"\\s*:',"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&&V(t.prototype,n),r&&V(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();module.exports=t})();