@thestatic-tv/dcl-sdk 2.9.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,16 +32,19 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  AdminPanelUIModule: () => AdminPanelUIModule,
34
34
  ChatUIModule: () => ChatUIModule,
35
+ FramesModule: () => FramesModule,
35
36
  GuideModule: () => GuideModule,
36
37
  GuideUIModule: () => GuideUIModule,
37
38
  HeartbeatModule: () => HeartbeatModule,
38
39
  InteractionsModule: () => InteractionsModule,
39
40
  KEY_TYPE_CHANNEL: () => KEY_TYPE_CHANNEL,
40
41
  KEY_TYPE_SCENE: () => KEY_TYPE_SCENE,
42
+ ModerationModule: () => ModerationModule,
41
43
  NotificationBanner: () => NotificationBanner,
42
44
  SessionModule: () => SessionModule,
43
45
  StaticTVClient: () => StaticTVClient,
44
46
  fetchUserData: () => fetchUserData,
47
+ getParcelRects: () => getParcelRects,
45
48
  getPlayerDisplayName: () => getPlayerDisplayName,
46
49
  getPlayerPosition: () => getPlayerPosition,
47
50
  getPlayerWallet: () => getPlayerWallet,
@@ -65,7 +68,7 @@ async function request(url, options = {}) {
65
68
  }
66
69
 
67
70
  // src/StaticTVClient.ts
68
- var import_SignedFetch3 = require("~system/SignedFetch");
71
+ var import_SignedFetch4 = require("~system/SignedFetch");
69
72
 
70
73
  // src/modules/guide.ts
71
74
  var GuideModule = class {
@@ -257,9 +260,104 @@ function dclClearTimeout(timeoutId) {
257
260
  // src/utils/bounds.ts
258
261
  var import_ecs2 = require("@dcl/sdk/ecs");
259
262
  var import_Runtime = require("~system/Runtime");
263
+
264
+ // src/utils/walls.ts
260
265
  var PARCEL_SIZE = 16;
266
+ var EDGE_STRIP = 1;
267
+ var WALL_TOP_MAX = 32;
268
+ var GROUND_REACH = 3;
269
+ function heightLimit(parcels) {
270
+ return Math.log2(parcels + 1) * 20;
271
+ }
272
+ function wallTop(parcels) {
273
+ return Math.min(WALL_TOP_MAX, heightLimit(parcels) - 4);
274
+ }
275
+ function parcelRects(parcels, base) {
276
+ const parse = (p) => {
277
+ const parts = String(p).split(",");
278
+ if (parts.length !== 2) return null;
279
+ const [x, z] = parts.map((n) => parseInt(n, 10));
280
+ return Number.isFinite(x) && Number.isFinite(z) ? { x, z } : null;
281
+ };
282
+ const coords = parcels.map(parse).filter((c) => c !== null);
283
+ const origin = base && parse(base) || coords[0];
284
+ if (!origin) return [];
285
+ return coords.map((c) => {
286
+ const minX = (c.x - origin.x) * PARCEL_SIZE;
287
+ const minZ = (c.z - origin.z) * PARCEL_SIZE;
288
+ return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
289
+ });
290
+ }
291
+ function outerSides(rect, rects) {
292
+ const at = (minX, minZ) => rects.some((r) => r.minX === minX && r.minZ === minZ);
293
+ const sides = [];
294
+ if (!at(rect.minX - PARCEL_SIZE, rect.minZ)) sides.push("west");
295
+ if (!at(rect.minX + PARCEL_SIZE, rect.minZ)) sides.push("east");
296
+ if (!at(rect.minX, rect.minZ - PARCEL_SIZE)) sides.push("south");
297
+ if (!at(rect.minX, rect.minZ + PARCEL_SIZE)) sides.push("north");
298
+ return sides;
299
+ }
300
+ function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
301
+ return rects.map((r) => {
302
+ const outer = outerSides(r, rects);
303
+ return {
304
+ minX: r.minX + (outer.includes("west") ? strip : 0),
305
+ maxX: r.maxX - (outer.includes("east") ? strip : 0),
306
+ minZ: r.minZ + (outer.includes("south") ? strip : 0),
307
+ maxZ: r.maxZ - (outer.includes("north") ? strip : 0),
308
+ top
309
+ };
310
+ });
311
+ }
312
+ function inParcels(p, rects) {
313
+ return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
314
+ }
315
+ function spawnPointOf(metadata) {
316
+ const points = metadata?.spawnPoints;
317
+ if (!Array.isArray(points) || points.length === 0) return null;
318
+ const chosen = points.find((s) => s && s.default === true) || points[0];
319
+ const position = chosen?.position;
320
+ const coordinate = (v) => {
321
+ const values = (Array.isArray(v) ? v : [v]).filter((n) => typeof n === "number" && Number.isFinite(n));
322
+ return values.length === 0 ? null : (Math.min(...values) + Math.max(...values)) / 2;
323
+ };
324
+ const x = coordinate(position?.x);
325
+ const y = coordinate(position?.y);
326
+ const z = coordinate(position?.z);
327
+ return x === null || y === null || z === null ? null : { x, y, z };
328
+ }
329
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
330
+ function entryPoint(boxes, rects, spawn, from) {
331
+ const IN = 0.5;
332
+ const target = spawn || from || { x: 0, y: 0, z: 0 };
333
+ const y = spawn ? Math.max(0, spawn.y) : 0;
334
+ let best = null;
335
+ let bestDistance = Infinity;
336
+ rects.forEach((rect, i) => {
337
+ const b = boxes[i];
338
+ if (!b) return;
339
+ const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
340
+ for (const side of outerSides(rect, rects)) {
341
+ const point = side === "west" ? { x: (rect.minX + b.minX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "east" ? { x: (rect.maxX + b.maxX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "south" ? { x: along(b.minX, b.maxX, target.x), z: (rect.minZ + b.minZ) / 2 } : { x: along(b.minX, b.maxX, target.x), z: (rect.maxZ + b.maxZ) / 2 };
342
+ const distance = Math.hypot(point.x - target.x, point.z - target.z);
343
+ if (distance < bestDistance) {
344
+ bestDistance = distance;
345
+ best = { x: point.x, y, z: point.z };
346
+ }
347
+ }
348
+ });
349
+ return best;
350
+ }
351
+ function mustMoveToEntry(p, boxes, rects, entryY) {
352
+ if (!inParcels(p, rects)) return false;
353
+ const overWall = boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ);
354
+ return overWall || p.y > entryY + GROUND_REACH;
355
+ }
356
+
357
+ // src/utils/bounds.ts
261
358
  var cachedBounds = null;
262
359
  var cachedParcelRects = [];
360
+ var cachedSpawn = null;
263
361
  var boundsInitialized = false;
264
362
  var boundsError = false;
265
363
  function parseParcel(parcel) {
@@ -285,6 +383,7 @@ async function getSceneBounds() {
285
383
  const metadata = JSON.parse(sceneInfo.metadataJson);
286
384
  parcels = metadata?.scene?.parcels || [];
287
385
  baseParcel = metadata?.scene?.base;
386
+ cachedSpawn = spawnPointOf(metadata);
288
387
  }
289
388
  if (parcels.length === 0) {
290
389
  boundsError = true;
@@ -300,11 +399,7 @@ async function getSceneBounds() {
300
399
  boundsError = true;
301
400
  return null;
302
401
  }
303
- cachedParcelRects = coords.map((c) => {
304
- const minX = (c.x - base.x) * PARCEL_SIZE;
305
- const minZ = (c.z - base.z) * PARCEL_SIZE;
306
- return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
307
- });
402
+ cachedParcelRects = parcelRects(parcels, baseParcel);
308
403
  const worldMinX = Math.min(...coords.map((c) => c.x));
309
404
  const worldMaxX = Math.max(...coords.map((c) => c.x));
310
405
  const worldMinZ = Math.min(...coords.map((c) => c.z));
@@ -340,6 +435,12 @@ function isPlayerInBounds(_bounds) {
340
435
  return false;
341
436
  }
342
437
  }
438
+ function getParcelRects() {
439
+ return cachedParcelRects.map((r) => ({ ...r }));
440
+ }
441
+ function getSpawnPoint() {
442
+ return cachedSpawn ? { ...cachedSpawn } : null;
443
+ }
343
444
  function getPlayerPosition() {
344
445
  try {
345
446
  const transform = import_ecs2.Transform.getOrNull(import_ecs2.engine.PlayerEntity);
@@ -482,7 +583,7 @@ var SessionModule = class {
482
583
  this._tier = normalizeTier(response.sdkType);
483
584
  this.startHeartbeat();
484
585
  this.client.log(`Session started: ${this.sessionId}, tier: ${this._tier}`);
485
- this.client._enableFeaturesForTier(this._tier, this._keyId);
586
+ this.client._enableFeaturesForTier(this._tier, this._keyId, this._tier === "pro" && response.venue === true);
486
587
  return this.sessionId;
487
588
  }
488
589
  this.client._settleFeaturesAsFree();
@@ -741,10 +842,280 @@ var InteractionsModule = class {
741
842
  }
742
843
  };
743
844
 
845
+ // src/modules/frames.ts
846
+ var import_SignedFetch = require("~system/SignedFetch");
847
+ var import_RestrictedActions = require("~system/RestrictedActions");
848
+ var FRAMES_MAX = 64;
849
+ var REFRESH_JITTER_MS = 3e3;
850
+ var DEFAULT_VERSION = "default";
851
+ var IMAGE_MAX = 1e3;
852
+ var TEXT_MAX = 120;
853
+ var LINK_MAX = 1e3;
854
+ var VERSION_MAX = 40;
855
+ var HTTPS = /^https:/i;
856
+ function isSceneFrame(value) {
857
+ if (!value || typeof value !== "object") return false;
858
+ const f = value;
859
+ if (typeof f.id !== "string" || typeof f.label !== "string" || typeof f.onContent !== "function") return false;
860
+ const d = f.default;
861
+ if (d === void 0 || d === null) return true;
862
+ if (typeof d !== "object") return false;
863
+ const { image, text, link } = d;
864
+ return typeof image === "string" && (text === void 0 || typeof text === "string") && (link === void 0 || typeof link === "string");
865
+ }
866
+ function defaultContent(frame) {
867
+ const d = frame.default;
868
+ if (!d) return null;
869
+ return { image: d.image, text: d.text || "", link: d.link || "", version: DEFAULT_VERSION };
870
+ }
871
+ function savedContent(value) {
872
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
873
+ const v = value;
874
+ const image = v.image;
875
+ const text = v.text === void 0 || v.text === null ? "" : v.text;
876
+ const link = v.link === void 0 || v.link === null ? "" : v.link;
877
+ const version = v.version;
878
+ if (typeof image !== "string" || image.length > IMAGE_MAX || !HTTPS.test(image)) return null;
879
+ if (typeof text !== "string" || text.length > TEXT_MAX) return null;
880
+ if (typeof link !== "string" || link.length > LINK_MAX || link !== "" && !HTTPS.test(link)) return null;
881
+ if (typeof version !== "string" || version === "" || version.length > VERSION_MAX) return null;
882
+ return { image, text, link, version };
883
+ }
884
+ function sameContent(a, b) {
885
+ return b !== null && a.image === b.image && a.text === b.text && a.link === b.link && a.version === b.version;
886
+ }
887
+ function errorOf(body) {
888
+ try {
889
+ const data = body ? JSON.parse(body) : null;
890
+ return data && typeof data.error === "string" ? data.error : "";
891
+ } catch {
892
+ return "";
893
+ }
894
+ }
895
+ var FramesModule = class {
896
+ constructor(host) {
897
+ this.entries = /* @__PURE__ */ new Map();
898
+ /** Venue is known: the reads, the upload and the clicks may go */
899
+ this.enabled = false;
900
+ /** This copy's admin check succeeded: the declaration may be uploaded */
901
+ this.adminOk = false;
902
+ this.uploaded = false;
903
+ this.loadReadStarted = false;
904
+ /** The last good read's `frames` object (saved content by frame id), or null until a read succeeds */
905
+ this.answer = null;
906
+ /** Reads are numbered as they start; an answer older than the one shown is dropped */
907
+ this.readSeq = 0;
908
+ this.shownSeq = 0;
909
+ /** A framesRefresh is waiting out its jitter: another inside the wait shares its read */
910
+ this.refreshWaiting = false;
911
+ this.host = host;
912
+ }
913
+ /** The declared frames' ids, in the order they were first registered */
914
+ get ids() {
915
+ return [...this.entries.keys()];
916
+ }
917
+ /** True once Venue is known for this scene */
918
+ get isEnabled() {
919
+ return this.enabled;
920
+ }
921
+ /**
922
+ * Declare frames: kept until Venue is known; after, a frame registered now gets what the last read gave at once,
923
+ * and the load read and the upload that waited on frames go now (each still once a load)
924
+ */
925
+ register(frames) {
926
+ if (!Array.isArray(frames)) {
927
+ this.host.log("registerFrames skipped - not a list of frames");
928
+ return;
929
+ }
930
+ for (const frame of frames) {
931
+ if (!isSceneFrame(frame)) {
932
+ this.host.log("Frame skipped - not a SceneFrame:", frame);
933
+ continue;
934
+ }
935
+ if (!this.entries.has(frame.id) && this.entries.size >= FRAMES_MAX) {
936
+ this.host.warn(`Frame ${frame.id} skipped - at most ${FRAMES_MAX} frames a scene`);
937
+ continue;
938
+ }
939
+ this.entries.set(frame.id, { frame, shown: null });
940
+ }
941
+ this.host.log("Registered frames:", this.ids);
942
+ if (!this.enabled) return;
943
+ this.apply();
944
+ this.loadRead();
945
+ this.upload().catch(() => {
946
+ });
947
+ }
948
+ /** Venue is known (the client calls this once the session confirms it): the load read, and the upload if it waited */
949
+ enable() {
950
+ if (this.enabled) return;
951
+ this.enabled = true;
952
+ this.loadRead();
953
+ this.upload().catch(() => {
954
+ });
955
+ }
956
+ /** This copy's admin check succeeded (the admin panel calls this): the declaration goes up once Venue is known */
957
+ adminCheckSucceeded() {
958
+ this.adminOk = true;
959
+ this.upload().catch(() => {
960
+ });
961
+ }
962
+ /**
963
+ * A queued framesRefresh (the scene's page saved or reset a frame): read again after a random wait of up to
964
+ * REFRESH_JITTER_MS. Refreshes that arrive inside the wait share its read.
965
+ */
966
+ refresh() {
967
+ if (!this.enabled || this.entries.size === 0 || this.refreshWaiting) return;
968
+ this.refreshWaiting = true;
969
+ const wait = Math.floor(Math.random() * REFRESH_JITTER_MS);
970
+ this.host.log(`Frames refresh in ${wait} ms`);
971
+ dclSetTimeout(() => {
972
+ this.refreshWaiting = false;
973
+ this.loadReadStarted = true;
974
+ this.read().catch(() => {
975
+ });
976
+ }, wait);
977
+ }
978
+ /**
979
+ * A visitor clicked a frame. The link opens when it is an https: one: the shown content's, else the frame's default's
980
+ * - so a scene without Venue (or before its read lands), which shows its own defaults, has no dead frames. The click is
981
+ * posted signed under the shown version (fire and forget; a failure is logged, never shown) only with Venue and
982
+ * something shown. An id not declared opens nothing and posts nothing.
983
+ */
984
+ open(id) {
985
+ const entry = typeof id === "string" ? this.entries.get(id) : void 0;
986
+ if (!entry) {
987
+ this.host.log("openFrame: no frame declared with this id:", id);
988
+ return;
989
+ }
990
+ const shown = entry.shown;
991
+ if (this.enabled && shown) this.postClick(entry.frame.id, shown.version).catch(() => {
992
+ });
993
+ else this.host.log("openFrame: no click counted - no Venue, or the frame shows nothing yet:", id);
994
+ const link = shown ? shown.link : entry.frame.default?.link || "";
995
+ if (link !== "" && HTTPS.test(link)) {
996
+ try {
997
+ Promise.resolve((0, import_RestrictedActions.openExternalUrl)({ url: link })).catch((err) => this.host.log("Frame link not opened:", err));
998
+ } catch (err) {
999
+ this.host.log("Frame link not opened:", err);
1000
+ }
1001
+ }
1002
+ }
1003
+ /** The routes' base for this scene: the scene id encoded, as any value in a url path is */
1004
+ sceneUrl() {
1005
+ const sceneId = this.host.getSceneId();
1006
+ if (!sceneId) return null;
1007
+ return `${this.host.getBaseUrl()}/scene/${encodeURIComponent(sceneId)}`;
1008
+ }
1009
+ /** The read at load: once, when Venue is known and a frame is declared */
1010
+ loadRead() {
1011
+ if (this.loadReadStarted || !this.enabled || this.entries.size === 0) return;
1012
+ this.loadReadStarted = true;
1013
+ this.read().catch(() => {
1014
+ });
1015
+ }
1016
+ /** Read the saved content and show it; a failed read keeps what was shown */
1017
+ async read() {
1018
+ const base = this.sceneUrl();
1019
+ if (!base) {
1020
+ this.host.log("Frames: no scene id - nothing read");
1021
+ return;
1022
+ }
1023
+ const seq = ++this.readSeq;
1024
+ let frames;
1025
+ try {
1026
+ const res = await fetch(`${base}/frames`);
1027
+ if (!res.ok) {
1028
+ this.host.log("Frames read refused:", res.status);
1029
+ return;
1030
+ }
1031
+ const data = await res.json();
1032
+ const raw = data && typeof data === "object" ? data.frames : void 0;
1033
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
1034
+ this.host.log("Frames read: the answer holds no frames");
1035
+ return;
1036
+ }
1037
+ frames = raw;
1038
+ } catch (err) {
1039
+ this.host.log("Frames read error:", err);
1040
+ return;
1041
+ }
1042
+ if (seq < this.shownSeq) return;
1043
+ this.shownSeq = seq;
1044
+ this.answer = frames;
1045
+ this.apply();
1046
+ }
1047
+ /** A frame's content from the last good read: its saved content when usable, else its default, else null */
1048
+ contentFor(frame) {
1049
+ const answer = this.answer;
1050
+ if (answer && Object.prototype.hasOwnProperty.call(answer, frame.id)) {
1051
+ const saved = savedContent(answer[frame.id]);
1052
+ if (saved) return saved;
1053
+ this.host.log("Frames: saved content not usable, ignored:", frame.id);
1054
+ }
1055
+ return defaultContent(frame);
1056
+ }
1057
+ /** Each declared frame's content handed to its onContent when it differs from what the frame shows */
1058
+ apply() {
1059
+ if (!this.enabled || this.answer === null) return;
1060
+ for (const entry of [...this.entries.values()]) {
1061
+ const content = this.contentFor(entry.frame);
1062
+ if (!content || sameContent(content, entry.shown)) continue;
1063
+ try {
1064
+ entry.frame.onContent({ ...content });
1065
+ entry.shown = content;
1066
+ } catch (err) {
1067
+ this.host.error(`Frame ${entry.frame.id}: onContent failed`, err);
1068
+ }
1069
+ }
1070
+ }
1071
+ /** The declaration - ids, labels, defaults, never the handlers - once a load, in its own request to the config route */
1072
+ async upload() {
1073
+ if (this.uploaded || !this.enabled || !this.adminOk || this.entries.size === 0) return;
1074
+ const base = this.sceneUrl();
1075
+ if (!base) return;
1076
+ this.uploaded = true;
1077
+ const frames = [...this.entries.values()].map(({ frame }) => {
1078
+ const d = frame.default;
1079
+ return {
1080
+ id: frame.id,
1081
+ label: frame.label,
1082
+ ...d ? { default: { image: d.image, text: d.text || "", link: d.link || "" } } : {}
1083
+ };
1084
+ });
1085
+ try {
1086
+ const res = await (0, import_SignedFetch.signedFetch)({
1087
+ url: `${base}/config`,
1088
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frames }) }
1089
+ });
1090
+ if (res.ok) {
1091
+ this.host.log("Frames declared:", frames.map((f) => f.id));
1092
+ return;
1093
+ }
1094
+ this.host.log("Frames declaration refused:", res.status, errorOf(res.body));
1095
+ } catch (err) {
1096
+ this.host.log("Frames declaration error:", err);
1097
+ }
1098
+ }
1099
+ /** The click, signed: thestatic.tv counts it under the frame's shown version (one a wallet a frame a 10 s) */
1100
+ async postClick(id, version) {
1101
+ const base = this.sceneUrl();
1102
+ if (!base) return;
1103
+ try {
1104
+ const res = await (0, import_SignedFetch.signedFetch)({
1105
+ url: `${base}/frames/click`,
1106
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frame: id, version }) }
1107
+ });
1108
+ if (!res.ok) this.host.log("Frame click refused:", id, res.status, errorOf(res.body));
1109
+ } catch (err) {
1110
+ this.host.log("Frame click error:", id, err);
1111
+ }
1112
+ }
1113
+ };
1114
+
744
1115
  // src/ui/guide-ui.tsx
745
1116
  var import_react_ecs2 = __toESM(require("@dcl/sdk/react-ecs"));
746
1117
  var import_math3 = require("@dcl/sdk/math");
747
- var import_RestrictedActions = require("~system/RestrictedActions");
1118
+ var import_RestrictedActions2 = require("~system/RestrictedActions");
748
1119
 
749
1120
  // src/ui/theme.ts
750
1121
  var import_math = require("@dcl/sdk/math");
@@ -1013,6 +1384,7 @@ var GuideUIModule = class {
1013
1384
  * Always renders toggle button, plus panel when visible
1014
1385
  */
1015
1386
  this.getComponent = () => {
1387
+ if (this.client.isVisitorBlocked) return null;
1016
1388
  const windowW = UI_DIMENSIONS.guide.width;
1017
1389
  const windowH = UI_DIMENSIONS.guide.height;
1018
1390
  return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
@@ -1234,7 +1606,7 @@ var GuideUIModule = class {
1234
1606
  handleChannelClick(video) {
1235
1607
  const baseUrl = this.getBaseUrl();
1236
1608
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
1237
- (0, import_RestrictedActions.openExternalUrl)({ url: channelUrl });
1609
+ (0, import_RestrictedActions2.openExternalUrl)({ url: channelUrl });
1238
1610
  }
1239
1611
  renderLeftPanel() {
1240
1612
  const sidebarW = this.s(UI_DIMENSIONS.guide.sidebar.width);
@@ -1776,12 +2148,13 @@ var GuideUIModule = class {
1776
2148
  // src/ui/chat-ui.tsx
1777
2149
  var import_react_ecs3 = __toESM(require("@dcl/sdk/react-ecs"));
1778
2150
  var import_math4 = require("@dcl/sdk/math");
1779
- var import_SignedFetch = require("~system/SignedFetch");
2151
+ var import_SignedFetch2 = require("~system/SignedFetch");
1780
2152
  var import_players = require("@dcl/sdk/players");
1781
- var import_RestrictedActions2 = require("~system/RestrictedActions");
2153
+ var import_RestrictedActions3 = require("~system/RestrictedActions");
1782
2154
  var POLL_INTERVAL_ACTIVE = 5e3;
1783
2155
  var POLL_INTERVAL_PASSIVE = 3e4;
1784
2156
  var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
2157
+ var HISTORY_ERROR_ID = "sys-history-error";
1785
2158
  var ChatUIModule = class {
1786
2159
  constructor(client, config = {}) {
1787
2160
  // Visibility state
@@ -1805,6 +2178,8 @@ var ChatUIModule = class {
1805
2178
  this.systemMessages = [];
1806
2179
  this.inputText = "";
1807
2180
  this.chatScrollOffset = 0;
2181
+ // The last history read's failure, shown as the messages' last line until a read succeeds (2026-11-17)
2182
+ this.historyError = "";
1808
2183
  // UI preferences
1809
2184
  this.position = "right";
1810
2185
  // Timers
@@ -1819,6 +2194,7 @@ var ChatUIModule = class {
1819
2194
  * Always renders toggle button, plus panel when visible
1820
2195
  */
1821
2196
  this.getComponent = () => {
2197
+ if (this.client.isVisitorBlocked) return null;
1822
2198
  const scaledTheme = scaleChatTheme(DEFAULT_CHAT_THEME, this.client.uiScale);
1823
2199
  const positionStyle = this.getPositionStyle();
1824
2200
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
@@ -1959,7 +2335,7 @@ var ChatUIModule = class {
1959
2335
  this.isSigningIn = true;
1960
2336
  try {
1961
2337
  const baseUrl = this.getBaseUrl();
1962
- const response = await (0, import_SignedFetch.signedFetch)({
2338
+ const response = await (0, import_SignedFetch2.signedFetch)({
1963
2339
  url: `${baseUrl}/api/auth/dcl`,
1964
2340
  init: {
1965
2341
  method: "POST",
@@ -2011,8 +2387,13 @@ var ChatUIModule = class {
2011
2387
  async fetchMessages() {
2012
2388
  try {
2013
2389
  const baseUrl = this.getBaseUrl();
2014
- const response = await fetch(`${baseUrl}/api/chat/history?channelId=${this.currentChannelId}`);
2390
+ const response = await fetch(`${baseUrl}/api/chat/history?channelId=${encodeURIComponent(this.currentChannelId)}`);
2391
+ if (!response.ok) {
2392
+ this.historyError = `CHAT HISTORY UNAVAILABLE (${response.status})`;
2393
+ return;
2394
+ }
2015
2395
  const data = await response.json();
2396
+ this.historyError = "";
2016
2397
  if (data.messages) {
2017
2398
  const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
2018
2399
  const recentMsgs = data.messages.filter(
@@ -2040,6 +2421,7 @@ var ChatUIModule = class {
2040
2421
  this.realMessages = sortedMsgs;
2041
2422
  }
2042
2423
  } catch (e) {
2424
+ this.historyError = "CHAT HISTORY UNAVAILABLE";
2043
2425
  }
2044
2426
  }
2045
2427
  async handleSend() {
@@ -2055,7 +2437,7 @@ var ChatUIModule = class {
2055
2437
  this.inputText = "";
2056
2438
  try {
2057
2439
  const baseUrl = this.getBaseUrl();
2058
- const response = await (0, import_SignedFetch.signedFetch)({
2440
+ const response = await (0, import_SignedFetch2.signedFetch)({
2059
2441
  url: `${baseUrl}/api/chat/send`,
2060
2442
  init: {
2061
2443
  method: "POST",
@@ -2098,6 +2480,7 @@ var ChatUIModule = class {
2098
2480
  switchChannel(channelId) {
2099
2481
  this.currentChannelId = channelId;
2100
2482
  this.realMessages = [];
2483
+ this.historyError = "";
2101
2484
  this.showChannelDropdown = false;
2102
2485
  this.chatScrollOffset = 0;
2103
2486
  this.channelPage = 0;
@@ -2212,6 +2595,16 @@ var ChatUIModule = class {
2212
2595
  }
2213
2596
  renderMessagesArea(theme) {
2214
2597
  const allMessages = [...this.systemMessages, ...this.realMessages];
2598
+ if (this.historyError) {
2599
+ allMessages.push({
2600
+ id: HISTORY_ERROR_ID,
2601
+ username: "SYSTEM",
2602
+ text: this.historyError,
2603
+ uid: "system",
2604
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2605
+ isSystem: true
2606
+ });
2607
+ }
2215
2608
  const totalMessages = allMessages.length;
2216
2609
  const maxOffset = Math.max(0, totalMessages - UI_DIMENSIONS.chat.messagesPerPage);
2217
2610
  if (this.chatScrollOffset > maxOffset) this.chatScrollOffset = maxOffset;
@@ -2298,7 +2691,12 @@ var ChatUIModule = class {
2298
2691
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2299
2692
  key: msg.id,
2300
2693
  uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2301
- uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2694
+ uiText: {
2695
+ value: msg.text,
2696
+ fontSize: theme.systemMessage,
2697
+ color: msg.id === HISTORY_ERROR_ID ? THEME.colors.yellow : THEME.colors.green,
2698
+ textAlign: "middle-left"
2699
+ }
2302
2700
  });
2303
2701
  }
2304
2702
  renderChatMessage(msg, theme) {
@@ -2413,7 +2811,7 @@ var ChatUIModule = class {
2413
2811
  uiBackground: { color: THEME.colors.cyan },
2414
2812
  color: import_math4.Color4.Black(),
2415
2813
  onMouseDown: () => {
2416
- (0, import_RestrictedActions2.openExternalUrl)({ url: `${baseUrl}/apply` });
2814
+ (0, import_RestrictedActions3.openExternalUrl)({ url: `${baseUrl}/login` });
2417
2815
  }
2418
2816
  })
2419
2817
  ]
@@ -2585,11 +2983,11 @@ var ChatUIModule = class {
2585
2983
  };
2586
2984
 
2587
2985
  // src/ui/admin-panel-ui.tsx
2588
- var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
2589
- var import_math5 = require("@dcl/sdk/math");
2986
+ var import_react_ecs6 = __toESM(require("@dcl/sdk/react-ecs"));
2987
+ var import_math7 = require("@dcl/sdk/math");
2590
2988
  var import_players2 = require("@dcl/sdk/players");
2591
- var import_RestrictedActions3 = require("~system/RestrictedActions");
2592
- var import_SignedFetch2 = require("~system/SignedFetch");
2989
+ var import_RestrictedActions6 = require("~system/RestrictedActions");
2990
+ var import_SignedFetch3 = require("~system/SignedFetch");
2593
2991
 
2594
2992
  // src/ui/ui-renderer.tsx
2595
2993
  var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
@@ -2697,6 +3095,7 @@ function createStaticUI(client) {
2697
3095
  initNotificationSystem();
2698
3096
  return function StaticUI() {
2699
3097
  const currentScale = client.uiScale;
3098
+ const blocked = client.isVisitorBlocked;
2700
3099
  const guideComponent = client.guideUI?.getComponent() ?? null;
2701
3100
  const chatComponent = client.chatUI?.getComponent() ?? null;
2702
3101
  const adminComponent = client.adminPanel?.getComponent() ?? null;
@@ -2712,7 +3111,7 @@ function createStaticUI(client) {
2712
3111
  alignItems: "center"
2713
3112
  }
2714
3113
  },
2715
- /* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
3114
+ blocked ? null : /* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
2716
3115
  guideComponent,
2717
3116
  chatComponent,
2718
3117
  adminComponent
@@ -2724,8 +3123,389 @@ function setupStaticUI(client) {
2724
3123
  import_react_ecs4.ReactEcsRenderer.setUiRenderer(StaticUI);
2725
3124
  }
2726
3125
 
3126
+ // src/ui/blocked-notice.tsx
3127
+ var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
3128
+ var import_math5 = require("@dcl/sdk/math");
3129
+ var import_RestrictedActions4 = require("~system/RestrictedActions");
3130
+ var DEFAULT_SITE_URL = "https://thestatic.tv";
3131
+ function blockedNoticeLines(standing, kickLeftMs) {
3132
+ if (standing === "banned") {
3133
+ return ["BANNED FROM THIS SCENE", "The scene's moderators banned", "this wallet."];
3134
+ }
3135
+ if (standing === "kicked") {
3136
+ const minutes = Math.max(1, Math.ceil(kickLeftMs / 6e4));
3137
+ return ["REMOVED FROM THIS SCENE", "A moderator cleared the scene.", `You can come back in ${minutes} min.`];
3138
+ }
3139
+ if (standing === "private") {
3140
+ return ["PRIVATE EVENT", "Open to TheStatic.tv citizens right now."];
3141
+ }
3142
+ return [];
3143
+ }
3144
+ function blockedNoticeAction(standing, siteUrl = DEFAULT_SITE_URL) {
3145
+ if (standing === "private") return { label: "BECOME A CITIZEN", url: `${siteUrl}/login` };
3146
+ return null;
3147
+ }
3148
+ function BlockedNotice(props) {
3149
+ const lines = blockedNoticeLines(props.standing, props.kickLeftMs);
3150
+ if (lines.length === 0) return null;
3151
+ const s = (v) => Math.round(v * props.scale);
3152
+ const [title, ...body] = lines;
3153
+ const action = blockedNoticeAction(props.standing, props.siteUrl || DEFAULT_SITE_URL);
3154
+ return /* @__PURE__ */ import_react_ecs5.default.createElement(
3155
+ import_react_ecs5.UiEntity,
3156
+ {
3157
+ uiTransform: {
3158
+ width: "100%",
3159
+ height: "100%",
3160
+ positionType: "absolute",
3161
+ justifyContent: "center",
3162
+ alignItems: "center"
3163
+ }
3164
+ },
3165
+ /* @__PURE__ */ import_react_ecs5.default.createElement(
3166
+ import_react_ecs5.UiEntity,
3167
+ {
3168
+ uiTransform: { width: s(460), flexDirection: "column", alignItems: "center", padding: s(20) },
3169
+ uiBackground: { color: import_math5.Color4.create(0.05, 0.05, 0.08, 0.95) }
3170
+ },
3171
+ /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: title, fontSize: s(22), color: import_math5.Color4.create(0.9, 0.2, 0.2, 1), uiTransform: { height: s(34) } }),
3172
+ body.map((line, i) => /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { key: `blocked-line-${i}`, value: line, fontSize: s(16), color: import_math5.Color4.White(), uiTransform: { height: s(26) } })),
3173
+ action && /* @__PURE__ */ import_react_ecs5.default.createElement(
3174
+ import_react_ecs5.Button,
3175
+ {
3176
+ uiTransform: { width: s(220), height: s(36), margin: { top: s(12) } },
3177
+ uiBackground: { color: import_math5.Color4.create(0, 0.8, 0.8, 1) },
3178
+ value: action.label,
3179
+ fontSize: s(16),
3180
+ color: import_math5.Color4.Black(),
3181
+ onMouseDown: () => {
3182
+ (0, import_RestrictedActions4.openExternalUrl)({ url: action.url });
3183
+ }
3184
+ }
3185
+ )
3186
+ )
3187
+ );
3188
+ }
3189
+
3190
+ // src/utils/player-wait.ts
3191
+ var PLAYER_WAIT_STEP_MS = 1e3;
3192
+ var PLAYER_WAIT_MAX_MS = 30 * 1e3;
3193
+ var isGuest = (player) => player.isGuest === true;
3194
+ var PlayerWait = class {
3195
+ constructor(deps) {
3196
+ this.timerId = null;
3197
+ this.reads = 0;
3198
+ /** This wait has checked a guest reading already */
3199
+ this.guestChecked = false;
3200
+ this.deps = deps;
3201
+ }
3202
+ get stepMs() {
3203
+ return this.deps.stepMs ?? PLAYER_WAIT_STEP_MS;
3204
+ }
3205
+ get maxMs() {
3206
+ return this.deps.maxMs ?? PLAYER_WAIT_MAX_MS;
3207
+ }
3208
+ /** True while a wait is reading the player */
3209
+ get waiting() {
3210
+ return this.timerId !== null;
3211
+ }
3212
+ /**
3213
+ * The check with the player now, or - with no player yet - a wait that runs it once one appears. A guest reading is
3214
+ * checked now and the wait goes on for a non-guest one. Resolves when the check is done, or at once when there is
3215
+ * none to run.
3216
+ */
3217
+ async run() {
3218
+ const player = this.read();
3219
+ if (player && !isGuest(player)) {
3220
+ this.stop();
3221
+ await this.deps.check(player);
3222
+ return;
3223
+ }
3224
+ if (player) {
3225
+ this.start("A guest reading - checked now; waiting for a non-guest one");
3226
+ this.guestChecked = true;
3227
+ await this.deps.check(player);
3228
+ return;
3229
+ }
3230
+ this.start("No player data yet - waiting for one");
3231
+ }
3232
+ /** A wait, unless one is running (one at a time) */
3233
+ start(msg) {
3234
+ if (this.timerId !== null) return;
3235
+ this.reads = 0;
3236
+ this.guestChecked = false;
3237
+ this.deps.log?.(msg);
3238
+ this.timerId = this.deps.setInterval(() => this.tick(), this.stepMs);
3239
+ }
3240
+ tick() {
3241
+ this.reads++;
3242
+ const player = this.read();
3243
+ if (player && !isGuest(player)) {
3244
+ this.stop();
3245
+ this.deps.log?.(`Player resolved after ${this.reads} read(s)`);
3246
+ this.deps.check(player).catch(() => {
3247
+ });
3248
+ return;
3249
+ }
3250
+ if (player && !this.guestChecked) {
3251
+ this.guestChecked = true;
3252
+ this.deps.log?.(`A guest reading after ${this.reads} read(s) - checked now; still waiting for a non-guest one`);
3253
+ this.deps.check(player).catch(() => {
3254
+ });
3255
+ }
3256
+ if (this.reads * this.stepMs >= this.maxMs) {
3257
+ this.stop();
3258
+ this.deps.log?.(`No non-guest player after ${this.maxMs / 1e3} s - no further check`);
3259
+ }
3260
+ }
3261
+ stop() {
3262
+ if (this.timerId === null) return;
3263
+ this.deps.clearInterval(this.timerId);
3264
+ this.timerId = null;
3265
+ }
3266
+ read() {
3267
+ try {
3268
+ const player = this.deps.getPlayer();
3269
+ return player && player.userId ? player : null;
3270
+ } catch {
3271
+ return null;
3272
+ }
3273
+ }
3274
+ };
3275
+
3276
+ // src/modules/moderation.ts
3277
+ var import_ecs4 = require("@dcl/sdk/ecs");
3278
+ var import_math6 = require("@dcl/sdk/math");
3279
+ var import_RestrictedActions5 = require("~system/RestrictedActions");
3280
+ var KICK_MS = 2 * 60 * 1e3;
3281
+ var REREAD_MS = 60 * 1e3;
3282
+ var READ_GAP_MS = 5e3;
3283
+ var HINT_SPREAD_MS = 3e3;
3284
+ var CITIZEN_WAIT_MS = 1e4;
3285
+ var CHECK_EVERY_S = 1;
3286
+ function namesMe(wallet, mine) {
3287
+ if (typeof wallet !== "string" || wallet === "") return false;
3288
+ if (typeof mine !== "string" || mine === "") return false;
3289
+ return wallet.toLowerCase() === mine.toLowerCase();
3290
+ }
3291
+ var ModerationModule = class {
3292
+ constructor(deps) {
3293
+ this.banned = false;
3294
+ this.kickedUntil = 0;
3295
+ this.canModerate = false;
3296
+ // Private mode (2026-11-19): the last answer's word on this visitor, its isCitizen and when it came, a hint's read
3297
+ // waiting its random spread, and the callers of checkCitizen() waiting on the next read
3298
+ this.privateBlocked = false;
3299
+ this.citizen = false;
3300
+ this.citizenAnsweredAt = null;
3301
+ this.hintDueAt = null;
3302
+ this.readWaiters = [];
3303
+ this.rects = [];
3304
+ this.boxes = [];
3305
+ this.spawn = null;
3306
+ this.wallEntities = [];
3307
+ this.lastBlocked = false;
3308
+ this.lastStanding = "clear";
3309
+ this.lastReadAt = Number.NEGATIVE_INFINITY;
3310
+ this.readInFlight = false;
3311
+ this.readPending = false;
3312
+ this.wasInScene = null;
3313
+ this.sinceCheck = 0;
3314
+ this.started = false;
3315
+ /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor out of place moved to the front entry */
3316
+ this.system = (dt) => {
3317
+ if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
3318
+ this.hintDueAt = null;
3319
+ this.requestRead();
3320
+ }
3321
+ if (this.readWaiters.length > 0) {
3322
+ const t = this.now();
3323
+ const expired = this.readWaiters.filter((w) => t >= w.deadline);
3324
+ if (expired.length > 0) {
3325
+ this.readWaiters = this.readWaiters.filter((w) => t < w.deadline);
3326
+ for (const w of expired) w.resolve();
3327
+ }
3328
+ }
3329
+ this.sinceCheck += dt;
3330
+ if (this.sinceCheck < CHECK_EVERY_S) return;
3331
+ this.sinceCheck = 0;
3332
+ const now = this.now();
3333
+ if (this.kickedUntil > 0 && now >= this.kickedUntil) {
3334
+ this.kickedUntil = 0;
3335
+ this.sync();
3336
+ }
3337
+ const me = getPlayerPosition();
3338
+ const inScene = me !== null && this.rects.length > 0 && inParcels(me, this.rects);
3339
+ if (inScene && this.wasInScene === false) this.readPending = true;
3340
+ if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
3341
+ this.wasInScene = inScene;
3342
+ this.tryRead();
3343
+ if (me && this.blocked) {
3344
+ const to = entryPoint(this.boxes, this.rects, this.spawn, me);
3345
+ if (to && mustMoveToEntry(me, this.boxes, this.rects, to.y)) {
3346
+ this.log("Blocked and inside the scene - moving to the front entry", to);
3347
+ Promise.resolve((0, import_RestrictedActions5.movePlayerTo)({ newRelativePosition: import_math6.Vector3.create(to.x, to.y, to.z) })).catch(() => {
3348
+ });
3349
+ }
3350
+ }
3351
+ };
3352
+ this.deps = deps;
3353
+ }
3354
+ now() {
3355
+ return this.deps.now ? this.deps.now() : Date.now();
3356
+ }
3357
+ log(msg, ...args) {
3358
+ this.deps.log?.(msg, ...args);
3359
+ }
3360
+ /** Reads the scene's parcels and starts the checks (once) */
3361
+ async start() {
3362
+ if (this.started) return;
3363
+ this.started = true;
3364
+ import_ecs4.engine.addSystem(this.system);
3365
+ try {
3366
+ await getSceneBounds();
3367
+ this.rects = getParcelRects();
3368
+ this.boxes = wallBoxes(this.rects);
3369
+ this.spawn = getSpawnPoint();
3370
+ } catch {
3371
+ }
3372
+ this.sync();
3373
+ }
3374
+ /** banned, kicked (KICK ALL, until it lapses), private (the scene's private mode) or clear - in that precedence */
3375
+ get standing() {
3376
+ if (this.banned) return "banned";
3377
+ if (this.kickedUntil > 0 && this.now() < this.kickedUntil) return "kicked";
3378
+ if (this.privateBlocked) return "private";
3379
+ return "clear";
3380
+ }
3381
+ /** The last answer's isCitizen (2026-11-19): false before one, and from a server that does not answer it */
3382
+ get isCitizen() {
3383
+ return this.citizen;
3384
+ }
3385
+ /**
3386
+ * Whether this visitor is a TheStatic.tv citizen (2026-11-19): the last answer when it is under READ_GAP_MS old, else
3387
+ * the answer of the next read - started now, or the one in flight - through the same gate as every other read. A
3388
+ * read that fails answers what the last one said (false before any), and so does one that has not settled within
3389
+ * CITIZEN_WAIT_MS (the module's system ends that wait).
3390
+ */
3391
+ async checkCitizen() {
3392
+ if (this.citizenAnsweredAt !== null && this.now() - this.citizenAnsweredAt < READ_GAP_MS) return this.citizen;
3393
+ await new Promise((resolve) => {
3394
+ this.readWaiters.push({ resolve, deadline: this.now() + CITIZEN_WAIT_MS });
3395
+ if (!this.readInFlight) this.requestRead();
3396
+ });
3397
+ return this.citizen;
3398
+ }
3399
+ get blocked() {
3400
+ return this.standing !== "clear";
3401
+ }
3402
+ /** How long a kick has left, in ms (0 when not kicked) */
3403
+ get kickLeftMs() {
3404
+ return this.standing === "kicked" ? Math.max(0, this.kickedUntil - this.now()) : 0;
3405
+ }
3406
+ /**
3407
+ * admin-check's answer: the ban list's word on this visitor, whether they moderate the scene, and (2026-11-19) the
3408
+ * private mode's word and whether they are a citizen. Only the boolean true counts, so an answer without the new
3409
+ * fields reads as open and not a citizen. One who can moderate is never walled by private mode here, whatever the
3410
+ * answer says (the server admits them; this keeps a wrong answer from locking an admin out).
3411
+ */
3412
+ applyStanding(answer) {
3413
+ this.banned = answer.isBanned === true;
3414
+ this.canModerate = answer.canModerate === true;
3415
+ this.privateBlocked = answer.privateBlocked === true && !this.canModerate;
3416
+ this.citizen = answer.isCitizen === true;
3417
+ this.citizenAnsweredAt = this.now();
3418
+ this.lastReadAt = Math.max(this.lastReadAt, this.now());
3419
+ this.sync();
3420
+ }
3421
+ /**
3422
+ * A command from the scene's queue (the poll every visitor runs). Returns true for the three this module takes.
3423
+ * kickBanned names a wallet: the named visitor re-reads their standing, every other visitor does nothing.
3424
+ * privateMode (2026-11-19) is a hint for every visitor: its payload is not read - a re-read after a random wait of up
3425
+ * to HINT_SPREAD_MS, joined by any hint that comes while it waits, and still gated by one read in flight and
3426
+ * READ_GAP_MS, so no number of hints makes this copy read faster than that.
3427
+ */
3428
+ handleCommand(type, payload) {
3429
+ if (type === "privateMode") {
3430
+ if (this.hintDueAt === null) {
3431
+ const r = this.deps.random ? this.deps.random() : Math.random();
3432
+ const wait = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) * HINT_SPREAD_MS : 0;
3433
+ this.hintDueAt = this.now() + wait;
3434
+ this.log(`Private mode changed - reading my standing in ${Math.round(wait)} ms`);
3435
+ }
3436
+ return true;
3437
+ }
3438
+ if (type === "kickBanned") {
3439
+ if (namesMe(payload?.wallet, this.deps.myWallet())) {
3440
+ this.log("A kick names me - reading my standing");
3441
+ this.requestRead();
3442
+ }
3443
+ return true;
3444
+ }
3445
+ if (type === "kickAll") {
3446
+ if (!this.canModerate) {
3447
+ this.kickedUntil = this.now() + KICK_MS;
3448
+ this.sync();
3449
+ }
3450
+ return true;
3451
+ }
3452
+ return false;
3453
+ }
3454
+ /** Ask for a fresh standing read: at once when the gate allows, else as soon as it does */
3455
+ requestRead() {
3456
+ this.readPending = true;
3457
+ this.tryRead();
3458
+ }
3459
+ tryRead() {
3460
+ if (!this.readPending || this.readInFlight) return;
3461
+ const now = this.now();
3462
+ if (now - this.lastReadAt < READ_GAP_MS) return;
3463
+ this.readPending = false;
3464
+ this.readInFlight = true;
3465
+ this.lastReadAt = now;
3466
+ this.deps.reread().catch(() => {
3467
+ }).finally(() => {
3468
+ this.readInFlight = false;
3469
+ const waiters = this.readWaiters;
3470
+ this.readWaiters = [];
3471
+ for (const w of waiters) w.resolve();
3472
+ });
3473
+ }
3474
+ /** The walls follow blocked; the scene hears of a change */
3475
+ sync() {
3476
+ const standing = this.standing;
3477
+ const blocked = standing !== "clear";
3478
+ if (blocked && this.wallEntities.length === 0) this.raiseWalls();
3479
+ if (!blocked && this.wallEntities.length > 0) this.lowerWalls();
3480
+ if (blocked !== this.lastBlocked || standing !== this.lastStanding) {
3481
+ this.lastBlocked = blocked;
3482
+ this.lastStanding = standing;
3483
+ this.log(`Standing: ${standing}`);
3484
+ this.deps.onChange?.(blocked, standing);
3485
+ }
3486
+ }
3487
+ raiseWalls() {
3488
+ for (const b of this.boxes) {
3489
+ const wall = import_ecs4.engine.addEntity();
3490
+ import_ecs4.Transform.create(wall, {
3491
+ position: import_math6.Vector3.create((b.minX + b.maxX) / 2, b.top / 2, (b.minZ + b.maxZ) / 2),
3492
+ scale: import_math6.Vector3.create(b.maxX - b.minX, b.top, b.maxZ - b.minZ)
3493
+ });
3494
+ import_ecs4.MeshCollider.setBox(wall, import_ecs4.ColliderLayer.CL_PHYSICS);
3495
+ this.wallEntities.push(wall);
3496
+ }
3497
+ }
3498
+ lowerWalls() {
3499
+ for (const wall of this.wallEntities) import_ecs4.engine.removeEntity(wall);
3500
+ this.wallEntities = [];
3501
+ }
3502
+ /** The walls this copy has up (one per parcel while blocked) */
3503
+ get wallCount() {
3504
+ return this.wallEntities.length;
3505
+ }
3506
+ };
3507
+
2727
3508
  // src/ui/admin-panel-ui.tsx
2728
- var BAN_KICK_POSITION = import_math5.Vector3.create(16, -50, 16);
2729
3509
  var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
2730
3510
  function figuresOf(value) {
2731
3511
  const figures = value?.figures;
@@ -2758,22 +3538,23 @@ function channelDeleteLines(look, changed) {
2758
3538
  lines.push("Stream history is kept");
2759
3539
  return lines;
2760
3540
  }
3541
+ var SEEN_COMMAND_IDS_MAX = 200;
2761
3542
  var C2 = {
2762
- bg: import_math5.Color4.create(0.08, 0.08, 0.12, 0.98),
2763
- header: import_math5.Color4.create(0.9, 0.15, 0.15, 1),
2764
- tabActive: import_math5.Color4.create(0, 0.7, 0.7, 1),
2765
- tabInactive: import_math5.Color4.create(0.15, 0.15, 0.2, 1),
2766
- section: import_math5.Color4.create(0.12, 0.12, 0.18, 1),
2767
- btn: import_math5.Color4.create(0.2, 0.2, 0.28, 1),
2768
- cyan: import_math5.Color4.create(0, 0.8, 0.8, 1),
2769
- magenta: import_math5.Color4.create(0.85, 0.2, 0.55, 1),
2770
- yellow: import_math5.Color4.create(0.95, 0.75, 0.1, 1),
2771
- green: import_math5.Color4.create(0.2, 0.75, 0.3, 1),
2772
- red: import_math5.Color4.create(0.85, 0.2, 0.2, 1),
2773
- purple: import_math5.Color4.create(0.6, 0.3, 0.85, 1),
2774
- orange: import_math5.Color4.create(0.95, 0.5, 0.15, 1),
2775
- text: import_math5.Color4.White(),
2776
- textDim: import_math5.Color4.create(0.6, 0.6, 0.7, 1)
3543
+ bg: import_math7.Color4.create(0.08, 0.08, 0.12, 0.98),
3544
+ header: import_math7.Color4.create(0.9, 0.15, 0.15, 1),
3545
+ tabActive: import_math7.Color4.create(0, 0.7, 0.7, 1),
3546
+ tabInactive: import_math7.Color4.create(0.15, 0.15, 0.2, 1),
3547
+ section: import_math7.Color4.create(0.12, 0.12, 0.18, 1),
3548
+ btn: import_math7.Color4.create(0.2, 0.2, 0.28, 1),
3549
+ cyan: import_math7.Color4.create(0, 0.8, 0.8, 1),
3550
+ magenta: import_math7.Color4.create(0.85, 0.2, 0.55, 1),
3551
+ yellow: import_math7.Color4.create(0.95, 0.75, 0.1, 1),
3552
+ green: import_math7.Color4.create(0.2, 0.75, 0.3, 1),
3553
+ red: import_math7.Color4.create(0.85, 0.2, 0.2, 1),
3554
+ purple: import_math7.Color4.create(0.6, 0.3, 0.85, 1),
3555
+ orange: import_math7.Color4.create(0.95, 0.5, 0.15, 1),
3556
+ text: import_math7.Color4.White(),
3557
+ textDim: import_math7.Color4.create(0.6, 0.6, 0.7, 1)
2777
3558
  };
2778
3559
  var AdminPanelUIModule = class {
2779
3560
  // UI scaling - uses shared client.uiScale
@@ -2815,34 +3596,90 @@ var AdminPanelUIModule = class {
2815
3596
  this.broadcastText = "";
2816
3597
  this.modStatus = "";
2817
3598
  this.modsFetched = false;
3599
+ // What the last kick sent from the Mod tab came to (2026-11-17): KICK ALL and the ban's kick are queued on
3600
+ // thestatic.tv, where every visitor's copy reads them
3601
+ this.kickStatus = "";
3602
+ // The Video and Broadcast buttons go through the same queue since 2026-11-18 (until then they reached the presser's
3603
+ // copy alone): what the last send from each came to, one line a section
3604
+ this.videoStatus = "";
3605
+ this.broadcastStatus = "";
3606
+ /** The url the screen last played - the scene's current one from the video state at load, or the last play here - which PLAYBACK Play sends */
3607
+ this.currentVideoUrl = null;
3608
+ // Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
3609
+ // status line, and the once-a-load gates for the declaration's upload and the saved state's read
3610
+ this.controls = [];
3611
+ this.currentOption = {};
3612
+ this.controlStatus = "";
3613
+ this.controlsUploaded = false;
3614
+ this.stateRead = false;
3615
+ /** init has read the video state: the saved control state may be read now (a persist control registered later reads then) */
3616
+ this.loadReadsDone = false;
3617
+ // The command poll (2026-11-18): the server's cursor, sent back as since once known, and the ids seen - the last
3618
+ // SEEN_COMMAND_IDS_MAX, this copy's own sends among them - so no command runs twice here
3619
+ this.commandCursor = null;
3620
+ this.seenCommandIds = /* @__PURE__ */ new Set();
3621
+ this.seenCommandOrder = [];
3622
+ this.controlLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3623
+ this.controlStatus = line;
3624
+ } };
3625
+ this.videoLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3626
+ this.videoStatus = line;
3627
+ } };
3628
+ this.broadcastLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3629
+ this.broadcastStatus = line;
3630
+ } };
3631
+ // Private mode (2026-11-19, Venue): the switch's state from the last read (null until an answer carries it), and the
3632
+ // MOD tab's line for the switch
3633
+ this.privateModeOn = null;
3634
+ this.privateStatus = "";
3635
+ this.privateLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3636
+ this.privateStatus = line;
3637
+ } };
2818
3638
  // --- UI Components ---
2819
- this.SectionHead = ({ label, color }) => /* @__PURE__ */ import_react_ecs5.default.createElement(
2820
- import_react_ecs5.UiEntity,
3639
+ this.SectionHead = ({ label, color }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3640
+ import_react_ecs6.UiEntity,
2821
3641
  {
2822
3642
  uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.sectionHeadHeight), margin: { bottom: 8 }, padding: { left: 10 }, alignItems: "center" },
2823
- uiBackground: { color: import_math5.Color4.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
3643
+ uiBackground: { color: import_math7.Color4.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
2824
3644
  },
2825
- /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: label, fontSize: this.theme.sectionHead, color })
3645
+ /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: label, fontSize: this.theme.sectionHead, color })
2826
3646
  );
2827
- this.TabBtn = ({ label, tab }) => /* @__PURE__ */ import_react_ecs5.default.createElement(
2828
- import_react_ecs5.Button,
3647
+ this.TabBtn = ({ label, tab }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3648
+ import_react_ecs6.Button,
2829
3649
  {
2830
3650
  uiTransform: { flexGrow: 1, height: this.s(UI_DIMENSIONS.admin.tabHeight), justifyContent: "center", alignItems: "center" },
2831
3651
  uiBackground: { color: this.activeTab === tab ? C2.tabActive : C2.tabInactive },
2832
3652
  value: label,
2833
3653
  fontSize: this.theme.tabButton,
2834
- color: this.activeTab === tab ? import_math5.Color4.Black() : C2.text,
3654
+ color: this.activeTab === tab ? import_math7.Color4.Black() : C2.text,
2835
3655
  textAlign: "middle-center",
2836
3656
  onMouseDown: () => this.setActiveTab(tab)
2837
3657
  }
2838
3658
  );
3659
+ /**
3660
+ * The CONTROLS tab (2026-11-18): a section per registered control, a button per option, OFF when the control has one,
3661
+ * the current option highlighted, and one status line for the last press. Listed first in the tab bar, only when
3662
+ * controls are registered, for the same admins the VIDEO tab is.
3663
+ */
3664
+ this.ControlsTab = () => {
3665
+ const t = this.theme;
3666
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.controls.map((control) => /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { key: `control-${control.id}`, uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: control.label, color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, control.options.map((option) => this.controlButton(control, option.id, option.label)), control.off === true && this.controlButton(control, "off", "OFF")))), this.controlStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3667
+ import_react_ecs6.Label,
3668
+ {
3669
+ value: this.controlStatus,
3670
+ fontSize: t.status,
3671
+ color: this.controlStatus.startsWith("Not sent") ? C2.red : C2.green,
3672
+ uiTransform: { height: this.s(18) }
3673
+ }
3674
+ ));
3675
+ };
2839
3676
  this.VideoTab = () => {
2840
3677
  if (!this.streamFetched) {
2841
3678
  this.fetchStreamData();
2842
3679
  }
2843
3680
  const t = this.theme;
2844
- return /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2845
- import_react_ecs5.Button,
3681
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3682
+ import_react_ecs6.Button,
2846
3683
  {
2847
3684
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2848
3685
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
@@ -2851,8 +3688,8 @@ var AdminPanelUIModule = class {
2851
3688
  color: C2.text,
2852
3689
  onMouseDown: () => this.claimTrial()
2853
3690
  }
2854
- ), this.trialClaimError && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2855
- import_react_ecs5.Button,
3691
+ ), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3692
+ import_react_ecs6.Button,
2856
3693
  {
2857
3694
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2858
3695
  uiBackground: { color: this.channelCreating ? C2.btn : C2.cyan },
@@ -2861,47 +3698,47 @@ var AdminPanelUIModule = class {
2861
3698
  color: C2.text,
2862
3699
  onMouseDown: () => this.createChannel()
2863
3700
  }
2864
- ), this.channelCreateError && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Relay tier \u2022 $25/mo \u2022 8 hours streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })))), this.streamData?.hasChannel && this.isOwner && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2865
- import_react_ecs5.Label,
3701
+ ), this.channelCreateError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Relay tier \u2022 $25/mo \u2022 8 hours streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })))), this.streamData?.hasChannel && this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3702
+ import_react_ecs6.Label,
2866
3703
  {
2867
3704
  value: this.streamData.isLive ? `LIVE \u2022 ${this.streamData.currentViewers || 0} viewers` : "OFFLINE",
2868
3705
  fontSize: t.label,
2869
3706
  color: this.streamData.isLive ? C2.red : C2.textDim
2870
3707
  }
2871
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ import_react_ecs5.default.createElement(
2872
- import_react_ecs5.Label,
3708
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ import_react_ecs6.default.createElement(
3709
+ import_react_ecs6.Label,
2873
3710
  {
2874
3711
  value: `Channel: ${this.streamData.channelName || this.streamData.channelId}`,
2875
3712
  fontSize: t.labelSmall,
2876
3713
  color: C2.textDim,
2877
3714
  uiTransform: { margin: { bottom: 10 } }
2878
3715
  }
2879
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs5.default.createElement(
2880
- import_react_ecs5.Label,
3716
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
3717
+ import_react_ecs6.Label,
2881
3718
  {
2882
3719
  value: this.streamData.rtmpUrl || "Loading...",
2883
3720
  fontSize: t.label,
2884
3721
  color: this.streamData.rtmpUrl ? C2.text : C2.textDim,
2885
3722
  uiTransform: { margin: { left: 6 } }
2886
3723
  }
2887
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs5.default.createElement(
2888
- import_react_ecs5.Label,
3724
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
3725
+ import_react_ecs6.Label,
2889
3726
  {
2890
3727
  value: this.streamData.streamKey || "Loading...",
2891
3728
  fontSize: t.label,
2892
3729
  color: this.streamData.streamKey ? C2.cyan : C2.textDim,
2893
3730
  uiTransform: { margin: { left: 6 } }
2894
3731
  }
2895
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs5.default.createElement(
2896
- import_react_ecs5.Label,
3732
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
3733
+ import_react_ecs6.Label,
2897
3734
  {
2898
3735
  value: this.streamData.hlsUrl || "Not available",
2899
3736
  fontSize: t.label,
2900
3737
  color: this.streamData.hlsUrl ? C2.green : C2.textDim,
2901
3738
  uiTransform: { margin: { left: 6 } }
2902
3739
  }
2903
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ import_react_ecs5.default.createElement(
2904
- import_react_ecs5.Button,
3740
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ import_react_ecs6.default.createElement(
3741
+ import_react_ecs6.Button,
2905
3742
  {
2906
3743
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2907
3744
  uiBackground: { color: this.streamControlling ? C2.btn : C2.green },
@@ -2910,8 +3747,8 @@ var AdminPanelUIModule = class {
2910
3747
  color: C2.text,
2911
3748
  onMouseDown: () => this.startStream()
2912
3749
  }
2913
- ), this.streamData.isLive && /* @__PURE__ */ import_react_ecs5.default.createElement(
2914
- import_react_ecs5.Button,
3750
+ ), this.streamData.isLive && /* @__PURE__ */ import_react_ecs6.default.createElement(
3751
+ import_react_ecs6.Button,
2915
3752
  {
2916
3753
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2917
3754
  uiBackground: { color: this.streamControlling ? C2.btn : C2.red },
@@ -2920,18 +3757,18 @@ var AdminPanelUIModule = class {
2920
3757
  color: C2.text,
2921
3758
  onMouseDown: () => this.stopStream()
2922
3759
  }
2923
- ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs5.default.createElement(
2924
- import_react_ecs5.Button,
3760
+ ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs6.default.createElement(
3761
+ import_react_ecs6.Button,
2925
3762
  {
2926
3763
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2927
3764
  uiBackground: { color: C2.cyan },
2928
3765
  value: "Play on Screen",
2929
3766
  fontSize: t.buttonSmall,
2930
3767
  color: C2.text,
2931
- onMouseDown: () => this.config.onVideoPlay?.(this.streamData.hlsUrl)
3768
+ onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
2932
3769
  }
2933
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2934
- import_react_ecs5.Button,
3770
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3771
+ import_react_ecs6.Button,
2935
3772
  {
2936
3773
  uiTransform: { width: this.s(80), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2937
3774
  uiBackground: { color: C2.btn },
@@ -2940,8 +3777,8 @@ var AdminPanelUIModule = class {
2940
3777
  color: C2.text,
2941
3778
  onMouseDown: () => this.refreshStreamStatus()
2942
3779
  }
2943
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2944
- import_react_ecs5.Button,
3780
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3781
+ import_react_ecs6.Button,
2945
3782
  {
2946
3783
  uiTransform: { width: this.s(95), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2947
3784
  uiBackground: { color: this.keyRotating ? C2.btn : C2.yellow },
@@ -2950,8 +3787,8 @@ var AdminPanelUIModule = class {
2950
3787
  color: C2.text,
2951
3788
  onMouseDown: () => this.rotateStreamKey()
2952
3789
  }
2953
- ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ import_react_ecs5.default.createElement(
2954
- import_react_ecs5.Button,
3790
+ ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ import_react_ecs6.default.createElement(
3791
+ import_react_ecs6.Button,
2955
3792
  {
2956
3793
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2957
3794
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2960,8 +3797,8 @@ var AdminPanelUIModule = class {
2960
3797
  color: C2.text,
2961
3798
  onMouseDown: () => this.deleteChannel()
2962
3799
  }
2963
- )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2964
- import_react_ecs5.Button,
3800
+ )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3801
+ import_react_ecs6.Button,
2965
3802
  {
2966
3803
  uiTransform: { width: this.s(120), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2967
3804
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2970,8 +3807,8 @@ var AdminPanelUIModule = class {
2970
3807
  color: C2.text,
2971
3808
  onMouseDown: () => this.confirmDeleteChannel()
2972
3809
  }
2973
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2974
- import_react_ecs5.Button,
3810
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3811
+ import_react_ecs6.Button,
2975
3812
  {
2976
3813
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2977
3814
  uiBackground: { color: C2.btn },
@@ -2980,11 +3817,11 @@ var AdminPanelUIModule = class {
2980
3817
  color: C2.text,
2981
3818
  onMouseDown: () => this.cancelDeleteChannel()
2982
3819
  }
2983
- ))), this.streamControlStatus === "started" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2984
- import_react_ecs5.Input,
3820
+ ))), this.streamControlStatus === "started" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3821
+ import_react_ecs6.Input,
2985
3822
  {
2986
3823
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
2987
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
3824
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
2988
3825
  placeholder: "Video URL...",
2989
3826
  placeholderColor: C2.textDim,
2990
3827
  color: C2.text,
@@ -2994,20 +3831,18 @@ var AdminPanelUIModule = class {
2994
3831
  this.customVideoUrl = val;
2995
3832
  }
2996
3833
  }
2997
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2998
- import_react_ecs5.Button,
3834
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3835
+ import_react_ecs6.Button,
2999
3836
  {
3000
3837
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3001
3838
  uiBackground: { color: C2.green },
3002
3839
  value: "Play",
3003
3840
  fontSize: t.button,
3004
3841
  color: C2.text,
3005
- onMouseDown: () => {
3006
- if (this.customVideoUrl) this.config.onVideoPlay?.(this.customVideoUrl);
3007
- }
3842
+ onMouseDown: () => this.playNow()
3008
3843
  }
3009
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3010
- import_react_ecs5.Button,
3844
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3845
+ import_react_ecs6.Button,
3011
3846
  {
3012
3847
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 6 } },
3013
3848
  uiBackground: { color: C2.btn },
@@ -3018,55 +3853,82 @@ var AdminPanelUIModule = class {
3018
3853
  this.customVideoUrl = "";
3019
3854
  }
3020
3855
  }
3021
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3022
- import_react_ecs5.Button,
3856
+ )), this.videoStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3857
+ import_react_ecs6.Label,
3858
+ {
3859
+ value: this.videoStatus,
3860
+ fontSize: t.status,
3861
+ color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
3862
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3863
+ }
3864
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3865
+ import_react_ecs6.Button,
3023
3866
  {
3024
3867
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3025
3868
  uiBackground: { color: C2.green },
3026
3869
  value: "Play",
3027
3870
  fontSize: t.button,
3028
3871
  color: C2.text,
3029
- onMouseDown: () => this.config.onCommand?.("videoPlay", { playing: true })
3872
+ onMouseDown: () => this.playbackPlay()
3030
3873
  }
3031
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3032
- import_react_ecs5.Button,
3874
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3875
+ import_react_ecs6.Button,
3033
3876
  {
3034
3877
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3035
3878
  uiBackground: { color: C2.red },
3036
3879
  value: "Stop",
3037
3880
  fontSize: t.button,
3038
3881
  color: C2.text,
3039
- onMouseDown: () => this.config.onVideoStop?.()
3882
+ onMouseDown: () => this.playbackStop()
3040
3883
  }
3041
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3042
- import_react_ecs5.Button,
3884
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3885
+ import_react_ecs6.Button,
3043
3886
  {
3044
3887
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3045
3888
  uiBackground: { color: C2.btn },
3046
3889
  value: "Reset Default",
3047
3890
  fontSize: t.buttonSmall,
3048
3891
  color: C2.text,
3049
- onMouseDown: () => this.config.onCommand?.("videoClear", {})
3892
+ onMouseDown: () => this.resetDefault()
3050
3893
  }
3051
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Button, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 1", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot1") }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Button, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 2", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot2") }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Button, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 3", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot3") }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Button, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 4", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot4") }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Button, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 5", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot5") })), /* @__PURE__ */ import_react_ecs5.default.createElement(
3052
- import_react_ecs5.Button,
3894
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, ["slot1", "slot2", "slot3", "slot4", "slot5"].map((slot, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3895
+ import_react_ecs6.Button,
3896
+ {
3897
+ key: `play-${slot}`,
3898
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3899
+ uiBackground: { color: C2.cyan },
3900
+ value: `Play ${i + 1}`,
3901
+ fontSize: t.button,
3902
+ color: C2.text,
3903
+ onMouseDown: () => this.pressSlot(slot)
3904
+ }
3905
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(
3906
+ import_react_ecs6.Button,
3053
3907
  {
3054
3908
  uiTransform: { height: this.s(24) },
3055
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
3909
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3056
3910
  value: "Edit slots at thestatic.tv",
3057
3911
  fontSize: t.labelSmall,
3058
3912
  color: C2.cyan,
3059
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3913
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3060
3914
  }
3061
3915
  ));
3062
3916
  };
3063
3917
  this.ModTab = () => {
3064
3918
  const t = this.theme;
3065
- return /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "Error - check input", fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3066
- import_react_ecs5.Input,
3919
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Error - check input", fontSize: t.status, color: C2.red }), this.kickStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3920
+ import_react_ecs6.Label,
3921
+ {
3922
+ value: this.kickStatus,
3923
+ fontSize: t.status,
3924
+ color: this.kickStatus.startsWith("Kick not sent") ? C2.red : C2.green,
3925
+ uiTransform: { height: this.s(18) }
3926
+ }
3927
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3928
+ import_react_ecs6.Input,
3067
3929
  {
3068
3930
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3069
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
3931
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3070
3932
  placeholder: "Message to all players...",
3071
3933
  placeholderColor: C2.textDim,
3072
3934
  color: C2.text,
@@ -3076,8 +3938,8 @@ var AdminPanelUIModule = class {
3076
3938
  this.broadcastText = val;
3077
3939
  }
3078
3940
  }
3079
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3080
- import_react_ecs5.Button,
3941
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3942
+ import_react_ecs6.Button,
3081
3943
  {
3082
3944
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3083
3945
  uiBackground: { color: C2.orange },
@@ -3086,27 +3948,51 @@ var AdminPanelUIModule = class {
3086
3948
  color: C2.text,
3087
3949
  onMouseDown: () => this.sendBroadcast()
3088
3950
  }
3089
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3090
- import_react_ecs5.Button,
3951
+ )), this.broadcastStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3952
+ import_react_ecs6.Label,
3953
+ {
3954
+ value: this.broadcastStatus,
3955
+ fontSize: t.status,
3956
+ color: this.broadcastStatus.startsWith("Not sent") ? C2.red : C2.green,
3957
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3958
+ }
3959
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3960
+ import_react_ecs6.Button,
3091
3961
  {
3092
3962
  uiTransform: { width: this.s(130), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: 4 },
3093
3963
  uiBackground: { color: C2.red },
3094
3964
  value: "KICK ALL",
3095
3965
  fontSize: t.button,
3096
3966
  color: C2.text,
3097
- onMouseDown: () => {
3098
- this.log("KICK ALL clicked");
3099
- this.config.onCommand?.("kickAll", {});
3100
- }
3967
+ onMouseDown: () => this.kickAll()
3968
+ }
3969
+ )), this.venue && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PRIVATE MODE", color: C2.yellow }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "While ON, only citizens get in", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { height: this.s(18), margin: { bottom: 4 } } }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, [true, false].map((on) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3970
+ import_react_ecs6.Button,
3971
+ {
3972
+ key: `private-${on ? "on" : "off"}`,
3973
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3974
+ uiBackground: { color: this.privateModeOn === on ? C2.yellow : C2.btn },
3975
+ value: on ? "ON" : "OFF",
3976
+ fontSize: t.buttonSmall,
3977
+ color: this.privateModeOn === on ? import_math7.Color4.Black() : C2.text,
3978
+ onMouseDown: () => this.setPrivateMode(on)
3101
3979
  }
3102
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ import_react_ecs5.default.createElement(
3103
- import_react_ecs5.UiEntity,
3980
+ ))), this.privateStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3981
+ import_react_ecs6.Label,
3982
+ {
3983
+ value: this.privateStatus,
3984
+ fontSize: t.status,
3985
+ color: this.privateStatus.startsWith("Not sent") ? C2.red : C2.green,
3986
+ uiTransform: { height: this.s(18) }
3987
+ }
3988
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3989
+ import_react_ecs6.UiEntity,
3104
3990
  {
3105
3991
  key: `admin-${i}`,
3106
3992
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3107
3993
  },
3108
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3109
- import_react_ecs5.Label,
3994
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
3995
+ import_react_ecs6.Label,
3110
3996
  {
3111
3997
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3112
3998
  fontSize: t.label,
@@ -3114,8 +4000,8 @@ var AdminPanelUIModule = class {
3114
4000
  uiTransform: { width: this.s(130) }
3115
4001
  }
3116
4002
  ),
3117
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3118
- import_react_ecs5.Button,
4003
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4004
+ import_react_ecs6.Button,
3119
4005
  {
3120
4006
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3121
4007
  uiBackground: { color: C2.btn },
@@ -3125,11 +4011,11 @@ var AdminPanelUIModule = class {
3125
4011
  onMouseDown: () => this.removeSceneAdmin(wallet)
3126
4012
  }
3127
4013
  )
3128
- ))), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3129
- import_react_ecs5.Input,
4014
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
4015
+ import_react_ecs6.Input,
3130
4016
  {
3131
4017
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3132
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
4018
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3133
4019
  placeholder: "0x... add admin",
3134
4020
  placeholderColor: C2.textDim,
3135
4021
  color: C2.text,
@@ -3139,8 +4025,8 @@ var AdminPanelUIModule = class {
3139
4025
  this.newAdminWallet = val;
3140
4026
  }
3141
4027
  }
3142
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3143
- import_react_ecs5.Button,
4028
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
4029
+ import_react_ecs6.Button,
3144
4030
  {
3145
4031
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3146
4032
  uiBackground: { color: C2.purple },
@@ -3151,14 +4037,14 @@ var AdminPanelUIModule = class {
3151
4037
  if (this.newAdminWallet) this.addSceneAdmin(this.newAdminWallet);
3152
4038
  }
3153
4039
  }
3154
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ import_react_ecs5.default.createElement(
3155
- import_react_ecs5.UiEntity,
4040
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
4041
+ import_react_ecs6.UiEntity,
3156
4042
  {
3157
4043
  key: `ban-${i}`,
3158
4044
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3159
4045
  },
3160
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3161
- import_react_ecs5.Label,
4046
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4047
+ import_react_ecs6.Label,
3162
4048
  {
3163
4049
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3164
4050
  fontSize: t.label,
@@ -3166,8 +4052,8 @@ var AdminPanelUIModule = class {
3166
4052
  uiTransform: { width: this.s(130) }
3167
4053
  }
3168
4054
  ),
3169
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3170
- import_react_ecs5.Button,
4055
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4056
+ import_react_ecs6.Button,
3171
4057
  {
3172
4058
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3173
4059
  uiBackground: { color: C2.green },
@@ -3177,11 +4063,11 @@ var AdminPanelUIModule = class {
3177
4063
  onMouseDown: () => this.unbanWallet(wallet)
3178
4064
  }
3179
4065
  )
3180
- ))), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3181
- import_react_ecs5.Input,
4066
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
4067
+ import_react_ecs6.Input,
3182
4068
  {
3183
4069
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3184
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
4070
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3185
4071
  placeholder: "0x... ban wallet",
3186
4072
  placeholderColor: C2.textDim,
3187
4073
  color: C2.text,
@@ -3191,8 +4077,8 @@ var AdminPanelUIModule = class {
3191
4077
  this.newBanWallet = val;
3192
4078
  }
3193
4079
  }
3194
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3195
- import_react_ecs5.Button,
4080
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
4081
+ import_react_ecs6.Button,
3196
4082
  {
3197
4083
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3198
4084
  uiBackground: { color: C2.red },
@@ -3203,15 +4089,15 @@ var AdminPanelUIModule = class {
3203
4089
  if (this.newBanWallet) this.banWallet(this.newBanWallet);
3204
4090
  }
3205
4091
  }
3206
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(
3207
- import_react_ecs5.Button,
4092
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(
4093
+ import_react_ecs6.Button,
3208
4094
  {
3209
4095
  uiTransform: { height: this.s(24) },
3210
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
4096
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3211
4097
  value: "Manage at thestatic.tv",
3212
4098
  fontSize: t.labelSmall,
3213
4099
  color: C2.cyan,
3214
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4100
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3215
4101
  }
3216
4102
  ));
3217
4103
  };
@@ -3220,11 +4106,24 @@ var AdminPanelUIModule = class {
3220
4106
  * Always renders notification (scaled), admin panel only for admins
3221
4107
  */
3222
4108
  this.getComponent = () => {
4109
+ if (this.moderation.blocked) {
4110
+ return BlockedNotice({
4111
+ standing: this.moderation.standing,
4112
+ kickLeftMs: this.moderation.kickLeftMs,
4113
+ scale: this.client.uiScale,
4114
+ // thestatic.tv's own origin, for a private event's BECOME A CITIZEN (2026-11-19): the API base less its path, as
4115
+ // the chat's REGISTER IDENTITY derives its /login
4116
+ siteUrl: this.baseUrl.replace("/api/v1/dcl", "")
4117
+ });
4118
+ }
3223
4119
  if (!this.isAdmin) {
3224
4120
  return this.renderScaledNotification();
3225
4121
  }
3226
4122
  const t = this.theme;
3227
4123
  const tabs = [];
4124
+ if (this.venue && this.controls.length > 0) {
4125
+ tabs.push({ label: "CONTROLS", id: "controls" });
4126
+ }
3228
4127
  if (this.config.sceneTabs && this.config.sceneTabs.length > 0) {
3229
4128
  this.config.sceneTabs.forEach((tab) => tabs.push({ label: tab.label, id: tab.id }));
3230
4129
  }
@@ -3237,8 +4136,8 @@ var AdminPanelUIModule = class {
3237
4136
  if (!tabs.find((tab) => tab.id === this.activeTab) && tabs.length > 0) {
3238
4137
  this.activeTab = tabs[0].id;
3239
4138
  }
3240
- return /* @__PURE__ */ import_react_ecs5.default.createElement(
3241
- import_react_ecs5.UiEntity,
4139
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
4140
+ import_react_ecs6.UiEntity,
3242
4141
  {
3243
4142
  uiTransform: {
3244
4143
  width: "100%",
@@ -3247,16 +4146,16 @@ var AdminPanelUIModule = class {
3247
4146
  }
3248
4147
  },
3249
4148
  this.renderScaledNotification(),
3250
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3251
- import_react_ecs5.UiEntity,
4149
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4150
+ import_react_ecs6.UiEntity,
3252
4151
  {
3253
4152
  uiTransform: {
3254
4153
  position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
3255
4154
  positionType: "absolute"
3256
4155
  }
3257
4156
  },
3258
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3259
- import_react_ecs5.Button,
4157
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4158
+ import_react_ecs6.Button,
3260
4159
  {
3261
4160
  uiTransform: { width: this.s(100), height: this.s(45) },
3262
4161
  uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
@@ -3267,8 +4166,8 @@ var AdminPanelUIModule = class {
3267
4166
  }
3268
4167
  )
3269
4168
  ),
3270
- this.panelOpen && /* @__PURE__ */ import_react_ecs5.default.createElement(
3271
- import_react_ecs5.UiEntity,
4169
+ this.panelOpen && /* @__PURE__ */ import_react_ecs6.default.createElement(
4170
+ import_react_ecs6.UiEntity,
3272
4171
  {
3273
4172
  key: `admin-panel-${this.client.uiScale}`,
3274
4173
  uiTransform: {
@@ -3281,8 +4180,8 @@ var AdminPanelUIModule = class {
3281
4180
  },
3282
4181
  uiBackground: { color: C2.bg }
3283
4182
  },
3284
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3285
- import_react_ecs5.UiEntity,
4183
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4184
+ import_react_ecs6.UiEntity,
3286
4185
  {
3287
4186
  uiTransform: {
3288
4187
  width: "100%",
@@ -3294,12 +4193,12 @@ var AdminPanelUIModule = class {
3294
4193
  },
3295
4194
  uiBackground: { color: C2.header }
3296
4195
  },
3297
- /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
3298
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3299
- import_react_ecs5.Button,
4196
+ /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
4197
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4198
+ import_react_ecs6.Button,
3300
4199
  {
3301
4200
  uiTransform: { width: this.s(28), height: this.s(28) },
3302
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0.3) },
4201
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0.3) },
3303
4202
  value: "X",
3304
4203
  fontSize: t.header,
3305
4204
  color: THEME.colors.red,
@@ -3307,9 +4206,9 @@ var AdminPanelUIModule = class {
3307
4206
  }
3308
4207
  )
3309
4208
  ),
3310
- /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ import_react_ecs5.default.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
3311
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3312
- import_react_ecs5.UiEntity,
4209
+ /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ import_react_ecs6.default.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
4210
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4211
+ import_react_ecs6.UiEntity,
3313
4212
  {
3314
4213
  uiTransform: {
3315
4214
  width: "100%",
@@ -3318,12 +4217,13 @@ var AdminPanelUIModule = class {
3318
4217
  flexDirection: "column"
3319
4218
  }
3320
4219
  },
3321
- this.activeTab === "video" && /* @__PURE__ */ import_react_ecs5.default.createElement(this.VideoTab, null),
3322
- this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ import_react_ecs5.default.createElement(this.ModTab, null),
4220
+ this.activeTab === "controls" && this.venue && this.controls.length > 0 && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ControlsTab, null),
4221
+ this.activeTab === "video" && /* @__PURE__ */ import_react_ecs6.default.createElement(this.VideoTab, null),
4222
+ this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ModTab, null),
3323
4223
  this.config.sceneTabs?.map((tab) => this.activeTab === tab.id && tab.render())
3324
4224
  ),
3325
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3326
- import_react_ecs5.UiEntity,
4225
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4226
+ import_react_ecs6.UiEntity,
3327
4227
  {
3328
4228
  uiTransform: {
3329
4229
  width: "100%",
@@ -3333,15 +4233,15 @@ var AdminPanelUIModule = class {
3333
4233
  },
3334
4234
  uiBackground: { color: C2.section }
3335
4235
  },
3336
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3337
- import_react_ecs5.Button,
4236
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4237
+ import_react_ecs6.Button,
3338
4238
  {
3339
4239
  uiTransform: { height: this.s(24) },
3340
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
4240
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3341
4241
  value: `thestatic.tv/scene/${this.config.sceneId}`,
3342
4242
  fontSize: t.labelSmall,
3343
4243
  color: C2.cyan,
3344
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4244
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3345
4245
  }
3346
4246
  )
3347
4247
  )
@@ -3362,14 +4262,41 @@ var AdminPanelUIModule = class {
3362
4262
  // Ensure sceneId is set
3363
4263
  };
3364
4264
  this.baseUrl = client.getBaseUrl();
4265
+ this.moderation = new ModerationModule({
4266
+ reread: () => this.checkAdminStatus(),
4267
+ myWallet: () => this.myWallet(),
4268
+ onChange: (blocked, standing) => this.onStandingChange(blocked, standing),
4269
+ log: (msg, ...args) => this.log(msg, ...args)
4270
+ });
4271
+ this.adminWait = new PlayerWait({
4272
+ getPlayer: () => (0, import_players2.getPlayer)(),
4273
+ setInterval: dclSetInterval,
4274
+ clearInterval: dclClearInterval,
4275
+ check: (player) => this.checkAdminFor(player),
4276
+ log: (msg) => this.log(msg)
4277
+ });
3365
4278
  if (config.headerColor) {
3366
- C2.header = import_math5.Color4.create(
4279
+ C2.header = import_math7.Color4.create(
3367
4280
  config.headerColor.r,
3368
4281
  config.headerColor.g,
3369
4282
  config.headerColor.b,
3370
4283
  config.headerColor.a
3371
4284
  );
3372
4285
  }
4286
+ if (config.controls && config.controls.length > 0) this.registerControls(config.controls);
4287
+ }
4288
+ kickLine(sent) {
4289
+ return { sent, notSent: "Kick not sent", show: (line) => {
4290
+ this.kickStatus = line;
4291
+ } };
4292
+ }
4293
+ /**
4294
+ * The Venue tier (2026-11-19): scene controls and private mode are Venue's, so the CONTROLS tab, the declaration's
4295
+ * upload, a press, the saved state's read, a queued control's run and the private-mode switch all need it. The
4296
+ * client knows it from the session start, before this panel exists.
4297
+ */
4298
+ get venue() {
4299
+ return this.client.hasVenueFeatures === true;
3373
4300
  }
3374
4301
  log(msg, ...args) {
3375
4302
  if (this.config.debug) {
@@ -3388,26 +4315,36 @@ var AdminPanelUIModule = class {
3388
4315
  * Initialize the admin panel - checks admin status and fetches video state
3389
4316
  */
3390
4317
  async init() {
4318
+ this.moderation.start().catch(() => {
4319
+ });
3391
4320
  await this.checkAdminStatus();
3392
4321
  await this.fetchVideoState();
3393
4322
  this.autoPlayDefault();
4323
+ this.loadReadsDone = true;
4324
+ await this.readSavedState();
3394
4325
  this.startCommandPolling();
3395
4326
  this.log("Initialized");
3396
4327
  }
3397
4328
  /**
3398
- * Check if current player is an admin for this scene
4329
+ * Check if current player is an admin for this scene. With no player yet it waits for one on the SDK's timer and
4330
+ * checks then (utils/player-wait.ts): one wait at a time, ended quietly after 30 s with no wallet. A guest reading
4331
+ * (isGuest true) is checked at once and the wait goes on for a non-guest reading, checked once more if one comes
4332
+ * within the 30 s. Resolves when the check is done, or at once when there is none to run.
3399
4333
  */
3400
4334
  async checkAdminStatus() {
3401
- const player = (0, import_players2.getPlayer)();
3402
- if (!player?.userId) {
3403
- this.log("No player data yet");
3404
- return;
3405
- }
4335
+ await this.adminWait.run();
4336
+ }
4337
+ /** The admin check proper, for a player the explorer has resolved */
4338
+ async checkAdminFor(player) {
3406
4339
  this.playerWallet = player.userId;
3407
4340
  if (this.config.forceAdmin) {
3408
4341
  this.isAdmin = true;
3409
4342
  this.isOwner = true;
4343
+ this.moderation.applyStanding({ isBanned: false, canModerate: true });
3410
4344
  this.log("Admin status FORCED (forceAdmin: true)");
4345
+ this.uploadControls().catch(() => {
4346
+ });
4347
+ this.client.frames?.adminCheckSucceeded();
3411
4348
  return;
3412
4349
  }
3413
4350
  try {
@@ -3418,17 +4355,54 @@ var AdminPanelUIModule = class {
3418
4355
  const data = await res.json();
3419
4356
  this.isAdmin = data.showButton ?? data.hasAccess;
3420
4357
  this.isOwner = data.isOwner || data.isSceneAdmin;
3421
- if (data.isBanned) {
4358
+ const wasBanned = this.moderation.standing === "banned";
4359
+ if (typeof data.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
4360
+ this.moderation.applyStanding({
4361
+ isBanned: data.isBanned === true,
4362
+ canModerate: data.showButton === true || data.hasAccess === true,
4363
+ privateBlocked: data.privateBlocked === true,
4364
+ isCitizen: data.isCitizen === true
4365
+ });
4366
+ if (data.isBanned === true && !wasBanned) {
3422
4367
  this.config.onBroadcast?.("You have been banned from this scene.");
3423
- this.banKickPlayer();
3424
- this.log("Player is banned - kicking");
4368
+ this.log("Player is banned - blocked");
3425
4369
  }
3426
4370
  this.log("Admin status:", this.isAdmin, "Owner:", this.isOwner);
4371
+ if (this.isAdmin) this.uploadControls().catch(() => {
4372
+ });
4373
+ if (this.isAdmin) this.client.frames?.adminCheckSucceeded();
3427
4374
  }
3428
4375
  } catch (err) {
3429
4376
  this.log("Admin check error:", err);
3430
4377
  }
3431
4378
  }
4379
+ /** My wallet, lowercased: admin-check's player, else the explorer's */
4380
+ myWallet() {
4381
+ let wallet = this.playerWallet;
4382
+ if (!wallet) {
4383
+ try {
4384
+ wallet = (0, import_players2.getPlayer)()?.userId || "";
4385
+ } catch {
4386
+ wallet = "";
4387
+ }
4388
+ }
4389
+ return wallet ? wallet.toLowerCase() : null;
4390
+ }
4391
+ /** Blocked turned on or off: the panel closes, and the client stops what it plays and tells the scene */
4392
+ onStandingChange(blocked, standing) {
4393
+ if (blocked) this.hide();
4394
+ this.client._onBlockedChange?.(blocked, standing);
4395
+ }
4396
+ /** True while this visitor is banned or kicked (2026-11-17) */
4397
+ get isVisitorBlocked() {
4398
+ return this.moderation.blocked;
4399
+ }
4400
+ /** A url the scene's queue or the slots would play - nothing while this visitor is blocked */
4401
+ playUrl(url) {
4402
+ if (this.moderation.blocked) return;
4403
+ this.currentVideoUrl = url;
4404
+ this.config.onVideoPlay?.(url);
4405
+ }
3432
4406
  /**
3433
4407
  * Toggle the admin panel open/closed
3434
4408
  */
@@ -3480,6 +4454,128 @@ var AdminPanelUIModule = class {
3480
4454
  this.config.sceneTabs.push(tab);
3481
4455
  this.log("Registered scene tab:", tab.label);
3482
4456
  }
4457
+ // --- Scene controls (2026-11-18; Venue since 2026-11-19, Pro until then) ---
4458
+ /**
4459
+ * Register scene controls: the CONTROLS tab draws them, a press reaches every visitor's copy through the scene's
4460
+ * queue, and the declaration goes to the scene's record once an admin's check has succeeded. The same as the config's
4461
+ * `controls`; a control registered again by id replaces the earlier one. Only the shape is checked here - thestatic.tv
4462
+ * checks the ids, labels and bounds when the declaration is uploaded, and every press against it.
4463
+ */
4464
+ registerControls(controls) {
4465
+ for (const control of controls) {
4466
+ if (!control || typeof control.id !== "string" || !Array.isArray(control.options) || typeof control.onChange !== "function") {
4467
+ this.log("Scene control skipped - not a SceneControl:", control);
4468
+ continue;
4469
+ }
4470
+ const at = this.controls.findIndex((c) => c.id === control.id);
4471
+ if (at >= 0) this.controls[at] = control;
4472
+ else this.controls.push(control);
4473
+ }
4474
+ this.log("Registered scene controls:", this.controls.map((c) => c.id));
4475
+ this.readSavedState().catch(() => {
4476
+ });
4477
+ this.uploadControls().catch(() => {
4478
+ });
4479
+ }
4480
+ /** True when `option` is one of the control's, or 'off' on a control that has OFF */
4481
+ isControlOption(control, option) {
4482
+ if (option === "off") return control.off === true;
4483
+ return control.options.some((o) => o.id === option);
4484
+ }
4485
+ /** A queued sceneControl's registered control and valid option, or null for anything else */
4486
+ controlCommand(payload) {
4487
+ const p = payload;
4488
+ if (!p || typeof p.control !== "string" || typeof p.option !== "string") return null;
4489
+ const control = this.controls.find((c) => c.id === p.control);
4490
+ if (!control || !this.isControlOption(control, p.option)) return null;
4491
+ return { control, option: p.option };
4492
+ }
4493
+ /** Run a control's option on this copy and mark it current; a handler that throws is logged and breaks nothing else */
4494
+ applyControl(control, option) {
4495
+ this.currentOption[control.id] = option;
4496
+ try {
4497
+ control.onChange(option);
4498
+ } catch (err) {
4499
+ this.log("Control handler failed:", control.id, option, err);
4500
+ }
4501
+ }
4502
+ /** A press in the CONTROLS tab: this copy runs it at once, then everyone's through the queue (Venue, 2026-11-19) */
4503
+ async pressControl(control, option) {
4504
+ if (!this.venue) return;
4505
+ this.applyControl(control, option);
4506
+ await this.sendSceneCommand("sceneControl", { control: control.id, option }, this.controlLine);
4507
+ }
4508
+ /**
4509
+ * The saved option of every persist control, read once a load from the scene's public state route - after the admin
4510
+ * check and the video state, before the poll starts - and run on this copy, so a late arrival sees what the last
4511
+ * press set. A saved option that is not one of the control's is ignored, as is a failed read; a control with no saved
4512
+ * option keeps the scene's own default.
4513
+ */
4514
+ async readSavedState() {
4515
+ if (this.stateRead || !this.loadReadsDone || !this.venue) return;
4516
+ const persisted = this.controls.filter((c) => c.persist === true);
4517
+ if (persisted.length === 0) return;
4518
+ this.stateRead = true;
4519
+ try {
4520
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/state`);
4521
+ if (!res.ok) {
4522
+ this.log("Scene state read refused:", res.status);
4523
+ return;
4524
+ }
4525
+ const data = await res.json();
4526
+ const state = data && typeof data.state === "object" && data.state !== null ? data.state : {};
4527
+ for (const control of persisted) {
4528
+ const saved = state[control.id];
4529
+ if (typeof saved === "string" && this.isControlOption(control, saved)) {
4530
+ this.log("Saved control option:", control.id, saved);
4531
+ this.applyControl(control, saved);
4532
+ }
4533
+ }
4534
+ } catch (err) {
4535
+ this.log("Scene state read error:", err);
4536
+ }
4537
+ }
4538
+ /**
4539
+ * The declaration - each control's id, label, options, off and persist, never its handler - posted once a load to the
4540
+ * scene's record on thestatic.tv, from a copy whose admin check succeeded, so the scene's page draws the same buttons.
4541
+ * thestatic.tv checks the shape and bounds and writes only a declaration that differs. A refusal is logged, never
4542
+ * shown to the visitor, and not retried in this load.
4543
+ */
4544
+ async uploadControls() {
4545
+ if (this.controlsUploaded || !this.isAdmin || !this.venue || this.controls.length === 0) return;
4546
+ this.controlsUploaded = true;
4547
+ const controls = this.controls.map((c) => ({
4548
+ id: c.id,
4549
+ label: c.label,
4550
+ options: c.options.map((o) => ({ id: o.id, label: o.label })),
4551
+ off: c.off === true,
4552
+ persist: c.persist === true
4553
+ }));
4554
+ try {
4555
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/config`, {
4556
+ method: "POST",
4557
+ headers: { "Content-Type": "application/json" },
4558
+ body: JSON.stringify({ controls })
4559
+ });
4560
+ if (res.ok) {
4561
+ this.log("Scene controls declared:", controls.map((c) => c.id));
4562
+ return;
4563
+ }
4564
+ const data = await res.json().catch(() => ({}));
4565
+ this.log("Scene controls declaration refused:", res.status, data.error);
4566
+ } catch (err) {
4567
+ this.log("Scene controls declaration error:", err);
4568
+ }
4569
+ }
4570
+ /** Remember a command id the poll has run or this copy has sent, forgetting the oldest past SEEN_COMMAND_IDS_MAX */
4571
+ markCommandSeen(id) {
4572
+ if (this.seenCommandIds.has(id)) return;
4573
+ this.seenCommandIds.add(id);
4574
+ this.seenCommandOrder.push(id);
4575
+ while (this.seenCommandOrder.length > SEEN_COMMAND_IDS_MAX) {
4576
+ this.seenCommandIds.delete(this.seenCommandOrder.shift());
4577
+ }
4578
+ }
3483
4579
  // --- Stream Polling ---
3484
4580
  startStreamPolling() {
3485
4581
  if (this.pollIntervalId !== null) return;
@@ -3520,52 +4616,91 @@ var AdminPanelUIModule = class {
3520
4616
  * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3521
4617
  */
3522
4618
  async signedRequest(url, init = {}) {
3523
- const res = await (0, import_SignedFetch2.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
4619
+ const res = await (0, import_SignedFetch3.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3524
4620
  return {
3525
4621
  ok: res.ok,
3526
4622
  status: res.status,
3527
4623
  json: async () => res.body ? JSON.parse(res.body) : {}
3528
4624
  };
3529
4625
  }
4626
+ /**
4627
+ * Every visitor's copy reads the scene's queue (a public GET, every 5 s). Since 2026-11-18 the poll sends the server's
4628
+ * cursor back as `since` once it has one - the first poll has none, so the 30-second replay on load stays, which the
4629
+ * kicks rely on - and tells commands apart by id: a bounded set of the last SEEN_COMMAND_IDS_MAX, this copy's own
4630
+ * sends among them (a press is not run twice here), so two commands in one millisecond both run. A command with no id
4631
+ * falls back to the timestamp rule every command used until then, and a server that answers no cursor (production
4632
+ * before 2026-11-18) gets no since and is read as before.
4633
+ */
3530
4634
  async pollCommands() {
3531
4635
  try {
3532
- const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
4636
+ const since = this.commandCursor !== null ? `?since=${this.commandCursor}` : "";
4637
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands${since}`);
3533
4638
  if (!res.ok) return;
3534
4639
  const data = await res.json();
3535
4640
  const commands = data.commands || [];
4641
+ if (typeof data.cursor === "number") this.commandCursor = data.cursor;
3536
4642
  for (const cmd of commands) {
3537
- if (cmd.timestamp <= this.lastCommandTimestamp) continue;
3538
- this.lastCommandTimestamp = cmd.timestamp;
3539
- if (cmd.type === "broadcast" && cmd.payload?.text) {
3540
- const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
3541
- this.log("Received broadcast:", msg);
3542
- this.config.onBroadcast?.(msg);
3543
- } else if (cmd.type === "clearBroadcast") {
3544
- this.log("Received clearBroadcast");
3545
- hideNotification();
3546
- } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
3547
- this.log("Received video play:", cmd.type, cmd.payload.url);
3548
- this.config.onVideoPlay?.(cmd.payload.url);
3549
- } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
3550
- this.log("Received video stop/clear:", cmd.type);
3551
- this.config.onVideoStop?.();
3552
- } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
3553
- const slotId = cmd.payload.slot;
3554
- if (cmd.payload.url) {
3555
- this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
3556
- this.config.onVideoPlay?.(cmd.payload.url);
3557
- } else {
3558
- this.log("Received videoPlaySlot:", slotId);
3559
- this.playSlot(slotId);
3560
- }
3561
- } else if (this.config.onCommand) {
3562
- this.log("Received command:", cmd.type, cmd.payload);
3563
- this.config.onCommand(cmd.type, cmd.payload);
4643
+ if (typeof cmd.id === "string" && cmd.id !== "") {
4644
+ if (this.seenCommandIds.has(cmd.id)) continue;
4645
+ this.markCommandSeen(cmd.id);
4646
+ if (typeof cmd.timestamp === "number" && cmd.timestamp > this.lastCommandTimestamp) this.lastCommandTimestamp = cmd.timestamp;
4647
+ } else {
4648
+ if (cmd.timestamp <= this.lastCommandTimestamp) continue;
4649
+ this.lastCommandTimestamp = cmd.timestamp;
4650
+ }
4651
+ try {
4652
+ this.runCommand(cmd);
4653
+ } catch (err) {
4654
+ this.log("Command handler failed:", cmd.type, err);
3564
4655
  }
3565
4656
  }
3566
4657
  } catch (err) {
3567
4658
  }
3568
4659
  }
4660
+ /** One queued command on this copy: the SDK's own types here, a registered control's option, else the scene's onCommand */
4661
+ runCommand(cmd) {
4662
+ const control = cmd.type === "sceneControl" && this.venue ? this.controlCommand(cmd.payload) : null;
4663
+ if (cmd.type === "broadcast" && cmd.payload?.text) {
4664
+ const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
4665
+ this.log("Received broadcast:", msg);
4666
+ this.config.onBroadcast?.(msg);
4667
+ } else if (cmd.type === "clearBroadcast") {
4668
+ this.log("Received clearBroadcast");
4669
+ hideNotification();
4670
+ } else if (cmd.type === "kickBanned" || cmd.type === "kickAll") {
4671
+ this.log("Received kick:", cmd.type, cmd.payload);
4672
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4673
+ this.config.onCommand?.(cmd.type, cmd.payload);
4674
+ } else if (cmd.type === "privateMode" && this.venue) {
4675
+ this.log("Received privateMode - re-reading my standing");
4676
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4677
+ } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
4678
+ this.log("Received video play:", cmd.type, cmd.payload.url);
4679
+ this.playUrl(cmd.payload.url);
4680
+ } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
4681
+ this.log("Received video stop/clear:", cmd.type);
4682
+ if (cmd.type === "videoClear") this.currentVideoUrl = null;
4683
+ this.config.onVideoStop?.();
4684
+ } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
4685
+ const slotId = cmd.payload.slot;
4686
+ if (cmd.payload.url) {
4687
+ this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
4688
+ this.playUrl(cmd.payload.url);
4689
+ } else {
4690
+ this.log("Received videoPlaySlot:", slotId);
4691
+ this.playSlot(slotId);
4692
+ }
4693
+ } else if (cmd.type === "framesRefresh") {
4694
+ this.log("Received framesRefresh");
4695
+ this.client.frames?.refresh();
4696
+ } else if (control) {
4697
+ this.log("Received scene control:", control.control.id, control.option);
4698
+ this.applyControl(control.control, control.option);
4699
+ } else if (this.config.onCommand) {
4700
+ this.log("Received command:", cmd.type, cmd.payload);
4701
+ this.config.onCommand(cmd.type, cmd.payload);
4702
+ }
4703
+ }
3569
4704
  // --- Stream API Calls ---
3570
4705
  async fetchStreamData() {
3571
4706
  if (this.streamFetched || !this.playerWallet) return;
@@ -3607,6 +4742,7 @@ var AdminPanelUIModule = class {
3607
4742
  defaultSlot: data.defaultSlot || null,
3608
4743
  videoSlots: data.videoSlots || {}
3609
4744
  };
4745
+ if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
3610
4746
  this.videoStateFetched = true;
3611
4747
  this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
3612
4748
  }
@@ -3621,7 +4757,7 @@ var AdminPanelUIModule = class {
3621
4757
  const slot = this.videoState?.videoSlots?.[slotId];
3622
4758
  if (slot?.url) {
3623
4759
  this.log("Playing slot:", slotId, slot.url);
3624
- this.config.onVideoPlay?.(slot.url);
4760
+ this.playUrl(slot.url);
3625
4761
  } else {
3626
4762
  this.log("Slot has no URL:", slotId);
3627
4763
  this.config.onVideoSlotPlay?.(slotId);
@@ -3636,7 +4772,7 @@ var AdminPanelUIModule = class {
3636
4772
  const slot = this.videoState.videoSlots?.[defaultSlot];
3637
4773
  if (slot?.url) {
3638
4774
  this.log("Auto-playing default slot:", defaultSlot);
3639
- this.config.onVideoPlay?.(slot.url);
4775
+ this.playUrl(slot.url);
3640
4776
  }
3641
4777
  }
3642
4778
  async createChannel() {
@@ -3988,6 +5124,7 @@ var AdminPanelUIModule = class {
3988
5124
  this.modStatus = "saved";
3989
5125
  this.log("Banned wallet:", normalized);
3990
5126
  this.config.onCommand?.("kickBanned", { wallet: normalized });
5127
+ await this.sendSceneCommand("kickBanned", { wallet: normalized }, this.kickLine("Banned and kicked"));
3991
5128
  } else {
3992
5129
  this.modStatus = "error";
3993
5130
  }
@@ -4022,15 +5159,142 @@ var AdminPanelUIModule = class {
4022
5159
  this.log("Unban error:", err);
4023
5160
  }
4024
5161
  }
4025
- banKickPlayer() {
4026
- (0, import_RestrictedActions3.movePlayerTo)({ newRelativePosition: BAN_KICK_POSITION });
4027
- this.log("Player ban-kicked");
5162
+ /**
5163
+ * Queue a command on thestatic.tv for every visitor's copy of the scene (2026-11-17): a signed POST to the scene's
5164
+ * commands route, which takes it from the scene's owner, an admin or an authorized user at the scene's registered
5165
+ * location, and which every copy's poll reads within its 30-second window. The one sender for the kicks, the scene
5166
+ * controls and, since 2026-11-18, the Video and Broadcast buttons; each shows what it came to on its section's own
5167
+ * line. The command id the server answers goes into the seen set, so this copy's poll does not run its own press a
5168
+ * second time. Returns that id (empty when the answer carries none), or null when the command was not sent.
5169
+ */
5170
+ async sendSceneCommand(type, payload, line) {
5171
+ const data = await this.sendSigned("commands", { type, payload }, line);
5172
+ if (data === null) return null;
5173
+ const id = typeof data.commandId === "string" ? data.commandId : "";
5174
+ if (id !== "") this.markCommandSeen(id);
5175
+ return id;
4028
5176
  }
5177
+ /**
5178
+ * The one signed sender's POST (2026-11-18; since 2026-11-19 private mode's switch goes through it too, to its own
5179
+ * route): signed as the presser to one of the scene's routes on thestatic.tv, which decides whether the presser may;
5180
+ * what it came to shown on the section's line in a control's four words. Returns the answer, or null when not sent.
5181
+ */
5182
+ async sendSigned(route, body, line) {
5183
+ try {
5184
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/${route}`, {
5185
+ method: "POST",
5186
+ headers: { "Content-Type": "application/json" },
5187
+ body: JSON.stringify(body)
5188
+ });
5189
+ const parsed = await res.json().catch(() => ({}));
5190
+ const data = parsed && typeof parsed === "object" ? parsed : {};
5191
+ if (res.ok) {
5192
+ line.show(line.sent);
5193
+ return data;
5194
+ }
5195
+ line.show(res.status === 401 || res.status === 403 ? `${line.notSent}: no access` : `${line.notSent}: HTTP ${res.status}`);
5196
+ this.log("Refused:", route, body.type ?? "", res.status, data.error);
5197
+ } catch (err) {
5198
+ line.show(`${line.notSent}: network error`);
5199
+ this.log("Send error:", route, err);
5200
+ }
5201
+ return null;
5202
+ }
5203
+ /**
5204
+ * PRIVATE MODE ON / OFF (2026-11-19, Venue; thestatic-hq docs/MERGE-CONTRACT-2026-11-19.md section 2): `{ on }` to
5205
+ * the scene's private route through the one signed sender. thestatic.tv decides who may switch it (its scene access
5206
+ * check) and queues `privateMode` for every copy, this one included, which re-reads its standing on it. The state
5207
+ * shown follows the server's answer, never the press.
5208
+ */
5209
+ async setPrivateMode(on) {
5210
+ if (!this.venue) return;
5211
+ const data = await this.sendSigned("private", { on }, this.privateLine);
5212
+ if (typeof data?.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
5213
+ }
5214
+ /** KICK ALL: every visitor who cannot moderate the scene is moved out and kept out for a while (2026-11-17) */
5215
+ async kickAll() {
5216
+ this.log("KICK ALL clicked");
5217
+ this.config.onCommand?.("kickAll", {});
5218
+ await this.sendSceneCommand("kickAll", {}, this.kickLine("KICK ALL sent"));
5219
+ }
5220
+ /**
5221
+ * BROADCAST (2026-11-18): queued for every visitor, as the scene's page on thestatic.tv sends it - `from` the presser's
5222
+ * display name, ADMIN when the explorer has none (the page's own default) - and shown here at once as everyone sees
5223
+ * it, `from: text`. Until then the in-world Send reached the presser's copy alone.
5224
+ */
4029
5225
  sendBroadcast() {
4030
- if (!this.broadcastText.trim()) return;
4031
- this.config.onBroadcast?.(this.broadcastText.trim());
5226
+ const text = this.broadcastText.trim();
5227
+ if (!text) return;
5228
+ const from = this.myName();
5229
+ this.config.onBroadcast?.(`${from}: ${text}`);
4032
5230
  this.broadcastText = "";
4033
5231
  this.log("Broadcast sent");
5232
+ this.sendSceneCommand("broadcast", { text, from }, this.broadcastLine).catch(() => {
5233
+ });
5234
+ }
5235
+ /** The presser's display name for a broadcast's from, ADMIN when the explorer has none; within the route's 100 */
5236
+ myName() {
5237
+ try {
5238
+ const name = (0, import_players2.getPlayer)()?.name;
5239
+ if (typeof name === "string" && name.trim() !== "") return name.trim().slice(0, 100);
5240
+ } catch {
5241
+ }
5242
+ return "ADMIN";
5243
+ }
5244
+ // --- The Video tab's buttons (2026-11-18): each does here at once what it did, then queues the same for everyone ---
5245
+ /** PLAY NOW: the typed url plays here and is queued as videoSetUrl, which thestatic.tv keeps for later arrivals */
5246
+ playNow() {
5247
+ const url = this.customVideoUrl.trim();
5248
+ if (!url) return;
5249
+ this.playUrl(url);
5250
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5251
+ });
5252
+ }
5253
+ /** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
5254
+ playStreamOnScreen(url) {
5255
+ this.playUrl(url);
5256
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5257
+ });
5258
+ }
5259
+ /** Play 1-5: the slot plays here (its url from the video state) and is queued as videoPlaySlot; the server resolves its url for everyone */
5260
+ pressSlot(slotId) {
5261
+ this.playSlot(slotId);
5262
+ this.sendSceneCommand("videoPlaySlot", { slot: slotId }, this.videoLine).catch(() => {
5263
+ });
5264
+ }
5265
+ /**
5266
+ * PLAYBACK Play: the current video - the one the screen last played here, or the scene's current url from the video
5267
+ * state at load - plays again here and is queued as videoPlay with its url; with none known nothing is sent and the
5268
+ * line says so. onCommand gets ('videoPlay', { playing: true }) as it did before, for a scene that reads it.
5269
+ */
5270
+ playbackPlay() {
5271
+ this.config.onCommand?.("videoPlay", { playing: true });
5272
+ const url = this.currentVideoUrl;
5273
+ if (!url) {
5274
+ this.videoStatus = "Not sent: no video";
5275
+ return;
5276
+ }
5277
+ this.playUrl(url);
5278
+ this.sendSceneCommand("videoPlay", { url }, this.videoLine).catch(() => {
5279
+ });
5280
+ }
5281
+ /** Stop: the screen stops here and videoStop is queued for everyone */
5282
+ playbackStop() {
5283
+ this.config.onVideoStop?.();
5284
+ this.sendSceneCommand("videoStop", {}, this.videoLine).catch(() => {
5285
+ });
5286
+ }
5287
+ /**
5288
+ * Reset Default: the screen goes back to its default here - what every copy does on a queued videoClear - and
5289
+ * videoClear is queued, which also clears the scene's kept url on thestatic.tv. onCommand gets ('videoClear', {}) as
5290
+ * it did before.
5291
+ */
5292
+ resetDefault() {
5293
+ this.config.onCommand?.("videoClear", {});
5294
+ this.currentVideoUrl = null;
5295
+ this.config.onVideoStop?.();
5296
+ this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
5297
+ });
4034
5298
  }
4035
5299
  setActiveTab(tab) {
4036
5300
  const previousTab = this.activeTab;
@@ -4044,6 +5308,22 @@ var AdminPanelUIModule = class {
4044
5308
  this.stopStreamPolling();
4045
5309
  }
4046
5310
  }
5311
+ /** A control's button (2026-11-18): the option's label, highlighted while that option is current on this copy */
5312
+ controlButton(control, option, label) {
5313
+ const current = this.currentOption[control.id] === option;
5314
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
5315
+ import_react_ecs6.Button,
5316
+ {
5317
+ key: `control-${control.id}-${option}`,
5318
+ uiTransform: { minWidth: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4, padding: { left: 10, right: 10 } },
5319
+ uiBackground: { color: current ? C2.cyan : C2.btn },
5320
+ value: label,
5321
+ fontSize: this.theme.buttonSmall,
5322
+ color: current ? import_math7.Color4.Black() : C2.text,
5323
+ onMouseDown: () => this.pressControl(control, option)
5324
+ }
5325
+ );
5326
+ }
4047
5327
  /**
4048
5328
  * Render a scaled notification banner
4049
5329
  * Uses same layout as NotificationBanner but with scaled font size
@@ -4054,8 +5334,8 @@ var AdminPanelUIModule = class {
4054
5334
  if (!state.visible) return null;
4055
5335
  const N2 = UI_DIMENSIONS.notification;
4056
5336
  const colors = THEME.colors;
4057
- return /* @__PURE__ */ import_react_ecs5.default.createElement(
4058
- import_react_ecs5.UiEntity,
5337
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
5338
+ import_react_ecs6.UiEntity,
4059
5339
  {
4060
5340
  uiTransform: {
4061
5341
  positionType: "absolute",
@@ -4065,8 +5345,8 @@ var AdminPanelUIModule = class {
4065
5345
  alignItems: "center"
4066
5346
  }
4067
5347
  },
4068
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4069
- import_react_ecs5.UiEntity,
5348
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5349
+ import_react_ecs6.UiEntity,
4070
5350
  {
4071
5351
  uiTransform: {
4072
5352
  minWidth: this.s(200),
@@ -4078,15 +5358,15 @@ var AdminPanelUIModule = class {
4078
5358
  },
4079
5359
  uiBackground: { color: colors.panel }
4080
5360
  },
4081
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4082
- import_react_ecs5.UiEntity,
5361
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5362
+ import_react_ecs6.UiEntity,
4083
5363
  {
4084
5364
  uiTransform: { width: N2.borderWidth, height: "100%" },
4085
5365
  uiBackground: { color: colors.cyan }
4086
5366
  }
4087
5367
  ),
4088
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4089
- import_react_ecs5.UiEntity,
5368
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5369
+ import_react_ecs6.UiEntity,
4090
5370
  {
4091
5371
  uiTransform: {
4092
5372
  flexGrow: 1,
@@ -4096,8 +5376,8 @@ var AdminPanelUIModule = class {
4096
5376
  alignItems: "center"
4097
5377
  }
4098
5378
  },
4099
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4100
- import_react_ecs5.Label,
5379
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5380
+ import_react_ecs6.Label,
4101
5381
  {
4102
5382
  value: state.text,
4103
5383
  fontSize: this.s(N2.fontSize),
@@ -4106,8 +5386,8 @@ var AdminPanelUIModule = class {
4106
5386
  }
4107
5387
  )
4108
5388
  ),
4109
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4110
- import_react_ecs5.UiEntity,
5389
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5390
+ import_react_ecs6.UiEntity,
4111
5391
  {
4112
5392
  uiTransform: { width: 5, height: 5, margin: { right: 10 } },
4113
5393
  uiBackground: { color: colors.cyan }
@@ -4119,7 +5399,7 @@ var AdminPanelUIModule = class {
4119
5399
  };
4120
5400
 
4121
5401
  // src/StaticTVClient.ts
4122
- var import_ecs4 = require("@dcl/sdk/ecs");
5402
+ var import_ecs5 = require("@dcl/sdk/ecs");
4123
5403
  var utils = __toESM(require("@dcl-sdk/utils"));
4124
5404
  var DEFAULT_BASE_URL = "https://thestatic.tv/api/v1/dcl";
4125
5405
  var DEFAULT_FALLBACK_VIDEO = "https://media.thestatic.tv/fallback-loop.mp4";
@@ -4161,9 +5441,13 @@ var StaticTVClient = class {
4161
5441
  this._keyId = null;
4162
5442
  this._disabled = false;
4163
5443
  this._tier = "free";
5444
+ /** Venue (2026-11-19): the server's flag beside a Pro tier; the event features need it */
5445
+ this._venue = false;
4164
5446
  this._standardFeaturesEnabled = false;
4165
5447
  this._proFeaturesEnabled = false;
4166
5448
  this._pendingProConfig = null;
5449
+ /** Controls registered before the admin panel exists (the tier not yet confirmed) - handed to it at init (2026-11-18) */
5450
+ this._pendingControls = [];
4167
5451
  this._featuresResolved = false;
4168
5452
  /** Guide module - fetch channel lineup (standard/pro tier) */
4169
5453
  this.guide = null;
@@ -4207,6 +5491,8 @@ var StaticTVClient = class {
4207
5491
  };
4208
5492
  this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
4209
5493
  this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
5494
+ this.frames = new FramesModule(this);
5495
+ if (config.frames) this.frames.register(config.frames);
4210
5496
  if (!config.apiKey) {
4211
5497
  this._disabled = true;
4212
5498
  this._keyType = null;
@@ -4337,7 +5623,7 @@ var StaticTVClient = class {
4337
5623
  * @internal
4338
5624
  */
4339
5625
  async signedRequest(endpoint, init = {}) {
4340
- const response = await (0, import_SignedFetch3.signedFetch)({
5626
+ const response = await (0, import_SignedFetch4.signedFetch)({
4341
5627
  url: `${this.apiUrl}${endpoint}`,
4342
5628
  init: {
4343
5629
  method: init.method || "POST",
@@ -4397,6 +5683,7 @@ var StaticTVClient = class {
4397
5683
  * @param url Video URL to play
4398
5684
  */
4399
5685
  playVideo(url) {
5686
+ if (this.isVisitorBlocked) return;
4400
5687
  const screen = this.config.videoScreen;
4401
5688
  if (screen !== void 0) {
4402
5689
  this.log(`Playing video: ${url}`);
@@ -4431,9 +5718,9 @@ var StaticTVClient = class {
4431
5718
  const fallbackUrl = this.config.fallbackVideoUrl;
4432
5719
  const fallbackDisabled = fallbackUrl === "";
4433
5720
  if (fallbackDisabled) {
4434
- if (import_ecs4.VideoPlayer.has(screen)) {
5721
+ if (import_ecs5.VideoPlayer.has(screen)) {
4435
5722
  this.log("Stopping video (no fallback)");
4436
- import_ecs4.VideoPlayer.getMutable(screen).playing = false;
5723
+ import_ecs5.VideoPlayer.getMutable(screen).playing = false;
4437
5724
  }
4438
5725
  this._currentVideoUrl = "";
4439
5726
  } else {
@@ -4454,16 +5741,17 @@ var StaticTVClient = class {
4454
5741
  _playVideoInternal(url, isFallback = false, isLiveStream = false) {
4455
5742
  const screen = this.config.videoScreen;
4456
5743
  if (screen === void 0) return;
5744
+ if (this.isVisitorBlocked) return;
4457
5745
  this._clearVerificationTimeout();
4458
5746
  this._streamVerified = false;
4459
- if (import_ecs4.VideoPlayer.has(screen)) {
4460
- const player = import_ecs4.VideoPlayer.getMutable(screen);
5747
+ if (import_ecs5.VideoPlayer.has(screen)) {
5748
+ const player = import_ecs5.VideoPlayer.getMutable(screen);
4461
5749
  player.src = url;
4462
5750
  player.playing = true;
4463
5751
  player.loop = isFallback;
4464
5752
  player.volume = 1;
4465
5753
  } else {
4466
- import_ecs4.VideoPlayer.create(screen, {
5754
+ import_ecs5.VideoPlayer.create(screen, {
4467
5755
  src: url,
4468
5756
  playing: true,
4469
5757
  loop: isFallback,
@@ -4485,8 +5773,8 @@ var StaticTVClient = class {
4485
5773
  const screen = this.config.videoScreen;
4486
5774
  if (screen === void 0) return;
4487
5775
  this._videoEventsRegistered = true;
4488
- import_ecs4.videoEventsSystem.registerVideoEventsEntity(screen, (videoEvent) => {
4489
- if (videoEvent.state === import_ecs4.VideoState.VS_PLAYING) {
5776
+ import_ecs5.videoEventsSystem.registerVideoEventsEntity(screen, (videoEvent) => {
5777
+ if (videoEvent.state === import_ecs5.VideoState.VS_PLAYING) {
4490
5778
  const timeSinceStart = Date.now() - this._verificationStartTime;
4491
5779
  const MIN_VERIFICATION_DELAY = 2e3;
4492
5780
  if (this._pendingVideoData && !this._streamVerified && timeSinceStart >= MIN_VERIFICATION_DELAY) {
@@ -4495,7 +5783,7 @@ var StaticTVClient = class {
4495
5783
  this.log(`Stream verified: ${this._pendingVideoData.name} (after ${timeSinceStart}ms)`);
4496
5784
  }
4497
5785
  }
4498
- if (videoEvent.state === import_ecs4.VideoState.VS_ERROR) {
5786
+ if (videoEvent.state === import_ecs5.VideoState.VS_ERROR) {
4499
5787
  if (this._pendingVideoData) {
4500
5788
  this.log(`Stream error for: ${this._pendingVideoData.name}`);
4501
5789
  this._handleStreamOffline();
@@ -4577,6 +5865,7 @@ var StaticTVClient = class {
4577
5865
  */
4578
5866
  _handleGuideVideoSelect(video) {
4579
5867
  if (!video.src) return;
5868
+ if (this.isVisitorBlocked) return;
4580
5869
  this._pendingVideoData = video;
4581
5870
  const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
4582
5871
  this._playVideoWithVerification(video, isLiveStream);
@@ -4653,6 +5942,74 @@ var StaticTVClient = class {
4653
5942
  this.log(`Stream confirmed playing: ${this._pendingVideoData.name}`);
4654
5943
  }
4655
5944
  }
5945
+ /**
5946
+ * True while this visitor is banned from the scene or kicked out of it (Pro tier, 2026-11-17), or kept out by its
5947
+ * private mode (Venue, 2026-11-19): the SDK keeps them out of the scene's parcels, shows them only the notice and
5948
+ * plays them no video. A scene with its own media (a radio, its own screen) checks this, or passes
5949
+ * `onBlockedChange`, and stops it.
5950
+ */
5951
+ get isVisitorBlocked() {
5952
+ return this.adminPanel?.isVisitorBlocked ?? false;
5953
+ }
5954
+ /**
5955
+ * This visitor's standing: 'banned', 'kicked', 'private' (2026-11-19) or 'clear', in that precedence (always 'clear'
5956
+ * without the Pro tier's admin panel)
5957
+ */
5958
+ get visitorStanding() {
5959
+ return this.adminPanel?.moderation.standing ?? "clear";
5960
+ }
5961
+ /**
5962
+ * True when the last standing read said this visitor is a TheStatic.tv citizen - their wallet linked to an account
5963
+ * (2026-11-19). False before a read, from a server that does not answer it, and without the Pro tier's admin panel.
5964
+ * For a fresh answer, `checkCitizen()`.
5965
+ */
5966
+ get visitorIsCitizen() {
5967
+ return this.adminPanel?.moderation.isCitizen ?? false;
5968
+ }
5969
+ /**
5970
+ * Whether this visitor is a TheStatic.tv citizen, fresh (2026-11-19): a read of the scene's admin-check through the
5971
+ * moderation module - the last answer when it is under 5 s old, else the next read, gated as every standing read
5972
+ * is. False without the Pro tier's admin panel, and when no read has answered. A scene's citizens-only door asks
5973
+ * this instead of calling a route of its own; thestatic.tv answers it from the signed request, so a scene cannot
5974
+ * claim a citizen.
5975
+ */
5976
+ async checkCitizen() {
5977
+ if (!this.adminPanel) return false;
5978
+ try {
5979
+ return await this.adminPanel.moderation.checkCitizen();
5980
+ } catch {
5981
+ return false;
5982
+ }
5983
+ }
5984
+ /**
5985
+ * The admin panel's moderation reports blocked on or off (2026-11-17): the panels close, the SDK's own video
5986
+ * stops (and its fallback loop comes back once clear), the watch heartbeat stops, and the scene hears of it.
5987
+ * @internal
5988
+ */
5989
+ _onBlockedChange(blocked, standing) {
5990
+ const screen = this.config.videoScreen;
5991
+ if (blocked) {
5992
+ this.guideUI?.hide();
5993
+ this.chatUI?.hide();
5994
+ this.heartbeat?.stopWatching();
5995
+ this._pendingVideoData = null;
5996
+ this._clearVerificationTimeout();
5997
+ if (screen !== void 0 && import_ecs5.VideoPlayer.has(screen)) {
5998
+ import_ecs5.VideoPlayer.getMutable(screen).playing = false;
5999
+ }
6000
+ this._currentVideoUrl = "";
6001
+ } else if (screen !== void 0) {
6002
+ const fallbackUrl = this.config.fallbackVideoUrl !== void 0 ? this.config.fallbackVideoUrl : DEFAULT_FALLBACK_VIDEO;
6003
+ if (fallbackUrl !== "") this._playVideoInternal(fallbackUrl, true);
6004
+ }
6005
+ if (this.config.onBlockedChange) {
6006
+ try {
6007
+ this.config.onBlockedChange(blocked, standing);
6008
+ } catch (err) {
6009
+ this.error("onBlockedChange failed", err);
6010
+ }
6011
+ }
6012
+ }
4656
6013
  /**
4657
6014
  * Internal handler for broadcast messages
4658
6015
  * @internal
@@ -4711,8 +6068,15 @@ var StaticTVClient = class {
4711
6068
  onBroadcast: (text) => this._handleBroadcast(text),
4712
6069
  onCommand: this.config.onCommand || this._pendingProConfig?.onCommand,
4713
6070
  // Merge other settings from enableProFeatures if provided
4714
- ...this._pendingProConfig
6071
+ ...this._pendingProConfig,
6072
+ // The scene's controls (2026-11-18): the constructor's, enableProFeatures()'s, and any registered before now
6073
+ controls: [
6074
+ ...this.config.controls || [],
6075
+ ...this._pendingProConfig?.controls || [],
6076
+ ...this._pendingControls
6077
+ ]
4715
6078
  };
6079
+ this._pendingControls = [];
4716
6080
  this.adminPanel = new AdminPanelUIModule(this, adminConfig);
4717
6081
  this._proFeaturesEnabled = true;
4718
6082
  this.adminPanel.init().catch((err) => {
@@ -4756,8 +6120,9 @@ var StaticTVClient = class {
4756
6120
  getSceneId() {
4757
6121
  return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4758
6122
  }
4759
- _enableFeaturesForTier(tier, keyId) {
6123
+ _enableFeaturesForTier(tier, keyId, venue = false) {
4760
6124
  this._tier = tier;
6125
+ this._venue = tier === "pro" && venue === true;
4761
6126
  if (keyId) {
4762
6127
  this._keyId = keyId;
4763
6128
  }
@@ -4772,6 +6137,7 @@ var StaticTVClient = class {
4772
6137
  this.log("Pro tier detected but no video config - call enableProFeatures() or set videoScreen to enable admin panel");
4773
6138
  }
4774
6139
  }
6140
+ if (this._venue) this.frames.enable();
4775
6141
  this._resolveFeaturesReady(tier);
4776
6142
  }
4777
6143
  /**
@@ -4799,6 +6165,13 @@ var StaticTVClient = class {
4799
6165
  get hasProFeatures() {
4800
6166
  return this._proFeaturesEnabled;
4801
6167
  }
6168
+ /**
6169
+ * True when the server confirmed the Venue tier (2026-11-19): Pro plus the event features - scene
6170
+ * controls, frames, private mode. `tier` stays 'pro' for a Venue scene, so a scene's own Pro checks hold.
6171
+ */
6172
+ get hasVenueFeatures() {
6173
+ return this._venue;
6174
+ }
4802
6175
  /**
4803
6176
  * @deprecated Use `tier` instead
4804
6177
  */
@@ -4868,6 +6241,57 @@ var StaticTVClient = class {
4868
6241
  }
4869
6242
  this.adminPanel.registerSceneTab(tab);
4870
6243
  }
6244
+ /**
6245
+ * Register scene controls for the Admin Panel's CONTROLS tab and the scene's page on thestatic.tv (2026-11-18;
6246
+ * the Venue tier since 2026-11-19, Pro until then) - the same as passing `controls` in the config. Before the panel
6247
+ * exists (the tier not yet confirmed) they are kept and handed to it at init; after, they join the tab at once. On a
6248
+ * Pro scene without Venue they are kept and never drawn, uploaded or run. See `SceneControl`.
6249
+ *
6250
+ * @example
6251
+ * ```typescript
6252
+ * staticTV.registerControls([{
6253
+ * id: 'digifog', label: 'DigiFog', off: true, persist: true,
6254
+ * options: [{ id: 'stars', label: 'Stars' }, { id: 'pulse', label: 'Pulse' }],
6255
+ * onChange: (option) => fog.play(option)
6256
+ * }])
6257
+ * ```
6258
+ */
6259
+ registerControls(controls) {
6260
+ if (!this.adminPanel) {
6261
+ this._pendingControls.push(...controls);
6262
+ this.log(`Scene controls registered (${controls.length}) - the admin panel takes them when the Pro tier is confirmed`);
6263
+ return;
6264
+ }
6265
+ this.adminPanel.registerControls(controls);
6266
+ }
6267
+ /**
6268
+ * Register picture frames (Venue tier, 2026-11-19) - the same as passing `frames` in the config. Kept whatever the
6269
+ * tier (without Venue `openFrame` still opens a default's link); once Venue is known, a frame registered now gets the
6270
+ * content the last read gave at once. A frame registered again by id
6271
+ * replaces the earlier one; at most 64. Only the shape is checked here - thestatic.tv checks the ids, labels and URLs
6272
+ * when the declaration is uploaded. See `SceneFrame`.
6273
+ *
6274
+ * @example
6275
+ * ```typescript
6276
+ * staticTV.registerFrames([{
6277
+ * id: 'f00', label: 'Ground floor, west wall',
6278
+ * default: { image: 'https://example.com/poster.png' },
6279
+ * onContent: (c) => showPicture(frameEntity, c.image, c.text)
6280
+ * }])
6281
+ * ```
6282
+ */
6283
+ registerFrames(frames) {
6284
+ this.frames.register(frames);
6285
+ }
6286
+ /**
6287
+ * A visitor clicked a frame (2026-11-19): the link opens when it is an https: one - the content's, else the frame's
6288
+ * default's, so a frame works before Venue is on - and, with Venue, the click is counted on thestatic.tv under the
6289
+ * picture the frame shows (signed, fire and forget). Call it from the frame's own pointer handler. Nothing happens
6290
+ * for an id the scene did not declare.
6291
+ */
6292
+ openFrame(id) {
6293
+ this.frames.open(id);
6294
+ }
4871
6295
  /**
4872
6296
  * Close Admin/Guide panels (they share the same screen space)
4873
6297
  * Chat is independent and stays open.
@@ -4940,16 +6364,19 @@ var StaticTVClient = class {
4940
6364
  0 && (module.exports = {
4941
6365
  AdminPanelUIModule,
4942
6366
  ChatUIModule,
6367
+ FramesModule,
4943
6368
  GuideModule,
4944
6369
  GuideUIModule,
4945
6370
  HeartbeatModule,
4946
6371
  InteractionsModule,
4947
6372
  KEY_TYPE_CHANNEL,
4948
6373
  KEY_TYPE_SCENE,
6374
+ ModerationModule,
4949
6375
  NotificationBanner,
4950
6376
  SessionModule,
4951
6377
  StaticTVClient,
4952
6378
  fetchUserData,
6379
+ getParcelRects,
4953
6380
  getPlayerDisplayName,
4954
6381
  getPlayerPosition,
4955
6382
  getPlayerWallet,