@livenetworks/ashlar 2.0.7 → 2.0.9

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 (213) hide show
  1. package/LICENSE +641 -641
  2. package/components/COMPONENTS.md +1116 -1116
  3. package/components/index.js +81 -81
  4. package/components/ln-accordion/ln-accordion-dev.scss +8 -8
  5. package/components/ln-accordion/ln-accordion.js +1 -1
  6. package/components/ln-accordion/ln-accordion.schema.json +30 -30
  7. package/components/ln-ajax/ln-ajax-dev.scss +8 -8
  8. package/components/ln-ajax/ln-ajax.js +1 -1
  9. package/components/ln-ajax/ln-ajax.schema.json +30 -30
  10. package/components/ln-api-connector/ln-api-connector.js +1 -1
  11. package/components/ln-api-connector/ln-api-connector.schema.json +9 -0
  12. package/components/ln-api-connector/src/ln-api-connector.js +2 -0
  13. package/components/ln-api-queue/ln-api-queue.js +1 -1
  14. package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
  15. package/components/ln-api-queue/src/ln-api-queue.js +3 -13
  16. package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
  17. package/components/ln-autoresize/ln-autoresize.js +1 -1
  18. package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
  19. package/components/ln-autosave/ln-autosave-dev.scss +13 -13
  20. package/components/ln-autosave/ln-autosave.js +1 -1
  21. package/components/ln-autosave/ln-autosave.schema.json +48 -48
  22. package/components/ln-autosave/src/autosave-model.js +34 -34
  23. package/components/ln-chart/ln-chart.js +1 -1
  24. package/components/ln-chart/ln-chart.schema.json +146 -146
  25. package/components/ln-chart/src/chart-model.js +154 -154
  26. package/components/ln-circular-progress/ln-circular-progress.js +1 -1
  27. package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
  28. package/components/ln-confirm/ln-confirm-dev.scss +24 -24
  29. package/components/ln-confirm/ln-confirm.js +1 -1
  30. package/components/ln-confirm/ln-confirm.schema.json +66 -66
  31. package/components/ln-confirm/src/ln-confirm.js +178 -178
  32. package/components/ln-core/attrs.js +13 -0
  33. package/components/ln-core/crypto.js +286 -265
  34. package/components/ln-core/dom.js +115 -115
  35. package/components/ln-core/form.js +146 -136
  36. package/components/ln-core/helpers.js +33 -33
  37. package/components/ln-core/http.js +48 -48
  38. package/components/ln-core/index.js +1 -1
  39. package/components/ln-core/lifecycle.js +5 -0
  40. package/components/ln-core/ln-core.schema.json +3 -2
  41. package/components/ln-core/locale.js +55 -55
  42. package/components/ln-core/matching.js +78 -78
  43. package/components/ln-core/number.js +125 -125
  44. package/components/ln-core/template.js +206 -206
  45. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  46. package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
  47. package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +1 -0
  48. package/components/ln-data-coordinator/README.md +9 -38
  49. package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
  50. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  51. package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
  52. package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
  53. package/components/ln-data-coordinator/src/ln-data-coordinator.js +432 -1308
  54. package/components/ln-data-store/ln-data-store-dev.scss +13 -13
  55. package/components/ln-data-store/ln-data-store.js +1 -1
  56. package/components/ln-data-store/ln-data-store.schema.json +84 -84
  57. package/components/ln-data-store/src/data-store-model.js +184 -184
  58. package/components/ln-data-store/src/ln-data-store.js +1 -1
  59. package/components/ln-date/ln-date.js +1 -1
  60. package/components/ln-date/ln-date.schema.json +92 -92
  61. package/components/ln-date/src/date-model.js +186 -186
  62. package/components/ln-debug/ln-debug.js +1 -1
  63. package/components/ln-debug/ln-debug.schema.json +28 -28
  64. package/components/ln-debug/src/console-sink.js +19 -19
  65. package/components/ln-debug/src/gate.js +95 -95
  66. package/components/ln-debug/src/generated-attributes.js +4 -2
  67. package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
  68. package/components/ln-dropdown/ln-dropdown.js +1 -1
  69. package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
  70. package/components/ln-editor/ln-editor.js +1 -1
  71. package/components/ln-editor/ln-editor.schema.json +58 -58
  72. package/components/ln-external-links/ln-external-links.js +1 -1
  73. package/components/ln-external-links/ln-external-links.schema.json +18 -18
  74. package/components/ln-fill/ln-fill.js +1 -1
  75. package/components/ln-fill/ln-fill.schema.json +23 -23
  76. package/components/ln-filter/ln-filter.js +1 -1
  77. package/components/ln-filter/ln-filter.schema.json +153 -153
  78. package/components/ln-filter/src/filter-model.js +185 -185
  79. package/components/ln-form/ln-form-dev.scss +8 -8
  80. package/components/ln-form/ln-form.js +1 -1
  81. package/components/ln-form/ln-form.schema.json +6 -0
  82. package/components/ln-form/src/ln-form.js +21 -0
  83. package/components/ln-http/ln-http.js +1 -1
  84. package/components/ln-http/ln-http.schema.json +6 -6
  85. package/components/ln-icon/ln-icon.schema.json +6 -6
  86. package/components/ln-include/ln-include.js +1 -1
  87. package/components/ln-include/ln-include.schema.json +23 -23
  88. package/components/ln-key/ln-key-dev.scss +18 -18
  89. package/components/ln-key/ln-key.js +1 -1
  90. package/components/ln-key/ln-key.schema.json +56 -56
  91. package/components/ln-key/src/ln-key.js +10 -10
  92. package/components/ln-link/ln-link-dev.scss +8 -8
  93. package/components/ln-link/ln-link.js +1 -1
  94. package/components/ln-link/ln-link.schema.json +22 -22
  95. package/components/ln-list/README.md +152 -152
  96. package/components/ln-list/ln-list-dev.scss +8 -8
  97. package/components/ln-list/ln-list.js +1 -1
  98. package/components/ln-list/ln-list.schema.json +166 -166
  99. package/components/ln-modal/ln-modal.js +1 -1
  100. package/components/ln-modal/ln-modal.schema.json +65 -65
  101. package/components/ln-nav/ln-nav.js +1 -1
  102. package/components/ln-nav/ln-nav.schema.json +25 -25
  103. package/components/ln-number/ln-number.js +1 -1
  104. package/components/ln-number/ln-number.schema.json +63 -63
  105. package/components/ln-number/src/ln-number.js +26 -0
  106. package/components/ln-number/src/number-model.js +31 -31
  107. package/components/ln-obfuscator/README.md +60 -60
  108. package/components/ln-obfuscator/ln-obfuscator.js +1 -1
  109. package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
  110. package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
  111. package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
  112. package/components/ln-options/ln-options.js +1 -1
  113. package/components/ln-options/ln-options.schema.json +6 -0
  114. package/components/ln-options/src/ln-options.js +4 -4
  115. package/components/ln-persist/README.md +151 -151
  116. package/components/ln-persist/ln-persist.js +1 -1
  117. package/components/ln-persist/ln-persist.schema.json +28 -28
  118. package/components/ln-persist/src/ln-persist.js +83 -83
  119. package/components/ln-picklist/README.md +230 -230
  120. package/components/ln-picklist/ln-picklist-dev.scss +22 -22
  121. package/components/ln-picklist/ln-picklist.js +1 -1
  122. package/components/ln-picklist/ln-picklist.schema.json +49 -49
  123. package/components/ln-picklist/src/ln-picklist.js +228 -228
  124. package/components/ln-popover/ln-popover-dev.scss +13 -13
  125. package/components/ln-popover/ln-popover.js +1 -1
  126. package/components/ln-popover/ln-popover.schema.json +82 -82
  127. package/components/ln-progress/ln-progress-dev.scss +8 -8
  128. package/components/ln-progress/ln-progress.js +1 -1
  129. package/components/ln-progress/ln-progress.schema.json +40 -40
  130. package/components/ln-router/ln-router.js +1 -1
  131. package/components/ln-router/ln-router.schema.json +76 -76
  132. package/components/ln-scroll/README.md +45 -45
  133. package/components/ln-scroll/ln-scroll.js +1 -1
  134. package/components/ln-scroll/ln-scroll.schema.json +85 -85
  135. package/components/ln-scroll/src/ln-scroll.js +150 -150
  136. package/components/ln-search/README.md +188 -188
  137. package/components/ln-search/ln-search.js +1 -1
  138. package/components/ln-search/ln-search.schema.json +103 -103
  139. package/components/ln-slug/ln-slug.js +1 -1
  140. package/components/ln-slug/ln-slug.schema.json +23 -23
  141. package/components/ln-slug/src/ln-slug.js +25 -1
  142. package/components/ln-sort/ln-sort.js +1 -1
  143. package/components/ln-sort/ln-sort.schema.json +104 -104
  144. package/components/ln-sort/src/ln-sort.js +321 -321
  145. package/components/ln-sort/src/sort-model.js +117 -117
  146. package/components/ln-sortable/ln-sortable-dev.scss +13 -13
  147. package/components/ln-sortable/ln-sortable.js +1 -1
  148. package/components/ln-sortable/ln-sortable.schema.json +36 -36
  149. package/components/ln-stat/ln-stat-dev.scss +8 -8
  150. package/components/ln-stat/ln-stat.js +1 -1
  151. package/components/ln-stat/ln-stat.schema.json +32 -32
  152. package/components/ln-stat/src/stat-model.js +28 -28
  153. package/components/ln-table/ln-table.js +1 -1
  154. package/components/ln-table/ln-table.schema.json +211 -211
  155. package/components/ln-table/src/table-model.js +98 -98
  156. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  157. package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
  158. package/components/ln-tabs/ln-tabs.js +1 -1
  159. package/components/ln-tabs/ln-tabs.schema.json +75 -75
  160. package/components/ln-tabs/src/ln-tabs.js +208 -208
  161. package/components/ln-tabs/src/tabs-model.js +82 -82
  162. package/components/ln-time/ln-time-dev.scss +13 -13
  163. package/components/ln-time/ln-time.js +1 -1
  164. package/components/ln-time/ln-time.schema.json +38 -38
  165. package/components/ln-toast/ln-toast.js +1 -1
  166. package/components/ln-toast/ln-toast.schema.json +65 -65
  167. package/components/ln-toggle/ln-toggle.js +1 -1
  168. package/components/ln-toggle/ln-toggle.schema.json +52 -52
  169. package/components/ln-tooltip/ln-tooltip.js +1 -1
  170. package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
  171. package/components/ln-translations/ln-translations.js +1 -1
  172. package/components/ln-translations/ln-translations.schema.json +120 -120
  173. package/components/ln-ui-coordinator/README.md +62 -62
  174. package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
  175. package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
  176. package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
  177. package/components/ln-upload/ln-upload.js +1 -1
  178. package/components/ln-upload/ln-upload.schema.json +193 -193
  179. package/components/ln-upload/src/upload-model.js +78 -78
  180. package/components/ln-validate/ln-validate.js +1 -1
  181. package/components/ln-validate/ln-validate.schema.json +50 -50
  182. package/components/ln-validate/src/validate-model.js +64 -64
  183. package/components/ln-websocket-connector/README.md +166 -166
  184. package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
  185. package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
  186. package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
  187. package/ln-ashlar.html-data.json +15 -8
  188. package/package.json +85 -84
  189. package/theme/brand.css +73 -73
  190. package/theme/components/_confirm.scss +6 -6
  191. package/theme/components/_picklist.scss +3 -3
  192. package/theme/config/_palette.scss +274 -274
  193. package/theme/config/_theme.scss +292 -292
  194. package/theme/config/_tokens.scss +285 -285
  195. package/theme/config/mixins/_index.scss +62 -62
  196. package/theme/config/mixins/_picklist.scss +66 -66
  197. package/theme/ln-ashlar-dev.scss +66 -66
  198. package/theme/ln-ashlar-landing.scss +56 -56
  199. package/theme/ln-ashlar-theme.scss +63 -63
  200. package/theme/presentation/_bento.scss +151 -151
  201. package/theme/presentation/_cta.scss +111 -111
  202. package/theme/presentation/_effects.scss +216 -216
  203. package/theme/presentation/_features.scss +108 -108
  204. package/theme/presentation/_footer.scss +129 -129
  205. package/theme/presentation/_hero.scss +158 -158
  206. package/theme/presentation/_layout.scss +170 -170
  207. package/theme/presentation/_navbar.scss +140 -140
  208. package/theme/presentation/_pricing.scss +262 -262
  209. package/theme/presentation/_stats.scss +87 -87
  210. package/theme/presentation/_testimonials.scss +124 -124
  211. package/theme/presentation/_tokens.scss +39 -39
  212. package/theme/presentation/_typography.scss +163 -163
  213. package/web-types.json +26 -12
@@ -1,185 +1,185 @@
1
- import { matchesFilterValues } from '../../ln-core/matching.js';
2
-
3
- /**
4
- * Checks whether two arrays of strings differ in length or content.
5
- * @param {Array} a
6
- * @param {Array} b
7
- * @returns {boolean}
8
- */
9
- export function arraysDiffer(a, b) {
10
- if (!Array.isArray(a) || !Array.isArray(b)) return a !== b;
11
- if (a.length !== b.length) return true;
12
- for (let i = 0; i < a.length; i++) {
13
- if (a[i] !== b[i]) return true;
14
- }
15
- return false;
16
- }
17
-
18
- /**
19
- * Evaluates a row across multiple active column filters (AND across columns, OR within column).
20
- * @param {Record<number, string>} cellValuesByCol Index-to-text mapping of row cells
21
- * @param {Record<string, { col: number|null, values: string[], attr?: string }>} filters Active column filter map
22
- * @param {Element} [row] Optional row element for data-attribute matching fallback
23
- * @returns {boolean}
24
- */
25
- export function evaluateRowFilters(cellValuesByCol, filters, row) {
26
- if (!filters || typeof filters !== 'object') return true;
27
- const keys = Object.keys(filters);
28
- if (keys.length === 0) return true;
29
-
30
- for (let i = 0; i < keys.length; i++) {
31
- const filter = filters[keys[i]];
32
- let cellText = '';
33
- if (filter.col !== null && filter.col !== undefined) {
34
- cellText = cellValuesByCol[filter.col] || '';
35
- } else if (filter.attr && row && typeof row.getAttribute === 'function') {
36
- cellText = row.getAttribute(filter.attr) || '';
37
- }
38
- if (!matchesFilterValues(cellText, filter.values)) {
39
- return false; // AND across columns: fail fast
40
- }
41
- }
42
- return true;
43
- }
44
-
45
- /**
46
- * Resolves the 0-based column index of a table associated with a filter.
47
- * Inspects explicit index, filterDom placement, popover trigger button in <th>,
48
- * and table header cells matching the filter key.
49
- *
50
- * @param {HTMLTableElement} table Target table
51
- * @param {HTMLElement} filterDom Filter root element (<ul data-ln-filter>)
52
- * @param {string|null} key Active filter key (e.g. 'category', 'status')
53
- * @param {number|null} explicitCol Explicitly provided colIndex, if any
54
- * @returns {number|null} 0-based column index, or null if unresolvable
55
- */
56
- export function resolveColumnIndex(table, filterDom, key, explicitCol) {
57
- if (explicitCol !== null && explicitCol !== undefined && !isNaN(explicitCol)) {
58
- return parseInt(explicitCol, 10);
59
- }
60
-
61
- if (filterDom && typeof filterDom.getAttribute === 'function') {
62
- const colAttr = filterDom.getAttribute('data-ln-filter-col');
63
- if (colAttr !== null && !isNaN(parseInt(colAttr, 10))) {
64
- return parseInt(colAttr, 10);
65
- }
66
-
67
- if (typeof filterDom.closest === 'function') {
68
- const th = filterDom.closest('th');
69
- if (th && typeof th.cellIndex === 'number') {
70
- return th.cellIndex;
71
- }
72
-
73
- const popover = filterDom.closest('[data-ln-popover], [id]');
74
- if (popover && popover.id) {
75
- const rootDoc = table && table.ownerDocument ? table.ownerDocument : (filterDom.ownerDocument || (typeof document !== 'undefined' ? document : null));
76
- if (rootDoc && typeof rootDoc.querySelector === 'function') {
77
- const trigger = rootDoc.querySelector('[data-ln-popover-for="' + popover.id + '"]');
78
- if (trigger && typeof trigger.closest === 'function') {
79
- const triggerTh = trigger.closest('th');
80
- if (triggerTh && typeof triggerTh.cellIndex === 'number') {
81
- return triggerTh.cellIndex;
82
- }
83
- }
84
- }
85
- }
86
- }
87
- }
88
-
89
- if (table && key && typeof table.querySelectorAll === 'function') {
90
- const ths = table.querySelectorAll('thead th, tr:first-child th');
91
- const keyLower = String(key).trim().toLowerCase();
92
-
93
- // First pass: match data-ln-* attributes on <th>
94
- for (let i = 0; i < ths.length; i++) {
95
- const th = ths[i];
96
- const attrVal = th.getAttribute('data-ln-table-filter-col') ||
97
- th.getAttribute('data-ln-filter-col') ||
98
- th.getAttribute('data-ln-filter-key') ||
99
- th.getAttribute('data-ln-table-col') ||
100
- th.getAttribute('data-ln-col') ||
101
- th.getAttribute('data-ln-field');
102
- if (attrVal && attrVal.trim().toLowerCase() === keyLower) {
103
- return typeof th.cellIndex === 'number' ? th.cellIndex : i;
104
- }
105
- }
106
-
107
- // Second pass: match popover trigger inside <th>
108
- if (filterDom) {
109
- const popover = filterDom.closest ? filterDom.closest('[data-ln-popover], [id]') : null;
110
- const popoverId = (popover && popover.id) || (filterDom.id || null);
111
- if (popoverId) {
112
- for (let i = 0; i < ths.length; i++) {
113
- const th = ths[i];
114
- if (typeof th.querySelector === 'function' && th.querySelector('[data-ln-popover-for="' + popoverId + '"]')) {
115
- return typeof th.cellIndex === 'number' ? th.cellIndex : i;
116
- }
117
- }
118
- }
119
- }
120
-
121
- // Third pass: match header text (direct text content)
122
- for (let i = 0; i < ths.length; i++) {
123
- const th = ths[i];
124
- const childNodes = Array.from(th.childNodes || []);
125
- const textNodes = childNodes.filter(n => n.nodeType === 3);
126
- const label = (textNodes.length > 0
127
- ? textNodes.map(n => n.textContent.trim()).join(' ')
128
- : (th.textContent || '')
129
- ).trim().toLowerCase();
130
-
131
- if (label && label === keyLower) {
132
- return typeof th.cellIndex === 'number' ? th.cellIndex : i;
133
- }
134
- }
135
- }
136
-
137
- return null;
138
- }
139
-
140
- /**
141
- * Derives the active key and values from a list of input descriptors.
142
- * @param {Array<{ key: string, value: string, checked: boolean, isReset: boolean }>} descriptors
143
- * @returns {{ key: string|null, values: string[] }}
144
- */
145
- export function deriveActiveFilters(descriptors) {
146
- if (!Array.isArray(descriptors)) return { key: null, values: [] };
147
-
148
- let key = null;
149
- const values = [];
150
-
151
- for (let i = 0; i < descriptors.length; i++) {
152
- const item = descriptors[i];
153
- if (!key && item.key) key = item.key;
154
- if (item.checked && !item.isReset && item.value) {
155
- values.push(item.value);
156
- }
157
- }
158
-
159
- return { key, values };
160
- }
161
-
162
- /**
163
- * Encodes an array of active filter values into a comma-joined,
164
- * percent-encoded string for persistence in a state attribute.
165
- * @param {string[]} values
166
- * @returns {string|null}
167
- */
168
- export function encodeFilterValues(values) {
169
- if (!Array.isArray(values) || values.length === 0) return null;
170
- return values.map(encodeURIComponent).join(',');
171
- }
172
-
173
- /**
174
- * Decodes a comma-joined, percent-encoded filter-values string back
175
- * into an array.
176
- * @param {string|null} raw
177
- * @returns {string[]}
178
- */
179
- export function decodeFilterValues(raw) {
180
- if (!raw) return [];
181
- return raw.split(',').map(function (v) {
182
- try { return decodeURIComponent(v); }
183
- catch (e) { return v; }
184
- }).filter(Boolean);
185
- }
1
+ import { matchesFilterValues } from '../../ln-core/matching.js';
2
+
3
+ /**
4
+ * Checks whether two arrays of strings differ in length or content.
5
+ * @param {Array} a
6
+ * @param {Array} b
7
+ * @returns {boolean}
8
+ */
9
+ export function arraysDiffer(a, b) {
10
+ if (!Array.isArray(a) || !Array.isArray(b)) return a !== b;
11
+ if (a.length !== b.length) return true;
12
+ for (let i = 0; i < a.length; i++) {
13
+ if (a[i] !== b[i]) return true;
14
+ }
15
+ return false;
16
+ }
17
+
18
+ /**
19
+ * Evaluates a row across multiple active column filters (AND across columns, OR within column).
20
+ * @param {Record<number, string>} cellValuesByCol Index-to-text mapping of row cells
21
+ * @param {Record<string, { col: number|null, values: string[], attr?: string }>} filters Active column filter map
22
+ * @param {Element} [row] Optional row element for data-attribute matching fallback
23
+ * @returns {boolean}
24
+ */
25
+ export function evaluateRowFilters(cellValuesByCol, filters, row) {
26
+ if (!filters || typeof filters !== 'object') return true;
27
+ const keys = Object.keys(filters);
28
+ if (keys.length === 0) return true;
29
+
30
+ for (let i = 0; i < keys.length; i++) {
31
+ const filter = filters[keys[i]];
32
+ let cellText = '';
33
+ if (filter.col !== null && filter.col !== undefined) {
34
+ cellText = cellValuesByCol[filter.col] || '';
35
+ } else if (filter.attr && row && typeof row.getAttribute === 'function') {
36
+ cellText = row.getAttribute(filter.attr) || '';
37
+ }
38
+ if (!matchesFilterValues(cellText, filter.values)) {
39
+ return false; // AND across columns: fail fast
40
+ }
41
+ }
42
+ return true;
43
+ }
44
+
45
+ /**
46
+ * Resolves the 0-based column index of a table associated with a filter.
47
+ * Inspects explicit index, filterDom placement, popover trigger button in <th>,
48
+ * and table header cells matching the filter key.
49
+ *
50
+ * @param {HTMLTableElement} table Target table
51
+ * @param {HTMLElement} filterDom Filter root element (<ul data-ln-filter>)
52
+ * @param {string|null} key Active filter key (e.g. 'category', 'status')
53
+ * @param {number|null} explicitCol Explicitly provided colIndex, if any
54
+ * @returns {number|null} 0-based column index, or null if unresolvable
55
+ */
56
+ export function resolveColumnIndex(table, filterDom, key, explicitCol) {
57
+ if (explicitCol !== null && explicitCol !== undefined && !isNaN(explicitCol)) {
58
+ return parseInt(explicitCol, 10);
59
+ }
60
+
61
+ if (filterDom && typeof filterDom.getAttribute === 'function') {
62
+ const colAttr = filterDom.getAttribute('data-ln-filter-col');
63
+ if (colAttr !== null && !isNaN(parseInt(colAttr, 10))) {
64
+ return parseInt(colAttr, 10);
65
+ }
66
+
67
+ if (typeof filterDom.closest === 'function') {
68
+ const th = filterDom.closest('th');
69
+ if (th && typeof th.cellIndex === 'number') {
70
+ return th.cellIndex;
71
+ }
72
+
73
+ const popover = filterDom.closest('[data-ln-popover], [id]');
74
+ if (popover && popover.id) {
75
+ const rootDoc = table && table.ownerDocument ? table.ownerDocument : (filterDom.ownerDocument || (typeof document !== 'undefined' ? document : null));
76
+ if (rootDoc && typeof rootDoc.querySelector === 'function') {
77
+ const trigger = rootDoc.querySelector('[data-ln-popover-for="' + popover.id + '"]');
78
+ if (trigger && typeof trigger.closest === 'function') {
79
+ const triggerTh = trigger.closest('th');
80
+ if (triggerTh && typeof triggerTh.cellIndex === 'number') {
81
+ return triggerTh.cellIndex;
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ if (table && key && typeof table.querySelectorAll === 'function') {
90
+ const ths = table.querySelectorAll('thead th, tr:first-child th');
91
+ const keyLower = String(key).trim().toLowerCase();
92
+
93
+ // First pass: match data-ln-* attributes on <th>
94
+ for (let i = 0; i < ths.length; i++) {
95
+ const th = ths[i];
96
+ const attrVal = th.getAttribute('data-ln-table-filter-col') ||
97
+ th.getAttribute('data-ln-filter-col') ||
98
+ th.getAttribute('data-ln-filter-key') ||
99
+ th.getAttribute('data-ln-table-col') ||
100
+ th.getAttribute('data-ln-col') ||
101
+ th.getAttribute('data-ln-field');
102
+ if (attrVal && attrVal.trim().toLowerCase() === keyLower) {
103
+ return typeof th.cellIndex === 'number' ? th.cellIndex : i;
104
+ }
105
+ }
106
+
107
+ // Second pass: match popover trigger inside <th>
108
+ if (filterDom) {
109
+ const popover = filterDom.closest ? filterDom.closest('[data-ln-popover], [id]') : null;
110
+ const popoverId = (popover && popover.id) || (filterDom.id || null);
111
+ if (popoverId) {
112
+ for (let i = 0; i < ths.length; i++) {
113
+ const th = ths[i];
114
+ if (typeof th.querySelector === 'function' && th.querySelector('[data-ln-popover-for="' + popoverId + '"]')) {
115
+ return typeof th.cellIndex === 'number' ? th.cellIndex : i;
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ // Third pass: match header text (direct text content)
122
+ for (let i = 0; i < ths.length; i++) {
123
+ const th = ths[i];
124
+ const childNodes = Array.from(th.childNodes || []);
125
+ const textNodes = childNodes.filter(n => n.nodeType === 3);
126
+ const label = (textNodes.length > 0
127
+ ? textNodes.map(n => n.textContent.trim()).join(' ')
128
+ : (th.textContent || '')
129
+ ).trim().toLowerCase();
130
+
131
+ if (label && label === keyLower) {
132
+ return typeof th.cellIndex === 'number' ? th.cellIndex : i;
133
+ }
134
+ }
135
+ }
136
+
137
+ return null;
138
+ }
139
+
140
+ /**
141
+ * Derives the active key and values from a list of input descriptors.
142
+ * @param {Array<{ key: string, value: string, checked: boolean, isReset: boolean }>} descriptors
143
+ * @returns {{ key: string|null, values: string[] }}
144
+ */
145
+ export function deriveActiveFilters(descriptors) {
146
+ if (!Array.isArray(descriptors)) return { key: null, values: [] };
147
+
148
+ let key = null;
149
+ const values = [];
150
+
151
+ for (let i = 0; i < descriptors.length; i++) {
152
+ const item = descriptors[i];
153
+ if (!key && item.key) key = item.key;
154
+ if (item.checked && !item.isReset && item.value) {
155
+ values.push(item.value);
156
+ }
157
+ }
158
+
159
+ return { key, values };
160
+ }
161
+
162
+ /**
163
+ * Encodes an array of active filter values into a comma-joined,
164
+ * percent-encoded string for persistence in a state attribute.
165
+ * @param {string[]} values
166
+ * @returns {string|null}
167
+ */
168
+ export function encodeFilterValues(values) {
169
+ if (!Array.isArray(values) || values.length === 0) return null;
170
+ return values.map(encodeURIComponent).join(',');
171
+ }
172
+
173
+ /**
174
+ * Decodes a comma-joined, percent-encoded filter-values string back
175
+ * into an array.
176
+ * @param {string|null} raw
177
+ * @returns {string[]}
178
+ */
179
+ export function decodeFilterValues(raw) {
180
+ if (!raw) return [];
181
+ return raw.split(',').map(function (v) {
182
+ try { return decodeURIComponent(v); }
183
+ catch (e) { return v; }
184
+ }).filter(Boolean);
185
+ }
@@ -1,8 +1,8 @@
1
- @use '../../theme/config/mixins' as *;
2
-
3
- [data-ln-debug] {
4
- // 1. Host Element Check: data-ln-form belongs only on <form> elements
5
- [data-ln-form]:not(form) {
6
- @include dev-inline-error("data-ln-form belongs only on <form> elements");
7
- }
8
- }
1
+ @use '../../theme/config/mixins' as *;
2
+
3
+ [data-ln-debug] {
4
+ // 1. Host Element Check: data-ln-form belongs only on <form> elements
5
+ [data-ln-form]:not(form) {
6
+ @include dev-inline-error("data-ln-form belongs only on <form> elements");
7
+ }
8
+ }
@@ -1 +1 @@
1
- (function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!g(o))return}e.apply(console,t)}}function B(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function b(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){b(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function j(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function W(e,t){const n=e.elements,o=[],l={};for(let i=0;i<n.length;i++){const r=n[i];r.name&&r.type==="checkbox"&&(l[r.name]=(l[r.name]||0)+1)}for(let i=0;i<n.length;i++){const r=n[i];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const c=r.getAttribute("data-ln-fill-as")||r.name;if(!c||!(c in t))continue;const s=t[c];if(r.type==="checkbox"){if(Array.isArray(s))r.checked=s.indexOf(r.value)!==-1;else if(l[r.name]>1){const u=String(s).split(",").map(function(a){return a.trim()});r.checked=u.indexOf(r.value)!==-1}else r.checked=j(s);o.push(r)}else if(r.type==="radio")r.checked=r.value===String(s),o.push(r);else if(r.type==="select-multiple"){if(Array.isArray(s))for(let u=0;u<r.options.length;u++)r.options[u].selected=s.indexOf(r.options[u].value)!==-1;o.push(r)}else r.value=s,o.push(r)}return o}const L={};function U(e,t){L[e]=t}function H(e){return L[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=U,window.lnCore.getDataMapper=H);function V(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,b(function(){new MutationObserver(function(){B(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function P(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function K(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=P,window.lnCore.getLocaleFallback=K,window.lnCore.ensureLocaleObserver=V);const m={};function Q(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=m[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function J(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)I(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&r.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function G(e,t,n,o,l,i){const r={};for(let s=0;s<e.children.length;s++){const u=e.children[s],a=u.getAttribute("data-ln-render-key");a&&(r[a]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],a=String(o(u));let d=r[a];if(d)l(d,u,s);else{const f=Q(n,i);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),l(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=I,window.lnCore.lnFill=J,window.lnCore.renderList=G);function C(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function X(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function z(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function Y(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),l=function(i,r){const c=i.getAttribute(r);return c!==null&&o.has(c)?c:t};return y.set(n,l),l}function ee(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function te(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function R(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=s=>{l?console.warn(s,l):console.warn(s)};if(r==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e,t,n){for(const o in n){const[l,i,r]=n[o];Object.defineProperty(e,o,{get:function(){return l(t,i,r)},enumerable:!0,configurable:!0})}return e}function oe(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=Z(o.values,o.fallback);break;case"integer":l=X;break;case"float":l=ee;break;case"boolean":l=z;break;case"list":l=Y;break;case"json":l=te;break;case"string":default:l=C;break}l||(l=C),t[o.prop]=[l,n,o.fallback]}return t}function re(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ie(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function A(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function le(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function se(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function D(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ce(e){const t=D(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ie(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function M(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ue(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=D(),l=o.byAttr.get(n);if(E()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)R(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&M(i,t,n,e.oldValue),o.reactiveWildcard.length&&M(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(A(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function ae(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ue(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function F(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=F();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];A(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const a=u[i.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function fe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{de(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function we(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,s=l.onInit||null,u=l.onAttrChange||null,a=l.effects||null,d=l.attributes||null,f=d?re(d):a,_e=d?new Set(Object.keys(d)):null,ve=l.persist||null;function p(k){const w=k||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Se=d[h],S=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&S.push(w);for(let O=0;O<S.length;O++){const x=S[O];g(x)&&R(Se,x.getAttribute(h),h,o,x)}}s&&s(w)}const v=[];if(e.indexOf("[")!==-1){const k=/\[([\w-]+)/g;let w;for(;(w=k.exec(e))!==null;)v.push(w[1])}else v.push(e);ce({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:v.concat(i),onAttributeChange:r,onAttrChange:u,effects:f,declared:_e,persist:ve}),ae();const ke=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";F().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:ke}),fe(),window[t]=p;function N(){le()>0?se(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N(),p}function q(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,n={},o=q(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),s=c>-1?r.slice(0,c):r,u=c>-1?r.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function he(e){if(!e)return null;const t=_();return e in t?t[e]:null}function be(e,t){if(!e)return;const n=_();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");q(location.hash)!==l&&(location.hash=l)}function pe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ge(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ce(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ye(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=he,window.lnCore.hashSet=be,window.lnCore.hashLinkClick=pe,window.lnCore.resolveHashNamespace=ge,window.lnCore.hashSortEncode=me,window.lnCore.hashSortDecode=Ce,window.lnCore.hashFilterEncode=ye,window.lnCore.hashFilterDecode=Ae),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:C,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},o=oe(n);function l(i){this.dom=i,ne(this,i,o),this._baseAction=i.getAttribute("action")||"";const r=this;return this._onLnFill=function(c){c.target===r.dom&&(c.detail?(r.fill(c.detail),r._applyActionMode(c.detail)):r.dom.reset())},this._onReset=function(){r._applyActionMode(null)},i.addEventListener("ln-fill",this._onLnFill),i.addEventListener("reset",this._onReset),this}l.prototype.fill=function(i){const r=W(this.dom,i);for(let c=0;c<r.length;c++){const s=r[c],u=s.tagName==="SELECT"||s.type==="checkbox"||s.type==="radio";s.dispatchEvent(new Event(u?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let i=this.dom.querySelector('input[name="_method"]');return i||(i=document.createElement("input"),i.type="hidden",i.name="_method",i.value="",this.dom.appendChild(i)),i},l.prototype._applyActionMode=function(i){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const r=i&&i.id!=null&&i.id!==""?i.id:null,c=this._ensureMethodInput();if(r!==null){const s=this._actionEdit;s?this.dom.setAttribute("action",s.replace(":id",encodeURIComponent(r))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(r)),c.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),c.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},we(e,t,l,"ln-form",{attributes:n})})()})();
1
+ (function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){i=t[l];break}if(!g(i))return}e.apply(console,t)}}function z(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function G(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function X(e,t){const n=!!(t&&t.typed),i=t&&t.exclude,l={},s=e.elements,o={};if(n)for(let a=0;a<s.length;a++){const r=s[a];r.name&&r.type==="checkbox"&&!r.disabled&&(o[r.name]=(o[r.name]||0)+1)}for(let a=0;a<s.length;a++){const r=s[a];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(i&&r.matches&&r.matches(i)))if(r.type==="checkbox")n&&o[r.name]===1?l[r.name]=r.checked:(l[r.name]||(l[r.name]=[]),r.checked&&l[r.name].push(r.value));else if(r.type==="radio")r.checked&&(l[r.name]=r.value);else if(r.type==="select-multiple"){l[r.name]=[];for(let c=0;c<r.options.length;c++)r.options[c].selected&&l[r.name].push(r.options[c].value)}else if(n&&r.type==="hidden")l[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const c=Number(r.value);l[r.name]=r.value===""||isNaN(c)?null:c}else l[r.name]=r.value}return l}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function L(e,t){const n=e.elements,i=[],l={};for(let s=0;s<n.length;s++){const o=n[s];o.name&&o.type==="checkbox"&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<n.length;s++){const o=n[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const a=o.getAttribute("data-ln-fill-as")||o.name;if(!a||!(a in t))continue;const r=t[a];if(o.type==="checkbox"){if(Array.isArray(r))o.checked=r.indexOf(o.value)!==-1;else if(l[o.name]>1){const c=String(r).split(",").map(function(u){return u.trim()});o.checked=c.indexOf(o.value)!==-1}else o.checked=Y(r);i.push(o)}else if(o.type==="radio")o.checked=o.value===String(r),i.push(o);else if(o.type==="select-multiple"){if(Array.isArray(r))for(let c=0;c<o.options.length;c++)o.options[c].selected=r.indexOf(o.options[c].value)!==-1;i.push(o)}else o.value=r,o.tagName==="SELECT"&&r!=null&&o.setAttribute("data-ln-value",r),i.push(o)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=L,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=G);const T={};function Z(e,t){T[e]=t}function ee(e){return T[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Z,window.lnCore.getDataMapper=ee);function te(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){z(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const I={};function ne(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];I[n]=t}function oe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return I[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ne,window.lnCore.getLocaleFallback=oe,window.lnCore.ensureLocaleObserver=te);const C={};function re(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const a=n[o],r=a.getAttribute("data-ln-field");t[r]!=null&&(a.textContent=t[r])}const i=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<i.length;o++){const a=i[o],r=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&a.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let o=0;o<l.length;o++){const a=l[o],r=a.getAttribute("data-ln-show");r in t&&a.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const a=s[o],r=a.getAttribute("data-ln-class").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&a.classList.toggle(d,!!t[f])}}return e}function ie(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,a){return t[a]!==void 0?t[a]:""}))}const i=function(s,o){return t[o]!==void 0?t[o]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const o=l[s],a=o.attributes;for(let r=0;r<a.length;r++){const c=a[r];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function le(e,t,n,i,l,s){const o={};for(let r=0;r<e.children.length;r++){const c=e.children[r],u=c.getAttribute("data-ln-render-key");u&&(o[u]=c)}const a=document.createDocumentFragment();for(let r=0;r<t.length;r++){const c=t[r],u=String(i(c));let d=o[u];if(d)l(d,c,r);else{const f=re(n,s);if(!f||($(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,c,r)}a.appendChild(d)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=ie,window.lnCore.renderList=le);function b(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function M(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function D(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const l=i.trim().toLowerCase();return!(l==="false"||l==="0")}function R(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function N(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const i=new Set(e||[]),l=function(s,o){const a=s.getAttribute(o);return a!==null&&i.has(a)?a:t};return y.set(n,l),l}function q(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function B(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function j(e,t,n,i,l){if(!e||t===null)return!0;const s=i||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const a=r=>{l?console.warn(r,l):console.warn(r)};if(o==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const r=e.values||[];return r.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(a(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(a(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(r){return a(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function U(e,t,n){for(const i in n){const[l,s,o]=n[i];Object.defineProperty(e,i,{get:function(){return l(t,s,o)},enumerable:!0,configurable:!0})}return e}function W(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let l=i.read;if(!l&&i.type)switch(i.type){case"enum":l=N(i.values,i.fallback);break;case"integer":l=M;break;case"float":l=q;break;case"boolean":l=D;break;case"list":l=R;break;case"json":l=B;break;case"string":default:l=b;break}l||(l=b),t[i.prop]=[l,n,i.fallback]}return t}function se(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=i.effect)}return Object.keys(t).length?t:null}function ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=U,window.lnCore.attrSpec=W,window.lnCore.attrStr=b,window.lnCore.attrInt=M,window.lnCore.attrBool=D,window.lnCore.attrList=R,window.lnCore.attrEnum=N,window.lnCore.attrFloat=q,window.lnCore.attrJson=B);function A(e,t,n,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&o.push(e);for(const a of o)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new i(a)}catch(r){console.error("["+n+"] init failed",a,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ue(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function H(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function de(e){const t=H(),n=e.observed||[];for(let i=0;i<n.length;i++){const l=n[i];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const l=t.byDeclaredAttr.get(i);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=ae(e);if(i===null)t.reactiveWildcard.push(e);else for(const l of i)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function V(e,t,n,i){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const o=s.effects&&s.effects[n];o?o(t,n,i):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,i)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const i=H(),l=i.byAttr.get(n);if(E()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(n)&&g(t)){const s=i.byDeclaredAttr.get(n),o=t.getAttribute(n);for(let a=0;a<s.length;a++)j(s[a].spec,o,n,s[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=i.byReactive.get(n);s&&V(s,t,n,e.oldValue),i.reactiveWildcard.length&&V(i.reactiveWildcard,t,n,e.oldValue)}if(l)for(let s=0;s<l.length;s++){const o=l[s];if(o.handler){o.handler(t,n,e.oldValue);continue}o.onAttributeChange&&t[o.attribute]?o.onAttributeChange(t,n):(A(t,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function P(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=P();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const i=t[n];if(i.onSubtreeChange){const l=i.query,s=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;s&&i.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const i=e.addedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l];A(i,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(i)}}for(let n=0;n<e.removedNodes.length;n++){const i=e.removedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l],o=s.query,a=Array.from(i.querySelectorAll(o));i.matches&&i.matches(o)&&a.push(i);for(let r=0;r<a.length;r++){const c=a[r];if(!document.contains(c)){const u=c[s.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",c,d)}delete c[s.attribute]}}}}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{he(i)}catch(l){console.error("[ln-core] lifecycle handler failed",i.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function J(e,t,n,i,l={}){const s=l.extraAttributes||[],o=l.onAttributeChange||null,a=l.onSubtreeChange||null,r=l.onInit||null,c=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?se(d):u,ke=d?new Set(Object.keys(d)):null,Se=l.persist||null;function m(x){const w=x||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Ee=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&j(Ee,O.getAttribute(h),h,i,O)}}r&&r(w)}const _=[];if(e.indexOf("[")!==-1){const x=/\[([\w-]+)/g;let w;for(;(w=x.exec(e))!==null;)_.push(w[1])}else _.push(e);de({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:n,onInit:r,observed:_.concat(s),onAttributeChange:o,onAttrChange:c,effects:f,declared:ke,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";P().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:a,query:Oe}),pe(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=J);function Q(){ce()>0?ue(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Q):Q(),m}function K(e){return(e||"").replace(/^#/,"")}function v(e){const t=e===void 0?location.hash:e,n={},i=K(t);if(!i)return n;const l=i.split("&");for(let s=0;s<l.length;s++){const o=l[s];if(!o)continue;const a=o.indexOf(":"),r=a>-1?o.slice(0,a):o,c=a>-1?o.slice(a+1):"";if(r)try{n[r]=decodeURIComponent(c)}catch{n[r]=c}}return n}function be(e){if(!e)return null;const t=v();return e in t?t[e]:null}function me(e,t){if(!e)return;const n=v();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(s){const o=n[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");K(location.hash)!==l&&(location.hash=l)}function ge(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ce(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ve(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function _e(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),l=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=v,window.lnCore.hashGet=be,window.lnCore.hashSet=me,window.lnCore.hashLinkClick=ge,window.lnCore.resolveHashNamespace=Ce,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=ve,window.lnCore.hashFilterDecode=_e);function xe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=xe),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:b,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},i=W(n);function l(s){this.dom=s,U(this,s,i),this._baseAction=s.getAttribute("action")||"";const o=this;function a(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].hasAttribute("data-ln-initial-value")||c[u].setAttribute("data-ln-initial-value",c[u].getAttribute("value")||"")}function r(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].value=c[u].getAttribute("data-ln-initial-value")||""}return a(),this._onLnFill=function(c){c.target===o.dom&&(c.detail?(a(),o.fill(c.detail),o._applyActionMode(c.detail)):(o.dom.reset(),r()))},this._onReset=function(){o._applyActionMode(null),r()},s.addEventListener("ln-fill",this._onLnFill),s.addEventListener("reset",this._onReset),this}l.prototype.fill=function(s){const o=L(this.dom,s);for(let a=0;a<o.length;a++){const r=o[a],c=r.tagName==="SELECT"||r.type==="checkbox"||r.type==="radio";r.dispatchEvent(new Event(c?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let s=this.dom.querySelector('input[name="_method"]');return s||(s=document.createElement("input"),s.type="hidden",s.name="_method",s.value="",this.dom.appendChild(s)),s},l.prototype._applyActionMode=function(s){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const o=s&&s.id!=null&&s.id!==""?s.id:null,a=this._ensureMethodInput();if(o!==null){const r=this._actionEdit;r?this.dom.setAttribute("action",r.replace(":id",encodeURIComponent(o))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(o)),a.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),a.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},J(e,t,l,"ln-form",{attributes:n})})()})();
@@ -40,6 +40,12 @@
40
40
  ],
41
41
  "fallback": "PUT",
42
42
  "description": "HTTP method used when submitting edit action"
43
+ },
44
+ "data-ln-initial-value": {
45
+ "direction": "both",
46
+ "sources": [
47
+ "src/ln-form.js"
48
+ ]
43
49
  }
44
50
  }
45
51
  }
@@ -23,22 +23,43 @@ import { populateForm, registerComponent, defineAttrs, attrSpec, attrStr } from
23
23
 
24
24
  const self = this;
25
25
 
26
+ function _captureHiddens() {
27
+ const hiddens = self.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');
28
+ for (let i = 0; i < hiddens.length; i++) {
29
+ if (!hiddens[i].hasAttribute('data-ln-initial-value')) {
30
+ hiddens[i].setAttribute('data-ln-initial-value', hiddens[i].getAttribute('value') || '');
31
+ }
32
+ }
33
+ }
34
+
35
+ function _resetHiddens() {
36
+ const hiddens = self.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');
37
+ for (let i = 0; i < hiddens.length; i++) {
38
+ hiddens[i].value = hiddens[i].getAttribute('data-ln-initial-value') || '';
39
+ }
40
+ }
41
+
42
+ _captureHiddens();
43
+
26
44
  this._onLnFill = function (e) {
27
45
  // Guard: only handle direct dispatches at this form, not bubbled
28
46
  // events from [data-ln-fillable] children inside the form.
29
47
  if (e.target !== self.dom) return;
30
48
  if (e.detail) {
49
+ _captureHiddens();
31
50
  self.fill(e.detail);
32
51
  self._applyActionMode(e.detail);
33
52
  } else {
34
53
  // Null record = "new" mode. Native reset fires the 'reset'
35
54
  // event, which restores the base action below.
36
55
  self.dom.reset();
56
+ _resetHiddens();
37
57
  }
38
58
  };
39
59
 
40
60
  this._onReset = function () {
41
61
  self._applyActionMode(null);
62
+ _resetHiddens();
42
63
  };
43
64
 
44
65
  form.addEventListener('ln-fill', this._onLnFill);
@@ -1 +1 @@
1
- (function(){"use strict";function S(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let d=null;for(let a=1;a<e.length;a++)if(e[a]&&e[a].nodeType===1){d=e[a];break}if(!S(d))return}t.apply(console,e)}}function p(t,e,o){const d=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,d),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:d}))}function C(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}const m={};function k(t,e){m[t]=e}function v(t){return m[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=k,window.lnCore.getDataMapper=v);function L(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,C(function(){new MutationObserver(function(){p(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const y={};function x(t,e){if(!t||typeof e!="object")return;const o=t.toLowerCase().split("-")[0];y[o]=e}function H(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return y[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=x,window.lnCore.getLocaleFallback=H,window.lnCore.ensureLocaleObserver=L);const b={};function O(t,e){b[t]||(b[t]=document.querySelector('[data-ln-template="'+t+'"]'));const o=b[t];return o?o.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function E(t,e){if(!t||!e)return t;const o=t.querySelectorAll("[data-ln-field]");for(let n=0;n<o.length;n++){const r=o[n],l=r.getAttribute("data-ln-field");e[l]!=null&&(r.textContent=e[l])}const d=t.querySelectorAll("[data-ln-attr]");for(let n=0;n<d.length;n++){const r=d[n],l=r.getAttribute("data-ln-attr").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();e[f]!=null&&r.setAttribute(u,e[f])}}const a=t.querySelectorAll("[data-ln-show]");for(let n=0;n<a.length;n++){const r=a[n],l=r.getAttribute("data-ln-show");l in e&&r.classList.toggle("hidden",!e[l])}const s=t.querySelectorAll("[data-ln-class]");for(let n=0;n<s.length;n++){const r=s[n],l=r.getAttribute("data-ln-class").split(",");for(let i=0;i<l.length;i++){const c=l[i].trim().split(":");if(c.length!==2)continue;const u=c[0].trim(),f=c[1].trim();f in e&&r.classList.toggle(u,!!e[f])}}return t}function D(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const o=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let d=0;d<o.length;d++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[d],e??null),o[d].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)E(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let o=0;o<e.length;o++)e[o].textContent=""}})));function _(t,e){if(!t||!e)return t;const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(n,r){return e[r]!==void 0?e[r]:""}))}const d=function(s,n){return e[n]!==void 0?e[n]:""},a=Array.from(t.querySelectorAll("*"));t.nodeType===1&&a.push(t);for(let s=0;s<a.length;s++){const n=a[s],r=n.attributes;for(let l=0;l<r.length;l++){const i=r[l];i.value.indexOf("{{")!==-1&&n.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,d))}}return t}function F(t,e,o,d,a,s){const n={};for(let l=0;l<t.children.length;l++){const i=t.children[l],c=i.getAttribute("data-ln-render-key");c&&(n[c]=i)}const r=document.createDocumentFragment();for(let l=0;l<e.length;l++){const i=e[l],c=String(d(i));let u=n[c];if(u)a(u,i,l);else{const f=O(o,s);if(!f||(_(f,i),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",c),a(u,i,l)}r.appendChild(u)}t.textContent="",t.appendChild(r)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=_,window.lnCore.fill=E,window.lnCore.lnFill=D,window.lnCore.renderList=F),typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function A(t){return(t||"").replace(/^#/,"")}function g(t){const e=t===void 0?location.hash:t,o={},d=A(e);if(!d)return o;const a=d.split("&");for(let s=0;s<a.length;s++){const n=a[s];if(!n)continue;const r=n.indexOf(":"),l=r>-1?n.slice(0,r):n,i=r>-1?n.slice(r+1):"";if(l)try{o[l]=decodeURIComponent(i)}catch{o[l]=i}}return o}function T(t){if(!t)return null;const e=g();return t in e?e[t]:null}function M(t,e){if(!t)return;const o=g();e==null?delete o[t]:o[t]=String(e);const a=Object.keys(o).map(function(s){const n=o[s];return n===""?s:s+":"+encodeURIComponent(n)}).join("&");A(location.hash)!==a&&(location.hash=a)}function q(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function B(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const o=t.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const d=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return d?e?d+"-"+e:d:e||null}function j(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function W(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function U(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function I(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const o=t.slice(0,e),d=t.slice(e+1),a=d?d.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=g,window.lnCore.hashGet=T,window.lnCore.hashSet=M,window.lnCore.hashLinkClick=q,window.lnCore.resolveHashNamespace=B,window.lnCore.hashSortEncode=j,window.lnCore.hashSortDecode=W,window.lnCore.hashFilterEncode=U,window.lnCore.hashFilterDecode=I);function G(t){if(typeof t=="string")return t;if(t&&typeof t=="object"){if(typeof t.href=="string")return t.href;if(typeof t.url=="string")return t.url}return String(t||"")}function K(t,e){return e&&e.method?String(e.method).toUpperCase():t&&typeof t=="object"&&t.method?String(t.method).toUpperCase():"GET"}function N(t,e){return(e||"GET")+" "+(t||"")}function R(t){const e=(t||"").toUpperCase();return e==="GET"||e==="HEAD"}(function(){if(window.lnHttp)return;const t=window.fetch.bind(window),e=new Map,o=new Map;function d(n,r){r=r||{};const l=G(n),i=K(n,r),c=N(l,i);R(i)&&e.has(c)&&(e.get(c).abort(),e.delete(c));const u=new AbortController,f=r.signal;let h=null;f&&(f.aborted?u.abort(f.reason):(h=function(){u.abort(f.reason)},f.addEventListener("abort",h,{once:!0})));const w=Object.assign({},r,{signal:u.signal});return e.set(c,u),t(n,w).finally(function(){f&&h&&f.removeEventListener("abort",h),e.get(c)===u&&e.delete(c)})}d.toString=function(){return"function fetch() { [ln-http wrapped] }"},window.fetch=d;function a(n){if(!n.detail||!n.detail.url)return;const r=n.target,l=(n.detail.method||(n.detail.body?"POST":"GET")).toUpperCase(),i=n.detail.key;i&&o.has(i)&&(o.get(i).abort(),o.delete(i));const c=new AbortController,u=n.detail.signal;let f=null;u&&(u.aborted?c.abort(u.reason):(f=function(){c.abort(u.reason)},u.addEventListener("abort",f,{once:!0}))),i&&o.set(i,c);const h={method:l,signal:c.signal};n.detail.body!==void 0&&(h.body=n.detail.body),window.fetch(n.detail.url,h).then(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),p(r,"ln-http:response",{ok:w.ok,status:w.status,response:w})}).catch(function(w){u&&f&&u.removeEventListener("abort",f),i&&o.get(i)===c&&o.delete(i),!(w&&w.name==="AbortError")&&p(r,"ln-http:error",{ok:!1,status:0,error:w})})}function s(n){const r=n.detail||{};r.all?window.lnHttp.cancelAll():r.key?window.lnHttp.cancelByKey(r.key):r.url&&window.lnHttp.cancel(r.url)}document.addEventListener("ln-http:request",a),document.addEventListener("ln-http:cancel",s),window.lnHttp={cancel:function(n){let r=!1;return e.forEach(function(l,i){i.endsWith(" "+n)&&(l.abort(),e.delete(i),r=!0)}),r},cancelByKey:function(n){return o.has(n)?(o.get(n).abort(),o.delete(n),!0):!1},cancelAll:function(){e.forEach(function(n){n.abort()}),e.clear(),o.forEach(function(n){n.abort()}),o.clear()},get inflight(){const n=[];return e.forEach(function(r,l){const i=l.indexOf(" ");n.push({method:l.slice(0,i),url:l.slice(i+1)})}),o.forEach(function(r,l){n.push({key:l})}),n},destroy:function(){window.lnHttp.cancelAll(),document.removeEventListener("ln-http:request",a),document.removeEventListener("ln-http:cancel",s),window.fetch=t,delete window.lnHttp}}})()})();
1
+ (function(){"use strict";function H(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){i=t[l];break}if(!H(i))return}e.apply(console,t)}}function h(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function y(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){y(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function M(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function N(e,t){const r=!!(t&&t.typed),i=t&&t.exclude,l={},s=e.elements,n={};if(r)for(let a=0;a<s.length;a++){const o=s[a];o.name&&o.type==="checkbox"&&!o.disabled&&(n[o.name]=(n[o.name]||0)+1)}for(let a=0;a<s.length;a++){const o=s[a];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(i&&o.matches&&o.matches(i)))if(o.type==="checkbox")r&&n[o.name]===1?l[o.name]=o.checked:(l[o.name]||(l[o.name]=[]),o.checked&&l[o.name].push(o.value));else if(o.type==="radio")o.checked&&(l[o.name]=o.value);else if(o.type==="select-multiple"){l[o.name]=[];for(let c=0;c<o.options.length;c++)o.options[c].selected&&l[o.name].push(o.options[c].value)}else if(r&&o.type==="hidden")l[o.name]=o.value;else if(r&&(o.type==="number"||o.type==="range")){const c=Number(o.value);l[o.name]=o.value===""||isNaN(c)?null:c}else l[o.name]=o.value}return l}function j(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function B(e,t){const r=e.elements,i=[],l={};for(let s=0;s<r.length;s++){const n=r[s];n.name&&n.type==="checkbox"&&(l[n.name]=(l[n.name]||0)+1)}for(let s=0;s<r.length;s++){const n=r[s];if(n.type==="file"||n.type==="submit"||n.type==="button")continue;const a=n.getAttribute("data-ln-fill-as")||n.name;if(!a||!(a in t))continue;const o=t[a];if(n.type==="checkbox"){if(Array.isArray(o))n.checked=o.indexOf(n.value)!==-1;else if(l[n.name]>1){const c=String(o).split(",").map(function(u){return u.trim()});n.checked=c.indexOf(n.value)!==-1}else n.checked=j(o);i.push(n)}else if(n.type==="radio")n.checked=n.value===String(o),i.push(n);else if(n.type==="select-multiple"){if(Array.isArray(o))for(let c=0;c<n.options.length;c++)n.options[c].selected=o.indexOf(n.options[c].value)!==-1;i.push(n)}else n.value=o,n.tagName==="SELECT"&&o!=null&&n.setAttribute("data-ln-value",o),i.push(n)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=B,window.lnCore.serializeForm=N,window.lnCore.resolveFormMethod=M);const x={};function T(e,t){x[e]=t}function I(e){return x[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=T,window.lnCore.getDataMapper=I);function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,y(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const k={};function q(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];k[r]=t}function W(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return k[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=q,window.lnCore.getLocaleFallback=W,window.lnCore.ensureLocaleObserver=U);const b={};function K(e,t){b[e]||(b[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=b[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function v(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let n=0;n<r.length;n++){const a=r[n],o=a.getAttribute("data-ln-field");t[o]!=null&&(a.textContent=t[o])}const i=e.querySelectorAll("[data-ln-attr]");for(let n=0;n<i.length;n++){const a=i[n],o=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<o.length;c++){const u=o[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&a.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let n=0;n<l.length;n++){const a=l[n],o=a.getAttribute("data-ln-show");o in t&&a.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let n=0;n<s.length;n++){const a=s[n],o=a.getAttribute("data-ln-class").split(",");for(let c=0;c<o.length;c++){const u=o[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&a.classList.toggle(d,!!t[f])}}return e}function G(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)v(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function A(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(n,a){return t[a]!==void 0?t[a]:""}))}const i=function(s,n){return t[n]!==void 0?t[n]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const n=l[s],a=n.attributes;for(let o=0;o<a.length;o++){const c=a[o];c.value.indexOf("{{")!==-1&&n.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function R(e,t,r,i,l,s){const n={};for(let o=0;o<e.children.length;o++){const c=e.children[o],u=c.getAttribute("data-ln-render-key");u&&(n[u]=c)}const a=document.createDocumentFragment();for(let o=0;o<t.length;o++){const c=t[o],u=String(i(c));let d=n[u];if(d)l(d,c,o);else{const f=K(r,s);if(!f||(A(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,c,o)}a.appendChild(d)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=A,window.lnCore.fill=v,window.lnCore.lnFill=G,window.lnCore.renderList=R);function m(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function S(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function E(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const l=i.trim().toLowerCase();return!(l==="false"||l==="0")}function _(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const g=new Map;function L(e,t){const r=(e?e.join("|"):"")+"::"+t;if(g.has(r))return g.get(r);const i=new Set(e||[]),l=function(s,n){const a=s.getAttribute(n);return a!==null&&i.has(a)?a:t};return g.set(r,l),l}function F(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function O(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function J(e,t,r){for(const i in r){const[l,s,n]=r[i];Object.defineProperty(e,i,{get:function(){return l(t,s,n)},enumerable:!0,configurable:!0})}return e}function P(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let l=i.read;if(!l&&i.type)switch(i.type){case"enum":l=L(i.values,i.fallback);break;case"integer":l=S;break;case"float":l=F;break;case"boolean":l=E;break;case"list":l=_;break;case"json":l=O;break;case"string":default:l=m;break}l||(l=m),t[i.prop]=[l,r,i.fallback]}return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=J,window.lnCore.attrSpec=P,window.lnCore.attrStr=m,window.lnCore.attrInt=S,window.lnCore.attrBool=E,window.lnCore.attrList=_,window.lnCore.attrEnum=L,window.lnCore.attrFloat=F,window.lnCore.attrJson=O),typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function D(e){return(e||"").replace(/^#/,"")}function C(e){const t=e===void 0?location.hash:e,r={},i=D(t);if(!i)return r;const l=i.split("&");for(let s=0;s<l.length;s++){const n=l[s];if(!n)continue;const a=n.indexOf(":"),o=a>-1?n.slice(0,a):n,c=a>-1?n.slice(a+1):"";if(o)try{r[o]=decodeURIComponent(c)}catch{r[o]=c}}return r}function z(e){if(!e)return null;const t=C();return e in t?t[e]:null}function Q(e,t){if(!e)return;const r=C();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(s){const n=r[s];return n===""?s:s+":"+encodeURIComponent(n)}).join("&");D(location.hash)!==l&&(location.hash=l)}function V(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function X(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function Y(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Z(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function $(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ee(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),i=e.slice(t+1),l=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=C,window.lnCore.hashGet=z,window.lnCore.hashSet=Q,window.lnCore.hashLinkClick=V,window.lnCore.resolveHashNamespace=X,window.lnCore.hashSortEncode=Y,window.lnCore.hashSortDecode=Z,window.lnCore.hashFilterEncode=$,window.lnCore.hashFilterDecode=ee);function te(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=te);function ne(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){if(typeof e.href=="string")return e.href;if(typeof e.url=="string")return e.url}return String(e||"")}function oe(e,t){return t&&t.method?String(t.method).toUpperCase():e&&typeof e=="object"&&e.method?String(e.method).toUpperCase():"GET"}function re(e,t){return(t||"GET")+" "+(e||"")}function ie(e){const t=(e||"").toUpperCase();return t==="GET"||t==="HEAD"}(function(){if(window.lnHttp)return;const e=window.fetch.bind(window),t=new Map,r=new Map;function i(n,a){a=a||{};const o=ne(n),c=oe(n,a),u=re(o,c);ie(c)&&t.has(u)&&(t.get(u).abort(),t.delete(u));const d=new AbortController,f=a.signal;let p=null;f&&(f.aborted?d.abort(f.reason):(p=function(){d.abort(f.reason)},f.addEventListener("abort",p,{once:!0})));const w=Object.assign({},a,{signal:d.signal});return t.set(u,d),e(n,w).finally(function(){f&&p&&f.removeEventListener("abort",p),t.get(u)===d&&t.delete(u)})}i.toString=function(){return"function fetch() { [ln-http wrapped] }"},window.fetch=i;function l(n){if(!n.detail||!n.detail.url)return;const a=n.target,o=(n.detail.method||(n.detail.body?"POST":"GET")).toUpperCase(),c=n.detail.key;c&&r.has(c)&&(r.get(c).abort(),r.delete(c));const u=new AbortController,d=n.detail.signal;let f=null;d&&(d.aborted?u.abort(d.reason):(f=function(){u.abort(d.reason)},d.addEventListener("abort",f,{once:!0}))),c&&r.set(c,u);const p={method:o,signal:u.signal};n.detail.body!==void 0&&(p.body=n.detail.body),window.fetch(n.detail.url,p).then(function(w){d&&f&&d.removeEventListener("abort",f),c&&r.get(c)===u&&r.delete(c),h(a,"ln-http:response",{ok:w.ok,status:w.status,response:w})}).catch(function(w){d&&f&&d.removeEventListener("abort",f),c&&r.get(c)===u&&r.delete(c),!(w&&w.name==="AbortError")&&h(a,"ln-http:error",{ok:!1,status:0,error:w})})}function s(n){const a=n.detail||{};a.all?window.lnHttp.cancelAll():a.key?window.lnHttp.cancelByKey(a.key):a.url&&window.lnHttp.cancel(a.url)}document.addEventListener("ln-http:request",l),document.addEventListener("ln-http:cancel",s),window.lnHttp={cancel:function(n){let a=!1;return t.forEach(function(o,c){c.endsWith(" "+n)&&(o.abort(),t.delete(c),a=!0)}),a},cancelByKey:function(n){return r.has(n)?(r.get(n).abort(),r.delete(n),!0):!1},cancelAll:function(){t.forEach(function(n){n.abort()}),t.clear(),r.forEach(function(n){n.abort()}),r.clear()},get inflight(){const n=[];return t.forEach(function(a,o){const c=o.indexOf(" ");n.push({method:o.slice(0,c),url:o.slice(c+1)})}),r.forEach(function(a,o){n.push({key:o})}),n},destroy:function(){window.lnHttp.cancelAll(),document.removeEventListener("ln-http:request",l),document.removeEventListener("ln-http:cancel",s),window.fetch=e,delete window.lnHttp}}})()})();
@@ -1,6 +1,6 @@
1
- {
2
- "$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
3
- "component": "ln-http",
4
- "generator": "scripts/sync-ln-schemas.mjs",
5
- "attributes": {}
6
- }
1
+ {
2
+ "$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
3
+ "component": "ln-http",
4
+ "generator": "scripts/sync-ln-schemas.mjs",
5
+ "attributes": {}
6
+ }