@toclocoinc/lattice-grid 1.86.4 → 1.86.5

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 (306) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +4 -4
  5. package/docs/api/adapters.html +1 -1
  6. package/docs/api/ai.html +1 -1
  7. package/docs/api/alarms.html +1 -1
  8. package/docs/api/calendar.html +1 -1
  9. package/docs/api/charts.html +1 -1
  10. package/docs/api/dashboard.html +1 -1
  11. package/docs/api/data-router.html +1 -1
  12. package/docs/api/deckgl.html +1 -1
  13. package/docs/api/gantt.html +1 -1
  14. package/docs/api/geometry.html +1 -1
  15. package/docs/api/grid.html +2 -2
  16. package/docs/api/index.html +1 -1
  17. package/docs/api/kanban.html +1 -1
  18. package/docs/api/kpi.html +1 -1
  19. package/docs/api/layout.html +1 -1
  20. package/docs/api/leaflet.html +1 -1
  21. package/docs/api/list.html +1 -1
  22. package/docs/api/mapview.html +1 -1
  23. package/docs/api/mock-socket.html +1 -1
  24. package/docs/api/presets.html +1 -1
  25. package/docs/api/tabs.html +1 -1
  26. package/docs/api/types.html +1 -1
  27. package/docs/api-detail.html +4 -4
  28. package/docs/warnings.json +1 -1
  29. package/lattice-grid.d.ts +1 -1
  30. package/lattice-grid.esm.min.js +3 -3
  31. package/lattice-grid.min.cjs +3 -3
  32. package/lattice-grid.min.css +1 -1
  33. package/lattice-grid.min.js +3 -3
  34. package/modules/ai.d.ts +1 -1
  35. package/modules/ai.esm.min.js +2 -2
  36. package/modules/ai.min.cjs +2 -2
  37. package/modules/ai.min.js +2 -2
  38. package/modules/alarms.d.ts +1 -1
  39. package/modules/alarms.esm.min.js +2 -2
  40. package/modules/alarms.min.cjs +2 -2
  41. package/modules/alarms.min.js +2 -2
  42. package/modules/angular.d.ts +1 -1
  43. package/modules/angular.esm.min.js +2 -2
  44. package/modules/angular.min.cjs +2 -2
  45. package/modules/angular.min.js +2 -2
  46. package/modules/calendar.d.ts +1 -1
  47. package/modules/calendar.esm.min.js +2 -2
  48. package/modules/calendar.min.cjs +2 -2
  49. package/modules/calendar.min.js +2 -2
  50. package/modules/chart-alluvial.d.ts +1 -1
  51. package/modules/chart-alluvial.esm.min.js +1 -1
  52. package/modules/chart-alluvial.min.cjs +1 -1
  53. package/modules/chart-alluvial.min.js +1 -1
  54. package/modules/chart-arc.d.ts +1 -1
  55. package/modules/chart-arc.esm.min.js +1 -1
  56. package/modules/chart-arc.min.cjs +1 -1
  57. package/modules/chart-arc.min.js +1 -1
  58. package/modules/chart-barrace.d.ts +1 -1
  59. package/modules/chart-barrace.esm.min.js +1 -1
  60. package/modules/chart-barrace.min.cjs +1 -1
  61. package/modules/chart-barrace.min.js +1 -1
  62. package/modules/chart-bubblemap.d.ts +1 -1
  63. package/modules/chart-bubblemap.esm.min.js +1 -1
  64. package/modules/chart-bubblemap.min.cjs +1 -1
  65. package/modules/chart-bubblemap.min.js +1 -1
  66. package/modules/chart-bump.d.ts +1 -1
  67. package/modules/chart-bump.esm.min.js +1 -1
  68. package/modules/chart-bump.min.cjs +1 -1
  69. package/modules/chart-bump.min.js +1 -1
  70. package/modules/chart-calendar.d.ts +1 -1
  71. package/modules/chart-calendar.esm.min.js +1 -1
  72. package/modules/chart-calendar.min.cjs +1 -1
  73. package/modules/chart-calendar.min.js +1 -1
  74. package/modules/chart-choropleth.d.ts +1 -1
  75. package/modules/chart-choropleth.esm.min.js +1 -1
  76. package/modules/chart-choropleth.min.cjs +1 -1
  77. package/modules/chart-choropleth.min.js +1 -1
  78. package/modules/chart-decomposition.d.ts +1 -1
  79. package/modules/chart-decomposition.esm.min.js +1 -1
  80. package/modules/chart-decomposition.min.cjs +1 -1
  81. package/modules/chart-decomposition.min.js +1 -1
  82. package/modules/chart-diverging.d.ts +1 -1
  83. package/modules/chart-diverging.esm.min.js +1 -1
  84. package/modules/chart-diverging.min.cjs +1 -1
  85. package/modules/chart-diverging.min.js +1 -1
  86. package/modules/chart-dumbbell.d.ts +1 -1
  87. package/modules/chart-dumbbell.esm.min.js +1 -1
  88. package/modules/chart-dumbbell.min.cjs +1 -1
  89. package/modules/chart-dumbbell.min.js +1 -1
  90. package/modules/chart-fan.d.ts +1 -1
  91. package/modules/chart-fan.esm.min.js +1 -1
  92. package/modules/chart-fan.min.cjs +1 -1
  93. package/modules/chart-fan.min.js +1 -1
  94. package/modules/chart-forcetree.d.ts +1 -1
  95. package/modules/chart-forcetree.esm.min.js +2 -2
  96. package/modules/chart-forcetree.esm.min.js.map +2 -2
  97. package/modules/chart-forcetree.min.cjs +2 -2
  98. package/modules/chart-forcetree.min.js +2 -2
  99. package/modules/chart-forcetree.min.js.map +2 -2
  100. package/modules/chart-hexbin.d.ts +1 -1
  101. package/modules/chart-hexbin.esm.min.js +2 -2
  102. package/modules/chart-hexbin.esm.min.js.map +1 -1
  103. package/modules/chart-hexbin.min.cjs +2 -2
  104. package/modules/chart-hexbin.min.js +2 -2
  105. package/modules/chart-hexbin.min.js.map +1 -1
  106. package/modules/chart-hexmap.d.ts +1 -1
  107. package/modules/chart-hexmap.esm.min.js +1 -1
  108. package/modules/chart-hexmap.min.cjs +1 -1
  109. package/modules/chart-hexmap.min.js +1 -1
  110. package/modules/chart-icicle.d.ts +1 -1
  111. package/modules/chart-icicle.esm.min.js +1 -1
  112. package/modules/chart-icicle.min.cjs +1 -1
  113. package/modules/chart-icicle.min.js +1 -1
  114. package/modules/chart-markermap.d.ts +1 -1
  115. package/modules/chart-markermap.esm.min.js +1 -1
  116. package/modules/chart-markermap.min.cjs +1 -1
  117. package/modules/chart-markermap.min.js +1 -1
  118. package/modules/chart-motion.d.ts +1 -1
  119. package/modules/chart-motion.esm.min.js +1 -1
  120. package/modules/chart-motion.min.cjs +1 -1
  121. package/modules/chart-motion.min.js +1 -1
  122. package/modules/chart-pack.d.ts +1 -1
  123. package/modules/chart-pack.esm.min.js +1 -1
  124. package/modules/chart-pack.min.cjs +1 -1
  125. package/modules/chart-pack.min.js +1 -1
  126. package/modules/chart-parallel.d.ts +1 -1
  127. package/modules/chart-parallel.esm.min.js +1 -1
  128. package/modules/chart-parallel.min.cjs +1 -1
  129. package/modules/chart-parallel.min.js +1 -1
  130. package/modules/chart-pictorial.d.ts +1 -1
  131. package/modules/chart-pictorial.esm.min.js +1 -1
  132. package/modules/chart-pictorial.min.cjs +1 -1
  133. package/modules/chart-pictorial.min.js +1 -1
  134. package/modules/chart-polararea.d.ts +1 -1
  135. package/modules/chart-polararea.esm.min.js +1 -1
  136. package/modules/chart-polararea.min.cjs +1 -1
  137. package/modules/chart-polararea.min.js +1 -1
  138. package/modules/chart-polarscatter.d.ts +1 -1
  139. package/modules/chart-polarscatter.esm.min.js +1 -1
  140. package/modules/chart-polarscatter.min.cjs +1 -1
  141. package/modules/chart-polarscatter.min.js +1 -1
  142. package/modules/chart-pyramid.d.ts +1 -1
  143. package/modules/chart-pyramid.esm.min.js +1 -1
  144. package/modules/chart-pyramid.min.cjs +1 -1
  145. package/modules/chart-pyramid.min.js +1 -1
  146. package/modules/chart-radialbar.d.ts +1 -1
  147. package/modules/chart-radialbar.esm.min.js +1 -1
  148. package/modules/chart-radialbar.min.cjs +1 -1
  149. package/modules/chart-radialbar.min.js +1 -1
  150. package/modules/chart-ridgeline.d.ts +1 -1
  151. package/modules/chart-ridgeline.esm.min.js +1 -1
  152. package/modules/chart-ridgeline.min.cjs +1 -1
  153. package/modules/chart-ridgeline.min.js +1 -1
  154. package/modules/chart-roc.d.ts +1 -1
  155. package/modules/chart-roc.esm.min.js +1 -1
  156. package/modules/chart-roc.min.cjs +1 -1
  157. package/modules/chart-roc.min.js +1 -1
  158. package/modules/chart-serpentine.d.ts +1 -1
  159. package/modules/chart-serpentine.esm.min.js +1 -1
  160. package/modules/chart-serpentine.min.cjs +1 -1
  161. package/modules/chart-serpentine.min.js +1 -1
  162. package/modules/chart-slope.d.ts +1 -1
  163. package/modules/chart-slope.esm.min.js +1 -1
  164. package/modules/chart-slope.min.cjs +1 -1
  165. package/modules/chart-slope.min.js +1 -1
  166. package/modules/chart-spiral.d.ts +1 -1
  167. package/modules/chart-spiral.esm.min.js +1 -1
  168. package/modules/chart-spiral.min.cjs +1 -1
  169. package/modules/chart-spiral.min.js +1 -1
  170. package/modules/chart-splom.d.ts +1 -1
  171. package/modules/chart-splom.esm.min.js +1 -1
  172. package/modules/chart-splom.min.cjs +1 -1
  173. package/modules/chart-splom.min.js +1 -1
  174. package/modules/chart-tree.d.ts +1 -1
  175. package/modules/chart-tree.esm.min.js +2 -2
  176. package/modules/chart-tree.esm.min.js.map +2 -2
  177. package/modules/chart-tree.min.cjs +2 -2
  178. package/modules/chart-tree.min.js +2 -2
  179. package/modules/chart-tree.min.js.map +2 -2
  180. package/modules/chart-venn.d.ts +1 -1
  181. package/modules/chart-venn.esm.min.js +1 -1
  182. package/modules/chart-venn.min.cjs +1 -1
  183. package/modules/chart-venn.min.js +1 -1
  184. package/modules/chart-voronoi.d.ts +1 -1
  185. package/modules/chart-voronoi.esm.min.js +1 -1
  186. package/modules/chart-voronoi.min.cjs +1 -1
  187. package/modules/chart-voronoi.min.js +1 -1
  188. package/modules/chart-waffle.d.ts +1 -1
  189. package/modules/chart-waffle.esm.min.js +1 -1
  190. package/modules/chart-waffle.min.cjs +1 -1
  191. package/modules/chart-waffle.min.js +1 -1
  192. package/modules/chart-wordcloud.d.ts +1 -1
  193. package/modules/chart-wordcloud.esm.min.js +1 -1
  194. package/modules/chart-wordcloud.min.cjs +1 -1
  195. package/modules/chart-wordcloud.min.js +1 -1
  196. package/modules/charts.d.ts +1 -1
  197. package/modules/charts.esm.min.js +235 -235
  198. package/modules/charts.esm.min.js.map +2 -2
  199. package/modules/charts.min.cjs +235 -235
  200. package/modules/charts.min.js +235 -235
  201. package/modules/charts.min.js.map +2 -2
  202. package/modules/dashboard.d.ts +1 -1
  203. package/modules/dashboard.esm.min.js +2 -2
  204. package/modules/dashboard.min.cjs +2 -2
  205. package/modules/dashboard.min.js +2 -2
  206. package/modules/data-router.d.ts +1 -1
  207. package/modules/data-router.esm.min.js +2 -2
  208. package/modules/data-router.min.cjs +2 -2
  209. package/modules/data-router.min.js +2 -2
  210. package/modules/deckgl.d.ts +1 -1
  211. package/modules/deckgl.esm.min.js +2 -2
  212. package/modules/deckgl.min.cjs +2 -2
  213. package/modules/deckgl.min.js +2 -2
  214. package/modules/devtools.d.ts +1 -1
  215. package/modules/devtools.esm.min.js +1 -1
  216. package/modules/devtools.min.cjs +1 -1
  217. package/modules/devtools.min.js +1 -1
  218. package/modules/dhtmlx-compat.d.ts +1 -1
  219. package/modules/dhtmlx-compat.esm.min.js +2 -2
  220. package/modules/dhtmlx-compat.min.cjs +2 -2
  221. package/modules/dhtmlx-compat.min.js +2 -2
  222. package/modules/gantt.d.ts +1 -1
  223. package/modules/gantt.esm.min.js +2 -2
  224. package/modules/gantt.min.cjs +2 -2
  225. package/modules/gantt.min.js +2 -2
  226. package/modules/geo-europe-nuts.d.ts +1 -1
  227. package/modules/geo-europe-nuts.esm.min.js +1 -1
  228. package/modules/geo-europe-nuts.min.cjs +1 -1
  229. package/modules/geo-europe-nuts.min.js +1 -1
  230. package/modules/geo-uk.d.ts +1 -1
  231. package/modules/geo-uk.esm.min.js +1 -1
  232. package/modules/geo-uk.min.cjs +1 -1
  233. package/modules/geo-uk.min.js +1 -1
  234. package/modules/geo-us-states.d.ts +1 -1
  235. package/modules/geo-us-states.esm.min.js +1 -1
  236. package/modules/geo-us-states.min.cjs +1 -1
  237. package/modules/geo-us-states.min.js +1 -1
  238. package/modules/geo-world-110m.d.ts +1 -1
  239. package/modules/geo-world-110m.esm.min.js +1 -1
  240. package/modules/geo-world-110m.min.cjs +1 -1
  241. package/modules/geo-world-110m.min.js +1 -1
  242. package/modules/geo-world-50m.d.ts +1 -1
  243. package/modules/geo-world-50m.esm.min.js +1 -1
  244. package/modules/geo-world-50m.min.cjs +1 -1
  245. package/modules/geo-world-50m.min.js +1 -1
  246. package/modules/geometry.d.ts +1 -1
  247. package/modules/geometry.esm.min.js +2 -2
  248. package/modules/geometry.min.cjs +2 -2
  249. package/modules/geometry.min.js +2 -2
  250. package/modules/htmx.d.ts +1 -1
  251. package/modules/htmx.esm.min.js +3 -3
  252. package/modules/htmx.min.cjs +3 -3
  253. package/modules/htmx.min.js +3 -3
  254. package/modules/kanban.d.ts +1 -1
  255. package/modules/kanban.esm.min.js +2 -2
  256. package/modules/kanban.min.cjs +2 -2
  257. package/modules/kanban.min.js +2 -2
  258. package/modules/kpi.d.ts +1 -1
  259. package/modules/kpi.esm.min.js +2 -2
  260. package/modules/kpi.min.cjs +2 -2
  261. package/modules/kpi.min.js +2 -2
  262. package/modules/layout.d.ts +1 -1
  263. package/modules/layout.esm.min.js +2 -2
  264. package/modules/layout.min.cjs +2 -2
  265. package/modules/layout.min.js +2 -2
  266. package/modules/leaflet.d.ts +1 -1
  267. package/modules/leaflet.esm.min.js +2 -2
  268. package/modules/leaflet.min.cjs +2 -2
  269. package/modules/leaflet.min.js +2 -2
  270. package/modules/list.d.ts +1 -1
  271. package/modules/list.esm.min.js +2 -2
  272. package/modules/list.min.cjs +2 -2
  273. package/modules/list.min.js +2 -2
  274. package/modules/mapview.d.ts +1 -1
  275. package/modules/mapview.esm.min.js +2 -2
  276. package/modules/mapview.min.cjs +2 -2
  277. package/modules/mapview.min.js +2 -2
  278. package/modules/mock-socket.d.ts +1 -1
  279. package/modules/mock-socket.esm.min.js +1 -1
  280. package/modules/mock-socket.min.cjs +1 -1
  281. package/modules/mock-socket.min.js +1 -1
  282. package/modules/presets.d.ts +1 -1
  283. package/modules/presets.esm.min.js +2 -2
  284. package/modules/presets.min.cjs +2 -2
  285. package/modules/presets.min.js +2 -2
  286. package/modules/react.d.ts +1 -1
  287. package/modules/react.esm.min.js +2 -2
  288. package/modules/react.min.cjs +2 -2
  289. package/modules/react.min.js +2 -2
  290. package/modules/svelte.d.ts +1 -1
  291. package/modules/svelte.esm.min.js +2 -2
  292. package/modules/svelte.min.cjs +2 -2
  293. package/modules/svelte.min.js +2 -2
  294. package/modules/tabs.d.ts +1 -1
  295. package/modules/tabs.esm.min.js +2 -2
  296. package/modules/tabs.min.cjs +2 -2
  297. package/modules/tabs.min.js +2 -2
  298. package/modules/vue.d.ts +1 -1
  299. package/modules/vue.esm.min.js +2 -2
  300. package/modules/vue.min.cjs +2 -2
  301. package/modules/vue.min.js +2 -2
  302. package/modules/webcomponent.d.ts +1 -1
  303. package/modules/webcomponent.esm.min.js +3 -3
  304. package/modules/webcomponent.min.cjs +3 -3
  305. package/modules/webcomponent.min.js +3 -3
  306. package/package.json +1 -1
package/modules/ai.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, ai module type declarations
2
+ * Lattice Grid 1.86.5, ai module type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, ai module
2
+ * Lattice Grid 1.86.5, ai module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.4";async function P(){return h}const L="1.86.4",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
6
+ var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.5";async function P(){return h}const L="1.86.5",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
7
7
  `||e==="\r"}function Y(e){const c=[],i=[];for(let p=0;p<e.length;p+=1)if(e[p]==="(")i.push(p);else if(e[p]===")"&&i.length){const r=i.pop();i.length===0&&c.push({start:r,end:p+1})}return c}function b(e){const c=[],i=e.length;let p=0,r=0;for(;r<i;){const d=e[r],v=d==="."||d==="!"||d==="?",n=r+1>=i||E(e[r+1]);if(v&&n||d===`
8
8
  `){let a=r+1;for(;a<i&&(e[a]==="."||e[a]==="!"||e[a]==="?");)a+=1;for(;a<i&&E(e[a]);)a+=1;c.push({start:p,end:a}),p=a,r=a;continue}r+=1}return p<i&&c.push({start:p,end:i}),c}function o(e){const c=e.slice().sort((p,r)=>p.start-r.start),i=[];for(const p of c){const r=i[i.length-1];r&&p.start<=r.end?r.end=Math.max(r.end,p.end):i.push({start:p.start,end:p.end})}return i}function t(e){return e.replace(/\(\s*\)/g,"").replace(/[ \t]{2,}/g," ").replace(/[ \t]+([,.;:!?)])/g,"$1").replace(/([([])[ \t]+/g,"$1").replace(/(^|[.!?\n])[ \t]*[.;:,!?]+(?=[ \t]|$|\n)/g,"$1").replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
9
9
  `).replace(/\n{3,}/g,`
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, ai module
2
+ * Lattice Grid 1.86.5, ai module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(Oe){"use strict";var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.4";async function P(){return h}const L="1.86.4",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
6
+ (function(Oe){"use strict";var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.5";async function P(){return h}const L="1.86.5",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
7
7
  `||e==="\r"}function Y(e){const c=[],i=[];for(let p=0;p<e.length;p+=1)if(e[p]==="(")i.push(p);else if(e[p]===")"&&i.length){const r=i.pop();i.length===0&&c.push({start:r,end:p+1})}return c}function b(e){const c=[],i=e.length;let p=0,r=0;for(;r<i;){const d=e[r],v=d==="."||d==="!"||d==="?",n=r+1>=i||E(e[r+1]);if(v&&n||d===`
8
8
  `){let a=r+1;for(;a<i&&(e[a]==="."||e[a]==="!"||e[a]==="?");)a+=1;for(;a<i&&E(e[a]);)a+=1;c.push({start:p,end:a}),p=a,r=a;continue}r+=1}return p<i&&c.push({start:p,end:i}),c}function o(e){const c=e.slice().sort((p,r)=>p.start-r.start),i=[];for(const p of c){const r=i[i.length-1];r&&p.start<=r.end?r.end=Math.max(r.end,p.end):i.push({start:p.start,end:p.end})}return i}function t(e){return e.replace(/\(\s*\)/g,"").replace(/[ \t]{2,}/g," ").replace(/[ \t]+([,.;:!?)])/g,"$1").replace(/([([])[ \t]+/g,"$1").replace(/(^|[.!?\n])[ \t]*[.;:,!?]+(?=[ \t]|$|\n)/g,"$1").replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
9
9
  `).replace(/\n{3,}/g,`
package/modules/ai.min.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, ai module
2
+ * Lattice Grid 1.86.5, ai module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(Oe){"use strict";var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.4";async function P(){return h}const L="1.86.4",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
6
+ (function(Oe){"use strict";var we=Object.create(null),ve=Object.create(null);function de(m,V){we[m]=V}function ke(m){var V=ve[m];if(V)return V;var h=Object.create(null);ve[m]=h;var P=we[m];if(!P)throw new Error("[lattice] missing module: "+m);return P(h,ke),h}de("packages/core/src/internal/util.js",function(m,V){"use strict";Object.defineProperty(m,"VERSION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"reportedWarnings",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(m,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(m,"resetWarnings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(m,"invariant",{enumerable:!0,get:function(){return o}}),Object.defineProperty(m,"DEV",{enumerable:!0,get:function(){return t}}),Object.defineProperty(m,"isObject",{enumerable:!0,get:function(){return l}}),Object.defineProperty(m,"isFunction",{enumerable:!0,get:function(){return u}}),Object.defineProperty(m,"isNil",{enumerable:!0,get:function(){return e}}),Object.defineProperty(m,"isBlank",{enumerable:!0,get:function(){return c}}),Object.defineProperty(m,"isCtor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(m,"pathGetter",{enumerable:!0,get:function(){return r}}),Object.defineProperty(m,"pathSetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(m,"getPath",{enumerable:!0,get:function(){return n}}),Object.defineProperty(m,"setPath",{enumerable:!0,get:function(){return a}}),Object.defineProperty(m,"humanise",{enumerable:!0,get:function(){return f}}),Object.defineProperty(m,"escapeHtml",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return j}}),Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return D}}),Object.defineProperty(m,"mergeRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"Lru",{enumerable:!0,get:function(){return K}}),Object.defineProperty(m,"collator",{enumerable:!0,get:function(){return he}}),Object.defineProperty(m,"defaultCompare",{enumerable:!0,get:function(){return s}}),Object.defineProperty(m,"now",{enumerable:!0,get:function(){return k}}),Object.defineProperty(m,"nextFrame",{enumerable:!0,get:function(){return S}}),Object.defineProperty(m,"cancelFrame",{enumerable:!0,get:function(){return x}}),Object.defineProperty(m,"frameBatched",{enumerable:!0,get:function(){return N}}),Object.defineProperty(m,"settleDebounce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(m,"whenIdle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(m,"uid",{enumerable:!0,get:function(){return le}});const h="1.86.5";async function P(){return h}const L="1.86.5",q=new Set,R=2e3;function U(g){if(q.add(g),q.size>R){const w=q.values().next().value;w!==void 0&&q.delete(w)}}const J=[],G=500;function Q(g,w,$){J.push({key:g,level:w,message:$.map(H=>typeof H=="string"?H:W(H)).join(" "),at:Date.now()}),J.length>G&&J.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function ne(){return J.map(g=>({...g}))}function te(g){if(g.length===0||typeof g[0]!="string")return g;const w=g[0].replace(/^\[lattice\]\s*/,"");return w===g[0]?g:[w,...g.slice(1)]}function M(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"warn",$),console.warn("[lattice]",...$)}function E(g,...w){if(q.has(g))return;U(g);const $=te(w);Q(g,"info",$),console.info("[lattice]",...$)}function Y(){q.clear(),J.length=0}function b(g,w){const $=new Error(`[lattice] ${g}`);throw w!==void 0&&($.cause=w),$}function o(g,w){g||b(w)}const t=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function l(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function u(g){return typeof g=="function"}function e(g){return g==null}function c(g){return g==null||g===""}function i(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const p=new Map;function r(g){let w=p.get(g);if(w)return w;if(!g.includes("."))w=$=>$?.[g];else{const $=g.split("."),H=$.length;w=ce=>{let ue=ce;for(let ae=0;ae<H;ae++){if(ue==null)return;ue=ue[$[ae]]}return ue}}return p.set(g,w),w}const d=new Map;function v(g){let w=d.get(g);if(w)return w;if(!g.includes("."))w=($,H)=>{$!=null&&($[g]=H)};else{const $=g.split("."),H=$.length-1;w=(ce,ue)=>{let ae=ce;for(let _=0;_<H;_++){if(ae==null)return;const F=$[_];ae[F]==null&&(ae[F]={}),ae=ae[F]}ae!=null&&(ae[$[H]]=ue)}}return d.set(g,w),w}function n(g,w){return r(w)(g)}function a(g,w,$){v(w)(g,$)}function f(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,$=>$.toUpperCase()):""}const y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(g){const w=g==null?"":String(g);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$=>y[$]):w}function T(g){return String(g).replace(/\w\S*/g,w=>w[0].toUpperCase()+w.slice(1).toLowerCase())}function j(g,w,$){if(g!==void 0)return g===!0?{enabled:!0,...$}:g===!1?{enabled:!1}:l(g)?g:{[w]:g,enabled:!0}}function z(g){return g==null?[]:Array.isArray(g)?g:[g]}const A=Object.freeze(new Set(["__proto__","constructor","prototype"]));function D(g,w){if(!l(g))return l(w)?{...w}:w;if(!l(w))return w===void 0?g:w;const $={...g};for(const H of Object.keys(w)){if(A.has(H))continue;const ce=w[H];ce!==void 0&&($[H]=l(ce)&&l($[H])?D($[H],ce):ce)}return $}function X(g,w){if(!l(g)||!l(w)||g===w)return w;const $=Object.create(Object.getPrototypeOf(g));return Object.assign($,g,w),$}class K{#t;#e=new Map;#n;constructor(w=256,$=null){this.#t=w,this.#n=$}get size(){return this.#e.size}get max(){return this.#t}set max(w){this.#t=w,this.#r()}has(w){return this.#e.has(w)}get(w){const $=this.#e;if(!$.has(w))return;const H=$.get(w);return $.delete(w),$.set(w,H),H}peek(w){return this.#e.get(w)}set(w,$){const H=this.#e;return H.has(w)&&H.delete(w),H.set(w,$),this.#r(),$}delete(w){const $=this.#e.get(w);return this.#e.delete(w)&&this.#n&&this.#n($,w),$}clear(){if(this.#n)for(const[w,$]of this.#e)this.#n($,w);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const w=this.#e;for(;w.size>this.#t;){const $=w.keys().next().value,H=w.get($);w.delete($),this.#n&&this.#n(H,$)}}}const oe=new Map;function he(g,w){const $=`${g||""}|${w?JSON.stringify(w):""}`;let H=oe.get($);return H||(H=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...w}),oe.set($,H)),H}function s(g,w){if(g===w)return 0;if(g==null)return 1;if(w==null)return-1;if(typeof g=="number"&&typeof w=="number")return Number.isNaN(g)?Number.isNaN(w)?0:1:Number.isNaN(w)||g<w?-1:g>w?1:0;const $=String(g),H=String(w);return $<H?-1:$>H?1:0}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const O=typeof requestAnimationFrame=="function";function S(g){return O?requestAnimationFrame(g):setTimeout(()=>g(k()),16)}function x(g){g!=null&&(O?cancelAnimationFrame(g):clearTimeout(g))}function N(g){let w=null,$=null;const H=()=>{w=null;const ue=$;$=null,g(...ue||[])},ce=(...ue)=>{$=ue,w===null&&(w=S(H))};return ce.cancel=()=>{x(w),w=null,$=null},ce.flush=()=>{w!==null&&(x(w),H())},ce}function I(g,w){let $=null,H=null;const ce=()=>{if($=null,H===null)return;const _=H;H=null,g(..._),ue()},ue=()=>{$=setTimeout(ce,w),typeof $?.unref=="function"&&$.unref()},ae=(..._)=>{$===null?(g(..._),ue()):(H=_,clearTimeout($),ue())};return ae.flush=()=>{if($!==null&&clearTimeout($),$=null,H===null)return;const _=H;H=null,g(..._)},ae.cancel=()=>{$!==null&&clearTimeout($),$=null,H=null},ae.pending=()=>$!==null||H!==null,ae}function B(g,w=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:w}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let Z=0;function le(g="l"){return`${g}${(++Z).toString(36)}`}}),de("packages/modules/ai/reconcile.js",function(m,V){"use strict";Object.defineProperty(m,"UNVERIFIED",{enumerable:!0,get:function(){return R}}),Object.defineProperty(m,"formsOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"buildRegistry",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(m,"collectNumbers",{enumerable:!0,get:function(){return W}}),Object.defineProperty(m,"extractNumbers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"reconcileNumbers",{enumerable:!0,get:function(){return u}});const P=V("packages/core/src/internal/util.js").isNil,L=1e-6,q=4,R="[unverified]";function U(e,c){const i=10**c,p=Math.round(e*i)/i;return p===0?0:p}function J(e){const c=e.indexOf(".");return c<0?0:Math.min(e.length-c-1,q+4)}function G(e){if(!Number.isFinite(e))return[];const c=new Set([e]);for(let i=0;i<=q;i+=1)c.add(U(e,i));if(Math.abs(e)<=1&&e!==0){const i=e*100;for(let p=0;p<=q;p+=1)c.add(U(i,p))}return[...c]}function Q(e){const c=new Set,i=[];for(const r of e)if(Number.isFinite(r)){i.push(r);for(const d of G(r))c.add(d)}const p=[...c];return{size:i.length,values:i,has(r,d){for(const v of p)if(Math.abs(v-r)<=L||U(v,d)===r)return!0;return!1}}}function W(e,c=[],i=0){if(i>8||P(e))return c;if(typeof e=="number")return Number.isFinite(e)&&c.push(e),c;if(typeof e=="string"){const p=Number(e);return e.trim()!==""&&Number.isFinite(p)&&c.push(p),c}if(Array.isArray(e)){for(const p of e)W(p,c,i+1);return c}if(typeof e=="object")for(const p of Object.keys(e))W(e[p],c,i+1);return c}const ne=Object.freeze({k:1e3,K:1e3,m:1e6,M:1e6,bn:1e9,b:1e9,B:1e9});function te(e,c,i,p){return!!((e==="-"||e==="/")&&/[A-Za-z0-9]/.test(c)||e===":"&&/\d/.test(c)||/[A-Za-z_]/.test(i)||(i==="-"||i==="/"||i===":")&&/\d/.test(p))}function M(e){const c=[];if(typeof e!="string"||e==="")return c;const i=/(^|[^\w.])([$£€¥]?)(-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?)(%?)(bn|[kKmMbB])?/g;let p;for(;(p=i.exec(e))!==null;){const[,r,,d,v,n]=p,a=p.index+r.length,f=p.index+p[0].length,y=p.index>0?e[p.index-1]:"",C=f<e.length?e[f]:"",T=f+1<e.length?e[f+1]:"";if(te(r,y,C,T))continue;const j=d.replace(/,/g,"");let z=Number(j);if(!Number.isFinite(z))continue;const A=J(j);n&&Object.prototype.hasOwnProperty.call(ne,n)&&(z*=ne[n]),c.push({raw:e.slice(a,f),start:a,end:f,value:z,decimals:A,suffix:n||""})}return c}function E(e){return e===" "||e===" "||e===`
7
7
  `||e==="\r"}function Y(e){const c=[],i=[];for(let p=0;p<e.length;p+=1)if(e[p]==="(")i.push(p);else if(e[p]===")"&&i.length){const r=i.pop();i.length===0&&c.push({start:r,end:p+1})}return c}function b(e){const c=[],i=e.length;let p=0,r=0;for(;r<i;){const d=e[r],v=d==="."||d==="!"||d==="?",n=r+1>=i||E(e[r+1]);if(v&&n||d===`
8
8
  `){let a=r+1;for(;a<i&&(e[a]==="."||e[a]==="!"||e[a]==="?");)a+=1;for(;a<i&&E(e[a]);)a+=1;c.push({start:p,end:a}),p=a,r=a;continue}r+=1}return p<i&&c.push({start:p,end:i}),c}function o(e){const c=e.slice().sort((p,r)=>p.start-r.start),i=[];for(const p of c){const r=i[i.length-1];r&&p.start<=r.end?r.end=Math.max(r.end,p.end):i.push({start:p.start,end:p.end})}return i}function t(e){return e.replace(/\(\s*\)/g,"").replace(/[ \t]{2,}/g," ").replace(/[ \t]+([,.;:!?)])/g,"$1").replace(/([([])[ \t]+/g,"$1").replace(/(^|[.!?\n])[ \t]*[.;:,!?]+(?=[ \t]|$|\n)/g,"$1").replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
9
9
  `).replace(/\n{3,}/g,`
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, alarms module type declarations
2
+ * Lattice Grid 1.86.5, alarms module type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, alarms module
2
+ * Lattice Grid 1.86.5, alarms module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- var le=Object.create(null),ae=Object.create(null);function se(d,K){le[d]=K}function fe(d){var K=ae[d];if(K)return K;var R=Object.create(null);ae[d]=R;var W=le[d];if(!W)throw new Error("[lattice] missing module: "+d);return W(R,fe),R}se("packages/core/src/internal/util.js",function(d,K){"use strict";Object.defineProperty(d,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(d,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"warnOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"infoOnce",{enumerable:!0,get:function(){return T}}),Object.defineProperty(d,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"fail",{enumerable:!0,get:function(){return D}}),Object.defineProperty(d,"invariant",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"DEV",{enumerable:!0,get:function(){return I}}),Object.defineProperty(d,"isObject",{enumerable:!0,get:function(){return p}}),Object.defineProperty(d,"isFunction",{enumerable:!0,get:function(){return A}}),Object.defineProperty(d,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(d,"isBlank",{enumerable:!0,get:function(){return F}}),Object.defineProperty(d,"isCtor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(d,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(d,"pathSetter",{enumerable:!0,get:function(){return X}}),Object.defineProperty(d,"getPath",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"setPath",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(d,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(d,"escapeHtml",{enumerable:!0,get:function(){return _}}),Object.defineProperty(d,"titleCase",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(d,"expand",{enumerable:!0,get:function(){return t}}),Object.defineProperty(d,"toArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(d,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(d,"mergeRow",{enumerable:!0,get:function(){return m}}),Object.defineProperty(d,"Lru",{enumerable:!0,get:function(){return e}}),Object.defineProperty(d,"collator",{enumerable:!0,get:function(){return c}}),Object.defineProperty(d,"defaultCompare",{enumerable:!0,get:function(){return a}}),Object.defineProperty(d,"now",{enumerable:!0,get:function(){return f}}),Object.defineProperty(d,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(d,"cancelFrame",{enumerable:!0,get:function(){return O}}),Object.defineProperty(d,"frameBatched",{enumerable:!0,get:function(){return S}}),Object.defineProperty(d,"settleDebounce",{enumerable:!0,get:function(){return C}}),Object.defineProperty(d,"whenIdle",{enumerable:!0,get:function(){return z}}),Object.defineProperty(d,"uid",{enumerable:!0,get:function(){return J}});const R="1.86.4";async function W(){return R}const M="1.86.4",U=new Set,Q=2e3;function ee(n){if(U.add(n),U.size>Q){const i=U.values().next().value;i!==void 0&&U.delete(i)}}const $=[],H=500;function L(n,i,s){$.push({key:n,level:i,message:s.map(h=>typeof h=="string"?h:b(h)).join(" "),at:Date.now()}),$.length>H&&$.shift()}function b(n){if(n instanceof Error)return n.message;try{return JSON.stringify(n)}catch{return String(n)}}function v(){return $.map(n=>({...n}))}function g(n){if(n.length===0||typeof n[0]!="string")return n;const i=n[0].replace(/^\[lattice\]\s*/,"");return i===n[0]?n:[i,...n.slice(1)]}function j(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"warn",s),console.warn("[lattice]",...s)}function T(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"info",s),console.info("[lattice]",...s)}function k(){U.clear(),$.length=0}function D(n,i){const s=new Error(`[lattice] ${n}`);throw i!==void 0&&(s.cause=i),s}function w(n,i){n||D(i)}const I=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function p(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function A(n){return typeof n=="function"}function q(n){return n==null}function F(n){return n==null||n===""}function P(n){return typeof n!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(n))?!0:!!(n.prototype&&Object.getOwnPropertyNames(n.prototype).length>1)}const x=new Map;function E(n){let i=x.get(n);if(i)return i;if(!n.includes("."))i=s=>s?.[n];else{const s=n.split("."),h=s.length;i=V=>{let G=V;for(let B=0;B<h;B++){if(G==null)return;G=G[s[B]]}return G}}return x.set(n,i),i}const Z=new Map;function X(n){let i=Z.get(n);if(i)return i;if(!n.includes("."))i=(s,h)=>{s!=null&&(s[n]=h)};else{const s=n.split("."),h=s.length-1;i=(V,G)=>{let B=V;for(let Y=0;Y<h;Y++){if(B==null)return;const ce=s[Y];B[ce]==null&&(B[ce]={}),B=B[ce]}B!=null&&(B[s[h]]=G)}}return Z.set(n,i),i}function te(n,i){return E(i)(n)}function ne(n,i,s){X(i)(n,s)}function re(n){return n?(n.includes(".")?n.slice(n.lastIndexOf(".")+1):n).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase()):""}const ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _(n){const i=n==null?"":String(n);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,s=>ie[s]):i}function oe(n){return String(n).replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}function t(n,i,s){if(n!==void 0)return n===!0?{enabled:!0,...s}:n===!1?{enabled:!1}:p(n)?n:{[i]:n,enabled:!0}}function r(n){return n==null?[]:Array.isArray(n)?n:[n]}const l=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(n,i){if(!p(n))return p(i)?{...i}:i;if(!p(i))return i===void 0?n:i;const s={...n};for(const h of Object.keys(i)){if(l.has(h))continue;const V=i[h];V!==void 0&&(s[h]=p(V)&&p(s[h])?o(s[h],V):V)}return s}function m(n,i){if(!p(n)||!p(i)||n===i)return i;const s=Object.create(Object.getPrototypeOf(n));return Object.assign(s,n,i),s}class e{#t;#e=new Map;#n;constructor(i=256,s=null){this.#t=i,this.#n=s}get size(){return this.#e.size}get max(){return this.#t}set max(i){this.#t=i,this.#r()}has(i){return this.#e.has(i)}get(i){const s=this.#e;if(!s.has(i))return;const h=s.get(i);return s.delete(i),s.set(i,h),h}peek(i){return this.#e.get(i)}set(i,s){const h=this.#e;return h.has(i)&&h.delete(i),h.set(i,s),this.#r(),s}delete(i){const s=this.#e.get(i);return this.#e.delete(i)&&this.#n&&this.#n(s,i),s}clear(){if(this.#n)for(const[i,s]of this.#e)this.#n(s,i);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const i=this.#e;for(;i.size>this.#t;){const s=i.keys().next().value,h=i.get(s);i.delete(s),this.#n&&this.#n(h,s)}}}const u=new Map;function c(n,i){const s=`${n||""}|${i?JSON.stringify(i):""}`;let h=u.get(s);return h||(h=new Intl.Collator(n||void 0,{numeric:!0,sensitivity:"variant",...i}),u.set(s,h)),h}function a(n,i){if(n===i)return 0;if(n==null)return 1;if(i==null)return-1;if(typeof n=="number"&&typeof i=="number")return Number.isNaN(n)?Number.isNaN(i)?0:1:Number.isNaN(i)||n<i?-1:n>i?1:0;const s=String(n),h=String(i);return s<h?-1:s>h?1:0}function f(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const y=typeof requestAnimationFrame=="function";function N(n){return y?requestAnimationFrame(n):setTimeout(()=>n(f()),16)}function O(n){n!=null&&(y?cancelAnimationFrame(n):clearTimeout(n))}function S(n){let i=null,s=null;const h=()=>{i=null;const G=s;s=null,n(...G||[])},V=(...G)=>{s=G,i===null&&(i=N(h))};return V.cancel=()=>{O(i),i=null,s=null},V.flush=()=>{i!==null&&(O(i),h())},V}function C(n,i){let s=null,h=null;const V=()=>{if(s=null,h===null)return;const Y=h;h=null,n(...Y),G()},G=()=>{s=setTimeout(V,i),typeof s?.unref=="function"&&s.unref()},B=(...Y)=>{s===null?(n(...Y),G()):(h=Y,clearTimeout(s),G())};return B.flush=()=>{if(s!==null&&clearTimeout(s),s=null,h===null)return;const Y=h;h=null,n(...Y)},B.cancel=()=>{s!==null&&clearTimeout(s),s=null,h=null},B.pending=()=>s!==null||h!==null,B}function z(n,i=50){return typeof requestIdleCallback=="function"?requestIdleCallback(n,{timeout:i}):setTimeout(()=>n({timeRemaining:()=>0,didTimeout:!0}),1)}let ue=0;function J(n="l"){return`${n}${(++ue).toString(36)}`}}),se("packages/core/src/formatting/rules.js",function(d,K){"use strict";Object.defineProperty(d,"RULE_OPS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(d,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(d,"testRule",{enumerable:!0,get:function(){return L}}),Object.defineProperty(d,"mixColour",{enumerable:!0,get:function(){return b}}),Object.defineProperty(d,"summariseColumn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"quantileOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(d,"needsDistribution",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"resolveDistribution",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"ICON_SETS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"compileRules",{enumerable:!0,get:function(){return oe}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),ee=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function $(t,r){const l=Number(t),o=Number(r);if(t!==null&&t!==""&&r!==null&&r!==""&&Number.isFinite(l)&&Number.isFinite(o))return l<o?-1:l>o?1:0;const e=String(t??"").toLowerCase(),u=String(r??"").toLowerCase();return e<u?-1:e>u?1:0}function H(t){return t==null||t===""}function L(t,r){if(!r||typeof r!="object")return!1;const{op:l}=r,o=r.value,m=r.value2;switch(l){case"blank":return H(t);case"notBlank":return!H(t);case"true":return t===!0;case"false":return t===!1;default:break}if(H(t))return!1;switch(l){case"eq":return $(t,o)===0;case"ne":return $(t,o)!==0;case"gt":return $(t,o)>0;case"gte":return $(t,o)>=0;case"lt":return $(t,o)<0;case"lte":return $(t,o)<=0;case"between":return $(t,o)>=0&&$(t,m)<=0;case"outside":return $(t,o)<0||$(t,m)>0;case"contains":return String(t).toLowerCase().includes(String(o??"").toLowerCase());case"notContains":return!String(t).toLowerCase().includes(String(o??"").toLowerCase());case"startsWith":return String(t).toLowerCase().startsWith(String(o??"").toLowerCase());case"endsWith":return String(t).toLowerCase().endsWith(String(o??"").toLowerCase());default:return!1}}function b(t,r,l){const o=O=>{const S=String(O).replace("#",""),C=S.length===3?S.split("").map(z=>z+z).join(""):S;return[0,2,4].map(z=>parseInt(C.slice(z,z+2),16)||0)},[m,e,u]=o(t),[c,a,f]=o(r),y=Math.max(0,Math.min(1,l)),N=(O,S)=>Math.round(O+(S-O)*y);return`#${[N(m,c),N(e,a),N(u,f)].map(O=>O.toString(16).padStart(2,"0")).join("")}`}function v(t){const r=[];for(const c of t||[]){if(c==null||c==="")continue;const a=c instanceof Date?c.getTime():Number(c);Number.isFinite(a)&&r.push(a)}if(!r.length)return null;r.sort((c,a)=>c-a);let l=0,o=0,m=0;for(const c of r){l++;const a=c-o;o+=a/l,m+=a*(c-o)}const e=g(r,.25),u=g(r,.75);return{n:r.length,min:r[0],max:r[r.length-1],mean:o,stddev:r.length>1?Math.sqrt(m/(r.length-1)):0,median:g(r,.5),q1:e,q3:u,iqr:u-e,sorted:r}}function g(t,r){if(!t.length)return 0;const l=(t.length-1)*Math.max(0,Math.min(1,r)),o=Math.floor(l),m=Math.ceil(l);return o===m?t[o]:t[o]+(l-o)*(t[m]-t[o])}function j(t){for(const r of Array.isArray(t)?t:[])if(!(!r||typeof r!="object")&&(r.when&&Q.includes(r.when.op)||r.scale&&r.scale.from||r.dataBar&&!(Number.isFinite(Number(r.dataBar.min))&&Number.isFinite(Number(r.dataBar.max)))||r.iconSet&&!Array.isArray(r.iconSet.thresholds)))return!0;return!1}function T(t,r){const l=Number(t.value),o=m=>g(r.sorted,m);switch(t.op){case"topPercent":{const m=k(l,10);return{op:"gte",value:o(1-m)}}case"bottomPercent":{const m=k(l,10);return{op:"lte",value:o(m)}}case"topN":{const m=Math.max(1,Math.floor(l)||1),e=Math.max(0,r.sorted.length-m);return{op:"gte",value:r.sorted[e]}}case"bottomN":{const m=Math.max(1,Math.floor(l)||1),e=Math.min(r.sorted.length-1,m-1);return{op:"lte",value:r.sorted[e]}}case"aboveMean":return{op:"gt",value:r.mean};case"belowMean":return{op:"lt",value:r.mean};case"aboveMedian":return{op:"gt",value:r.median};case"belowMedian":return{op:"lt",value:r.median};case"zAbove":return r.stddev?{op:"gte",value:r.mean+(Number.isFinite(l)?l:2)*r.stddev}:null;case"zBelow":return r.stddev?{op:"lte",value:r.mean-(Number.isFinite(l)?l:2)*r.stddev}:null;case"outlier":{const m=(Number.isFinite(l)&&l>0?l:1.5)*r.iqr;return r.iqr?{op:"outside",value:r.q1-m,value2:r.q3+m}:null}default:return null}}function k(t,r){const l=Number.isFinite(t)?t:r,o=l>1?l/100:l;return Math.max(0,Math.min(1,o))}function D(t,r){if(t.from==="minmax")return{...t,min:r.min,max:r.max};if(t.from==="quantile")return{...t,min:g(r.sorted,k(Number(t.low),5)),max:g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const l=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:r.mean-l*r.stddev,max:r.mean+l*r.stddev}}return t}function w(t,r){const l=Array.isArray(t)?t:[];return!r||!r.n?l.map(o=>o&&j([o])?{...o,enabled:!1}:o):l.map(o=>{if(!o||typeof o!="object")return o;if(o.scale&&o.scale.from)return{...o,scale:D(o.scale,r)};if(o.dataBar)return{...o,dataBar:I(o.dataBar,r)};if(o.iconSet)return{...o,iconSet:p(o.iconSet,r)};if(!o.when||!Q.includes(o.when.op))return o;const m=T(o.when,r);return m?{...o,when:m}:{...o,enabled:!1}})}function I(t,r){const l=Number.isFinite(Number(t.min))?Number(t.min):void 0,o=Number.isFinite(Number(t.max))?Number(t.max):void 0;if(l!==void 0&&o!==void 0)return{...t,min:l,max:o};if(t.from==="quantile")return{...t,min:l??g(r.sorted,k(Number(t.low),5)),max:o??g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const m=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:l??r.mean-m*r.stddev,max:o??r.mean+m*r.stddev}}return{...t,min:l??r.min,max:o??r.max}}function p(t,r){if(Array.isArray(t.thresholds))return t;const l=A(t),o=[];for(let m=1;m<l;m++)o.push(g(r.sorted,m/l));return{...t,thresholds:o}}function A(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.length;if(Number.isFinite(Number(t.count))&&Number(t.count)>=2)return Math.floor(Number(t.count));const r=X[t.set];return r?r.length:3}function q(t){return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}function F(t){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${t}"/></svg>`}function P(t,r){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${r==="up"?"8,2 14,13 2,13":r==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${t}"/></svg>`}function x(t,r){const l="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r*16} 16">`;for(let m=0;m<r;m++){const e=m<t?"#f5a623":"#d0d0d0";o+=`<path transform="translate(${m*16},0)" d="${l}" fill="${e}"/>`}return`${o}</svg>`}const E=Object.freeze([P("#c0392b","down"),P("#e0a800","right"),P("#2e7d32","up")]),Z=Object.freeze([F("#d13438"),F("#f5a623"),F("#2e9e44")]),X=Object.freeze({arrows:E,trafficLights:Z,ratings:Object.freeze([1,2,3,4,5].map(t=>x(t,5)))}),te=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function ne(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.map(o=>/^\s*(url\(|data:|<)/.test(String(o))&&String(o).trim().startsWith("<")?q(String(o)):String(o));const r=t.set||"arrows";if(r==="ratings"){const o=A(t),m=[];for(let e=1;e<=o;e++)m.push(q(x(e,o)));return m}const l=X[r];return l?l.map(q):(M(`iconSet:${r}`,`unknown icon set '${r}'; falling back to arrows.`),E.map(q))}function re(t){const r=Number(t.min),o=Number(t.max)-r,m=t.colour||t.color||"#5b9bd5",e=t.negativeColour||t.negativeColor||"#d13438",u=t.direction==="rtl"?"left":"right",c=f=>Math.max(0,Math.min(1,(f-r)/o))*100,a=o?Math.max(0,Math.min(100,(0-r)/o*100)):0;return f=>{if(H(f))return null;const y=Number(f);if(!Number.isFinite(y)||!o)return null;const N=c(y),O=Math.min(N,a),S=Math.max(N,a),C=y>=0?m:e;return{backgroundImage:`linear-gradient(to ${u}, transparent ${O}%, ${C} ${O}%, ${C} ${S}%, transparent ${S}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function ie(t){const r=ne(t),l=t.reverse?[...r].reverse():r,o=(Array.isArray(t.thresholds)?t.thresholds:[]).map(Number).filter(Number.isFinite),m=Number.isFinite(Number(t.size))?Number(t.size):16,e=t.set==="ratings"?m*A(t):m;return u=>{if(H(u))return null;const c=Number(u);if(!Number.isFinite(c))return null;let a=0;for(const y of o)c>=y&&a++;const f=l[Math.min(a,l.length-1)];return f?{backgroundImage:f,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${e}px ${m}px`,paddingLeft:`${e+4}px`}:null}}function _(t){const r=Array.isArray(t.colours)&&t.colours.length>=2?t.colours:["#f8f9fa","#1a6bc7"],l=Number(t.min),o=Number(t.max),m=o-l,e=r.length-1,u=[];for(let a=0;a<=e;a++)u.push(e?a/e:0);const c=Number(t.mid);if(t.mid!==void 0&&t.mid!==null)if(r.length%2===0)M("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${r.length} were given, so "mid" was ignored.`);else if(Number.isFinite(c)&&m&&c>Math.min(l,o)&&c<Math.max(l,o)){const a=e/2,f=Math.max(0,Math.min(1,(c-l)/m));for(let y=0;y<=e;y++)u[y]=y<=a?a?y/a*f:f:f+(y-a)/(e-a)*(1-f)}else Number.isFinite(c)&&M("formatting.scale.mid.range",`a scale's "mid" (${c}) is outside its min..max range, so it was ignored.`);return a=>{const f=Number(a);if(!Number.isFinite(f)||!m)return null;const y=Math.max(0,Math.min(1,(f-l)/m));let N=0;for(;N<e-1&&y>u[N+1];)N++;const O=u[N+1]-u[N],S=O>0?(y-u[N])/O:0;return{background:b(r[N],r[N+1],Math.max(0,Math.min(1,S)))}}}function oe(t,r=null){const l=j(t)?w(t,r):t,o=(Array.isArray(l)?l:[]).filter(e=>e&&typeof e=="object");if(!o.length)return()=>null;const m=o.map(e=>e.scale?{scale:_(e.scale),enabled:e.enabled!==!1}:e.dataBar?{scale:re(e.dataBar),enabled:e.enabled!==!1}:e.iconSet?{scale:ie(e.iconSet),enabled:e.enabled!==!1}:{when:e.when,style:e.style,stop:e.stopIfTrue!==!1,enabled:e.enabled!==!1});return e=>{const u=e?e.value:void 0;let c=null;for(const a of m){if(!a.enabled)continue;if(a.scale){const y=a.scale(u);y&&(c={...c||{},...y});continue}if(!L(u,a.when))continue;const f=W(a.style)?a.style(e):a.style;if(f&&(c={...c||{},...f}),a.stop)break}return c}}}),se("packages/modules/shared/emitter.js",function(d,K){"use strict";Object.defineProperty(d,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"Emitter",{enumerable:!0,get:function(){return $}}),Object.defineProperty(d,"gate",{enumerable:!0,get:function(){return H}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U="*",Q=new Set(["api","user","init","ai"]);function ee(L,b){return L&&L.name?L.name:`#${b}`}class ${#t=new Map;#e;constructor(b="module"){this.#e=String(b)}on(b,v){if(!W(v))return()=>{};let g=this.#t.get(b);return g||(g=new Set,this.#t.set(b,g)),g.add(v),()=>this.off(b,v)}off(b,v){const g=this.#t.get(b);g&&g.delete(v)}count(b){const v=this.#t.get(b);return v?v.size:0}emit(b,v){const g=this.#t.get(b),j=this.#t.get(U);if((!g||g.size===0)&&(!j||j.size===0))return;const T={...v||null,type:b};g&&g.size&&this.#n([...g],T,b),j&&j.size&&this.#n([...j],T,U)}#n(b,v,g){for(let j=0;j<b.length;j++)try{b[j](v)}catch(T){M(`${this.#e}.emit.throw:${g}:${ee(b[j],j)}`,`${this.#e}: a '${g}' handler threw; other handlers were unaffected.`,T)}}emitBefore(b,v,g){const j=g??(v&&v.origin),T=Q.has(j)?j:"user";let k=!1,D=null;const w=P=>{k=!0,P!=null&&D===null&&(D=String(P))},I={...v||null,type:b,origin:T,get defaultPrevented(){return k},get reason(){return D},preventDefault(P){w(P)}},p=this.#t.get(b);if(!p||p.size===0)return!0;const A=[...p],q=()=>(k&&D===null&&(D="prevented"),k&&v&&typeof v=="object"&&(v.reason=D),!k),F=[];for(let P=0;P<A.length;P++){const x=A[P];try{const E=x(I);E&&W(E.then)?F.push(E):E===!1&&w("prevented")}catch(E){w("error"),M(`${this.#e}.beforeThrow:${b}:${ee(x,P)}`,`${this.#e}: a '${b}' before-handler threw; the action was cancelled.`,E)}}return F.length===0?q():Promise.allSettled(F).then(P=>{for(const x of P)x.status==="rejected"?(w("error"),M(`${this.#e}.beforeReject:${b}`,`${this.#e}: a '${b}' before-handler rejected; the action was cancelled.`,x.reason)):x.value===!1&&w("prevented");return q()})}clear(){this.#t.clear()}}function H(L,b,v,g,j){const T=L.emitBefore(b,g,g.origin),k=()=>(L.emit(v,{...g,reason:g.reason||"prevented"}),!1);return T===!1?k():T&&W(T.then)?T.then(D=>D?j():k()):j()}}),se("packages/modules/alarms/index.js",function(d,K){"use strict";Object.defineProperty(d,"createAlarms",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"default",{enumerable:!0,get:function(){return D}});const R=K("packages/core/src/internal/util.js"),W=R.warnOnce,M=R.isFunction,Q=K("packages/core/src/formatting/rules.js").testRule,$=K("packages/modules/shared/emitter.js").Emitter,H=Object.freeze(["alarm:raised","alarm:cleared"]),L=new Set(["warn","critical"]);function b(w){return typeof w=="string"&&L.has(w)}function v(w,I){if(typeof w!="number"||Number.isNaN(w))return null;if(Array.isArray(I&&I.bands)){for(const A of I.bands){const q=A.min===void 0||A.min===null?-1/0:A.min,F=A.max===void 0||A.max===null?1/0:A.max;if(w>=q&&w<F)return A.status??null}return null}const p=I&&I.thresholds;return!p||p.warn===void 0||p.warn===null||p.critical===void 0||p.critical===null?null:p.direction==="lowerIsBetter"?w<=p.warn?"good":w<=p.critical?"warn":"critical":w>=p.warn?"good":w>=p.critical?"warn":"critical"}function g(w){const I=w||{};return{now:M(I.now)?I.now:()=>Date.now(),setTimeout:M(I.setTimeout)?I.setTimeout:((p,A)=>setTimeout(p,A)),clearTimeout:M(I.clearTimeout)?I.clearTimeout:(p=>clearTimeout(p))}}function j(w,I){return Number.isFinite(w)&&Number(w)>=0?Number(w):I}function T(w,I){return`${typeof w=="string"?w:JSON.stringify(w)}/${I}`}function k(w={}){const I=w||{},p=g(I.clock),A=j(I.holdMs,0),q=new $("alarms"),F=new Map,P=[],x=new Map,E=[];let Z=!1;const X=e=>{const u=(x.get(e)||0)+1;return x.set(e,u),`${e}#${u}`},te=(e,u)=>`${e.source}:${e.sourceId}:${e.key}:${u}`,ne=(e,u,c)=>({id:te(e,u),source:e.source,sourceId:e.sourceId,key:e.key,level:u,previous:c,value:e.value,threshold:e.threshold??null,band:e.band??null,at:p.now(),holdMs:e.holdMs}),re=(e,u)=>{q.emit(e,u);for(const c of E)c(u,e)},ie=(e,u)=>{const c=e.committed;if(c!==u&&(e.committed=u,b(c)&&(e.active=null,re("alarm:cleared",ne(e,c,c))),b(u))){const a=ne(e,u,c);e.active=a,re("alarm:raised",a)}},_=(e,u,c={})=>{if(Z)return;const a=`${e.source}\0${e.sourceId}\0${e.key}`;let f=F.get(a);if(f||(f={source:e.source,sourceId:e.sourceId,key:e.key,holdMs:e.holdMs,committed:null,active:null,pending:null,timer:null,value:void 0,threshold:null,band:null},F.set(a,f)),f.holdMs=e.holdMs,f.value=c.value,f.threshold=c.threshold??null,f.band=c.band??null,u===f.committed){f.timer!==null&&(p.clearTimeout(f.timer),f.timer=null),f.pending=null;return}if(!(b(f.committed)||b(u))||f.holdMs<=0){ie(f,u);return}f.pending={level:u,at:p.now()},f.timer===null&&(f.timer=p.setTimeout(()=>{f.timer=null;const N=f.pending;f.pending=null,N&&ie(f,N.level)},f.holdMs))},oe=e=>{const u=`${e.source}\0${e.sourceId}\0${e.key}`,c=F.get(u);c&&(_(e,null,{value:void 0}),c.timer===null&&c.pending===null&&F.delete(u))},t=e=>{const u=new Map;return(e&&e.config&&e.config.tiles||[]).forEach((a,f)=>{a&&u.set(String(a.id??a.label??`tile${f}`),a)}),u},r=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("kpi"),a=j(u.holdMs,A),f=t(e),y=(O,S,C)=>{const z=f.get(String(O))||{};_({source:"kpi",sourceId:c,key:String(O),holdMs:a},S??null,{value:C,threshold:z.thresholds??null,band:Array.isArray(z.bands)?z.bands:null})};for(const O of e.model&&e.model.tiles||[])y(O.id,O.status,O.value);const N=e.on("tile:status",O=>y(O.id,O.status,O.value));return()=>{M(N)&&N()}},l=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("grid"),a=j(u.holdMs,A),f=u.columns&&typeof u.columns=="object"?u.columns:null;(!f||Object.keys(f).length===0)&&W("alarms:grid-no-columns","alarms.attach(grid) was given no `columns`, so no cell can raise anything. Declare the columns to watch: attach(grid, { columns: { cpu: { thresholds: { warn: 80, critical: 95, direction: 'lowerIsBetter' } } } }).");let y=new Set;const N=()=>{const S=new Set;if(!(!M(e.rows.forEachAll)||!M(e.rows.value))){e.rows.forEachAll(C=>{const z=C&&C.key;if(z!=null)for(const[ue,J]of Object.entries(f||{})){if(!J)continue;const n=T(z,ue);S.add(n);const i=e.rows.value(z,ue);if(J.when&&!Q(i,J.when)){_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},null,{value:i});continue}_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},v(i,J),{value:i,threshold:J.thresholds??null,band:Array.isArray(J.bands)?J.bands:null})}});for(const C of y)S.has(C)||oe({source:"grid",sourceId:c,key:C,holdMs:a});y=S}},O=[];for(const S of["rows:changed","cell:changed","stream:chunk","stream:evicted"]){const C=e.on(S,N);M(C)&&O.push(C)}return N(),()=>{for(const S of O)S()}},o=(e,u,c)=>{const a=c.sourceId?String(c.sourceId):X("router"),f=j(c.holdMs,A),y=String(c.label??(typeof u=="function"?"route":u)),N=M(c.value)?c.value:(S=>S.length),O=e.monitor(u,N,S=>{_({source:"router",sourceId:a,key:y,holdMs:f},v(S,c),{value:S,threshold:c.thresholds??null,band:Array.isArray(c.bands)?c.bands:null})});return()=>{M(O)&&O()}};return{attach(e,u,c){if(Z||!e||typeof e!="object")return this;if(M(e.monitor)){const f=c||{},y=o(e,u,f);return P.push({kind:"router",sourceId:f.sourceId||"",release:y}),this}const a=u&&typeof u=="object"?u:{};return e.model&&Array.isArray(e.model.tiles)&&M(e.on)?(P.push({kind:"kpi",sourceId:a.sourceId||"",release:r(e,a)}),this):e.rows&&M(e.on)?(P.push({kind:"grid",sourceId:a.sourceId||"",release:l(e,a)}),this):(W("alarms:unknown-source","alarms.attach() was given something that is not a KPI panel, a grid or a data router; nothing was attached and no alarm can be raised from it."),this)},on(e,u){return H.includes(e)?q.on(e,u):(W(`alarms:unknown-event:${e}`,`alarms.on('${e}') will never fire; an alarm set emits ${H.join(" and ")}.`),()=>{})},active(){const e=[];for(const u of F.values())u.active&&e.push({...u.active});return e},pending(){const e=[];for(const u of F.values())u.pending&&e.push({id:te(u,u.pending.level),source:u.source,sourceId:u.sourceId,key:u.key,level:u.pending.level,previous:u.committed,value:u.value,at:u.pending.at,holdMs:u.holdMs});return e},publish(e,u="alarms"){if(Z||!e||!M(e.addSource))return W("alarms:publish-no-router","alarms.publish() needs a data router with addSource(); nothing was published."),this;const c=e.addSource(String(u));let a=0;return E.push((f,y)=>{a+=1,c.push({op:"upsert",row:{...f,id:`${f.id}#${a}`,alarmId:f.id,kind:String(u),state:y==="alarm:raised"?"raised":"cleared"}})}),this},destroy(){if(!Z){Z=!0;for(const e of P)try{e.release()}catch{}P.length=0;for(const e of F.values())e.timer!==null&&(p.clearTimeout(e.timer),e.timer=null),e.pending=null;F.clear(),E.length=0,q.clear()}}}}const D=k});const de=fe("packages/modules/alarms/index.js"),me=de.createAlarms;var he=de.default;export{me as createAlarms,he as default};
6
+ var le=Object.create(null),ae=Object.create(null);function se(d,K){le[d]=K}function fe(d){var K=ae[d];if(K)return K;var R=Object.create(null);ae[d]=R;var W=le[d];if(!W)throw new Error("[lattice] missing module: "+d);return W(R,fe),R}se("packages/core/src/internal/util.js",function(d,K){"use strict";Object.defineProperty(d,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(d,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"warnOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"infoOnce",{enumerable:!0,get:function(){return T}}),Object.defineProperty(d,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"fail",{enumerable:!0,get:function(){return D}}),Object.defineProperty(d,"invariant",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"DEV",{enumerable:!0,get:function(){return I}}),Object.defineProperty(d,"isObject",{enumerable:!0,get:function(){return p}}),Object.defineProperty(d,"isFunction",{enumerable:!0,get:function(){return A}}),Object.defineProperty(d,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(d,"isBlank",{enumerable:!0,get:function(){return F}}),Object.defineProperty(d,"isCtor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(d,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(d,"pathSetter",{enumerable:!0,get:function(){return X}}),Object.defineProperty(d,"getPath",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"setPath",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(d,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(d,"escapeHtml",{enumerable:!0,get:function(){return _}}),Object.defineProperty(d,"titleCase",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(d,"expand",{enumerable:!0,get:function(){return t}}),Object.defineProperty(d,"toArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(d,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(d,"mergeRow",{enumerable:!0,get:function(){return m}}),Object.defineProperty(d,"Lru",{enumerable:!0,get:function(){return e}}),Object.defineProperty(d,"collator",{enumerable:!0,get:function(){return c}}),Object.defineProperty(d,"defaultCompare",{enumerable:!0,get:function(){return a}}),Object.defineProperty(d,"now",{enumerable:!0,get:function(){return f}}),Object.defineProperty(d,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(d,"cancelFrame",{enumerable:!0,get:function(){return O}}),Object.defineProperty(d,"frameBatched",{enumerable:!0,get:function(){return S}}),Object.defineProperty(d,"settleDebounce",{enumerable:!0,get:function(){return C}}),Object.defineProperty(d,"whenIdle",{enumerable:!0,get:function(){return z}}),Object.defineProperty(d,"uid",{enumerable:!0,get:function(){return J}});const R="1.86.5";async function W(){return R}const M="1.86.5",U=new Set,Q=2e3;function ee(n){if(U.add(n),U.size>Q){const i=U.values().next().value;i!==void 0&&U.delete(i)}}const $=[],H=500;function L(n,i,s){$.push({key:n,level:i,message:s.map(h=>typeof h=="string"?h:b(h)).join(" "),at:Date.now()}),$.length>H&&$.shift()}function b(n){if(n instanceof Error)return n.message;try{return JSON.stringify(n)}catch{return String(n)}}function v(){return $.map(n=>({...n}))}function g(n){if(n.length===0||typeof n[0]!="string")return n;const i=n[0].replace(/^\[lattice\]\s*/,"");return i===n[0]?n:[i,...n.slice(1)]}function j(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"warn",s),console.warn("[lattice]",...s)}function T(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"info",s),console.info("[lattice]",...s)}function k(){U.clear(),$.length=0}function D(n,i){const s=new Error(`[lattice] ${n}`);throw i!==void 0&&(s.cause=i),s}function w(n,i){n||D(i)}const I=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function p(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function A(n){return typeof n=="function"}function q(n){return n==null}function F(n){return n==null||n===""}function P(n){return typeof n!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(n))?!0:!!(n.prototype&&Object.getOwnPropertyNames(n.prototype).length>1)}const x=new Map;function E(n){let i=x.get(n);if(i)return i;if(!n.includes("."))i=s=>s?.[n];else{const s=n.split("."),h=s.length;i=V=>{let G=V;for(let B=0;B<h;B++){if(G==null)return;G=G[s[B]]}return G}}return x.set(n,i),i}const Z=new Map;function X(n){let i=Z.get(n);if(i)return i;if(!n.includes("."))i=(s,h)=>{s!=null&&(s[n]=h)};else{const s=n.split("."),h=s.length-1;i=(V,G)=>{let B=V;for(let Y=0;Y<h;Y++){if(B==null)return;const ce=s[Y];B[ce]==null&&(B[ce]={}),B=B[ce]}B!=null&&(B[s[h]]=G)}}return Z.set(n,i),i}function te(n,i){return E(i)(n)}function ne(n,i,s){X(i)(n,s)}function re(n){return n?(n.includes(".")?n.slice(n.lastIndexOf(".")+1):n).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase()):""}const ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _(n){const i=n==null?"":String(n);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,s=>ie[s]):i}function oe(n){return String(n).replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}function t(n,i,s){if(n!==void 0)return n===!0?{enabled:!0,...s}:n===!1?{enabled:!1}:p(n)?n:{[i]:n,enabled:!0}}function r(n){return n==null?[]:Array.isArray(n)?n:[n]}const l=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(n,i){if(!p(n))return p(i)?{...i}:i;if(!p(i))return i===void 0?n:i;const s={...n};for(const h of Object.keys(i)){if(l.has(h))continue;const V=i[h];V!==void 0&&(s[h]=p(V)&&p(s[h])?o(s[h],V):V)}return s}function m(n,i){if(!p(n)||!p(i)||n===i)return i;const s=Object.create(Object.getPrototypeOf(n));return Object.assign(s,n,i),s}class e{#t;#e=new Map;#n;constructor(i=256,s=null){this.#t=i,this.#n=s}get size(){return this.#e.size}get max(){return this.#t}set max(i){this.#t=i,this.#r()}has(i){return this.#e.has(i)}get(i){const s=this.#e;if(!s.has(i))return;const h=s.get(i);return s.delete(i),s.set(i,h),h}peek(i){return this.#e.get(i)}set(i,s){const h=this.#e;return h.has(i)&&h.delete(i),h.set(i,s),this.#r(),s}delete(i){const s=this.#e.get(i);return this.#e.delete(i)&&this.#n&&this.#n(s,i),s}clear(){if(this.#n)for(const[i,s]of this.#e)this.#n(s,i);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const i=this.#e;for(;i.size>this.#t;){const s=i.keys().next().value,h=i.get(s);i.delete(s),this.#n&&this.#n(h,s)}}}const u=new Map;function c(n,i){const s=`${n||""}|${i?JSON.stringify(i):""}`;let h=u.get(s);return h||(h=new Intl.Collator(n||void 0,{numeric:!0,sensitivity:"variant",...i}),u.set(s,h)),h}function a(n,i){if(n===i)return 0;if(n==null)return 1;if(i==null)return-1;if(typeof n=="number"&&typeof i=="number")return Number.isNaN(n)?Number.isNaN(i)?0:1:Number.isNaN(i)||n<i?-1:n>i?1:0;const s=String(n),h=String(i);return s<h?-1:s>h?1:0}function f(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const y=typeof requestAnimationFrame=="function";function N(n){return y?requestAnimationFrame(n):setTimeout(()=>n(f()),16)}function O(n){n!=null&&(y?cancelAnimationFrame(n):clearTimeout(n))}function S(n){let i=null,s=null;const h=()=>{i=null;const G=s;s=null,n(...G||[])},V=(...G)=>{s=G,i===null&&(i=N(h))};return V.cancel=()=>{O(i),i=null,s=null},V.flush=()=>{i!==null&&(O(i),h())},V}function C(n,i){let s=null,h=null;const V=()=>{if(s=null,h===null)return;const Y=h;h=null,n(...Y),G()},G=()=>{s=setTimeout(V,i),typeof s?.unref=="function"&&s.unref()},B=(...Y)=>{s===null?(n(...Y),G()):(h=Y,clearTimeout(s),G())};return B.flush=()=>{if(s!==null&&clearTimeout(s),s=null,h===null)return;const Y=h;h=null,n(...Y)},B.cancel=()=>{s!==null&&clearTimeout(s),s=null,h=null},B.pending=()=>s!==null||h!==null,B}function z(n,i=50){return typeof requestIdleCallback=="function"?requestIdleCallback(n,{timeout:i}):setTimeout(()=>n({timeRemaining:()=>0,didTimeout:!0}),1)}let ue=0;function J(n="l"){return`${n}${(++ue).toString(36)}`}}),se("packages/core/src/formatting/rules.js",function(d,K){"use strict";Object.defineProperty(d,"RULE_OPS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(d,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(d,"testRule",{enumerable:!0,get:function(){return L}}),Object.defineProperty(d,"mixColour",{enumerable:!0,get:function(){return b}}),Object.defineProperty(d,"summariseColumn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"quantileOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(d,"needsDistribution",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"resolveDistribution",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"ICON_SETS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"compileRules",{enumerable:!0,get:function(){return oe}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),ee=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function $(t,r){const l=Number(t),o=Number(r);if(t!==null&&t!==""&&r!==null&&r!==""&&Number.isFinite(l)&&Number.isFinite(o))return l<o?-1:l>o?1:0;const e=String(t??"").toLowerCase(),u=String(r??"").toLowerCase();return e<u?-1:e>u?1:0}function H(t){return t==null||t===""}function L(t,r){if(!r||typeof r!="object")return!1;const{op:l}=r,o=r.value,m=r.value2;switch(l){case"blank":return H(t);case"notBlank":return!H(t);case"true":return t===!0;case"false":return t===!1;default:break}if(H(t))return!1;switch(l){case"eq":return $(t,o)===0;case"ne":return $(t,o)!==0;case"gt":return $(t,o)>0;case"gte":return $(t,o)>=0;case"lt":return $(t,o)<0;case"lte":return $(t,o)<=0;case"between":return $(t,o)>=0&&$(t,m)<=0;case"outside":return $(t,o)<0||$(t,m)>0;case"contains":return String(t).toLowerCase().includes(String(o??"").toLowerCase());case"notContains":return!String(t).toLowerCase().includes(String(o??"").toLowerCase());case"startsWith":return String(t).toLowerCase().startsWith(String(o??"").toLowerCase());case"endsWith":return String(t).toLowerCase().endsWith(String(o??"").toLowerCase());default:return!1}}function b(t,r,l){const o=O=>{const S=String(O).replace("#",""),C=S.length===3?S.split("").map(z=>z+z).join(""):S;return[0,2,4].map(z=>parseInt(C.slice(z,z+2),16)||0)},[m,e,u]=o(t),[c,a,f]=o(r),y=Math.max(0,Math.min(1,l)),N=(O,S)=>Math.round(O+(S-O)*y);return`#${[N(m,c),N(e,a),N(u,f)].map(O=>O.toString(16).padStart(2,"0")).join("")}`}function v(t){const r=[];for(const c of t||[]){if(c==null||c==="")continue;const a=c instanceof Date?c.getTime():Number(c);Number.isFinite(a)&&r.push(a)}if(!r.length)return null;r.sort((c,a)=>c-a);let l=0,o=0,m=0;for(const c of r){l++;const a=c-o;o+=a/l,m+=a*(c-o)}const e=g(r,.25),u=g(r,.75);return{n:r.length,min:r[0],max:r[r.length-1],mean:o,stddev:r.length>1?Math.sqrt(m/(r.length-1)):0,median:g(r,.5),q1:e,q3:u,iqr:u-e,sorted:r}}function g(t,r){if(!t.length)return 0;const l=(t.length-1)*Math.max(0,Math.min(1,r)),o=Math.floor(l),m=Math.ceil(l);return o===m?t[o]:t[o]+(l-o)*(t[m]-t[o])}function j(t){for(const r of Array.isArray(t)?t:[])if(!(!r||typeof r!="object")&&(r.when&&Q.includes(r.when.op)||r.scale&&r.scale.from||r.dataBar&&!(Number.isFinite(Number(r.dataBar.min))&&Number.isFinite(Number(r.dataBar.max)))||r.iconSet&&!Array.isArray(r.iconSet.thresholds)))return!0;return!1}function T(t,r){const l=Number(t.value),o=m=>g(r.sorted,m);switch(t.op){case"topPercent":{const m=k(l,10);return{op:"gte",value:o(1-m)}}case"bottomPercent":{const m=k(l,10);return{op:"lte",value:o(m)}}case"topN":{const m=Math.max(1,Math.floor(l)||1),e=Math.max(0,r.sorted.length-m);return{op:"gte",value:r.sorted[e]}}case"bottomN":{const m=Math.max(1,Math.floor(l)||1),e=Math.min(r.sorted.length-1,m-1);return{op:"lte",value:r.sorted[e]}}case"aboveMean":return{op:"gt",value:r.mean};case"belowMean":return{op:"lt",value:r.mean};case"aboveMedian":return{op:"gt",value:r.median};case"belowMedian":return{op:"lt",value:r.median};case"zAbove":return r.stddev?{op:"gte",value:r.mean+(Number.isFinite(l)?l:2)*r.stddev}:null;case"zBelow":return r.stddev?{op:"lte",value:r.mean-(Number.isFinite(l)?l:2)*r.stddev}:null;case"outlier":{const m=(Number.isFinite(l)&&l>0?l:1.5)*r.iqr;return r.iqr?{op:"outside",value:r.q1-m,value2:r.q3+m}:null}default:return null}}function k(t,r){const l=Number.isFinite(t)?t:r,o=l>1?l/100:l;return Math.max(0,Math.min(1,o))}function D(t,r){if(t.from==="minmax")return{...t,min:r.min,max:r.max};if(t.from==="quantile")return{...t,min:g(r.sorted,k(Number(t.low),5)),max:g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const l=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:r.mean-l*r.stddev,max:r.mean+l*r.stddev}}return t}function w(t,r){const l=Array.isArray(t)?t:[];return!r||!r.n?l.map(o=>o&&j([o])?{...o,enabled:!1}:o):l.map(o=>{if(!o||typeof o!="object")return o;if(o.scale&&o.scale.from)return{...o,scale:D(o.scale,r)};if(o.dataBar)return{...o,dataBar:I(o.dataBar,r)};if(o.iconSet)return{...o,iconSet:p(o.iconSet,r)};if(!o.when||!Q.includes(o.when.op))return o;const m=T(o.when,r);return m?{...o,when:m}:{...o,enabled:!1}})}function I(t,r){const l=Number.isFinite(Number(t.min))?Number(t.min):void 0,o=Number.isFinite(Number(t.max))?Number(t.max):void 0;if(l!==void 0&&o!==void 0)return{...t,min:l,max:o};if(t.from==="quantile")return{...t,min:l??g(r.sorted,k(Number(t.low),5)),max:o??g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const m=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:l??r.mean-m*r.stddev,max:o??r.mean+m*r.stddev}}return{...t,min:l??r.min,max:o??r.max}}function p(t,r){if(Array.isArray(t.thresholds))return t;const l=A(t),o=[];for(let m=1;m<l;m++)o.push(g(r.sorted,m/l));return{...t,thresholds:o}}function A(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.length;if(Number.isFinite(Number(t.count))&&Number(t.count)>=2)return Math.floor(Number(t.count));const r=X[t.set];return r?r.length:3}function q(t){return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}function F(t){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${t}"/></svg>`}function P(t,r){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${r==="up"?"8,2 14,13 2,13":r==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${t}"/></svg>`}function x(t,r){const l="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r*16} 16">`;for(let m=0;m<r;m++){const e=m<t?"#f5a623":"#d0d0d0";o+=`<path transform="translate(${m*16},0)" d="${l}" fill="${e}"/>`}return`${o}</svg>`}const E=Object.freeze([P("#c0392b","down"),P("#e0a800","right"),P("#2e7d32","up")]),Z=Object.freeze([F("#d13438"),F("#f5a623"),F("#2e9e44")]),X=Object.freeze({arrows:E,trafficLights:Z,ratings:Object.freeze([1,2,3,4,5].map(t=>x(t,5)))}),te=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function ne(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.map(o=>/^\s*(url\(|data:|<)/.test(String(o))&&String(o).trim().startsWith("<")?q(String(o)):String(o));const r=t.set||"arrows";if(r==="ratings"){const o=A(t),m=[];for(let e=1;e<=o;e++)m.push(q(x(e,o)));return m}const l=X[r];return l?l.map(q):(M(`iconSet:${r}`,`unknown icon set '${r}'; falling back to arrows.`),E.map(q))}function re(t){const r=Number(t.min),o=Number(t.max)-r,m=t.colour||t.color||"#5b9bd5",e=t.negativeColour||t.negativeColor||"#d13438",u=t.direction==="rtl"?"left":"right",c=f=>Math.max(0,Math.min(1,(f-r)/o))*100,a=o?Math.max(0,Math.min(100,(0-r)/o*100)):0;return f=>{if(H(f))return null;const y=Number(f);if(!Number.isFinite(y)||!o)return null;const N=c(y),O=Math.min(N,a),S=Math.max(N,a),C=y>=0?m:e;return{backgroundImage:`linear-gradient(to ${u}, transparent ${O}%, ${C} ${O}%, ${C} ${S}%, transparent ${S}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function ie(t){const r=ne(t),l=t.reverse?[...r].reverse():r,o=(Array.isArray(t.thresholds)?t.thresholds:[]).map(Number).filter(Number.isFinite),m=Number.isFinite(Number(t.size))?Number(t.size):16,e=t.set==="ratings"?m*A(t):m;return u=>{if(H(u))return null;const c=Number(u);if(!Number.isFinite(c))return null;let a=0;for(const y of o)c>=y&&a++;const f=l[Math.min(a,l.length-1)];return f?{backgroundImage:f,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${e}px ${m}px`,paddingLeft:`${e+4}px`}:null}}function _(t){const r=Array.isArray(t.colours)&&t.colours.length>=2?t.colours:["#f8f9fa","#1a6bc7"],l=Number(t.min),o=Number(t.max),m=o-l,e=r.length-1,u=[];for(let a=0;a<=e;a++)u.push(e?a/e:0);const c=Number(t.mid);if(t.mid!==void 0&&t.mid!==null)if(r.length%2===0)M("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${r.length} were given, so "mid" was ignored.`);else if(Number.isFinite(c)&&m&&c>Math.min(l,o)&&c<Math.max(l,o)){const a=e/2,f=Math.max(0,Math.min(1,(c-l)/m));for(let y=0;y<=e;y++)u[y]=y<=a?a?y/a*f:f:f+(y-a)/(e-a)*(1-f)}else Number.isFinite(c)&&M("formatting.scale.mid.range",`a scale's "mid" (${c}) is outside its min..max range, so it was ignored.`);return a=>{const f=Number(a);if(!Number.isFinite(f)||!m)return null;const y=Math.max(0,Math.min(1,(f-l)/m));let N=0;for(;N<e-1&&y>u[N+1];)N++;const O=u[N+1]-u[N],S=O>0?(y-u[N])/O:0;return{background:b(r[N],r[N+1],Math.max(0,Math.min(1,S)))}}}function oe(t,r=null){const l=j(t)?w(t,r):t,o=(Array.isArray(l)?l:[]).filter(e=>e&&typeof e=="object");if(!o.length)return()=>null;const m=o.map(e=>e.scale?{scale:_(e.scale),enabled:e.enabled!==!1}:e.dataBar?{scale:re(e.dataBar),enabled:e.enabled!==!1}:e.iconSet?{scale:ie(e.iconSet),enabled:e.enabled!==!1}:{when:e.when,style:e.style,stop:e.stopIfTrue!==!1,enabled:e.enabled!==!1});return e=>{const u=e?e.value:void 0;let c=null;for(const a of m){if(!a.enabled)continue;if(a.scale){const y=a.scale(u);y&&(c={...c||{},...y});continue}if(!L(u,a.when))continue;const f=W(a.style)?a.style(e):a.style;if(f&&(c={...c||{},...f}),a.stop)break}return c}}}),se("packages/modules/shared/emitter.js",function(d,K){"use strict";Object.defineProperty(d,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"Emitter",{enumerable:!0,get:function(){return $}}),Object.defineProperty(d,"gate",{enumerable:!0,get:function(){return H}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U="*",Q=new Set(["api","user","init","ai"]);function ee(L,b){return L&&L.name?L.name:`#${b}`}class ${#t=new Map;#e;constructor(b="module"){this.#e=String(b)}on(b,v){if(!W(v))return()=>{};let g=this.#t.get(b);return g||(g=new Set,this.#t.set(b,g)),g.add(v),()=>this.off(b,v)}off(b,v){const g=this.#t.get(b);g&&g.delete(v)}count(b){const v=this.#t.get(b);return v?v.size:0}emit(b,v){const g=this.#t.get(b),j=this.#t.get(U);if((!g||g.size===0)&&(!j||j.size===0))return;const T={...v||null,type:b};g&&g.size&&this.#n([...g],T,b),j&&j.size&&this.#n([...j],T,U)}#n(b,v,g){for(let j=0;j<b.length;j++)try{b[j](v)}catch(T){M(`${this.#e}.emit.throw:${g}:${ee(b[j],j)}`,`${this.#e}: a '${g}' handler threw; other handlers were unaffected.`,T)}}emitBefore(b,v,g){const j=g??(v&&v.origin),T=Q.has(j)?j:"user";let k=!1,D=null;const w=P=>{k=!0,P!=null&&D===null&&(D=String(P))},I={...v||null,type:b,origin:T,get defaultPrevented(){return k},get reason(){return D},preventDefault(P){w(P)}},p=this.#t.get(b);if(!p||p.size===0)return!0;const A=[...p],q=()=>(k&&D===null&&(D="prevented"),k&&v&&typeof v=="object"&&(v.reason=D),!k),F=[];for(let P=0;P<A.length;P++){const x=A[P];try{const E=x(I);E&&W(E.then)?F.push(E):E===!1&&w("prevented")}catch(E){w("error"),M(`${this.#e}.beforeThrow:${b}:${ee(x,P)}`,`${this.#e}: a '${b}' before-handler threw; the action was cancelled.`,E)}}return F.length===0?q():Promise.allSettled(F).then(P=>{for(const x of P)x.status==="rejected"?(w("error"),M(`${this.#e}.beforeReject:${b}`,`${this.#e}: a '${b}' before-handler rejected; the action was cancelled.`,x.reason)):x.value===!1&&w("prevented");return q()})}clear(){this.#t.clear()}}function H(L,b,v,g,j){const T=L.emitBefore(b,g,g.origin),k=()=>(L.emit(v,{...g,reason:g.reason||"prevented"}),!1);return T===!1?k():T&&W(T.then)?T.then(D=>D?j():k()):j()}}),se("packages/modules/alarms/index.js",function(d,K){"use strict";Object.defineProperty(d,"createAlarms",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"default",{enumerable:!0,get:function(){return D}});const R=K("packages/core/src/internal/util.js"),W=R.warnOnce,M=R.isFunction,Q=K("packages/core/src/formatting/rules.js").testRule,$=K("packages/modules/shared/emitter.js").Emitter,H=Object.freeze(["alarm:raised","alarm:cleared"]),L=new Set(["warn","critical"]);function b(w){return typeof w=="string"&&L.has(w)}function v(w,I){if(typeof w!="number"||Number.isNaN(w))return null;if(Array.isArray(I&&I.bands)){for(const A of I.bands){const q=A.min===void 0||A.min===null?-1/0:A.min,F=A.max===void 0||A.max===null?1/0:A.max;if(w>=q&&w<F)return A.status??null}return null}const p=I&&I.thresholds;return!p||p.warn===void 0||p.warn===null||p.critical===void 0||p.critical===null?null:p.direction==="lowerIsBetter"?w<=p.warn?"good":w<=p.critical?"warn":"critical":w>=p.warn?"good":w>=p.critical?"warn":"critical"}function g(w){const I=w||{};return{now:M(I.now)?I.now:()=>Date.now(),setTimeout:M(I.setTimeout)?I.setTimeout:((p,A)=>setTimeout(p,A)),clearTimeout:M(I.clearTimeout)?I.clearTimeout:(p=>clearTimeout(p))}}function j(w,I){return Number.isFinite(w)&&Number(w)>=0?Number(w):I}function T(w,I){return`${typeof w=="string"?w:JSON.stringify(w)}/${I}`}function k(w={}){const I=w||{},p=g(I.clock),A=j(I.holdMs,0),q=new $("alarms"),F=new Map,P=[],x=new Map,E=[];let Z=!1;const X=e=>{const u=(x.get(e)||0)+1;return x.set(e,u),`${e}#${u}`},te=(e,u)=>`${e.source}:${e.sourceId}:${e.key}:${u}`,ne=(e,u,c)=>({id:te(e,u),source:e.source,sourceId:e.sourceId,key:e.key,level:u,previous:c,value:e.value,threshold:e.threshold??null,band:e.band??null,at:p.now(),holdMs:e.holdMs}),re=(e,u)=>{q.emit(e,u);for(const c of E)c(u,e)},ie=(e,u)=>{const c=e.committed;if(c!==u&&(e.committed=u,b(c)&&(e.active=null,re("alarm:cleared",ne(e,c,c))),b(u))){const a=ne(e,u,c);e.active=a,re("alarm:raised",a)}},_=(e,u,c={})=>{if(Z)return;const a=`${e.source}\0${e.sourceId}\0${e.key}`;let f=F.get(a);if(f||(f={source:e.source,sourceId:e.sourceId,key:e.key,holdMs:e.holdMs,committed:null,active:null,pending:null,timer:null,value:void 0,threshold:null,band:null},F.set(a,f)),f.holdMs=e.holdMs,f.value=c.value,f.threshold=c.threshold??null,f.band=c.band??null,u===f.committed){f.timer!==null&&(p.clearTimeout(f.timer),f.timer=null),f.pending=null;return}if(!(b(f.committed)||b(u))||f.holdMs<=0){ie(f,u);return}f.pending={level:u,at:p.now()},f.timer===null&&(f.timer=p.setTimeout(()=>{f.timer=null;const N=f.pending;f.pending=null,N&&ie(f,N.level)},f.holdMs))},oe=e=>{const u=`${e.source}\0${e.sourceId}\0${e.key}`,c=F.get(u);c&&(_(e,null,{value:void 0}),c.timer===null&&c.pending===null&&F.delete(u))},t=e=>{const u=new Map;return(e&&e.config&&e.config.tiles||[]).forEach((a,f)=>{a&&u.set(String(a.id??a.label??`tile${f}`),a)}),u},r=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("kpi"),a=j(u.holdMs,A),f=t(e),y=(O,S,C)=>{const z=f.get(String(O))||{};_({source:"kpi",sourceId:c,key:String(O),holdMs:a},S??null,{value:C,threshold:z.thresholds??null,band:Array.isArray(z.bands)?z.bands:null})};for(const O of e.model&&e.model.tiles||[])y(O.id,O.status,O.value);const N=e.on("tile:status",O=>y(O.id,O.status,O.value));return()=>{M(N)&&N()}},l=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("grid"),a=j(u.holdMs,A),f=u.columns&&typeof u.columns=="object"?u.columns:null;(!f||Object.keys(f).length===0)&&W("alarms:grid-no-columns","alarms.attach(grid) was given no `columns`, so no cell can raise anything. Declare the columns to watch: attach(grid, { columns: { cpu: { thresholds: { warn: 80, critical: 95, direction: 'lowerIsBetter' } } } }).");let y=new Set;const N=()=>{const S=new Set;if(!(!M(e.rows.forEachAll)||!M(e.rows.value))){e.rows.forEachAll(C=>{const z=C&&C.key;if(z!=null)for(const[ue,J]of Object.entries(f||{})){if(!J)continue;const n=T(z,ue);S.add(n);const i=e.rows.value(z,ue);if(J.when&&!Q(i,J.when)){_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},null,{value:i});continue}_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},v(i,J),{value:i,threshold:J.thresholds??null,band:Array.isArray(J.bands)?J.bands:null})}});for(const C of y)S.has(C)||oe({source:"grid",sourceId:c,key:C,holdMs:a});y=S}},O=[];for(const S of["rows:changed","cell:changed","stream:chunk","stream:evicted"]){const C=e.on(S,N);M(C)&&O.push(C)}return N(),()=>{for(const S of O)S()}},o=(e,u,c)=>{const a=c.sourceId?String(c.sourceId):X("router"),f=j(c.holdMs,A),y=String(c.label??(typeof u=="function"?"route":u)),N=M(c.value)?c.value:(S=>S.length),O=e.monitor(u,N,S=>{_({source:"router",sourceId:a,key:y,holdMs:f},v(S,c),{value:S,threshold:c.thresholds??null,band:Array.isArray(c.bands)?c.bands:null})});return()=>{M(O)&&O()}};return{attach(e,u,c){if(Z||!e||typeof e!="object")return this;if(M(e.monitor)){const f=c||{},y=o(e,u,f);return P.push({kind:"router",sourceId:f.sourceId||"",release:y}),this}const a=u&&typeof u=="object"?u:{};return e.model&&Array.isArray(e.model.tiles)&&M(e.on)?(P.push({kind:"kpi",sourceId:a.sourceId||"",release:r(e,a)}),this):e.rows&&M(e.on)?(P.push({kind:"grid",sourceId:a.sourceId||"",release:l(e,a)}),this):(W("alarms:unknown-source","alarms.attach() was given something that is not a KPI panel, a grid or a data router; nothing was attached and no alarm can be raised from it."),this)},on(e,u){return H.includes(e)?q.on(e,u):(W(`alarms:unknown-event:${e}`,`alarms.on('${e}') will never fire; an alarm set emits ${H.join(" and ")}.`),()=>{})},active(){const e=[];for(const u of F.values())u.active&&e.push({...u.active});return e},pending(){const e=[];for(const u of F.values())u.pending&&e.push({id:te(u,u.pending.level),source:u.source,sourceId:u.sourceId,key:u.key,level:u.pending.level,previous:u.committed,value:u.value,at:u.pending.at,holdMs:u.holdMs});return e},publish(e,u="alarms"){if(Z||!e||!M(e.addSource))return W("alarms:publish-no-router","alarms.publish() needs a data router with addSource(); nothing was published."),this;const c=e.addSource(String(u));let a=0;return E.push((f,y)=>{a+=1,c.push({op:"upsert",row:{...f,id:`${f.id}#${a}`,alarmId:f.id,kind:String(u),state:y==="alarm:raised"?"raised":"cleared"}})}),this},destroy(){if(!Z){Z=!0;for(const e of P)try{e.release()}catch{}P.length=0;for(const e of F.values())e.timer!==null&&(p.clearTimeout(e.timer),e.timer=null),e.pending=null;F.clear(),E.length=0,q.clear()}}}}const D=k});const de=fe("packages/modules/alarms/index.js"),me=de.createAlarms;var he=de.default;export{me as createAlarms,he as default};
7
7
 
8
8
  //# sourceMappingURL=alarms.esm.min.js.map
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Lattice Grid 1.86.4, alarms module
2
+ * Lattice Grid 1.86.5, alarms module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(me){"use strict";var ae=Object.create(null),fe=Object.create(null);function ue(d,K){ae[d]=K}function de(d){var K=fe[d];if(K)return K;var R=Object.create(null);fe[d]=R;var W=ae[d];if(!W)throw new Error("[lattice] missing module: "+d);return W(R,de),R}ue("packages/core/src/internal/util.js",function(d,K){"use strict";Object.defineProperty(d,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(d,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"warnOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"infoOnce",{enumerable:!0,get:function(){return F}}),Object.defineProperty(d,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"fail",{enumerable:!0,get:function(){return D}}),Object.defineProperty(d,"invariant",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"DEV",{enumerable:!0,get:function(){return I}}),Object.defineProperty(d,"isObject",{enumerable:!0,get:function(){return p}}),Object.defineProperty(d,"isFunction",{enumerable:!0,get:function(){return $}}),Object.defineProperty(d,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(d,"isBlank",{enumerable:!0,get:function(){return T}}),Object.defineProperty(d,"isCtor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(d,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(d,"pathSetter",{enumerable:!0,get:function(){return X}}),Object.defineProperty(d,"getPath",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"setPath",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(d,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(d,"escapeHtml",{enumerable:!0,get:function(){return _}}),Object.defineProperty(d,"titleCase",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(d,"expand",{enumerable:!0,get:function(){return t}}),Object.defineProperty(d,"toArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(d,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(d,"mergeRow",{enumerable:!0,get:function(){return m}}),Object.defineProperty(d,"Lru",{enumerable:!0,get:function(){return e}}),Object.defineProperty(d,"collator",{enumerable:!0,get:function(){return c}}),Object.defineProperty(d,"defaultCompare",{enumerable:!0,get:function(){return a}}),Object.defineProperty(d,"now",{enumerable:!0,get:function(){return f}}),Object.defineProperty(d,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(d,"cancelFrame",{enumerable:!0,get:function(){return O}}),Object.defineProperty(d,"frameBatched",{enumerable:!0,get:function(){return S}}),Object.defineProperty(d,"settleDebounce",{enumerable:!0,get:function(){return C}}),Object.defineProperty(d,"whenIdle",{enumerable:!0,get:function(){return z}}),Object.defineProperty(d,"uid",{enumerable:!0,get:function(){return J}});const R="1.86.4";async function W(){return R}const M="1.86.4",U=new Set,Q=2e3;function ee(n){if(U.add(n),U.size>Q){const i=U.values().next().value;i!==void 0&&U.delete(i)}}const A=[],H=500;function L(n,i,s){A.push({key:n,level:i,message:s.map(h=>typeof h=="string"?h:b(h)).join(" "),at:Date.now()}),A.length>H&&A.shift()}function b(n){if(n instanceof Error)return n.message;try{return JSON.stringify(n)}catch{return String(n)}}function v(){return A.map(n=>({...n}))}function g(n){if(n.length===0||typeof n[0]!="string")return n;const i=n[0].replace(/^\[lattice\]\s*/,"");return i===n[0]?n:[i,...n.slice(1)]}function j(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"warn",s),console.warn("[lattice]",...s)}function F(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"info",s),console.info("[lattice]",...s)}function k(){U.clear(),A.length=0}function D(n,i){const s=new Error(`[lattice] ${n}`);throw i!==void 0&&(s.cause=i),s}function w(n,i){n||D(i)}const I=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function p(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function $(n){return typeof n=="function"}function q(n){return n==null}function T(n){return n==null||n===""}function P(n){return typeof n!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(n))?!0:!!(n.prototype&&Object.getOwnPropertyNames(n.prototype).length>1)}const x=new Map;function E(n){let i=x.get(n);if(i)return i;if(!n.includes("."))i=s=>s?.[n];else{const s=n.split("."),h=s.length;i=V=>{let G=V;for(let B=0;B<h;B++){if(G==null)return;G=G[s[B]]}return G}}return x.set(n,i),i}const Z=new Map;function X(n){let i=Z.get(n);if(i)return i;if(!n.includes("."))i=(s,h)=>{s!=null&&(s[n]=h)};else{const s=n.split("."),h=s.length-1;i=(V,G)=>{let B=V;for(let Y=0;Y<h;Y++){if(B==null)return;const le=s[Y];B[le]==null&&(B[le]={}),B=B[le]}B!=null&&(B[s[h]]=G)}}return Z.set(n,i),i}function te(n,i){return E(i)(n)}function ne(n,i,s){X(i)(n,s)}function re(n){return n?(n.includes(".")?n.slice(n.lastIndexOf(".")+1):n).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase()):""}const ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _(n){const i=n==null?"":String(n);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,s=>ie[s]):i}function oe(n){return String(n).replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}function t(n,i,s){if(n!==void 0)return n===!0?{enabled:!0,...s}:n===!1?{enabled:!1}:p(n)?n:{[i]:n,enabled:!0}}function r(n){return n==null?[]:Array.isArray(n)?n:[n]}const l=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(n,i){if(!p(n))return p(i)?{...i}:i;if(!p(i))return i===void 0?n:i;const s={...n};for(const h of Object.keys(i)){if(l.has(h))continue;const V=i[h];V!==void 0&&(s[h]=p(V)&&p(s[h])?o(s[h],V):V)}return s}function m(n,i){if(!p(n)||!p(i)||n===i)return i;const s=Object.create(Object.getPrototypeOf(n));return Object.assign(s,n,i),s}class e{#t;#e=new Map;#n;constructor(i=256,s=null){this.#t=i,this.#n=s}get size(){return this.#e.size}get max(){return this.#t}set max(i){this.#t=i,this.#r()}has(i){return this.#e.has(i)}get(i){const s=this.#e;if(!s.has(i))return;const h=s.get(i);return s.delete(i),s.set(i,h),h}peek(i){return this.#e.get(i)}set(i,s){const h=this.#e;return h.has(i)&&h.delete(i),h.set(i,s),this.#r(),s}delete(i){const s=this.#e.get(i);return this.#e.delete(i)&&this.#n&&this.#n(s,i),s}clear(){if(this.#n)for(const[i,s]of this.#e)this.#n(s,i);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const i=this.#e;for(;i.size>this.#t;){const s=i.keys().next().value,h=i.get(s);i.delete(s),this.#n&&this.#n(h,s)}}}const u=new Map;function c(n,i){const s=`${n||""}|${i?JSON.stringify(i):""}`;let h=u.get(s);return h||(h=new Intl.Collator(n||void 0,{numeric:!0,sensitivity:"variant",...i}),u.set(s,h)),h}function a(n,i){if(n===i)return 0;if(n==null)return 1;if(i==null)return-1;if(typeof n=="number"&&typeof i=="number")return Number.isNaN(n)?Number.isNaN(i)?0:1:Number.isNaN(i)||n<i?-1:n>i?1:0;const s=String(n),h=String(i);return s<h?-1:s>h?1:0}function f(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const y=typeof requestAnimationFrame=="function";function N(n){return y?requestAnimationFrame(n):setTimeout(()=>n(f()),16)}function O(n){n!=null&&(y?cancelAnimationFrame(n):clearTimeout(n))}function S(n){let i=null,s=null;const h=()=>{i=null;const G=s;s=null,n(...G||[])},V=(...G)=>{s=G,i===null&&(i=N(h))};return V.cancel=()=>{O(i),i=null,s=null},V.flush=()=>{i!==null&&(O(i),h())},V}function C(n,i){let s=null,h=null;const V=()=>{if(s=null,h===null)return;const Y=h;h=null,n(...Y),G()},G=()=>{s=setTimeout(V,i),typeof s?.unref=="function"&&s.unref()},B=(...Y)=>{s===null?(n(...Y),G()):(h=Y,clearTimeout(s),G())};return B.flush=()=>{if(s!==null&&clearTimeout(s),s=null,h===null)return;const Y=h;h=null,n(...Y)},B.cancel=()=>{s!==null&&clearTimeout(s),s=null,h=null},B.pending=()=>s!==null||h!==null,B}function z(n,i=50){return typeof requestIdleCallback=="function"?requestIdleCallback(n,{timeout:i}):setTimeout(()=>n({timeRemaining:()=>0,didTimeout:!0}),1)}let se=0;function J(n="l"){return`${n}${(++se).toString(36)}`}}),ue("packages/core/src/formatting/rules.js",function(d,K){"use strict";Object.defineProperty(d,"RULE_OPS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(d,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(d,"testRule",{enumerable:!0,get:function(){return L}}),Object.defineProperty(d,"mixColour",{enumerable:!0,get:function(){return b}}),Object.defineProperty(d,"summariseColumn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"quantileOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(d,"needsDistribution",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"resolveDistribution",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"ICON_SETS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"compileRules",{enumerable:!0,get:function(){return oe}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),ee=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function A(t,r){const l=Number(t),o=Number(r);if(t!==null&&t!==""&&r!==null&&r!==""&&Number.isFinite(l)&&Number.isFinite(o))return l<o?-1:l>o?1:0;const e=String(t??"").toLowerCase(),u=String(r??"").toLowerCase();return e<u?-1:e>u?1:0}function H(t){return t==null||t===""}function L(t,r){if(!r||typeof r!="object")return!1;const{op:l}=r,o=r.value,m=r.value2;switch(l){case"blank":return H(t);case"notBlank":return!H(t);case"true":return t===!0;case"false":return t===!1;default:break}if(H(t))return!1;switch(l){case"eq":return A(t,o)===0;case"ne":return A(t,o)!==0;case"gt":return A(t,o)>0;case"gte":return A(t,o)>=0;case"lt":return A(t,o)<0;case"lte":return A(t,o)<=0;case"between":return A(t,o)>=0&&A(t,m)<=0;case"outside":return A(t,o)<0||A(t,m)>0;case"contains":return String(t).toLowerCase().includes(String(o??"").toLowerCase());case"notContains":return!String(t).toLowerCase().includes(String(o??"").toLowerCase());case"startsWith":return String(t).toLowerCase().startsWith(String(o??"").toLowerCase());case"endsWith":return String(t).toLowerCase().endsWith(String(o??"").toLowerCase());default:return!1}}function b(t,r,l){const o=O=>{const S=String(O).replace("#",""),C=S.length===3?S.split("").map(z=>z+z).join(""):S;return[0,2,4].map(z=>parseInt(C.slice(z,z+2),16)||0)},[m,e,u]=o(t),[c,a,f]=o(r),y=Math.max(0,Math.min(1,l)),N=(O,S)=>Math.round(O+(S-O)*y);return`#${[N(m,c),N(e,a),N(u,f)].map(O=>O.toString(16).padStart(2,"0")).join("")}`}function v(t){const r=[];for(const c of t||[]){if(c==null||c==="")continue;const a=c instanceof Date?c.getTime():Number(c);Number.isFinite(a)&&r.push(a)}if(!r.length)return null;r.sort((c,a)=>c-a);let l=0,o=0,m=0;for(const c of r){l++;const a=c-o;o+=a/l,m+=a*(c-o)}const e=g(r,.25),u=g(r,.75);return{n:r.length,min:r[0],max:r[r.length-1],mean:o,stddev:r.length>1?Math.sqrt(m/(r.length-1)):0,median:g(r,.5),q1:e,q3:u,iqr:u-e,sorted:r}}function g(t,r){if(!t.length)return 0;const l=(t.length-1)*Math.max(0,Math.min(1,r)),o=Math.floor(l),m=Math.ceil(l);return o===m?t[o]:t[o]+(l-o)*(t[m]-t[o])}function j(t){for(const r of Array.isArray(t)?t:[])if(!(!r||typeof r!="object")&&(r.when&&Q.includes(r.when.op)||r.scale&&r.scale.from||r.dataBar&&!(Number.isFinite(Number(r.dataBar.min))&&Number.isFinite(Number(r.dataBar.max)))||r.iconSet&&!Array.isArray(r.iconSet.thresholds)))return!0;return!1}function F(t,r){const l=Number(t.value),o=m=>g(r.sorted,m);switch(t.op){case"topPercent":{const m=k(l,10);return{op:"gte",value:o(1-m)}}case"bottomPercent":{const m=k(l,10);return{op:"lte",value:o(m)}}case"topN":{const m=Math.max(1,Math.floor(l)||1),e=Math.max(0,r.sorted.length-m);return{op:"gte",value:r.sorted[e]}}case"bottomN":{const m=Math.max(1,Math.floor(l)||1),e=Math.min(r.sorted.length-1,m-1);return{op:"lte",value:r.sorted[e]}}case"aboveMean":return{op:"gt",value:r.mean};case"belowMean":return{op:"lt",value:r.mean};case"aboveMedian":return{op:"gt",value:r.median};case"belowMedian":return{op:"lt",value:r.median};case"zAbove":return r.stddev?{op:"gte",value:r.mean+(Number.isFinite(l)?l:2)*r.stddev}:null;case"zBelow":return r.stddev?{op:"lte",value:r.mean-(Number.isFinite(l)?l:2)*r.stddev}:null;case"outlier":{const m=(Number.isFinite(l)&&l>0?l:1.5)*r.iqr;return r.iqr?{op:"outside",value:r.q1-m,value2:r.q3+m}:null}default:return null}}function k(t,r){const l=Number.isFinite(t)?t:r,o=l>1?l/100:l;return Math.max(0,Math.min(1,o))}function D(t,r){if(t.from==="minmax")return{...t,min:r.min,max:r.max};if(t.from==="quantile")return{...t,min:g(r.sorted,k(Number(t.low),5)),max:g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const l=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:r.mean-l*r.stddev,max:r.mean+l*r.stddev}}return t}function w(t,r){const l=Array.isArray(t)?t:[];return!r||!r.n?l.map(o=>o&&j([o])?{...o,enabled:!1}:o):l.map(o=>{if(!o||typeof o!="object")return o;if(o.scale&&o.scale.from)return{...o,scale:D(o.scale,r)};if(o.dataBar)return{...o,dataBar:I(o.dataBar,r)};if(o.iconSet)return{...o,iconSet:p(o.iconSet,r)};if(!o.when||!Q.includes(o.when.op))return o;const m=F(o.when,r);return m?{...o,when:m}:{...o,enabled:!1}})}function I(t,r){const l=Number.isFinite(Number(t.min))?Number(t.min):void 0,o=Number.isFinite(Number(t.max))?Number(t.max):void 0;if(l!==void 0&&o!==void 0)return{...t,min:l,max:o};if(t.from==="quantile")return{...t,min:l??g(r.sorted,k(Number(t.low),5)),max:o??g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const m=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:l??r.mean-m*r.stddev,max:o??r.mean+m*r.stddev}}return{...t,min:l??r.min,max:o??r.max}}function p(t,r){if(Array.isArray(t.thresholds))return t;const l=$(t),o=[];for(let m=1;m<l;m++)o.push(g(r.sorted,m/l));return{...t,thresholds:o}}function $(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.length;if(Number.isFinite(Number(t.count))&&Number(t.count)>=2)return Math.floor(Number(t.count));const r=X[t.set];return r?r.length:3}function q(t){return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}function T(t){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${t}"/></svg>`}function P(t,r){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${r==="up"?"8,2 14,13 2,13":r==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${t}"/></svg>`}function x(t,r){const l="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r*16} 16">`;for(let m=0;m<r;m++){const e=m<t?"#f5a623":"#d0d0d0";o+=`<path transform="translate(${m*16},0)" d="${l}" fill="${e}"/>`}return`${o}</svg>`}const E=Object.freeze([P("#c0392b","down"),P("#e0a800","right"),P("#2e7d32","up")]),Z=Object.freeze([T("#d13438"),T("#f5a623"),T("#2e9e44")]),X=Object.freeze({arrows:E,trafficLights:Z,ratings:Object.freeze([1,2,3,4,5].map(t=>x(t,5)))}),te=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function ne(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.map(o=>/^\s*(url\(|data:|<)/.test(String(o))&&String(o).trim().startsWith("<")?q(String(o)):String(o));const r=t.set||"arrows";if(r==="ratings"){const o=$(t),m=[];for(let e=1;e<=o;e++)m.push(q(x(e,o)));return m}const l=X[r];return l?l.map(q):(M(`iconSet:${r}`,`unknown icon set '${r}'; falling back to arrows.`),E.map(q))}function re(t){const r=Number(t.min),o=Number(t.max)-r,m=t.colour||t.color||"#5b9bd5",e=t.negativeColour||t.negativeColor||"#d13438",u=t.direction==="rtl"?"left":"right",c=f=>Math.max(0,Math.min(1,(f-r)/o))*100,a=o?Math.max(0,Math.min(100,(0-r)/o*100)):0;return f=>{if(H(f))return null;const y=Number(f);if(!Number.isFinite(y)||!o)return null;const N=c(y),O=Math.min(N,a),S=Math.max(N,a),C=y>=0?m:e;return{backgroundImage:`linear-gradient(to ${u}, transparent ${O}%, ${C} ${O}%, ${C} ${S}%, transparent ${S}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function ie(t){const r=ne(t),l=t.reverse?[...r].reverse():r,o=(Array.isArray(t.thresholds)?t.thresholds:[]).map(Number).filter(Number.isFinite),m=Number.isFinite(Number(t.size))?Number(t.size):16,e=t.set==="ratings"?m*$(t):m;return u=>{if(H(u))return null;const c=Number(u);if(!Number.isFinite(c))return null;let a=0;for(const y of o)c>=y&&a++;const f=l[Math.min(a,l.length-1)];return f?{backgroundImage:f,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${e}px ${m}px`,paddingLeft:`${e+4}px`}:null}}function _(t){const r=Array.isArray(t.colours)&&t.colours.length>=2?t.colours:["#f8f9fa","#1a6bc7"],l=Number(t.min),o=Number(t.max),m=o-l,e=r.length-1,u=[];for(let a=0;a<=e;a++)u.push(e?a/e:0);const c=Number(t.mid);if(t.mid!==void 0&&t.mid!==null)if(r.length%2===0)M("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${r.length} were given, so "mid" was ignored.`);else if(Number.isFinite(c)&&m&&c>Math.min(l,o)&&c<Math.max(l,o)){const a=e/2,f=Math.max(0,Math.min(1,(c-l)/m));for(let y=0;y<=e;y++)u[y]=y<=a?a?y/a*f:f:f+(y-a)/(e-a)*(1-f)}else Number.isFinite(c)&&M("formatting.scale.mid.range",`a scale's "mid" (${c}) is outside its min..max range, so it was ignored.`);return a=>{const f=Number(a);if(!Number.isFinite(f)||!m)return null;const y=Math.max(0,Math.min(1,(f-l)/m));let N=0;for(;N<e-1&&y>u[N+1];)N++;const O=u[N+1]-u[N],S=O>0?(y-u[N])/O:0;return{background:b(r[N],r[N+1],Math.max(0,Math.min(1,S)))}}}function oe(t,r=null){const l=j(t)?w(t,r):t,o=(Array.isArray(l)?l:[]).filter(e=>e&&typeof e=="object");if(!o.length)return()=>null;const m=o.map(e=>e.scale?{scale:_(e.scale),enabled:e.enabled!==!1}:e.dataBar?{scale:re(e.dataBar),enabled:e.enabled!==!1}:e.iconSet?{scale:ie(e.iconSet),enabled:e.enabled!==!1}:{when:e.when,style:e.style,stop:e.stopIfTrue!==!1,enabled:e.enabled!==!1});return e=>{const u=e?e.value:void 0;let c=null;for(const a of m){if(!a.enabled)continue;if(a.scale){const y=a.scale(u);y&&(c={...c||{},...y});continue}if(!L(u,a.when))continue;const f=W(a.style)?a.style(e):a.style;if(f&&(c={...c||{},...f}),a.stop)break}return c}}}),ue("packages/modules/shared/emitter.js",function(d,K){"use strict";Object.defineProperty(d,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"Emitter",{enumerable:!0,get:function(){return A}}),Object.defineProperty(d,"gate",{enumerable:!0,get:function(){return H}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U="*",Q=new Set(["api","user","init","ai"]);function ee(L,b){return L&&L.name?L.name:`#${b}`}class A{#t=new Map;#e;constructor(b="module"){this.#e=String(b)}on(b,v){if(!W(v))return()=>{};let g=this.#t.get(b);return g||(g=new Set,this.#t.set(b,g)),g.add(v),()=>this.off(b,v)}off(b,v){const g=this.#t.get(b);g&&g.delete(v)}count(b){const v=this.#t.get(b);return v?v.size:0}emit(b,v){const g=this.#t.get(b),j=this.#t.get(U);if((!g||g.size===0)&&(!j||j.size===0))return;const F={...v||null,type:b};g&&g.size&&this.#n([...g],F,b),j&&j.size&&this.#n([...j],F,U)}#n(b,v,g){for(let j=0;j<b.length;j++)try{b[j](v)}catch(F){M(`${this.#e}.emit.throw:${g}:${ee(b[j],j)}`,`${this.#e}: a '${g}' handler threw; other handlers were unaffected.`,F)}}emitBefore(b,v,g){const j=g??(v&&v.origin),F=Q.has(j)?j:"user";let k=!1,D=null;const w=P=>{k=!0,P!=null&&D===null&&(D=String(P))},I={...v||null,type:b,origin:F,get defaultPrevented(){return k},get reason(){return D},preventDefault(P){w(P)}},p=this.#t.get(b);if(!p||p.size===0)return!0;const $=[...p],q=()=>(k&&D===null&&(D="prevented"),k&&v&&typeof v=="object"&&(v.reason=D),!k),T=[];for(let P=0;P<$.length;P++){const x=$[P];try{const E=x(I);E&&W(E.then)?T.push(E):E===!1&&w("prevented")}catch(E){w("error"),M(`${this.#e}.beforeThrow:${b}:${ee(x,P)}`,`${this.#e}: a '${b}' before-handler threw; the action was cancelled.`,E)}}return T.length===0?q():Promise.allSettled(T).then(P=>{for(const x of P)x.status==="rejected"?(w("error"),M(`${this.#e}.beforeReject:${b}`,`${this.#e}: a '${b}' before-handler rejected; the action was cancelled.`,x.reason)):x.value===!1&&w("prevented");return q()})}clear(){this.#t.clear()}}function H(L,b,v,g,j){const F=L.emitBefore(b,g,g.origin),k=()=>(L.emit(v,{...g,reason:g.reason||"prevented"}),!1);return F===!1?k():F&&W(F.then)?F.then(D=>D?j():k()):j()}}),ue("packages/modules/alarms/index.js",function(d,K){"use strict";Object.defineProperty(d,"createAlarms",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"default",{enumerable:!0,get:function(){return D}});const R=K("packages/core/src/internal/util.js"),W=R.warnOnce,M=R.isFunction,Q=K("packages/core/src/formatting/rules.js").testRule,A=K("packages/modules/shared/emitter.js").Emitter,H=Object.freeze(["alarm:raised","alarm:cleared"]),L=new Set(["warn","critical"]);function b(w){return typeof w=="string"&&L.has(w)}function v(w,I){if(typeof w!="number"||Number.isNaN(w))return null;if(Array.isArray(I&&I.bands)){for(const $ of I.bands){const q=$.min===void 0||$.min===null?-1/0:$.min,T=$.max===void 0||$.max===null?1/0:$.max;if(w>=q&&w<T)return $.status??null}return null}const p=I&&I.thresholds;return!p||p.warn===void 0||p.warn===null||p.critical===void 0||p.critical===null?null:p.direction==="lowerIsBetter"?w<=p.warn?"good":w<=p.critical?"warn":"critical":w>=p.warn?"good":w>=p.critical?"warn":"critical"}function g(w){const I=w||{};return{now:M(I.now)?I.now:()=>Date.now(),setTimeout:M(I.setTimeout)?I.setTimeout:((p,$)=>setTimeout(p,$)),clearTimeout:M(I.clearTimeout)?I.clearTimeout:(p=>clearTimeout(p))}}function j(w,I){return Number.isFinite(w)&&Number(w)>=0?Number(w):I}function F(w,I){return`${typeof w=="string"?w:JSON.stringify(w)}/${I}`}function k(w={}){const I=w||{},p=g(I.clock),$=j(I.holdMs,0),q=new A("alarms"),T=new Map,P=[],x=new Map,E=[];let Z=!1;const X=e=>{const u=(x.get(e)||0)+1;return x.set(e,u),`${e}#${u}`},te=(e,u)=>`${e.source}:${e.sourceId}:${e.key}:${u}`,ne=(e,u,c)=>({id:te(e,u),source:e.source,sourceId:e.sourceId,key:e.key,level:u,previous:c,value:e.value,threshold:e.threshold??null,band:e.band??null,at:p.now(),holdMs:e.holdMs}),re=(e,u)=>{q.emit(e,u);for(const c of E)c(u,e)},ie=(e,u)=>{const c=e.committed;if(c!==u&&(e.committed=u,b(c)&&(e.active=null,re("alarm:cleared",ne(e,c,c))),b(u))){const a=ne(e,u,c);e.active=a,re("alarm:raised",a)}},_=(e,u,c={})=>{if(Z)return;const a=`${e.source}\0${e.sourceId}\0${e.key}`;let f=T.get(a);if(f||(f={source:e.source,sourceId:e.sourceId,key:e.key,holdMs:e.holdMs,committed:null,active:null,pending:null,timer:null,value:void 0,threshold:null,band:null},T.set(a,f)),f.holdMs=e.holdMs,f.value=c.value,f.threshold=c.threshold??null,f.band=c.band??null,u===f.committed){f.timer!==null&&(p.clearTimeout(f.timer),f.timer=null),f.pending=null;return}if(!(b(f.committed)||b(u))||f.holdMs<=0){ie(f,u);return}f.pending={level:u,at:p.now()},f.timer===null&&(f.timer=p.setTimeout(()=>{f.timer=null;const N=f.pending;f.pending=null,N&&ie(f,N.level)},f.holdMs))},oe=e=>{const u=`${e.source}\0${e.sourceId}\0${e.key}`,c=T.get(u);c&&(_(e,null,{value:void 0}),c.timer===null&&c.pending===null&&T.delete(u))},t=e=>{const u=new Map;return(e&&e.config&&e.config.tiles||[]).forEach((a,f)=>{a&&u.set(String(a.id??a.label??`tile${f}`),a)}),u},r=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("kpi"),a=j(u.holdMs,$),f=t(e),y=(O,S,C)=>{const z=f.get(String(O))||{};_({source:"kpi",sourceId:c,key:String(O),holdMs:a},S??null,{value:C,threshold:z.thresholds??null,band:Array.isArray(z.bands)?z.bands:null})};for(const O of e.model&&e.model.tiles||[])y(O.id,O.status,O.value);const N=e.on("tile:status",O=>y(O.id,O.status,O.value));return()=>{M(N)&&N()}},l=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("grid"),a=j(u.holdMs,$),f=u.columns&&typeof u.columns=="object"?u.columns:null;(!f||Object.keys(f).length===0)&&W("alarms:grid-no-columns","alarms.attach(grid) was given no `columns`, so no cell can raise anything. Declare the columns to watch: attach(grid, { columns: { cpu: { thresholds: { warn: 80, critical: 95, direction: 'lowerIsBetter' } } } }).");let y=new Set;const N=()=>{const S=new Set;if(!(!M(e.rows.forEachAll)||!M(e.rows.value))){e.rows.forEachAll(C=>{const z=C&&C.key;if(z!=null)for(const[se,J]of Object.entries(f||{})){if(!J)continue;const n=F(z,se);S.add(n);const i=e.rows.value(z,se);if(J.when&&!Q(i,J.when)){_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},null,{value:i});continue}_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},v(i,J),{value:i,threshold:J.thresholds??null,band:Array.isArray(J.bands)?J.bands:null})}});for(const C of y)S.has(C)||oe({source:"grid",sourceId:c,key:C,holdMs:a});y=S}},O=[];for(const S of["rows:changed","cell:changed","stream:chunk","stream:evicted"]){const C=e.on(S,N);M(C)&&O.push(C)}return N(),()=>{for(const S of O)S()}},o=(e,u,c)=>{const a=c.sourceId?String(c.sourceId):X("router"),f=j(c.holdMs,$),y=String(c.label??(typeof u=="function"?"route":u)),N=M(c.value)?c.value:(S=>S.length),O=e.monitor(u,N,S=>{_({source:"router",sourceId:a,key:y,holdMs:f},v(S,c),{value:S,threshold:c.thresholds??null,band:Array.isArray(c.bands)?c.bands:null})});return()=>{M(O)&&O()}};return{attach(e,u,c){if(Z||!e||typeof e!="object")return this;if(M(e.monitor)){const f=c||{},y=o(e,u,f);return P.push({kind:"router",sourceId:f.sourceId||"",release:y}),this}const a=u&&typeof u=="object"?u:{};return e.model&&Array.isArray(e.model.tiles)&&M(e.on)?(P.push({kind:"kpi",sourceId:a.sourceId||"",release:r(e,a)}),this):e.rows&&M(e.on)?(P.push({kind:"grid",sourceId:a.sourceId||"",release:l(e,a)}),this):(W("alarms:unknown-source","alarms.attach() was given something that is not a KPI panel, a grid or a data router; nothing was attached and no alarm can be raised from it."),this)},on(e,u){return H.includes(e)?q.on(e,u):(W(`alarms:unknown-event:${e}`,`alarms.on('${e}') will never fire; an alarm set emits ${H.join(" and ")}.`),()=>{})},active(){const e=[];for(const u of T.values())u.active&&e.push({...u.active});return e},pending(){const e=[];for(const u of T.values())u.pending&&e.push({id:te(u,u.pending.level),source:u.source,sourceId:u.sourceId,key:u.key,level:u.pending.level,previous:u.committed,value:u.value,at:u.pending.at,holdMs:u.holdMs});return e},publish(e,u="alarms"){if(Z||!e||!M(e.addSource))return W("alarms:publish-no-router","alarms.publish() needs a data router with addSource(); nothing was published."),this;const c=e.addSource(String(u));let a=0;return E.push((f,y)=>{a+=1,c.push({op:"upsert",row:{...f,id:`${f.id}#${a}`,alarmId:f.id,kind:String(u),state:y==="alarm:raised"?"raised":"cleared"}})}),this},destroy(){if(!Z){Z=!0;for(const e of P)try{e.release()}catch{}P.length=0;for(const e of T.values())e.timer!==null&&(p.clearTimeout(e.timer),e.timer=null),e.pending=null;T.clear(),E.length=0,q.clear()}}}}const D=k});var ce=de("packages/modules/alarms/index.js");typeof module=="object"&&module.exports?module.exports=ce:typeof define=="function"&&define.amd?define(function(){return ce}):me.LatticeGridAlarms=ce})(typeof globalThis<"u"?globalThis:this);
6
+ (function(me){"use strict";var ae=Object.create(null),fe=Object.create(null);function ue(d,K){ae[d]=K}function de(d){var K=fe[d];if(K)return K;var R=Object.create(null);fe[d]=R;var W=ae[d];if(!W)throw new Error("[lattice] missing module: "+d);return W(R,de),R}ue("packages/core/src/internal/util.js",function(d,K){"use strict";Object.defineProperty(d,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(d,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"warnOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"infoOnce",{enumerable:!0,get:function(){return F}}),Object.defineProperty(d,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"fail",{enumerable:!0,get:function(){return D}}),Object.defineProperty(d,"invariant",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"DEV",{enumerable:!0,get:function(){return I}}),Object.defineProperty(d,"isObject",{enumerable:!0,get:function(){return p}}),Object.defineProperty(d,"isFunction",{enumerable:!0,get:function(){return $}}),Object.defineProperty(d,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(d,"isBlank",{enumerable:!0,get:function(){return T}}),Object.defineProperty(d,"isCtor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(d,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(d,"pathSetter",{enumerable:!0,get:function(){return X}}),Object.defineProperty(d,"getPath",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"setPath",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(d,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(d,"escapeHtml",{enumerable:!0,get:function(){return _}}),Object.defineProperty(d,"titleCase",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(d,"expand",{enumerable:!0,get:function(){return t}}),Object.defineProperty(d,"toArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(d,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(d,"mergeRow",{enumerable:!0,get:function(){return m}}),Object.defineProperty(d,"Lru",{enumerable:!0,get:function(){return e}}),Object.defineProperty(d,"collator",{enumerable:!0,get:function(){return c}}),Object.defineProperty(d,"defaultCompare",{enumerable:!0,get:function(){return a}}),Object.defineProperty(d,"now",{enumerable:!0,get:function(){return f}}),Object.defineProperty(d,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(d,"cancelFrame",{enumerable:!0,get:function(){return O}}),Object.defineProperty(d,"frameBatched",{enumerable:!0,get:function(){return S}}),Object.defineProperty(d,"settleDebounce",{enumerable:!0,get:function(){return C}}),Object.defineProperty(d,"whenIdle",{enumerable:!0,get:function(){return z}}),Object.defineProperty(d,"uid",{enumerable:!0,get:function(){return J}});const R="1.86.5";async function W(){return R}const M="1.86.5",U=new Set,Q=2e3;function ee(n){if(U.add(n),U.size>Q){const i=U.values().next().value;i!==void 0&&U.delete(i)}}const A=[],H=500;function L(n,i,s){A.push({key:n,level:i,message:s.map(h=>typeof h=="string"?h:b(h)).join(" "),at:Date.now()}),A.length>H&&A.shift()}function b(n){if(n instanceof Error)return n.message;try{return JSON.stringify(n)}catch{return String(n)}}function v(){return A.map(n=>({...n}))}function g(n){if(n.length===0||typeof n[0]!="string")return n;const i=n[0].replace(/^\[lattice\]\s*/,"");return i===n[0]?n:[i,...n.slice(1)]}function j(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"warn",s),console.warn("[lattice]",...s)}function F(n,...i){if(U.has(n))return;ee(n);const s=g(i);L(n,"info",s),console.info("[lattice]",...s)}function k(){U.clear(),A.length=0}function D(n,i){const s=new Error(`[lattice] ${n}`);throw i!==void 0&&(s.cause=i),s}function w(n,i){n||D(i)}const I=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function p(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function $(n){return typeof n=="function"}function q(n){return n==null}function T(n){return n==null||n===""}function P(n){return typeof n!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(n))?!0:!!(n.prototype&&Object.getOwnPropertyNames(n.prototype).length>1)}const x=new Map;function E(n){let i=x.get(n);if(i)return i;if(!n.includes("."))i=s=>s?.[n];else{const s=n.split("."),h=s.length;i=V=>{let G=V;for(let B=0;B<h;B++){if(G==null)return;G=G[s[B]]}return G}}return x.set(n,i),i}const Z=new Map;function X(n){let i=Z.get(n);if(i)return i;if(!n.includes("."))i=(s,h)=>{s!=null&&(s[n]=h)};else{const s=n.split("."),h=s.length-1;i=(V,G)=>{let B=V;for(let Y=0;Y<h;Y++){if(B==null)return;const le=s[Y];B[le]==null&&(B[le]={}),B=B[le]}B!=null&&(B[s[h]]=G)}}return Z.set(n,i),i}function te(n,i){return E(i)(n)}function ne(n,i,s){X(i)(n,s)}function re(n){return n?(n.includes(".")?n.slice(n.lastIndexOf(".")+1):n).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase()):""}const ie={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _(n){const i=n==null?"":String(n);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,s=>ie[s]):i}function oe(n){return String(n).replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}function t(n,i,s){if(n!==void 0)return n===!0?{enabled:!0,...s}:n===!1?{enabled:!1}:p(n)?n:{[i]:n,enabled:!0}}function r(n){return n==null?[]:Array.isArray(n)?n:[n]}const l=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(n,i){if(!p(n))return p(i)?{...i}:i;if(!p(i))return i===void 0?n:i;const s={...n};for(const h of Object.keys(i)){if(l.has(h))continue;const V=i[h];V!==void 0&&(s[h]=p(V)&&p(s[h])?o(s[h],V):V)}return s}function m(n,i){if(!p(n)||!p(i)||n===i)return i;const s=Object.create(Object.getPrototypeOf(n));return Object.assign(s,n,i),s}class e{#t;#e=new Map;#n;constructor(i=256,s=null){this.#t=i,this.#n=s}get size(){return this.#e.size}get max(){return this.#t}set max(i){this.#t=i,this.#r()}has(i){return this.#e.has(i)}get(i){const s=this.#e;if(!s.has(i))return;const h=s.get(i);return s.delete(i),s.set(i,h),h}peek(i){return this.#e.get(i)}set(i,s){const h=this.#e;return h.has(i)&&h.delete(i),h.set(i,s),this.#r(),s}delete(i){const s=this.#e.get(i);return this.#e.delete(i)&&this.#n&&this.#n(s,i),s}clear(){if(this.#n)for(const[i,s]of this.#e)this.#n(s,i);this.#e.clear()}keys(){return this.#e.keys()}values(){return this.#e.values()}#r(){const i=this.#e;for(;i.size>this.#t;){const s=i.keys().next().value,h=i.get(s);i.delete(s),this.#n&&this.#n(h,s)}}}const u=new Map;function c(n,i){const s=`${n||""}|${i?JSON.stringify(i):""}`;let h=u.get(s);return h||(h=new Intl.Collator(n||void 0,{numeric:!0,sensitivity:"variant",...i}),u.set(s,h)),h}function a(n,i){if(n===i)return 0;if(n==null)return 1;if(i==null)return-1;if(typeof n=="number"&&typeof i=="number")return Number.isNaN(n)?Number.isNaN(i)?0:1:Number.isNaN(i)||n<i?-1:n>i?1:0;const s=String(n),h=String(i);return s<h?-1:s>h?1:0}function f(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const y=typeof requestAnimationFrame=="function";function N(n){return y?requestAnimationFrame(n):setTimeout(()=>n(f()),16)}function O(n){n!=null&&(y?cancelAnimationFrame(n):clearTimeout(n))}function S(n){let i=null,s=null;const h=()=>{i=null;const G=s;s=null,n(...G||[])},V=(...G)=>{s=G,i===null&&(i=N(h))};return V.cancel=()=>{O(i),i=null,s=null},V.flush=()=>{i!==null&&(O(i),h())},V}function C(n,i){let s=null,h=null;const V=()=>{if(s=null,h===null)return;const Y=h;h=null,n(...Y),G()},G=()=>{s=setTimeout(V,i),typeof s?.unref=="function"&&s.unref()},B=(...Y)=>{s===null?(n(...Y),G()):(h=Y,clearTimeout(s),G())};return B.flush=()=>{if(s!==null&&clearTimeout(s),s=null,h===null)return;const Y=h;h=null,n(...Y)},B.cancel=()=>{s!==null&&clearTimeout(s),s=null,h=null},B.pending=()=>s!==null||h!==null,B}function z(n,i=50){return typeof requestIdleCallback=="function"?requestIdleCallback(n,{timeout:i}):setTimeout(()=>n({timeRemaining:()=>0,didTimeout:!0}),1)}let se=0;function J(n="l"){return`${n}${(++se).toString(36)}`}}),ue("packages/core/src/formatting/rules.js",function(d,K){"use strict";Object.defineProperty(d,"RULE_OPS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(d,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(d,"testRule",{enumerable:!0,get:function(){return L}}),Object.defineProperty(d,"mixColour",{enumerable:!0,get:function(){return b}}),Object.defineProperty(d,"summariseColumn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(d,"quantileOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(d,"needsDistribution",{enumerable:!0,get:function(){return j}}),Object.defineProperty(d,"resolveDistribution",{enumerable:!0,get:function(){return w}}),Object.defineProperty(d,"ICON_SETS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(d,"compileRules",{enumerable:!0,get:function(){return oe}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),ee=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function A(t,r){const l=Number(t),o=Number(r);if(t!==null&&t!==""&&r!==null&&r!==""&&Number.isFinite(l)&&Number.isFinite(o))return l<o?-1:l>o?1:0;const e=String(t??"").toLowerCase(),u=String(r??"").toLowerCase();return e<u?-1:e>u?1:0}function H(t){return t==null||t===""}function L(t,r){if(!r||typeof r!="object")return!1;const{op:l}=r,o=r.value,m=r.value2;switch(l){case"blank":return H(t);case"notBlank":return!H(t);case"true":return t===!0;case"false":return t===!1;default:break}if(H(t))return!1;switch(l){case"eq":return A(t,o)===0;case"ne":return A(t,o)!==0;case"gt":return A(t,o)>0;case"gte":return A(t,o)>=0;case"lt":return A(t,o)<0;case"lte":return A(t,o)<=0;case"between":return A(t,o)>=0&&A(t,m)<=0;case"outside":return A(t,o)<0||A(t,m)>0;case"contains":return String(t).toLowerCase().includes(String(o??"").toLowerCase());case"notContains":return!String(t).toLowerCase().includes(String(o??"").toLowerCase());case"startsWith":return String(t).toLowerCase().startsWith(String(o??"").toLowerCase());case"endsWith":return String(t).toLowerCase().endsWith(String(o??"").toLowerCase());default:return!1}}function b(t,r,l){const o=O=>{const S=String(O).replace("#",""),C=S.length===3?S.split("").map(z=>z+z).join(""):S;return[0,2,4].map(z=>parseInt(C.slice(z,z+2),16)||0)},[m,e,u]=o(t),[c,a,f]=o(r),y=Math.max(0,Math.min(1,l)),N=(O,S)=>Math.round(O+(S-O)*y);return`#${[N(m,c),N(e,a),N(u,f)].map(O=>O.toString(16).padStart(2,"0")).join("")}`}function v(t){const r=[];for(const c of t||[]){if(c==null||c==="")continue;const a=c instanceof Date?c.getTime():Number(c);Number.isFinite(a)&&r.push(a)}if(!r.length)return null;r.sort((c,a)=>c-a);let l=0,o=0,m=0;for(const c of r){l++;const a=c-o;o+=a/l,m+=a*(c-o)}const e=g(r,.25),u=g(r,.75);return{n:r.length,min:r[0],max:r[r.length-1],mean:o,stddev:r.length>1?Math.sqrt(m/(r.length-1)):0,median:g(r,.5),q1:e,q3:u,iqr:u-e,sorted:r}}function g(t,r){if(!t.length)return 0;const l=(t.length-1)*Math.max(0,Math.min(1,r)),o=Math.floor(l),m=Math.ceil(l);return o===m?t[o]:t[o]+(l-o)*(t[m]-t[o])}function j(t){for(const r of Array.isArray(t)?t:[])if(!(!r||typeof r!="object")&&(r.when&&Q.includes(r.when.op)||r.scale&&r.scale.from||r.dataBar&&!(Number.isFinite(Number(r.dataBar.min))&&Number.isFinite(Number(r.dataBar.max)))||r.iconSet&&!Array.isArray(r.iconSet.thresholds)))return!0;return!1}function F(t,r){const l=Number(t.value),o=m=>g(r.sorted,m);switch(t.op){case"topPercent":{const m=k(l,10);return{op:"gte",value:o(1-m)}}case"bottomPercent":{const m=k(l,10);return{op:"lte",value:o(m)}}case"topN":{const m=Math.max(1,Math.floor(l)||1),e=Math.max(0,r.sorted.length-m);return{op:"gte",value:r.sorted[e]}}case"bottomN":{const m=Math.max(1,Math.floor(l)||1),e=Math.min(r.sorted.length-1,m-1);return{op:"lte",value:r.sorted[e]}}case"aboveMean":return{op:"gt",value:r.mean};case"belowMean":return{op:"lt",value:r.mean};case"aboveMedian":return{op:"gt",value:r.median};case"belowMedian":return{op:"lt",value:r.median};case"zAbove":return r.stddev?{op:"gte",value:r.mean+(Number.isFinite(l)?l:2)*r.stddev}:null;case"zBelow":return r.stddev?{op:"lte",value:r.mean-(Number.isFinite(l)?l:2)*r.stddev}:null;case"outlier":{const m=(Number.isFinite(l)&&l>0?l:1.5)*r.iqr;return r.iqr?{op:"outside",value:r.q1-m,value2:r.q3+m}:null}default:return null}}function k(t,r){const l=Number.isFinite(t)?t:r,o=l>1?l/100:l;return Math.max(0,Math.min(1,o))}function D(t,r){if(t.from==="minmax")return{...t,min:r.min,max:r.max};if(t.from==="quantile")return{...t,min:g(r.sorted,k(Number(t.low),5)),max:g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const l=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:r.mean-l*r.stddev,max:r.mean+l*r.stddev}}return t}function w(t,r){const l=Array.isArray(t)?t:[];return!r||!r.n?l.map(o=>o&&j([o])?{...o,enabled:!1}:o):l.map(o=>{if(!o||typeof o!="object")return o;if(o.scale&&o.scale.from)return{...o,scale:D(o.scale,r)};if(o.dataBar)return{...o,dataBar:I(o.dataBar,r)};if(o.iconSet)return{...o,iconSet:p(o.iconSet,r)};if(!o.when||!Q.includes(o.when.op))return o;const m=F(o.when,r);return m?{...o,when:m}:{...o,enabled:!1}})}function I(t,r){const l=Number.isFinite(Number(t.min))?Number(t.min):void 0,o=Number.isFinite(Number(t.max))?Number(t.max):void 0;if(l!==void 0&&o!==void 0)return{...t,min:l,max:o};if(t.from==="quantile")return{...t,min:l??g(r.sorted,k(Number(t.low),5)),max:o??g(r.sorted,k(Number(t.high),95))};if(t.from==="stddev"){const m=Number.isFinite(Number(t.deviations))?Number(t.deviations):2;return{...t,min:l??r.mean-m*r.stddev,max:o??r.mean+m*r.stddev}}return{...t,min:l??r.min,max:o??r.max}}function p(t,r){if(Array.isArray(t.thresholds))return t;const l=$(t),o=[];for(let m=1;m<l;m++)o.push(g(r.sorted,m/l));return{...t,thresholds:o}}function $(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.length;if(Number.isFinite(Number(t.count))&&Number(t.count)>=2)return Math.floor(Number(t.count));const r=X[t.set];return r?r.length:3}function q(t){return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}function T(t){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${t}"/></svg>`}function P(t,r){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${r==="up"?"8,2 14,13 2,13":r==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${t}"/></svg>`}function x(t,r){const l="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r*16} 16">`;for(let m=0;m<r;m++){const e=m<t?"#f5a623":"#d0d0d0";o+=`<path transform="translate(${m*16},0)" d="${l}" fill="${e}"/>`}return`${o}</svg>`}const E=Object.freeze([P("#c0392b","down"),P("#e0a800","right"),P("#2e7d32","up")]),Z=Object.freeze([T("#d13438"),T("#f5a623"),T("#2e9e44")]),X=Object.freeze({arrows:E,trafficLights:Z,ratings:Object.freeze([1,2,3,4,5].map(t=>x(t,5)))}),te=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function ne(t){if(Array.isArray(t.icons)&&t.icons.length>=2)return t.icons.map(o=>/^\s*(url\(|data:|<)/.test(String(o))&&String(o).trim().startsWith("<")?q(String(o)):String(o));const r=t.set||"arrows";if(r==="ratings"){const o=$(t),m=[];for(let e=1;e<=o;e++)m.push(q(x(e,o)));return m}const l=X[r];return l?l.map(q):(M(`iconSet:${r}`,`unknown icon set '${r}'; falling back to arrows.`),E.map(q))}function re(t){const r=Number(t.min),o=Number(t.max)-r,m=t.colour||t.color||"#5b9bd5",e=t.negativeColour||t.negativeColor||"#d13438",u=t.direction==="rtl"?"left":"right",c=f=>Math.max(0,Math.min(1,(f-r)/o))*100,a=o?Math.max(0,Math.min(100,(0-r)/o*100)):0;return f=>{if(H(f))return null;const y=Number(f);if(!Number.isFinite(y)||!o)return null;const N=c(y),O=Math.min(N,a),S=Math.max(N,a),C=y>=0?m:e;return{backgroundImage:`linear-gradient(to ${u}, transparent ${O}%, ${C} ${O}%, ${C} ${S}%, transparent ${S}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function ie(t){const r=ne(t),l=t.reverse?[...r].reverse():r,o=(Array.isArray(t.thresholds)?t.thresholds:[]).map(Number).filter(Number.isFinite),m=Number.isFinite(Number(t.size))?Number(t.size):16,e=t.set==="ratings"?m*$(t):m;return u=>{if(H(u))return null;const c=Number(u);if(!Number.isFinite(c))return null;let a=0;for(const y of o)c>=y&&a++;const f=l[Math.min(a,l.length-1)];return f?{backgroundImage:f,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${e}px ${m}px`,paddingLeft:`${e+4}px`}:null}}function _(t){const r=Array.isArray(t.colours)&&t.colours.length>=2?t.colours:["#f8f9fa","#1a6bc7"],l=Number(t.min),o=Number(t.max),m=o-l,e=r.length-1,u=[];for(let a=0;a<=e;a++)u.push(e?a/e:0);const c=Number(t.mid);if(t.mid!==void 0&&t.mid!==null)if(r.length%2===0)M("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${r.length} were given, so "mid" was ignored.`);else if(Number.isFinite(c)&&m&&c>Math.min(l,o)&&c<Math.max(l,o)){const a=e/2,f=Math.max(0,Math.min(1,(c-l)/m));for(let y=0;y<=e;y++)u[y]=y<=a?a?y/a*f:f:f+(y-a)/(e-a)*(1-f)}else Number.isFinite(c)&&M("formatting.scale.mid.range",`a scale's "mid" (${c}) is outside its min..max range, so it was ignored.`);return a=>{const f=Number(a);if(!Number.isFinite(f)||!m)return null;const y=Math.max(0,Math.min(1,(f-l)/m));let N=0;for(;N<e-1&&y>u[N+1];)N++;const O=u[N+1]-u[N],S=O>0?(y-u[N])/O:0;return{background:b(r[N],r[N+1],Math.max(0,Math.min(1,S)))}}}function oe(t,r=null){const l=j(t)?w(t,r):t,o=(Array.isArray(l)?l:[]).filter(e=>e&&typeof e=="object");if(!o.length)return()=>null;const m=o.map(e=>e.scale?{scale:_(e.scale),enabled:e.enabled!==!1}:e.dataBar?{scale:re(e.dataBar),enabled:e.enabled!==!1}:e.iconSet?{scale:ie(e.iconSet),enabled:e.enabled!==!1}:{when:e.when,style:e.style,stop:e.stopIfTrue!==!1,enabled:e.enabled!==!1});return e=>{const u=e?e.value:void 0;let c=null;for(const a of m){if(!a.enabled)continue;if(a.scale){const y=a.scale(u);y&&(c={...c||{},...y});continue}if(!L(u,a.when))continue;const f=W(a.style)?a.style(e):a.style;if(f&&(c={...c||{},...f}),a.stop)break}return c}}}),ue("packages/modules/shared/emitter.js",function(d,K){"use strict";Object.defineProperty(d,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(d,"Emitter",{enumerable:!0,get:function(){return A}}),Object.defineProperty(d,"gate",{enumerable:!0,get:function(){return H}});const R=K("packages/core/src/internal/util.js"),W=R.isFunction,M=R.warnOnce,U="*",Q=new Set(["api","user","init","ai"]);function ee(L,b){return L&&L.name?L.name:`#${b}`}class A{#t=new Map;#e;constructor(b="module"){this.#e=String(b)}on(b,v){if(!W(v))return()=>{};let g=this.#t.get(b);return g||(g=new Set,this.#t.set(b,g)),g.add(v),()=>this.off(b,v)}off(b,v){const g=this.#t.get(b);g&&g.delete(v)}count(b){const v=this.#t.get(b);return v?v.size:0}emit(b,v){const g=this.#t.get(b),j=this.#t.get(U);if((!g||g.size===0)&&(!j||j.size===0))return;const F={...v||null,type:b};g&&g.size&&this.#n([...g],F,b),j&&j.size&&this.#n([...j],F,U)}#n(b,v,g){for(let j=0;j<b.length;j++)try{b[j](v)}catch(F){M(`${this.#e}.emit.throw:${g}:${ee(b[j],j)}`,`${this.#e}: a '${g}' handler threw; other handlers were unaffected.`,F)}}emitBefore(b,v,g){const j=g??(v&&v.origin),F=Q.has(j)?j:"user";let k=!1,D=null;const w=P=>{k=!0,P!=null&&D===null&&(D=String(P))},I={...v||null,type:b,origin:F,get defaultPrevented(){return k},get reason(){return D},preventDefault(P){w(P)}},p=this.#t.get(b);if(!p||p.size===0)return!0;const $=[...p],q=()=>(k&&D===null&&(D="prevented"),k&&v&&typeof v=="object"&&(v.reason=D),!k),T=[];for(let P=0;P<$.length;P++){const x=$[P];try{const E=x(I);E&&W(E.then)?T.push(E):E===!1&&w("prevented")}catch(E){w("error"),M(`${this.#e}.beforeThrow:${b}:${ee(x,P)}`,`${this.#e}: a '${b}' before-handler threw; the action was cancelled.`,E)}}return T.length===0?q():Promise.allSettled(T).then(P=>{for(const x of P)x.status==="rejected"?(w("error"),M(`${this.#e}.beforeReject:${b}`,`${this.#e}: a '${b}' before-handler rejected; the action was cancelled.`,x.reason)):x.value===!1&&w("prevented");return q()})}clear(){this.#t.clear()}}function H(L,b,v,g,j){const F=L.emitBefore(b,g,g.origin),k=()=>(L.emit(v,{...g,reason:g.reason||"prevented"}),!1);return F===!1?k():F&&W(F.then)?F.then(D=>D?j():k()):j()}}),ue("packages/modules/alarms/index.js",function(d,K){"use strict";Object.defineProperty(d,"createAlarms",{enumerable:!0,get:function(){return k}}),Object.defineProperty(d,"default",{enumerable:!0,get:function(){return D}});const R=K("packages/core/src/internal/util.js"),W=R.warnOnce,M=R.isFunction,Q=K("packages/core/src/formatting/rules.js").testRule,A=K("packages/modules/shared/emitter.js").Emitter,H=Object.freeze(["alarm:raised","alarm:cleared"]),L=new Set(["warn","critical"]);function b(w){return typeof w=="string"&&L.has(w)}function v(w,I){if(typeof w!="number"||Number.isNaN(w))return null;if(Array.isArray(I&&I.bands)){for(const $ of I.bands){const q=$.min===void 0||$.min===null?-1/0:$.min,T=$.max===void 0||$.max===null?1/0:$.max;if(w>=q&&w<T)return $.status??null}return null}const p=I&&I.thresholds;return!p||p.warn===void 0||p.warn===null||p.critical===void 0||p.critical===null?null:p.direction==="lowerIsBetter"?w<=p.warn?"good":w<=p.critical?"warn":"critical":w>=p.warn?"good":w>=p.critical?"warn":"critical"}function g(w){const I=w||{};return{now:M(I.now)?I.now:()=>Date.now(),setTimeout:M(I.setTimeout)?I.setTimeout:((p,$)=>setTimeout(p,$)),clearTimeout:M(I.clearTimeout)?I.clearTimeout:(p=>clearTimeout(p))}}function j(w,I){return Number.isFinite(w)&&Number(w)>=0?Number(w):I}function F(w,I){return`${typeof w=="string"?w:JSON.stringify(w)}/${I}`}function k(w={}){const I=w||{},p=g(I.clock),$=j(I.holdMs,0),q=new A("alarms"),T=new Map,P=[],x=new Map,E=[];let Z=!1;const X=e=>{const u=(x.get(e)||0)+1;return x.set(e,u),`${e}#${u}`},te=(e,u)=>`${e.source}:${e.sourceId}:${e.key}:${u}`,ne=(e,u,c)=>({id:te(e,u),source:e.source,sourceId:e.sourceId,key:e.key,level:u,previous:c,value:e.value,threshold:e.threshold??null,band:e.band??null,at:p.now(),holdMs:e.holdMs}),re=(e,u)=>{q.emit(e,u);for(const c of E)c(u,e)},ie=(e,u)=>{const c=e.committed;if(c!==u&&(e.committed=u,b(c)&&(e.active=null,re("alarm:cleared",ne(e,c,c))),b(u))){const a=ne(e,u,c);e.active=a,re("alarm:raised",a)}},_=(e,u,c={})=>{if(Z)return;const a=`${e.source}\0${e.sourceId}\0${e.key}`;let f=T.get(a);if(f||(f={source:e.source,sourceId:e.sourceId,key:e.key,holdMs:e.holdMs,committed:null,active:null,pending:null,timer:null,value:void 0,threshold:null,band:null},T.set(a,f)),f.holdMs=e.holdMs,f.value=c.value,f.threshold=c.threshold??null,f.band=c.band??null,u===f.committed){f.timer!==null&&(p.clearTimeout(f.timer),f.timer=null),f.pending=null;return}if(!(b(f.committed)||b(u))||f.holdMs<=0){ie(f,u);return}f.pending={level:u,at:p.now()},f.timer===null&&(f.timer=p.setTimeout(()=>{f.timer=null;const N=f.pending;f.pending=null,N&&ie(f,N.level)},f.holdMs))},oe=e=>{const u=`${e.source}\0${e.sourceId}\0${e.key}`,c=T.get(u);c&&(_(e,null,{value:void 0}),c.timer===null&&c.pending===null&&T.delete(u))},t=e=>{const u=new Map;return(e&&e.config&&e.config.tiles||[]).forEach((a,f)=>{a&&u.set(String(a.id??a.label??`tile${f}`),a)}),u},r=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("kpi"),a=j(u.holdMs,$),f=t(e),y=(O,S,C)=>{const z=f.get(String(O))||{};_({source:"kpi",sourceId:c,key:String(O),holdMs:a},S??null,{value:C,threshold:z.thresholds??null,band:Array.isArray(z.bands)?z.bands:null})};for(const O of e.model&&e.model.tiles||[])y(O.id,O.status,O.value);const N=e.on("tile:status",O=>y(O.id,O.status,O.value));return()=>{M(N)&&N()}},l=(e,u)=>{const c=u.sourceId?String(u.sourceId):X("grid"),a=j(u.holdMs,$),f=u.columns&&typeof u.columns=="object"?u.columns:null;(!f||Object.keys(f).length===0)&&W("alarms:grid-no-columns","alarms.attach(grid) was given no `columns`, so no cell can raise anything. Declare the columns to watch: attach(grid, { columns: { cpu: { thresholds: { warn: 80, critical: 95, direction: 'lowerIsBetter' } } } }).");let y=new Set;const N=()=>{const S=new Set;if(!(!M(e.rows.forEachAll)||!M(e.rows.value))){e.rows.forEachAll(C=>{const z=C&&C.key;if(z!=null)for(const[se,J]of Object.entries(f||{})){if(!J)continue;const n=F(z,se);S.add(n);const i=e.rows.value(z,se);if(J.when&&!Q(i,J.when)){_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},null,{value:i});continue}_({source:"grid",sourceId:c,key:n,holdMs:j(J.holdMs,a)},v(i,J),{value:i,threshold:J.thresholds??null,band:Array.isArray(J.bands)?J.bands:null})}});for(const C of y)S.has(C)||oe({source:"grid",sourceId:c,key:C,holdMs:a});y=S}},O=[];for(const S of["rows:changed","cell:changed","stream:chunk","stream:evicted"]){const C=e.on(S,N);M(C)&&O.push(C)}return N(),()=>{for(const S of O)S()}},o=(e,u,c)=>{const a=c.sourceId?String(c.sourceId):X("router"),f=j(c.holdMs,$),y=String(c.label??(typeof u=="function"?"route":u)),N=M(c.value)?c.value:(S=>S.length),O=e.monitor(u,N,S=>{_({source:"router",sourceId:a,key:y,holdMs:f},v(S,c),{value:S,threshold:c.thresholds??null,band:Array.isArray(c.bands)?c.bands:null})});return()=>{M(O)&&O()}};return{attach(e,u,c){if(Z||!e||typeof e!="object")return this;if(M(e.monitor)){const f=c||{},y=o(e,u,f);return P.push({kind:"router",sourceId:f.sourceId||"",release:y}),this}const a=u&&typeof u=="object"?u:{};return e.model&&Array.isArray(e.model.tiles)&&M(e.on)?(P.push({kind:"kpi",sourceId:a.sourceId||"",release:r(e,a)}),this):e.rows&&M(e.on)?(P.push({kind:"grid",sourceId:a.sourceId||"",release:l(e,a)}),this):(W("alarms:unknown-source","alarms.attach() was given something that is not a KPI panel, a grid or a data router; nothing was attached and no alarm can be raised from it."),this)},on(e,u){return H.includes(e)?q.on(e,u):(W(`alarms:unknown-event:${e}`,`alarms.on('${e}') will never fire; an alarm set emits ${H.join(" and ")}.`),()=>{})},active(){const e=[];for(const u of T.values())u.active&&e.push({...u.active});return e},pending(){const e=[];for(const u of T.values())u.pending&&e.push({id:te(u,u.pending.level),source:u.source,sourceId:u.sourceId,key:u.key,level:u.pending.level,previous:u.committed,value:u.value,at:u.pending.at,holdMs:u.holdMs});return e},publish(e,u="alarms"){if(Z||!e||!M(e.addSource))return W("alarms:publish-no-router","alarms.publish() needs a data router with addSource(); nothing was published."),this;const c=e.addSource(String(u));let a=0;return E.push((f,y)=>{a+=1,c.push({op:"upsert",row:{...f,id:`${f.id}#${a}`,alarmId:f.id,kind:String(u),state:y==="alarm:raised"?"raised":"cleared"}})}),this},destroy(){if(!Z){Z=!0;for(const e of P)try{e.release()}catch{}P.length=0;for(const e of T.values())e.timer!==null&&(p.clearTimeout(e.timer),e.timer=null),e.pending=null;T.clear(),E.length=0,q.clear()}}}}const D=k});var ce=de("packages/modules/alarms/index.js");typeof module=="object"&&module.exports?module.exports=ce:typeof define=="function"&&define.amd?define(function(){return ce}):me.LatticeGridAlarms=ce})(typeof globalThis<"u"?globalThis:this);
7
7
 
8
8
  //# sourceMappingURL=alarms.min.js.map