@farm.js/react 0.1.0-beta.5 → 0.1.0-beta.7

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.
@@ -25,6 +25,463 @@ function materializeIterable(source) {
25
25
  }
26
26
 
27
27
  // src/compiler-runtime.tsx
28
+ var COMPILER_KEYED_COLLECTION_TOKENS = /* @__PURE__ */ new WeakMap();
29
+ var COMPILER_KEYED_MAP_UPDATES = /* @__PURE__ */ new WeakMap();
30
+ var COMPILER_KEYED_ARRAY_APPENDS = /* @__PURE__ */ new WeakMap();
31
+ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
32
+ var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
33
+ var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
34
+ var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
35
+ var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
36
+ var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
37
+ var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
38
+ var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
39
+ var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
40
+ var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
41
+ var NATIVE_ARRAY_FILTER = Array.prototype.filter;
42
+ var NATIVE_ARRAY_SLICE = Array.prototype.slice;
43
+ var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
44
+ var NATIVE_ARRAY_WITH = Array.prototype.with;
45
+ var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
46
+ var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
47
+ var NATIVE_REFLECT_APPLY = Reflect.apply;
48
+ function compilerObject(value) {
49
+ return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
50
+ }
51
+ function compilerKeyedCollectionToken(value) {
52
+ const target = compilerObject(value);
53
+ if (!target) return void 0;
54
+ let token = COMPILER_KEYED_COLLECTION_TOKENS.get(target);
55
+ if (!token) {
56
+ token = {};
57
+ COMPILER_KEYED_COLLECTION_TOKENS.set(target, token);
58
+ }
59
+ return token;
60
+ }
61
+ function commitCompilerKeyedCollection(value) {
62
+ const target = compilerObject(value);
63
+ if (!target) return void 0;
64
+ COMPILER_KEYED_COMMITTED_COLLECTIONS.add(target);
65
+ return compilerKeyedCollectionToken(target);
66
+ }
67
+ function compilerKeyedMapChangedIndices(value, sourceToken) {
68
+ const target = compilerObject(value);
69
+ if (!target || !sourceToken) return void 0;
70
+ const update = COMPILER_KEYED_MAP_UPDATES.get(target);
71
+ if (!update || update.sourceToken !== sourceToken) return void 0;
72
+ const changedIndices = [];
73
+ for (let current = update; current; current = current.previous) {
74
+ changedIndices.push(...current.changedIndices);
75
+ }
76
+ return changedIndices;
77
+ }
78
+ function compilerKeyedArrayAppendStart(value, sourceToken, expectedStart) {
79
+ const target = compilerObject(value);
80
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
81
+ const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
82
+ if (!update || update.sourceToken !== sourceToken) return void 0;
83
+ const updates = [];
84
+ for (let current = update; current; current = current.previous) {
85
+ if (current.sourceToken !== sourceToken) return void 0;
86
+ updates.push(current);
87
+ }
88
+ let length = expectedStart;
89
+ for (let index = updates.length - 1; index >= 0; index -= 1) {
90
+ const current = updates[index];
91
+ if (current.startIndex !== length || current.resultLength < length) return void 0;
92
+ length = current.resultLength;
93
+ }
94
+ return length === value.length ? expectedStart : void 0;
95
+ }
96
+ function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
97
+ const target = compilerObject(value);
98
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
99
+ const update = COMPILER_KEYED_ARRAY_FILTERS.get(target);
100
+ if (!update || update.sourceToken !== sourceToken) return void 0;
101
+ const updates = [];
102
+ for (let current = update; current; current = current.previous) {
103
+ if (current.sourceToken !== sourceToken) return void 0;
104
+ updates.push(current);
105
+ }
106
+ let survivors = Array.from({ length: expectedLength }, (_, index) => index);
107
+ let keysStable = true;
108
+ for (let updateIndex = updates.length - 1; updateIndex >= 0; updateIndex -= 1) {
109
+ const current = updates[updateIndex];
110
+ if (current.sourceLength !== survivors.length) return void 0;
111
+ if (current.kind === "slice") {
112
+ const start = current.retainedStart;
113
+ const end = current.retainedEnd;
114
+ if (start === void 0 || end === void 0 || !Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end < start || end > current.sourceLength || current.resultLength !== end - start) {
115
+ return void 0;
116
+ }
117
+ survivors = survivors.slice(start, end);
118
+ continue;
119
+ }
120
+ keysStable = false;
121
+ const removed = /* @__PURE__ */ new Set();
122
+ for (const index of current.removedIndices || []) {
123
+ if (!Number.isSafeInteger(index) || index < 0 || index >= current.sourceLength)
124
+ return void 0;
125
+ removed.add(index);
126
+ }
127
+ if (current.resultLength !== current.sourceLength - removed.size) return void 0;
128
+ survivors = survivors.filter((_sourceIndex, index) => !removed.has(index));
129
+ }
130
+ return survivors.length === value.length ? { indices: survivors, keysStable } : void 0;
131
+ }
132
+ function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
133
+ const target = compilerObject(value);
134
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
135
+ const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
136
+ if (!update || update.sourceToken !== sourceToken) return void 0;
137
+ const updates = [];
138
+ for (let current = update; current; current = current.previous) {
139
+ if (current.sourceToken !== sourceToken) return void 0;
140
+ updates.push(current);
141
+ }
142
+ let length = expectedLength;
143
+ let prefixLength = 0;
144
+ for (let index = updates.length - 1; index >= 0; index -= 1) {
145
+ const current = updates[index];
146
+ if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
147
+ return void 0;
148
+ }
149
+ length = current.resultLength;
150
+ prefixLength += current.prefixLength;
151
+ }
152
+ return length === value.length ? prefixLength : void 0;
153
+ }
154
+ function compilerKeyedArrayRollingWindow(value, sourceToken, expectedLength) {
155
+ const target = compilerObject(value);
156
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
157
+ const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
158
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.retainedStart < 1 || update.retainedEnd !== update.sourceLength || update.resultLength <= update.retainedEnd - update.retainedStart) {
159
+ return void 0;
160
+ }
161
+ return update;
162
+ }
163
+ function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
164
+ const target = compilerObject(value);
165
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
166
+ const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
167
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.position >= expectedLength || update.resultLength !== expectedLength - 1) || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
168
+ return void 0;
169
+ }
170
+ return update;
171
+ }
172
+ function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
173
+ const target = compilerObject(value);
174
+ if (!target || !sourceToken || !Array.isArray(value)) return void 0;
175
+ const update = COMPILER_KEYED_ARRAY_REORDERS.get(target);
176
+ if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== expectedLength || update.resultLength !== value.length) {
177
+ return void 0;
178
+ }
179
+ return update;
180
+ }
181
+ function compilerKeyedCollectionChangedKeys(value, sourceToken, kind) {
182
+ const target = compilerObject(value);
183
+ if (!target || !sourceToken) return void 0;
184
+ const update = COMPILER_KEYED_COLLECTION_UPDATES.get(target);
185
+ if (!update || update.kind !== kind || update.sourceToken !== sourceToken) return void 0;
186
+ const changedKeys = [];
187
+ for (let current = update; current; current = current.previous) {
188
+ if (current.kind !== kind || current.sourceToken !== sourceToken) return void 0;
189
+ changedKeys.push(...current.changedKeys);
190
+ }
191
+ return changedKeys;
192
+ }
193
+ function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
194
+ const previousTarget = compilerObject(previous);
195
+ const valueTarget = compilerObject(value);
196
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
197
+ if (valueTarget && sourceToken) {
198
+ const previousUpdate = previousTarget && !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_MAP_UPDATES.get(previousTarget) : void 0;
199
+ COMPILER_KEYED_MAP_UPDATES.set(valueTarget, {
200
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
201
+ changedIndices,
202
+ ...previousUpdate ? { previous: previousUpdate } : {}
203
+ });
204
+ }
205
+ return value;
206
+ }
207
+ function createCompilerKeyedArrayAppend(previous, value) {
208
+ try {
209
+ const previousTarget = compilerObject(previous);
210
+ const valueTarget = compilerObject(value);
211
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
212
+ return value;
213
+ }
214
+ const startIndex = previous.length;
215
+ if (value.length < startIndex) return value;
216
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
217
+ if (!sourceToken) return value;
218
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget) : void 0;
219
+ COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
220
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
221
+ startIndex,
222
+ resultLength: value.length,
223
+ ...previousUpdate ? { previous: previousUpdate } : {}
224
+ });
225
+ return value;
226
+ } catch {
227
+ return value;
228
+ }
229
+ }
230
+ function createCompilerKeyedArrayPrepend(previous, value) {
231
+ try {
232
+ const previousTarget = compilerObject(previous);
233
+ const valueTarget = compilerObject(value);
234
+ if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
235
+ return value;
236
+ }
237
+ const sourceLength = previous.length;
238
+ const prefixLength = value.length - sourceLength;
239
+ if (prefixLength < 1) return value;
240
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
241
+ if (!sourceToken) return value;
242
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
243
+ COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
244
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
245
+ sourceLength,
246
+ resultLength: value.length,
247
+ prefixLength,
248
+ ...previousUpdate ? { previous: previousUpdate } : {}
249
+ });
250
+ return value;
251
+ } catch {
252
+ return value;
253
+ }
254
+ }
255
+ function createCompilerKeyedArrayFilter(previous, method, predicate) {
256
+ let canHint = false;
257
+ let sourceLength = 0;
258
+ try {
259
+ canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
260
+ if (canHint) sourceLength = previous.length;
261
+ } catch {
262
+ canHint = false;
263
+ }
264
+ if (!canHint) {
265
+ return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
266
+ }
267
+ const removedIndices = [];
268
+ let visited = 0;
269
+ const wrappedPredicate = function(item, index, collection) {
270
+ visited += 1;
271
+ const keep = NATIVE_REFLECT_APPLY(predicate, this, [
272
+ item,
273
+ index,
274
+ collection
275
+ ]);
276
+ if (!keep) removedIndices.push(index);
277
+ return keep;
278
+ };
279
+ const value = NATIVE_REFLECT_APPLY(method, previous, [
280
+ wrappedPredicate
281
+ ]);
282
+ try {
283
+ const previousTarget = compilerObject(previous);
284
+ const valueTarget = compilerObject(value);
285
+ if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
286
+ return value;
287
+ }
288
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
289
+ if (!sourceToken) return value;
290
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
291
+ COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
292
+ kind: "filter",
293
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
294
+ sourceLength,
295
+ resultLength: value.length,
296
+ removedIndices,
297
+ ...previousUpdate ? { previous: previousUpdate } : {}
298
+ });
299
+ } catch {
300
+ }
301
+ return value;
302
+ }
303
+ function createCompilerKeyedArraySlice(previous, method, ...args) {
304
+ const canHint = (() => {
305
+ try {
306
+ return Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_SLICE && args.length > 0 && args.length <= 2 && args.every((value2) => Number.isSafeInteger(value2));
307
+ } catch {
308
+ return false;
309
+ }
310
+ })();
311
+ const value = NATIVE_REFLECT_APPLY(method, previous, args);
312
+ if (!canHint) return value;
313
+ try {
314
+ const previousTarget = compilerObject(previous);
315
+ const valueTarget = compilerObject(value);
316
+ if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
317
+ return value;
318
+ }
319
+ const sourceLength = previous.length;
320
+ const normalize = (relative) => relative < 0 ? Math.max(sourceLength + relative, 0) : Math.min(relative, sourceLength);
321
+ const retainedStart = normalize(args[0]);
322
+ const retainedEnd = args.length === 2 ? normalize(args[1]) : sourceLength;
323
+ const resultLength = Math.max(retainedEnd - retainedStart, 0);
324
+ if (value.length !== resultLength || resultLength >= sourceLength) return value;
325
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
326
+ if (!sourceToken) return value;
327
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
328
+ COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
329
+ kind: "slice",
330
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
331
+ sourceLength,
332
+ resultLength,
333
+ retainedEnd: Math.max(retainedEnd, retainedStart),
334
+ retainedStart,
335
+ ...previousUpdate ? { previous: previousUpdate } : {}
336
+ });
337
+ } catch {
338
+ }
339
+ return value;
340
+ }
341
+ function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
342
+ try {
343
+ const previousTarget = compilerObject(previous);
344
+ const retainedTarget = compilerObject(retained);
345
+ const valueTarget = compilerObject(value);
346
+ if (!previousTarget || !retainedTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(retained) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(retained) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
347
+ return value;
348
+ }
349
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
350
+ const slice = COMPILER_KEYED_ARRAY_FILTERS.get(retainedTarget);
351
+ if (!sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !== sourceToken || slice.sourceLength !== previous.length || slice.retainedStart === void 0 || slice.retainedEnd !== previous.length || slice.retainedStart < 1 || slice.resultLength !== retained.length || value.length <= retained.length) {
352
+ return value;
353
+ }
354
+ for (let index = 0; index < retained.length; index += 1) {
355
+ if (!Object.is(value[index], retained[index])) return value;
356
+ }
357
+ COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.set(valueTarget, {
358
+ sourceToken,
359
+ sourceLength: previous.length,
360
+ resultLength: value.length,
361
+ retainedEnd: slice.retainedEnd,
362
+ retainedStart: slice.retainedStart
363
+ });
364
+ } catch {
365
+ }
366
+ return value;
367
+ }
368
+ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position, ...args) {
369
+ const callArgs = [position, ...args];
370
+ const value = NATIVE_REFLECT_APPLY(
371
+ method,
372
+ previous,
373
+ callArgs
374
+ );
375
+ try {
376
+ const previousTarget = compilerObject(previous);
377
+ const valueTarget = compilerObject(value);
378
+ if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || !Number.isSafeInteger(position)) {
379
+ return value;
380
+ }
381
+ const sourceLength = previous.length;
382
+ const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
383
+ const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
384
+ const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Object.is(args[0], 1) && normalizedPosition < sourceLength && value.length === sourceLength - 1;
385
+ const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength && value.length === sourceLength;
386
+ if (!validInsert && !validRemove && !validReplace) return value;
387
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
388
+ if (!sourceToken) return value;
389
+ COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
390
+ kind,
391
+ sourceToken,
392
+ sourceLength,
393
+ resultLength: value.length,
394
+ position: normalizedPosition
395
+ });
396
+ } catch {
397
+ }
398
+ return value;
399
+ }
400
+ function createCompilerKeyedArrayReorder(previous, method) {
401
+ const value = NATIVE_REFLECT_APPLY(
402
+ method,
403
+ previous,
404
+ []
405
+ );
406
+ try {
407
+ const previousTarget = compilerObject(previous);
408
+ const valueTarget = compilerObject(value);
409
+ if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
410
+ return value;
411
+ }
412
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
413
+ if (!sourceToken) return value;
414
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
415
+ kind: "reverse",
416
+ sourceToken,
417
+ sourceLength: previous.length,
418
+ resultLength: value.length
419
+ });
420
+ } catch {
421
+ }
422
+ return value;
423
+ }
424
+ function createCompilerKeyedArraySort(previous, method, ...args) {
425
+ const value = NATIVE_REFLECT_APPLY(
426
+ method,
427
+ previous,
428
+ args
429
+ );
430
+ try {
431
+ const previousTarget = compilerObject(previous);
432
+ const valueTarget = compilerObject(value);
433
+ if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
434
+ return value;
435
+ }
436
+ for (let index = 0; index < previous.length; index += 1) {
437
+ if (!(index in previous)) return value;
438
+ }
439
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
440
+ if (!sourceToken) return value;
441
+ COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
442
+ kind: "sort",
443
+ sourceToken,
444
+ sourceLength: previous.length,
445
+ resultLength: value.length
446
+ });
447
+ } catch {
448
+ }
449
+ return value;
450
+ }
451
+ function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
452
+ const args = operation === "map-set" ? [key, value] : [key];
453
+ const result = NATIVE_REFLECT_APPLY(method, collection, args);
454
+ const target = compilerObject(collection);
455
+ if (!target) return result;
456
+ const kind = operation.startsWith("set-") ? "set" : "map";
457
+ const nativeMethod = operation === "set-add" ? NATIVE_SET_ADD : operation === "set-delete" ? NATIVE_SET_DELETE : operation === "map-set" ? NATIVE_MAP_SET : NATIVE_MAP_DELETE;
458
+ const nativePrototype = kind === "set" ? NATIVE_SET_PROTOTYPE : NATIVE_MAP_PROTOTYPE;
459
+ if (method !== nativeMethod || Object.getPrototypeOf(collection) !== nativePrototype) {
460
+ return result;
461
+ }
462
+ const existing = COMPILER_KEYED_COLLECTION_DRAFTS.get(target);
463
+ if (existing && existing.kind !== kind) return result;
464
+ if (existing) existing.changedKeys.push(key);
465
+ else COMPILER_KEYED_COLLECTION_DRAFTS.set(target, { kind, changedKeys: [key] });
466
+ return result;
467
+ }
468
+ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
469
+ const previousTarget = compilerObject(previous);
470
+ const valueTarget = compilerObject(value);
471
+ if (!previousTarget || !valueTarget || previousTarget === valueTarget) return value;
472
+ const draft = COMPILER_KEYED_COLLECTION_DRAFTS.get(valueTarget);
473
+ if (!draft || draft.kind !== kind || draft.changedKeys.length === 0) return value;
474
+ const sourceToken = compilerKeyedCollectionToken(previousTarget);
475
+ if (!sourceToken) return value;
476
+ const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_COLLECTION_UPDATES.get(previousTarget) : void 0;
477
+ COMPILER_KEYED_COLLECTION_UPDATES.set(valueTarget, {
478
+ kind,
479
+ sourceToken: previousUpdate?.sourceToken || sourceToken,
480
+ changedKeys: [...draft.changedKeys],
481
+ ...previousUpdate ? { previous: previousUpdate } : {}
482
+ });
483
+ return value;
484
+ }
28
485
  var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
29
486
  function getCompilerHmrRegistry() {
30
487
  const globalTarget = globalThis;
@@ -412,6 +869,240 @@ var UNSET_KEYED_ROW_BINDING = /* @__PURE__ */ Symbol("unset interactive keyed-ro
412
869
  function keyedRowIdentity(key) {
413
870
  return String(key);
414
871
  }
872
+ function keyedIdentityTargetSnapshot(value) {
873
+ const kind = typeof value;
874
+ return value === null || value === void 0 || kind === "string" || kind === "number" || kind === "bigint" ? { eligible: true, key: String(value) } : { eligible: false };
875
+ }
876
+ var NATIVE_SET_PROTOTYPE = Set.prototype;
877
+ var NATIVE_SET_ADD = Set.prototype.add;
878
+ var NATIVE_SET_DELETE = Set.prototype.delete;
879
+ var NATIVE_SET_HAS = Set.prototype.has;
880
+ var NATIVE_SET_VALUES = Set.prototype.values;
881
+ var KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH = 64;
882
+ function materializeKeyedMembershipSnapshot(snapshot) {
883
+ if (!snapshot.eligible) return void 0;
884
+ if (snapshot.values) return new Set(snapshot.values);
885
+ if (!snapshot.previous || !snapshot.changes) return void 0;
886
+ const values = materializeKeyedMembershipSnapshot(snapshot.previous);
887
+ if (!values) return void 0;
888
+ for (const [key, present] of snapshot.changes) {
889
+ if (present) NATIVE_SET_ADD.call(values, key);
890
+ else NATIVE_SET_DELETE.call(values, key);
891
+ }
892
+ return values;
893
+ }
894
+ function keyedMembershipSnapshotHas(snapshot, key) {
895
+ for (let current = snapshot; current; current = current.previous) {
896
+ if (!current.eligible) return void 0;
897
+ if (current.changes?.has(key)) return current.changes.get(key);
898
+ if (current.values) return NATIVE_SET_HAS.call(current.values, key);
899
+ }
900
+ return void 0;
901
+ }
902
+ function keyedMembershipDeltaSnapshot(value, previous) {
903
+ if (!previous.eligible || !previous.sourceToken) return void 0;
904
+ const target = compilerObject(value);
905
+ if (!target) return void 0;
906
+ const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "set");
907
+ if (!changedKeys) return void 0;
908
+ if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
909
+ return void 0;
910
+ }
911
+ const changes = /* @__PURE__ */ new Map();
912
+ const targetedKeys = /* @__PURE__ */ new Set();
913
+ try {
914
+ for (const key of changedKeys) {
915
+ if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
916
+ const present = NATIVE_SET_HAS.call(value, key);
917
+ const before = keyedMembershipSnapshotHas(previous, key);
918
+ if (before === void 0) return void 0;
919
+ changes.set(key, present);
920
+ if (before !== present) NATIVE_SET_ADD.call(targetedKeys, String(key));
921
+ }
922
+ } catch {
923
+ return void 0;
924
+ }
925
+ const depth = (previous.depth || 0) + 1;
926
+ if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
927
+ return {
928
+ eligible: true,
929
+ previous,
930
+ changes,
931
+ sourceToken: commitCompilerKeyedCollection(value),
932
+ targetedKeys,
933
+ depth
934
+ };
935
+ }
936
+ function keyedMembershipTargetSnapshot(value, previous) {
937
+ if (previous) {
938
+ const delta = keyedMembershipDeltaSnapshot(value, previous);
939
+ if (delta) return delta;
940
+ }
941
+ if (typeof value !== "object" || value === null) return { eligible: false };
942
+ let iterator;
943
+ try {
944
+ iterator = NATIVE_SET_VALUES.call(value);
945
+ } catch {
946
+ return { eligible: false };
947
+ }
948
+ if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
949
+ return { eligible: false };
950
+ }
951
+ const values = /* @__PURE__ */ new Set();
952
+ try {
953
+ for (const entry of iterator) {
954
+ if (!keyedIdentityTargetSnapshot(entry).eligible) return { eligible: false };
955
+ NATIVE_SET_ADD.call(values, entry);
956
+ }
957
+ } catch {
958
+ return { eligible: false };
959
+ }
960
+ return {
961
+ eligible: true,
962
+ values,
963
+ sourceToken: commitCompilerKeyedCollection(value),
964
+ depth: 0
965
+ };
966
+ }
967
+ function keyedMembershipChangedKeys(previousSnapshot, nextSnapshot) {
968
+ if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
969
+ const previous = materializeKeyedMembershipSnapshot(previousSnapshot);
970
+ const next = materializeKeyedMembershipSnapshot(nextSnapshot);
971
+ const keys = /* @__PURE__ */ new Set();
972
+ if (!previous || !next) return keys;
973
+ for (const value of previous) {
974
+ if (!NATIVE_SET_HAS.call(next, value)) NATIVE_SET_ADD.call(keys, String(value));
975
+ }
976
+ for (const value of next) {
977
+ if (!NATIVE_SET_HAS.call(previous, value)) NATIVE_SET_ADD.call(keys, String(value));
978
+ }
979
+ return keys;
980
+ }
981
+ var NATIVE_MAP_PROTOTYPE = Map.prototype;
982
+ var NATIVE_MAP_GET = Map.prototype.get;
983
+ var NATIVE_MAP_HAS = Map.prototype.has;
984
+ var NATIVE_MAP_SET = Map.prototype.set;
985
+ var NATIVE_MAP_DELETE = Map.prototype.delete;
986
+ var NATIVE_MAP_ENTRIES = Map.prototype.entries;
987
+ function isSafeKeyedMapLookupValue(value) {
988
+ return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean";
989
+ }
990
+ function materializeKeyedMapLookupSnapshot(snapshot) {
991
+ if (!snapshot.eligible) return void 0;
992
+ if (snapshot.values) return new Map(snapshot.values);
993
+ if (!snapshot.previous || !snapshot.changes) return void 0;
994
+ const values = materializeKeyedMapLookupSnapshot(snapshot.previous);
995
+ if (!values) return void 0;
996
+ for (const [key, entry] of snapshot.changes) {
997
+ if (entry.present) NATIVE_MAP_SET.call(values, key, entry.value);
998
+ else NATIVE_MAP_DELETE.call(values, key);
999
+ }
1000
+ return values;
1001
+ }
1002
+ function keyedMapLookupSnapshotValue(snapshot, key) {
1003
+ for (let current = snapshot; current; current = current.previous) {
1004
+ if (!current.eligible) return void 0;
1005
+ const changed = current.changes?.get(key);
1006
+ if (changed) return changed;
1007
+ if (current.values) {
1008
+ const present = NATIVE_MAP_HAS.call(current.values, key);
1009
+ return {
1010
+ present,
1011
+ ...present ? { value: NATIVE_MAP_GET.call(current.values, key) } : {}
1012
+ };
1013
+ }
1014
+ }
1015
+ return void 0;
1016
+ }
1017
+ function keyedMapLookupDeltaSnapshot(value, previous) {
1018
+ if (!previous.eligible || !previous.sourceToken) return void 0;
1019
+ const target = compilerObject(value);
1020
+ if (!target) return void 0;
1021
+ const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "map");
1022
+ if (!changedKeys) return void 0;
1023
+ if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
1024
+ return void 0;
1025
+ }
1026
+ const changes = /* @__PURE__ */ new Map();
1027
+ const targetedKeys = /* @__PURE__ */ new Set();
1028
+ try {
1029
+ for (const key of changedKeys) {
1030
+ if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
1031
+ const present = NATIVE_MAP_HAS.call(value, key);
1032
+ const entry = present ? NATIVE_MAP_GET.call(value, key) : void 0;
1033
+ if (present && !isSafeKeyedMapLookupValue(entry)) return void 0;
1034
+ const before = keyedMapLookupSnapshotValue(previous, key);
1035
+ if (!before) return void 0;
1036
+ changes.set(key, { present, ...present ? { value: entry } : {} });
1037
+ if (before.present !== present || !Object.is(before.value, entry)) {
1038
+ NATIVE_SET_ADD.call(targetedKeys, String(key));
1039
+ }
1040
+ }
1041
+ } catch {
1042
+ return void 0;
1043
+ }
1044
+ const depth = (previous.depth || 0) + 1;
1045
+ if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
1046
+ return {
1047
+ eligible: true,
1048
+ previous,
1049
+ changes,
1050
+ sourceToken: commitCompilerKeyedCollection(value),
1051
+ targetedKeys,
1052
+ depth
1053
+ };
1054
+ }
1055
+ function keyedMapLookupTargetSnapshot(value, previous) {
1056
+ if (previous) {
1057
+ const delta = keyedMapLookupDeltaSnapshot(value, previous);
1058
+ if (delta) return delta;
1059
+ }
1060
+ if (typeof value !== "object" || value === null) return { eligible: false };
1061
+ let iterator;
1062
+ try {
1063
+ iterator = NATIVE_MAP_ENTRIES.call(value);
1064
+ } catch {
1065
+ return { eligible: false };
1066
+ }
1067
+ if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
1068
+ return { eligible: false };
1069
+ }
1070
+ const values = /* @__PURE__ */ new Map();
1071
+ try {
1072
+ for (const [key, entry] of iterator) {
1073
+ if (!keyedIdentityTargetSnapshot(key).eligible || !isSafeKeyedMapLookupValue(entry)) {
1074
+ return { eligible: false };
1075
+ }
1076
+ NATIVE_MAP_SET.call(values, key, entry);
1077
+ }
1078
+ } catch {
1079
+ return { eligible: false };
1080
+ }
1081
+ return {
1082
+ eligible: true,
1083
+ values,
1084
+ sourceToken: commitCompilerKeyedCollection(value),
1085
+ depth: 0
1086
+ };
1087
+ }
1088
+ function keyedMapLookupChangedKeys(previousSnapshot, nextSnapshot) {
1089
+ if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
1090
+ const previous = materializeKeyedMapLookupSnapshot(previousSnapshot);
1091
+ const next = materializeKeyedMapLookupSnapshot(nextSnapshot);
1092
+ const keys = /* @__PURE__ */ new Set();
1093
+ if (!previous || !next) return keys;
1094
+ for (const [key, value] of previous) {
1095
+ if (!Object.is(value, NATIVE_MAP_GET.call(next, key))) {
1096
+ NATIVE_SET_ADD.call(keys, String(key));
1097
+ }
1098
+ }
1099
+ for (const [key, value] of next) {
1100
+ if (!Object.is(value, NATIVE_MAP_GET.call(previous, key))) {
1101
+ NATIVE_SET_ADD.call(keys, String(key));
1102
+ }
1103
+ }
1104
+ return keys;
1105
+ }
415
1106
  function normalizedKeyedRowBindingValue(binding, value) {
416
1107
  return binding.kind === "text" ? renderTextValue(value) : value;
417
1108
  }
@@ -1883,6 +2574,475 @@ function longestIncreasingSubsequencePositions(sequence) {
1883
2574
  }
1884
2575
  return positions;
1885
2576
  }
2577
+ var keyedUpdateRuntime = {
2578
+ append: reconcileCompilerKeyedArrayAppend,
2579
+ commit: commitCompilerKeyedCollection,
2580
+ reconcile: reconcileCompilerKeyedMapUpdate
2581
+ };
2582
+ var keyedFilterUpdateRuntime = {
2583
+ ...keyedUpdateRuntime,
2584
+ filter: reconcileCompilerKeyedArrayFilter
2585
+ };
2586
+ var keyedPrependUpdateRuntime = {
2587
+ ...keyedUpdateRuntime,
2588
+ prepend: reconcileCompilerKeyedArrayPrepend
2589
+ };
2590
+ var keyedFilterPrependUpdateRuntime = {
2591
+ ...keyedFilterUpdateRuntime,
2592
+ prepend: reconcileCompilerKeyedArrayPrepend
2593
+ };
2594
+ var keyedPositionUpdateRuntime = {
2595
+ ...keyedUpdateRuntime,
2596
+ position: reconcileCompilerKeyedArrayPosition
2597
+ };
2598
+ var keyedReorderUpdateRuntime = {
2599
+ ...keyedUpdateRuntime,
2600
+ reorder: reconcileCompilerKeyedArrayReorder
2601
+ };
2602
+ var keyedCompleteUpdateRuntime = {
2603
+ ...keyedFilterPrependUpdateRuntime,
2604
+ rollingWindow: reconcileCompilerKeyedArrayRollingWindow
2605
+ };
2606
+ var keyedEveryUpdateRuntime = {
2607
+ ...keyedCompleteUpdateRuntime,
2608
+ position: reconcileCompilerKeyedArrayPosition,
2609
+ reorder: reconcileCompilerKeyedArrayReorder
2610
+ };
2611
+ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
2612
+ const dependency = props.collectionDependency;
2613
+ if (dependency === void 0) return void 0;
2614
+ const dependencies = props.dependencies || props.structureDependencies || [];
2615
+ const relevantDirty = [...dirtyState].filter((index) => dependencies.includes(index));
2616
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== dependency) return void 0;
2617
+ const finalValue = props.items();
2618
+ const hintedIndices = compilerKeyedMapChangedIndices(finalValue, collectionToken);
2619
+ if (!hintedIndices || !Array.isArray(finalValue) || finalValue.length !== instances.size) {
2620
+ return void 0;
2621
+ }
2622
+ const changedIndices = [...new Set(hintedIndices)].sort((left, right) => left - right);
2623
+ const updates = [];
2624
+ try {
2625
+ for (const index of changedIndices) {
2626
+ if (!Number.isSafeInteger(index) || index < 0 || index >= finalValue.length) return void 0;
2627
+ const item = finalValue[index];
2628
+ const key = keyedRowIdentity(props.rowKey(item, index));
2629
+ const instance = instances.get(key);
2630
+ if (!instance || instance.index !== index) return void 0;
2631
+ updates.push({ key, item, index, instance });
2632
+ }
2633
+ } catch {
2634
+ return void 0;
2635
+ }
2636
+ const conditionalChanges = [];
2637
+ for (const { key, item, index, instance } of updates) {
2638
+ if (props.hostBlocks) {
2639
+ const descriptor = props.create(item, index);
2640
+ if (!instance.scope?.update(descriptor)) {
2641
+ return { collectionToken, conditionalChanges: [], fallback: true };
2642
+ }
2643
+ }
2644
+ applyKeyedRowBindings(props, instance, item, index);
2645
+ const conditionalValues = conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
2646
+ for (const [id, values] of conditionalValues) {
2647
+ if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
2648
+ conditionalChanges.push({ key, id, item, index });
2649
+ }
2650
+ }
2651
+ instance.conditionalValues = conditionalValues;
2652
+ instance.item = item;
2653
+ }
2654
+ return {
2655
+ collectionToken: commitCompilerKeyedCollection(finalValue),
2656
+ conditionalChanges,
2657
+ fallback: false
2658
+ };
2659
+ }
2660
+ function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2661
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || props.collectionDependency === void 0) {
2662
+ return void 0;
2663
+ }
2664
+ const collectionDependency = props.collectionDependency;
2665
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2666
+ return void 0;
2667
+ }
2668
+ const dependencies = props.dependencies || props.structureDependencies;
2669
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2670
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2671
+ return void 0;
2672
+ }
2673
+ const finalValue = props.items();
2674
+ const startIndex = compilerKeyedArrayAppendStart(finalValue, collectionToken, instances.size);
2675
+ if (startIndex === void 0 || !Array.isArray(finalValue)) return void 0;
2676
+ const nextInstances = new Map(instances);
2677
+ const appended = [];
2678
+ try {
2679
+ for (let index = startIndex; index < finalValue.length; index += 1) {
2680
+ const item = finalValue[index];
2681
+ const key = keyedRowIdentity(props.rowKey(item, index));
2682
+ if (nextInstances.has(key)) return void 0;
2683
+ const descriptor = props.create(item, index);
2684
+ const instance = {
2685
+ key,
2686
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2687
+ values: readKeyedRowBindingValues(props, item, index),
2688
+ item,
2689
+ index,
2690
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2691
+ };
2692
+ appended.push(instance);
2693
+ nextInstances.set(key, instance);
2694
+ }
2695
+ } catch {
2696
+ return void 0;
2697
+ }
2698
+ if (appended.length > 0) {
2699
+ const fragment = root.ownerDocument.createDocumentFragment();
2700
+ for (const instance of appended) fragment.append(instance.element);
2701
+ root.append(fragment);
2702
+ }
2703
+ return nextInstances;
2704
+ }
2705
+ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2706
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
2707
+ return void 0;
2708
+ }
2709
+ const collectionDependency = props.collectionDependency;
2710
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2711
+ return void 0;
2712
+ }
2713
+ const dependencies = props.dependencies || props.structureDependencies;
2714
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2715
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2716
+ return void 0;
2717
+ }
2718
+ const finalValue = props.items();
2719
+ const update = compilerKeyedArrayRollingWindow(finalValue, collectionToken, instances.size);
2720
+ if (!update || !Array.isArray(finalValue)) return void 0;
2721
+ const previousInstances = [...instances.values()];
2722
+ const retainedLength = update.retainedEnd - update.retainedStart;
2723
+ const survivors = [];
2724
+ try {
2725
+ for (let index = 0; index < retainedLength; index += 1) {
2726
+ const sourceIndex = update.retainedStart + index;
2727
+ const instance = previousInstances[sourceIndex];
2728
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
2729
+ return void 0;
2730
+ }
2731
+ survivors.push(instance);
2732
+ }
2733
+ } catch {
2734
+ return void 0;
2735
+ }
2736
+ const knownKeys = new Set(instances.keys());
2737
+ const incoming = [];
2738
+ try {
2739
+ for (let index = retainedLength; index < finalValue.length; index += 1) {
2740
+ const item = finalValue[index];
2741
+ const key = keyedRowIdentity(props.rowKey(item, index));
2742
+ if (knownKeys.has(key)) return void 0;
2743
+ knownKeys.add(key);
2744
+ const descriptor = props.create(item, index);
2745
+ incoming.push({
2746
+ key,
2747
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2748
+ values: readKeyedRowBindingValues(props, item, index),
2749
+ item,
2750
+ index,
2751
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2752
+ });
2753
+ }
2754
+ } catch {
2755
+ return void 0;
2756
+ }
2757
+ for (let index = 0; index < update.retainedStart; index += 1) {
2758
+ previousInstances[index].scope?.cleanup();
2759
+ previousInstances[index].element.remove();
2760
+ }
2761
+ for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
2762
+ if (incoming.length > 0) {
2763
+ const fragment = root.ownerDocument.createDocumentFragment();
2764
+ for (const instance of incoming) fragment.append(instance.element);
2765
+ root.append(fragment);
2766
+ }
2767
+ const nextInstances = new Map(
2768
+ [...survivors, ...incoming].map((instance) => [instance.key, instance])
2769
+ );
2770
+ return nextInstances;
2771
+ }
2772
+ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2773
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
2774
+ return void 0;
2775
+ }
2776
+ const collectionDependency = props.collectionDependency;
2777
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2778
+ return void 0;
2779
+ }
2780
+ const dependencies = props.dependencies || props.structureDependencies;
2781
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2782
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2783
+ return void 0;
2784
+ }
2785
+ const finalValue = props.items();
2786
+ const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
2787
+ if (!update || !Array.isArray(finalValue)) return void 0;
2788
+ const previousInstances = [...instances.values()];
2789
+ const previous = previousInstances[update.position];
2790
+ if (update.kind === "remove") {
2791
+ if (!previous || previous.index !== update.position) return void 0;
2792
+ previous.scope?.cleanup();
2793
+ previous.element.remove();
2794
+ previousInstances.splice(update.position, 1);
2795
+ for (let index = update.position; index < previousInstances.length; index += 1) {
2796
+ previousInstances[index].index = index;
2797
+ }
2798
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2799
+ }
2800
+ let item;
2801
+ let key;
2802
+ try {
2803
+ item = finalValue[update.position];
2804
+ key = keyedRowIdentity(props.rowKey(item, update.position));
2805
+ } catch {
2806
+ return void 0;
2807
+ }
2808
+ if (update.kind === "insert") {
2809
+ if (instances.has(key)) return void 0;
2810
+ let inserted;
2811
+ try {
2812
+ const descriptor = props.create(item, update.position);
2813
+ inserted = {
2814
+ key,
2815
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2816
+ values: readKeyedRowBindingValues(props, item, update.position),
2817
+ item,
2818
+ index: update.position,
2819
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2820
+ };
2821
+ } catch {
2822
+ return void 0;
2823
+ }
2824
+ root.insertBefore(inserted.element, previous?.element || null);
2825
+ previousInstances.splice(update.position, 0, inserted);
2826
+ for (let index = update.position + 1; index < previousInstances.length; index += 1) {
2827
+ previousInstances[index].index = index;
2828
+ }
2829
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2830
+ }
2831
+ if (!previous || previous.index !== update.position) return void 0;
2832
+ if (key === previous.key) {
2833
+ try {
2834
+ applyKeyedRowBindings(props, previous, item, update.position);
2835
+ } catch {
2836
+ return void 0;
2837
+ }
2838
+ previous.item = item;
2839
+ return instances;
2840
+ }
2841
+ if (instances.has(key)) return void 0;
2842
+ let replacement;
2843
+ try {
2844
+ const descriptor = props.create(item, update.position);
2845
+ replacement = {
2846
+ key,
2847
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2848
+ values: readKeyedRowBindingValues(props, item, update.position),
2849
+ item,
2850
+ index: update.position,
2851
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2852
+ };
2853
+ } catch {
2854
+ return void 0;
2855
+ }
2856
+ previous.scope?.cleanup();
2857
+ previous.element.replaceWith(replacement.element);
2858
+ previousInstances[update.position] = replacement;
2859
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2860
+ }
2861
+ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2862
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
2863
+ return void 0;
2864
+ }
2865
+ const collectionDependency = props.collectionDependency;
2866
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2867
+ return void 0;
2868
+ }
2869
+ const dependencies = props.dependencies || props.structureDependencies;
2870
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2871
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2872
+ return void 0;
2873
+ }
2874
+ const finalValue = props.items();
2875
+ const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
2876
+ if (!update || !Array.isArray(finalValue)) return void 0;
2877
+ const previousInstances = [...instances.values()];
2878
+ if (update.kind === "sort") {
2879
+ const instancesByItem = /* @__PURE__ */ new Map();
2880
+ try {
2881
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
2882
+ const instance = previousInstances[sourceIndex];
2883
+ if (instance.index !== sourceIndex || instancesByItem.has(instance.item)) return void 0;
2884
+ instancesByItem.set(instance.item, instance);
2885
+ }
2886
+ const nextInstances = [];
2887
+ const sequence = [];
2888
+ for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
2889
+ const item = finalValue[targetIndex];
2890
+ const instance = instancesByItem.get(item);
2891
+ if (!instance || !Object.is(instance.item, item)) return void 0;
2892
+ instancesByItem.delete(item);
2893
+ nextInstances.push(instance);
2894
+ sequence.push(instance.index);
2895
+ }
2896
+ if (instancesByItem.size > 0) return void 0;
2897
+ const activeElement2 = root.ownerDocument.activeElement;
2898
+ const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
2899
+ const stablePositions = longestIncreasingSubsequencePositions(sequence);
2900
+ let anchor2 = null;
2901
+ for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
2902
+ const instance = nextInstances[index];
2903
+ if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
2904
+ root.insertBefore(instance.element, anchor2);
2905
+ }
2906
+ anchor2 = instance.element;
2907
+ instance.index = index;
2908
+ }
2909
+ if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
2910
+ activeElement2.focus({ preventScroll: true });
2911
+ }
2912
+ return new Map(nextInstances.map((instance) => [instance.key, instance]));
2913
+ } catch {
2914
+ return void 0;
2915
+ }
2916
+ }
2917
+ try {
2918
+ for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
2919
+ const instance = previousInstances[sourceIndex];
2920
+ const targetIndex = previousInstances.length - sourceIndex - 1;
2921
+ if (instance.index !== sourceIndex || !Object.is(instance.item, finalValue[targetIndex])) {
2922
+ return void 0;
2923
+ }
2924
+ }
2925
+ } catch {
2926
+ return void 0;
2927
+ }
2928
+ const activeElement = root.ownerDocument.activeElement;
2929
+ const restoreFocus = Boolean(activeElement && root.contains(activeElement));
2930
+ let anchor = previousInstances[0]?.element || null;
2931
+ for (let sourceIndex = 1; sourceIndex < previousInstances.length; sourceIndex += 1) {
2932
+ const element = previousInstances[sourceIndex].element;
2933
+ root.insertBefore(element, anchor);
2934
+ anchor = element;
2935
+ }
2936
+ previousInstances.reverse();
2937
+ for (let index = 0; index < previousInstances.length; index += 1) {
2938
+ previousInstances[index].index = index;
2939
+ }
2940
+ if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
2941
+ activeElement.focus({ preventScroll: true });
2942
+ }
2943
+ return new Map(previousInstances.map((instance) => [instance.key, instance]));
2944
+ }
2945
+ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
2946
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.prependIndexIndependent || props.collectionDependency === void 0) {
2947
+ return void 0;
2948
+ }
2949
+ const collectionDependency = props.collectionDependency;
2950
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
2951
+ return void 0;
2952
+ }
2953
+ const dependencies = props.dependencies || props.structureDependencies;
2954
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
2955
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
2956
+ return void 0;
2957
+ }
2958
+ const finalValue = props.items();
2959
+ const prefixLength = compilerKeyedArrayPrependLength(finalValue, collectionToken, instances.size);
2960
+ if (prefixLength === void 0 || !Array.isArray(finalValue)) return void 0;
2961
+ const previousInstances = [...instances.values()];
2962
+ for (let index = 0; index < previousInstances.length; index += 1) {
2963
+ const instance = previousInstances[index];
2964
+ if (instance.index !== index || !Object.is(instance.item, finalValue[prefixLength + index])) {
2965
+ return void 0;
2966
+ }
2967
+ }
2968
+ const knownKeys = new Set(instances.keys());
2969
+ const prepended = [];
2970
+ try {
2971
+ for (let index = 0; index < prefixLength; index += 1) {
2972
+ const item = finalValue[index];
2973
+ const key = keyedRowIdentity(props.rowKey(item, index));
2974
+ if (knownKeys.has(key)) return void 0;
2975
+ knownKeys.add(key);
2976
+ const descriptor = props.create(item, index);
2977
+ prepended.push({
2978
+ key,
2979
+ element: createCompilerHostElement(root.ownerDocument, descriptor),
2980
+ values: readKeyedRowBindingValues(props, item, index),
2981
+ item,
2982
+ index,
2983
+ conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2984
+ });
2985
+ }
2986
+ } catch {
2987
+ return void 0;
2988
+ }
2989
+ if (prepended.length > 0) {
2990
+ const fragment = root.ownerDocument.createDocumentFragment();
2991
+ for (const instance of prepended) fragment.append(instance.element);
2992
+ root.insertBefore(fragment, root.firstChild);
2993
+ }
2994
+ for (let index = 0; index < previousInstances.length; index += 1) {
2995
+ previousInstances[index].index = prefixLength + index;
2996
+ }
2997
+ return new Map([...prepended, ...previousInstances].map((instance) => [instance.key, instance]));
2998
+ }
2999
+ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, instances, reactOwnedRows) {
3000
+ if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
3001
+ return void 0;
3002
+ }
3003
+ const collectionDependency = props.collectionDependency;
3004
+ if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
3005
+ return void 0;
3006
+ }
3007
+ const dependencies = props.dependencies || props.structureDependencies;
3008
+ const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
3009
+ if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
3010
+ return void 0;
3011
+ }
3012
+ const finalValue = props.items();
3013
+ const survivorResult = compilerKeyedArrayFilterSurvivors(
3014
+ finalValue,
3015
+ collectionToken,
3016
+ instances.size
3017
+ );
3018
+ if (!survivorResult || !Array.isArray(finalValue)) return void 0;
3019
+ const { indices: survivorIndices, keysStable } = survivorResult;
3020
+ const previousInstances = [...instances.values()];
3021
+ const survivors = [];
3022
+ try {
3023
+ for (let index = 0; index < survivorIndices.length; index += 1) {
3024
+ const sourceIndex = survivorIndices[index];
3025
+ const instance = previousInstances[sourceIndex];
3026
+ const item = finalValue[index];
3027
+ if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !keysStable && keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
3028
+ return void 0;
3029
+ }
3030
+ survivors.push(instance);
3031
+ }
3032
+ } catch {
3033
+ return void 0;
3034
+ }
3035
+ const survivorSet = new Set(survivorIndices);
3036
+ for (let index = 0; index < previousInstances.length; index += 1) {
3037
+ if (survivorSet.has(index)) continue;
3038
+ previousInstances[index].scope?.cleanup();
3039
+ previousInstances[index].element.remove();
3040
+ }
3041
+ for (let index = 0; index < survivors.length; index += 1) {
3042
+ survivors[index].index = index;
3043
+ }
3044
+ return new Map(survivors.map((instance) => [instance.key, instance]));
3045
+ }
1886
3046
  function createKeyedRowConditionalRuntime() {
1887
3047
  class FarmKeyedRowConditional extends React__default.default.Component {
1888
3048
  constructor() {
@@ -1953,6 +3113,9 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
1953
3113
  this.propSyncQueued = false;
1954
3114
  this.currentProps = this.props;
1955
3115
  this.instances = /* @__PURE__ */ new Map();
3116
+ this.identityTargets = /* @__PURE__ */ new Map();
3117
+ this.membershipTargets = /* @__PURE__ */ new Map();
3118
+ this.mapLookupTargets = /* @__PURE__ */ new Map();
1956
3119
  this.renderVersion = 0;
1957
3120
  this.eventHandlers = /* @__PURE__ */ new Map();
1958
3121
  this.conditionalListeners = /* @__PURE__ */ new Map();
@@ -2027,8 +3190,123 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2027
3190
  });
2028
3191
  };
2029
3192
  this.refresh = (afterCommit, dirtyState) => {
3193
+ if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
3194
+ const result = options.keyedUpdates.reconcile(
3195
+ this.currentProps,
3196
+ dirtyState,
3197
+ this.collectionToken,
3198
+ this.instances,
3199
+ options.conditionals
3200
+ );
3201
+ if (result) {
3202
+ if (result.fallback) this.activateFallback(afterCommit);
3203
+ else {
3204
+ this.collectionToken = result.collectionToken;
3205
+ this.notifyConditionalChanges(result.conditionalChanges, afterCommit);
3206
+ }
3207
+ return;
3208
+ }
3209
+ const appendedInstances = options.keyedUpdates.append(
3210
+ this.currentProps,
3211
+ dirtyState,
3212
+ this.collectionToken,
3213
+ this.instances,
3214
+ this.root,
3215
+ this.hasReactOwnedRows()
3216
+ );
3217
+ if (appendedInstances) {
3218
+ this.instances = new Map(appendedInstances);
3219
+ this.rebuildElementIndex(this.instances);
3220
+ this.commitCurrentCollection(dirtyState);
3221
+ afterCommit?.();
3222
+ return;
3223
+ }
3224
+ const positionedInstances = options.keyedUpdates.position?.(
3225
+ this.currentProps,
3226
+ dirtyState,
3227
+ this.collectionToken,
3228
+ this.instances,
3229
+ this.root,
3230
+ this.hasReactOwnedRows()
3231
+ );
3232
+ if (positionedInstances) {
3233
+ this.instances = new Map(positionedInstances);
3234
+ this.rebuildElementIndex(this.instances);
3235
+ const keys = [...this.instances.keys()];
3236
+ this.pruneEventHandlers(keys);
3237
+ this.pruneConditionalListeners(keys);
3238
+ this.commitCurrentCollection(dirtyState);
3239
+ afterCommit?.();
3240
+ return;
3241
+ }
3242
+ const reorderedInstances = options.keyedUpdates.reorder?.(
3243
+ this.currentProps,
3244
+ dirtyState,
3245
+ this.collectionToken,
3246
+ this.instances,
3247
+ this.root,
3248
+ this.hasReactOwnedRows()
3249
+ );
3250
+ if (reorderedInstances) {
3251
+ this.instances = new Map(reorderedInstances);
3252
+ this.rebuildElementIndex(this.instances);
3253
+ this.commitCurrentCollection(dirtyState);
3254
+ afterCommit?.();
3255
+ return;
3256
+ }
3257
+ const rollingWindowInstances = options.keyedUpdates.rollingWindow?.(
3258
+ this.currentProps,
3259
+ dirtyState,
3260
+ this.collectionToken,
3261
+ this.instances,
3262
+ this.root,
3263
+ this.hasReactOwnedRows()
3264
+ );
3265
+ if (rollingWindowInstances) {
3266
+ this.instances = new Map(rollingWindowInstances);
3267
+ this.rebuildElementIndex(this.instances);
3268
+ const keys = [...this.instances.keys()];
3269
+ this.pruneEventHandlers(keys);
3270
+ this.pruneConditionalListeners(keys);
3271
+ this.commitCurrentCollection(dirtyState);
3272
+ afterCommit?.();
3273
+ return;
3274
+ }
3275
+ const filteredInstances = options.keyedUpdates.filter?.(
3276
+ this.currentProps,
3277
+ dirtyState,
3278
+ this.collectionToken,
3279
+ this.instances,
3280
+ this.hasReactOwnedRows()
3281
+ );
3282
+ if (filteredInstances) {
3283
+ this.instances = new Map(filteredInstances);
3284
+ this.rebuildElementIndex(this.instances);
3285
+ const keys = [...this.instances.keys()];
3286
+ this.pruneEventHandlers(keys);
3287
+ this.pruneConditionalListeners(keys);
3288
+ this.commitCurrentCollection(dirtyState);
3289
+ afterCommit?.();
3290
+ return;
3291
+ }
3292
+ const prependedInstances = options.keyedUpdates.prepend?.(
3293
+ this.currentProps,
3294
+ dirtyState,
3295
+ this.collectionToken,
3296
+ this.instances,
3297
+ this.root,
3298
+ this.hasReactOwnedRows()
3299
+ );
3300
+ if (prependedInstances) {
3301
+ this.instances = new Map(prependedInstances);
3302
+ this.rebuildElementIndex(this.instances);
3303
+ this.commitCurrentCollection(dirtyState);
3304
+ afterCommit?.();
3305
+ return;
3306
+ }
3307
+ }
2030
3308
  if (dirtyState && this.refreshDirtyBindings(dirtyState, afterCommit)) return;
2031
- this.reconcile(afterCommit);
3309
+ this.reconcile(afterCommit, dirtyState);
2032
3310
  };
2033
3311
  }
2034
3312
  readRows(props) {
@@ -2126,8 +3404,66 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2126
3404
  if (!active.has(key)) this.conditionalListeners.delete(key);
2127
3405
  }
2128
3406
  }
3407
+ commitCurrentCollection(dirtyState) {
3408
+ this.collectionToken = options.keyedUpdates?.commit(this.currentProps.items());
3409
+ this.commitKeyedTargets(dirtyState);
3410
+ }
3411
+ hasSafeMembershipTargets(dirtyState) {
3412
+ for (const binding of this.currentProps.bindings) {
3413
+ const target = binding.membershipTarget;
3414
+ if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
3415
+ if (!keyedMembershipTargetSnapshot(target.read()).eligible) return false;
3416
+ }
3417
+ return true;
3418
+ }
3419
+ hasSafeMapLookupTargets(dirtyState) {
3420
+ for (const binding of this.currentProps.bindings) {
3421
+ const target = binding.mapLookupTarget;
3422
+ if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
3423
+ if (!keyedMapLookupTargetSnapshot(target.read()).eligible) return false;
3424
+ }
3425
+ return true;
3426
+ }
3427
+ commitKeyedTargets(dirtyState) {
3428
+ if (!dirtyState) {
3429
+ this.identityTargets.clear();
3430
+ this.membershipTargets.clear();
3431
+ this.mapLookupTargets.clear();
3432
+ }
3433
+ for (let bindingIndex = 0; bindingIndex < this.currentProps.bindings.length; bindingIndex += 1) {
3434
+ const binding = this.currentProps.bindings[bindingIndex];
3435
+ const identityTarget = binding.identityTarget;
3436
+ if (!identityTarget) {
3437
+ this.identityTargets.delete(bindingIndex);
3438
+ } else if (!dirtyState || dirtyState.has(identityTarget.dependency)) {
3439
+ this.identityTargets.set(
3440
+ bindingIndex,
3441
+ keyedIdentityTargetSnapshot(identityTarget.read())
3442
+ );
3443
+ }
3444
+ const membershipTarget = binding.membershipTarget;
3445
+ if (!membershipTarget) {
3446
+ this.membershipTargets.delete(bindingIndex);
3447
+ } else if (!dirtyState || dirtyState.has(membershipTarget.dependency)) {
3448
+ this.membershipTargets.set(
3449
+ bindingIndex,
3450
+ keyedMembershipTargetSnapshot(membershipTarget.read())
3451
+ );
3452
+ }
3453
+ const mapLookupTarget = binding.mapLookupTarget;
3454
+ if (!mapLookupTarget) {
3455
+ this.mapLookupTargets.delete(bindingIndex);
3456
+ } else if (!dirtyState || dirtyState.has(mapLookupTarget.dependency)) {
3457
+ this.mapLookupTargets.set(
3458
+ bindingIndex,
3459
+ keyedMapLookupTargetSnapshot(mapLookupTarget.read())
3460
+ );
3461
+ }
3462
+ }
3463
+ }
2129
3464
  adopt() {
2130
3465
  if (!this.root) return false;
3466
+ if (!this.hasSafeMembershipTargets() || !this.hasSafeMapLookupTargets()) return false;
2131
3467
  const rows = this.readRows(this.currentProps);
2132
3468
  const elements = [...this.root.children];
2133
3469
  if (!rows || rows.items.length !== elements.length) return false;
@@ -2169,6 +3505,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2169
3505
  this.rebuildElementIndex(instances);
2170
3506
  this.pruneEventHandlers(rows.keys);
2171
3507
  this.pruneConditionalListeners(rows.keys);
3508
+ this.commitCurrentCollection();
2172
3509
  return true;
2173
3510
  }
2174
3511
  hasUnsafeFallbackKeys() {
@@ -2231,21 +3568,132 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2231
3568
  affectedBindingIndices.push(bindingIndex);
2232
3569
  }
2233
3570
  }
2234
- for (const instance of this.instances.values()) {
2235
- for (const bindingIndex of affectedBindingIndices) {
2236
- applyKeyedRowBinding(
2237
- this.currentProps,
2238
- instance,
2239
- instance.item,
2240
- instance.index,
2241
- bindingIndex
3571
+ const nextIdentityTargets = /* @__PURE__ */ new Map();
3572
+ const nextMembershipTargets = /* @__PURE__ */ new Map();
3573
+ const nextMapLookupTargets = /* @__PURE__ */ new Map();
3574
+ for (const bindingIndex of affectedBindingIndices) {
3575
+ const binding = this.currentProps.bindings[bindingIndex];
3576
+ if (binding.identityTarget) {
3577
+ nextIdentityTargets.set(
3578
+ bindingIndex,
3579
+ keyedIdentityTargetSnapshot(binding.identityTarget.read())
3580
+ );
3581
+ }
3582
+ if (binding.membershipTarget) {
3583
+ const snapshot = keyedMembershipTargetSnapshot(
3584
+ binding.membershipTarget.read(),
3585
+ this.membershipTargets.get(bindingIndex)
3586
+ );
3587
+ if (!snapshot.eligible) {
3588
+ this.activateFallback(afterCommit);
3589
+ return true;
3590
+ }
3591
+ nextMembershipTargets.set(bindingIndex, snapshot);
3592
+ }
3593
+ if (binding.mapLookupTarget) {
3594
+ const snapshot = keyedMapLookupTargetSnapshot(
3595
+ binding.mapLookupTarget.read(),
3596
+ this.mapLookupTargets.get(bindingIndex)
2242
3597
  );
3598
+ if (!snapshot.eligible) {
3599
+ this.activateFallback(afterCommit);
3600
+ return true;
3601
+ }
3602
+ nextMapLookupTargets.set(bindingIndex, snapshot);
3603
+ }
3604
+ }
3605
+ for (const bindingIndex of affectedBindingIndices) {
3606
+ const binding = this.currentProps.bindings[bindingIndex];
3607
+ const identityTarget = binding.identityTarget;
3608
+ const previousIdentityTarget = this.identityTargets.get(bindingIndex);
3609
+ const nextIdentityTarget = nextIdentityTargets.get(bindingIndex);
3610
+ const canTargetIdentity = Boolean(
3611
+ identityTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === identityTarget.dependency && dirtyState.has(identityTarget.dependency) && previousIdentityTarget?.eligible && nextIdentityTarget?.eligible
3612
+ );
3613
+ const membershipTarget = binding.membershipTarget;
3614
+ const previousMembershipTarget = this.membershipTargets.get(bindingIndex);
3615
+ const nextMembershipTarget = nextMembershipTargets.get(bindingIndex);
3616
+ const canTargetMembership = Boolean(
3617
+ membershipTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === membershipTarget.dependency && dirtyState.has(membershipTarget.dependency) && previousMembershipTarget?.eligible && nextMembershipTarget?.eligible
3618
+ );
3619
+ const mapLookupTarget = binding.mapLookupTarget;
3620
+ const previousMapLookupTarget = this.mapLookupTargets.get(bindingIndex);
3621
+ const nextMapLookupTarget = nextMapLookupTargets.get(bindingIndex);
3622
+ const canTargetMapLookup = Boolean(
3623
+ mapLookupTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === mapLookupTarget.dependency && dirtyState.has(mapLookupTarget.dependency) && previousMapLookupTarget?.eligible && nextMapLookupTarget?.eligible
3624
+ );
3625
+ if (canTargetMapLookup && previousMapLookupTarget && nextMapLookupTarget) {
3626
+ const keys = keyedMapLookupChangedKeys(previousMapLookupTarget, nextMapLookupTarget);
3627
+ for (const key of keys) {
3628
+ const instance = this.instances.get(key);
3629
+ if (instance) {
3630
+ applyKeyedRowBinding(
3631
+ this.currentProps,
3632
+ instance,
3633
+ instance.item,
3634
+ instance.index,
3635
+ bindingIndex
3636
+ );
3637
+ }
3638
+ }
3639
+ } else if (canTargetMembership && previousMembershipTarget && nextMembershipTarget) {
3640
+ const keys = keyedMembershipChangedKeys(previousMembershipTarget, nextMembershipTarget);
3641
+ for (const key of keys) {
3642
+ const instance = this.instances.get(key);
3643
+ if (instance) {
3644
+ applyKeyedRowBinding(
3645
+ this.currentProps,
3646
+ instance,
3647
+ instance.item,
3648
+ instance.index,
3649
+ bindingIndex
3650
+ );
3651
+ }
3652
+ }
3653
+ } else if (canTargetIdentity && previousIdentityTarget && nextIdentityTarget) {
3654
+ const keys = /* @__PURE__ */ new Set();
3655
+ if (previousIdentityTarget.key !== void 0) keys.add(previousIdentityTarget.key);
3656
+ if (nextIdentityTarget.key !== void 0) keys.add(nextIdentityTarget.key);
3657
+ for (const key of keys) {
3658
+ const instance = this.instances.get(key);
3659
+ if (instance) {
3660
+ applyKeyedRowBinding(
3661
+ this.currentProps,
3662
+ instance,
3663
+ instance.item,
3664
+ instance.index,
3665
+ bindingIndex
3666
+ );
3667
+ }
3668
+ }
3669
+ } else {
3670
+ for (const instance of this.instances.values()) {
3671
+ applyKeyedRowBinding(
3672
+ this.currentProps,
3673
+ instance,
3674
+ instance.item,
3675
+ instance.index,
3676
+ bindingIndex
3677
+ );
3678
+ }
3679
+ }
3680
+ if (nextIdentityTarget) this.identityTargets.set(bindingIndex, nextIdentityTarget);
3681
+ else this.identityTargets.delete(bindingIndex);
3682
+ if (nextMembershipTarget) {
3683
+ this.membershipTargets.set(bindingIndex, nextMembershipTarget);
3684
+ } else {
3685
+ this.membershipTargets.delete(bindingIndex);
3686
+ }
3687
+ if (nextMapLookupTarget) {
3688
+ this.mapLookupTargets.set(bindingIndex, nextMapLookupTarget);
3689
+ } else {
3690
+ this.mapLookupTargets.delete(bindingIndex);
2243
3691
  }
2244
3692
  }
2245
3693
  afterCommit?.();
2246
3694
  return true;
2247
3695
  }
2248
- reconcileStableRows(rows, afterCommit) {
3696
+ reconcileStableRows(rows, afterCommit, dirtyState) {
2249
3697
  if (rows.keys.length !== this.instances.size) return false;
2250
3698
  let index = 0;
2251
3699
  for (const key of this.instances.keys()) {
@@ -2272,17 +3720,23 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2272
3720
  );
2273
3721
  for (const [id, values] of conditionalValues) {
2274
3722
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2275
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3723
+ conditionalChanges.push({
3724
+ key,
3725
+ id,
3726
+ item: rows.items[index],
3727
+ index
3728
+ });
2276
3729
  }
2277
3730
  }
2278
3731
  existing.conditionalValues = conditionalValues;
2279
3732
  existing.item = rows.items[index];
2280
3733
  existing.index = index;
2281
3734
  }
3735
+ this.commitCurrentCollection(dirtyState);
2282
3736
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2283
3737
  return true;
2284
3738
  }
2285
- reconcileSingleRemoval(rows, afterCommit) {
3739
+ reconcileSingleRemoval(rows, afterCommit, dirtyState) {
2286
3740
  if (this.hasReactOwnedRows() || rows.keys.length + 1 !== this.instances.size) return false;
2287
3741
  const previousKeys = [...this.instances.keys()];
2288
3742
  let removedIndex = 0;
@@ -2315,7 +3769,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2315
3769
  );
2316
3770
  for (const [id, values] of conditionalValues) {
2317
3771
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2318
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3772
+ conditionalChanges.push({
3773
+ key,
3774
+ id,
3775
+ item: rows.items[index],
3776
+ index
3777
+ });
2319
3778
  }
2320
3779
  }
2321
3780
  existing.conditionalValues = conditionalValues;
@@ -2327,10 +3786,11 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2327
3786
  this.instances.delete(removedKey);
2328
3787
  this.eventHandlers.delete(removedKey);
2329
3788
  this.conditionalListeners.delete(removedKey);
3789
+ this.commitCurrentCollection(dirtyState);
2330
3790
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2331
3791
  return true;
2332
3792
  }
2333
- reconcile(afterCommit) {
3793
+ reconcile(afterCommit, dirtyState) {
2334
3794
  if (!this.mounted || !this.root) {
2335
3795
  afterCommit?.();
2336
3796
  return;
@@ -2344,6 +3804,14 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2344
3804
  this.forceUpdate(afterCommit);
2345
3805
  return;
2346
3806
  }
3807
+ if (!this.hasSafeMembershipTargets(dirtyState)) {
3808
+ this.activateFallback(afterCommit);
3809
+ return;
3810
+ }
3811
+ if (!this.hasSafeMapLookupTargets(dirtyState)) {
3812
+ this.activateFallback(afterCommit);
3813
+ return;
3814
+ }
2347
3815
  const rows = this.readRows(this.currentProps);
2348
3816
  if (!rows) {
2349
3817
  this.activateFallback(afterCommit);
@@ -2363,11 +3831,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2363
3831
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
2364
3832
  this.eventHandlers.clear();
2365
3833
  this.conditionalListeners.clear();
3834
+ this.commitCurrentCollection(dirtyState);
2366
3835
  afterCommit?.();
2367
3836
  return;
2368
3837
  }
2369
- if (this.reconcileStableRows(rows, afterCommit)) return;
2370
- if (this.reconcileSingleRemoval(rows, afterCommit)) return;
3838
+ if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
3839
+ if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
2371
3840
  const activeElement = this.root.ownerDocument.activeElement;
2372
3841
  const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
2373
3842
  const nextKeys = new Set(rows.keys);
@@ -2405,7 +3874,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2405
3874
  );
2406
3875
  for (const [id, values] of conditionalValues) {
2407
3876
  if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
2408
- conditionalChanges.push({ key, id, item: rows.items[index], index });
3877
+ conditionalChanges.push({
3878
+ key,
3879
+ id,
3880
+ item: rows.items[index],
3881
+ index
3882
+ });
2409
3883
  }
2410
3884
  }
2411
3885
  existing.conditionalValues = conditionalValues;
@@ -2471,6 +3945,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2471
3945
  if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
2472
3946
  activeElement.focus({ preventScroll: true });
2473
3947
  }
3948
+ this.commitCurrentCollection(dirtyState);
2474
3949
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
2475
3950
  }
2476
3951
  schedulePropSync() {
@@ -2510,6 +3985,9 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
2510
3985
  this.root = null;
2511
3986
  this.cleanupHostScopes();
2512
3987
  this.instances.clear();
3988
+ this.identityTargets.clear();
3989
+ this.membershipTargets.clear();
3990
+ this.mapLookupTargets.clear();
2513
3991
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
2514
3992
  this.eventHandlers.clear();
2515
3993
  this.conditionalListeners.clear();
@@ -2940,6 +4418,70 @@ var keyedRowsRuntimeFeature = {
2940
4418
  KeyedRows: createKeyedRowsBlockComponent(owner)
2941
4419
  })
2942
4420
  };
4421
+ var keyedRowsHintedRuntimeFeature = {
4422
+ name: "keyed-rows:hinted",
4423
+ create: (owner) => ({
4424
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4425
+ keyedUpdates: keyedUpdateRuntime
4426
+ })
4427
+ })
4428
+ };
4429
+ var keyedRowsPositionHintedRuntimeFeature = {
4430
+ name: "keyed-rows:position-hinted",
4431
+ create: (owner) => ({
4432
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4433
+ keyedUpdates: keyedPositionUpdateRuntime
4434
+ })
4435
+ })
4436
+ };
4437
+ var keyedRowsReorderHintedRuntimeFeature = {
4438
+ name: "keyed-rows:reorder-hinted",
4439
+ create: (owner) => ({
4440
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4441
+ keyedUpdates: keyedReorderUpdateRuntime
4442
+ })
4443
+ })
4444
+ };
4445
+ var keyedRowsAllHintedRuntimeFeature = {
4446
+ name: "keyed-rows:all-hinted",
4447
+ create: (owner) => ({
4448
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4449
+ keyedUpdates: keyedCompleteUpdateRuntime
4450
+ })
4451
+ })
4452
+ };
4453
+ var keyedRowsEveryHintedRuntimeFeature = {
4454
+ name: "keyed-rows:every-hinted",
4455
+ create: (owner) => ({
4456
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4457
+ keyedUpdates: keyedEveryUpdateRuntime
4458
+ })
4459
+ })
4460
+ };
4461
+ var keyedRowsFilterHintedRuntimeFeature = {
4462
+ name: "keyed-rows:filter-hinted",
4463
+ create: (owner) => ({
4464
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4465
+ keyedUpdates: keyedFilterUpdateRuntime
4466
+ })
4467
+ })
4468
+ };
4469
+ var keyedRowsPrependHintedRuntimeFeature = {
4470
+ name: "keyed-rows:prepend-hinted",
4471
+ create: (owner) => ({
4472
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4473
+ keyedUpdates: keyedPrependUpdateRuntime
4474
+ })
4475
+ })
4476
+ };
4477
+ var keyedRowsFilterPrependHintedRuntimeFeature = {
4478
+ name: "keyed-rows:filter-prepend-hinted",
4479
+ create: (owner) => ({
4480
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4481
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4482
+ })
4483
+ })
4484
+ };
2943
4485
  var keyedRowsConditionalRuntimeFeature = {
2944
4486
  name: "keyed-rows:conditional",
2945
4487
  create: (owner) => ({
@@ -2948,6 +4490,78 @@ var keyedRowsConditionalRuntimeFeature = {
2948
4490
  })
2949
4491
  })
2950
4492
  };
4493
+ var keyedRowsConditionalHintedRuntimeFeature = {
4494
+ name: "keyed-rows:conditional:hinted",
4495
+ create: (owner) => ({
4496
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4497
+ conditionals: createKeyedRowConditionalRuntime(),
4498
+ keyedUpdates: keyedUpdateRuntime
4499
+ })
4500
+ })
4501
+ };
4502
+ var keyedRowsConditionalPositionHintedRuntimeFeature = {
4503
+ name: "keyed-rows:conditional:position-hinted",
4504
+ create: (owner) => ({
4505
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4506
+ conditionals: createKeyedRowConditionalRuntime(),
4507
+ keyedUpdates: keyedPositionUpdateRuntime
4508
+ })
4509
+ })
4510
+ };
4511
+ var keyedRowsConditionalReorderHintedRuntimeFeature = {
4512
+ name: "keyed-rows:conditional:reorder-hinted",
4513
+ create: (owner) => ({
4514
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4515
+ conditionals: createKeyedRowConditionalRuntime(),
4516
+ keyedUpdates: keyedReorderUpdateRuntime
4517
+ })
4518
+ })
4519
+ };
4520
+ var keyedRowsConditionalAllHintedRuntimeFeature = {
4521
+ name: "keyed-rows:conditional:all-hinted",
4522
+ create: (owner) => ({
4523
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4524
+ conditionals: createKeyedRowConditionalRuntime(),
4525
+ keyedUpdates: keyedCompleteUpdateRuntime
4526
+ })
4527
+ })
4528
+ };
4529
+ var keyedRowsConditionalEveryHintedRuntimeFeature = {
4530
+ name: "keyed-rows:conditional:every-hinted",
4531
+ create: (owner) => ({
4532
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4533
+ conditionals: createKeyedRowConditionalRuntime(),
4534
+ keyedUpdates: keyedEveryUpdateRuntime
4535
+ })
4536
+ })
4537
+ };
4538
+ var keyedRowsConditionalFilterHintedRuntimeFeature = {
4539
+ name: "keyed-rows:conditional:filter-hinted",
4540
+ create: (owner) => ({
4541
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4542
+ conditionals: createKeyedRowConditionalRuntime(),
4543
+ keyedUpdates: keyedFilterUpdateRuntime
4544
+ })
4545
+ })
4546
+ };
4547
+ var keyedRowsConditionalPrependHintedRuntimeFeature = {
4548
+ name: "keyed-rows:conditional:prepend-hinted",
4549
+ create: (owner) => ({
4550
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4551
+ conditionals: createKeyedRowConditionalRuntime(),
4552
+ keyedUpdates: keyedPrependUpdateRuntime
4553
+ })
4554
+ })
4555
+ };
4556
+ var keyedRowsConditionalFilterPrependHintedRuntimeFeature = {
4557
+ name: "keyed-rows:conditional:filter-prepend-hinted",
4558
+ create: (owner) => ({
4559
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4560
+ conditionals: createKeyedRowConditionalRuntime(),
4561
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4562
+ })
4563
+ })
4564
+ };
2951
4565
  var keyedRowsHostRuntimeFeature = {
2952
4566
  name: "keyed-rows:host",
2953
4567
  create: (owner) => ({
@@ -2956,6 +4570,78 @@ var keyedRowsHostRuntimeFeature = {
2956
4570
  })
2957
4571
  })
2958
4572
  };
4573
+ var keyedRowsHostHintedRuntimeFeature = {
4574
+ name: "keyed-rows:host:hinted",
4575
+ create: (owner) => ({
4576
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4577
+ hostBlocks: createKeyedRowHostRuntime(),
4578
+ keyedUpdates: keyedUpdateRuntime
4579
+ })
4580
+ })
4581
+ };
4582
+ var keyedRowsHostPositionHintedRuntimeFeature = {
4583
+ name: "keyed-rows:host:position-hinted",
4584
+ create: (owner) => ({
4585
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4586
+ hostBlocks: createKeyedRowHostRuntime(),
4587
+ keyedUpdates: keyedPositionUpdateRuntime
4588
+ })
4589
+ })
4590
+ };
4591
+ var keyedRowsHostReorderHintedRuntimeFeature = {
4592
+ name: "keyed-rows:host:reorder-hinted",
4593
+ create: (owner) => ({
4594
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4595
+ hostBlocks: createKeyedRowHostRuntime(),
4596
+ keyedUpdates: keyedReorderUpdateRuntime
4597
+ })
4598
+ })
4599
+ };
4600
+ var keyedRowsHostAllHintedRuntimeFeature = {
4601
+ name: "keyed-rows:host:all-hinted",
4602
+ create: (owner) => ({
4603
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4604
+ hostBlocks: createKeyedRowHostRuntime(),
4605
+ keyedUpdates: keyedCompleteUpdateRuntime
4606
+ })
4607
+ })
4608
+ };
4609
+ var keyedRowsHostEveryHintedRuntimeFeature = {
4610
+ name: "keyed-rows:host:every-hinted",
4611
+ create: (owner) => ({
4612
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4613
+ hostBlocks: createKeyedRowHostRuntime(),
4614
+ keyedUpdates: keyedEveryUpdateRuntime
4615
+ })
4616
+ })
4617
+ };
4618
+ var keyedRowsHostFilterHintedRuntimeFeature = {
4619
+ name: "keyed-rows:host:filter-hinted",
4620
+ create: (owner) => ({
4621
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4622
+ hostBlocks: createKeyedRowHostRuntime(),
4623
+ keyedUpdates: keyedFilterUpdateRuntime
4624
+ })
4625
+ })
4626
+ };
4627
+ var keyedRowsHostPrependHintedRuntimeFeature = {
4628
+ name: "keyed-rows:host:prepend-hinted",
4629
+ create: (owner) => ({
4630
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4631
+ hostBlocks: createKeyedRowHostRuntime(),
4632
+ keyedUpdates: keyedPrependUpdateRuntime
4633
+ })
4634
+ })
4635
+ };
4636
+ var keyedRowsHostFilterPrependHintedRuntimeFeature = {
4637
+ name: "keyed-rows:host:filter-prepend-hinted",
4638
+ create: (owner) => ({
4639
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4640
+ hostBlocks: createKeyedRowHostRuntime(),
4641
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4642
+ })
4643
+ })
4644
+ };
2959
4645
  var keyedRowsCompleteRuntimeFeature = {
2960
4646
  name: "keyed-rows:complete",
2961
4647
  create: (owner) => ({
@@ -2965,6 +4651,86 @@ var keyedRowsCompleteRuntimeFeature = {
2965
4651
  })
2966
4652
  })
2967
4653
  };
4654
+ var keyedRowsCompleteHintedRuntimeFeature = {
4655
+ name: "keyed-rows:complete:hinted",
4656
+ create: (owner) => ({
4657
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4658
+ conditionals: createKeyedRowConditionalRuntime(),
4659
+ hostBlocks: createKeyedRowHostRuntime(),
4660
+ keyedUpdates: keyedUpdateRuntime
4661
+ })
4662
+ })
4663
+ };
4664
+ var keyedRowsCompletePositionHintedRuntimeFeature = {
4665
+ name: "keyed-rows:complete:position-hinted",
4666
+ create: (owner) => ({
4667
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4668
+ conditionals: createKeyedRowConditionalRuntime(),
4669
+ hostBlocks: createKeyedRowHostRuntime(),
4670
+ keyedUpdates: keyedPositionUpdateRuntime
4671
+ })
4672
+ })
4673
+ };
4674
+ var keyedRowsCompleteReorderHintedRuntimeFeature = {
4675
+ name: "keyed-rows:complete:reorder-hinted",
4676
+ create: (owner) => ({
4677
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4678
+ conditionals: createKeyedRowConditionalRuntime(),
4679
+ hostBlocks: createKeyedRowHostRuntime(),
4680
+ keyedUpdates: keyedReorderUpdateRuntime
4681
+ })
4682
+ })
4683
+ };
4684
+ var keyedRowsCompleteAllHintedRuntimeFeature = {
4685
+ name: "keyed-rows:complete:all-hinted",
4686
+ create: (owner) => ({
4687
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4688
+ conditionals: createKeyedRowConditionalRuntime(),
4689
+ hostBlocks: createKeyedRowHostRuntime(),
4690
+ keyedUpdates: keyedCompleteUpdateRuntime
4691
+ })
4692
+ })
4693
+ };
4694
+ var keyedRowsCompleteEveryHintedRuntimeFeature = {
4695
+ name: "keyed-rows:complete:every-hinted",
4696
+ create: (owner) => ({
4697
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4698
+ conditionals: createKeyedRowConditionalRuntime(),
4699
+ hostBlocks: createKeyedRowHostRuntime(),
4700
+ keyedUpdates: keyedEveryUpdateRuntime
4701
+ })
4702
+ })
4703
+ };
4704
+ var keyedRowsCompleteFilterHintedRuntimeFeature = {
4705
+ name: "keyed-rows:complete:filter-hinted",
4706
+ create: (owner) => ({
4707
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4708
+ conditionals: createKeyedRowConditionalRuntime(),
4709
+ hostBlocks: createKeyedRowHostRuntime(),
4710
+ keyedUpdates: keyedFilterUpdateRuntime
4711
+ })
4712
+ })
4713
+ };
4714
+ var keyedRowsCompletePrependHintedRuntimeFeature = {
4715
+ name: "keyed-rows:complete:prepend-hinted",
4716
+ create: (owner) => ({
4717
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4718
+ conditionals: createKeyedRowConditionalRuntime(),
4719
+ hostBlocks: createKeyedRowHostRuntime(),
4720
+ keyedUpdates: keyedPrependUpdateRuntime
4721
+ })
4722
+ })
4723
+ };
4724
+ var keyedRowsCompleteFilterPrependHintedRuntimeFeature = {
4725
+ name: "keyed-rows:complete:filter-prepend-hinted",
4726
+ create: (owner) => ({
4727
+ KeyedRows: createKeyedRowsBlockComponent(owner, {
4728
+ conditionals: createKeyedRowConditionalRuntime(),
4729
+ hostBlocks: createKeyedRowHostRuntime(),
4730
+ keyedUpdates: keyedFilterPrependUpdateRuntime
4731
+ })
4732
+ })
4733
+ };
2968
4734
  var keyedRangesRuntimeFeature = {
2969
4735
  name: "keyed-ranges",
2970
4736
  create: (owner) => ({
@@ -2996,7 +4762,9 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
2996
4762
  return existing.component;
2997
4763
  }
2998
4764
  }
2999
- const definitionReference = { current: definition };
4765
+ const definitionReference = {
4766
+ current: definition
4767
+ };
3000
4768
  const refreshListeners = /* @__PURE__ */ new Set();
3001
4769
  class FarmCompiledComponent extends React__default.default.Component {
3002
4770
  constructor(props) {
@@ -3435,7 +5203,7 @@ var COMPLETE_RUNTIME_FEATURES = [
3435
5203
  hostConditionalRuntimeFeature,
3436
5204
  conditionalRangesRuntimeFeature,
3437
5205
  keyedListRuntimeFeature,
3438
- keyedRowsCompleteRuntimeFeature,
5206
+ keyedRowsCompleteEveryHintedRuntimeFeature,
3439
5207
  keyedRangesRuntimeFeature,
3440
5208
  mixedRangesRuntimeFeature,
3441
5209
  componentRuntimeFeature
@@ -3444,17 +5212,60 @@ function createCompiledComponent(definition) {
3444
5212
  return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
3445
5213
  }
3446
5214
 
5215
+ exports.applyCompilerKeyedCollectionMutation = applyCompilerKeyedCollectionMutation;
3447
5216
  exports.componentRuntimeFeature = componentRuntimeFeature;
3448
5217
  exports.conditionalRangesRuntimeFeature = conditionalRangesRuntimeFeature;
3449
5218
  exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
3450
5219
  exports.createCompiledComponent = createCompiledComponent;
3451
5220
  exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
5221
+ exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
5222
+ exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
5223
+ exports.createCompilerKeyedArrayPositionUpdate = createCompilerKeyedArrayPositionUpdate;
5224
+ exports.createCompilerKeyedArrayPrepend = createCompilerKeyedArrayPrepend;
5225
+ exports.createCompilerKeyedArrayReorder = createCompilerKeyedArrayReorder;
5226
+ exports.createCompilerKeyedArrayRollingWindow = createCompilerKeyedArrayRollingWindow;
5227
+ exports.createCompilerKeyedArraySlice = createCompilerKeyedArraySlice;
5228
+ exports.createCompilerKeyedArraySort = createCompilerKeyedArraySort;
5229
+ exports.createCompilerKeyedCollectionUpdate = createCompilerKeyedCollectionUpdate;
5230
+ exports.createCompilerKeyedMapUpdate = createCompilerKeyedMapUpdate;
3452
5231
  exports.hostConditionalRuntimeFeature = hostConditionalRuntimeFeature;
3453
5232
  exports.keyedListRuntimeFeature = keyedListRuntimeFeature;
3454
5233
  exports.keyedRangesRuntimeFeature = keyedRangesRuntimeFeature;
5234
+ exports.keyedRowsAllHintedRuntimeFeature = keyedRowsAllHintedRuntimeFeature;
5235
+ exports.keyedRowsCompleteAllHintedRuntimeFeature = keyedRowsCompleteAllHintedRuntimeFeature;
5236
+ exports.keyedRowsCompleteEveryHintedRuntimeFeature = keyedRowsCompleteEveryHintedRuntimeFeature;
5237
+ exports.keyedRowsCompleteFilterHintedRuntimeFeature = keyedRowsCompleteFilterHintedRuntimeFeature;
5238
+ exports.keyedRowsCompleteFilterPrependHintedRuntimeFeature = keyedRowsCompleteFilterPrependHintedRuntimeFeature;
5239
+ exports.keyedRowsCompleteHintedRuntimeFeature = keyedRowsCompleteHintedRuntimeFeature;
5240
+ exports.keyedRowsCompletePositionHintedRuntimeFeature = keyedRowsCompletePositionHintedRuntimeFeature;
5241
+ exports.keyedRowsCompletePrependHintedRuntimeFeature = keyedRowsCompletePrependHintedRuntimeFeature;
5242
+ exports.keyedRowsCompleteReorderHintedRuntimeFeature = keyedRowsCompleteReorderHintedRuntimeFeature;
3455
5243
  exports.keyedRowsCompleteRuntimeFeature = keyedRowsCompleteRuntimeFeature;
5244
+ exports.keyedRowsConditionalAllHintedRuntimeFeature = keyedRowsConditionalAllHintedRuntimeFeature;
5245
+ exports.keyedRowsConditionalEveryHintedRuntimeFeature = keyedRowsConditionalEveryHintedRuntimeFeature;
5246
+ exports.keyedRowsConditionalFilterHintedRuntimeFeature = keyedRowsConditionalFilterHintedRuntimeFeature;
5247
+ exports.keyedRowsConditionalFilterPrependHintedRuntimeFeature = keyedRowsConditionalFilterPrependHintedRuntimeFeature;
5248
+ exports.keyedRowsConditionalHintedRuntimeFeature = keyedRowsConditionalHintedRuntimeFeature;
5249
+ exports.keyedRowsConditionalPositionHintedRuntimeFeature = keyedRowsConditionalPositionHintedRuntimeFeature;
5250
+ exports.keyedRowsConditionalPrependHintedRuntimeFeature = keyedRowsConditionalPrependHintedRuntimeFeature;
5251
+ exports.keyedRowsConditionalReorderHintedRuntimeFeature = keyedRowsConditionalReorderHintedRuntimeFeature;
3456
5252
  exports.keyedRowsConditionalRuntimeFeature = keyedRowsConditionalRuntimeFeature;
5253
+ exports.keyedRowsEveryHintedRuntimeFeature = keyedRowsEveryHintedRuntimeFeature;
5254
+ exports.keyedRowsFilterHintedRuntimeFeature = keyedRowsFilterHintedRuntimeFeature;
5255
+ exports.keyedRowsFilterPrependHintedRuntimeFeature = keyedRowsFilterPrependHintedRuntimeFeature;
5256
+ exports.keyedRowsHintedRuntimeFeature = keyedRowsHintedRuntimeFeature;
5257
+ exports.keyedRowsHostAllHintedRuntimeFeature = keyedRowsHostAllHintedRuntimeFeature;
5258
+ exports.keyedRowsHostEveryHintedRuntimeFeature = keyedRowsHostEveryHintedRuntimeFeature;
5259
+ exports.keyedRowsHostFilterHintedRuntimeFeature = keyedRowsHostFilterHintedRuntimeFeature;
5260
+ exports.keyedRowsHostFilterPrependHintedRuntimeFeature = keyedRowsHostFilterPrependHintedRuntimeFeature;
5261
+ exports.keyedRowsHostHintedRuntimeFeature = keyedRowsHostHintedRuntimeFeature;
5262
+ exports.keyedRowsHostPositionHintedRuntimeFeature = keyedRowsHostPositionHintedRuntimeFeature;
5263
+ exports.keyedRowsHostPrependHintedRuntimeFeature = keyedRowsHostPrependHintedRuntimeFeature;
5264
+ exports.keyedRowsHostReorderHintedRuntimeFeature = keyedRowsHostReorderHintedRuntimeFeature;
3457
5265
  exports.keyedRowsHostRuntimeFeature = keyedRowsHostRuntimeFeature;
5266
+ exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
5267
+ exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;
5268
+ exports.keyedRowsReorderHintedRuntimeFeature = keyedRowsReorderHintedRuntimeFeature;
3458
5269
  exports.keyedRowsRuntimeFeature = keyedRowsRuntimeFeature;
3459
5270
  exports.mixedRangesRuntimeFeature = mixedRangesRuntimeFeature;
3460
5271
  //# sourceMappingURL=compiler-runtime.cjs.map