@noya-app/noya-multiplayer-react 0.1.63 → 0.1.65

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.mjs CHANGED
@@ -42,10 +42,10 @@ var require_access = __commonJS({
42
42
  const accessed = _getPath(node, indexPath, options);
43
43
  return accessed[accessed.length - 1];
44
44
  }
45
- let path = indexPath.slice();
46
- while (path.length > 0) {
47
- let index = path.shift();
48
- const children = options.getChildren(node, path);
45
+ let path2 = indexPath.slice();
46
+ while (path2.length > 0) {
47
+ let index = path2.shift();
48
+ const children = options.getChildren(node, path2);
49
49
  const child = children[index];
50
50
  if (!child) {
51
51
  return void 0;
@@ -58,12 +58,12 @@ var require_access = __commonJS({
58
58
  return _getPath(node, indexPath, options).slice(0, -1);
59
59
  }
60
60
  function _getPath(node, indexPath, options) {
61
- let path = indexPath.slice();
61
+ let path2 = indexPath.slice();
62
62
  let result = [node];
63
- while (path.length > 0) {
64
- let index = path.shift();
63
+ while (path2.length > 0) {
64
+ let index = path2.shift();
65
65
  const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
66
- const children = options.getChildren(node, path, context);
66
+ const children = options.getChildren(node, path2, context);
67
67
  const child = children[index];
68
68
  if (!child) {
69
69
  return result;
@@ -78,20 +78,20 @@ var require_access = __commonJS({
78
78
  const accessed = accessPath(node, indexPath, options);
79
79
  return accessed[accessed.length - 1];
80
80
  }
81
- let path = indexPath.slice();
82
- while (path.length > 0) {
83
- let index = path.shift();
84
- node = options.getChildren(node, path)[index];
81
+ let path2 = indexPath.slice();
82
+ while (path2.length > 0) {
83
+ let index = path2.shift();
84
+ node = options.getChildren(node, path2)[index];
85
85
  }
86
86
  return node;
87
87
  }
88
88
  function accessPath(node, indexPath, options) {
89
- let path = indexPath.slice();
89
+ let path2 = indexPath.slice();
90
90
  let result = [node];
91
- while (path.length > 0) {
92
- let index = path.shift();
91
+ while (path2.length > 0) {
92
+ let index = path2.shift();
93
93
  const context = options.includeTraversalContext ? makeTraversalContext(result) : void 0;
94
- node = options.getChildren(node, path, context)[index];
94
+ node = options.getChildren(node, path2, context)[index];
95
95
  result.push(node);
96
96
  }
97
97
  return result;
@@ -605,40 +605,40 @@ var require_transformPath = __commonJS({
605
605
  Object.defineProperty(exports, "__esModule", { value: true });
606
606
  exports.transformPath = transformPath;
607
607
  var sort_1 = require_sort();
608
- function commonAncestor(path, otherPath) {
609
- const length = Math.min(path.length, otherPath.length);
608
+ function commonAncestor(path2, otherPath) {
609
+ const length = Math.min(path2.length, otherPath.length);
610
610
  for (let i = 0; i < length; i++) {
611
- if (path[i] !== otherPath[i]) {
612
- return path.slice(0, i);
611
+ if (path2[i] !== otherPath[i]) {
612
+ return path2.slice(0, i);
613
613
  }
614
614
  }
615
- return path.slice(0, length);
615
+ return path2.slice(0, length);
616
616
  }
617
- function transformPath(path, operation, otherPath, count = 1) {
618
- if (otherPath.length > path.length || (0, sort_1.comparePathsByComponent)(otherPath, path) > 0) {
619
- return path;
617
+ function transformPath(path2, operation, otherPath, count = 1) {
618
+ if (otherPath.length > path2.length || (0, sort_1.comparePathsByComponent)(otherPath, path2) > 0) {
619
+ return path2;
620
620
  }
621
621
  if (otherPath.length === 0 && operation === "remove") {
622
622
  return void 0;
623
623
  }
624
- const common = commonAncestor(path, otherPath);
625
- const adjustmentIndex = common.length === path.length || common.length === otherPath.length ? common.length - 1 : common.length;
626
- const pathValue = path[adjustmentIndex];
624
+ const common = commonAncestor(path2, otherPath);
625
+ const adjustmentIndex = common.length === path2.length || common.length === otherPath.length ? common.length - 1 : common.length;
626
+ const pathValue = path2[adjustmentIndex];
627
627
  const otherPathValue = otherPath[adjustmentIndex];
628
628
  if (operation === "insert" && otherPathValue <= pathValue) {
629
- const newPath = [...path];
629
+ const newPath = [...path2];
630
630
  newPath[adjustmentIndex] += count;
631
631
  return newPath;
632
632
  } else if (operation === "remove") {
633
633
  if (otherPathValue === pathValue) {
634
634
  return void 0;
635
635
  } else if (otherPathValue < pathValue) {
636
- const newPath = [...path];
636
+ const newPath = [...path2];
637
637
  newPath[adjustmentIndex] -= count;
638
638
  return newPath;
639
639
  }
640
640
  }
641
- return path;
641
+ return path2;
642
642
  }
643
643
  }
644
644
  });
@@ -804,15 +804,15 @@ var require_operation = __commonJS({
804
804
  switch (operation.type) {
805
805
  case "insert": {
806
806
  const otherPath = parentPath.concat(operation.index);
807
- return transformedPaths.map((path) => path ? (0, transformPath_1.transformPath)(path, "insert", otherPath, operation.nodes.length) : void 0);
807
+ return transformedPaths.map((path2) => path2 ? (0, transformPath_1.transformPath)(path2, "insert", otherPath, operation.nodes.length) : void 0);
808
808
  }
809
809
  case "remove": {
810
810
  const otherPaths = [...operation.indexes].reverse().map((index) => parentPath.concat(index));
811
- return transformedPaths.map((path) => {
811
+ return transformedPaths.map((path2) => {
812
812
  for (const otherPath of otherPaths) {
813
- path = path ? (0, transformPath_1.transformPath)(path, "remove", otherPath) : void 0;
813
+ path2 = path2 ? (0, transformPath_1.transformPath)(path2, "remove", otherPath) : void 0;
814
814
  }
815
- return path;
815
+ return path2;
816
816
  });
817
817
  }
818
818
  case "removeThenInsert": {
@@ -949,22 +949,22 @@ var require_splice = __commonJS({
949
949
  return _spliceWithPathTracking(node, options);
950
950
  }
951
951
  function _spliceWithPathTracking(node, options) {
952
- const { path, deleteCount = 0, nodes, track } = options;
953
- if (path.length === 0) {
952
+ const { path: path2, deleteCount = 0, nodes, track } = options;
953
+ if (path2.length === 0) {
954
954
  throw new Error(`Can't splice at the root`);
955
955
  }
956
- const pathsToRemove = getPathsToRemove(path, deleteCount);
957
- const operations = (0, operation_1.getInsertionOperations)(path, nodes, (0, operation_1.getRemovalOperations)(pathsToRemove));
956
+ const pathsToRemove = getPathsToRemove(path2, deleteCount);
957
+ const operations = (0, operation_1.getInsertionOperations)(path2, nodes, (0, operation_1.getRemovalOperations)(pathsToRemove));
958
958
  const transformedPaths = track ? (0, operation_1.transformPathsByOperations)(track, operations) : [];
959
959
  return {
960
960
  node: (0, operation_1.applyOperations)(node, operations, options),
961
961
  paths: transformedPaths
962
962
  };
963
963
  }
964
- function getPathsToRemove(path, deleteCount) {
964
+ function getPathsToRemove(path2, deleteCount) {
965
965
  let pathsToRemove = [];
966
- let parentPath = path.slice(0, -1);
967
- let index = path[path.length - 1];
966
+ let parentPath = path2.slice(0, -1);
967
+ let index = path2[path2.length - 1];
968
968
  for (let i = 0; i < deleteCount; i++) {
969
969
  pathsToRemove.push(parentPath.concat(index + i));
970
970
  }
@@ -978,7 +978,7 @@ var require_defineTree = __commonJS({
978
978
  "../../node_modules/tree-visit/lib/defineTree.js"(exports) {
979
979
  "use strict";
980
980
  Object.defineProperty(exports, "__esModule", { value: true });
981
- exports.defineTree = defineTree2;
981
+ exports.defineTree = defineTree3;
982
982
  var access_1 = require_access();
983
983
  var diagram_1 = require_diagram();
984
984
  var entries_1 = require_entries();
@@ -1027,7 +1027,7 @@ var require_defineTree = __commonJS({
1027
1027
  this._getChildren = this.baseOptions.getChildren;
1028
1028
  }
1029
1029
  };
1030
- function defineTree2(getChildren) {
1030
+ function defineTree3(getChildren) {
1031
1031
  return new Tree(getChildren, {});
1032
1032
  }
1033
1033
  }
@@ -1104,25 +1104,397 @@ var require_lib = __commonJS({
1104
1104
  }
1105
1105
  });
1106
1106
 
1107
+ // ../../node_modules/imfs/lib/types.js
1108
+ var require_types = __commonJS({
1109
+ "../../node_modules/imfs/lib/types.js"(exports) {
1110
+ "use strict";
1111
+ Object.defineProperty(exports, "__esModule", { value: true });
1112
+ }
1113
+ });
1114
+
1115
+ // ../../node_modules/imfs/lib/node.js
1116
+ var require_node = __commonJS({
1117
+ "../../node_modules/imfs/lib/node.js"(exports) {
1118
+ "use strict";
1119
+ Object.defineProperty(exports, "__esModule", { value: true });
1120
+ exports.Nodes = void 0;
1121
+ function createFile(data, metadata) {
1122
+ return { type: "file", data, metadata };
1123
+ }
1124
+ function createDirectory(children = {}, metadata) {
1125
+ return { type: "directory", children, metadata };
1126
+ }
1127
+ function isFile(node) {
1128
+ return node.type === "file";
1129
+ }
1130
+ function isDirectory(node) {
1131
+ return node.type === "directory";
1132
+ }
1133
+ function getMetadata(node) {
1134
+ return node.metadata;
1135
+ }
1136
+ function readDirectory(directory) {
1137
+ return Object.keys(directory.children);
1138
+ }
1139
+ function getChild(directory, name) {
1140
+ return directory.children[name];
1141
+ }
1142
+ function hasChild(directory, name) {
1143
+ return name in directory.children;
1144
+ }
1145
+ exports.Nodes = {
1146
+ createDirectory,
1147
+ createFile,
1148
+ getChild,
1149
+ getMetadata,
1150
+ hasChild,
1151
+ isDirectory,
1152
+ isFile,
1153
+ readDirectory
1154
+ };
1155
+ }
1156
+ });
1157
+
1158
+ // ../../node_modules/imfs/lib/path.js
1159
+ var require_path = __commonJS({
1160
+ "../../node_modules/imfs/lib/path.js"(exports) {
1161
+ "use strict";
1162
+ Object.defineProperty(exports, "__esModule", { value: true });
1163
+ exports.dirname = exports.basename = exports.extname = exports.join = exports.normalize = exports.sep = void 0;
1164
+ exports.sep = "/";
1165
+ function preserveLeadingAndTrailingSlash(original, updated) {
1166
+ if (original.startsWith("/")) {
1167
+ updated = "/" + updated;
1168
+ }
1169
+ if (updated[updated.length - 1] !== "/" && original.endsWith("/")) {
1170
+ updated = updated + "/";
1171
+ }
1172
+ return updated;
1173
+ }
1174
+ function normalize(filename) {
1175
+ const components = filename.split(exports.sep).filter((component) => !!component);
1176
+ let i = 0;
1177
+ let length = components.length - 1;
1178
+ while (i < length) {
1179
+ if (components[i] === ".") {
1180
+ components.splice(i, 1);
1181
+ length--;
1182
+ } else if (components[i] === ".." && i !== 0) {
1183
+ components.splice(i - 1, 2);
1184
+ length -= 2;
1185
+ i -= 1;
1186
+ } else if (components[i] === "" && components[i + 1] === "") {
1187
+ components.splice(i, 1);
1188
+ length--;
1189
+ } else {
1190
+ i++;
1191
+ }
1192
+ }
1193
+ return preserveLeadingAndTrailingSlash(filename, components.join(exports.sep));
1194
+ }
1195
+ exports.normalize = normalize;
1196
+ function join(...components) {
1197
+ let result = normalize(components.join(exports.sep));
1198
+ if (result === "") {
1199
+ result = ".";
1200
+ }
1201
+ return result;
1202
+ }
1203
+ exports.join = join;
1204
+ function extname(filename) {
1205
+ const index = filename.lastIndexOf(".");
1206
+ return index !== -1 ? filename.slice(index) : filename;
1207
+ }
1208
+ exports.extname = extname;
1209
+ function basename(filename, extname2) {
1210
+ if (extname2 && filename.endsWith(extname2)) {
1211
+ filename = filename.slice(0, -extname2.length);
1212
+ }
1213
+ let sepIndex = filename.lastIndexOf(exports.sep);
1214
+ if (sepIndex === filename.length - 1) {
1215
+ filename = filename.slice(0, -1);
1216
+ return filename.length > 1 ? basename(filename) : filename;
1217
+ }
1218
+ return filename.slice(sepIndex + 1);
1219
+ }
1220
+ exports.basename = basename;
1221
+ function dirname(filename) {
1222
+ let base = basename(filename);
1223
+ let result = filename.slice(0, -(base.length + 1));
1224
+ if (result === "") {
1225
+ if (filename.startsWith(exports.sep)) {
1226
+ result = exports.sep;
1227
+ } else {
1228
+ result = ".";
1229
+ }
1230
+ }
1231
+ return result;
1232
+ }
1233
+ exports.dirname = dirname;
1234
+ }
1235
+ });
1236
+
1237
+ // ../../node_modules/imfs/lib/entries.js
1238
+ var require_entries2 = __commonJS({
1239
+ "../../node_modules/imfs/lib/entries.js"(exports) {
1240
+ "use strict";
1241
+ Object.defineProperty(exports, "__esModule", { value: true });
1242
+ exports.Entries = void 0;
1243
+ var node_1 = require_node();
1244
+ var path_1 = require_path();
1245
+ function getEntries(entry) {
1246
+ const [pathname, node] = entry;
1247
+ return node_1.Nodes.isDirectory(node) ? Object.entries(node.children).map(([key, value]) => [
1248
+ (0, path_1.join)(pathname, key),
1249
+ value
1250
+ ]) : [];
1251
+ }
1252
+ function createEntry(pathname, node) {
1253
+ return [pathname, node];
1254
+ }
1255
+ exports.Entries = {
1256
+ createEntry,
1257
+ getEntries
1258
+ };
1259
+ }
1260
+ });
1261
+
1262
+ // ../../node_modules/imfs/lib/volume/paths.js
1263
+ var require_paths = __commonJS({
1264
+ "../../node_modules/imfs/lib/volume/paths.js"(exports) {
1265
+ "use strict";
1266
+ Object.defineProperty(exports, "__esModule", { value: true });
1267
+ exports.getNewAndParentName = exports.normalizePathLikeInternal = exports.getPathComponents = void 0;
1268
+ var path_1 = require_path();
1269
+ function getPathComponents(filepath) {
1270
+ return getPathComponentsNormalized((0, path_1.normalize)(filepath));
1271
+ function getPathComponentsNormalized(filepath2) {
1272
+ if (filepath2.startsWith("..")) {
1273
+ throw new Error(`Invalid path ${filepath2}, can't go up past root.`);
1274
+ }
1275
+ if (filepath2.startsWith(".") || filepath2.startsWith("/")) {
1276
+ return getPathComponentsNormalized(filepath2.slice(1));
1277
+ }
1278
+ if (filepath2 === "")
1279
+ return [];
1280
+ return filepath2.split(path_1.sep).filter((component) => !!component);
1281
+ }
1282
+ }
1283
+ exports.getPathComponents = getPathComponents;
1284
+ function normalizePathLikeInternal(pathlike) {
1285
+ return typeof pathlike === "string" ? getPathComponents(pathlike) : pathlike;
1286
+ }
1287
+ exports.normalizePathLikeInternal = normalizePathLikeInternal;
1288
+ function getNewAndParentName(pathlike) {
1289
+ const parentName = typeof pathlike === "string" ? (0, path_1.dirname)(pathlike) : pathlike.slice(0, -1);
1290
+ const newName = typeof pathlike === "string" ? (0, path_1.basename)(pathlike) : pathlike[pathlike.length - 1];
1291
+ return { parentName, newName };
1292
+ }
1293
+ exports.getNewAndParentName = getNewAndParentName;
1294
+ }
1295
+ });
1296
+
1297
+ // ../../node_modules/imfs/lib/volume/read.js
1298
+ var require_read = __commonJS({
1299
+ "../../node_modules/imfs/lib/volume/read.js"(exports) {
1300
+ "use strict";
1301
+ Object.defineProperty(exports, "__esModule", { value: true });
1302
+ exports.getMetadata = exports.readDirectory = exports.readFile = exports.getNode = exports.getNodeInternal = void 0;
1303
+ var node_1 = require_node();
1304
+ var path_1 = require_path();
1305
+ var paths_1 = require_paths();
1306
+ function getNodeInternal(root, pathlike, options) {
1307
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1308
+ let i = 0;
1309
+ let current = root;
1310
+ while (i < components.length) {
1311
+ let component = components[i];
1312
+ if (current.type !== "directory") {
1313
+ throw new Error(`File ${(0, path_1.join)(...components.slice(0, i))} is not a directory`);
1314
+ }
1315
+ let node = node_1.Nodes.getChild(current, component);
1316
+ if (!node) {
1317
+ if (options.makeIntermediateDirectoryMetadata) {
1318
+ const child = node_1.Nodes.createDirectory({}, options.makeIntermediateDirectoryMetadata((0, path_1.join)(...components.slice(0, i + 1))));
1319
+ current.children[component] = child;
1320
+ node = child;
1321
+ } else if (options.makeIntermediateDirectories) {
1322
+ const child = node_1.Nodes.createDirectory();
1323
+ current.children[component] = child;
1324
+ node = child;
1325
+ } else {
1326
+ throw new Error(`File ${(0, path_1.join)(...components.slice(0, i + 1))} not found`);
1327
+ }
1328
+ }
1329
+ current = node;
1330
+ i++;
1331
+ }
1332
+ return current;
1333
+ }
1334
+ exports.getNodeInternal = getNodeInternal;
1335
+ function getNode(root, pathlike) {
1336
+ return getNodeInternal(root, pathlike, {});
1337
+ }
1338
+ exports.getNode = getNode;
1339
+ function readFile(root, pathlike) {
1340
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1341
+ const node = getNode(root, components);
1342
+ if (!node_1.Nodes.isFile(node)) {
1343
+ throw new Error(`Can't read, ${(0, path_1.join)(...components)} not a file`);
1344
+ }
1345
+ return node.data;
1346
+ }
1347
+ exports.readFile = readFile;
1348
+ function readDirectory(root, pathlike) {
1349
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1350
+ const node = getNode(root, components);
1351
+ if (!node_1.Nodes.isDirectory(node)) {
1352
+ throw new Error(`Can't read, ${(0, path_1.join)(...components)} not a directory`);
1353
+ }
1354
+ return node_1.Nodes.readDirectory(node);
1355
+ }
1356
+ exports.readDirectory = readDirectory;
1357
+ function getMetadata(root, pathlike) {
1358
+ const components = (0, paths_1.normalizePathLikeInternal)(pathlike);
1359
+ const node = getNode(root, components);
1360
+ return node.metadata;
1361
+ }
1362
+ exports.getMetadata = getMetadata;
1363
+ }
1364
+ });
1365
+
1366
+ // ../../node_modules/imfs/lib/volume/write.js
1367
+ var require_write = __commonJS({
1368
+ "../../node_modules/imfs/lib/volume/write.js"(exports) {
1369
+ "use strict";
1370
+ Object.defineProperty(exports, "__esModule", { value: true });
1371
+ exports.create = exports.setMetadata = exports.removeFile = exports.makeDirectory = exports.writeFile = exports.setNode = void 0;
1372
+ var node_1 = require_node();
1373
+ var paths_1 = require_paths();
1374
+ var read_1 = require_read();
1375
+ function setNode(root, pathlike, node, options) {
1376
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1377
+ const parent = (0, read_1.getNodeInternal)(root, parentName, options !== null && options !== void 0 ? options : {});
1378
+ if (!node_1.Nodes.isDirectory(parent)) {
1379
+ throw new Error(`Can't create ${newName}, ${parentName} not a directory`);
1380
+ }
1381
+ parent.children[newName] = node;
1382
+ }
1383
+ exports.setNode = setNode;
1384
+ function writeFile(root, pathlike, data, options) {
1385
+ var _a;
1386
+ setNode(root, pathlike, node_1.Nodes.createFile(data, (_a = options) === null || _a === void 0 ? void 0 : _a.metadata), options);
1387
+ }
1388
+ exports.writeFile = writeFile;
1389
+ function makeDirectory(root, pathlike, options) {
1390
+ var _a;
1391
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1392
+ const parent = (0, read_1.getNodeInternal)(root, parentName, options !== null && options !== void 0 ? options : {});
1393
+ if (!node_1.Nodes.isDirectory(parent)) {
1394
+ throw new Error(`Can't create ${newName}, ${parentName} not a directory`);
1395
+ }
1396
+ const existing = node_1.Nodes.getChild(parent, newName);
1397
+ if (existing && node_1.Nodes.isDirectory(parent.children[newName])) {
1398
+ return;
1399
+ }
1400
+ parent.children[newName] = node_1.Nodes.createDirectory({}, (_a = options) === null || _a === void 0 ? void 0 : _a.metadata);
1401
+ }
1402
+ exports.makeDirectory = makeDirectory;
1403
+ function removeFile(root, pathlike) {
1404
+ const { parentName, newName } = (0, paths_1.getNewAndParentName)(pathlike);
1405
+ const parent = (0, read_1.getNode)(root, parentName);
1406
+ if (!node_1.Nodes.isDirectory(parent)) {
1407
+ throw new Error(`Can't remove file ${newName}, ${parentName} not a directory`);
1408
+ }
1409
+ delete parent.children[newName];
1410
+ }
1411
+ exports.removeFile = removeFile;
1412
+ function setMetadata(root, pathlike, metadata) {
1413
+ const node = (0, read_1.getNode)(root, pathlike);
1414
+ node.metadata = metadata;
1415
+ }
1416
+ exports.setMetadata = setMetadata;
1417
+ function create(options) {
1418
+ return node_1.Nodes.createDirectory({}, options && "metadata" in options ? options.metadata : void 0);
1419
+ }
1420
+ exports.create = create;
1421
+ }
1422
+ });
1423
+
1424
+ // ../../node_modules/imfs/lib/volume.js
1425
+ var require_volume = __commonJS({
1426
+ "../../node_modules/imfs/lib/volume.js"(exports) {
1427
+ "use strict";
1428
+ Object.defineProperty(exports, "__esModule", { value: true });
1429
+ exports.Volume = void 0;
1430
+ var paths_1 = require_paths();
1431
+ var read_1 = require_read();
1432
+ var write_1 = require_write();
1433
+ exports.Volume = {
1434
+ // paths
1435
+ getPathComponents: paths_1.getPathComponents,
1436
+ // read
1437
+ getMetadata: read_1.getMetadata,
1438
+ getNode: read_1.getNode,
1439
+ readDirectory: read_1.readDirectory,
1440
+ readFile: read_1.readFile,
1441
+ // write
1442
+ create: write_1.create,
1443
+ makeDirectory: write_1.makeDirectory,
1444
+ removeFile: write_1.removeFile,
1445
+ setMetadata: write_1.setMetadata,
1446
+ setNode: write_1.setNode,
1447
+ writeFile: write_1.writeFile
1448
+ };
1449
+ }
1450
+ });
1451
+
1452
+ // ../../node_modules/imfs/lib/index.js
1453
+ var require_lib2 = __commonJS({
1454
+ "../../node_modules/imfs/lib/index.js"(exports) {
1455
+ "use strict";
1456
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1457
+ if (k2 === void 0) k2 = k;
1458
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
1459
+ return m[k];
1460
+ } });
1461
+ } : function(o, m, k, k2) {
1462
+ if (k2 === void 0) k2 = k;
1463
+ o[k2] = m[k];
1464
+ });
1465
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1466
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1467
+ } : function(o, v) {
1468
+ o["default"] = v;
1469
+ });
1470
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
1471
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
1472
+ };
1473
+ var __importStar = exports && exports.__importStar || function(mod) {
1474
+ if (mod && mod.__esModule) return mod;
1475
+ var result = {};
1476
+ if (mod != null) {
1477
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1478
+ }
1479
+ __setModuleDefault(result, mod);
1480
+ return result;
1481
+ };
1482
+ Object.defineProperty(exports, "__esModule", { value: true });
1483
+ exports.path = void 0;
1484
+ __exportStar(require_types(), exports);
1485
+ __exportStar(require_node(), exports);
1486
+ __exportStar(require_entries2(), exports);
1487
+ __exportStar(require_volume(), exports);
1488
+ exports.path = __importStar(require_path());
1489
+ }
1490
+ });
1491
+
1107
1492
  // src/index.ts
1108
1493
  export * from "@noya-app/state-manager";
1109
1494
 
1110
1495
  // src/ai.ts
1111
1496
  import { useEffect as useEffect5 } from "react";
1112
1497
 
1113
- // src/NoyaStateContext.tsx
1114
- import {
1115
- Observable
1116
- } from "@noya-app/observable";
1117
- import { useStableCallback } from "@noya-app/react-utils";
1118
- import React14, {
1119
- createContext,
1120
- useCallback as useCallback3,
1121
- useContext,
1122
- useEffect as useEffect4,
1123
- useMemo as useMemo4
1124
- } from "react";
1125
-
1126
1498
  // ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
1127
1499
  var TransformKind = Symbol.for("TypeBox.Transform");
1128
1500
  var ReadonlyKind = Symbol.for("TypeBox.Readonly");
@@ -1678,14 +2050,14 @@ function Number2(options = {}) {
1678
2050
  }
1679
2051
 
1680
2052
  // ../../node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
1681
- function String(options = {}) {
2053
+ function String2(options = {}) {
1682
2054
  return { ...options, [Kind]: "String", type: "string" };
1683
2055
  }
1684
2056
 
1685
2057
  // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
1686
2058
  function* FromUnion(syntax) {
1687
2059
  const trim = syntax.trim().replace(/"|'/g, "");
1688
- return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String() : yield (() => {
2060
+ return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String2() : yield (() => {
1689
2061
  const literals = trim.split("|").map((literal) => Literal(literal.trim()));
1690
2062
  return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
1691
2063
  })();
@@ -2774,7 +3146,7 @@ function FromPromise3(left, right) {
2774
3146
  return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
2775
3147
  }
2776
3148
  function RecordKey(schema) {
2777
- return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String() : Throw("Unknown record key pattern");
3149
+ return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String2() : Throw("Unknown record key pattern");
2778
3150
  }
2779
3151
  function RecordValue(schema) {
2780
3152
  return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
@@ -2794,8 +3166,8 @@ function FromRecord(left, right) {
2794
3166
  return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
2795
3167
  }
2796
3168
  function FromRegExp(left, right) {
2797
- const L = type_exports.IsRegExp(left) ? String() : left;
2798
- const R = type_exports.IsRegExp(right) ? String() : right;
3169
+ const L = type_exports.IsRegExp(left) ? String2() : left;
3170
+ const R = type_exports.IsRegExp(right) ? String2() : right;
2799
3171
  return Visit3(L, R);
2800
3172
  }
2801
3173
  function FromStringRight(left, right) {
@@ -3431,30 +3803,30 @@ var TransformDecodeBuilder = class {
3431
3803
  constructor(schema) {
3432
3804
  this.schema = schema;
3433
3805
  }
3434
- Decode(decode) {
3435
- return new TransformEncodeBuilder(this.schema, decode);
3806
+ Decode(decode2) {
3807
+ return new TransformEncodeBuilder(this.schema, decode2);
3436
3808
  }
3437
3809
  };
3438
3810
  var TransformEncodeBuilder = class {
3439
3811
  schema;
3440
3812
  decode;
3441
- constructor(schema, decode) {
3813
+ constructor(schema, decode2) {
3442
3814
  this.schema = schema;
3443
- this.decode = decode;
3815
+ this.decode = decode2;
3444
3816
  }
3445
- EncodeTransform(encode, schema) {
3446
- const Encode = (value) => schema[TransformKind].Encode(encode(value));
3817
+ EncodeTransform(encode2, schema) {
3818
+ const Encode = (value) => schema[TransformKind].Encode(encode2(value));
3447
3819
  const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
3448
3820
  const Codec = { Encode, Decode };
3449
3821
  return { ...schema, [TransformKind]: Codec };
3450
3822
  }
3451
- EncodeSchema(encode, schema) {
3452
- const Codec = { Decode: this.decode, Encode: encode };
3823
+ EncodeSchema(encode2, schema) {
3824
+ const Codec = { Decode: this.decode, Encode: encode2 };
3453
3825
  return { ...schema, [TransformKind]: Codec };
3454
3826
  }
3455
- Encode(encode) {
3827
+ Encode(encode2) {
3456
3828
  const schema = CloneType(this.schema);
3457
- return IsTransform(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema);
3829
+ return IsTransform(schema) ? this.EncodeTransform(encode2, schema) : this.EncodeSchema(encode2, schema);
3458
3830
  }
3459
3831
  };
3460
3832
  function Transform(schema) {
@@ -3520,7 +3892,7 @@ __export(type_exports3, {
3520
3892
  Rest: () => Rest,
3521
3893
  ReturnType: () => ReturnType,
3522
3894
  Strict: () => Strict,
3523
- String: () => String,
3895
+ String: () => String2,
3524
3896
  Symbol: () => Symbol2,
3525
3897
  TemplateLiteral: () => TemplateLiteral,
3526
3898
  Transform: () => Transform,
@@ -3547,13 +3919,76 @@ function Void(options = {}) {
3547
3919
  // ../../node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
3548
3920
  var Type = type_exports3;
3549
3921
 
3922
+ // ../noya-schemas/src/nullable.ts
3923
+ var Nullable = (schema) => Type.Union([Type.Null(), schema]);
3924
+
3925
+ // ../noya-schemas/src/activityEventSchema.ts
3926
+ var userSelectSchema = Type.Object({
3927
+ id: Type.String(),
3928
+ name: Nullable(Type.String()),
3929
+ email: Nullable(Type.String()),
3930
+ image: Nullable(Type.String())
3931
+ });
3932
+ var workspaceSelectSchema = Type.Object({
3933
+ id: Type.String(),
3934
+ name: Type.String()
3935
+ });
3936
+ var fileSelectSchema = Type.Object({
3937
+ id: Type.String(),
3938
+ name: Nullable(Type.String())
3939
+ });
3940
+ var resourceSelectSchema = Type.Object({
3941
+ id: Type.String(),
3942
+ path: Type.String(),
3943
+ type: Type.Union([
3944
+ Type.Literal("asset"),
3945
+ Type.Literal("file"),
3946
+ Type.Literal("fileVersion"),
3947
+ Type.Literal("directory"),
3948
+ Type.Literal("resource")
3949
+ ])
3950
+ });
3951
+ var siteSelectSchema = Type.Object({
3952
+ id: Type.String(),
3953
+ subdomain: Nullable(Type.String())
3954
+ });
3955
+ var activityEventSchema = Type.Object({
3956
+ id: Type.String(),
3957
+ createdAt: Type.String(),
3958
+ actorId: Nullable(Type.String()),
3959
+ actor: Type.Optional(userSelectSchema),
3960
+ type: Type.Union([
3961
+ Type.Literal("file"),
3962
+ Type.Literal("resource"),
3963
+ Type.Literal("site"),
3964
+ Type.Literal("snapshot"),
3965
+ Type.Literal("restore")
3966
+ ]),
3967
+ workspaceId: Nullable(Type.String()),
3968
+ workspace: Type.Optional(workspaceSelectSchema),
3969
+ fileId: Nullable(Type.String()),
3970
+ file: Type.Optional(fileSelectSchema),
3971
+ fileVersionId: Nullable(Type.String()),
3972
+ resourceId: Nullable(Type.String()),
3973
+ resource: Type.Optional(resourceSelectSchema),
3974
+ siteId: Nullable(Type.String()),
3975
+ site: Type.Optional(siteSelectSchema),
3976
+ previousData: Nullable(Type.Any()),
3977
+ currentData: Nullable(Type.Any()),
3978
+ metadata: Nullable(Type.Any()),
3979
+ userAgent: Nullable(Type.String())
3980
+ });
3981
+
3550
3982
  // ../noya-schemas/src/asset.ts
3551
3983
  var assetSchema = Type.Object({
3552
3984
  id: Type.String(),
3553
3985
  url: Type.String(),
3554
3986
  createdAt: Type.String(),
3555
3987
  size: Type.Number(),
3556
- contentType: Type.Optional(Type.String())
3988
+ contentType: Type.Optional(Type.String()),
3989
+ width: Type.Union([Type.Null(), Type.Number()]),
3990
+ height: Type.Union([Type.Null(), Type.Number()]),
3991
+ userId: Type.Union([Type.Null(), Type.String()])
3557
3992
  });
3558
3993
 
3559
3994
  // ../noya-schemas/src/encode.ts
@@ -3707,25 +4142,25 @@ var jsonSchema = Type.Recursive(
3707
4142
  );
3708
4143
 
3709
4144
  // ../noya-schemas/src/input.ts
3710
- function Nullable(type) {
4145
+ function Nullable2(type) {
3711
4146
  return Type.Union([type, Type.Null()], { default: null });
3712
4147
  }
3713
4148
  var inputSchemaBase = {
3714
4149
  id: Type.String({ format: "uuid", default: "" }),
3715
4150
  stableId: Type.String({ format: "uuid", default: "" }),
3716
4151
  name: Type.String(),
3717
- description: Nullable(Type.String()),
4152
+ description: Nullable2(Type.String()),
3718
4153
  required: Type.Boolean({ default: false })
3719
4154
  };
3720
4155
  var fileInputSchema = Type.Object({
3721
4156
  ...inputSchemaBase,
3722
4157
  kind: Type.Literal("file"),
3723
- toolId: Nullable(Type.String())
4158
+ toolId: Nullable2(Type.String())
3724
4159
  });
3725
4160
  var dataInputSchema = Type.Object({
3726
4161
  ...inputSchemaBase,
3727
4162
  kind: Type.Literal("data"),
3728
- schema: Nullable(jsonSchema)
4163
+ schema: Nullable2(jsonSchema)
3729
4164
  });
3730
4165
  var secretInputSchema = Type.Object({
3731
4166
  ...inputSchemaBase,
@@ -3735,7 +4170,7 @@ var secretInputSchema = Type.Object({
3735
4170
  default: null
3736
4171
  })
3737
4172
  ),
3738
- authScope: Type.Optional(Nullable(Type.String()))
4173
+ authScope: Type.Optional(Nullable2(Type.String()))
3739
4174
  });
3740
4175
  var inputSchema = Type.Union(
3741
4176
  [fileInputSchema, dataInputSchema, secretInputSchema],
@@ -3932,17 +4367,17 @@ var ValueErrorType;
3932
4367
  // ../../node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
3933
4368
  var Insert = Object2({
3934
4369
  type: Literal("insert"),
3935
- path: String(),
4370
+ path: String2(),
3936
4371
  value: Unknown()
3937
4372
  });
3938
4373
  var Update = Object2({
3939
4374
  type: Literal("update"),
3940
- path: String(),
4375
+ path: String2(),
3941
4376
  value: Unknown()
3942
4377
  });
3943
4378
  var Delete3 = Object2({
3944
4379
  type: Literal("delete"),
3945
- path: String()
4380
+ path: String2()
3946
4381
  });
3947
4382
  var Edit = Union([Insert, Update, Delete3]);
3948
4383
 
@@ -3969,6 +4404,142 @@ function findAllDefs(schema) {
3969
4404
  });
3970
4405
  }
3971
4406
 
4407
+ // ../noya-schemas/src/resourceSchema.ts
4408
+ var baseSchemaProperties = {
4409
+ id: Type.String(),
4410
+ stableId: Type.String(),
4411
+ path: Type.String(),
4412
+ createdAt: Type.String(),
4413
+ updatedAt: Type.String(),
4414
+ accessibleByFileId: Nullable(Type.String()),
4415
+ accessibleByFile: Type.Optional(
4416
+ Type.Object({
4417
+ id: Type.String(),
4418
+ name: Type.String(),
4419
+ toolId: Type.String()
4420
+ })
4421
+ ),
4422
+ accessibleByFileVersionId: Nullable(Type.String()),
4423
+ url: Type.Optional(Type.String())
4424
+ };
4425
+ var uploadableAssetSchema = Type.Object({
4426
+ content: Type.String(),
4427
+ contentType: Type.String(),
4428
+ encoding: Type.Union([Type.Literal("utf-8"), Type.Literal("base64")])
4429
+ });
4430
+ var assetResourceSchema = Type.Object({
4431
+ ...baseSchemaProperties,
4432
+ type: Type.Literal("asset"),
4433
+ assetId: Type.String()
4434
+ });
4435
+ var assetResourceCreateSchema = Type.Object({
4436
+ ...baseSchemaProperties,
4437
+ type: Type.Literal("asset"),
4438
+ assetId: Type.Optional(Type.String()),
4439
+ asset: Type.Optional(uploadableAssetSchema)
4440
+ });
4441
+ var fileResourceSchema = Type.Object({
4442
+ ...baseSchemaProperties,
4443
+ type: Type.Literal("file"),
4444
+ fileId: Type.String()
4445
+ });
4446
+ var directoryResourceSchema = Type.Object({
4447
+ ...baseSchemaProperties,
4448
+ type: Type.Literal("directory")
4449
+ });
4450
+ var nestedResourceSchema = Type.Object({
4451
+ ...baseSchemaProperties,
4452
+ type: Type.Literal("resource"),
4453
+ fileId: Type.String(),
4454
+ resourceId: Type.String()
4455
+ });
4456
+ var resourceSchema = Type.Union(
4457
+ [
4458
+ assetResourceSchema,
4459
+ fileResourceSchema,
4460
+ directoryResourceSchema,
4461
+ nestedResourceSchema
4462
+ ],
4463
+ {
4464
+ discriminator: "type"
4465
+ }
4466
+ );
4467
+ var resourceCreateSchema = Type.Union(
4468
+ [
4469
+ assetResourceCreateSchema,
4470
+ fileResourceSchema,
4471
+ directoryResourceSchema,
4472
+ nestedResourceSchema
4473
+ ],
4474
+ {
4475
+ discriminator: "type"
4476
+ }
4477
+ );
4478
+ var flatResourceSchema = Type.Object({
4479
+ ...baseSchemaProperties,
4480
+ type: Type.Union([
4481
+ Type.Literal("asset"),
4482
+ Type.Literal("file"),
4483
+ Type.Literal("directory"),
4484
+ Type.Literal("resource")
4485
+ ]),
4486
+ assetId: Nullable(Type.String()),
4487
+ fileId: Nullable(Type.String()),
4488
+ resourceId: Nullable(Type.String())
4489
+ });
4490
+ function diffResourceMaps(resourceMap, newResourceMap, idProperty) {
4491
+ const oldIdToPathMap = new Map(
4492
+ Object.entries(resourceMap).map(([path2, entity]) => [
4493
+ entity[idProperty],
4494
+ path2
4495
+ ])
4496
+ );
4497
+ const newIdToPathMap = new Map(
4498
+ Object.entries(newResourceMap).map(([path2, entity]) => [
4499
+ entity[idProperty],
4500
+ path2
4501
+ ])
4502
+ );
4503
+ const oldIds = new Set(
4504
+ Object.values(resourceMap).map((entity) => entity[idProperty])
4505
+ );
4506
+ const newIds = new Set(
4507
+ Object.values(newResourceMap).map((entity) => entity[idProperty])
4508
+ );
4509
+ const sameIds = oldIds.intersection(newIds);
4510
+ const addedResources = Object.values(newResourceMap).filter(
4511
+ (entity) => !oldIds.has(entity[idProperty])
4512
+ );
4513
+ const removedResources = Object.values(resourceMap).filter(
4514
+ (entity) => !newIds.has(entity[idProperty])
4515
+ );
4516
+ const modifiedResources = [...sameIds].flatMap((id) => {
4517
+ const oldResource = Object.values(resourceMap).find(
4518
+ (resource) => resource[idProperty] === id
4519
+ );
4520
+ const newResource = Object.values(newResourceMap).find(
4521
+ (resource) => resource[idProperty] === id
4522
+ );
4523
+ if (!oldResource || !newResource) return [];
4524
+ const oldPath = oldIdToPathMap.get(id);
4525
+ const newPath = newIdToPathMap.get(id);
4526
+ const oldAssetId = oldResource.type === "asset" ? oldResource.assetId : void 0;
4527
+ const newAssetId = newResource.type === "asset" ? newResource.assetId : void 0;
4528
+ const changedProperties = {
4529
+ ...oldPath !== newPath ? { path: newPath } : {},
4530
+ ...oldAssetId !== newAssetId ? { assetId: newAssetId } : {},
4531
+ ...newResource.type === "asset" && newResource.asset !== void 0 ? { asset: newResource.asset } : {}
4532
+ };
4533
+ if (Object.keys(changedProperties).length === 0) return [];
4534
+ return [{ id, stableId: newResource.stableId, ...changedProperties }];
4535
+ });
4536
+ return { addedResources, removedResources, modifiedResources };
4537
+ }
4538
+
4539
+ // ../noya-schemas/src/resourceTree.ts
4540
+ var import_imfs = __toESM(require_lib2());
4541
+ var import_tree_visit2 = __toESM(require_lib());
4542
+
3972
4543
  // ../noya-schemas/src/index.ts
3973
4544
  function validateUUID(value) {
3974
4545
  return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
@@ -3978,6 +4549,20 @@ function validateUUID(value) {
3978
4549
  format_exports.Set("color", () => true);
3979
4550
  format_exports.Set("uuid", validateUUID);
3980
4551
 
4552
+ // src/NoyaStateContext.tsx
4553
+ import {
4554
+ Observable
4555
+ } from "@noya-app/observable";
4556
+ import { useJsonMemo, useStableCallback } from "@noya-app/react-utils";
4557
+ import React16, {
4558
+ createContext,
4559
+ useCallback as useCallback3,
4560
+ useContext,
4561
+ useEffect as useEffect4,
4562
+ useMemo as useMemo4,
4563
+ useState as useState4
4564
+ } from "react";
4565
+
3981
4566
  // src/noyaApp.ts
3982
4567
  import {
3983
4568
  createOrCastValue,
@@ -3988,7 +4573,7 @@ import {
3988
4573
  TypeGuard,
3989
4574
  webSocketSync
3990
4575
  } from "@noya-app/state-manager";
3991
- import { useMemo as useMemo3, useState as useState2 } from "react";
4576
+ import { useMemo as useMemo3, useState as useState3 } from "react";
3992
4577
 
3993
4578
  // src/hooks.ts
3994
4579
  import {
@@ -4002,7 +4587,7 @@ import {
4002
4587
  useEffect as useEffect3,
4003
4588
  useMemo as useMemo2,
4004
4589
  useRef as useRef2,
4005
- useState,
4590
+ useState as useState2,
4006
4591
  useSyncExternalStore as useSyncExternalStore2
4007
4592
  } from "react";
4008
4593
  import { createRoot as createRoot2 } from "react-dom/client";
@@ -4082,18 +4667,126 @@ var ErrorOverlay = React.memo(function ErrorOverlay2({
4082
4667
  });
4083
4668
 
4084
4669
  // src/inspector/useStateInspector.tsx
4085
- import React13 from "react";
4670
+ import React15 from "react";
4086
4671
  import { createRoot } from "react-dom/client";
4087
4672
  import { useIsomorphicLayoutEffect } from "@noya-app/react-utils";
4088
4673
 
4674
+ // ../noya-utils/src/base64.ts
4675
+ function decode(base64String) {
4676
+ const binaryString = atob(base64String);
4677
+ const length = binaryString.length;
4678
+ const bytes = new Uint8Array(length);
4679
+ for (let i = 0; i < length; i++) {
4680
+ bytes[i] = binaryString.charCodeAt(i);
4681
+ }
4682
+ return bytes;
4683
+ }
4684
+ function encode(buffer) {
4685
+ const bytes = new Uint8Array(buffer);
4686
+ let binary = "";
4687
+ const length = bytes.byteLength;
4688
+ for (let i = 0; i < length; i++) {
4689
+ binary += String.fromCharCode(bytes[i]);
4690
+ }
4691
+ return globalThis.btoa(binary);
4692
+ }
4693
+ var Base64 = {
4694
+ encode,
4695
+ decode
4696
+ };
4697
+
4698
+ // ../noya-utils/src/invert.ts
4699
+ function invert(record) {
4700
+ return Object.fromEntries(
4701
+ Object.entries(record).map(([type, extension]) => [extension, type])
4702
+ );
4703
+ }
4704
+
4705
+ // ../noya-utils/src/fileType.ts
4706
+ var FILE_TYPE_TO_EXTENSION = {
4707
+ "image/png": "png",
4708
+ "image/jpeg": "jpg",
4709
+ "image/webp": "webp",
4710
+ "image/svg+xml": "svg",
4711
+ "application/pdf": "pdf",
4712
+ "application/zip": "zip",
4713
+ "application/x-7z-compressed": "7z"
4714
+ };
4715
+ var FILE_EXTENSION_TO_TYPE = invert(FILE_TYPE_TO_EXTENSION);
4716
+
4717
+ // ../noya-utils/src/memoizeDeep.ts
4718
+ var TOKEN_OBJECT = Symbol("object");
4719
+ var TOKEN_ARRAY = Symbol("array");
4720
+ var TOKEN_KEY = Symbol("key");
4721
+ var TOKEN_END = Symbol("end");
4722
+ var TOKEN_PRIMITIVE = Symbol("primitive");
4723
+ var TOKEN_ARGSEP = Symbol("argsep");
4724
+
4725
+ // ../../node_modules/uuid/dist/esm-node/rng.js
4726
+ import crypto from "crypto";
4727
+ var rnds8Pool = new Uint8Array(256);
4728
+ var poolPtr = rnds8Pool.length;
4729
+ function rng() {
4730
+ if (poolPtr > rnds8Pool.length - 16) {
4731
+ crypto.randomFillSync(rnds8Pool);
4732
+ poolPtr = 0;
4733
+ }
4734
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
4735
+ }
4736
+
4737
+ // ../../node_modules/uuid/dist/esm-node/regex.js
4738
+ var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
4739
+
4740
+ // ../../node_modules/uuid/dist/esm-node/validate.js
4741
+ function validate(uuid2) {
4742
+ return typeof uuid2 === "string" && regex_default.test(uuid2);
4743
+ }
4744
+ var validate_default = validate;
4745
+
4746
+ // ../../node_modules/uuid/dist/esm-node/stringify.js
4747
+ var byteToHex = [];
4748
+ for (let i = 0; i < 256; ++i) {
4749
+ byteToHex.push((i + 256).toString(16).substr(1));
4750
+ }
4751
+ function stringify(arr, offset = 0) {
4752
+ const uuid2 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
4753
+ if (!validate_default(uuid2)) {
4754
+ throw TypeError("Stringified UUID is invalid");
4755
+ }
4756
+ return uuid2;
4757
+ }
4758
+ var stringify_default = stringify;
4759
+
4760
+ // ../../node_modules/uuid/dist/esm-node/v4.js
4761
+ function v4(options, buf, offset) {
4762
+ options = options || {};
4763
+ const rnds = options.random || (options.rng || rng)();
4764
+ rnds[6] = rnds[6] & 15 | 64;
4765
+ rnds[8] = rnds[8] & 63 | 128;
4766
+ if (buf) {
4767
+ offset = offset || 0;
4768
+ for (let i = 0; i < 16; ++i) {
4769
+ buf[offset + i] = rnds[i];
4770
+ }
4771
+ return buf;
4772
+ }
4773
+ return stringify_default(rnds);
4774
+ }
4775
+ var v4_default = v4;
4776
+
4777
+ // ../noya-utils/src/uuid.ts
4778
+ function uuid() {
4779
+ return v4_default();
4780
+ }
4781
+
4089
4782
  // src/inspector/StateInspector.tsx
4090
4783
  import { downloadBlob, memoGeneric } from "@noya-app/react-utils";
4091
- import React12, {
4784
+ import React14, {
4092
4785
  useCallback,
4093
4786
  useEffect as useEffect2,
4094
4787
  useLayoutEffect
4095
4788
  } from "react";
4096
- import { ObjectInspector as ObjectInspector3 } from "react-inspector";
4789
+ import { ObjectInspector as ObjectInspector4 } from "react-inspector";
4097
4790
 
4098
4791
  // src/useObservable.ts
4099
4792
  import { useMemo, useSyncExternalStore } from "react";
@@ -4159,41 +4852,48 @@ var getStateInspectorBorderColor = (colorScheme) => {
4159
4852
  return colorScheme === "light" ? "rgb(223 223 223)" : "rgb(29 29 29)";
4160
4853
  };
4161
4854
 
4162
- // src/inspector/sections/EventsSection.tsx
4163
- import React7 from "react";
4164
- import { ObjectInspector, ObjectLabel } from "react-inspector";
4855
+ // src/inspector/sections/ActivityEventsSection.tsx
4856
+ import React7, { useState } from "react";
4857
+ import { ObjectInspector } from "react-inspector";
4165
4858
 
4166
- // src/inspector/ObjectRootLabel.tsx
4859
+ // src/inspector/StateInspectorButton.tsx
4167
4860
  import React3 from "react";
4168
- import { ObjectName, ObjectPreview } from "react-inspector";
4169
- var ObjectRootLabel = ({ name, data, direction }) => {
4170
- if (typeof name === "string") {
4171
- return /* @__PURE__ */ React3.createElement("span", null, /* @__PURE__ */ React3.createElement(ObjectName, { name }), /* @__PURE__ */ React3.createElement("span", null, ": "), /* @__PURE__ */ React3.createElement(ObjectPreview, { data }));
4172
- }
4173
- if (direction === "up" || direction === "down") {
4174
- const arrow = direction === "up" ? "\u2191" : "\u2193";
4175
- return /* @__PURE__ */ React3.createElement("span", null, /* @__PURE__ */ React3.createElement(
4176
- "span",
4177
- {
4178
- style: {
4179
- background: direction === "up" ? "rgba(0,255,0,0.2)" : "rgba(255,0,0,0.2)",
4180
- // color: "white",
4181
- width: 12,
4182
- height: 12,
4183
- borderRadius: 2,
4184
- display: "inline-flex",
4185
- justifyContent: "center",
4186
- alignItems: "center",
4187
- marginRight: 4,
4188
- lineHeight: "12px"
4189
- }
4861
+ function StateInspectorButton({
4862
+ children,
4863
+ onClick,
4864
+ style,
4865
+ theme,
4866
+ disabled
4867
+ }) {
4868
+ return /* @__PURE__ */ React3.createElement(
4869
+ "button",
4870
+ {
4871
+ type: "button",
4872
+ disabled,
4873
+ onClick: (event) => {
4874
+ event.stopPropagation();
4875
+ onClick();
4190
4876
  },
4191
- arrow
4192
- ), /* @__PURE__ */ React3.createElement(ObjectPreview, { data }));
4193
- } else {
4194
- return /* @__PURE__ */ React3.createElement(ObjectPreview, { data });
4195
- }
4196
- };
4877
+ style: {
4878
+ flex: "0",
4879
+ appearance: "none",
4880
+ background: "none",
4881
+ color: theme.BASE_COLOR,
4882
+ opacity: disabled ? 0.25 : 1,
4883
+ border: "none",
4884
+ fontSize: "12px",
4885
+ whiteSpace: "nowrap",
4886
+ display: "inline-flex",
4887
+ alignItems: "center",
4888
+ justifyContent: "center",
4889
+ padding: "0",
4890
+ cursor: "pointer",
4891
+ ...style
4892
+ }
4893
+ },
4894
+ children
4895
+ );
4896
+ }
4197
4897
 
4198
4898
  // src/inspector/StateInspectorDisclosureSection.tsx
4199
4899
  import React5, {
@@ -4341,6 +5041,139 @@ function StateInspectorRow({
4341
5041
  );
4342
5042
  }
4343
5043
 
5044
+ // src/inspector/sections/ActivityEventsSection.tsx
5045
+ function isResourceStreamFilter(streamFilter) {
5046
+ return typeof streamFilter === "object" && "resourceId" in streamFilter;
5047
+ }
5048
+ function isResourceActivityEvent(activityEvent) {
5049
+ return typeof activityEvent === "object" && activityEvent !== null && "type" in activityEvent && activityEvent.type === "resource" && "resourceId" in activityEvent && typeof activityEvent.resourceId === "string";
5050
+ }
5051
+ function ActivityEventsSection({
5052
+ showEvents,
5053
+ setShowEvents,
5054
+ colorScheme,
5055
+ activityEventsContainerRef,
5056
+ activityEventsManager
5057
+ }) {
5058
+ const [streamFilter, setStreamFilter] = useState("all");
5059
+ const streamFilterType = isResourceStreamFilter(streamFilter) ? "resource" : "all";
5060
+ const theme = getStateInspectorTheme(colorScheme);
5061
+ const activityEvents = useActivityEventsForManager(
5062
+ showEvents ? streamFilter : void 0,
5063
+ activityEventsManager
5064
+ );
5065
+ return /* @__PURE__ */ React7.createElement(
5066
+ StateInspectorDisclosureSection,
5067
+ {
5068
+ open: showEvents,
5069
+ setOpen: setShowEvents,
5070
+ title: `Activity Events`,
5071
+ colorScheme
5072
+ },
5073
+ /* @__PURE__ */ React7.createElement(StateInspectorDisclosureRowInner, { ref: activityEventsContainerRef }, /* @__PURE__ */ React7.createElement("div", { style: { padding: "4px 12px", display: "flex", gap: "4px" } }, /* @__PURE__ */ React7.createElement(
5074
+ "select",
5075
+ {
5076
+ name: "streamFilterType",
5077
+ value: streamFilterType,
5078
+ style: { flex: "0 0 auto", height: "19px" },
5079
+ onChange: (e) => {
5080
+ const value = e.target.value;
5081
+ if (value === "all") {
5082
+ setStreamFilter("all");
5083
+ } else {
5084
+ setStreamFilter({ resourceId: "" });
5085
+ }
5086
+ }
5087
+ },
5088
+ /* @__PURE__ */ React7.createElement("option", { value: "all" }, "All"),
5089
+ /* @__PURE__ */ React7.createElement("option", { value: "resource" }, "Resource")
5090
+ ), isResourceStreamFilter(streamFilter) && /* @__PURE__ */ React7.createElement(
5091
+ "input",
5092
+ {
5093
+ name: "resourceId",
5094
+ type: "text",
5095
+ placeholder: "Resource ID",
5096
+ value: streamFilter.resourceId,
5097
+ style: {
5098
+ flex: "1 1 auto",
5099
+ height: "19px",
5100
+ padding: "0px 4px",
5101
+ boxSizing: "border-box"
5102
+ },
5103
+ onChange: (e) => setStreamFilter({ ...streamFilter, resourceId: e.target.value })
5104
+ }
5105
+ )), activityEvents?.map((activityEvent, index) => /* @__PURE__ */ React7.createElement(
5106
+ StateInspectorRow,
5107
+ {
5108
+ key: index,
5109
+ colorScheme,
5110
+ style: {
5111
+ padding: "0px 12px 1px"
5112
+ }
5113
+ },
5114
+ /* @__PURE__ */ React7.createElement(ObjectInspector, { data: activityEvent, theme }),
5115
+ streamFilterType === "all" && isResourceActivityEvent(activityEvent) && /* @__PURE__ */ React7.createElement(
5116
+ StateInspectorButton,
5117
+ {
5118
+ theme,
5119
+ onClick: () => {
5120
+ setStreamFilter({ resourceId: activityEvent.resourceId });
5121
+ }
5122
+ },
5123
+ "Watch this resource"
5124
+ )
5125
+ )), !activityEvents && /* @__PURE__ */ React7.createElement(
5126
+ "div",
5127
+ {
5128
+ style: {
5129
+ padding: "12px",
5130
+ fontSize: "12px",
5131
+ display: "flex",
5132
+ flexDirection: "column",
5133
+ gap: "4px"
5134
+ }
5135
+ },
5136
+ /* @__PURE__ */ React7.createElement("span", null, "No activity events")
5137
+ ))
5138
+ );
5139
+ }
5140
+
5141
+ // src/inspector/sections/EventsSection.tsx
5142
+ import React9 from "react";
5143
+ import { ObjectInspector as ObjectInspector2, ObjectLabel } from "react-inspector";
5144
+
5145
+ // src/inspector/ObjectRootLabel.tsx
5146
+ import React8 from "react";
5147
+ import { ObjectName, ObjectPreview } from "react-inspector";
5148
+ var ObjectRootLabel = ({ name, data, direction }) => {
5149
+ if (typeof name === "string") {
5150
+ return /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement(ObjectName, { name }), /* @__PURE__ */ React8.createElement("span", null, ": "), /* @__PURE__ */ React8.createElement(ObjectPreview, { data }));
5151
+ }
5152
+ if (direction === "up" || direction === "down") {
5153
+ const arrow = direction === "up" ? "\u2191" : "\u2193";
5154
+ return /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement(
5155
+ "span",
5156
+ {
5157
+ style: {
5158
+ background: direction === "up" ? "rgba(0,255,0,0.2)" : "rgba(255,0,0,0.2)",
5159
+ // color: "white",
5160
+ width: 12,
5161
+ height: 12,
5162
+ borderRadius: 2,
5163
+ display: "inline-flex",
5164
+ justifyContent: "center",
5165
+ alignItems: "center",
5166
+ marginRight: 4,
5167
+ lineHeight: "12px"
5168
+ }
5169
+ },
5170
+ arrow
5171
+ ), /* @__PURE__ */ React8.createElement(ObjectPreview, { data }));
5172
+ } else {
5173
+ return /* @__PURE__ */ React8.createElement(ObjectPreview, { data });
5174
+ }
5175
+ };
5176
+
4344
5177
  // src/inspector/sections/EventsSection.tsx
4345
5178
  function EventsSection({
4346
5179
  showEvents,
@@ -4350,7 +5183,7 @@ function EventsSection({
4350
5183
  connectionEvents
4351
5184
  }) {
4352
5185
  const theme = getStateInspectorTheme(colorScheme);
4353
- return /* @__PURE__ */ React7.createElement(
5186
+ return /* @__PURE__ */ React9.createElement(
4354
5187
  StateInspectorDisclosureSection,
4355
5188
  {
4356
5189
  open: showEvents,
@@ -4358,8 +5191,8 @@ function EventsSection({
4358
5191
  title: "Events",
4359
5192
  colorScheme
4360
5193
  },
4361
- /* @__PURE__ */ React7.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, connectionEvents?.map(
4362
- (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React7.createElement(StateInspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React7.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React7.createElement(
5194
+ /* @__PURE__ */ React9.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, connectionEvents?.map(
5195
+ (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React9.createElement(StateInspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React9.createElement(
4363
5196
  StateInspectorRow,
4364
5197
  {
4365
5198
  key: index,
@@ -4369,14 +5202,14 @@ function EventsSection({
4369
5202
  padding: "0px 12px 1px"
4370
5203
  }
4371
5204
  },
4372
- /* @__PURE__ */ React7.createElement(
4373
- ObjectInspector,
5205
+ /* @__PURE__ */ React9.createElement(
5206
+ ObjectInspector2,
4374
5207
  {
4375
5208
  data: event.type === "error" ? event.error : event.message,
4376
5209
  theme,
4377
5210
  nodeRenderer: ({ depth, name, data, isNonenumerable }) => {
4378
5211
  const direction = event.type === "send" ? "up" : "down";
4379
- return depth === 0 ? /* @__PURE__ */ React7.createElement(ObjectRootLabel, { direction, data }) : /* @__PURE__ */ React7.createElement(
5212
+ return depth === 0 ? /* @__PURE__ */ React9.createElement(ObjectRootLabel, { direction, data }) : /* @__PURE__ */ React9.createElement(
4380
5213
  ObjectLabel,
4381
5214
  {
4382
5215
  direction,
@@ -4389,7 +5222,7 @@ function EventsSection({
4389
5222
  }
4390
5223
  )
4391
5224
  )
4392
- ), !connectionEvents && /* @__PURE__ */ React7.createElement(
5225
+ ), !connectionEvents && /* @__PURE__ */ React9.createElement(
4393
5226
  "div",
4394
5227
  {
4395
5228
  style: {
@@ -4400,53 +5233,14 @@ function EventsSection({
4400
5233
  gap: "4px"
4401
5234
  }
4402
5235
  },
4403
- /* @__PURE__ */ React7.createElement("span", null, "No recorded events")
5236
+ /* @__PURE__ */ React9.createElement("span", null, "No recorded events")
4404
5237
  ))
4405
5238
  );
4406
5239
  }
4407
5240
 
4408
5241
  // src/inspector/sections/HistorySection.tsx
4409
- import React9, { useEffect, useRef } from "react";
4410
- import { ObjectInspector as ObjectInspector2 } from "react-inspector";
4411
-
4412
- // src/inspector/StateInspectorButton.tsx
4413
- import React8 from "react";
4414
- function StateInspectorButton({
4415
- children,
4416
- onClick,
4417
- style,
4418
- theme,
4419
- disabled
4420
- }) {
4421
- return /* @__PURE__ */ React8.createElement(
4422
- "button",
4423
- {
4424
- type: "button",
4425
- disabled,
4426
- onClick: (event) => {
4427
- event.stopPropagation();
4428
- onClick();
4429
- },
4430
- style: {
4431
- flex: "0",
4432
- appearance: "none",
4433
- background: "none",
4434
- color: theme.BASE_COLOR,
4435
- opacity: disabled ? 0.25 : 1,
4436
- border: "none",
4437
- fontSize: "12px",
4438
- whiteSpace: "nowrap",
4439
- display: "inline-flex",
4440
- alignItems: "center",
4441
- justifyContent: "center",
4442
- padding: "0",
4443
- cursor: "pointer",
4444
- ...style
4445
- }
4446
- },
4447
- children
4448
- );
4449
- }
5242
+ import React10, { useEffect, useRef } from "react";
5243
+ import { ObjectInspector as ObjectInspector3 } from "react-inspector";
4450
5244
 
4451
5245
  // src/inspector/utils.ts
4452
5246
  function pathToString(extendedPath) {
@@ -4479,7 +5273,7 @@ function uploadFile() {
4479
5273
  const reader = new FileReader();
4480
5274
  reader.onload = () => {
4481
5275
  const buffer = reader.result;
4482
- const blob = new Blob([buffer]);
5276
+ const blob = new File([buffer], file.name, { type: file.type });
4483
5277
  resolve(blob);
4484
5278
  };
4485
5279
  reader.onerror = () => {
@@ -4521,14 +5315,14 @@ function HistorySection({
4521
5315
  });
4522
5316
  }
4523
5317
  }, [historySnapshot.historyIndex]);
4524
- return /* @__PURE__ */ React9.createElement(
5318
+ return /* @__PURE__ */ React10.createElement(
4525
5319
  StateInspectorDisclosureSection,
4526
5320
  {
4527
5321
  open: showHistory,
4528
5322
  setOpen: setShowHistory,
4529
5323
  title: "History",
4530
5324
  colorScheme,
4531
- right: /* @__PURE__ */ React9.createElement(
5325
+ right: /* @__PURE__ */ React10.createElement(
4532
5326
  "span",
4533
5327
  {
4534
5328
  style: {
@@ -4536,7 +5330,7 @@ function HistorySection({
4536
5330
  gap: "4px"
4537
5331
  }
4538
5332
  },
4539
- /* @__PURE__ */ React9.createElement(
5333
+ /* @__PURE__ */ React10.createElement(
4540
5334
  StateInspectorButton,
4541
5335
  {
4542
5336
  disabled: !historySnapshot.canUndo,
@@ -4545,7 +5339,7 @@ function HistorySection({
4545
5339
  multiplayerStateManager.undo();
4546
5340
  }
4547
5341
  },
4548
- /* @__PURE__ */ React9.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React9.createElement(
5342
+ /* @__PURE__ */ React10.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React10.createElement(
4549
5343
  "svg",
4550
5344
  {
4551
5345
  xmlns: "http://www.w3.org/2000/svg",
@@ -4553,7 +5347,7 @@ function HistorySection({
4553
5347
  height: "1em",
4554
5348
  viewBox: "0 0 20 20"
4555
5349
  },
4556
- /* @__PURE__ */ React9.createElement(
5350
+ /* @__PURE__ */ React10.createElement(
4557
5351
  "path",
4558
5352
  {
4559
5353
  fill: "currentColor",
@@ -4562,7 +5356,7 @@ function HistorySection({
4562
5356
  )
4563
5357
  ))
4564
5358
  ),
4565
- /* @__PURE__ */ React9.createElement(
5359
+ /* @__PURE__ */ React10.createElement(
4566
5360
  StateInspectorButton,
4567
5361
  {
4568
5362
  disabled: !historySnapshot.canRedo,
@@ -4571,7 +5365,7 @@ function HistorySection({
4571
5365
  multiplayerStateManager.redo();
4572
5366
  }
4573
5367
  },
4574
- /* @__PURE__ */ React9.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React9.createElement(
5368
+ /* @__PURE__ */ React10.createElement("span", { style: { width: "12px", height: "12px" } }, /* @__PURE__ */ React10.createElement(
4575
5369
  "svg",
4576
5370
  {
4577
5371
  xmlns: "http://www.w3.org/2000/svg",
@@ -4579,7 +5373,7 @@ function HistorySection({
4579
5373
  height: "1em",
4580
5374
  viewBox: "0 0 20 20"
4581
5375
  },
4582
- /* @__PURE__ */ React9.createElement(
5376
+ /* @__PURE__ */ React10.createElement(
4583
5377
  "path",
4584
5378
  {
4585
5379
  fill: "currentColor",
@@ -4590,7 +5384,7 @@ function HistorySection({
4590
5384
  )
4591
5385
  )
4592
5386
  },
4593
- /* @__PURE__ */ React9.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ React9.createElement(
5387
+ /* @__PURE__ */ React10.createElement(StateInspectorDisclosureRowInner, { ref }, /* @__PURE__ */ React10.createElement(
4594
5388
  "div",
4595
5389
  {
4596
5390
  id: `${HISTORY_ELEMENT_PREFIX}0`,
@@ -4604,7 +5398,7 @@ function HistorySection({
4604
5398
  background: historySnapshot.historyIndex === 0 ? "rgb(59 130 246 / 15%)" : void 0
4605
5399
  }
4606
5400
  },
4607
- /* @__PURE__ */ React9.createElement(
5401
+ /* @__PURE__ */ React10.createElement(
4608
5402
  "span",
4609
5403
  {
4610
5404
  style: {
@@ -4619,7 +5413,7 @@ function HistorySection({
4619
5413
  ), historySnapshot.history.map((entry, index) => {
4620
5414
  const metadata = entry.metadata;
4621
5415
  const { id, name, timestamp, ...rest } = metadata;
4622
- return /* @__PURE__ */ React9.createElement(
5416
+ return /* @__PURE__ */ React10.createElement(
4623
5417
  "div",
4624
5418
  {
4625
5419
  id: `${HISTORY_ELEMENT_PREFIX}${index + 1}`,
@@ -4630,7 +5424,7 @@ function HistorySection({
4630
5424
  background: index + 1 === historySnapshot.historyIndex ? "rgb(59 130 246 / 15%)" : void 0
4631
5425
  }
4632
5426
  },
4633
- typeof name === "string" && /* @__PURE__ */ React9.createElement(
5427
+ typeof name === "string" && /* @__PURE__ */ React10.createElement(
4634
5428
  "pre",
4635
5429
  {
4636
5430
  style: {
@@ -4641,9 +5435,9 @@ function HistorySection({
4641
5435
  }
4642
5436
  },
4643
5437
  entry.metadata.name,
4644
- Object.keys(rest).length > 0 && /* @__PURE__ */ React9.createElement(ObjectInspector2, { data: rest, theme })
5438
+ Object.keys(rest).length > 0 && /* @__PURE__ */ React10.createElement(ObjectInspector3, { data: rest, theme })
4645
5439
  ),
4646
- entry.redoPatches?.map((patch, j) => /* @__PURE__ */ React9.createElement(
5440
+ entry.redoPatches?.map((patch, j) => /* @__PURE__ */ React10.createElement(
4647
5441
  "pre",
4648
5442
  {
4649
5443
  key: j,
@@ -4654,10 +5448,10 @@ function HistorySection({
4654
5448
  margin: 0
4655
5449
  }
4656
5450
  },
4657
- patch.op === "add" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React9.createElement(ObjectInspector2, { data: patch.value, theme })),
4658
- patch.op === "replace" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React9.createElement(ObjectInspector2, { data: patch.value, theme })),
4659
- patch.op === "remove" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", { style: { color: theme.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
4660
- patch.op === "move" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ React9.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
5451
+ patch.op === "add" && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React10.createElement(ObjectInspector3, { data: patch.value, theme })),
5452
+ patch.op === "replace" && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)), " = ", /* @__PURE__ */ React10.createElement(ObjectInspector3, { data: patch.value, theme })),
5453
+ patch.op === "remove" && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { style: { color: theme.OBJECT_VALUE_STRING_COLOR } }, "delete", " "), /* @__PURE__ */ React10.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path))),
5454
+ patch.op === "move" && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.from)), " -> ", /* @__PURE__ */ React10.createElement("span", { style: { fontStyle: "italic" } }, pathToString(patch.path)))
4661
5455
  ))
4662
5456
  );
4663
5457
  }))
@@ -5213,8 +6007,16 @@ function replaceDeep(obj, replacementMap) {
5213
6007
  }
5214
6008
  }
5215
6009
 
6010
+ // src/inspector/StateInspectorTitleLabel.tsx
6011
+ import React11 from "react";
6012
+ function StateInspectorTitleLabel({
6013
+ children
6014
+ }) {
6015
+ return /* @__PURE__ */ React11.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
6016
+ }
6017
+
5216
6018
  // src/inspector/StateInspectorToggleButton.tsx
5217
- import React10 from "react";
6019
+ import React12 from "react";
5218
6020
  function StateInspectorToggleButton({
5219
6021
  showInspector,
5220
6022
  setShowInspector,
@@ -5222,7 +6024,7 @@ function StateInspectorToggleButton({
5222
6024
  anchor
5223
6025
  }) {
5224
6026
  const isRightAnchor = anchor === "right";
5225
- const rightIcon = /* @__PURE__ */ React10.createElement(
6027
+ const rightIcon = /* @__PURE__ */ React12.createElement(
5226
6028
  "svg",
5227
6029
  {
5228
6030
  xmlns: "http://www.w3.org/2000/svg",
@@ -5232,7 +6034,7 @@ function StateInspectorToggleButton({
5232
6034
  stroke: "currentColor",
5233
6035
  className: "size-6"
5234
6036
  },
5235
- /* @__PURE__ */ React10.createElement(
6037
+ /* @__PURE__ */ React12.createElement(
5236
6038
  "path",
5237
6039
  {
5238
6040
  strokeLinecap: "round",
@@ -5241,7 +6043,7 @@ function StateInspectorToggleButton({
5241
6043
  }
5242
6044
  )
5243
6045
  );
5244
- const leftIcon = /* @__PURE__ */ React10.createElement(
6046
+ const leftIcon = /* @__PURE__ */ React12.createElement(
5245
6047
  "svg",
5246
6048
  {
5247
6049
  xmlns: "http://www.w3.org/2000/svg",
@@ -5251,7 +6053,7 @@ function StateInspectorToggleButton({
5251
6053
  stroke: "currentColor",
5252
6054
  className: "size-6"
5253
6055
  },
5254
- /* @__PURE__ */ React10.createElement(
6056
+ /* @__PURE__ */ React12.createElement(
5255
6057
  "path",
5256
6058
  {
5257
6059
  strokeLinecap: "round",
@@ -5260,7 +6062,7 @@ function StateInspectorToggleButton({
5260
6062
  }
5261
6063
  )
5262
6064
  );
5263
- return /* @__PURE__ */ React10.createElement(
6065
+ return /* @__PURE__ */ React12.createElement(
5264
6066
  "span",
5265
6067
  {
5266
6068
  role: "button",
@@ -5281,15 +6083,15 @@ function StateInspectorToggleButton({
5281
6083
  setShowInspector(!showInspector);
5282
6084
  }
5283
6085
  },
5284
- showInspector ? "Hide Inspector" : /* @__PURE__ */ React10.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
6086
+ showInspector ? "Hide Inspector" : /* @__PURE__ */ React12.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
5285
6087
  );
5286
6088
  }
5287
6089
 
5288
6090
  // src/inspector/useLocalStorageState.tsx
5289
- import React11 from "react";
6091
+ import React13 from "react";
5290
6092
  var localStorage = typeof window !== "undefined" ? window.localStorage : null;
5291
6093
  function useLocalStorageState(key, defaultValue) {
5292
- const [state, setState] = React11.useState(() => {
6094
+ const [state, setState] = React13.useState(() => {
5293
6095
  const value = localStorage?.getItem(key);
5294
6096
  let result = defaultValue;
5295
6097
  if (value) {
@@ -5324,16 +6126,19 @@ var StateInspector = memoGeneric(function StateInspector2({
5324
6126
  ephemeralUserDataManager,
5325
6127
  connectionEventManager,
5326
6128
  taskManager,
5327
- ioManager
6129
+ ioManager,
6130
+ resourceManager,
6131
+ activityEventsManager
5328
6132
  } = noyaManager;
5329
- const [didMount, setDidMount] = React12.useState(false);
6133
+ const [didMount, setDidMount] = React14.useState(false);
5330
6134
  const tasks = useObservable(taskManager.tasks$);
5331
6135
  const inputs = useObservable(ioManager.inputs$);
5332
6136
  const outputTransforms = useObservable(ioManager.outputTransforms$);
5333
6137
  useLayoutEffect(() => {
5334
6138
  setDidMount(true);
5335
6139
  }, []);
5336
- const eventsContainerRef = React12.useRef(null);
6140
+ const eventsContainerRef = React14.useRef(null);
6141
+ const activityEventsContainerRef = React14.useRef(null);
5337
6142
  const [showInspector, setShowInspector] = useLocalStorageState(
5338
6143
  "noya-multiplayer-react-show-inspector",
5339
6144
  true
@@ -5366,6 +6171,10 @@ var StateInspector = memoGeneric(function StateInspector2({
5366
6171
  "noya-multiplayer-react-show-assets",
5367
6172
  false
5368
6173
  );
6174
+ const [showResources, setShowResources] = useLocalStorageState(
6175
+ "noya-multiplayer-react-show-resources",
6176
+ false
6177
+ );
5369
6178
  const [showSecrets, setShowSecrets] = useLocalStorageState(
5370
6179
  "noya-multiplayer-react-show-secrets",
5371
6180
  false
@@ -5378,6 +6187,10 @@ var StateInspector = memoGeneric(function StateInspector2({
5378
6187
  "noya-multiplayer-react-show-output-transforms",
5379
6188
  false
5380
6189
  );
6190
+ const [showActivityEvents, setShowActivityEvents] = useLocalStorageState(
6191
+ "noya-multiplayer-react-show-activity-events",
6192
+ false
6193
+ );
5381
6194
  const connectionEvents = useObservable(connectionEventManager.events$);
5382
6195
  useEffect2(() => {
5383
6196
  if (eventsContainerRef.current) {
@@ -5390,6 +6203,8 @@ var StateInspector = memoGeneric(function StateInspector2({
5390
6203
  const ephemeral = useObservable(ephemeralUserDataManager.data$);
5391
6204
  const historySnapshot = useManagedHistory(multiplayerStateManager.sm);
5392
6205
  const assets = useObservable(assetManager.assets$);
6206
+ const resources = useObservable(resourceManager.resources$);
6207
+ const resourcesInitialized = useObservable(resourceManager.isInitialized$);
5393
6208
  const assetsInitialized = useObservable(assetManager.isInitialized$);
5394
6209
  const secrets = useObservable(secretManager.secrets$);
5395
6210
  const secretsInitialized = useObservable(secretManager.isInitialized$);
@@ -5438,7 +6253,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5438
6253
  }, [noyaManager]);
5439
6254
  if (!didMount) return null;
5440
6255
  if (!showInspector) {
5441
- return /* @__PURE__ */ React12.createElement(
6256
+ return /* @__PURE__ */ React14.createElement(
5442
6257
  "div",
5443
6258
  {
5444
6259
  ...props,
@@ -5450,7 +6265,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5450
6265
  },
5451
6266
  onClick: () => setShowInspector(true)
5452
6267
  },
5453
- /* @__PURE__ */ React12.createElement(
6268
+ /* @__PURE__ */ React14.createElement(
5454
6269
  StateInspectorToggleButton,
5455
6270
  {
5456
6271
  showInspector,
@@ -5461,7 +6276,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5461
6276
  )
5462
6277
  );
5463
6278
  }
5464
- return /* @__PURE__ */ React12.createElement(
6279
+ return /* @__PURE__ */ React14.createElement(
5465
6280
  "div",
5466
6281
  {
5467
6282
  ...props,
@@ -5470,7 +6285,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5470
6285
  ...props.style
5471
6286
  }
5472
6287
  },
5473
- /* @__PURE__ */ React12.createElement(
6288
+ /* @__PURE__ */ React14.createElement(
5474
6289
  StateInspectorDisclosureSection,
5475
6290
  {
5476
6291
  isFirst: true,
@@ -5482,7 +6297,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5482
6297
  flex: "0 0 auto",
5483
6298
  maxHeight: "200px"
5484
6299
  },
5485
- right: /* @__PURE__ */ React12.createElement(
6300
+ right: /* @__PURE__ */ React14.createElement(
5486
6301
  StateInspectorToggleButton,
5487
6302
  {
5488
6303
  showInspector,
@@ -5492,14 +6307,14 @@ var StateInspector = memoGeneric(function StateInspector2({
5492
6307
  }
5493
6308
  )
5494
6309
  },
5495
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user) => /* @__PURE__ */ React12.createElement(
6310
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user) => /* @__PURE__ */ React14.createElement(
5496
6311
  StateInspectorRow,
5497
6312
  {
5498
6313
  key: user.id,
5499
6314
  colorScheme,
5500
6315
  variant: user.id === userId ? "up" : void 0
5501
6316
  },
5502
- user.image && /* @__PURE__ */ React12.createElement(
6317
+ user.image && /* @__PURE__ */ React14.createElement(
5503
6318
  "img",
5504
6319
  {
5505
6320
  src: user.image,
@@ -5520,7 +6335,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5520
6335
  " (",
5521
6336
  ellipsis(user.id.toString(), 8, "middle"),
5522
6337
  ")"
5523
- )), !connectedUsers && /* @__PURE__ */ React12.createElement(
6338
+ )), !connectedUsers && /* @__PURE__ */ React14.createElement(
5524
6339
  "div",
5525
6340
  {
5526
6341
  style: {
@@ -5531,13 +6346,13 @@ var StateInspector = memoGeneric(function StateInspector2({
5531
6346
  gap: "4px"
5532
6347
  }
5533
6348
  },
5534
- /* @__PURE__ */ React12.createElement("span", null, "No connected users")
6349
+ /* @__PURE__ */ React14.createElement("span", null, "No connected users")
5535
6350
  ))
5536
6351
  ),
5537
- /* @__PURE__ */ React12.createElement(
6352
+ /* @__PURE__ */ React14.createElement(
5538
6353
  StateInspectorDisclosureSection,
5539
6354
  {
5540
- title: /* @__PURE__ */ React12.createElement(TitleLabel, null, "Data", /* @__PURE__ */ React12.createElement(
6355
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React14.createElement(
5541
6356
  ColoredDot,
5542
6357
  {
5543
6358
  type: multipeerStateInitialized ? "success" : "error"
@@ -5546,7 +6361,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5546
6361
  colorScheme,
5547
6362
  setOpen: setShowData,
5548
6363
  open: showData,
5549
- right: /* @__PURE__ */ React12.createElement(
6364
+ right: /* @__PURE__ */ React14.createElement(
5550
6365
  "span",
5551
6366
  {
5552
6367
  style: {
@@ -5554,9 +6369,9 @@ var StateInspector = memoGeneric(function StateInspector2({
5554
6369
  gap: "12px"
5555
6370
  }
5556
6371
  },
5557
- /* @__PURE__ */ React12.createElement(StateInspectorButton, { theme, onClick: handleImportAll }, "Import"),
5558
- /* @__PURE__ */ React12.createElement(StateInspectorButton, { theme, onClick: handleExportAll }, "Export"),
5559
- /* @__PURE__ */ React12.createElement(
6372
+ /* @__PURE__ */ React14.createElement(StateInspectorButton, { theme, onClick: handleImportAll }, "Import"),
6373
+ /* @__PURE__ */ React14.createElement(StateInspectorButton, { theme, onClick: handleExportAll }, "Export"),
6374
+ /* @__PURE__ */ React14.createElement(
5560
6375
  StateInspectorButton,
5561
6376
  {
5562
6377
  theme,
@@ -5568,15 +6383,15 @@ var StateInspector = memoGeneric(function StateInspector2({
5568
6383
  )
5569
6384
  )
5570
6385
  },
5571
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React12.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React12.createElement(
5572
- ObjectInspector3,
6386
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React14.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React14.createElement(
6387
+ ObjectInspector4,
5573
6388
  {
5574
6389
  name: multiplayerStateManager.schema ? "state" : void 0,
5575
6390
  data: state,
5576
6391
  theme
5577
6392
  }
5578
- )), multiplayerStateManager.schema && /* @__PURE__ */ React12.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React12.createElement(
5579
- ObjectInspector3,
6393
+ )), multiplayerStateManager.schema && /* @__PURE__ */ React14.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React14.createElement(
6394
+ ObjectInspector4,
5580
6395
  {
5581
6396
  name: "schema",
5582
6397
  data: multiplayerStateManager.schema,
@@ -5584,7 +6399,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5584
6399
  }
5585
6400
  )))
5586
6401
  ),
5587
- /* @__PURE__ */ React12.createElement(
6402
+ /* @__PURE__ */ React14.createElement(
5588
6403
  HistorySection,
5589
6404
  {
5590
6405
  showHistory,
@@ -5594,14 +6409,29 @@ var StateInspector = memoGeneric(function StateInspector2({
5594
6409
  multiplayerStateManager
5595
6410
  }
5596
6411
  ),
5597
- /* @__PURE__ */ React12.createElement(
6412
+ /* @__PURE__ */ React14.createElement(
5598
6413
  StateInspectorDisclosureSection,
5599
6414
  {
5600
6415
  open: showAssets,
5601
6416
  setOpen: setShowAssets,
5602
- title: /* @__PURE__ */ React12.createElement(TitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React12.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
6417
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React14.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
5603
6418
  colorScheme,
5604
- right: /* @__PURE__ */ React12.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React12.createElement(
6419
+ right: /* @__PURE__ */ React14.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React14.createElement(
6420
+ StateInspectorButton,
6421
+ {
6422
+ theme,
6423
+ onClick: async () => {
6424
+ const ok = confirm(
6425
+ "Are you sure you want to delete all assets?"
6426
+ );
6427
+ if (!ok) return;
6428
+ await Promise.all(
6429
+ assets.map((asset) => assetManager.delete(asset.id))
6430
+ );
6431
+ }
6432
+ },
6433
+ "Delete all"
6434
+ ), /* @__PURE__ */ React14.createElement(
5605
6435
  StateInspectorButton,
5606
6436
  {
5607
6437
  theme,
@@ -5614,7 +6444,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5614
6444
  }
5615
6445
  },
5616
6446
  "Reload"
5617
- ), /* @__PURE__ */ React12.createElement(
6447
+ ), /* @__PURE__ */ React14.createElement(
5618
6448
  StateInspectorButton,
5619
6449
  {
5620
6450
  theme,
@@ -5638,7 +6468,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5638
6468
  "Upload"
5639
6469
  ))
5640
6470
  },
5641
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React12.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React12.createElement(ObjectInspector3, { name: asset.id, data: asset, theme }), /* @__PURE__ */ React12.createElement(
6471
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React14.createElement(ObjectInspector4, { name: asset.id, data: asset, theme }), /* @__PURE__ */ React14.createElement(
5642
6472
  StateInspectorButton,
5643
6473
  {
5644
6474
  theme,
@@ -5647,14 +6477,98 @@ var StateInspector = memoGeneric(function StateInspector2({
5647
6477
  "Delete"
5648
6478
  ))))
5649
6479
  ),
5650
- /* @__PURE__ */ React12.createElement(
6480
+ /* @__PURE__ */ React14.createElement(
6481
+ StateInspectorDisclosureSection,
6482
+ {
6483
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React14.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
6484
+ colorScheme,
6485
+ open: showResources,
6486
+ setOpen: setShowResources,
6487
+ right: /* @__PURE__ */ React14.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React14.createElement(
6488
+ StateInspectorButton,
6489
+ {
6490
+ theme,
6491
+ onClick: async () => {
6492
+ const ok = confirm(
6493
+ "Are you sure you want to delete all resources?"
6494
+ );
6495
+ if (!ok) return;
6496
+ await Promise.all(
6497
+ resources.map(
6498
+ (resource) => resourceManager.deleteResource({ id: resource.id })
6499
+ )
6500
+ );
6501
+ }
6502
+ },
6503
+ "Delete all"
6504
+ ), /* @__PURE__ */ React14.createElement(
6505
+ StateInspectorButton,
6506
+ {
6507
+ theme,
6508
+ onClick: async () => {
6509
+ const path2 = prompt("Enter directory path") || uuid();
6510
+ await resourceManager.createResource({
6511
+ type: "directory",
6512
+ path: path2
6513
+ });
6514
+ }
6515
+ },
6516
+ "Create Directory"
6517
+ ), /* @__PURE__ */ React14.createElement(
6518
+ StateInspectorButton,
6519
+ {
6520
+ theme,
6521
+ onClick: async () => {
6522
+ const file = await uploadFile();
6523
+ resourceManager.createResource({
6524
+ type: "asset",
6525
+ path: file.name || uuid(),
6526
+ asset: {
6527
+ content: Base64.encode(await file.arrayBuffer()),
6528
+ contentType: file.type,
6529
+ encoding: "base64"
6530
+ }
6531
+ });
6532
+ }
6533
+ },
6534
+ "Create Asset"
6535
+ ))
6536
+ },
6537
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React14.createElement(
6538
+ ObjectInspector4,
6539
+ {
6540
+ name: resource.path,
6541
+ data: resource,
6542
+ theme
6543
+ }
6544
+ ), /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React14.createElement(
6545
+ StateInspectorButton,
6546
+ {
6547
+ theme,
6548
+ onClick: () => resourceManager.deleteResource({ id: resource.id })
6549
+ },
6550
+ "Delete"
6551
+ ), /* @__PURE__ */ React14.createElement(
6552
+ StateInspectorButton,
6553
+ {
6554
+ theme,
6555
+ onClick: () => {
6556
+ const path2 = prompt("Enter new path", resource.path);
6557
+ if (!path2) return;
6558
+ resourceManager.updateResource({ id: resource.id, path: path2 });
6559
+ }
6560
+ },
6561
+ "Rename"
6562
+ )))))
6563
+ ),
6564
+ /* @__PURE__ */ React14.createElement(
5651
6565
  StateInspectorDisclosureSection,
5652
6566
  {
5653
- title: /* @__PURE__ */ React12.createElement(TitleLabel, null, "Secrets", /* @__PURE__ */ React12.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
6567
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Secrets", /* @__PURE__ */ React14.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
5654
6568
  colorScheme,
5655
6569
  open: showSecrets,
5656
6570
  setOpen: setShowSecrets,
5657
- right: /* @__PURE__ */ React12.createElement(
6571
+ right: /* @__PURE__ */ React14.createElement(
5658
6572
  StateInspectorButton,
5659
6573
  {
5660
6574
  theme,
@@ -5669,7 +6583,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5669
6583
  "Create"
5670
6584
  )
5671
6585
  },
5672
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React12.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: secret, theme }), /* @__PURE__ */ React12.createElement(
6586
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React14.createElement(ObjectInspector4, { data: secret, theme }), /* @__PURE__ */ React14.createElement(
5673
6587
  StateInspectorButton,
5674
6588
  {
5675
6589
  theme,
@@ -5679,15 +6593,15 @@ var StateInspector = memoGeneric(function StateInspector2({
5679
6593
  ))))
5680
6594
  ),
5681
6595
  " ",
5682
- /* @__PURE__ */ React12.createElement(
6596
+ /* @__PURE__ */ React14.createElement(
5683
6597
  StateInspectorDisclosureSection,
5684
6598
  {
5685
6599
  open: showInputs,
5686
6600
  setOpen: setShowInputs,
5687
- title: /* @__PURE__ */ React12.createElement(TitleLabel, null, "Inputs", /* @__PURE__ */ React12.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
6601
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Inputs", /* @__PURE__ */ React14.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
5688
6602
  colorScheme
5689
6603
  },
5690
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React12.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ React12.createElement(
6604
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React14.createElement(ObjectInspector4, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ React14.createElement(
5691
6605
  "div",
5692
6606
  {
5693
6607
  style: {
@@ -5698,15 +6612,15 @@ var StateInspector = memoGeneric(function StateInspector2({
5698
6612
  gap: "4px"
5699
6613
  }
5700
6614
  },
5701
- /* @__PURE__ */ React12.createElement("span", null, "No inputs")
6615
+ /* @__PURE__ */ React14.createElement("span", null, "No inputs")
5702
6616
  ))
5703
6617
  ),
5704
- /* @__PURE__ */ React12.createElement(
6618
+ /* @__PURE__ */ React14.createElement(
5705
6619
  StateInspectorDisclosureSection,
5706
6620
  {
5707
6621
  open: showOutputTransforms,
5708
6622
  setOpen: setShowOutputTransforms,
5709
- title: /* @__PURE__ */ React12.createElement(TitleLabel, null, "Output Transforms", /* @__PURE__ */ React12.createElement(
6623
+ title: /* @__PURE__ */ React14.createElement(StateInspectorTitleLabel, null, "Output Transforms", /* @__PURE__ */ React14.createElement(
5710
6624
  ColoredDot,
5711
6625
  {
5712
6626
  type: outputTransformsInitialized ? "success" : "error"
@@ -5714,7 +6628,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5714
6628
  )),
5715
6629
  colorScheme
5716
6630
  },
5717
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React12.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React12.createElement(ObjectInspector3, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ React12.createElement(
6631
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React14.createElement(ObjectInspector4, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ React14.createElement(
5718
6632
  "div",
5719
6633
  {
5720
6634
  style: {
@@ -5725,10 +6639,10 @@ var StateInspector = memoGeneric(function StateInspector2({
5725
6639
  gap: "4px"
5726
6640
  }
5727
6641
  },
5728
- /* @__PURE__ */ React12.createElement("span", null, "No output transforms")
6642
+ /* @__PURE__ */ React14.createElement("span", null, "No output transforms")
5729
6643
  ))
5730
6644
  ),
5731
- /* @__PURE__ */ React12.createElement(
6645
+ /* @__PURE__ */ React14.createElement(
5732
6646
  StateInspectorDisclosureSection,
5733
6647
  {
5734
6648
  title: "Tasks",
@@ -5736,7 +6650,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5736
6650
  open: showTasks,
5737
6651
  setOpen: setShowTasks
5738
6652
  },
5739
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React12.createElement(
6653
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React14.createElement(
5740
6654
  StateInspectorRow,
5741
6655
  {
5742
6656
  key: task.id,
@@ -5745,8 +6659,8 @@ var StateInspector = memoGeneric(function StateInspector2({
5745
6659
  backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
5746
6660
  }
5747
6661
  },
5748
- /* @__PURE__ */ React12.createElement(
5749
- ObjectInspector3,
6662
+ /* @__PURE__ */ React14.createElement(
6663
+ ObjectInspector4,
5750
6664
  {
5751
6665
  name: task.name,
5752
6666
  data: task.payload,
@@ -5755,7 +6669,7 @@ var StateInspector = memoGeneric(function StateInspector2({
5755
6669
  )
5756
6670
  )))
5757
6671
  ),
5758
- /* @__PURE__ */ React12.createElement(
6672
+ /* @__PURE__ */ React14.createElement(
5759
6673
  StateInspectorDisclosureSection,
5760
6674
  {
5761
6675
  open: showEphemeral,
@@ -5763,8 +6677,8 @@ var StateInspector = memoGeneric(function StateInspector2({
5763
6677
  title: "Ephemeral User Data",
5764
6678
  colorScheme
5765
6679
  },
5766
- /* @__PURE__ */ React12.createElement(StateInspectorDisclosureRowInner, null, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React12.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React12.createElement(
5767
- ObjectInspector3,
6680
+ /* @__PURE__ */ React14.createElement(StateInspectorDisclosureRowInner, null, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React14.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React14.createElement(
6681
+ ObjectInspector4,
5768
6682
  {
5769
6683
  name: key,
5770
6684
  data: value,
@@ -5773,7 +6687,17 @@ var StateInspector = memoGeneric(function StateInspector2({
5773
6687
  }
5774
6688
  ))))
5775
6689
  ),
5776
- /* @__PURE__ */ React12.createElement(
6690
+ /* @__PURE__ */ React14.createElement(
6691
+ ActivityEventsSection,
6692
+ {
6693
+ colorScheme,
6694
+ activityEventsContainerRef,
6695
+ showEvents: showActivityEvents,
6696
+ setShowEvents: setShowActivityEvents,
6697
+ activityEventsManager
6698
+ }
6699
+ ),
6700
+ /* @__PURE__ */ React14.createElement(
5777
6701
  EventsSection,
5778
6702
  {
5779
6703
  connectionEvents,
@@ -5785,9 +6709,6 @@ var StateInspector = memoGeneric(function StateInspector2({
5785
6709
  )
5786
6710
  );
5787
6711
  });
5788
- function TitleLabel({ children }) {
5789
- return /* @__PURE__ */ React12.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
5790
- }
5791
6712
 
5792
6713
  // src/inspector/useStateInspector.tsx
5793
6714
  function createShadowRootElement() {
@@ -5804,7 +6725,7 @@ function useStateInspector({
5804
6725
  colorScheme,
5805
6726
  anchor
5806
6727
  }) {
5807
- const [root, setRoot] = React13.useState(null);
6728
+ const [root, setRoot] = React15.useState(null);
5808
6729
  useIsomorphicLayoutEffect(() => {
5809
6730
  if (disabled) return;
5810
6731
  const { host, container } = createShadowRootElement();
@@ -5818,7 +6739,7 @@ function useStateInspector({
5818
6739
  useIsomorphicLayoutEffect(() => {
5819
6740
  if (!root) return;
5820
6741
  root.render(
5821
- /* @__PURE__ */ React13.createElement(
6742
+ /* @__PURE__ */ React15.createElement(
5822
6743
  StateInspector,
5823
6744
  {
5824
6745
  colorScheme,
@@ -5831,10 +6752,10 @@ function useStateInspector({
5831
6752
  }
5832
6753
 
5833
6754
  // src/hooks.ts
5834
- function useSyncStateManager(stateManager, path) {
6755
+ function useSyncStateManager(stateManager, path2) {
5835
6756
  const getSnapshot = useCallback2(
5836
- () => typeof path === "string" ? stateManager.getState(path) : stateManager.getState(),
5837
- [stateManager, path]
6757
+ () => typeof path2 === "string" ? stateManager.getState(path2) : stateManager.getState(),
6758
+ [stateManager, path2]
5838
6759
  );
5839
6760
  return useSyncExternalStore2(
5840
6761
  stateManager.addListener,
@@ -5843,7 +6764,7 @@ function useSyncStateManager(stateManager, path) {
5843
6764
  );
5844
6765
  }
5845
6766
  function useManagedState(createInitialState, options) {
5846
- const [stateManager] = useState(
6767
+ const [stateManager] = useState2(
5847
6768
  () => new StateManager(createInitialState(), options)
5848
6769
  );
5849
6770
  const state = useSyncStateManager(stateManager);
@@ -5895,7 +6816,7 @@ function useMultiplayerState(initialState, options) {
5895
6816
  inspector,
5896
6817
  ...rest
5897
6818
  } = options ?? {};
5898
- const [noyaManager] = useState(
6819
+ const [noyaManager] = useState2(
5899
6820
  () => new NoyaManager2(initialState, rest)
5900
6821
  );
5901
6822
  const state = useObservable(
@@ -5984,7 +6905,7 @@ function parseAppDataParameter(options) {
5984
6905
  function getAppData(initialState, schema, options) {
5985
6906
  const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
5986
6907
  let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
5987
- if (options?.overrideExistingState) {
6908
+ if (options?.overrideExistingState || appData.initialState === null) {
5988
6909
  appData.initialState = resolvedInitialState;
5989
6910
  }
5990
6911
  appData.initialState = enforceSchema(appData.initialState, schema);
@@ -6000,7 +6921,7 @@ function useNoyaState(...args) {
6000
6921
  theme,
6001
6922
  viewType
6002
6923
  }
6003
- ] = useState2(() => {
6924
+ ] = useState3(() => {
6004
6925
  return getAppData(initialState, options?.schema, {
6005
6926
  overrideExistingState: options?.overrideExistingState
6006
6927
  });
@@ -6138,6 +7059,25 @@ var ConnectedUsersContext = createContext(void 0);
6138
7059
  function useConnectedUsersManager() {
6139
7060
  return useContext(ConnectedUsersContext);
6140
7061
  }
7062
+ function useConnectedUsers() {
7063
+ const connectedUsersManager = useConnectedUsersManager();
7064
+ return useObservable(connectedUsersManager?.connectedUsers$);
7065
+ }
7066
+ function useConnectedUser(userId) {
7067
+ const connectedUsersManager = useConnectedUsersManager();
7068
+ return useObservable(
7069
+ connectedUsersManager?.connectedUsers$,
7070
+ useCallback3(
7071
+ (users) => {
7072
+ return users.find((user) => {
7073
+ const prefix = user.id.slice(0, 8);
7074
+ return userId?.includes(prefix);
7075
+ });
7076
+ },
7077
+ [userId]
7078
+ )
7079
+ );
7080
+ }
6141
7081
  var AnyEphemeralUserDataManagerContext = createContext(void 0);
6142
7082
  function useAnyEphemeralUserData() {
6143
7083
  return useContext(AnyEphemeralUserDataManagerContext);
@@ -6146,6 +7086,125 @@ function useCurrentUserId() {
6146
7086
  const connectedUsersManager = useConnectedUsersManager();
6147
7087
  return useObservable(connectedUsersManager?.currentUserId$);
6148
7088
  }
7089
+ function useIsProcessing() {
7090
+ const { noyaManager } = useAnyNoyaStateContext();
7091
+ return useObservable(noyaManager.isProcessing$);
7092
+ }
7093
+ function useResourceManager() {
7094
+ const { noyaManager } = useAnyNoyaStateContext();
7095
+ return noyaManager.resourceManager;
7096
+ }
7097
+ function resourceToMediaItem(resource) {
7098
+ switch (resource.type) {
7099
+ case "asset":
7100
+ return { kind: "asset", id: resource.id, assetId: resource.assetId };
7101
+ case "file":
7102
+ return { kind: "noyaFile", id: resource.id, fileId: resource.fileId };
7103
+ default:
7104
+ return { kind: "folder", id: resource.id };
7105
+ }
7106
+ }
7107
+ function useResources({
7108
+ shouldDeleteAssets = true
7109
+ } = {}) {
7110
+ const resourceManager = useResourceManager();
7111
+ const assetManager = useAssetManager();
7112
+ const resourceMap = useObservable(
7113
+ resourceManager.optimisticResources$,
7114
+ useCallback3((resources) => {
7115
+ return Object.fromEntries(
7116
+ resources.map((resource) => [resource.path, resource])
7117
+ );
7118
+ }, [])
7119
+ );
7120
+ const setResourceMap = useCallback3(
7121
+ async (action) => {
7122
+ const newResourceMap = action instanceof Function ? action(resourceMap) : action;
7123
+ const { addedResources, removedResources, modifiedResources } = diffResourceMaps(resourceMap, newResourceMap, "id");
7124
+ if (addedResources.length > 0) {
7125
+ const payload = addedResources.map((resource) => {
7126
+ switch (resource.type) {
7127
+ case "directory":
7128
+ return {
7129
+ path: resource.path,
7130
+ type: "directory"
7131
+ };
7132
+ case "asset":
7133
+ return {
7134
+ path: resource.path,
7135
+ type: "asset",
7136
+ assetId: resource.assetId,
7137
+ asset: resource.asset
7138
+ };
7139
+ case "file":
7140
+ return {
7141
+ path: resource.path,
7142
+ type: "file",
7143
+ fileId: resource.fileId
7144
+ };
7145
+ case "resource":
7146
+ return {
7147
+ path: resource.path,
7148
+ type: "resource",
7149
+ fileId: resource.fileId,
7150
+ resourceId: resource.resourceId
7151
+ };
7152
+ default:
7153
+ throw new Error(
7154
+ `Unknown resource type: ${resource.type}`
7155
+ );
7156
+ }
7157
+ });
7158
+ await resourceManager.createResource(payload);
7159
+ }
7160
+ for (const resource of removedResources) {
7161
+ await resourceManager.deleteResource({ id: resource.id });
7162
+ if (shouldDeleteAssets && resource.type === "asset") {
7163
+ try {
7164
+ await assetManager.delete(resource.assetId);
7165
+ } catch (error) {
7166
+ console.error("Failed to delete asset:", error);
7167
+ }
7168
+ }
7169
+ }
7170
+ await Promise.all(
7171
+ modifiedResources.map(
7172
+ ({ id, path: path2, assetId, asset }) => resourceManager.updateResource({
7173
+ id,
7174
+ path: path2,
7175
+ assetId,
7176
+ asset
7177
+ })
7178
+ )
7179
+ );
7180
+ },
7181
+ [resourceMap, resourceManager, shouldDeleteAssets, assetManager]
7182
+ );
7183
+ return [resourceMap, setResourceMap];
7184
+ }
7185
+ var emptyArray = [];
7186
+ function useActivityEvents(streamFilter) {
7187
+ const { noyaManager } = useAnyNoyaStateContext();
7188
+ return useActivityEventsForManager(
7189
+ streamFilter,
7190
+ noyaManager.activityEventsManager
7191
+ );
7192
+ }
7193
+ function useActivityEventsForManager(streamFilter, activityEventsManager) {
7194
+ const [streamId, setStreamId] = useState4(void 0);
7195
+ const stableStreamFilter = useJsonMemo(streamFilter);
7196
+ useEffect4(() => {
7197
+ if (!stableStreamFilter) return;
7198
+ const streamId2 = activityEventsManager.subscribe(stableStreamFilter);
7199
+ setStreamId(streamId2);
7200
+ return () => {
7201
+ setStreamId(void 0);
7202
+ activityEventsManager.unsubscribe(streamId2);
7203
+ };
7204
+ }, [activityEventsManager, stableStreamFilter]);
7205
+ const observable = streamId ? activityEventsManager.getStream(streamId) : void 0;
7206
+ return useObservable(observable) ?? emptyArray;
7207
+ }
6149
7208
  var FallbackUntilInitialized = ({
6150
7209
  children,
6151
7210
  fallback
@@ -6162,6 +7221,24 @@ function createNoyaContext({
6162
7221
  }) {
6163
7222
  const NoyaStateContext = AnyNoyaStateContext;
6164
7223
  const EphemeralUserDataManagerContext = AnyEphemeralUserDataManagerContext;
7224
+ function NoyaContextProvider({
7225
+ children,
7226
+ contextValue
7227
+ }) {
7228
+ return /* @__PURE__ */ React16.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, /* @__PURE__ */ React16.createElement(
7229
+ ConnectedUsersContext.Provider,
7230
+ {
7231
+ value: contextValue.noyaManager.connectedUsersManager
7232
+ },
7233
+ /* @__PURE__ */ React16.createElement(
7234
+ EphemeralUserDataManagerContext.Provider,
7235
+ {
7236
+ value: contextValue.noyaManager.ephemeralUserDataManager
7237
+ },
7238
+ children
7239
+ )
7240
+ ));
7241
+ }
6165
7242
  function NoyaStateProvider({
6166
7243
  children,
6167
7244
  initialState,
@@ -6186,53 +7263,41 @@ function createNoyaContext({
6186
7263
  }),
6187
7264
  [noyaManager, theme, viewType]
6188
7265
  );
6189
- return /* @__PURE__ */ React14.createElement(AnyNoyaStateContext.Provider, { value: contextValue }, /* @__PURE__ */ React14.createElement(
6190
- ConnectedUsersContext.Provider,
6191
- {
6192
- value: noyaManager.connectedUsersManager
6193
- },
6194
- /* @__PURE__ */ React14.createElement(
6195
- EphemeralUserDataManagerContext.Provider,
6196
- {
6197
- value: noyaManager.ephemeralUserDataManager
6198
- },
6199
- options.fallback !== void 0 ? /* @__PURE__ */ React14.createElement(FallbackUntilInitialized, { fallback: options.fallback }, children) : children
6200
- )
6201
- ));
7266
+ return /* @__PURE__ */ React16.createElement(NoyaContextProvider, { contextValue }, options.fallback !== void 0 ? /* @__PURE__ */ React16.createElement(FallbackUntilInitialized, { fallback: options.fallback }, children) : children);
6202
7267
  }
6203
- function useValue(path, options) {
7268
+ function useValue(path2, options) {
6204
7269
  const { noyaManager } = useAnyNoyaStateContext();
6205
- let actualPath = typeof path === "function" || !path ? "" : path;
7270
+ let actualPath = typeof path2 === "function" || !path2 ? "" : path2;
6206
7271
  const mappedObservable = useMemo4(() => {
6207
- if (typeof path === "function") {
6208
- return noyaManager.multiplayerStateManager.optimisticState$.map(path, {
7272
+ if (typeof path2 === "function") {
7273
+ return noyaManager.multiplayerStateManager.optimisticState$.map(path2, {
6209
7274
  isEqual: options?.isEqual
6210
7275
  });
6211
7276
  }
6212
7277
  return noyaManager.multiplayerStateManager.optimisticState$;
6213
- }, [noyaManager, path, options?.isEqual]);
7278
+ }, [noyaManager, path2, options?.isEqual]);
6214
7279
  const value = useObservable(mappedObservable, actualPath);
6215
7280
  return value;
6216
7281
  }
6217
- function useSetValue(path) {
7282
+ function useSetValue(path2) {
6218
7283
  const { noyaManager } = useAnyNoyaStateContext();
6219
7284
  const setValue = useCallback3(
6220
7285
  (...args) => {
6221
7286
  const [metadata, value] = args.length === 2 ? args : [{}, args[0]];
6222
7287
  noyaManager.multiplayerStateManager.setStateAtPath(
6223
7288
  metadata,
6224
- path ?? "",
7289
+ path2 ?? "",
6225
7290
  value
6226
7291
  );
6227
7292
  },
6228
- [noyaManager, path]
7293
+ [noyaManager, path2]
6229
7294
  );
6230
7295
  return setValue;
6231
7296
  }
6232
7297
  function useValueState(...args) {
6233
- const [selector, options, path] = args.length >= 1 && typeof args[0] === "function" ? [args[0], args[1], void 0] : [void 0, void 0, args[0]];
6234
- const value = useValue(selector ?? path ?? "", options);
6235
- const setValue = useSetValue(path ?? "");
7298
+ const [selector, options, path2] = args.length >= 1 && typeof args[0] === "function" ? [args[0], args[1], void 0] : [void 0, void 0, args[0]];
7299
+ const value = useValue(selector ?? path2 ?? "", options);
7300
+ const setValue = useSetValue(path2 ?? "");
6236
7301
  return [value, setValue];
6237
7302
  }
6238
7303
  function useStateManager() {
@@ -6296,6 +7361,7 @@ function createNoyaContext({
6296
7361
  return {
6297
7362
  Context: NoyaStateContext,
6298
7363
  Provider: NoyaStateProvider,
7364
+ NoyaContextProvider,
6299
7365
  useValue,
6300
7366
  useSetValue,
6301
7367
  useValueState,
@@ -6327,7 +7393,7 @@ function useCallableAITools() {
6327
7393
  // src/components/UserPointersOverlay.tsx
6328
7394
  import { Observable as Observable2 } from "@noya-app/observable";
6329
7395
  import { memoGeneric as memoGeneric2 } from "@noya-app/react-utils";
6330
- import React15, { useEffect as useEffect6, useMemo as useMemo5, useState as useState3 } from "react";
7396
+ import React17, { useEffect as useEffect6, useMemo as useMemo5, useState as useState5 } from "react";
6331
7397
  function shouldShow(hideAfter, updatedAt) {
6332
7398
  return !!updatedAt && Date.now() - updatedAt < hideAfter;
6333
7399
  }
@@ -6345,7 +7411,7 @@ var UserPointerInternal = memoGeneric2(function UserPointerInternal2({
6345
7411
  });
6346
7412
  }, [ephemeralUserDataManager, user.id]);
6347
7413
  const { metadata, data } = useObservable(observable);
6348
- const [, setForceUpdate] = useState3(0);
7414
+ const [, setForceUpdate] = useState5(0);
6349
7415
  const updatedAt = metadata?.updatedAt ?? 0;
6350
7416
  const show = shouldShow(hideAfter, updatedAt);
6351
7417
  useEffect6(() => {
@@ -6370,9 +7436,9 @@ var UserPointersOverlay = memoGeneric2(function UserPointers({
6370
7436
  }) {
6371
7437
  const currentUserId = useObservable(ephemeralUserDataManager.currentUserId$);
6372
7438
  const connectedUsers = useObservable(connectedUsersManager.connectedUsers$);
6373
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, connectedUsers.map((user) => {
7439
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, connectedUsers.map((user) => {
6374
7440
  if (user.id === currentUserId) return null;
6375
- return /* @__PURE__ */ React15.createElement(
7441
+ return /* @__PURE__ */ React17.createElement(
6376
7442
  UserPointerInternal,
6377
7443
  {
6378
7444
  key: user.id,
@@ -6483,7 +7549,10 @@ export {
6483
7549
  importAll,
6484
7550
  parseAppDataParameter,
6485
7551
  replaceDeep,
7552
+ resourceToMediaItem,
6486
7553
  useAIManager,
7554
+ useActivityEvents,
7555
+ useActivityEventsForManager,
6487
7556
  useAnyEphemeralUserData,
6488
7557
  useAnyNoyaManager,
6489
7558
  useAnyNoyaStateContext,
@@ -6492,11 +7561,14 @@ export {
6492
7561
  useAssets,
6493
7562
  useCallableAITools,
6494
7563
  useColorScheme,
7564
+ useConnectedUser,
7565
+ useConnectedUsers,
6495
7566
  useConnectedUsersManager,
6496
7567
  useCurrentUserId,
6497
7568
  useIOManager,
6498
7569
  useInputs,
6499
7570
  useIsInitialized,
7571
+ useIsProcessing,
6500
7572
  useManagedHistory,
6501
7573
  useManagedState,
6502
7574
  useMultiplayerState,
@@ -6506,6 +7578,8 @@ export {
6506
7578
  usePipelineManager,
6507
7579
  usePublish,
6508
7580
  useRegisterAITool,
7581
+ useResourceManager,
7582
+ useResources,
6509
7583
  useSecret,
6510
7584
  useSecretManager,
6511
7585
  useSecrets,