@noya-app/noya-multiplayer-react 0.1.54 → 0.1.56

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.
package/dist/index.js CHANGED
@@ -36,7 +36,46 @@ var require_access = __commonJS({
36
36
  "../../node_modules/tree-visit/lib/access.js"(exports2) {
37
37
  "use strict";
38
38
  Object.defineProperty(exports2, "__esModule", { value: true });
39
- exports2.accessPath = exports2.access = void 0;
39
+ exports2.get = get;
40
+ exports2.ancestors = ancestors;
41
+ exports2.access = access;
42
+ exports2.accessPath = accessPath;
43
+ function get(node, indexPath, options) {
44
+ if (options.includeTraversalContext) {
45
+ const accessed = _getPath(node, indexPath, options);
46
+ return accessed[accessed.length - 1];
47
+ }
48
+ let path = indexPath.slice();
49
+ while (path.length > 0) {
50
+ let index = path.shift();
51
+ const children = options.getChildren(node, path);
52
+ const child = children[index];
53
+ if (!child) {
54
+ return void 0;
55
+ }
56
+ node = child;
57
+ }
58
+ return node;
59
+ }
60
+ function ancestors(node, indexPath, options) {
61
+ return _getPath(node, indexPath, options).slice(0, -1);
62
+ }
63
+ function _getPath(node, indexPath, options) {
64
+ let path = indexPath.slice();
65
+ let result = [node];
66
+ while (path.length > 0) {
67
+ let index = path.shift();
68
+ const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
69
+ const children = options.getChildren(node, path, context);
70
+ const child = children[index];
71
+ if (!child) {
72
+ return result;
73
+ }
74
+ node = child;
75
+ result.push(node);
76
+ }
77
+ return result;
78
+ }
40
79
  function access(node, indexPath, options) {
41
80
  if (options.includeTraversalContext) {
42
81
  const accessed = accessPath(node, indexPath, options);
@@ -49,23 +88,24 @@ var require_access = __commonJS({
49
88
  }
50
89
  return node;
51
90
  }
52
- exports2.access = access;
53
91
  function accessPath(node, indexPath, options) {
54
92
  let path = indexPath.slice();
55
93
  let result = [node];
56
94
  while (path.length > 0) {
57
95
  let index = path.shift();
58
- const context = options.includeTraversalContext ? {
59
- getRoot: () => result[0],
60
- getParent: () => result[result.length - 2],
61
- getAncestors: () => result.slice(0, -1)
62
- } : void 0;
96
+ const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
63
97
  node = options.getChildren(node, path, context)[index];
64
98
  result.push(node);
65
99
  }
66
100
  return result;
67
101
  }
68
- exports2.accessPath = accessPath;
102
+ function makeTraversalContext(array) {
103
+ return {
104
+ getRoot: () => array[0],
105
+ getParent: () => array[array.length - 2],
106
+ getAncestors: () => array.slice(0, -1)
107
+ };
108
+ }
69
109
  }
70
110
  });
71
111
 
@@ -74,7 +114,8 @@ var require_sort = __commonJS({
74
114
  "../../node_modules/tree-visit/lib/sort.js"(exports2) {
75
115
  "use strict";
76
116
  Object.defineProperty(exports2, "__esModule", { value: true });
77
- exports2.sortPaths = exports2.comparePathsByComponent = void 0;
117
+ exports2.comparePathsByComponent = comparePathsByComponent;
118
+ exports2.sortPaths = sortPaths;
78
119
  function comparePathsByComponent(a, b) {
79
120
  for (let i = 0; i < Math.min(a.length, b.length); i++) {
80
121
  if (a[i] < b[i])
@@ -84,11 +125,9 @@ var require_sort = __commonJS({
84
125
  }
85
126
  return a.length - b.length;
86
127
  }
87
- exports2.comparePathsByComponent = comparePathsByComponent;
88
128
  function sortPaths(indexPaths) {
89
129
  return [...indexPaths].sort(comparePathsByComponent);
90
130
  }
91
- exports2.sortPaths = sortPaths;
92
131
  }
93
132
  });
94
133
 
@@ -97,7 +136,7 @@ var require_ancestors = __commonJS({
97
136
  "../../node_modules/tree-visit/lib/ancestors.js"(exports2) {
98
137
  "use strict";
99
138
  Object.defineProperty(exports2, "__esModule", { value: true });
100
- exports2.ancestorPaths = void 0;
139
+ exports2.ancestorPaths = ancestorPaths;
101
140
  var sort_1 = require_sort();
102
141
  function ancestorPaths(paths, options) {
103
142
  var _a;
@@ -115,7 +154,6 @@ var require_ancestors = __commonJS({
115
154
  }
116
155
  return Array.from(result.values());
117
156
  }
118
- exports2.ancestorPaths = ancestorPaths;
119
157
  }
120
158
  });
121
159
 
@@ -124,7 +162,7 @@ var require_boxDiagram = __commonJS({
124
162
  "../../node_modules/tree-visit/lib/diagram/boxDiagram.js"(exports2) {
125
163
  "use strict";
126
164
  Object.defineProperty(exports2, "__esModule", { value: true });
127
- exports2.boxDiagram = void 0;
165
+ exports2.boxDiagram = boxDiagram;
128
166
  var BoxDrawing;
129
167
  (function(BoxDrawing2) {
130
168
  BoxDrawing2["TopLeft"] = "\u250C";
@@ -239,7 +277,6 @@ var require_boxDiagram = __commonJS({
239
277
  function boxDiagram(node, options) {
240
278
  return nodeDiagram(node, [], options).contents.join("\n");
241
279
  }
242
- exports2.boxDiagram = boxDiagram;
243
280
  function centerIndex(width) {
244
281
  return Math.floor(width / 2);
245
282
  }
@@ -268,7 +305,9 @@ var require_directoryDiagram = __commonJS({
268
305
  "../../node_modules/tree-visit/lib/diagram/directoryDiagram.js"(exports2) {
269
306
  "use strict";
270
307
  Object.defineProperty(exports2, "__esModule", { value: true });
271
- exports2.prefixBlock = exports2.isMultiline = exports2.directoryDiagram = void 0;
308
+ exports2.directoryDiagram = directoryDiagram;
309
+ exports2.isMultiline = isMultiline;
310
+ exports2.prefixBlock = prefixBlock;
272
311
  var LinePrefix;
273
312
  (function(LinePrefix2) {
274
313
  LinePrefix2["Child"] = "\u251C\u2500\u2500 ";
@@ -315,17 +354,14 @@ var require_directoryDiagram = __commonJS({
315
354
  const strings = lines.map((line) => prefixBlock(line.label, line.prefix, line.multilinePrefix));
316
355
  return strings.join("\n");
317
356
  }
318
- exports2.directoryDiagram = directoryDiagram;
319
357
  function isMultiline(line) {
320
358
  return line.includes("\n");
321
359
  }
322
- exports2.isMultiline = isMultiline;
323
360
  function prefixBlock(block, prefix, multilinePrefix) {
324
361
  if (!isMultiline(block))
325
362
  return prefix + block;
326
363
  return block.split("\n").map((line, index) => (index === 0 ? prefix : multilinePrefix) + line).join("\n");
327
364
  }
328
- exports2.prefixBlock = prefixBlock;
329
365
  }
330
366
  });
331
367
 
@@ -334,7 +370,7 @@ var require_diagram = __commonJS({
334
370
  "../../node_modules/tree-visit/lib/diagram.js"(exports2) {
335
371
  "use strict";
336
372
  Object.defineProperty(exports2, "__esModule", { value: true });
337
- exports2.diagram = void 0;
373
+ exports2.diagram = diagram;
338
374
  var boxDiagram_1 = require_boxDiagram();
339
375
  var directoryDiagram_1 = require_directoryDiagram();
340
376
  function diagram(node, options) {
@@ -343,7 +379,6 @@ var require_diagram = __commonJS({
343
379
  }
344
380
  return (0, directoryDiagram_1.directoryDiagram)(node, options);
345
381
  }
346
- exports2.diagram = diagram;
347
382
  }
348
383
  });
349
384
 
@@ -352,11 +387,16 @@ var require_visit = __commonJS({
352
387
  "../../node_modules/tree-visit/lib/visit.js"(exports2) {
353
388
  "use strict";
354
389
  Object.defineProperty(exports2, "__esModule", { value: true });
355
- exports2.visit = exports2.STOP = exports2.SKIP = void 0;
390
+ exports2.STOP = exports2.SKIP = void 0;
391
+ exports2.visit = visit;
356
392
  exports2.SKIP = "skip";
357
393
  exports2.STOP = "stop";
358
394
  function visit(node, options) {
359
- const { onEnter, onLeave, getChildren, onDetectCycle, getIdentifier } = options;
395
+ const { onEnter, onLeave, getChildren: originalGetChildren, onDetectCycle, getIdentifier, direction = "forward" } = options;
396
+ const getChildren = (node2, indexPath2, context2) => {
397
+ const children = originalGetChildren(node2, indexPath2, context2);
398
+ return direction === "forward" ? children : children.slice().reverse();
399
+ };
360
400
  let indexPath = [];
361
401
  let stack = [{ node }];
362
402
  const visited = onDetectCycle ? /* @__PURE__ */ new Set() : void 0;
@@ -401,7 +441,7 @@ var require_visit = __commonJS({
401
441
  if (wrapper.state !== -1) {
402
442
  if (wrapper.state < children.length) {
403
443
  let currentIndex = wrapper.state;
404
- indexPath.push(currentIndex);
444
+ indexPath.push(direction === "forward" ? currentIndex : children.length - currentIndex - 1);
405
445
  stack.push({ node: children[currentIndex] });
406
446
  wrapper.state = currentIndex + 1;
407
447
  continue;
@@ -418,7 +458,23 @@ var require_visit = __commonJS({
418
458
  stack.pop();
419
459
  }
420
460
  }
421
- exports2.visit = visit;
461
+ }
462
+ });
463
+
464
+ // ../../node_modules/tree-visit/lib/entries.js
465
+ var require_entries = __commonJS({
466
+ "../../node_modules/tree-visit/lib/entries.js"(exports2) {
467
+ "use strict";
468
+ Object.defineProperty(exports2, "__esModule", { value: true });
469
+ exports2.entries = entries;
470
+ var visit_1 = require_visit();
471
+ function entries(node, options) {
472
+ let result = [];
473
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onEnter: (item, indexPath) => {
474
+ result.push([indexPath, item]);
475
+ } }));
476
+ return result;
477
+ }
422
478
  }
423
479
  });
424
480
 
@@ -427,7 +483,10 @@ var require_find = __commonJS({
427
483
  "../../node_modules/tree-visit/lib/find.js"(exports2) {
428
484
  "use strict";
429
485
  Object.defineProperty(exports2, "__esModule", { value: true });
430
- exports2.findAllIndexPaths = exports2.findIndexPath = exports2.findAll = exports2.find = void 0;
486
+ exports2.find = find;
487
+ exports2.findAll = findAll;
488
+ exports2.findPath = findPath;
489
+ exports2.findAllPaths = findAllPaths;
431
490
  var visit_1 = require_visit();
432
491
  function find(node, options) {
433
492
  let found;
@@ -439,7 +498,6 @@ var require_find = __commonJS({
439
498
  } }));
440
499
  return found;
441
500
  }
442
- exports2.find = find;
443
501
  function findAll(node, options) {
444
502
  let found = [];
445
503
  (0, visit_1.visit)(node, {
@@ -452,8 +510,7 @@ var require_find = __commonJS({
452
510
  });
453
511
  return found;
454
512
  }
455
- exports2.findAll = findAll;
456
- function findIndexPath(node, options) {
513
+ function findPath(node, options) {
457
514
  let found;
458
515
  (0, visit_1.visit)(node, {
459
516
  onEnter: (child, indexPath) => {
@@ -466,8 +523,7 @@ var require_find = __commonJS({
466
523
  });
467
524
  return found;
468
525
  }
469
- exports2.findIndexPath = findIndexPath;
470
- function findAllIndexPaths(node, options) {
526
+ function findAllPaths(node, options) {
471
527
  let found = [];
472
528
  (0, visit_1.visit)(node, {
473
529
  onEnter: (child, indexPath) => {
@@ -479,7 +535,6 @@ var require_find = __commonJS({
479
535
  });
480
536
  return found;
481
537
  }
482
- exports2.findAllIndexPaths = findAllIndexPaths;
483
538
  }
484
539
  });
485
540
 
@@ -488,7 +543,7 @@ var require_reduce = __commonJS({
488
543
  "../../node_modules/tree-visit/lib/reduce.js"(exports2) {
489
544
  "use strict";
490
545
  Object.defineProperty(exports2, "__esModule", { value: true });
491
- exports2.reduce = void 0;
546
+ exports2.reduce = reduce;
492
547
  var visit_1 = require_visit();
493
548
  function reduce(node, options) {
494
549
  let result = options.initialResult;
@@ -497,7 +552,6 @@ var require_reduce = __commonJS({
497
552
  } }));
498
553
  return result;
499
554
  }
500
- exports2.reduce = reduce;
501
555
  }
502
556
  });
503
557
 
@@ -506,7 +560,7 @@ var require_flat = __commonJS({
506
560
  "../../node_modules/tree-visit/lib/flat.js"(exports2) {
507
561
  "use strict";
508
562
  Object.defineProperty(exports2, "__esModule", { value: true });
509
- exports2.flat = void 0;
563
+ exports2.flat = flat;
510
564
  var reduce_1 = require_reduce();
511
565
  function flat(node, options) {
512
566
  return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child) => {
@@ -514,24 +568,6 @@ var require_flat = __commonJS({
514
568
  return result;
515
569
  } }));
516
570
  }
517
- exports2.flat = flat;
518
- }
519
- });
520
-
521
- // ../../node_modules/tree-visit/lib/flatMap.js
522
- var require_flatMap = __commonJS({
523
- "../../node_modules/tree-visit/lib/flatMap.js"(exports2) {
524
- "use strict";
525
- Object.defineProperty(exports2, "__esModule", { value: true });
526
- exports2.flatMap = void 0;
527
- var reduce_1 = require_reduce();
528
- function flatMap(node, options) {
529
- return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child, indexPath) => {
530
- result.push(...options.transform(child, indexPath));
531
- return result;
532
- } }));
533
- }
534
- exports2.flatMap = flatMap;
535
571
  }
536
572
  });
537
573
 
@@ -540,9 +576,15 @@ var require_map = __commonJS({
540
576
  "../../node_modules/tree-visit/lib/map.js"(exports2) {
541
577
  "use strict";
542
578
  Object.defineProperty(exports2, "__esModule", { value: true });
543
- exports2.map = void 0;
579
+ exports2.map = map3;
580
+ exports2.flatMap = flatMap;
544
581
  var visit_1 = require_visit();
545
582
  function map3(node, options) {
583
+ return flatMap(node, Object.assign(Object.assign({}, options), { transform: (node2, transformedChildren, indexPath) => [
584
+ options.transform(node2, transformedChildren, indexPath)
585
+ ] }));
586
+ }
587
+ function flatMap(node, options) {
546
588
  const childrenMap = {};
547
589
  (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onLeave: (child, indexPath) => {
548
590
  var _a, _b;
@@ -551,12 +593,56 @@ var require_map = __commonJS({
551
593
  const transformed = options.transform(child, (_a = childrenMap[key]) !== null && _a !== void 0 ? _a : [], indexPath);
552
594
  const parentKey = keyIndexPath.slice(0, -1).join();
553
595
  const parentChildren = (_b = childrenMap[parentKey]) !== null && _b !== void 0 ? _b : [];
554
- parentChildren.push(transformed);
596
+ parentChildren.push(...transformed);
555
597
  childrenMap[parentKey] = parentChildren;
556
598
  } }));
557
599
  return childrenMap[""][0];
558
600
  }
559
- exports2.map = map3;
601
+ }
602
+ });
603
+
604
+ // ../../node_modules/tree-visit/lib/transformPath.js
605
+ var require_transformPath = __commonJS({
606
+ "../../node_modules/tree-visit/lib/transformPath.js"(exports2) {
607
+ "use strict";
608
+ Object.defineProperty(exports2, "__esModule", { value: true });
609
+ exports2.transformPath = transformPath;
610
+ var sort_1 = require_sort();
611
+ function commonAncestor(path, otherPath) {
612
+ const length = Math.min(path.length, otherPath.length);
613
+ for (let i = 0; i < length; i++) {
614
+ if (path[i] !== otherPath[i]) {
615
+ return path.slice(0, i);
616
+ }
617
+ }
618
+ return path.slice(0, length);
619
+ }
620
+ function transformPath(path, operation, otherPath, count = 1) {
621
+ if (otherPath.length > path.length || (0, sort_1.comparePathsByComponent)(otherPath, path) > 0) {
622
+ return path;
623
+ }
624
+ if (otherPath.length === 0 && operation === "remove") {
625
+ return void 0;
626
+ }
627
+ const common = commonAncestor(path, otherPath);
628
+ const adjustmentIndex = common.length === path.length || common.length === otherPath.length ? common.length - 1 : common.length;
629
+ const pathValue = path[adjustmentIndex];
630
+ const otherPathValue = otherPath[adjustmentIndex];
631
+ if (operation === "insert" && otherPathValue <= pathValue) {
632
+ const newPath = [...path];
633
+ newPath[adjustmentIndex] += count;
634
+ return newPath;
635
+ } else if (operation === "remove") {
636
+ if (otherPathValue === pathValue) {
637
+ return void 0;
638
+ } else if (otherPathValue < pathValue) {
639
+ const newPath = [...path];
640
+ newPath[adjustmentIndex] -= count;
641
+ return newPath;
642
+ }
643
+ }
644
+ return path;
645
+ }
560
646
  }
561
647
  });
562
648
 
@@ -565,9 +651,18 @@ var require_operation = __commonJS({
565
651
  "../../node_modules/tree-visit/lib/operation.js"(exports2) {
566
652
  "use strict";
567
653
  Object.defineProperty(exports2, "__esModule", { value: true });
568
- exports2.splice = exports2.applyOperations = exports2.getReplaceOperations = exports2.getRemovalOperations = exports2.getInsertionOperations = exports2.replaceOperation = exports2.removeOperation = exports2.insertOperation = void 0;
654
+ exports2.insertOperation = insertOperation;
655
+ exports2.removeOperation = removeOperation;
656
+ exports2.replaceOperation = replaceOperation;
657
+ exports2.getInsertionOperations = getInsertionOperations;
658
+ exports2.getRemovalOperations = getRemovalOperations;
659
+ exports2.getReplaceOperations = getReplaceOperations;
660
+ exports2.applyOperations = applyOperations;
661
+ exports2.arraySplice = arraySplice;
662
+ exports2.transformPathsByOperations = transformPathsByOperations;
569
663
  var ancestors_1 = require_ancestors();
570
664
  var map_1 = require_map();
665
+ var transformPath_1 = require_transformPath();
571
666
  function insertOperation(index, nodes) {
572
667
  return {
573
668
  type: "insert",
@@ -575,20 +670,17 @@ var require_operation = __commonJS({
575
670
  nodes
576
671
  };
577
672
  }
578
- exports2.insertOperation = insertOperation;
579
673
  function removeOperation(indexes) {
580
674
  return {
581
675
  type: "remove",
582
676
  indexes
583
677
  };
584
678
  }
585
- exports2.removeOperation = removeOperation;
586
679
  function replaceOperation() {
587
680
  return {
588
681
  type: "replace"
589
682
  };
590
683
  }
591
- exports2.replaceOperation = replaceOperation;
592
684
  function splitIndexPath(indexPath) {
593
685
  return [indexPath.slice(0, -1), indexPath[indexPath.length - 1]];
594
686
  }
@@ -618,7 +710,6 @@ var require_operation = __commonJS({
618
710
  }
619
711
  return operations;
620
712
  }
621
- exports2.getInsertionOperations = getInsertionOperations;
622
713
  function getRemovalOperations(indexPaths) {
623
714
  var _a, _b;
624
715
  const _ancestorIndexPaths = (0, ancestors_1.ancestorPaths)(indexPaths);
@@ -642,7 +733,6 @@ var require_operation = __commonJS({
642
733
  }
643
734
  return operations;
644
735
  }
645
- exports2.getRemovalOperations = getRemovalOperations;
646
736
  function getReplaceOperations(indexPath, node) {
647
737
  const operations = /* @__PURE__ */ new Map();
648
738
  const [parentIndexPath, index] = splitIndexPath(indexPath);
@@ -658,7 +748,9 @@ var require_operation = __commonJS({
658
748
  });
659
749
  return operations;
660
750
  }
661
- exports2.getReplaceOperations = getReplaceOperations;
751
+ function adjustInsertIndex(index, removeIndexes) {
752
+ return removeIndexes.reduce((index2, removedIndex) => removedIndex < index2 ? index2 - 1 : index2, index);
753
+ }
662
754
  function applyOperations(node, operations, options) {
663
755
  return (0, map_1.map)(node, Object.assign(Object.assign({}, options), {
664
756
  // Avoid calling `getChildren` for every node in the tree.
@@ -684,10 +776,10 @@ var require_operation = __commonJS({
684
776
  return options.create(node2, children.filter((_, index) => !operation.indexes.includes(index)), indexPath);
685
777
  case "removeThenInsert":
686
778
  const updatedChildren = children.filter((_, index) => !operation.removeIndexes.includes(index));
687
- const adjustedIndex = operation.removeIndexes.reduce((index, removedIndex) => removedIndex < index ? index - 1 : index, operation.insertIndex);
688
- return options.create(node2, splice(updatedChildren, adjustedIndex, 0, ...operation.insertNodes), indexPath);
779
+ const adjustedIndex = adjustInsertIndex(operation.insertIndex, operation.removeIndexes);
780
+ return options.create(node2, arraySplice(updatedChildren, adjustedIndex, 0, ...operation.insertNodes), indexPath);
689
781
  case "insert":
690
- return options.create(node2, splice(children, operation.index, 0, ...operation.nodes), indexPath);
782
+ return options.create(node2, arraySplice(children, operation.index, 0, ...operation.nodes), indexPath);
691
783
  case "replace":
692
784
  return options.create(node2, children, indexPath);
693
785
  default:
@@ -696,15 +788,53 @@ var require_operation = __commonJS({
696
788
  }
697
789
  }));
698
790
  }
699
- exports2.applyOperations = applyOperations;
700
- function splice(array, start, deleteCount, ...items) {
791
+ function arraySplice(array, start, deleteCount, ...items) {
701
792
  return [
702
793
  ...array.slice(0, start),
703
794
  ...items,
704
795
  ...array.slice(start + deleteCount)
705
796
  ];
706
797
  }
707
- exports2.splice = splice;
798
+ function transformPathsByOperations(paths, operations) {
799
+ let transformedPaths = paths;
800
+ for (const [parentKey, operation] of operations.entries()) {
801
+ const parentPath = parentKey ? parentKey.split(",").map(Number) : [];
802
+ transformedPaths = transformByOperation(transformedPaths, parentPath, operation);
803
+ }
804
+ return transformedPaths;
805
+ }
806
+ function transformByOperation(transformedPaths, parentPath, operation) {
807
+ switch (operation.type) {
808
+ case "insert": {
809
+ const otherPath = parentPath.concat(operation.index);
810
+ return transformedPaths.map((path) => path ? (0, transformPath_1.transformPath)(path, "insert", otherPath, operation.nodes.length) : void 0);
811
+ }
812
+ case "remove": {
813
+ const otherPaths = [...operation.indexes].reverse().map((index) => parentPath.concat(index));
814
+ return transformedPaths.map((path) => {
815
+ for (const otherPath of otherPaths) {
816
+ path = path ? (0, transformPath_1.transformPath)(path, "remove", otherPath) : void 0;
817
+ }
818
+ return path;
819
+ });
820
+ }
821
+ case "removeThenInsert": {
822
+ const result = transformByOperation(transformedPaths, parentPath, {
823
+ type: "remove",
824
+ indexes: operation.removeIndexes
825
+ });
826
+ const insertIndex = adjustInsertIndex(operation.insertIndex, operation.removeIndexes);
827
+ return transformByOperation(result, parentPath, {
828
+ type: "insert",
829
+ index: insertIndex,
830
+ nodes: operation.insertNodes
831
+ });
832
+ }
833
+ case "replace": {
834
+ return transformedPaths;
835
+ }
836
+ }
837
+ }
708
838
  }
709
839
  });
710
840
 
@@ -713,17 +843,27 @@ var require_insert = __commonJS({
713
843
  "../../node_modules/tree-visit/lib/insert.js"(exports2) {
714
844
  "use strict";
715
845
  Object.defineProperty(exports2, "__esModule", { value: true });
716
- exports2.insert = void 0;
846
+ exports2.insert = insert;
847
+ exports2.insertWithPathTracking = insertWithPathTracking;
717
848
  var operation_1 = require_operation();
718
849
  function insert(node, options) {
719
- const { nodes, at } = options;
850
+ return _insertWithPathTracking(node, options).node;
851
+ }
852
+ function insertWithPathTracking(node, options) {
853
+ return _insertWithPathTracking(node, options);
854
+ }
855
+ function _insertWithPathTracking(node, options) {
856
+ const { nodes, path: at, track } = options;
720
857
  if (at.length === 0) {
721
858
  throw new Error(`Can't insert nodes at the root`);
722
859
  }
723
860
  const state = (0, operation_1.getInsertionOperations)(at, nodes);
724
- return (0, operation_1.applyOperations)(node, state, options);
861
+ const transformedPaths = track ? (0, operation_1.transformPathsByOperations)(track, state) : [];
862
+ return {
863
+ node: (0, operation_1.applyOperations)(node, state, options),
864
+ paths: transformedPaths
865
+ };
725
866
  }
726
- exports2.insert = insert;
727
867
  }
728
868
  });
729
869
 
@@ -732,14 +872,14 @@ var require_move = __commonJS({
732
872
  "../../node_modules/tree-visit/lib/move.js"(exports2) {
733
873
  "use strict";
734
874
  Object.defineProperty(exports2, "__esModule", { value: true });
735
- exports2.move = void 0;
875
+ exports2.move = move;
736
876
  var access_1 = require_access();
737
877
  var ancestors_1 = require_ancestors();
738
878
  var operation_1 = require_operation();
739
879
  function move(node, options) {
740
- if (options.indexPaths.length === 0)
880
+ if (options.paths.length === 0)
741
881
  return node;
742
- for (const indexPath of options.indexPaths) {
882
+ for (const indexPath of options.paths) {
743
883
  if (indexPath.length === 0) {
744
884
  throw new Error(`Can't move the root node`);
745
885
  }
@@ -747,12 +887,11 @@ var require_move = __commonJS({
747
887
  if (options.to.length === 0) {
748
888
  throw new Error(`Can't move nodes to the root`);
749
889
  }
750
- const _ancestorIndexPaths = (0, ancestors_1.ancestorPaths)(options.indexPaths);
890
+ const _ancestorIndexPaths = (0, ancestors_1.ancestorPaths)(options.paths);
751
891
  const nodesToInsert = _ancestorIndexPaths.map((indexPath) => (0, access_1.access)(node, indexPath, options));
752
892
  const operations = (0, operation_1.getInsertionOperations)(options.to, nodesToInsert, (0, operation_1.getRemovalOperations)(_ancestorIndexPaths));
753
893
  return (0, operation_1.applyOperations)(node, operations, options);
754
894
  }
755
- exports2.move = move;
756
895
  }
757
896
  });
758
897
 
@@ -761,20 +900,24 @@ var require_remove = __commonJS({
761
900
  "../../node_modules/tree-visit/lib/remove.js"(exports2) {
762
901
  "use strict";
763
902
  Object.defineProperty(exports2, "__esModule", { value: true });
764
- exports2.remove = void 0;
903
+ exports2.remove = remove;
904
+ exports2.removeWithPathTracking = removeWithPathTracking;
765
905
  var operation_1 = require_operation();
766
906
  function remove(node, options) {
767
- if (options.indexPaths.length === 0)
768
- return node;
769
- for (const indexPath of options.indexPaths) {
770
- if (indexPath.length === 0) {
771
- throw new Error(`Can't remove the root node`);
772
- }
773
- }
774
- const operations = (0, operation_1.getRemovalOperations)(options.indexPaths);
775
- return (0, operation_1.applyOperations)(node, operations, options);
907
+ return _removeWithPathTracking(node, options).node;
908
+ }
909
+ function removeWithPathTracking(node, options) {
910
+ return _removeWithPathTracking(node, options);
911
+ }
912
+ function _removeWithPathTracking(node, options) {
913
+ const { paths, track } = options;
914
+ const operations = (0, operation_1.getRemovalOperations)(paths);
915
+ const transformedPaths = track ? (0, operation_1.transformPathsByOperations)(track, operations) : [];
916
+ return {
917
+ node: (0, operation_1.applyOperations)(node, operations, options),
918
+ paths: transformedPaths
919
+ };
776
920
  }
777
- exports2.remove = remove;
778
921
  }
779
922
  });
780
923
 
@@ -783,15 +926,53 @@ var require_replace = __commonJS({
783
926
  "../../node_modules/tree-visit/lib/replace.js"(exports2) {
784
927
  "use strict";
785
928
  Object.defineProperty(exports2, "__esModule", { value: true });
786
- exports2.replace = void 0;
929
+ exports2.replace = replace;
787
930
  var operation_1 = require_operation();
788
931
  function replace(node, options) {
789
- if (options.at.length === 0)
932
+ if (options.path.length === 0)
790
933
  return options.node;
791
- const operations = (0, operation_1.getReplaceOperations)(options.at, options.node);
934
+ const operations = (0, operation_1.getReplaceOperations)(options.path, options.node);
792
935
  return (0, operation_1.applyOperations)(node, operations, options);
793
936
  }
794
- exports2.replace = replace;
937
+ }
938
+ });
939
+
940
+ // ../../node_modules/tree-visit/lib/splice.js
941
+ var require_splice = __commonJS({
942
+ "../../node_modules/tree-visit/lib/splice.js"(exports2) {
943
+ "use strict";
944
+ Object.defineProperty(exports2, "__esModule", { value: true });
945
+ exports2.splice = splice;
946
+ exports2.spliceWithPathTracking = spliceWithPathTracking;
947
+ var operation_1 = require_operation();
948
+ function splice(node, options) {
949
+ return _spliceWithPathTracking(node, options).node;
950
+ }
951
+ function spliceWithPathTracking(node, options) {
952
+ return _spliceWithPathTracking(node, options);
953
+ }
954
+ function _spliceWithPathTracking(node, options) {
955
+ const { path, deleteCount = 0, nodes, track } = options;
956
+ if (path.length === 0) {
957
+ throw new Error(`Can't splice at the root`);
958
+ }
959
+ const pathsToRemove = getPathsToRemove(path, deleteCount);
960
+ const operations = (0, operation_1.getInsertionOperations)(path, nodes, (0, operation_1.getRemovalOperations)(pathsToRemove));
961
+ const transformedPaths = track ? (0, operation_1.transformPathsByOperations)(track, operations) : [];
962
+ return {
963
+ node: (0, operation_1.applyOperations)(node, operations, options),
964
+ paths: transformedPaths
965
+ };
966
+ }
967
+ function getPathsToRemove(path, deleteCount) {
968
+ let pathsToRemove = [];
969
+ let parentPath = path.slice(0, -1);
970
+ let index = path[path.length - 1];
971
+ for (let i = 0; i < deleteCount; i++) {
972
+ pathsToRemove.push(parentPath.concat(index + i));
973
+ }
974
+ return pathsToRemove;
975
+ }
795
976
  }
796
977
  });
797
978
 
@@ -800,18 +981,19 @@ var require_defineTree = __commonJS({
800
981
  "../../node_modules/tree-visit/lib/defineTree.js"(exports2) {
801
982
  "use strict";
802
983
  Object.defineProperty(exports2, "__esModule", { value: true });
803
- exports2.defineTree = void 0;
984
+ exports2.defineTree = defineTree2;
804
985
  var access_1 = require_access();
805
986
  var diagram_1 = require_diagram();
987
+ var entries_1 = require_entries();
806
988
  var find_1 = require_find();
807
989
  var flat_1 = require_flat();
808
- var flatMap_1 = require_flatMap();
809
990
  var insert_1 = require_insert();
810
991
  var map_1 = require_map();
811
992
  var move_1 = require_move();
812
993
  var reduce_1 = require_reduce();
813
994
  var remove_1 = require_remove();
814
995
  var replace_1 = require_replace();
996
+ var splice_1 = require_splice();
815
997
  var visit_1 = require_visit();
816
998
  var Tree = class _Tree {
817
999
  constructor(getChildrenOrBaseOptions, appliedOptions) {
@@ -823,19 +1005,26 @@ var require_defineTree = __commonJS({
823
1005
  this.withOptions = (newOptions) => new _Tree(this.baseOptions, Object.assign(Object.assign({}, this.appliedOptions), newOptions));
824
1006
  this.access = (node, indexPath) => (0, access_1.access)(node, indexPath, this.mergeOptions({}));
825
1007
  this.accessPath = (node, indexPath) => (0, access_1.accessPath)(node, indexPath, this.mergeOptions({}));
1008
+ this.get = (node, indexPath) => (0, access_1.get)(node, indexPath, this.mergeOptions({}));
1009
+ this.ancestors = (node, indexPath) => (0, access_1.ancestors)(node, indexPath, this.mergeOptions({}));
826
1010
  this.diagram = (node, options) => typeof options === "function" ? (0, diagram_1.diagram)(node, this.mergeOptions({ getLabel: options })) : (0, diagram_1.diagram)(node, this.mergeOptions(options));
827
1011
  this.find = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.find)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.find)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
828
1012
  this.findAll = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAll)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAll)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
829
- this.findIndexPath = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findIndexPath)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findIndexPath)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
830
- this.findAllIndexPaths = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAllIndexPaths)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAllIndexPaths)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
1013
+ this.findPath = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findPath)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findPath)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
1014
+ this.findAllPaths = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAllPaths)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAllPaths)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
1015
+ this.entries = (node) => (0, entries_1.entries)(node, this.mergeOptions({}));
831
1016
  this.flat = (node) => (0, flat_1.flat)(node, this.mergeOptions({}));
832
- this.flatMap = (node, transform) => (0, flatMap_1.flatMap)(node, this.mergeOptions({ transform }));
833
1017
  this.reduce = (node, nextResult, initialResult) => (0, reduce_1.reduce)(node, this.mergeOptions({ nextResult, initialResult }));
834
1018
  this.map = (node, transform) => (0, map_1.map)(node, this.mergeOptions({ transform }));
1019
+ this.flatMap = (node, transform) => (0, map_1.flatMap)(node, this.mergeOptions({ transform }));
835
1020
  this.visit = (node, onEnterOrOptions) => typeof onEnterOrOptions === "function" ? (0, visit_1.visit)(node, this.mergeOptions({ onEnter: onEnterOrOptions })) : (0, visit_1.visit)(node, this.mergeOptions(Object.assign({}, onEnterOrOptions)));
836
1021
  this.insert = (node, options) => (0, insert_1.insert)(node, this.mergeOptions(options));
1022
+ this.insertWithPathTracking = (node, options) => (0, insert_1.insertWithPathTracking)(node, this.mergeOptions(options));
837
1023
  this.remove = (node, options) => (0, remove_1.remove)(node, this.mergeOptions(options));
1024
+ this.removeWithPathTracking = (node, options) => (0, remove_1.removeWithPathTracking)(node, this.mergeOptions(options));
838
1025
  this.move = (node, options) => (0, move_1.move)(node, this.mergeOptions(options));
1026
+ this.splice = (node, options) => (0, splice_1.splice)(node, this.mergeOptions(options));
1027
+ this.spliceWithPathTracking = (node, options) => (0, splice_1.spliceWithPathTracking)(node, this.mergeOptions(options));
839
1028
  this.replace = (node, options) => (0, replace_1.replace)(node, this.mergeOptions(options));
840
1029
  this.baseOptions = typeof getChildrenOrBaseOptions === "function" ? { getChildren: getChildrenOrBaseOptions } : getChildrenOrBaseOptions;
841
1030
  this._getChildren = this.baseOptions.getChildren;
@@ -844,7 +1033,6 @@ var require_defineTree = __commonJS({
844
1033
  function defineTree2(getChildren) {
845
1034
  return new Tree(getChildren, {});
846
1035
  }
847
- exports2.defineTree = defineTree2;
848
1036
  }
849
1037
  });
850
1038
 
@@ -881,9 +1069,13 @@ var require_lib = __commonJS({
881
1069
  "use strict";
882
1070
  var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
883
1071
  if (k2 === void 0) k2 = k;
884
- Object.defineProperty(o, k2, { enumerable: true, get: function() {
885
- return m[k];
886
- } });
1072
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1073
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1074
+ desc = { enumerable: true, get: function() {
1075
+ return m[k];
1076
+ } };
1077
+ }
1078
+ Object.defineProperty(o, k2, desc);
887
1079
  } : function(o, m, k, k2) {
888
1080
  if (k2 === void 0) k2 = k;
889
1081
  o[k2] = m[k];
@@ -896,9 +1088,9 @@ var require_lib = __commonJS({
896
1088
  __exportStar(require_ancestors(), exports2);
897
1089
  __exportStar(require_defineTree(), exports2);
898
1090
  __exportStar(require_diagram(), exports2);
1091
+ __exportStar(require_entries(), exports2);
899
1092
  __exportStar(require_find(), exports2);
900
1093
  __exportStar(require_flat(), exports2);
901
- __exportStar(require_flatMap(), exports2);
902
1094
  __exportStar(require_indexPath(), exports2);
903
1095
  __exportStar(require_insert(), exports2);
904
1096
  __exportStar(require_map(), exports2);
@@ -908,6 +1100,8 @@ var require_lib = __commonJS({
908
1100
  __exportStar(require_remove(), exports2);
909
1101
  __exportStar(require_replace(), exports2);
910
1102
  __exportStar(require_sort(), exports2);
1103
+ __exportStar(require_splice(), exports2);
1104
+ __exportStar(require_transformPath(), exports2);
911
1105
  __exportStar(require_visit(), exports2);
912
1106
  __exportStar(require_withOptions(), exports2);
913
1107
  }
@@ -3482,10 +3676,11 @@ var jsonSchema = Type.Recursive(
3482
3676
 
3483
3677
  // ../noya-schemas/src/input.ts
3484
3678
  function Nullable(type) {
3485
- return Type.Union([type, Type.Null()]);
3679
+ return Type.Union([type, Type.Null()], { default: null });
3486
3680
  }
3487
3681
  var inputSchemaBase = {
3488
3682
  id: Type.String({ format: "uuid", default: "" }),
3683
+ stableId: Type.String({ format: "uuid", default: "" }),
3489
3684
  name: Type.String(),
3490
3685
  description: Nullable(Type.String()),
3491
3686
  required: Type.Boolean({ default: false })
@@ -3502,7 +3697,13 @@ var dataInputSchema = Type.Object({
3502
3697
  });
3503
3698
  var secretInputSchema = Type.Object({
3504
3699
  ...inputSchemaBase,
3505
- kind: Type.Literal("secret")
3700
+ kind: Type.Literal("secret"),
3701
+ authProvider: Type.Optional(
3702
+ Type.Union([Type.Null(), Type.Literal("github"), Type.Literal("figma")], {
3703
+ default: null
3704
+ })
3705
+ ),
3706
+ authScope: Type.Optional(Nullable(Type.String()))
3506
3707
  });
3507
3708
  var inputSchema = Type.Union(
3508
3709
  [fileInputSchema, dataInputSchema, secretInputSchema],
@@ -3512,6 +3713,7 @@ var inputSchema = Type.Union(
3512
3713
  );
3513
3714
  var outputTransformSchemaBase = {
3514
3715
  id: Type.String({ format: "uuid", default: "" }),
3716
+ stableId: Type.String({ format: "uuid", default: "" }),
3515
3717
  order: Type.Number()
3516
3718
  };
3517
3719
  var scriptOutputTransformSchema = Type.Object({
@@ -3730,7 +3932,7 @@ var SchemaTree = (0, import_tree_visit.defineTree)((schema) => {
3730
3932
  });
3731
3933
  function findAllDefs(schema) {
3732
3934
  if (!schema) return [];
3733
- return SchemaTree.flatMap(schema, (node) => {
3935
+ return SchemaTree.flat(schema).flatMap((node) => {
3734
3936
  return node.$id ? [node] : [];
3735
3937
  });
3736
3938
  }
@@ -3912,6 +4114,45 @@ function ToggleButton({
3912
4114
  theme,
3913
4115
  anchor
3914
4116
  }) {
4117
+ const isRightAnchor = anchor === "right";
4118
+ const rightIcon = /* @__PURE__ */ import_react3.default.createElement(
4119
+ "svg",
4120
+ {
4121
+ xmlns: "http://www.w3.org/2000/svg",
4122
+ fill: "none",
4123
+ viewBox: "0 0 24 24",
4124
+ strokeWidth: 1.5,
4125
+ stroke: "currentColor",
4126
+ className: "size-6"
4127
+ },
4128
+ /* @__PURE__ */ import_react3.default.createElement(
4129
+ "path",
4130
+ {
4131
+ strokeLinecap: "round",
4132
+ strokeLinejoin: "round",
4133
+ d: "m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5"
4134
+ }
4135
+ )
4136
+ );
4137
+ const leftIcon = /* @__PURE__ */ import_react3.default.createElement(
4138
+ "svg",
4139
+ {
4140
+ xmlns: "http://www.w3.org/2000/svg",
4141
+ fill: "none",
4142
+ viewBox: "0 0 24 24",
4143
+ strokeWidth: 1.5,
4144
+ stroke: "currentColor",
4145
+ className: "size-6"
4146
+ },
4147
+ /* @__PURE__ */ import_react3.default.createElement(
4148
+ "path",
4149
+ {
4150
+ strokeLinecap: "round",
4151
+ strokeLinejoin: "round",
4152
+ d: "m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5"
4153
+ }
4154
+ )
4155
+ );
3915
4156
  return /* @__PURE__ */ import_react3.default.createElement(
3916
4157
  "span",
3917
4158
  {
@@ -3933,43 +4174,7 @@ function ToggleButton({
3933
4174
  setShowInspector(!showInspector);
3934
4175
  }
3935
4176
  },
3936
- /* @__PURE__ */ import_react3.default.createElement("span", { style: { width: "12px", height: "12px" } }, showInspector === (anchor === "right") ? /* @__PURE__ */ import_react3.default.createElement(
3937
- "svg",
3938
- {
3939
- xmlns: "http://www.w3.org/2000/svg",
3940
- fill: "none",
3941
- viewBox: "0 0 24 24",
3942
- strokeWidth: 1.5,
3943
- stroke: "currentColor",
3944
- className: "size-6"
3945
- },
3946
- /* @__PURE__ */ import_react3.default.createElement(
3947
- "path",
3948
- {
3949
- strokeLinecap: "round",
3950
- strokeLinejoin: "round",
3951
- d: "m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5"
3952
- }
3953
- )
3954
- ) : /* @__PURE__ */ import_react3.default.createElement(
3955
- "svg",
3956
- {
3957
- xmlns: "http://www.w3.org/2000/svg",
3958
- fill: "none",
3959
- viewBox: "0 0 24 24",
3960
- strokeWidth: 1.5,
3961
- stroke: "currentColor",
3962
- className: "size-6"
3963
- },
3964
- /* @__PURE__ */ import_react3.default.createElement(
3965
- "path",
3966
- {
3967
- strokeLinecap: "round",
3968
- strokeLinejoin: "round",
3969
- d: "m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5"
3970
- }
3971
- )
3972
- ))
4177
+ showInspector ? "Hide Inspector" : /* @__PURE__ */ import_react3.default.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
3973
4178
  );
3974
4179
  }
3975
4180
  function DisclosureSection({
@@ -4547,7 +4752,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
4547
4752
  if (!name) return;
4548
4753
  const value = prompt("Enter secret value");
4549
4754
  if (!value) return;
4550
- secretManager.createSecret(name, value);
4755
+ secretManager.createSecret(null, name, value);
4551
4756
  }
4552
4757
  },
4553
4758
  "Create"
@@ -4557,7 +4762,7 @@ var StateInspector = (0, import_react_utils.memoGeneric)(function StateInspector
4557
4762
  SmallButton,
4558
4763
  {
4559
4764
  theme,
4560
- onClick: () => secretManager.deleteSecret(secret.name)
4765
+ onClick: () => secretManager.deleteSecret(secret.id)
4561
4766
  },
4562
4767
  "Delete"
4563
4768
  ))))
@@ -4940,10 +5145,9 @@ function useManagedHistory(stateManager) {
4940
5145
  stateManager.getHistorySnapshot
4941
5146
  );
4942
5147
  }
4943
- var defaultStubSync = (0, import_state_manager.stubSync)();
4944
5148
  function useMultiplayerState(initialState, options) {
4945
5149
  const {
4946
- sync = defaultStubSync,
5150
+ sync = (0, import_state_manager.stubSync)(),
4947
5151
  inspector,
4948
5152
  ...rest
4949
5153
  } = options ?? {};
@@ -5197,7 +5401,8 @@ function createNoyaContext({
5197
5401
  schema,
5198
5402
  mergeHistoryEntries,
5199
5403
  outputTransforms,
5200
- inputs
5404
+ inputs,
5405
+ safeEval
5201
5406
  }) {
5202
5407
  const NoyaStateContext = AnyNoyaStateContext;
5203
5408
  const EphemeralUserDataManagerContext = AnyEphemeralUserDataManagerContext;
@@ -5213,6 +5418,7 @@ function createNoyaContext({
5213
5418
  mergeHistoryEntries,
5214
5419
  outputTransforms,
5215
5420
  inputs,
5421
+ safeEval,
5216
5422
  ...options
5217
5423
  }
5218
5424
  );
@@ -5363,6 +5569,7 @@ function useCallableAITools() {
5363
5569
  }
5364
5570
 
5365
5571
  // src/components/UserPointersOverlay.tsx
5572
+ var import_observable2 = require("@noya-app/observable");
5366
5573
  var import_react_utils2 = require("@noya-app/react-utils");
5367
5574
  var import_react9 = __toESM(require("react"));
5368
5575
  function shouldShow(hideAfter, updatedAt) {
@@ -5374,12 +5581,14 @@ var UserPointerInternal = (0, import_react_utils2.memoGeneric)(function UserPoin
5374
5581
  hideAfter = 5e3,
5375
5582
  renderUserPointer
5376
5583
  }) {
5377
- const metadata = useObservable(ephemeralUserDataManager.metadata$, [
5378
- user.id
5379
- ]);
5380
- const data = useObservable(ephemeralUserDataManager.data$, [
5381
- user.id
5382
- ]);
5584
+ const observable = (0, import_react9.useMemo)(() => {
5585
+ const metadata$ = ephemeralUserDataManager.metadata$.observePath([user.id]).throttle(50);
5586
+ const data$ = ephemeralUserDataManager.data$.observePath([user.id]).throttle(50);
5587
+ return import_observable2.Observable.combine([metadata$, data$], ([metadata2, data2]) => {
5588
+ return { metadata: metadata2, data: data2 };
5589
+ });
5590
+ }, [ephemeralUserDataManager, user.id]);
5591
+ const { metadata, data } = useObservable(observable);
5383
5592
  const [, setForceUpdate] = (0, import_react9.useState)(0);
5384
5593
  const updatedAt = metadata?.updatedAt ?? 0;
5385
5594
  const show = shouldShow(hideAfter, updatedAt);