@noya-app/noya-api-client-react 0.1.43 → 0.1.45

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
@@ -7449,22 +7449,16 @@ var jwt;
7449
7449
  jwt2.DEFAULT_HEADER = HEADER;
7450
7450
  })(jwt || (jwt = {}));
7451
7451
 
7452
- // ../state-manager/src/MenuManager.ts
7453
- import { isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
7452
+ // ../state-manager/src/LogManager.ts
7454
7453
  import { Observable as Observable7 } from "@noya-app/observable";
7455
7454
 
7456
- // ../state-manager/src/multiplayer.ts
7457
- import { Cache, hash, uuid as uuid4, isDeepEqual as isDeepEqual3 } from "@noya-app/noya-utils";
7458
- import { Observable as Observable9, get as get2, set as set2 } from "@noya-app/observable";
7459
-
7460
- // ../state-manager/src/stateManager.ts
7461
- import {
7462
- Observable as Observable8,
7463
- get as getPath2
7464
- } from "@noya-app/observable";
7455
+ // ../state-manager/src/MenuManager.ts
7456
+ import { isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
7457
+ import { Observable as Observable8 } from "@noya-app/observable";
7465
7458
 
7466
7459
  // ../state-manager/src/multiplayer.ts
7467
- var createHash = (value, options) => hash(value, { ...options, ignoreUndefinedProperties: true });
7460
+ import { Cache, hash, isDeepEqual as isDeepEqual4, uuid as uuid5 } from "@noya-app/noya-utils";
7461
+ import { Observable as Observable10, get as get2, set as set2 } from "@noya-app/observable";
7468
7462
 
7469
7463
  // ../../node_modules/@marcbachmann/cel-js/lib/errors.js
7470
7464
  var ParseError = class extends Error {
@@ -10442,7 +10436,7 @@ var globalEnvironment = new Environment({
10442
10436
  });
10443
10437
 
10444
10438
  // ../state-manager/src/multiplayerPolicies.ts
10445
- import { uuid as uuid5 } from "@noya-app/noya-utils";
10439
+ import { uuid as uuid4 } from "@noya-app/noya-utils";
10446
10440
  var celEnvironment = new Environment({
10447
10441
  unlistedVariablesAreDyn: true
10448
10442
  });
@@ -10477,12 +10471,24 @@ celEnvironment.registerFunction("random(): double", () => Math.random()).registe
10477
10471
  const nowValue = typeof nowVariable?.value === "number" ? nowVariable.value : typeof nowVariable?.value === "string" ? Number(nowVariable.value) : Date.now();
10478
10472
  return new Date(nowValue).toISOString();
10479
10473
  }
10480
- ).registerFunction("uuid(): string", () => uuid5());
10474
+ ).registerFunction("uuid(): string", () => uuid4());
10481
10475
  var READ_DENIED = Symbol("readDenied");
10482
10476
 
10477
+ // ../state-manager/src/serverScripts.ts
10478
+ import { uuid as createUuid, isDeepEqual as isDeepEqual3 } from "@noya-app/noya-utils";
10479
+
10480
+ // ../state-manager/src/stateManager.ts
10481
+ import {
10482
+ Observable as Observable9,
10483
+ get as getPath2
10484
+ } from "@noya-app/observable";
10485
+
10486
+ // ../state-manager/src/multiplayer.ts
10487
+ var createHash = (value, options) => hash(value, { ...options, ignoreUndefinedProperties: true });
10488
+
10483
10489
  // ../state-manager/src/NoyaManager.ts
10484
- import { uuid as uuid9 } from "@noya-app/noya-utils";
10485
- import { Observable as Observable17, set as set3 } from "@noya-app/observable";
10490
+ import { uuid as uuid12 } from "@noya-app/noya-utils";
10491
+ import { Observable as Observable21, set as set3 } from "@noya-app/observable";
10486
10492
 
10487
10493
  // ../noya-pipeline/src/graphToTasks.ts
10488
10494
  import { get as get3 } from "@noya-app/observable";
@@ -10587,40 +10593,163 @@ var pipelineSchema = Type.Object(
10587
10593
  );
10588
10594
 
10589
10595
  // ../state-manager/src/PipelineManager.ts
10590
- import { Observable as Observable10 } from "@noya-app/observable";
10596
+ import { Observable as Observable11 } from "@noya-app/observable";
10591
10597
 
10592
10598
  // ../state-manager/src/PublishingManager.ts
10593
- import { Observable as Observable11 } from "@noya-app/observable";
10599
+ import { Observable as Observable12 } from "@noya-app/observable";
10594
10600
 
10595
10601
  // ../state-manager/src/ResourceManager.ts
10596
- import { isDeepEqual as isDeepEqual4, uuid as uuid7 } from "@noya-app/noya-utils";
10597
- import { Observable as Observable12 } from "@noya-app/observable";
10602
+ import { isDeepEqual as isDeepEqual5, uuid as uuid7 } from "@noya-app/noya-utils";
10603
+ import { Observable as Observable13 } from "@noya-app/observable";
10604
+
10605
+ // ../state-manager/src/SandboxManager.ts
10606
+ import { Observable as Observable14 } from "@noya-app/observable";
10598
10607
 
10599
10608
  // ../state-manager/src/rpcManager.ts
10600
10609
  import { uuid as uuid8 } from "@noya-app/noya-utils";
10601
- import { Observable as Observable13 } from "@noya-app/observable";
10610
+ import { Observable as Observable15 } from "@noya-app/observable";
10602
10611
 
10603
10612
  // ../state-manager/src/SecretManager.ts
10604
- import { Observable as Observable14 } from "@noya-app/observable";
10613
+ import { Observable as Observable16 } from "@noya-app/observable";
10605
10614
 
10606
10615
  // ../state-manager/src/TaskManager.ts
10607
- import { Observable as Observable15 } from "@noya-app/observable";
10616
+ import { Observable as Observable17 } from "@noya-app/observable";
10617
+
10618
+ // ../state-manager/src/TranscriptionManager.ts
10619
+ import { Base64 as Base642 } from "@noya-app/noya-utils";
10620
+ import { Observable as Observable18 } from "@noya-app/observable";
10608
10621
 
10609
10622
  // ../state-manager/src/UserManager.ts
10610
- import { Observable as Observable16 } from "@noya-app/observable";
10623
+ import { Observable as Observable20 } from "@noya-app/observable";
10611
10624
 
10612
- // ../state-manager/src/NoyaManager.ts
10613
- var createMutatorParametersSchema = Type.Object({
10614
- sourceCode: Type.String({
10615
- description: "The source code of the mutator function."
10616
- }),
10617
- message: Type.String({
10618
- description: `A message that summarizes the changes made to the document state.`
10619
- })
10620
- });
10625
+ // ../state-manager/src/sync/clientId.ts
10626
+ import { uuid as uuid9 } from "@noya-app/noya-utils";
10627
+ import { Observable as Observable19 } from "@noya-app/observable";
10628
+
10629
+ // ../state-manager/src/sync/defaultNames.ts
10630
+ import { upperFirst } from "@noya-app/noya-utils";
10631
+ var animals = [
10632
+ "cat",
10633
+ "dog",
10634
+ "owl",
10635
+ "fish",
10636
+ "horse",
10637
+ "rabbit",
10638
+ "snake",
10639
+ "lion",
10640
+ "bear",
10641
+ "wolf",
10642
+ "fox",
10643
+ "elephant",
10644
+ "giraffe",
10645
+ "zebra",
10646
+ "panda",
10647
+ "monkey",
10648
+ "penguin",
10649
+ "koala",
10650
+ "kangaroo",
10651
+ "whale",
10652
+ "shark",
10653
+ "turtle",
10654
+ "crocodile",
10655
+ "hippo"
10656
+ ];
10657
+ var adjectives = [
10658
+ "happy",
10659
+ "sleepy",
10660
+ "hungry",
10661
+ "thirsty",
10662
+ "healthy",
10663
+ "rich",
10664
+ "funky",
10665
+ "cool",
10666
+ "awesome",
10667
+ "amazing",
10668
+ "fantastic",
10669
+ "incredible",
10670
+ "super",
10671
+ "mega",
10672
+ "ultra"
10673
+ ];
10674
+ function randomElement(array) {
10675
+ return array[Math.floor(Math.random() * array.length)];
10676
+ }
10677
+ function getClientImageUrl(animal) {
10678
+ return `https://avatars.noya.site/animals/animals_${animal}.svg`;
10679
+ }
10680
+ function randomClientIdentity() {
10681
+ const animal = randomElement(animals);
10682
+ const name = `${upperFirst(randomElement(adjectives))} ${upperFirst(animal)}`;
10683
+ return {
10684
+ name,
10685
+ animal,
10686
+ image: getClientImageUrl(animal)
10687
+ };
10688
+ }
10689
+ function getClientAnimalFromName(name) {
10690
+ const parts = name.trim().split(/\s+/);
10691
+ const possibleAnimal = parts[parts.length - 1]?.toLowerCase();
10692
+ if (!possibleAnimal) return void 0;
10693
+ return animals.includes(possibleAnimal) ? possibleAnimal : void 0;
10694
+ }
10695
+
10696
+ // ../state-manager/src/sync/clientId.ts
10697
+ var CLIENT_ID_STORAGE_KEY = "noya-client-id";
10698
+ var CLIENT_NAME_STORAGE_KEY = "noya-client-name";
10699
+ var CLIENT_IMAGE_STORAGE_KEY = "noya-client-image";
10700
+ var clientId$ = new Observable19(void 0);
10701
+ var clientName$ = new Observable19(void 0);
10702
+ var clientImage$ = new Observable19(void 0);
10703
+ var safeGetItem = (key) => {
10704
+ try {
10705
+ return typeof localStorage !== "undefined" ? localStorage.getItem(key) : null;
10706
+ } catch {
10707
+ return null;
10708
+ }
10709
+ };
10710
+ var safeSetItem = (key, value) => {
10711
+ try {
10712
+ if (typeof localStorage !== "undefined") {
10713
+ localStorage.setItem(key, value);
10714
+ }
10715
+ } catch {
10716
+ }
10717
+ };
10718
+ if (typeof window !== "undefined") {
10719
+ const storedClientId = safeGetItem(CLIENT_ID_STORAGE_KEY);
10720
+ if (storedClientId) {
10721
+ clientId$.set(storedClientId);
10722
+ } else {
10723
+ const newClientId = uuid9();
10724
+ safeSetItem(CLIENT_ID_STORAGE_KEY, newClientId);
10725
+ clientId$.set(newClientId);
10726
+ }
10727
+ let storedClientName = safeGetItem(CLIENT_NAME_STORAGE_KEY) ?? void 0;
10728
+ let storedClientImage = safeGetItem(CLIENT_IMAGE_STORAGE_KEY) ?? void 0;
10729
+ const newIdentity = randomClientIdentity();
10730
+ if (!storedClientName) {
10731
+ storedClientName = newIdentity.name;
10732
+ safeSetItem(CLIENT_NAME_STORAGE_KEY, storedClientName);
10733
+ }
10734
+ if (!storedClientImage) {
10735
+ const animal = (storedClientName && getClientAnimalFromName(storedClientName)) ?? newIdentity.animal;
10736
+ if (animal) {
10737
+ storedClientImage = getClientImageUrl(animal);
10738
+ safeSetItem(CLIENT_IMAGE_STORAGE_KEY, storedClientImage);
10739
+ }
10740
+ }
10741
+ clientName$.set(storedClientName);
10742
+ clientImage$.set(storedClientImage);
10743
+ }
10744
+
10745
+ // ../state-manager/src/sync/syncUtils.ts
10746
+ import { uuid as uuid10 } from "@noya-app/noya-utils";
10621
10747
 
10622
10748
  // ../state-manager/src/sync/localRpcHelpers.ts
10623
- import { Base64 as Base642 } from "@noya-app/noya-utils";
10749
+ import { Base64 as Base643 } from "@noya-app/noya-utils";
10750
+
10751
+ // ../state-manager/src/sync/localStorageSync.ts
10752
+ import { uuid as uuid11 } from "@noya-app/noya-utils";
10624
10753
 
10625
10754
  // ../noya-keymap/src/hooks.ts
10626
10755
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
@@ -10732,12 +10861,22 @@ var MenuItemTree = (0, import_tree_visit3.defineTree)((node) => {
10732
10861
  return node.type === "submenu" ? node.items : [];
10733
10862
  });
10734
10863
 
10864
+ // ../state-manager/src/NoyaManager.ts
10865
+ var createMutatorParametersSchema = Type.Object({
10866
+ sourceCode: Type.String({
10867
+ description: "The source code of the mutator function."
10868
+ }),
10869
+ message: Type.String({
10870
+ description: `A message that summarizes the changes made to the document state.`
10871
+ })
10872
+ });
10873
+
10735
10874
  // ../noya-multiplayer-react/src/ai.ts
10736
10875
  import { useEffect as useEffect17 } from "react";
10737
10876
 
10738
10877
  // ../noya-multiplayer-react/src/NoyaStateContext.tsx
10739
10878
  import {
10740
- Observable as Observable18
10879
+ Observable as Observable22
10741
10880
  } from "@noya-app/observable";
10742
10881
 
10743
10882
  // ../noya-react-utils/src/components/AutoSizer.tsx
@@ -10920,7 +11059,7 @@ var FileDropTarget = memoGeneric(function FileDropTarget2({ children, onDropFile
10920
11059
  import { useCallback as useCallback4, useState as useState3 } from "react";
10921
11060
 
10922
11061
  // ../noya-react-utils/src/hooks/useDeepArray.ts
10923
- import { isDeepEqual as isDeepEqual5 } from "@noya-app/noya-utils";
11062
+ import { isDeepEqual as isDeepEqual6 } from "@noya-app/noya-utils";
10924
11063
  import { useMemo as useMemo3, useState as useState4 } from "react";
10925
11064
  function useJsonMemo(value) {
10926
11065
  const stringified = useMemo3(
@@ -10935,7 +11074,7 @@ function useJsonMemo(value) {
10935
11074
  }
10936
11075
 
10937
11076
  // ../noya-react-utils/src/hooks/useDeepState.ts
10938
- import { isDeepEqual as isDeepEqual6 } from "@noya-app/noya-utils";
11077
+ import { isDeepEqual as isDeepEqual7 } from "@noya-app/noya-utils";
10939
11078
  import { useCallback as useCallback5, useMemo as useMemo4, useState as useState5 } from "react";
10940
11079
 
10941
11080
  // ../noya-react-utils/src/hooks/useFetch.ts
@@ -11044,7 +11183,7 @@ function downloadBlob(...params) {
11044
11183
  }
11045
11184
 
11046
11185
  // ../noya-multiplayer-react/src/NoyaStateContext.tsx
11047
- import React34, {
11186
+ import React36, {
11048
11187
  createContext as createContext3,
11049
11188
  useCallback as useCallback14,
11050
11189
  useContext as useContext4,
@@ -11143,12 +11282,12 @@ var ErrorOverlay = React6.memo(function ErrorOverlay2({
11143
11282
  });
11144
11283
 
11145
11284
  // ../noya-multiplayer-react/src/inspector/useStateInspector.tsx
11146
- import React31 from "react";
11285
+ import React34 from "react";
11147
11286
  import { createRoot } from "react-dom/client";
11148
11287
 
11149
11288
  // ../noya-multiplayer-react/src/inspector/StateInspector.tsx
11150
- import { Base64 as Base643, memoize as memoize2, uuid as uuid10 } from "@noya-app/noya-utils";
11151
- import React30, {
11289
+ import { Base64 as Base644, memoize as memoize2, uuid as uuid13 } from "@noya-app/noya-utils";
11290
+ import React33, {
11152
11291
  useCallback as useCallback12,
11153
11292
  useEffect as useEffect13,
11154
11293
  useLayoutEffect as useLayoutEffect4
@@ -12731,7 +12870,9 @@ function EventsSection({
12731
12870
  setShowEvents,
12732
12871
  colorScheme,
12733
12872
  eventsContainerRef,
12734
- connectionEvents
12873
+ connectionEvents,
12874
+ paused,
12875
+ onTogglePaused
12735
12876
  }) {
12736
12877
  const theme3 = getStateInspectorTheme(colorScheme);
12737
12878
  return /* @__PURE__ */ React25.createElement(
@@ -12740,9 +12881,20 @@ function EventsSection({
12740
12881
  open: showEvents,
12741
12882
  setOpen: setShowEvents,
12742
12883
  title: "Events",
12743
- colorScheme
12884
+ colorScheme,
12885
+ right: /* @__PURE__ */ React25.createElement(StateInspectorButton, { theme: theme3, onClick: onTogglePaused }, paused ? "Resume" : "Pause")
12744
12886
  },
12745
- /* @__PURE__ */ React25.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, connectionEvents?.map(
12887
+ /* @__PURE__ */ React25.createElement(StateInspectorDisclosureRowInner, { ref: eventsContainerRef }, paused && /* @__PURE__ */ React25.createElement(
12888
+ "div",
12889
+ {
12890
+ style: {
12891
+ padding: "4px 12px",
12892
+ fontSize: "11px",
12893
+ opacity: 0.7
12894
+ }
12895
+ },
12896
+ "Event streaming paused"
12897
+ ), connectionEvents?.map(
12746
12898
  (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React25.createElement(StateInspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React25.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React25.createElement(
12747
12899
  StateInspectorRow,
12748
12900
  {
@@ -12773,7 +12925,7 @@ function EventsSection({
12773
12925
  }
12774
12926
  )
12775
12927
  )
12776
- ), !connectionEvents && /* @__PURE__ */ React25.createElement(
12928
+ ), !connectionEvents?.length && /* @__PURE__ */ React25.createElement(
12777
12929
  "div",
12778
12930
  {
12779
12931
  style: {
@@ -13008,6 +13160,117 @@ function HistorySection({
13008
13160
  );
13009
13161
  }
13010
13162
 
13163
+ // ../noya-multiplayer-react/src/inspector/sections/ServerScriptLogsSection.tsx
13164
+ import React27 from "react";
13165
+ var levelColors = {
13166
+ error: "#f87171",
13167
+ warn: "#facc15",
13168
+ log: "#9ca3af"
13169
+ };
13170
+ function formatTimestamp(timestamp) {
13171
+ return new Date(timestamp).toLocaleTimeString();
13172
+ }
13173
+ function ServerScriptLogsSection({
13174
+ showLogs,
13175
+ setShowLogs,
13176
+ colorScheme,
13177
+ logs,
13178
+ containerRef,
13179
+ paused,
13180
+ onTogglePaused,
13181
+ title = "Server Script Logs"
13182
+ }) {
13183
+ const theme3 = getStateInspectorTheme(colorScheme);
13184
+ return /* @__PURE__ */ React27.createElement(
13185
+ StateInspectorDisclosureSection,
13186
+ {
13187
+ open: showLogs,
13188
+ setOpen: setShowLogs,
13189
+ title,
13190
+ colorScheme,
13191
+ right: /* @__PURE__ */ React27.createElement(StateInspectorButton, { theme: theme3, onClick: onTogglePaused }, paused ? "Resume" : "Pause")
13192
+ },
13193
+ /* @__PURE__ */ React27.createElement(StateInspectorDisclosureRowInner, { ref: containerRef }, paused && /* @__PURE__ */ React27.createElement(
13194
+ "div",
13195
+ {
13196
+ style: {
13197
+ padding: "4px 12px",
13198
+ fontSize: "11px",
13199
+ opacity: 0.7
13200
+ }
13201
+ },
13202
+ "Log streaming paused"
13203
+ ), logs.map((log) => /* @__PURE__ */ React27.createElement(StateInspectorRow, { key: log.id, colorScheme }, /* @__PURE__ */ React27.createElement(
13204
+ "div",
13205
+ {
13206
+ style: {
13207
+ display: "flex",
13208
+ gap: "6px",
13209
+ alignItems: "center",
13210
+ fontSize: "10px",
13211
+ color: "inherit",
13212
+ marginBottom: log.values.length ? "4px" : 0,
13213
+ textTransform: "uppercase"
13214
+ }
13215
+ },
13216
+ /* @__PURE__ */ React27.createElement("span", null, formatTimestamp(log.timestamp)),
13217
+ /* @__PURE__ */ React27.createElement("span", { style: { color: levelColors[log.level] } }, log.level),
13218
+ (log.origin || log.target || log.mode) && /* @__PURE__ */ React27.createElement(
13219
+ "span",
13220
+ {
13221
+ style: {
13222
+ fontFamily: "monospace",
13223
+ textTransform: "none",
13224
+ fontSize: "10px",
13225
+ opacity: 0.75
13226
+ }
13227
+ },
13228
+ [log.origin ?? log.target, log.mode].filter(Boolean).join(" / ")
13229
+ ),
13230
+ /* @__PURE__ */ React27.createElement(
13231
+ "span",
13232
+ {
13233
+ style: {
13234
+ fontFamily: "monospace",
13235
+ textTransform: "none",
13236
+ fontSize: "10px"
13237
+ }
13238
+ },
13239
+ log.scriptId
13240
+ )
13241
+ ), /* @__PURE__ */ React27.createElement(
13242
+ "div",
13243
+ {
13244
+ style: {
13245
+ display: "flex",
13246
+ flexDirection: "column",
13247
+ gap: "4px"
13248
+ }
13249
+ },
13250
+ log.values.length > 0 ? log.values.map((value, index) => /* @__PURE__ */ React27.createElement(
13251
+ themedObjectInspector,
13252
+ {
13253
+ key: index,
13254
+ data: value,
13255
+ theme: theme3
13256
+ }
13257
+ )) : /* @__PURE__ */ React27.createElement("span", { style: { fontSize: "11px", opacity: 0.7 } }, "No data")
13258
+ ))), !logs?.length && /* @__PURE__ */ React27.createElement(
13259
+ "div",
13260
+ {
13261
+ style: {
13262
+ padding: "12px",
13263
+ fontSize: "12px",
13264
+ display: "flex",
13265
+ flexDirection: "column",
13266
+ gap: "4px"
13267
+ }
13268
+ },
13269
+ /* @__PURE__ */ React27.createElement("span", null, "No logs received")
13270
+ ))
13271
+ );
13272
+ }
13273
+
13011
13274
  // ../noya-multiplayer-react/src/inspector/zip/crc32.ts
13012
13275
  var CRC_TABLE = (() => {
13013
13276
  const t = new Uint32Array(256);
@@ -13532,15 +13795,15 @@ function decodeAll(buffer) {
13532
13795
  }
13533
13796
 
13534
13797
  // ../noya-multiplayer-react/src/inspector/StateInspectorTitleLabel.tsx
13535
- import React27 from "react";
13798
+ import React28 from "react";
13536
13799
  function StateInspectorTitleLabel({
13537
13800
  children
13538
13801
  }) {
13539
- return /* @__PURE__ */ React27.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
13802
+ return /* @__PURE__ */ React28.createElement("span", { style: { display: "flex", alignItems: "center", gap: "4px" } }, children);
13540
13803
  }
13541
13804
 
13542
13805
  // ../noya-multiplayer-react/src/inspector/StateInspectorToggleButton.tsx
13543
- import React28 from "react";
13806
+ import React29 from "react";
13544
13807
  function StateInspectorToggleButton({
13545
13808
  showInspector,
13546
13809
  setShowInspector,
@@ -13548,7 +13811,7 @@ function StateInspectorToggleButton({
13548
13811
  anchor
13549
13812
  }) {
13550
13813
  const isRightAnchor = anchor === "right";
13551
- const rightIcon = /* @__PURE__ */ React28.createElement(
13814
+ const rightIcon = /* @__PURE__ */ React29.createElement(
13552
13815
  "svg",
13553
13816
  {
13554
13817
  xmlns: "http://www.w3.org/2000/svg",
@@ -13558,7 +13821,7 @@ function StateInspectorToggleButton({
13558
13821
  stroke: "currentColor",
13559
13822
  className: "size-6"
13560
13823
  },
13561
- /* @__PURE__ */ React28.createElement(
13824
+ /* @__PURE__ */ React29.createElement(
13562
13825
  "path",
13563
13826
  {
13564
13827
  strokeLinecap: "round",
@@ -13567,7 +13830,7 @@ function StateInspectorToggleButton({
13567
13830
  }
13568
13831
  )
13569
13832
  );
13570
- const leftIcon = /* @__PURE__ */ React28.createElement(
13833
+ const leftIcon = /* @__PURE__ */ React29.createElement(
13571
13834
  "svg",
13572
13835
  {
13573
13836
  xmlns: "http://www.w3.org/2000/svg",
@@ -13577,7 +13840,7 @@ function StateInspectorToggleButton({
13577
13840
  stroke: "currentColor",
13578
13841
  className: "size-6"
13579
13842
  },
13580
- /* @__PURE__ */ React28.createElement(
13843
+ /* @__PURE__ */ React29.createElement(
13581
13844
  "path",
13582
13845
  {
13583
13846
  strokeLinecap: "round",
@@ -13586,7 +13849,7 @@ function StateInspectorToggleButton({
13586
13849
  }
13587
13850
  )
13588
13851
  );
13589
- return /* @__PURE__ */ React28.createElement(
13852
+ return /* @__PURE__ */ React29.createElement(
13590
13853
  "span",
13591
13854
  {
13592
13855
  role: "button",
@@ -13607,15 +13870,15 @@ function StateInspectorToggleButton({
13607
13870
  setShowInspector(!showInspector);
13608
13871
  }
13609
13872
  },
13610
- showInspector ? "Hide Inspector" : /* @__PURE__ */ React28.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
13873
+ showInspector ? "Hide Inspector" : /* @__PURE__ */ React29.createElement("span", { style: { width: "12px", height: "12px" } }, isRightAnchor ? rightIcon : leftIcon)
13611
13874
  );
13612
13875
  }
13613
13876
 
13614
13877
  // ../noya-multiplayer-react/src/inspector/useLocalStorageState.tsx
13615
- import React29 from "react";
13878
+ import React30 from "react";
13616
13879
  var localStorage2 = typeof window !== "undefined" ? window.localStorage : null;
13617
13880
  function useLocalStorageState(key, defaultValue) {
13618
- const [state, setState] = React29.useState(() => {
13881
+ const [state, setState] = React30.useState(() => {
13619
13882
  const value = localStorage2?.getItem(key);
13620
13883
  let result = defaultValue;
13621
13884
  if (value) {
@@ -13634,6 +13897,31 @@ function useLocalStorageState(key, defaultValue) {
13634
13897
  return [state, setLocalStorageState];
13635
13898
  }
13636
13899
 
13900
+ // ../noya-multiplayer-react/src/inspector/usePausedStream.ts
13901
+ import React31 from "react";
13902
+ function usePausedStream(items) {
13903
+ const [paused, setPaused] = React31.useState(false);
13904
+ const [visibleItems, setVisibleItems] = React31.useState(items ?? []);
13905
+ const togglePaused = React31.useCallback(() => {
13906
+ setPaused((value) => {
13907
+ if (!value) {
13908
+ setVisibleItems(items ?? []);
13909
+ }
13910
+ return !value;
13911
+ });
13912
+ }, [items]);
13913
+ React31.useEffect(() => {
13914
+ if (paused) return;
13915
+ setVisibleItems(items ?? []);
13916
+ }, [items, paused]);
13917
+ return {
13918
+ paused,
13919
+ setPaused,
13920
+ togglePaused,
13921
+ visibleItems
13922
+ };
13923
+ }
13924
+
13637
13925
  // ../noya-multiplayer-react/src/inspector/StateInspector.tsx
13638
13926
  var StateInspector = memoGeneric(function StateInspector2({
13639
13927
  noyaManager,
@@ -13648,22 +13936,25 @@ var StateInspector = memoGeneric(function StateInspector2({
13648
13936
  assetManager,
13649
13937
  userManager,
13650
13938
  secretManager,
13651
- ephemeralUserDataManager,
13939
+ sharedConnectionDataManager,
13652
13940
  connectionEventManager,
13653
13941
  taskManager,
13654
13942
  ioManager,
13655
13943
  resourceManager,
13656
- activityEventsManager
13944
+ activityEventsManager,
13945
+ logManager
13657
13946
  } = noyaManager;
13658
- const [didMount, setDidMount] = React30.useState(false);
13947
+ const [didMount, setDidMount] = React33.useState(false);
13659
13948
  const tasks = useObservable2(taskManager.tasks$);
13660
13949
  const inputs = useObservable2(ioManager.inputs$);
13661
13950
  const outputTransforms = useObservable2(ioManager.outputTransforms$);
13662
13951
  useLayoutEffect4(() => {
13663
13952
  setDidMount(true);
13664
13953
  }, []);
13665
- const eventsContainerRef = React30.useRef(null);
13666
- const activityEventsContainerRef = React30.useRef(null);
13954
+ const eventsContainerRef = React33.useRef(null);
13955
+ const activityEventsContainerRef = React33.useRef(null);
13956
+ const serverLogsContainerRef = React33.useRef(null);
13957
+ const serverSimulationLogsContainerRef = React33.useRef(null);
13667
13958
  const [showInspector, setShowInspector] = useLocalStorageState(
13668
13959
  "noya-multiplayer-react-show-inspector",
13669
13960
  true
@@ -13680,6 +13971,10 @@ var StateInspector = memoGeneric(function StateInspector2({
13680
13971
  "noya-multiplayer-react-show-users",
13681
13972
  true
13682
13973
  );
13974
+ const [showUserDetails, setShowUserDetails] = useLocalStorageState(
13975
+ "noya-multiplayer-react-show-user-details",
13976
+ false
13977
+ );
13683
13978
  const [showData, setShowData] = useLocalStorageState(
13684
13979
  "noya-multiplayer-react-show-data",
13685
13980
  true
@@ -13688,8 +13983,8 @@ var StateInspector = memoGeneric(function StateInspector2({
13688
13983
  "noya-multiplayer-react-show-tasks",
13689
13984
  false
13690
13985
  );
13691
- const [showEphemeral, setShowEphemeral] = useLocalStorageState(
13692
- "noya-multiplayer-react-show-ephemeral",
13986
+ const [showShared, setShowShared] = useLocalStorageState(
13987
+ "noya-multiplayer-react-show-shared",
13693
13988
  false
13694
13989
  );
13695
13990
  const [showAssets, setShowAssets] = useLocalStorageState(
@@ -13716,16 +14011,59 @@ var StateInspector = memoGeneric(function StateInspector2({
13716
14011
  "noya-multiplayer-react-show-activity-events",
13717
14012
  false
13718
14013
  );
14014
+ const [showServerLogs, setShowServerLogs] = useLocalStorageState(
14015
+ "noya-multiplayer-react-show-server-logs",
14016
+ false
14017
+ );
14018
+ const [showServerSimulationLogs, setShowServerSimulationLogs] = useLocalStorageState(
14019
+ "noya-multiplayer-react-show-server-simulation-logs",
14020
+ false
14021
+ );
14022
+ const [showSimulation, setShowSimulation] = useLocalStorageState(
14023
+ "noya-multiplayer-react-show-simulation",
14024
+ false
14025
+ );
13719
14026
  const connectionEvents = useObservable2(connectionEventManager.events$);
14027
+ const {
14028
+ visibleItems: visibleConnectionEvents,
14029
+ paused: connectionEventsPaused,
14030
+ togglePaused: toggleConnectionEventsPaused
14031
+ } = usePausedStream(connectionEvents);
13720
14032
  useEffect13(() => {
13721
14033
  if (eventsContainerRef.current) {
13722
14034
  eventsContainerRef.current.scrollTop = eventsContainerRef.current.scrollHeight;
13723
14035
  }
13724
- }, [connectionEvents]);
14036
+ }, [visibleConnectionEvents]);
14037
+ const serverLogs = useObservable2(logManager.logs$);
14038
+ const {
14039
+ visibleItems: visibleServerLogs,
14040
+ paused: serverLogsPaused,
14041
+ togglePaused: toggleServerLogsPaused
14042
+ } = usePausedStream(serverLogs);
14043
+ const serverSimulationLogs = useObservable2(
14044
+ multiplayerStateManager.serverSimulationLogs$
14045
+ );
14046
+ const {
14047
+ visibleItems: visibleServerSimulationLogs,
14048
+ paused: serverSimulationLogsPaused,
14049
+ togglePaused: toggleServerSimulationLogsPaused
14050
+ } = usePausedStream(serverSimulationLogs);
14051
+ useEffect13(() => {
14052
+ if (!showServerLogs) return;
14053
+ if (serverLogsContainerRef.current) {
14054
+ serverLogsContainerRef.current.scrollTop = serverLogsContainerRef.current.scrollHeight;
14055
+ }
14056
+ }, [showServerLogs, visibleServerLogs]);
14057
+ useEffect13(() => {
14058
+ if (!showServerSimulationLogs) return;
14059
+ if (serverSimulationLogsContainerRef.current) {
14060
+ serverSimulationLogsContainerRef.current.scrollTop = serverSimulationLogsContainerRef.current.scrollHeight;
14061
+ }
14062
+ }, [showServerSimulationLogs, visibleServerSimulationLogs]);
13725
14063
  const multipeerStateInitialized = useObservable2(
13726
14064
  multiplayerStateManager.isInitialized$
13727
14065
  );
13728
- const ephemeral = useObservable2(ephemeralUserDataManager.data$);
14066
+ const shared = useObservable2(sharedConnectionDataManager.data$);
13729
14067
  const historySnapshot = useManagedHistory(multiplayerStateManager.sm);
13730
14068
  const assets = useObservable2(assetManager.assets$);
13731
14069
  const resources = useObservable2(resourceManager.resources$);
@@ -13733,8 +14071,10 @@ var StateInspector = memoGeneric(function StateInspector2({
13733
14071
  const assetsInitialized = useObservable2(assetManager.isInitialized$);
13734
14072
  const secrets = useObservable2(secretManager.secrets$);
13735
14073
  const secretsInitialized = useObservable2(secretManager.isInitialized$);
13736
- const connectedUsers = useObservable2(userManager.connectedUsers$);
13737
- const userId = useObservable2(userManager.currentUserId$);
14074
+ const connectedUsers = useObservable2(userManager.allUsers$);
14075
+ const connectionId = useObservable2(userManager.currentConnectionId$);
14076
+ const simulationDiagnostics = multiplayerStateManager.getServerSimulationDiagnostics?.() ?? null;
14077
+ const showSimulationLogsSection = (simulationDiagnostics?.simulateLocally ?? false) || visibleServerSimulationLogs.length > 0;
13738
14078
  const state = useObservable2(multiplayerStateManager.optimisticState$);
13739
14079
  const inputsInitialized = useObservable2(ioManager.inputsInitialized$);
13740
14080
  const outputTransformsInitialized = useObservable2(
@@ -13778,7 +14118,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13778
14118
  }, [noyaManager]);
13779
14119
  if (!didMount) return null;
13780
14120
  if (!showInspector) {
13781
- return /* @__PURE__ */ React30.createElement(
14121
+ return /* @__PURE__ */ React33.createElement(
13782
14122
  "div",
13783
14123
  {
13784
14124
  ...props,
@@ -13790,7 +14130,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13790
14130
  },
13791
14131
  onClick: () => setShowInspector(true)
13792
14132
  },
13793
- /* @__PURE__ */ React30.createElement(
14133
+ /* @__PURE__ */ React33.createElement(
13794
14134
  StateInspectorToggleButton,
13795
14135
  {
13796
14136
  showInspector,
@@ -13801,7 +14141,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13801
14141
  )
13802
14142
  );
13803
14143
  }
13804
- return /* @__PURE__ */ React30.createElement(
14144
+ return /* @__PURE__ */ React33.createElement(
13805
14145
  "div",
13806
14146
  {
13807
14147
  ...props,
@@ -13810,7 +14150,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13810
14150
  ...props.style
13811
14151
  }
13812
14152
  },
13813
- /* @__PURE__ */ React30.createElement(
14153
+ /* @__PURE__ */ React33.createElement(
13814
14154
  StateInspectorDisclosureSection,
13815
14155
  {
13816
14156
  isFirst: true,
@@ -13820,9 +14160,17 @@ var StateInspector = memoGeneric(function StateInspector2({
13820
14160
  colorScheme,
13821
14161
  style: {
13822
14162
  flex: "0 0 auto",
13823
- maxHeight: "200px"
14163
+ maxHeight: "50%",
14164
+ overflowY: "auto"
13824
14165
  },
13825
- right: /* @__PURE__ */ React30.createElement(
14166
+ right: /* @__PURE__ */ React33.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React33.createElement(
14167
+ StateInspectorButton,
14168
+ {
14169
+ theme: theme3,
14170
+ onClick: () => setShowUserDetails(!showUserDetails)
14171
+ },
14172
+ "Toggle details"
14173
+ ), /* @__PURE__ */ React33.createElement(
13826
14174
  StateInspectorToggleButton,
13827
14175
  {
13828
14176
  showInspector,
@@ -13830,38 +14178,40 @@ var StateInspector = memoGeneric(function StateInspector2({
13830
14178
  theme: theme3,
13831
14179
  anchor
13832
14180
  }
13833
- )
14181
+ ))
13834
14182
  },
13835
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.map((user, index, array) => /* @__PURE__ */ React30.createElement(
13836
- StateInspectorRow,
13837
- {
13838
- key: user.id,
13839
- colorScheme,
13840
- variant: user.id === userId ? "up" : void 0,
13841
- bordered: index !== array.length - 1
13842
- },
13843
- user.image && /* @__PURE__ */ React30.createElement(
13844
- "img",
14183
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, { style: { flex: "0 0 auto" } }, connectedUsers?.filter((user) => showUserDetails || !user.inactive).map((user, index, array) => {
14184
+ return /* @__PURE__ */ React33.createElement(
14185
+ StateInspectorRow,
13845
14186
  {
13846
- src: user.image,
13847
- alt: user.name,
14187
+ key: user.connectionId,
14188
+ colorScheme,
14189
+ variant: user.connectionId === connectionId ? "up" : void 0,
14190
+ bordered: index !== array.length - 1,
13848
14191
  style: {
13849
- width: "13px",
13850
- height: "13px",
13851
- borderRadius: "50%",
13852
- marginRight: "4px",
13853
- display: "inline-block",
13854
- position: "relative",
13855
- background: solidBorderColor,
13856
- verticalAlign: "middle"
14192
+ opacity: user.inactive ? 0.5 : 1
13857
14193
  }
13858
- }
13859
- ),
13860
- user.name,
13861
- " (",
13862
- ellipsis(user.id.toString(), 8, "middle"),
13863
- ")"
13864
- )), !connectedUsers && /* @__PURE__ */ React30.createElement(
14194
+ },
14195
+ user.image && /* @__PURE__ */ React33.createElement(
14196
+ "img",
14197
+ {
14198
+ src: user.image,
14199
+ alt: user.name,
14200
+ style: {
14201
+ width: "13px",
14202
+ height: "13px",
14203
+ borderRadius: "50%",
14204
+ marginRight: "4px",
14205
+ display: "inline-block",
14206
+ position: "relative",
14207
+ background: solidBorderColor,
14208
+ verticalAlign: "middle"
14209
+ }
14210
+ }
14211
+ ),
14212
+ showUserDetails ? /* @__PURE__ */ React33.createElement(themedObjectInspector, { data: user, theme: theme3 }) : user.name
14213
+ );
14214
+ }), !connectedUsers && /* @__PURE__ */ React33.createElement(
13865
14215
  "div",
13866
14216
  {
13867
14217
  style: {
@@ -13872,13 +14222,13 @@ var StateInspector = memoGeneric(function StateInspector2({
13872
14222
  gap: "4px"
13873
14223
  }
13874
14224
  },
13875
- /* @__PURE__ */ React30.createElement("span", null, "No connected users")
14225
+ /* @__PURE__ */ React33.createElement("span", null, "No connected users")
13876
14226
  ))
13877
14227
  ),
13878
- /* @__PURE__ */ React30.createElement(
14228
+ /* @__PURE__ */ React33.createElement(
13879
14229
  StateInspectorDisclosureSection,
13880
14230
  {
13881
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React30.createElement(
14231
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Data", /* @__PURE__ */ React33.createElement(
13882
14232
  ColoredDot,
13883
14233
  {
13884
14234
  type: multipeerStateInitialized ? "success" : "error"
@@ -13887,7 +14237,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13887
14237
  colorScheme,
13888
14238
  setOpen: setShowData,
13889
14239
  open: showData,
13890
- right: /* @__PURE__ */ React30.createElement(
14240
+ right: /* @__PURE__ */ React33.createElement(
13891
14241
  "span",
13892
14242
  {
13893
14243
  style: {
@@ -13895,9 +14245,9 @@ var StateInspector = memoGeneric(function StateInspector2({
13895
14245
  gap: "12px"
13896
14246
  }
13897
14247
  },
13898
- /* @__PURE__ */ React30.createElement(StateInspectorButton, { theme: theme3, onClick: handleImportAll }, "Import"),
13899
- /* @__PURE__ */ React30.createElement(StateInspectorButton, { theme: theme3, onClick: handleExportAll }, "Export"),
13900
- /* @__PURE__ */ React30.createElement(
14248
+ /* @__PURE__ */ React33.createElement(StateInspectorButton, { theme: theme3, onClick: handleImportAll }, "Import"),
14249
+ /* @__PURE__ */ React33.createElement(StateInspectorButton, { theme: theme3, onClick: handleExportAll }, "Export"),
14250
+ /* @__PURE__ */ React33.createElement(
13901
14251
  StateInspectorButton,
13902
14252
  {
13903
14253
  theme: theme3,
@@ -13909,14 +14259,14 @@ var StateInspector = memoGeneric(function StateInspector2({
13909
14259
  )
13910
14260
  )
13911
14261
  },
13912
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React30.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React30.createElement(
14262
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React33.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React33.createElement(
13913
14263
  themedObjectInspector,
13914
14264
  {
13915
14265
  name: multiplayerStateManager.schema ? "state" : void 0,
13916
14266
  data: state,
13917
14267
  theme: theme3
13918
14268
  }
13919
- )), multiplayerStateManager.schema && /* @__PURE__ */ React30.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React30.createElement(
14269
+ )), multiplayerStateManager.schema && /* @__PURE__ */ React33.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React33.createElement(
13920
14270
  themedObjectInspector,
13921
14271
  {
13922
14272
  name: "schema",
@@ -13925,7 +14275,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13925
14275
  }
13926
14276
  )))
13927
14277
  ),
13928
- /* @__PURE__ */ React30.createElement(
14278
+ /* @__PURE__ */ React33.createElement(
13929
14279
  HistorySection,
13930
14280
  {
13931
14281
  showHistory,
@@ -13935,14 +14285,14 @@ var StateInspector = memoGeneric(function StateInspector2({
13935
14285
  multiplayerStateManager
13936
14286
  }
13937
14287
  ),
13938
- /* @__PURE__ */ React30.createElement(
14288
+ /* @__PURE__ */ React33.createElement(
13939
14289
  StateInspectorDisclosureSection,
13940
14290
  {
13941
14291
  open: showAssets,
13942
14292
  setOpen: setShowAssets,
13943
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React30.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
14293
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Assets (", assets.length, ")", /* @__PURE__ */ React33.createElement(ColoredDot, { type: assetsInitialized ? "success" : "error" })),
13944
14294
  colorScheme,
13945
- right: /* @__PURE__ */ React30.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React30.createElement(
14295
+ right: /* @__PURE__ */ React33.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React33.createElement(
13946
14296
  StateInspectorButton,
13947
14297
  {
13948
14298
  theme: theme3,
@@ -13957,7 +14307,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13957
14307
  }
13958
14308
  },
13959
14309
  "Delete all"
13960
- ), /* @__PURE__ */ React30.createElement(
14310
+ ), /* @__PURE__ */ React33.createElement(
13961
14311
  StateInspectorButton,
13962
14312
  {
13963
14313
  theme: theme3,
@@ -13970,7 +14320,7 @@ var StateInspector = memoGeneric(function StateInspector2({
13970
14320
  }
13971
14321
  },
13972
14322
  "Reload"
13973
- ), /* @__PURE__ */ React30.createElement(
14323
+ ), /* @__PURE__ */ React33.createElement(
13974
14324
  StateInspectorButton,
13975
14325
  {
13976
14326
  theme: theme3,
@@ -13994,14 +14344,14 @@ var StateInspector = memoGeneric(function StateInspector2({
13994
14344
  "Upload"
13995
14345
  ))
13996
14346
  },
13997
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React30.createElement(
14347
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React33.createElement(
13998
14348
  themedObjectInspector,
13999
14349
  {
14000
14350
  name: asset.id,
14001
14351
  data: truncateAsset(asset),
14002
14352
  theme: theme3
14003
14353
  }
14004
- ), /* @__PURE__ */ React30.createElement(
14354
+ ), /* @__PURE__ */ React33.createElement(
14005
14355
  StateInspectorButton,
14006
14356
  {
14007
14357
  theme: theme3,
@@ -14010,14 +14360,14 @@ var StateInspector = memoGeneric(function StateInspector2({
14010
14360
  "Delete"
14011
14361
  ))))
14012
14362
  ),
14013
- advanced && /* @__PURE__ */ React30.createElement(
14363
+ advanced && /* @__PURE__ */ React33.createElement(
14014
14364
  StateInspectorDisclosureSection,
14015
14365
  {
14016
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React30.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
14366
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Resources (", resources.length, ")", /* @__PURE__ */ React33.createElement(ColoredDot, { type: resourcesInitialized ? "success" : "error" })),
14017
14367
  colorScheme,
14018
14368
  open: showResources,
14019
14369
  setOpen: setShowResources,
14020
- right: /* @__PURE__ */ React30.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React30.createElement(
14370
+ right: /* @__PURE__ */ React33.createElement("span", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React33.createElement(
14021
14371
  StateInspectorButton,
14022
14372
  {
14023
14373
  theme: theme3,
@@ -14032,12 +14382,12 @@ var StateInspector = memoGeneric(function StateInspector2({
14032
14382
  }
14033
14383
  },
14034
14384
  "Delete all"
14035
- ), /* @__PURE__ */ React30.createElement(
14385
+ ), /* @__PURE__ */ React33.createElement(
14036
14386
  StateInspectorButton,
14037
14387
  {
14038
14388
  theme: theme3,
14039
14389
  onClick: async () => {
14040
- const path2 = prompt("Enter directory path") || uuid10();
14390
+ const path2 = prompt("Enter directory path") || uuid13();
14041
14391
  await resourceManager.createResource({
14042
14392
  type: "directory",
14043
14393
  path: path2
@@ -14045,7 +14395,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14045
14395
  }
14046
14396
  },
14047
14397
  "Create Directory"
14048
- ), /* @__PURE__ */ React30.createElement(
14398
+ ), /* @__PURE__ */ React33.createElement(
14049
14399
  StateInspectorButton,
14050
14400
  {
14051
14401
  theme: theme3,
@@ -14053,9 +14403,9 @@ var StateInspector = memoGeneric(function StateInspector2({
14053
14403
  const file = await uploadFile();
14054
14404
  resourceManager.createResource({
14055
14405
  type: "asset",
14056
- path: file.name || uuid10(),
14406
+ path: file.name || uuid13(),
14057
14407
  asset: {
14058
- content: Base643.encode(await file.arrayBuffer()),
14408
+ content: Base644.encode(await file.arrayBuffer()),
14059
14409
  contentType: file.type,
14060
14410
  encoding: "base64"
14061
14411
  }
@@ -14065,21 +14415,21 @@ var StateInspector = memoGeneric(function StateInspector2({
14065
14415
  "Create Asset"
14066
14416
  ))
14067
14417
  },
14068
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React30.createElement(
14418
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, resources?.map((resource) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key: resource.id, colorScheme }, /* @__PURE__ */ React33.createElement(
14069
14419
  themedObjectInspector,
14070
14420
  {
14071
14421
  name: resource.path,
14072
14422
  data: resource,
14073
14423
  theme: theme3
14074
14424
  }
14075
- ), /* @__PURE__ */ React30.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React30.createElement(
14425
+ ), /* @__PURE__ */ React33.createElement("div", { style: { display: "flex", gap: "4px" } }, /* @__PURE__ */ React33.createElement(
14076
14426
  StateInspectorButton,
14077
14427
  {
14078
14428
  theme: theme3,
14079
14429
  onClick: () => resourceManager.deleteResource({ id: resource.id })
14080
14430
  },
14081
14431
  "Delete"
14082
- ), /* @__PURE__ */ React30.createElement(
14432
+ ), /* @__PURE__ */ React33.createElement(
14083
14433
  StateInspectorButton,
14084
14434
  {
14085
14435
  theme: theme3,
@@ -14092,14 +14442,14 @@ var StateInspector = memoGeneric(function StateInspector2({
14092
14442
  "Rename"
14093
14443
  )))))
14094
14444
  ),
14095
- advanced && /* @__PURE__ */ React30.createElement(
14445
+ advanced && /* @__PURE__ */ React33.createElement(
14096
14446
  StateInspectorDisclosureSection,
14097
14447
  {
14098
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Secrets", /* @__PURE__ */ React30.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
14448
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Secrets", /* @__PURE__ */ React33.createElement(ColoredDot, { type: secretsInitialized ? "success" : "error" })),
14099
14449
  colorScheme,
14100
14450
  open: showSecrets,
14101
14451
  setOpen: setShowSecrets,
14102
- right: /* @__PURE__ */ React30.createElement(
14452
+ right: /* @__PURE__ */ React33.createElement(
14103
14453
  StateInspectorButton,
14104
14454
  {
14105
14455
  theme: theme3,
@@ -14114,7 +14464,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14114
14464
  "Create"
14115
14465
  )
14116
14466
  },
14117
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: secret, theme: theme3 }), /* @__PURE__ */ React30.createElement(
14467
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, secrets.map((secret) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key: secret.id, colorScheme }, /* @__PURE__ */ React33.createElement(themedObjectInspector, { data: secret, theme: theme3 }), /* @__PURE__ */ React33.createElement(
14118
14468
  StateInspectorButton,
14119
14469
  {
14120
14470
  theme: theme3,
@@ -14123,15 +14473,15 @@ var StateInspector = memoGeneric(function StateInspector2({
14123
14473
  "Delete"
14124
14474
  ))))
14125
14475
  ),
14126
- advanced && /* @__PURE__ */ React30.createElement(
14476
+ advanced && /* @__PURE__ */ React33.createElement(
14127
14477
  StateInspectorDisclosureSection,
14128
14478
  {
14129
14479
  open: showInputs,
14130
14480
  setOpen: setShowInputs,
14131
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Inputs", /* @__PURE__ */ React30.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
14481
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Inputs", /* @__PURE__ */ React33.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
14132
14482
  colorScheme
14133
14483
  },
14134
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: input, theme: theme3 }))), !inputs?.length && /* @__PURE__ */ React30.createElement(
14484
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, inputs?.map((input) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React33.createElement(themedObjectInspector, { data: input, theme: theme3 }))), !inputs?.length && /* @__PURE__ */ React33.createElement(
14135
14485
  "div",
14136
14486
  {
14137
14487
  style: {
@@ -14142,15 +14492,15 @@ var StateInspector = memoGeneric(function StateInspector2({
14142
14492
  gap: "4px"
14143
14493
  }
14144
14494
  },
14145
- /* @__PURE__ */ React30.createElement("span", null, "No inputs")
14495
+ /* @__PURE__ */ React33.createElement("span", null, "No inputs")
14146
14496
  ))
14147
14497
  ),
14148
- advanced && /* @__PURE__ */ React30.createElement(
14498
+ advanced && /* @__PURE__ */ React33.createElement(
14149
14499
  StateInspectorDisclosureSection,
14150
14500
  {
14151
14501
  open: showOutputTransforms,
14152
14502
  setOpen: setShowOutputTransforms,
14153
- title: /* @__PURE__ */ React30.createElement(StateInspectorTitleLabel, null, "Output Transforms", /* @__PURE__ */ React30.createElement(
14503
+ title: /* @__PURE__ */ React33.createElement(StateInspectorTitleLabel, null, "Output Transforms", /* @__PURE__ */ React33.createElement(
14154
14504
  ColoredDot,
14155
14505
  {
14156
14506
  type: outputTransformsInitialized ? "success" : "error"
@@ -14158,7 +14508,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14158
14508
  )),
14159
14509
  colorScheme
14160
14510
  },
14161
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React30.createElement(themedObjectInspector, { data: transform, theme: theme3 }))), !outputTransforms?.length && /* @__PURE__ */ React30.createElement(
14511
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, outputTransforms?.map((transform) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React33.createElement(themedObjectInspector, { data: transform, theme: theme3 }))), !outputTransforms?.length && /* @__PURE__ */ React33.createElement(
14162
14512
  "div",
14163
14513
  {
14164
14514
  style: {
@@ -14169,10 +14519,10 @@ var StateInspector = memoGeneric(function StateInspector2({
14169
14519
  gap: "4px"
14170
14520
  }
14171
14521
  },
14172
- /* @__PURE__ */ React30.createElement("span", null, "No output transforms")
14522
+ /* @__PURE__ */ React33.createElement("span", null, "No output transforms")
14173
14523
  ))
14174
14524
  ),
14175
- advanced && /* @__PURE__ */ React30.createElement(
14525
+ advanced && /* @__PURE__ */ React33.createElement(
14176
14526
  StateInspectorDisclosureSection,
14177
14527
  {
14178
14528
  title: "Tasks",
@@ -14180,7 +14530,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14180
14530
  open: showTasks,
14181
14531
  setOpen: setShowTasks
14182
14532
  },
14183
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React30.createElement(
14533
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, tasks?.map((task) => /* @__PURE__ */ React33.createElement(
14184
14534
  StateInspectorRow,
14185
14535
  {
14186
14536
  key: task.id,
@@ -14189,7 +14539,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14189
14539
  backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
14190
14540
  }
14191
14541
  },
14192
- /* @__PURE__ */ React30.createElement(
14542
+ /* @__PURE__ */ React33.createElement(
14193
14543
  themedObjectInspector,
14194
14544
  {
14195
14545
  name: task.name,
@@ -14199,15 +14549,15 @@ var StateInspector = memoGeneric(function StateInspector2({
14199
14549
  )
14200
14550
  )))
14201
14551
  ),
14202
- /* @__PURE__ */ React30.createElement(
14552
+ /* @__PURE__ */ React33.createElement(
14203
14553
  StateInspectorDisclosureSection,
14204
14554
  {
14205
- open: showEphemeral,
14206
- setOpen: setShowEphemeral,
14207
- title: "Ephemeral User Data",
14555
+ open: showShared,
14556
+ setOpen: setShowShared,
14557
+ title: "Shared Connection Data",
14208
14558
  colorScheme
14209
14559
  },
14210
- /* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React30.createElement(
14560
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, Object.entries(shared).map(([key, value]) => /* @__PURE__ */ React33.createElement(StateInspectorRow, { key, colorScheme }, /* @__PURE__ */ React33.createElement(
14211
14561
  themedObjectInspector,
14212
14562
  {
14213
14563
  name: key,
@@ -14217,7 +14567,56 @@ var StateInspector = memoGeneric(function StateInspector2({
14217
14567
  }
14218
14568
  ))))
14219
14569
  ),
14220
- advanced && /* @__PURE__ */ React30.createElement(
14570
+ /* @__PURE__ */ React33.createElement(
14571
+ ServerScriptLogsSection,
14572
+ {
14573
+ colorScheme,
14574
+ showLogs: showServerLogs,
14575
+ setShowLogs: setShowServerLogs,
14576
+ logs: visibleServerLogs,
14577
+ paused: serverLogsPaused,
14578
+ onTogglePaused: toggleServerLogsPaused,
14579
+ containerRef: serverLogsContainerRef
14580
+ }
14581
+ ),
14582
+ showSimulationLogsSection && /* @__PURE__ */ React33.createElement(
14583
+ ServerScriptLogsSection,
14584
+ {
14585
+ title: "Server Script Simulation Logs",
14586
+ colorScheme,
14587
+ showLogs: showServerSimulationLogs,
14588
+ setShowLogs: setShowServerSimulationLogs,
14589
+ logs: visibleServerSimulationLogs,
14590
+ paused: serverSimulationLogsPaused,
14591
+ onTogglePaused: toggleServerSimulationLogsPaused,
14592
+ containerRef: serverSimulationLogsContainerRef
14593
+ }
14594
+ ),
14595
+ /* @__PURE__ */ React33.createElement(
14596
+ StateInspectorDisclosureSection,
14597
+ {
14598
+ open: showSimulation,
14599
+ setOpen: setShowSimulation,
14600
+ title: "Server Simulation",
14601
+ colorScheme
14602
+ },
14603
+ /* @__PURE__ */ React33.createElement(StateInspectorDisclosureRowInner, null, /* @__PURE__ */ React33.createElement(StateInspectorRow, { colorScheme }, /* @__PURE__ */ React33.createElement(
14604
+ themedObjectInspector,
14605
+ {
14606
+ name: "status",
14607
+ data: simulationDiagnostics ?? {
14608
+ simulateLocally: false,
14609
+ simulatorActive: false,
14610
+ clockSkewMs: 0,
14611
+ invocations: [],
14612
+ pendingPredictions: []
14613
+ },
14614
+ theme: theme3,
14615
+ expandLevel: 2
14616
+ }
14617
+ )))
14618
+ ),
14619
+ advanced && /* @__PURE__ */ React33.createElement(
14221
14620
  ActivityEventsSection,
14222
14621
  {
14223
14622
  colorScheme,
@@ -14227,10 +14626,12 @@ var StateInspector = memoGeneric(function StateInspector2({
14227
14626
  activityEventsManager
14228
14627
  }
14229
14628
  ),
14230
- /* @__PURE__ */ React30.createElement(
14629
+ /* @__PURE__ */ React33.createElement(
14231
14630
  EventsSection,
14232
14631
  {
14233
- connectionEvents,
14632
+ connectionEvents: visibleConnectionEvents,
14633
+ paused: connectionEventsPaused,
14634
+ onTogglePaused: toggleConnectionEventsPaused,
14234
14635
  colorScheme,
14235
14636
  eventsContainerRef,
14236
14637
  showEvents,
@@ -14256,7 +14657,7 @@ function useManagedHistory(stateManager) {
14256
14657
  }
14257
14658
 
14258
14659
  // ../noya-multiplayer-react/src/singleton.tsx
14259
- import React33 from "react";
14660
+ import React35 from "react";
14260
14661
 
14261
14662
  // ../noya-multiplayer-react/src/NoyaStateContext.tsx
14262
14663
  var AnyNoyaStateContext = createContext3(void 0);
@@ -14278,24 +14679,24 @@ function useActivityEventsForManager(streamFilter, activityEventsManager) {
14278
14679
  }
14279
14680
 
14280
14681
  // ../noya-multiplayer-react/src/components/UserPointersOverlay.tsx
14281
- import { Observable as Observable19 } from "@noya-app/observable";
14282
- import React35, { useEffect as useEffect18, useMemo as useMemo12, useState as useState18 } from "react";
14682
+ import { Observable as Observable23 } from "@noya-app/observable";
14683
+ import React37, { useEffect as useEffect18, useMemo as useMemo12, useState as useState18 } from "react";
14283
14684
  function shouldShow(hideAfter, updatedAt) {
14284
14685
  return !!updatedAt && Date.now() - updatedAt < hideAfter;
14285
14686
  }
14286
14687
  var UserPointerInternal = memoGeneric(function UserPointerInternal2({
14287
14688
  user,
14288
- ephemeralUserDataManager,
14689
+ sharedConnectionDataManager,
14289
14690
  hideAfter = 5e3,
14290
14691
  renderUserPointer
14291
14692
  }) {
14292
14693
  const observable = useMemo12(() => {
14293
- const metadata$ = ephemeralUserDataManager.metadata$.observePath([user.id]).throttle(50);
14294
- const data$ = ephemeralUserDataManager.data$.observePath([user.id]).throttle(50);
14295
- return Observable19.combine([metadata$, data$], ([metadata2, data2]) => {
14694
+ const metadata$ = sharedConnectionDataManager.metadata$.observePath([user.connectionId]).throttle(50);
14695
+ const data$ = sharedConnectionDataManager.data$.observePath([user.connectionId]).throttle(50);
14696
+ return Observable23.combine([metadata$, data$], ([metadata2, data2]) => {
14296
14697
  return { metadata: metadata2, data: data2 };
14297
14698
  });
14298
- }, [ephemeralUserDataManager, user.id]);
14699
+ }, [sharedConnectionDataManager, user.connectionId]);
14299
14700
  const { metadata, data } = useObservable2(observable);
14300
14701
  const [, setForceUpdate] = useState18(0);
14301
14702
  const updatedAt = metadata?.updatedAt ?? 0;
@@ -14309,7 +14710,7 @@ var UserPointerInternal = memoGeneric(function UserPointerInternal2({
14309
14710
  }, [hideAfter, show, updatedAt]);
14310
14711
  if (!data?.pointer) return null;
14311
14712
  return renderUserPointer({
14312
- userId: user.id,
14713
+ userId: user.connectionId,
14313
14714
  name: user.name,
14314
14715
  point: data.pointer,
14315
14716
  visible: show
@@ -14317,19 +14718,21 @@ var UserPointerInternal = memoGeneric(function UserPointerInternal2({
14317
14718
  });
14318
14719
  var UserPointersOverlay = memoGeneric(function UserPointers({
14319
14720
  userManager,
14320
- ephemeralUserDataManager,
14721
+ sharedConnectionDataManager,
14321
14722
  renderUserPointer
14322
14723
  }) {
14323
- const currentUserId = useObservable2(ephemeralUserDataManager.currentUserId$);
14724
+ const currentConnectionId = useObservable2(
14725
+ sharedConnectionDataManager.currentConnectionId$
14726
+ );
14324
14727
  const connectedUsers = useObservable2(userManager.connectedUsers$);
14325
- return /* @__PURE__ */ React35.createElement(React35.Fragment, null, connectedUsers.map((user) => {
14326
- if (user.id === currentUserId) return null;
14327
- return /* @__PURE__ */ React35.createElement(
14728
+ return /* @__PURE__ */ React37.createElement(React37.Fragment, null, connectedUsers.map((user) => {
14729
+ if (user.connectionId === currentConnectionId) return null;
14730
+ return /* @__PURE__ */ React37.createElement(
14328
14731
  UserPointerInternal,
14329
14732
  {
14330
- key: user.id,
14733
+ key: user.connectionId,
14331
14734
  user,
14332
- ephemeralUserDataManager,
14735
+ sharedConnectionDataManager,
14333
14736
  renderUserPointer
14334
14737
  }
14335
14738
  );