@thestatic-tv/dcl-sdk 2.8.1 → 2.10.0

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,7 +260,83 @@ 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
+ function heightLimit(parcels) {
269
+ return Math.log2(parcels + 1) * 20;
270
+ }
271
+ function wallTop(parcels) {
272
+ return Math.min(WALL_TOP_MAX, heightLimit(parcels) - 4);
273
+ }
274
+ function parcelRects(parcels, base) {
275
+ const parse = (p) => {
276
+ const parts = String(p).split(",");
277
+ if (parts.length !== 2) return null;
278
+ const [x, z] = parts.map((n) => parseInt(n, 10));
279
+ return Number.isFinite(x) && Number.isFinite(z) ? { x, z } : null;
280
+ };
281
+ const coords = parcels.map(parse).filter((c) => c !== null);
282
+ const origin = base && parse(base) || coords[0];
283
+ if (!origin) return [];
284
+ return coords.map((c) => {
285
+ const minX = (c.x - origin.x) * PARCEL_SIZE;
286
+ const minZ = (c.z - origin.z) * PARCEL_SIZE;
287
+ return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
288
+ });
289
+ }
290
+ function outerSides(rect, rects) {
291
+ const at = (minX, minZ) => rects.some((r) => r.minX === minX && r.minZ === minZ);
292
+ const sides = [];
293
+ if (!at(rect.minX - PARCEL_SIZE, rect.minZ)) sides.push("west");
294
+ if (!at(rect.minX + PARCEL_SIZE, rect.minZ)) sides.push("east");
295
+ if (!at(rect.minX, rect.minZ - PARCEL_SIZE)) sides.push("south");
296
+ if (!at(rect.minX, rect.minZ + PARCEL_SIZE)) sides.push("north");
297
+ return sides;
298
+ }
299
+ function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
300
+ return rects.map((r) => {
301
+ const outer = outerSides(r, rects);
302
+ return {
303
+ minX: r.minX + (outer.includes("west") ? strip : 0),
304
+ maxX: r.maxX - (outer.includes("east") ? strip : 0),
305
+ minZ: r.minZ + (outer.includes("south") ? strip : 0),
306
+ maxZ: r.maxZ - (outer.includes("north") ? strip : 0),
307
+ top
308
+ };
309
+ });
310
+ }
311
+ function inParcels(p, rects) {
312
+ return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
313
+ }
314
+ function insideWalls(p, boxes) {
315
+ return boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ && p.y < b.top);
316
+ }
317
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
318
+ function ejectPoint(boxes, rects, from) {
319
+ const IN = 0.5;
320
+ const p = from || { x: 0, y: 0, z: 0 };
321
+ let best = null;
322
+ let bestDistance = Infinity;
323
+ rects.forEach((rect, i) => {
324
+ const b = boxes[i];
325
+ if (!b) return;
326
+ const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
327
+ for (const side of outerSides(rect, rects)) {
328
+ const point = side === "west" ? { x: b.minX + IN, z: along(b.minZ, b.maxZ, p.z) } : side === "east" ? { x: b.maxX - IN, z: along(b.minZ, b.maxZ, p.z) } : side === "south" ? { x: along(b.minX, b.maxX, p.x), z: b.minZ + IN } : { x: along(b.minX, b.maxX, p.x), z: b.maxZ - IN };
329
+ const distance = Math.hypot(point.x - p.x, point.z - p.z);
330
+ if (distance < bestDistance) {
331
+ bestDistance = distance;
332
+ best = { x: point.x, y: b.top + 1, z: point.z };
333
+ }
334
+ }
335
+ });
336
+ return best;
337
+ }
338
+
339
+ // src/utils/bounds.ts
261
340
  var cachedBounds = null;
262
341
  var cachedParcelRects = [];
263
342
  var boundsInitialized = false;
@@ -300,11 +379,7 @@ async function getSceneBounds() {
300
379
  boundsError = true;
301
380
  return null;
302
381
  }
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
- });
382
+ cachedParcelRects = parcelRects(parcels, baseParcel);
308
383
  const worldMinX = Math.min(...coords.map((c) => c.x));
309
384
  const worldMaxX = Math.max(...coords.map((c) => c.x));
310
385
  const worldMinZ = Math.min(...coords.map((c) => c.z));
@@ -340,6 +415,9 @@ function isPlayerInBounds(_bounds) {
340
415
  return false;
341
416
  }
342
417
  }
418
+ function getParcelRects() {
419
+ return cachedParcelRects.map((r) => ({ ...r }));
420
+ }
343
421
  function getPlayerPosition() {
344
422
  try {
345
423
  const transform = import_ecs2.Transform.getOrNull(import_ecs2.engine.PlayerEntity);
@@ -482,7 +560,7 @@ var SessionModule = class {
482
560
  this._tier = normalizeTier(response.sdkType);
483
561
  this.startHeartbeat();
484
562
  this.client.log(`Session started: ${this.sessionId}, tier: ${this._tier}`);
485
- this.client._enableFeaturesForTier(this._tier, this._keyId);
563
+ this.client._enableFeaturesForTier(this._tier, this._keyId, this._tier === "pro" && response.venue === true);
486
564
  return this.sessionId;
487
565
  }
488
566
  this.client._settleFeaturesAsFree();
@@ -741,10 +819,280 @@ var InteractionsModule = class {
741
819
  }
742
820
  };
743
821
 
822
+ // src/modules/frames.ts
823
+ var import_SignedFetch = require("~system/SignedFetch");
824
+ var import_RestrictedActions = require("~system/RestrictedActions");
825
+ var FRAMES_MAX = 64;
826
+ var REFRESH_JITTER_MS = 3e3;
827
+ var DEFAULT_VERSION = "default";
828
+ var IMAGE_MAX = 1e3;
829
+ var TEXT_MAX = 120;
830
+ var LINK_MAX = 1e3;
831
+ var VERSION_MAX = 40;
832
+ var HTTPS = /^https:/i;
833
+ function isSceneFrame(value) {
834
+ if (!value || typeof value !== "object") return false;
835
+ const f = value;
836
+ if (typeof f.id !== "string" || typeof f.label !== "string" || typeof f.onContent !== "function") return false;
837
+ const d = f.default;
838
+ if (d === void 0 || d === null) return true;
839
+ if (typeof d !== "object") return false;
840
+ const { image, text, link } = d;
841
+ return typeof image === "string" && (text === void 0 || typeof text === "string") && (link === void 0 || typeof link === "string");
842
+ }
843
+ function defaultContent(frame) {
844
+ const d = frame.default;
845
+ if (!d) return null;
846
+ return { image: d.image, text: d.text || "", link: d.link || "", version: DEFAULT_VERSION };
847
+ }
848
+ function savedContent(value) {
849
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
850
+ const v = value;
851
+ const image = v.image;
852
+ const text = v.text === void 0 || v.text === null ? "" : v.text;
853
+ const link = v.link === void 0 || v.link === null ? "" : v.link;
854
+ const version = v.version;
855
+ if (typeof image !== "string" || image.length > IMAGE_MAX || !HTTPS.test(image)) return null;
856
+ if (typeof text !== "string" || text.length > TEXT_MAX) return null;
857
+ if (typeof link !== "string" || link.length > LINK_MAX || link !== "" && !HTTPS.test(link)) return null;
858
+ if (typeof version !== "string" || version === "" || version.length > VERSION_MAX) return null;
859
+ return { image, text, link, version };
860
+ }
861
+ function sameContent(a, b) {
862
+ return b !== null && a.image === b.image && a.text === b.text && a.link === b.link && a.version === b.version;
863
+ }
864
+ function errorOf(body) {
865
+ try {
866
+ const data = body ? JSON.parse(body) : null;
867
+ return data && typeof data.error === "string" ? data.error : "";
868
+ } catch {
869
+ return "";
870
+ }
871
+ }
872
+ var FramesModule = class {
873
+ constructor(host) {
874
+ this.entries = /* @__PURE__ */ new Map();
875
+ /** Venue is known: the reads, the upload and the clicks may go */
876
+ this.enabled = false;
877
+ /** This copy's admin check succeeded: the declaration may be uploaded */
878
+ this.adminOk = false;
879
+ this.uploaded = false;
880
+ this.loadReadStarted = false;
881
+ /** The last good read's `frames` object (saved content by frame id), or null until a read succeeds */
882
+ this.answer = null;
883
+ /** Reads are numbered as they start; an answer older than the one shown is dropped */
884
+ this.readSeq = 0;
885
+ this.shownSeq = 0;
886
+ /** A framesRefresh is waiting out its jitter: another inside the wait shares its read */
887
+ this.refreshWaiting = false;
888
+ this.host = host;
889
+ }
890
+ /** The declared frames' ids, in the order they were first registered */
891
+ get ids() {
892
+ return [...this.entries.keys()];
893
+ }
894
+ /** True once Venue is known for this scene */
895
+ get isEnabled() {
896
+ return this.enabled;
897
+ }
898
+ /**
899
+ * Declare frames: kept until Venue is known; after, a frame registered now gets what the last read gave at once,
900
+ * and the load read and the upload that waited on frames go now (each still once a load)
901
+ */
902
+ register(frames) {
903
+ if (!Array.isArray(frames)) {
904
+ this.host.log("registerFrames skipped - not a list of frames");
905
+ return;
906
+ }
907
+ for (const frame of frames) {
908
+ if (!isSceneFrame(frame)) {
909
+ this.host.log("Frame skipped - not a SceneFrame:", frame);
910
+ continue;
911
+ }
912
+ if (!this.entries.has(frame.id) && this.entries.size >= FRAMES_MAX) {
913
+ this.host.warn(`Frame ${frame.id} skipped - at most ${FRAMES_MAX} frames a scene`);
914
+ continue;
915
+ }
916
+ this.entries.set(frame.id, { frame, shown: null });
917
+ }
918
+ this.host.log("Registered frames:", this.ids);
919
+ if (!this.enabled) return;
920
+ this.apply();
921
+ this.loadRead();
922
+ this.upload().catch(() => {
923
+ });
924
+ }
925
+ /** Venue is known (the client calls this once the session confirms it): the load read, and the upload if it waited */
926
+ enable() {
927
+ if (this.enabled) return;
928
+ this.enabled = true;
929
+ this.loadRead();
930
+ this.upload().catch(() => {
931
+ });
932
+ }
933
+ /** This copy's admin check succeeded (the admin panel calls this): the declaration goes up once Venue is known */
934
+ adminCheckSucceeded() {
935
+ this.adminOk = true;
936
+ this.upload().catch(() => {
937
+ });
938
+ }
939
+ /**
940
+ * A queued framesRefresh (the scene's page saved or reset a frame): read again after a random wait of up to
941
+ * REFRESH_JITTER_MS. Refreshes that arrive inside the wait share its read.
942
+ */
943
+ refresh() {
944
+ if (!this.enabled || this.entries.size === 0 || this.refreshWaiting) return;
945
+ this.refreshWaiting = true;
946
+ const wait = Math.floor(Math.random() * REFRESH_JITTER_MS);
947
+ this.host.log(`Frames refresh in ${wait} ms`);
948
+ dclSetTimeout(() => {
949
+ this.refreshWaiting = false;
950
+ this.loadReadStarted = true;
951
+ this.read().catch(() => {
952
+ });
953
+ }, wait);
954
+ }
955
+ /**
956
+ * A visitor clicked a frame. The link opens when it is an https: one: the shown content's, else the frame's default's
957
+ * - so a scene without Venue (or before its read lands), which shows its own defaults, has no dead frames. The click is
958
+ * posted signed under the shown version (fire and forget; a failure is logged, never shown) only with Venue and
959
+ * something shown. An id not declared opens nothing and posts nothing.
960
+ */
961
+ open(id) {
962
+ const entry = typeof id === "string" ? this.entries.get(id) : void 0;
963
+ if (!entry) {
964
+ this.host.log("openFrame: no frame declared with this id:", id);
965
+ return;
966
+ }
967
+ const shown = entry.shown;
968
+ if (this.enabled && shown) this.postClick(entry.frame.id, shown.version).catch(() => {
969
+ });
970
+ else this.host.log("openFrame: no click counted - no Venue, or the frame shows nothing yet:", id);
971
+ const link = shown ? shown.link : entry.frame.default?.link || "";
972
+ if (link !== "" && HTTPS.test(link)) {
973
+ try {
974
+ Promise.resolve((0, import_RestrictedActions.openExternalUrl)({ url: link })).catch((err) => this.host.log("Frame link not opened:", err));
975
+ } catch (err) {
976
+ this.host.log("Frame link not opened:", err);
977
+ }
978
+ }
979
+ }
980
+ /** The routes' base for this scene: the scene id encoded, as any value in a url path is */
981
+ sceneUrl() {
982
+ const sceneId = this.host.getSceneId();
983
+ if (!sceneId) return null;
984
+ return `${this.host.getBaseUrl()}/scene/${encodeURIComponent(sceneId)}`;
985
+ }
986
+ /** The read at load: once, when Venue is known and a frame is declared */
987
+ loadRead() {
988
+ if (this.loadReadStarted || !this.enabled || this.entries.size === 0) return;
989
+ this.loadReadStarted = true;
990
+ this.read().catch(() => {
991
+ });
992
+ }
993
+ /** Read the saved content and show it; a failed read keeps what was shown */
994
+ async read() {
995
+ const base = this.sceneUrl();
996
+ if (!base) {
997
+ this.host.log("Frames: no scene id - nothing read");
998
+ return;
999
+ }
1000
+ const seq = ++this.readSeq;
1001
+ let frames;
1002
+ try {
1003
+ const res = await fetch(`${base}/frames`);
1004
+ if (!res.ok) {
1005
+ this.host.log("Frames read refused:", res.status);
1006
+ return;
1007
+ }
1008
+ const data = await res.json();
1009
+ const raw = data && typeof data === "object" ? data.frames : void 0;
1010
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
1011
+ this.host.log("Frames read: the answer holds no frames");
1012
+ return;
1013
+ }
1014
+ frames = raw;
1015
+ } catch (err) {
1016
+ this.host.log("Frames read error:", err);
1017
+ return;
1018
+ }
1019
+ if (seq < this.shownSeq) return;
1020
+ this.shownSeq = seq;
1021
+ this.answer = frames;
1022
+ this.apply();
1023
+ }
1024
+ /** A frame's content from the last good read: its saved content when usable, else its default, else null */
1025
+ contentFor(frame) {
1026
+ const answer = this.answer;
1027
+ if (answer && Object.prototype.hasOwnProperty.call(answer, frame.id)) {
1028
+ const saved = savedContent(answer[frame.id]);
1029
+ if (saved) return saved;
1030
+ this.host.log("Frames: saved content not usable, ignored:", frame.id);
1031
+ }
1032
+ return defaultContent(frame);
1033
+ }
1034
+ /** Each declared frame's content handed to its onContent when it differs from what the frame shows */
1035
+ apply() {
1036
+ if (!this.enabled || this.answer === null) return;
1037
+ for (const entry of [...this.entries.values()]) {
1038
+ const content = this.contentFor(entry.frame);
1039
+ if (!content || sameContent(content, entry.shown)) continue;
1040
+ try {
1041
+ entry.frame.onContent({ ...content });
1042
+ entry.shown = content;
1043
+ } catch (err) {
1044
+ this.host.error(`Frame ${entry.frame.id}: onContent failed`, err);
1045
+ }
1046
+ }
1047
+ }
1048
+ /** The declaration - ids, labels, defaults, never the handlers - once a load, in its own request to the config route */
1049
+ async upload() {
1050
+ if (this.uploaded || !this.enabled || !this.adminOk || this.entries.size === 0) return;
1051
+ const base = this.sceneUrl();
1052
+ if (!base) return;
1053
+ this.uploaded = true;
1054
+ const frames = [...this.entries.values()].map(({ frame }) => {
1055
+ const d = frame.default;
1056
+ return {
1057
+ id: frame.id,
1058
+ label: frame.label,
1059
+ ...d ? { default: { image: d.image, text: d.text || "", link: d.link || "" } } : {}
1060
+ };
1061
+ });
1062
+ try {
1063
+ const res = await (0, import_SignedFetch.signedFetch)({
1064
+ url: `${base}/config`,
1065
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frames }) }
1066
+ });
1067
+ if (res.ok) {
1068
+ this.host.log("Frames declared:", frames.map((f) => f.id));
1069
+ return;
1070
+ }
1071
+ this.host.log("Frames declaration refused:", res.status, errorOf(res.body));
1072
+ } catch (err) {
1073
+ this.host.log("Frames declaration error:", err);
1074
+ }
1075
+ }
1076
+ /** The click, signed: thestatic.tv counts it under the frame's shown version (one a wallet a frame a 10 s) */
1077
+ async postClick(id, version) {
1078
+ const base = this.sceneUrl();
1079
+ if (!base) return;
1080
+ try {
1081
+ const res = await (0, import_SignedFetch.signedFetch)({
1082
+ url: `${base}/frames/click`,
1083
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frame: id, version }) }
1084
+ });
1085
+ if (!res.ok) this.host.log("Frame click refused:", id, res.status, errorOf(res.body));
1086
+ } catch (err) {
1087
+ this.host.log("Frame click error:", id, err);
1088
+ }
1089
+ }
1090
+ };
1091
+
744
1092
  // src/ui/guide-ui.tsx
745
1093
  var import_react_ecs2 = __toESM(require("@dcl/sdk/react-ecs"));
746
1094
  var import_math3 = require("@dcl/sdk/math");
747
- var import_RestrictedActions = require("~system/RestrictedActions");
1095
+ var import_RestrictedActions2 = require("~system/RestrictedActions");
748
1096
 
749
1097
  // src/ui/theme.ts
750
1098
  var import_math = require("@dcl/sdk/math");
@@ -1013,6 +1361,7 @@ var GuideUIModule = class {
1013
1361
  * Always renders toggle button, plus panel when visible
1014
1362
  */
1015
1363
  this.getComponent = () => {
1364
+ if (this.client.isVisitorBlocked) return null;
1016
1365
  const windowW = UI_DIMENSIONS.guide.width;
1017
1366
  const windowH = UI_DIMENSIONS.guide.height;
1018
1367
  return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
@@ -1234,7 +1583,7 @@ var GuideUIModule = class {
1234
1583
  handleChannelClick(video) {
1235
1584
  const baseUrl = this.getBaseUrl();
1236
1585
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
1237
- (0, import_RestrictedActions.openExternalUrl)({ url: channelUrl });
1586
+ (0, import_RestrictedActions2.openExternalUrl)({ url: channelUrl });
1238
1587
  }
1239
1588
  renderLeftPanel() {
1240
1589
  const sidebarW = this.s(UI_DIMENSIONS.guide.sidebar.width);
@@ -1776,12 +2125,13 @@ var GuideUIModule = class {
1776
2125
  // src/ui/chat-ui.tsx
1777
2126
  var import_react_ecs3 = __toESM(require("@dcl/sdk/react-ecs"));
1778
2127
  var import_math4 = require("@dcl/sdk/math");
1779
- var import_SignedFetch = require("~system/SignedFetch");
2128
+ var import_SignedFetch2 = require("~system/SignedFetch");
1780
2129
  var import_players = require("@dcl/sdk/players");
1781
- var import_RestrictedActions2 = require("~system/RestrictedActions");
2130
+ var import_RestrictedActions3 = require("~system/RestrictedActions");
1782
2131
  var POLL_INTERVAL_ACTIVE = 5e3;
1783
2132
  var POLL_INTERVAL_PASSIVE = 3e4;
1784
2133
  var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
2134
+ var HISTORY_ERROR_ID = "sys-history-error";
1785
2135
  var ChatUIModule = class {
1786
2136
  constructor(client, config = {}) {
1787
2137
  // Visibility state
@@ -1805,6 +2155,8 @@ var ChatUIModule = class {
1805
2155
  this.systemMessages = [];
1806
2156
  this.inputText = "";
1807
2157
  this.chatScrollOffset = 0;
2158
+ // The last history read's failure, shown as the messages' last line until a read succeeds (2026-11-17)
2159
+ this.historyError = "";
1808
2160
  // UI preferences
1809
2161
  this.position = "right";
1810
2162
  // Timers
@@ -1819,6 +2171,7 @@ var ChatUIModule = class {
1819
2171
  * Always renders toggle button, plus panel when visible
1820
2172
  */
1821
2173
  this.getComponent = () => {
2174
+ if (this.client.isVisitorBlocked) return null;
1822
2175
  const scaledTheme = scaleChatTheme(DEFAULT_CHAT_THEME, this.client.uiScale);
1823
2176
  const positionStyle = this.getPositionStyle();
1824
2177
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
@@ -1959,7 +2312,7 @@ var ChatUIModule = class {
1959
2312
  this.isSigningIn = true;
1960
2313
  try {
1961
2314
  const baseUrl = this.getBaseUrl();
1962
- const response = await (0, import_SignedFetch.signedFetch)({
2315
+ const response = await (0, import_SignedFetch2.signedFetch)({
1963
2316
  url: `${baseUrl}/api/auth/dcl`,
1964
2317
  init: {
1965
2318
  method: "POST",
@@ -2011,8 +2364,13 @@ var ChatUIModule = class {
2011
2364
  async fetchMessages() {
2012
2365
  try {
2013
2366
  const baseUrl = this.getBaseUrl();
2014
- const response = await fetch(`${baseUrl}/api/chat/history?channelId=${this.currentChannelId}`);
2367
+ const response = await fetch(`${baseUrl}/api/chat/history?channelId=${encodeURIComponent(this.currentChannelId)}`);
2368
+ if (!response.ok) {
2369
+ this.historyError = `CHAT HISTORY UNAVAILABLE (${response.status})`;
2370
+ return;
2371
+ }
2015
2372
  const data = await response.json();
2373
+ this.historyError = "";
2016
2374
  if (data.messages) {
2017
2375
  const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
2018
2376
  const recentMsgs = data.messages.filter(
@@ -2040,6 +2398,7 @@ var ChatUIModule = class {
2040
2398
  this.realMessages = sortedMsgs;
2041
2399
  }
2042
2400
  } catch (e) {
2401
+ this.historyError = "CHAT HISTORY UNAVAILABLE";
2043
2402
  }
2044
2403
  }
2045
2404
  async handleSend() {
@@ -2055,7 +2414,7 @@ var ChatUIModule = class {
2055
2414
  this.inputText = "";
2056
2415
  try {
2057
2416
  const baseUrl = this.getBaseUrl();
2058
- const response = await (0, import_SignedFetch.signedFetch)({
2417
+ const response = await (0, import_SignedFetch2.signedFetch)({
2059
2418
  url: `${baseUrl}/api/chat/send`,
2060
2419
  init: {
2061
2420
  method: "POST",
@@ -2098,6 +2457,7 @@ var ChatUIModule = class {
2098
2457
  switchChannel(channelId) {
2099
2458
  this.currentChannelId = channelId;
2100
2459
  this.realMessages = [];
2460
+ this.historyError = "";
2101
2461
  this.showChannelDropdown = false;
2102
2462
  this.chatScrollOffset = 0;
2103
2463
  this.channelPage = 0;
@@ -2212,6 +2572,16 @@ var ChatUIModule = class {
2212
2572
  }
2213
2573
  renderMessagesArea(theme) {
2214
2574
  const allMessages = [...this.systemMessages, ...this.realMessages];
2575
+ if (this.historyError) {
2576
+ allMessages.push({
2577
+ id: HISTORY_ERROR_ID,
2578
+ username: "SYSTEM",
2579
+ text: this.historyError,
2580
+ uid: "system",
2581
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2582
+ isSystem: true
2583
+ });
2584
+ }
2215
2585
  const totalMessages = allMessages.length;
2216
2586
  const maxOffset = Math.max(0, totalMessages - UI_DIMENSIONS.chat.messagesPerPage);
2217
2587
  if (this.chatScrollOffset > maxOffset) this.chatScrollOffset = maxOffset;
@@ -2298,7 +2668,12 @@ var ChatUIModule = class {
2298
2668
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2299
2669
  key: msg.id,
2300
2670
  uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2301
- uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2671
+ uiText: {
2672
+ value: msg.text,
2673
+ fontSize: theme.systemMessage,
2674
+ color: msg.id === HISTORY_ERROR_ID ? THEME.colors.yellow : THEME.colors.green,
2675
+ textAlign: "middle-left"
2676
+ }
2302
2677
  });
2303
2678
  }
2304
2679
  renderChatMessage(msg, theme) {
@@ -2413,7 +2788,7 @@ var ChatUIModule = class {
2413
2788
  uiBackground: { color: THEME.colors.cyan },
2414
2789
  color: import_math4.Color4.Black(),
2415
2790
  onMouseDown: () => {
2416
- (0, import_RestrictedActions2.openExternalUrl)({ url: `${baseUrl}/apply` });
2791
+ (0, import_RestrictedActions3.openExternalUrl)({ url: `${baseUrl}/login` });
2417
2792
  }
2418
2793
  })
2419
2794
  ]
@@ -2585,11 +2960,11 @@ var ChatUIModule = class {
2585
2960
  };
2586
2961
 
2587
2962
  // 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");
2963
+ var import_react_ecs6 = __toESM(require("@dcl/sdk/react-ecs"));
2964
+ var import_math7 = require("@dcl/sdk/math");
2590
2965
  var import_players2 = require("@dcl/sdk/players");
2591
- var import_RestrictedActions3 = require("~system/RestrictedActions");
2592
- var import_SignedFetch2 = require("~system/SignedFetch");
2966
+ var import_RestrictedActions6 = require("~system/RestrictedActions");
2967
+ var import_SignedFetch3 = require("~system/SignedFetch");
2593
2968
 
2594
2969
  // src/ui/ui-renderer.tsx
2595
2970
  var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
@@ -2697,6 +3072,7 @@ function createStaticUI(client) {
2697
3072
  initNotificationSystem();
2698
3073
  return function StaticUI() {
2699
3074
  const currentScale = client.uiScale;
3075
+ const blocked = client.isVisitorBlocked;
2700
3076
  const guideComponent = client.guideUI?.getComponent() ?? null;
2701
3077
  const chatComponent = client.chatUI?.getComponent() ?? null;
2702
3078
  const adminComponent = client.adminPanel?.getComponent() ?? null;
@@ -2712,7 +3088,7 @@ function createStaticUI(client) {
2712
3088
  alignItems: "center"
2713
3089
  }
2714
3090
  },
2715
- /* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
3091
+ blocked ? null : /* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
2716
3092
  guideComponent,
2717
3093
  chatComponent,
2718
3094
  adminComponent
@@ -2724,24 +3100,436 @@ function setupStaticUI(client) {
2724
3100
  import_react_ecs4.ReactEcsRenderer.setUiRenderer(StaticUI);
2725
3101
  }
2726
3102
 
3103
+ // src/ui/blocked-notice.tsx
3104
+ var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
3105
+ var import_math5 = require("@dcl/sdk/math");
3106
+ var import_RestrictedActions4 = require("~system/RestrictedActions");
3107
+ var DEFAULT_SITE_URL = "https://thestatic.tv";
3108
+ function blockedNoticeLines(standing, kickLeftMs) {
3109
+ if (standing === "banned") {
3110
+ return ["BANNED FROM THIS SCENE", "The scene's moderators banned", "this wallet."];
3111
+ }
3112
+ if (standing === "kicked") {
3113
+ const minutes = Math.max(1, Math.ceil(kickLeftMs / 6e4));
3114
+ return ["REMOVED FROM THIS SCENE", "A moderator cleared the scene.", `You can come back in ${minutes} min.`];
3115
+ }
3116
+ if (standing === "private") {
3117
+ return ["PRIVATE EVENT", "Open to TheStatic.tv citizens right now."];
3118
+ }
3119
+ return [];
3120
+ }
3121
+ function blockedNoticeAction(standing, siteUrl = DEFAULT_SITE_URL) {
3122
+ if (standing === "private") return { label: "BECOME A CITIZEN", url: `${siteUrl}/login` };
3123
+ return null;
3124
+ }
3125
+ function BlockedNotice(props) {
3126
+ const lines = blockedNoticeLines(props.standing, props.kickLeftMs);
3127
+ if (lines.length === 0) return null;
3128
+ const s = (v) => Math.round(v * props.scale);
3129
+ const [title, ...body] = lines;
3130
+ const action = blockedNoticeAction(props.standing, props.siteUrl || DEFAULT_SITE_URL);
3131
+ return /* @__PURE__ */ import_react_ecs5.default.createElement(
3132
+ import_react_ecs5.UiEntity,
3133
+ {
3134
+ uiTransform: {
3135
+ width: "100%",
3136
+ height: "100%",
3137
+ positionType: "absolute",
3138
+ justifyContent: "center",
3139
+ alignItems: "center"
3140
+ }
3141
+ },
3142
+ /* @__PURE__ */ import_react_ecs5.default.createElement(
3143
+ import_react_ecs5.UiEntity,
3144
+ {
3145
+ uiTransform: { width: s(460), flexDirection: "column", alignItems: "center", padding: s(20) },
3146
+ uiBackground: { color: import_math5.Color4.create(0.05, 0.05, 0.08, 0.95) }
3147
+ },
3148
+ /* @__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) } }),
3149
+ 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) } })),
3150
+ action && /* @__PURE__ */ import_react_ecs5.default.createElement(
3151
+ import_react_ecs5.Button,
3152
+ {
3153
+ uiTransform: { width: s(220), height: s(36), margin: { top: s(12) } },
3154
+ uiBackground: { color: import_math5.Color4.create(0, 0.8, 0.8, 1) },
3155
+ value: action.label,
3156
+ fontSize: s(16),
3157
+ color: import_math5.Color4.Black(),
3158
+ onMouseDown: () => {
3159
+ (0, import_RestrictedActions4.openExternalUrl)({ url: action.url });
3160
+ }
3161
+ }
3162
+ )
3163
+ )
3164
+ );
3165
+ }
3166
+
3167
+ // src/utils/player-wait.ts
3168
+ var PLAYER_WAIT_STEP_MS = 1e3;
3169
+ var PLAYER_WAIT_MAX_MS = 30 * 1e3;
3170
+ var isGuest = (player) => player.isGuest === true;
3171
+ var PlayerWait = class {
3172
+ constructor(deps) {
3173
+ this.timerId = null;
3174
+ this.reads = 0;
3175
+ /** This wait has checked a guest reading already */
3176
+ this.guestChecked = false;
3177
+ this.deps = deps;
3178
+ }
3179
+ get stepMs() {
3180
+ return this.deps.stepMs ?? PLAYER_WAIT_STEP_MS;
3181
+ }
3182
+ get maxMs() {
3183
+ return this.deps.maxMs ?? PLAYER_WAIT_MAX_MS;
3184
+ }
3185
+ /** True while a wait is reading the player */
3186
+ get waiting() {
3187
+ return this.timerId !== null;
3188
+ }
3189
+ /**
3190
+ * The check with the player now, or - with no player yet - a wait that runs it once one appears. A guest reading is
3191
+ * checked now and the wait goes on for a non-guest one. Resolves when the check is done, or at once when there is
3192
+ * none to run.
3193
+ */
3194
+ async run() {
3195
+ const player = this.read();
3196
+ if (player && !isGuest(player)) {
3197
+ this.stop();
3198
+ await this.deps.check(player);
3199
+ return;
3200
+ }
3201
+ if (player) {
3202
+ this.start("A guest reading - checked now; waiting for a non-guest one");
3203
+ this.guestChecked = true;
3204
+ await this.deps.check(player);
3205
+ return;
3206
+ }
3207
+ this.start("No player data yet - waiting for one");
3208
+ }
3209
+ /** A wait, unless one is running (one at a time) */
3210
+ start(msg) {
3211
+ if (this.timerId !== null) return;
3212
+ this.reads = 0;
3213
+ this.guestChecked = false;
3214
+ this.deps.log?.(msg);
3215
+ this.timerId = this.deps.setInterval(() => this.tick(), this.stepMs);
3216
+ }
3217
+ tick() {
3218
+ this.reads++;
3219
+ const player = this.read();
3220
+ if (player && !isGuest(player)) {
3221
+ this.stop();
3222
+ this.deps.log?.(`Player resolved after ${this.reads} read(s)`);
3223
+ this.deps.check(player).catch(() => {
3224
+ });
3225
+ return;
3226
+ }
3227
+ if (player && !this.guestChecked) {
3228
+ this.guestChecked = true;
3229
+ this.deps.log?.(`A guest reading after ${this.reads} read(s) - checked now; still waiting for a non-guest one`);
3230
+ this.deps.check(player).catch(() => {
3231
+ });
3232
+ }
3233
+ if (this.reads * this.stepMs >= this.maxMs) {
3234
+ this.stop();
3235
+ this.deps.log?.(`No non-guest player after ${this.maxMs / 1e3} s - no further check`);
3236
+ }
3237
+ }
3238
+ stop() {
3239
+ if (this.timerId === null) return;
3240
+ this.deps.clearInterval(this.timerId);
3241
+ this.timerId = null;
3242
+ }
3243
+ read() {
3244
+ try {
3245
+ const player = this.deps.getPlayer();
3246
+ return player && player.userId ? player : null;
3247
+ } catch {
3248
+ return null;
3249
+ }
3250
+ }
3251
+ };
3252
+
3253
+ // src/modules/moderation.ts
3254
+ var import_ecs4 = require("@dcl/sdk/ecs");
3255
+ var import_math6 = require("@dcl/sdk/math");
3256
+ var import_RestrictedActions5 = require("~system/RestrictedActions");
3257
+ var KICK_MS = 2 * 60 * 1e3;
3258
+ var REREAD_MS = 60 * 1e3;
3259
+ var READ_GAP_MS = 5e3;
3260
+ var HINT_SPREAD_MS = 3e3;
3261
+ var CITIZEN_WAIT_MS = 1e4;
3262
+ var CHECK_EVERY_S = 1;
3263
+ function namesMe(wallet, mine) {
3264
+ if (typeof wallet !== "string" || wallet === "") return false;
3265
+ if (typeof mine !== "string" || mine === "") return false;
3266
+ return wallet.toLowerCase() === mine.toLowerCase();
3267
+ }
3268
+ var ModerationModule = class {
3269
+ constructor(deps) {
3270
+ this.banned = false;
3271
+ this.kickedUntil = 0;
3272
+ this.canModerate = false;
3273
+ // Private mode (2026-11-19): the last answer's word on this visitor, its isCitizen and when it came, a hint's read
3274
+ // waiting its random spread, and the callers of checkCitizen() waiting on the next read
3275
+ this.privateBlocked = false;
3276
+ this.citizen = false;
3277
+ this.citizenAnsweredAt = null;
3278
+ this.hintDueAt = null;
3279
+ this.readWaiters = [];
3280
+ this.rects = [];
3281
+ this.boxes = [];
3282
+ this.wallEntities = [];
3283
+ this.lastBlocked = false;
3284
+ this.lastStanding = "clear";
3285
+ this.lastReadAt = Number.NEGATIVE_INFINITY;
3286
+ this.readInFlight = false;
3287
+ this.readPending = false;
3288
+ this.wasInScene = null;
3289
+ this.sinceCheck = 0;
3290
+ this.started = false;
3291
+ /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor inside a wall moved above it */
3292
+ this.system = (dt) => {
3293
+ if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
3294
+ this.hintDueAt = null;
3295
+ this.requestRead();
3296
+ }
3297
+ if (this.readWaiters.length > 0) {
3298
+ const t = this.now();
3299
+ const expired = this.readWaiters.filter((w) => t >= w.deadline);
3300
+ if (expired.length > 0) {
3301
+ this.readWaiters = this.readWaiters.filter((w) => t < w.deadline);
3302
+ for (const w of expired) w.resolve();
3303
+ }
3304
+ }
3305
+ this.sinceCheck += dt;
3306
+ if (this.sinceCheck < CHECK_EVERY_S) return;
3307
+ this.sinceCheck = 0;
3308
+ const now = this.now();
3309
+ if (this.kickedUntil > 0 && now >= this.kickedUntil) {
3310
+ this.kickedUntil = 0;
3311
+ this.sync();
3312
+ }
3313
+ const me = getPlayerPosition();
3314
+ const inScene = me !== null && this.rects.length > 0 && inParcels(me, this.rects);
3315
+ if (inScene && this.wasInScene === false) this.readPending = true;
3316
+ if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
3317
+ this.wasInScene = inScene;
3318
+ this.tryRead();
3319
+ if (me && this.blocked && insideWalls(me, this.boxes)) {
3320
+ const to = ejectPoint(this.boxes, this.rects, me);
3321
+ if (to) {
3322
+ this.log("Blocked and inside the walls - moving above them", to);
3323
+ Promise.resolve((0, import_RestrictedActions5.movePlayerTo)({ newRelativePosition: import_math6.Vector3.create(to.x, to.y, to.z) })).catch(() => {
3324
+ });
3325
+ }
3326
+ }
3327
+ };
3328
+ this.deps = deps;
3329
+ }
3330
+ now() {
3331
+ return this.deps.now ? this.deps.now() : Date.now();
3332
+ }
3333
+ log(msg, ...args) {
3334
+ this.deps.log?.(msg, ...args);
3335
+ }
3336
+ /** Reads the scene's parcels and starts the checks (once) */
3337
+ async start() {
3338
+ if (this.started) return;
3339
+ this.started = true;
3340
+ import_ecs4.engine.addSystem(this.system);
3341
+ try {
3342
+ await getSceneBounds();
3343
+ this.rects = getParcelRects();
3344
+ this.boxes = wallBoxes(this.rects);
3345
+ } catch {
3346
+ }
3347
+ this.sync();
3348
+ }
3349
+ /** banned, kicked (KICK ALL, until it lapses), private (the scene's private mode) or clear - in that precedence */
3350
+ get standing() {
3351
+ if (this.banned) return "banned";
3352
+ if (this.kickedUntil > 0 && this.now() < this.kickedUntil) return "kicked";
3353
+ if (this.privateBlocked) return "private";
3354
+ return "clear";
3355
+ }
3356
+ /** The last answer's isCitizen (2026-11-19): false before one, and from a server that does not answer it */
3357
+ get isCitizen() {
3358
+ return this.citizen;
3359
+ }
3360
+ /**
3361
+ * Whether this visitor is a TheStatic.tv citizen (2026-11-19): the last answer when it is under READ_GAP_MS old, else
3362
+ * the answer of the next read - started now, or the one in flight - through the same gate as every other read. A
3363
+ * read that fails answers what the last one said (false before any), and so does one that has not settled within
3364
+ * CITIZEN_WAIT_MS (the module's system ends that wait).
3365
+ */
3366
+ async checkCitizen() {
3367
+ if (this.citizenAnsweredAt !== null && this.now() - this.citizenAnsweredAt < READ_GAP_MS) return this.citizen;
3368
+ await new Promise((resolve) => {
3369
+ this.readWaiters.push({ resolve, deadline: this.now() + CITIZEN_WAIT_MS });
3370
+ if (!this.readInFlight) this.requestRead();
3371
+ });
3372
+ return this.citizen;
3373
+ }
3374
+ get blocked() {
3375
+ return this.standing !== "clear";
3376
+ }
3377
+ /** How long a kick has left, in ms (0 when not kicked) */
3378
+ get kickLeftMs() {
3379
+ return this.standing === "kicked" ? Math.max(0, this.kickedUntil - this.now()) : 0;
3380
+ }
3381
+ /**
3382
+ * admin-check's answer: the ban list's word on this visitor, whether they moderate the scene, and (2026-11-19) the
3383
+ * private mode's word and whether they are a citizen. Only the boolean true counts, so an answer without the new
3384
+ * fields reads as open and not a citizen. One who can moderate is never walled by private mode here, whatever the
3385
+ * answer says (the server admits them; this keeps a wrong answer from locking an admin out).
3386
+ */
3387
+ applyStanding(answer) {
3388
+ this.banned = answer.isBanned === true;
3389
+ this.canModerate = answer.canModerate === true;
3390
+ this.privateBlocked = answer.privateBlocked === true && !this.canModerate;
3391
+ this.citizen = answer.isCitizen === true;
3392
+ this.citizenAnsweredAt = this.now();
3393
+ this.lastReadAt = Math.max(this.lastReadAt, this.now());
3394
+ this.sync();
3395
+ }
3396
+ /**
3397
+ * A command from the scene's queue (the poll every visitor runs). Returns true for the three this module takes.
3398
+ * kickBanned names a wallet: the named visitor re-reads their standing, every other visitor does nothing.
3399
+ * privateMode (2026-11-19) is a hint for every visitor: its payload is not read - a re-read after a random wait of up
3400
+ * to HINT_SPREAD_MS, joined by any hint that comes while it waits, and still gated by one read in flight and
3401
+ * READ_GAP_MS, so no number of hints makes this copy read faster than that.
3402
+ */
3403
+ handleCommand(type, payload) {
3404
+ if (type === "privateMode") {
3405
+ if (this.hintDueAt === null) {
3406
+ const r = this.deps.random ? this.deps.random() : Math.random();
3407
+ const wait = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) * HINT_SPREAD_MS : 0;
3408
+ this.hintDueAt = this.now() + wait;
3409
+ this.log(`Private mode changed - reading my standing in ${Math.round(wait)} ms`);
3410
+ }
3411
+ return true;
3412
+ }
3413
+ if (type === "kickBanned") {
3414
+ if (namesMe(payload?.wallet, this.deps.myWallet())) {
3415
+ this.log("A kick names me - reading my standing");
3416
+ this.requestRead();
3417
+ }
3418
+ return true;
3419
+ }
3420
+ if (type === "kickAll") {
3421
+ if (!this.canModerate) {
3422
+ this.kickedUntil = this.now() + KICK_MS;
3423
+ this.sync();
3424
+ }
3425
+ return true;
3426
+ }
3427
+ return false;
3428
+ }
3429
+ /** Ask for a fresh standing read: at once when the gate allows, else as soon as it does */
3430
+ requestRead() {
3431
+ this.readPending = true;
3432
+ this.tryRead();
3433
+ }
3434
+ tryRead() {
3435
+ if (!this.readPending || this.readInFlight) return;
3436
+ const now = this.now();
3437
+ if (now - this.lastReadAt < READ_GAP_MS) return;
3438
+ this.readPending = false;
3439
+ this.readInFlight = true;
3440
+ this.lastReadAt = now;
3441
+ this.deps.reread().catch(() => {
3442
+ }).finally(() => {
3443
+ this.readInFlight = false;
3444
+ const waiters = this.readWaiters;
3445
+ this.readWaiters = [];
3446
+ for (const w of waiters) w.resolve();
3447
+ });
3448
+ }
3449
+ /** The walls follow blocked; the scene hears of a change */
3450
+ sync() {
3451
+ const standing = this.standing;
3452
+ const blocked = standing !== "clear";
3453
+ if (blocked && this.wallEntities.length === 0) this.raiseWalls();
3454
+ if (!blocked && this.wallEntities.length > 0) this.lowerWalls();
3455
+ if (blocked !== this.lastBlocked || standing !== this.lastStanding) {
3456
+ this.lastBlocked = blocked;
3457
+ this.lastStanding = standing;
3458
+ this.log(`Standing: ${standing}`);
3459
+ this.deps.onChange?.(blocked, standing);
3460
+ }
3461
+ }
3462
+ raiseWalls() {
3463
+ for (const b of this.boxes) {
3464
+ const wall = import_ecs4.engine.addEntity();
3465
+ import_ecs4.Transform.create(wall, {
3466
+ position: import_math6.Vector3.create((b.minX + b.maxX) / 2, b.top / 2, (b.minZ + b.maxZ) / 2),
3467
+ scale: import_math6.Vector3.create(b.maxX - b.minX, b.top, b.maxZ - b.minZ)
3468
+ });
3469
+ import_ecs4.MeshCollider.setBox(wall, import_ecs4.ColliderLayer.CL_PHYSICS);
3470
+ this.wallEntities.push(wall);
3471
+ }
3472
+ }
3473
+ lowerWalls() {
3474
+ for (const wall of this.wallEntities) import_ecs4.engine.removeEntity(wall);
3475
+ this.wallEntities = [];
3476
+ }
3477
+ /** The walls this copy has up (one per parcel while blocked) */
3478
+ get wallCount() {
3479
+ return this.wallEntities.length;
3480
+ }
3481
+ };
3482
+
2727
3483
  // src/ui/admin-panel-ui.tsx
2728
- var BAN_KICK_POSITION = import_math5.Vector3.create(16, -50, 16);
3484
+ var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
3485
+ function figuresOf(value) {
3486
+ const figures = value?.figures;
3487
+ if (!figures || typeof figures !== "object") return null;
3488
+ if (!FIGURE_NAMES.every((name) => Number.isInteger(figures[name]))) return null;
3489
+ const basis = value.basis;
3490
+ return {
3491
+ recordings: figures.recordings,
3492
+ vaulted: figures.vaulted,
3493
+ slugKeyedLeft: figures.slugKeyedLeft,
3494
+ pendingReports: figures.pendingReports,
3495
+ ...typeof basis === "string" ? { basis } : {}
3496
+ };
3497
+ }
3498
+ function channelDeleteLines(look, changed) {
3499
+ const lines = [];
3500
+ if (changed) lines.push("WHAT IT HOLDS CHANGED - READ AGAIN");
3501
+ if (look.unlinkOnly) {
3502
+ lines.push("This only unlinks the channel.", "Nothing is deleted.");
3503
+ return lines;
3504
+ }
3505
+ const { recordings, vaulted, slugKeyedLeft } = look.figures;
3506
+ if (recordings > 0) {
3507
+ lines.push(`Deletes ${recordings} recording${recordings === 1 ? "" : "s"} for good`);
3508
+ if (vaulted > 0) lines.push(`${vaulted} of them in the Vault`);
3509
+ } else {
3510
+ lines.push("It holds no recordings");
3511
+ }
3512
+ if (slugKeyedLeft > 0) lines.push(`${slugKeyedLeft} record${slugKeyedLeft === 1 ? "" : "s"} under its name stay${slugKeyedLeft === 1 ? "s" : ""}`);
3513
+ lines.push("Stream history is kept");
3514
+ return lines;
3515
+ }
3516
+ var SEEN_COMMAND_IDS_MAX = 200;
2729
3517
  var C2 = {
2730
- bg: import_math5.Color4.create(0.08, 0.08, 0.12, 0.98),
2731
- header: import_math5.Color4.create(0.9, 0.15, 0.15, 1),
2732
- tabActive: import_math5.Color4.create(0, 0.7, 0.7, 1),
2733
- tabInactive: import_math5.Color4.create(0.15, 0.15, 0.2, 1),
2734
- section: import_math5.Color4.create(0.12, 0.12, 0.18, 1),
2735
- btn: import_math5.Color4.create(0.2, 0.2, 0.28, 1),
2736
- cyan: import_math5.Color4.create(0, 0.8, 0.8, 1),
2737
- magenta: import_math5.Color4.create(0.85, 0.2, 0.55, 1),
2738
- yellow: import_math5.Color4.create(0.95, 0.75, 0.1, 1),
2739
- green: import_math5.Color4.create(0.2, 0.75, 0.3, 1),
2740
- red: import_math5.Color4.create(0.85, 0.2, 0.2, 1),
2741
- purple: import_math5.Color4.create(0.6, 0.3, 0.85, 1),
2742
- orange: import_math5.Color4.create(0.95, 0.5, 0.15, 1),
2743
- text: import_math5.Color4.White(),
2744
- textDim: import_math5.Color4.create(0.6, 0.6, 0.7, 1)
3518
+ bg: import_math7.Color4.create(0.08, 0.08, 0.12, 0.98),
3519
+ header: import_math7.Color4.create(0.9, 0.15, 0.15, 1),
3520
+ tabActive: import_math7.Color4.create(0, 0.7, 0.7, 1),
3521
+ tabInactive: import_math7.Color4.create(0.15, 0.15, 0.2, 1),
3522
+ section: import_math7.Color4.create(0.12, 0.12, 0.18, 1),
3523
+ btn: import_math7.Color4.create(0.2, 0.2, 0.28, 1),
3524
+ cyan: import_math7.Color4.create(0, 0.8, 0.8, 1),
3525
+ magenta: import_math7.Color4.create(0.85, 0.2, 0.55, 1),
3526
+ yellow: import_math7.Color4.create(0.95, 0.75, 0.1, 1),
3527
+ green: import_math7.Color4.create(0.2, 0.75, 0.3, 1),
3528
+ red: import_math7.Color4.create(0.85, 0.2, 0.2, 1),
3529
+ purple: import_math7.Color4.create(0.6, 0.3, 0.85, 1),
3530
+ orange: import_math7.Color4.create(0.95, 0.5, 0.15, 1),
3531
+ text: import_math7.Color4.White(),
3532
+ textDim: import_math7.Color4.create(0.6, 0.6, 0.7, 1)
2745
3533
  };
2746
3534
  var AdminPanelUIModule = class {
2747
3535
  // UI scaling - uses shared client.uiScale
@@ -2762,6 +3550,10 @@ var AdminPanelUIModule = class {
2762
3550
  this.channelCreateError = "";
2763
3551
  this.channelDeleting = false;
2764
3552
  this.channelDeleteError = "";
3553
+ // The delete's confirm step (thestatic.tv 2026-11-13): what the server's look answered the channel holds - shown in
3554
+ // the panel and sent back as the acknowledgement - or null while no confirm is open
3555
+ this.channelDeleteLook = null;
3556
+ this.channelDeleteChanged = false;
2765
3557
  this.keyRotating = false;
2766
3558
  this.keyRotateStatus = "";
2767
3559
  this.streamControlling = false;
@@ -2779,34 +3571,90 @@ var AdminPanelUIModule = class {
2779
3571
  this.broadcastText = "";
2780
3572
  this.modStatus = "";
2781
3573
  this.modsFetched = false;
3574
+ // What the last kick sent from the Mod tab came to (2026-11-17): KICK ALL and the ban's kick are queued on
3575
+ // thestatic.tv, where every visitor's copy reads them
3576
+ this.kickStatus = "";
3577
+ // The Video and Broadcast buttons go through the same queue since 2026-11-18 (until then they reached the presser's
3578
+ // copy alone): what the last send from each came to, one line a section
3579
+ this.videoStatus = "";
3580
+ this.broadcastStatus = "";
3581
+ /** 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 */
3582
+ this.currentVideoUrl = null;
3583
+ // Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
3584
+ // status line, and the once-a-load gates for the declaration's upload and the saved state's read
3585
+ this.controls = [];
3586
+ this.currentOption = {};
3587
+ this.controlStatus = "";
3588
+ this.controlsUploaded = false;
3589
+ this.stateRead = false;
3590
+ /** init has read the video state: the saved control state may be read now (a persist control registered later reads then) */
3591
+ this.loadReadsDone = false;
3592
+ // The command poll (2026-11-18): the server's cursor, sent back as since once known, and the ids seen - the last
3593
+ // SEEN_COMMAND_IDS_MAX, this copy's own sends among them - so no command runs twice here
3594
+ this.commandCursor = null;
3595
+ this.seenCommandIds = /* @__PURE__ */ new Set();
3596
+ this.seenCommandOrder = [];
3597
+ this.controlLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3598
+ this.controlStatus = line;
3599
+ } };
3600
+ this.videoLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3601
+ this.videoStatus = line;
3602
+ } };
3603
+ this.broadcastLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3604
+ this.broadcastStatus = line;
3605
+ } };
3606
+ // Private mode (2026-11-19, Venue): the switch's state from the last read (null until an answer carries it), and the
3607
+ // MOD tab's line for the switch
3608
+ this.privateModeOn = null;
3609
+ this.privateStatus = "";
3610
+ this.privateLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3611
+ this.privateStatus = line;
3612
+ } };
2782
3613
  // --- UI Components ---
2783
- this.SectionHead = ({ label, color }) => /* @__PURE__ */ import_react_ecs5.default.createElement(
2784
- import_react_ecs5.UiEntity,
3614
+ this.SectionHead = ({ label, color }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3615
+ import_react_ecs6.UiEntity,
2785
3616
  {
2786
3617
  uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.sectionHeadHeight), margin: { bottom: 8 }, padding: { left: 10 }, alignItems: "center" },
2787
- uiBackground: { color: import_math5.Color4.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
3618
+ uiBackground: { color: import_math7.Color4.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
2788
3619
  },
2789
- /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: label, fontSize: this.theme.sectionHead, color })
3620
+ /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: label, fontSize: this.theme.sectionHead, color })
2790
3621
  );
2791
- this.TabBtn = ({ label, tab }) => /* @__PURE__ */ import_react_ecs5.default.createElement(
2792
- import_react_ecs5.Button,
3622
+ this.TabBtn = ({ label, tab }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
3623
+ import_react_ecs6.Button,
2793
3624
  {
2794
3625
  uiTransform: { flexGrow: 1, height: this.s(UI_DIMENSIONS.admin.tabHeight), justifyContent: "center", alignItems: "center" },
2795
3626
  uiBackground: { color: this.activeTab === tab ? C2.tabActive : C2.tabInactive },
2796
3627
  value: label,
2797
3628
  fontSize: this.theme.tabButton,
2798
- color: this.activeTab === tab ? import_math5.Color4.Black() : C2.text,
3629
+ color: this.activeTab === tab ? import_math7.Color4.Black() : C2.text,
2799
3630
  textAlign: "middle-center",
2800
3631
  onMouseDown: () => this.setActiveTab(tab)
2801
3632
  }
2802
3633
  );
3634
+ /**
3635
+ * The CONTROLS tab (2026-11-18): a section per registered control, a button per option, OFF when the control has one,
3636
+ * the current option highlighted, and one status line for the last press. Listed first in the tab bar, only when
3637
+ * controls are registered, for the same admins the VIDEO tab is.
3638
+ */
3639
+ this.ControlsTab = () => {
3640
+ const t = this.theme;
3641
+ 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(
3642
+ import_react_ecs6.Label,
3643
+ {
3644
+ value: this.controlStatus,
3645
+ fontSize: t.status,
3646
+ color: this.controlStatus.startsWith("Not sent") ? C2.red : C2.green,
3647
+ uiTransform: { height: this.s(18) }
3648
+ }
3649
+ ));
3650
+ };
2803
3651
  this.VideoTab = () => {
2804
3652
  if (!this.streamFetched) {
2805
3653
  this.fetchStreamData();
2806
3654
  }
2807
3655
  const t = this.theme;
2808
- 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(
2809
- import_react_ecs5.Button,
3656
+ 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(
3657
+ import_react_ecs6.Button,
2810
3658
  {
2811
3659
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2812
3660
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
@@ -2815,8 +3663,8 @@ var AdminPanelUIModule = class {
2815
3663
  color: C2.text,
2816
3664
  onMouseDown: () => this.claimTrial()
2817
3665
  }
2818
- ), 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(
2819
- import_react_ecs5.Button,
3666
+ ), 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(
3667
+ import_react_ecs6.Button,
2820
3668
  {
2821
3669
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2822
3670
  uiBackground: { color: this.channelCreating ? C2.btn : C2.cyan },
@@ -2825,47 +3673,47 @@ var AdminPanelUIModule = class {
2825
3673
  color: C2.text,
2826
3674
  onMouseDown: () => this.createChannel()
2827
3675
  }
2828
- ), 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(
2829
- import_react_ecs5.Label,
3676
+ ), 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(
3677
+ import_react_ecs6.Label,
2830
3678
  {
2831
3679
  value: this.streamData.isLive ? `LIVE \u2022 ${this.streamData.currentViewers || 0} viewers` : "OFFLINE",
2832
3680
  fontSize: t.label,
2833
3681
  color: this.streamData.isLive ? C2.red : C2.textDim
2834
3682
  }
2835
- ), /* @__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(
2836
- import_react_ecs5.Label,
3683
+ ), /* @__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(
3684
+ import_react_ecs6.Label,
2837
3685
  {
2838
3686
  value: `Channel: ${this.streamData.channelName || this.streamData.channelId}`,
2839
3687
  fontSize: t.labelSmall,
2840
3688
  color: C2.textDim,
2841
3689
  uiTransform: { margin: { bottom: 10 } }
2842
3690
  }
2843
- ), /* @__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(
2844
- import_react_ecs5.Label,
3691
+ ), /* @__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(
3692
+ import_react_ecs6.Label,
2845
3693
  {
2846
3694
  value: this.streamData.rtmpUrl || "Loading...",
2847
3695
  fontSize: t.label,
2848
3696
  color: this.streamData.rtmpUrl ? C2.text : C2.textDim,
2849
3697
  uiTransform: { margin: { left: 6 } }
2850
3698
  }
2851
- )), /* @__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(
2852
- import_react_ecs5.Label,
3699
+ )), /* @__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(
3700
+ import_react_ecs6.Label,
2853
3701
  {
2854
3702
  value: this.streamData.streamKey || "Loading...",
2855
3703
  fontSize: t.label,
2856
3704
  color: this.streamData.streamKey ? C2.cyan : C2.textDim,
2857
3705
  uiTransform: { margin: { left: 6 } }
2858
3706
  }
2859
- )), /* @__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(
2860
- import_react_ecs5.Label,
3707
+ )), /* @__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(
3708
+ import_react_ecs6.Label,
2861
3709
  {
2862
3710
  value: this.streamData.hlsUrl || "Not available",
2863
3711
  fontSize: t.label,
2864
3712
  color: this.streamData.hlsUrl ? C2.green : C2.textDim,
2865
3713
  uiTransform: { margin: { left: 6 } }
2866
3714
  }
2867
- )), /* @__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(
2868
- import_react_ecs5.Button,
3715
+ )), /* @__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(
3716
+ import_react_ecs6.Button,
2869
3717
  {
2870
3718
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2871
3719
  uiBackground: { color: this.streamControlling ? C2.btn : C2.green },
@@ -2874,8 +3722,8 @@ var AdminPanelUIModule = class {
2874
3722
  color: C2.text,
2875
3723
  onMouseDown: () => this.startStream()
2876
3724
  }
2877
- ), this.streamData.isLive && /* @__PURE__ */ import_react_ecs5.default.createElement(
2878
- import_react_ecs5.Button,
3725
+ ), this.streamData.isLive && /* @__PURE__ */ import_react_ecs6.default.createElement(
3726
+ import_react_ecs6.Button,
2879
3727
  {
2880
3728
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2881
3729
  uiBackground: { color: this.streamControlling ? C2.btn : C2.red },
@@ -2884,18 +3732,18 @@ var AdminPanelUIModule = class {
2884
3732
  color: C2.text,
2885
3733
  onMouseDown: () => this.stopStream()
2886
3734
  }
2887
- ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs5.default.createElement(
2888
- import_react_ecs5.Button,
3735
+ ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs6.default.createElement(
3736
+ import_react_ecs6.Button,
2889
3737
  {
2890
3738
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2891
3739
  uiBackground: { color: C2.cyan },
2892
3740
  value: "Play on Screen",
2893
3741
  fontSize: t.buttonSmall,
2894
3742
  color: C2.text,
2895
- onMouseDown: () => this.config.onVideoPlay?.(this.streamData.hlsUrl)
3743
+ onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
2896
3744
  }
2897
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
2898
- import_react_ecs5.Button,
3745
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3746
+ import_react_ecs6.Button,
2899
3747
  {
2900
3748
  uiTransform: { width: this.s(80), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2901
3749
  uiBackground: { color: C2.btn },
@@ -2904,8 +3752,8 @@ var AdminPanelUIModule = class {
2904
3752
  color: C2.text,
2905
3753
  onMouseDown: () => this.refreshStreamStatus()
2906
3754
  }
2907
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2908
- import_react_ecs5.Button,
3755
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3756
+ import_react_ecs6.Button,
2909
3757
  {
2910
3758
  uiTransform: { width: this.s(95), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2911
3759
  uiBackground: { color: this.keyRotating ? C2.btn : C2.yellow },
@@ -2914,8 +3762,8 @@ var AdminPanelUIModule = class {
2914
3762
  color: C2.text,
2915
3763
  onMouseDown: () => this.rotateStreamKey()
2916
3764
  }
2917
- ), !this.streamData.isLive && /* @__PURE__ */ import_react_ecs5.default.createElement(
2918
- import_react_ecs5.Button,
3765
+ ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ import_react_ecs6.default.createElement(
3766
+ import_react_ecs6.Button,
2919
3767
  {
2920
3768
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2921
3769
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2924,11 +3772,31 @@ var AdminPanelUIModule = class {
2924
3772
  color: C2.text,
2925
3773
  onMouseDown: () => this.deleteChannel()
2926
3774
  }
2927
- )), 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(
2928
- import_react_ecs5.Input,
3775
+ )), !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(
3776
+ import_react_ecs6.Button,
3777
+ {
3778
+ uiTransform: { width: this.s(120), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3779
+ uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
3780
+ value: this.channelDeleting ? "..." : "Confirm Delete",
3781
+ fontSize: t.buttonSmall,
3782
+ color: C2.text,
3783
+ onMouseDown: () => this.confirmDeleteChannel()
3784
+ }
3785
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3786
+ import_react_ecs6.Button,
3787
+ {
3788
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3789
+ uiBackground: { color: C2.btn },
3790
+ value: "Cancel",
3791
+ fontSize: t.buttonSmall,
3792
+ color: C2.text,
3793
+ onMouseDown: () => this.cancelDeleteChannel()
3794
+ }
3795
+ ))), 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(
3796
+ import_react_ecs6.Input,
2929
3797
  {
2930
3798
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
2931
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
3799
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
2932
3800
  placeholder: "Video URL...",
2933
3801
  placeholderColor: C2.textDim,
2934
3802
  color: C2.text,
@@ -2938,20 +3806,18 @@ var AdminPanelUIModule = class {
2938
3806
  this.customVideoUrl = val;
2939
3807
  }
2940
3808
  }
2941
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2942
- import_react_ecs5.Button,
3809
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3810
+ import_react_ecs6.Button,
2943
3811
  {
2944
3812
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
2945
3813
  uiBackground: { color: C2.green },
2946
3814
  value: "Play",
2947
3815
  fontSize: t.button,
2948
3816
  color: C2.text,
2949
- onMouseDown: () => {
2950
- if (this.customVideoUrl) this.config.onVideoPlay?.(this.customVideoUrl);
2951
- }
3817
+ onMouseDown: () => this.playNow()
2952
3818
  }
2953
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2954
- import_react_ecs5.Button,
3819
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3820
+ import_react_ecs6.Button,
2955
3821
  {
2956
3822
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 6 } },
2957
3823
  uiBackground: { color: C2.btn },
@@ -2962,55 +3828,82 @@ var AdminPanelUIModule = class {
2962
3828
  this.customVideoUrl = "";
2963
3829
  }
2964
3830
  }
2965
- )), /* @__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(
2966
- import_react_ecs5.Button,
3831
+ )), this.videoStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3832
+ import_react_ecs6.Label,
3833
+ {
3834
+ value: this.videoStatus,
3835
+ fontSize: t.status,
3836
+ color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
3837
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3838
+ }
3839
+ ), /* @__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(
3840
+ import_react_ecs6.Button,
2967
3841
  {
2968
3842
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2969
3843
  uiBackground: { color: C2.green },
2970
3844
  value: "Play",
2971
3845
  fontSize: t.button,
2972
3846
  color: C2.text,
2973
- onMouseDown: () => this.config.onCommand?.("videoPlay", { playing: true })
3847
+ onMouseDown: () => this.playbackPlay()
2974
3848
  }
2975
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2976
- import_react_ecs5.Button,
3849
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3850
+ import_react_ecs6.Button,
2977
3851
  {
2978
3852
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2979
3853
  uiBackground: { color: C2.red },
2980
3854
  value: "Stop",
2981
3855
  fontSize: t.button,
2982
3856
  color: C2.text,
2983
- onMouseDown: () => this.config.onVideoStop?.()
3857
+ onMouseDown: () => this.playbackStop()
2984
3858
  }
2985
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
2986
- import_react_ecs5.Button,
3859
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3860
+ import_react_ecs6.Button,
2987
3861
  {
2988
3862
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2989
3863
  uiBackground: { color: C2.btn },
2990
3864
  value: "Reset Default",
2991
3865
  fontSize: t.buttonSmall,
2992
3866
  color: C2.text,
2993
- onMouseDown: () => this.config.onCommand?.("videoClear", {})
3867
+ onMouseDown: () => this.resetDefault()
2994
3868
  }
2995
- )), /* @__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(
2996
- import_react_ecs5.Button,
3869
+ )), /* @__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(
3870
+ import_react_ecs6.Button,
3871
+ {
3872
+ key: `play-${slot}`,
3873
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3874
+ uiBackground: { color: C2.cyan },
3875
+ value: `Play ${i + 1}`,
3876
+ fontSize: t.button,
3877
+ color: C2.text,
3878
+ onMouseDown: () => this.pressSlot(slot)
3879
+ }
3880
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(
3881
+ import_react_ecs6.Button,
2997
3882
  {
2998
3883
  uiTransform: { height: this.s(24) },
2999
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
3884
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3000
3885
  value: "Edit slots at thestatic.tv",
3001
3886
  fontSize: t.labelSmall,
3002
3887
  color: C2.cyan,
3003
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3888
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3004
3889
  }
3005
3890
  ));
3006
3891
  };
3007
3892
  this.ModTab = () => {
3008
3893
  const t = this.theme;
3009
- 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(
3010
- import_react_ecs5.Input,
3894
+ 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(
3895
+ import_react_ecs6.Label,
3896
+ {
3897
+ value: this.kickStatus,
3898
+ fontSize: t.status,
3899
+ color: this.kickStatus.startsWith("Kick not sent") ? C2.red : C2.green,
3900
+ uiTransform: { height: this.s(18) }
3901
+ }
3902
+ ), /* @__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(
3903
+ import_react_ecs6.Input,
3011
3904
  {
3012
3905
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3013
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
3906
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3014
3907
  placeholder: "Message to all players...",
3015
3908
  placeholderColor: C2.textDim,
3016
3909
  color: C2.text,
@@ -3020,8 +3913,8 @@ var AdminPanelUIModule = class {
3020
3913
  this.broadcastText = val;
3021
3914
  }
3022
3915
  }
3023
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3024
- import_react_ecs5.Button,
3916
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
3917
+ import_react_ecs6.Button,
3025
3918
  {
3026
3919
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3027
3920
  uiBackground: { color: C2.orange },
@@ -3030,27 +3923,51 @@ var AdminPanelUIModule = class {
3030
3923
  color: C2.text,
3031
3924
  onMouseDown: () => this.sendBroadcast()
3032
3925
  }
3033
- )), /* @__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(
3034
- import_react_ecs5.Button,
3926
+ )), this.broadcastStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3927
+ import_react_ecs6.Label,
3928
+ {
3929
+ value: this.broadcastStatus,
3930
+ fontSize: t.status,
3931
+ color: this.broadcastStatus.startsWith("Not sent") ? C2.red : C2.green,
3932
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3933
+ }
3934
+ ), /* @__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(
3935
+ import_react_ecs6.Button,
3035
3936
  {
3036
3937
  uiTransform: { width: this.s(130), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: 4 },
3037
3938
  uiBackground: { color: C2.red },
3038
3939
  value: "KICK ALL",
3039
3940
  fontSize: t.button,
3040
3941
  color: C2.text,
3041
- onMouseDown: () => {
3042
- this.log("KICK ALL clicked");
3043
- this.config.onCommand?.("kickAll", {});
3044
- }
3942
+ onMouseDown: () => this.kickAll()
3045
3943
  }
3046
- )), /* @__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(
3047
- import_react_ecs5.UiEntity,
3944
+ )), 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(
3945
+ import_react_ecs6.Button,
3946
+ {
3947
+ key: `private-${on ? "on" : "off"}`,
3948
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3949
+ uiBackground: { color: this.privateModeOn === on ? C2.yellow : C2.btn },
3950
+ value: on ? "ON" : "OFF",
3951
+ fontSize: t.buttonSmall,
3952
+ color: this.privateModeOn === on ? import_math7.Color4.Black() : C2.text,
3953
+ onMouseDown: () => this.setPrivateMode(on)
3954
+ }
3955
+ ))), this.privateStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
3956
+ import_react_ecs6.Label,
3957
+ {
3958
+ value: this.privateStatus,
3959
+ fontSize: t.status,
3960
+ color: this.privateStatus.startsWith("Not sent") ? C2.red : C2.green,
3961
+ uiTransform: { height: this.s(18) }
3962
+ }
3963
+ )), /* @__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(
3964
+ import_react_ecs6.UiEntity,
3048
3965
  {
3049
3966
  key: `admin-${i}`,
3050
3967
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3051
3968
  },
3052
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3053
- import_react_ecs5.Label,
3969
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
3970
+ import_react_ecs6.Label,
3054
3971
  {
3055
3972
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3056
3973
  fontSize: t.label,
@@ -3058,8 +3975,8 @@ var AdminPanelUIModule = class {
3058
3975
  uiTransform: { width: this.s(130) }
3059
3976
  }
3060
3977
  ),
3061
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3062
- import_react_ecs5.Button,
3978
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
3979
+ import_react_ecs6.Button,
3063
3980
  {
3064
3981
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3065
3982
  uiBackground: { color: C2.btn },
@@ -3069,11 +3986,11 @@ var AdminPanelUIModule = class {
3069
3986
  onMouseDown: () => this.removeSceneAdmin(wallet)
3070
3987
  }
3071
3988
  )
3072
- ))), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3073
- import_react_ecs5.Input,
3989
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3990
+ import_react_ecs6.Input,
3074
3991
  {
3075
3992
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3076
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
3993
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3077
3994
  placeholder: "0x... add admin",
3078
3995
  placeholderColor: C2.textDim,
3079
3996
  color: C2.text,
@@ -3083,8 +4000,8 @@ var AdminPanelUIModule = class {
3083
4000
  this.newAdminWallet = val;
3084
4001
  }
3085
4002
  }
3086
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3087
- import_react_ecs5.Button,
4003
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
4004
+ import_react_ecs6.Button,
3088
4005
  {
3089
4006
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3090
4007
  uiBackground: { color: C2.purple },
@@ -3095,14 +4012,14 @@ var AdminPanelUIModule = class {
3095
4012
  if (this.newAdminWallet) this.addSceneAdmin(this.newAdminWallet);
3096
4013
  }
3097
4014
  }
3098
- )), /* @__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(
3099
- import_react_ecs5.UiEntity,
4015
+ )), /* @__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(
4016
+ import_react_ecs6.UiEntity,
3100
4017
  {
3101
4018
  key: `ban-${i}`,
3102
4019
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3103
4020
  },
3104
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3105
- import_react_ecs5.Label,
4021
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4022
+ import_react_ecs6.Label,
3106
4023
  {
3107
4024
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3108
4025
  fontSize: t.label,
@@ -3110,8 +4027,8 @@ var AdminPanelUIModule = class {
3110
4027
  uiTransform: { width: this.s(130) }
3111
4028
  }
3112
4029
  ),
3113
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3114
- import_react_ecs5.Button,
4030
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4031
+ import_react_ecs6.Button,
3115
4032
  {
3116
4033
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3117
4034
  uiBackground: { color: C2.green },
@@ -3121,11 +4038,11 @@ var AdminPanelUIModule = class {
3121
4038
  onMouseDown: () => this.unbanWallet(wallet)
3122
4039
  }
3123
4040
  )
3124
- ))), /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs5.default.createElement(
3125
- import_react_ecs5.Input,
4041
+ ))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
4042
+ import_react_ecs6.Input,
3126
4043
  {
3127
4044
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3128
- uiBackground: { color: import_math5.Color4.create(0.15, 0.15, 0.2, 1) },
4045
+ uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
3129
4046
  placeholder: "0x... ban wallet",
3130
4047
  placeholderColor: C2.textDim,
3131
4048
  color: C2.text,
@@ -3135,8 +4052,8 @@ var AdminPanelUIModule = class {
3135
4052
  this.newBanWallet = val;
3136
4053
  }
3137
4054
  }
3138
- ), /* @__PURE__ */ import_react_ecs5.default.createElement(
3139
- import_react_ecs5.Button,
4055
+ ), /* @__PURE__ */ import_react_ecs6.default.createElement(
4056
+ import_react_ecs6.Button,
3140
4057
  {
3141
4058
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3142
4059
  uiBackground: { color: C2.red },
@@ -3147,15 +4064,15 @@ var AdminPanelUIModule = class {
3147
4064
  if (this.newBanWallet) this.banWallet(this.newBanWallet);
3148
4065
  }
3149
4066
  }
3150
- )), /* @__PURE__ */ import_react_ecs5.default.createElement(
3151
- import_react_ecs5.Button,
4067
+ )), /* @__PURE__ */ import_react_ecs6.default.createElement(
4068
+ import_react_ecs6.Button,
3152
4069
  {
3153
4070
  uiTransform: { height: this.s(24) },
3154
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
4071
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3155
4072
  value: "Manage at thestatic.tv",
3156
4073
  fontSize: t.labelSmall,
3157
4074
  color: C2.cyan,
3158
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4075
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3159
4076
  }
3160
4077
  ));
3161
4078
  };
@@ -3164,11 +4081,24 @@ var AdminPanelUIModule = class {
3164
4081
  * Always renders notification (scaled), admin panel only for admins
3165
4082
  */
3166
4083
  this.getComponent = () => {
4084
+ if (this.moderation.blocked) {
4085
+ return BlockedNotice({
4086
+ standing: this.moderation.standing,
4087
+ kickLeftMs: this.moderation.kickLeftMs,
4088
+ scale: this.client.uiScale,
4089
+ // thestatic.tv's own origin, for a private event's BECOME A CITIZEN (2026-11-19): the API base less its path, as
4090
+ // the chat's REGISTER IDENTITY derives its /login
4091
+ siteUrl: this.baseUrl.replace("/api/v1/dcl", "")
4092
+ });
4093
+ }
3167
4094
  if (!this.isAdmin) {
3168
4095
  return this.renderScaledNotification();
3169
4096
  }
3170
4097
  const t = this.theme;
3171
4098
  const tabs = [];
4099
+ if (this.venue && this.controls.length > 0) {
4100
+ tabs.push({ label: "CONTROLS", id: "controls" });
4101
+ }
3172
4102
  if (this.config.sceneTabs && this.config.sceneTabs.length > 0) {
3173
4103
  this.config.sceneTabs.forEach((tab) => tabs.push({ label: tab.label, id: tab.id }));
3174
4104
  }
@@ -3181,8 +4111,8 @@ var AdminPanelUIModule = class {
3181
4111
  if (!tabs.find((tab) => tab.id === this.activeTab) && tabs.length > 0) {
3182
4112
  this.activeTab = tabs[0].id;
3183
4113
  }
3184
- return /* @__PURE__ */ import_react_ecs5.default.createElement(
3185
- import_react_ecs5.UiEntity,
4114
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
4115
+ import_react_ecs6.UiEntity,
3186
4116
  {
3187
4117
  uiTransform: {
3188
4118
  width: "100%",
@@ -3191,16 +4121,16 @@ var AdminPanelUIModule = class {
3191
4121
  }
3192
4122
  },
3193
4123
  this.renderScaledNotification(),
3194
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3195
- import_react_ecs5.UiEntity,
4124
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4125
+ import_react_ecs6.UiEntity,
3196
4126
  {
3197
4127
  uiTransform: {
3198
4128
  position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
3199
4129
  positionType: "absolute"
3200
4130
  }
3201
4131
  },
3202
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3203
- import_react_ecs5.Button,
4132
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4133
+ import_react_ecs6.Button,
3204
4134
  {
3205
4135
  uiTransform: { width: this.s(100), height: this.s(45) },
3206
4136
  uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
@@ -3211,8 +4141,8 @@ var AdminPanelUIModule = class {
3211
4141
  }
3212
4142
  )
3213
4143
  ),
3214
- this.panelOpen && /* @__PURE__ */ import_react_ecs5.default.createElement(
3215
- import_react_ecs5.UiEntity,
4144
+ this.panelOpen && /* @__PURE__ */ import_react_ecs6.default.createElement(
4145
+ import_react_ecs6.UiEntity,
3216
4146
  {
3217
4147
  key: `admin-panel-${this.client.uiScale}`,
3218
4148
  uiTransform: {
@@ -3225,8 +4155,8 @@ var AdminPanelUIModule = class {
3225
4155
  },
3226
4156
  uiBackground: { color: C2.bg }
3227
4157
  },
3228
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3229
- import_react_ecs5.UiEntity,
4158
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4159
+ import_react_ecs6.UiEntity,
3230
4160
  {
3231
4161
  uiTransform: {
3232
4162
  width: "100%",
@@ -3238,12 +4168,12 @@ var AdminPanelUIModule = class {
3238
4168
  },
3239
4169
  uiBackground: { color: C2.header }
3240
4170
  },
3241
- /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
3242
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3243
- import_react_ecs5.Button,
4171
+ /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
4172
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4173
+ import_react_ecs6.Button,
3244
4174
  {
3245
4175
  uiTransform: { width: this.s(28), height: this.s(28) },
3246
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0.3) },
4176
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0.3) },
3247
4177
  value: "X",
3248
4178
  fontSize: t.header,
3249
4179
  color: THEME.colors.red,
@@ -3251,9 +4181,9 @@ var AdminPanelUIModule = class {
3251
4181
  }
3252
4182
  )
3253
4183
  ),
3254
- /* @__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 }))),
3255
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3256
- import_react_ecs5.UiEntity,
4184
+ /* @__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 }))),
4185
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4186
+ import_react_ecs6.UiEntity,
3257
4187
  {
3258
4188
  uiTransform: {
3259
4189
  width: "100%",
@@ -3262,12 +4192,13 @@ var AdminPanelUIModule = class {
3262
4192
  flexDirection: "column"
3263
4193
  }
3264
4194
  },
3265
- this.activeTab === "video" && /* @__PURE__ */ import_react_ecs5.default.createElement(this.VideoTab, null),
3266
- this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ import_react_ecs5.default.createElement(this.ModTab, null),
4195
+ this.activeTab === "controls" && this.venue && this.controls.length > 0 && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ControlsTab, null),
4196
+ this.activeTab === "video" && /* @__PURE__ */ import_react_ecs6.default.createElement(this.VideoTab, null),
4197
+ this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ModTab, null),
3267
4198
  this.config.sceneTabs?.map((tab) => this.activeTab === tab.id && tab.render())
3268
4199
  ),
3269
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3270
- import_react_ecs5.UiEntity,
4200
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4201
+ import_react_ecs6.UiEntity,
3271
4202
  {
3272
4203
  uiTransform: {
3273
4204
  width: "100%",
@@ -3277,15 +4208,15 @@ var AdminPanelUIModule = class {
3277
4208
  },
3278
4209
  uiBackground: { color: C2.section }
3279
4210
  },
3280
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3281
- import_react_ecs5.Button,
4211
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
4212
+ import_react_ecs6.Button,
3282
4213
  {
3283
4214
  uiTransform: { height: this.s(24) },
3284
- uiBackground: { color: import_math5.Color4.create(0, 0, 0, 0) },
4215
+ uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
3285
4216
  value: `thestatic.tv/scene/${this.config.sceneId}`,
3286
4217
  fontSize: t.labelSmall,
3287
4218
  color: C2.cyan,
3288
- onMouseDown: () => (0, import_RestrictedActions3.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4219
+ onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3289
4220
  }
3290
4221
  )
3291
4222
  )
@@ -3306,14 +4237,41 @@ var AdminPanelUIModule = class {
3306
4237
  // Ensure sceneId is set
3307
4238
  };
3308
4239
  this.baseUrl = client.getBaseUrl();
4240
+ this.moderation = new ModerationModule({
4241
+ reread: () => this.checkAdminStatus(),
4242
+ myWallet: () => this.myWallet(),
4243
+ onChange: (blocked, standing) => this.onStandingChange(blocked, standing),
4244
+ log: (msg, ...args) => this.log(msg, ...args)
4245
+ });
4246
+ this.adminWait = new PlayerWait({
4247
+ getPlayer: () => (0, import_players2.getPlayer)(),
4248
+ setInterval: dclSetInterval,
4249
+ clearInterval: dclClearInterval,
4250
+ check: (player) => this.checkAdminFor(player),
4251
+ log: (msg) => this.log(msg)
4252
+ });
3309
4253
  if (config.headerColor) {
3310
- C2.header = import_math5.Color4.create(
4254
+ C2.header = import_math7.Color4.create(
3311
4255
  config.headerColor.r,
3312
4256
  config.headerColor.g,
3313
4257
  config.headerColor.b,
3314
4258
  config.headerColor.a
3315
4259
  );
3316
4260
  }
4261
+ if (config.controls && config.controls.length > 0) this.registerControls(config.controls);
4262
+ }
4263
+ kickLine(sent) {
4264
+ return { sent, notSent: "Kick not sent", show: (line) => {
4265
+ this.kickStatus = line;
4266
+ } };
4267
+ }
4268
+ /**
4269
+ * The Venue tier (2026-11-19): scene controls and private mode are Venue's, so the CONTROLS tab, the declaration's
4270
+ * upload, a press, the saved state's read, a queued control's run and the private-mode switch all need it. The
4271
+ * client knows it from the session start, before this panel exists.
4272
+ */
4273
+ get venue() {
4274
+ return this.client.hasVenueFeatures === true;
3317
4275
  }
3318
4276
  log(msg, ...args) {
3319
4277
  if (this.config.debug) {
@@ -3332,26 +4290,36 @@ var AdminPanelUIModule = class {
3332
4290
  * Initialize the admin panel - checks admin status and fetches video state
3333
4291
  */
3334
4292
  async init() {
4293
+ this.moderation.start().catch(() => {
4294
+ });
3335
4295
  await this.checkAdminStatus();
3336
4296
  await this.fetchVideoState();
3337
4297
  this.autoPlayDefault();
4298
+ this.loadReadsDone = true;
4299
+ await this.readSavedState();
3338
4300
  this.startCommandPolling();
3339
4301
  this.log("Initialized");
3340
4302
  }
3341
4303
  /**
3342
- * Check if current player is an admin for this scene
4304
+ * Check if current player is an admin for this scene. With no player yet it waits for one on the SDK's timer and
4305
+ * checks then (utils/player-wait.ts): one wait at a time, ended quietly after 30 s with no wallet. A guest reading
4306
+ * (isGuest true) is checked at once and the wait goes on for a non-guest reading, checked once more if one comes
4307
+ * within the 30 s. Resolves when the check is done, or at once when there is none to run.
3343
4308
  */
3344
4309
  async checkAdminStatus() {
3345
- const player = (0, import_players2.getPlayer)();
3346
- if (!player?.userId) {
3347
- this.log("No player data yet");
3348
- return;
3349
- }
4310
+ await this.adminWait.run();
4311
+ }
4312
+ /** The admin check proper, for a player the explorer has resolved */
4313
+ async checkAdminFor(player) {
3350
4314
  this.playerWallet = player.userId;
3351
4315
  if (this.config.forceAdmin) {
3352
4316
  this.isAdmin = true;
3353
4317
  this.isOwner = true;
4318
+ this.moderation.applyStanding({ isBanned: false, canModerate: true });
3354
4319
  this.log("Admin status FORCED (forceAdmin: true)");
4320
+ this.uploadControls().catch(() => {
4321
+ });
4322
+ this.client.frames?.adminCheckSucceeded();
3355
4323
  return;
3356
4324
  }
3357
4325
  try {
@@ -3362,17 +4330,54 @@ var AdminPanelUIModule = class {
3362
4330
  const data = await res.json();
3363
4331
  this.isAdmin = data.showButton ?? data.hasAccess;
3364
4332
  this.isOwner = data.isOwner || data.isSceneAdmin;
3365
- if (data.isBanned) {
4333
+ const wasBanned = this.moderation.standing === "banned";
4334
+ if (typeof data.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
4335
+ this.moderation.applyStanding({
4336
+ isBanned: data.isBanned === true,
4337
+ canModerate: data.showButton === true || data.hasAccess === true,
4338
+ privateBlocked: data.privateBlocked === true,
4339
+ isCitizen: data.isCitizen === true
4340
+ });
4341
+ if (data.isBanned === true && !wasBanned) {
3366
4342
  this.config.onBroadcast?.("You have been banned from this scene.");
3367
- this.banKickPlayer();
3368
- this.log("Player is banned - kicking");
4343
+ this.log("Player is banned - blocked");
3369
4344
  }
3370
4345
  this.log("Admin status:", this.isAdmin, "Owner:", this.isOwner);
4346
+ if (this.isAdmin) this.uploadControls().catch(() => {
4347
+ });
4348
+ if (this.isAdmin) this.client.frames?.adminCheckSucceeded();
3371
4349
  }
3372
4350
  } catch (err) {
3373
4351
  this.log("Admin check error:", err);
3374
4352
  }
3375
4353
  }
4354
+ /** My wallet, lowercased: admin-check's player, else the explorer's */
4355
+ myWallet() {
4356
+ let wallet = this.playerWallet;
4357
+ if (!wallet) {
4358
+ try {
4359
+ wallet = (0, import_players2.getPlayer)()?.userId || "";
4360
+ } catch {
4361
+ wallet = "";
4362
+ }
4363
+ }
4364
+ return wallet ? wallet.toLowerCase() : null;
4365
+ }
4366
+ /** Blocked turned on or off: the panel closes, and the client stops what it plays and tells the scene */
4367
+ onStandingChange(blocked, standing) {
4368
+ if (blocked) this.hide();
4369
+ this.client._onBlockedChange?.(blocked, standing);
4370
+ }
4371
+ /** True while this visitor is banned or kicked (2026-11-17) */
4372
+ get isVisitorBlocked() {
4373
+ return this.moderation.blocked;
4374
+ }
4375
+ /** A url the scene's queue or the slots would play - nothing while this visitor is blocked */
4376
+ playUrl(url) {
4377
+ if (this.moderation.blocked) return;
4378
+ this.currentVideoUrl = url;
4379
+ this.config.onVideoPlay?.(url);
4380
+ }
3376
4381
  /**
3377
4382
  * Toggle the admin panel open/closed
3378
4383
  */
@@ -3424,6 +4429,128 @@ var AdminPanelUIModule = class {
3424
4429
  this.config.sceneTabs.push(tab);
3425
4430
  this.log("Registered scene tab:", tab.label);
3426
4431
  }
4432
+ // --- Scene controls (2026-11-18; Venue since 2026-11-19, Pro until then) ---
4433
+ /**
4434
+ * Register scene controls: the CONTROLS tab draws them, a press reaches every visitor's copy through the scene's
4435
+ * queue, and the declaration goes to the scene's record once an admin's check has succeeded. The same as the config's
4436
+ * `controls`; a control registered again by id replaces the earlier one. Only the shape is checked here - thestatic.tv
4437
+ * checks the ids, labels and bounds when the declaration is uploaded, and every press against it.
4438
+ */
4439
+ registerControls(controls) {
4440
+ for (const control of controls) {
4441
+ if (!control || typeof control.id !== "string" || !Array.isArray(control.options) || typeof control.onChange !== "function") {
4442
+ this.log("Scene control skipped - not a SceneControl:", control);
4443
+ continue;
4444
+ }
4445
+ const at = this.controls.findIndex((c) => c.id === control.id);
4446
+ if (at >= 0) this.controls[at] = control;
4447
+ else this.controls.push(control);
4448
+ }
4449
+ this.log("Registered scene controls:", this.controls.map((c) => c.id));
4450
+ this.readSavedState().catch(() => {
4451
+ });
4452
+ this.uploadControls().catch(() => {
4453
+ });
4454
+ }
4455
+ /** True when `option` is one of the control's, or 'off' on a control that has OFF */
4456
+ isControlOption(control, option) {
4457
+ if (option === "off") return control.off === true;
4458
+ return control.options.some((o) => o.id === option);
4459
+ }
4460
+ /** A queued sceneControl's registered control and valid option, or null for anything else */
4461
+ controlCommand(payload) {
4462
+ const p = payload;
4463
+ if (!p || typeof p.control !== "string" || typeof p.option !== "string") return null;
4464
+ const control = this.controls.find((c) => c.id === p.control);
4465
+ if (!control || !this.isControlOption(control, p.option)) return null;
4466
+ return { control, option: p.option };
4467
+ }
4468
+ /** Run a control's option on this copy and mark it current; a handler that throws is logged and breaks nothing else */
4469
+ applyControl(control, option) {
4470
+ this.currentOption[control.id] = option;
4471
+ try {
4472
+ control.onChange(option);
4473
+ } catch (err) {
4474
+ this.log("Control handler failed:", control.id, option, err);
4475
+ }
4476
+ }
4477
+ /** A press in the CONTROLS tab: this copy runs it at once, then everyone's through the queue (Venue, 2026-11-19) */
4478
+ async pressControl(control, option) {
4479
+ if (!this.venue) return;
4480
+ this.applyControl(control, option);
4481
+ await this.sendSceneCommand("sceneControl", { control: control.id, option }, this.controlLine);
4482
+ }
4483
+ /**
4484
+ * The saved option of every persist control, read once a load from the scene's public state route - after the admin
4485
+ * check and the video state, before the poll starts - and run on this copy, so a late arrival sees what the last
4486
+ * 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
4487
+ * option keeps the scene's own default.
4488
+ */
4489
+ async readSavedState() {
4490
+ if (this.stateRead || !this.loadReadsDone || !this.venue) return;
4491
+ const persisted = this.controls.filter((c) => c.persist === true);
4492
+ if (persisted.length === 0) return;
4493
+ this.stateRead = true;
4494
+ try {
4495
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/state`);
4496
+ if (!res.ok) {
4497
+ this.log("Scene state read refused:", res.status);
4498
+ return;
4499
+ }
4500
+ const data = await res.json();
4501
+ const state = data && typeof data.state === "object" && data.state !== null ? data.state : {};
4502
+ for (const control of persisted) {
4503
+ const saved = state[control.id];
4504
+ if (typeof saved === "string" && this.isControlOption(control, saved)) {
4505
+ this.log("Saved control option:", control.id, saved);
4506
+ this.applyControl(control, saved);
4507
+ }
4508
+ }
4509
+ } catch (err) {
4510
+ this.log("Scene state read error:", err);
4511
+ }
4512
+ }
4513
+ /**
4514
+ * The declaration - each control's id, label, options, off and persist, never its handler - posted once a load to the
4515
+ * scene's record on thestatic.tv, from a copy whose admin check succeeded, so the scene's page draws the same buttons.
4516
+ * thestatic.tv checks the shape and bounds and writes only a declaration that differs. A refusal is logged, never
4517
+ * shown to the visitor, and not retried in this load.
4518
+ */
4519
+ async uploadControls() {
4520
+ if (this.controlsUploaded || !this.isAdmin || !this.venue || this.controls.length === 0) return;
4521
+ this.controlsUploaded = true;
4522
+ const controls = this.controls.map((c) => ({
4523
+ id: c.id,
4524
+ label: c.label,
4525
+ options: c.options.map((o) => ({ id: o.id, label: o.label })),
4526
+ off: c.off === true,
4527
+ persist: c.persist === true
4528
+ }));
4529
+ try {
4530
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/config`, {
4531
+ method: "POST",
4532
+ headers: { "Content-Type": "application/json" },
4533
+ body: JSON.stringify({ controls })
4534
+ });
4535
+ if (res.ok) {
4536
+ this.log("Scene controls declared:", controls.map((c) => c.id));
4537
+ return;
4538
+ }
4539
+ const data = await res.json().catch(() => ({}));
4540
+ this.log("Scene controls declaration refused:", res.status, data.error);
4541
+ } catch (err) {
4542
+ this.log("Scene controls declaration error:", err);
4543
+ }
4544
+ }
4545
+ /** Remember a command id the poll has run or this copy has sent, forgetting the oldest past SEEN_COMMAND_IDS_MAX */
4546
+ markCommandSeen(id) {
4547
+ if (this.seenCommandIds.has(id)) return;
4548
+ this.seenCommandIds.add(id);
4549
+ this.seenCommandOrder.push(id);
4550
+ while (this.seenCommandOrder.length > SEEN_COMMAND_IDS_MAX) {
4551
+ this.seenCommandIds.delete(this.seenCommandOrder.shift());
4552
+ }
4553
+ }
3427
4554
  // --- Stream Polling ---
3428
4555
  startStreamPolling() {
3429
4556
  if (this.pollIntervalId !== null) return;
@@ -3464,52 +4591,91 @@ var AdminPanelUIModule = class {
3464
4591
  * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3465
4592
  */
3466
4593
  async signedRequest(url, init = {}) {
3467
- const res = await (0, import_SignedFetch2.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
4594
+ const res = await (0, import_SignedFetch3.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3468
4595
  return {
3469
4596
  ok: res.ok,
3470
4597
  status: res.status,
3471
4598
  json: async () => res.body ? JSON.parse(res.body) : {}
3472
4599
  };
3473
4600
  }
4601
+ /**
4602
+ * 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
4603
+ * cursor back as `since` once it has one - the first poll has none, so the 30-second replay on load stays, which the
4604
+ * kicks rely on - and tells commands apart by id: a bounded set of the last SEEN_COMMAND_IDS_MAX, this copy's own
4605
+ * sends among them (a press is not run twice here), so two commands in one millisecond both run. A command with no id
4606
+ * falls back to the timestamp rule every command used until then, and a server that answers no cursor (production
4607
+ * before 2026-11-18) gets no since and is read as before.
4608
+ */
3474
4609
  async pollCommands() {
3475
4610
  try {
3476
- const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
4611
+ const since = this.commandCursor !== null ? `?since=${this.commandCursor}` : "";
4612
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands${since}`);
3477
4613
  if (!res.ok) return;
3478
4614
  const data = await res.json();
3479
4615
  const commands = data.commands || [];
4616
+ if (typeof data.cursor === "number") this.commandCursor = data.cursor;
3480
4617
  for (const cmd of commands) {
3481
- if (cmd.timestamp <= this.lastCommandTimestamp) continue;
3482
- this.lastCommandTimestamp = cmd.timestamp;
3483
- if (cmd.type === "broadcast" && cmd.payload?.text) {
3484
- const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
3485
- this.log("Received broadcast:", msg);
3486
- this.config.onBroadcast?.(msg);
3487
- } else if (cmd.type === "clearBroadcast") {
3488
- this.log("Received clearBroadcast");
3489
- hideNotification();
3490
- } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
3491
- this.log("Received video play:", cmd.type, cmd.payload.url);
3492
- this.config.onVideoPlay?.(cmd.payload.url);
3493
- } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
3494
- this.log("Received video stop/clear:", cmd.type);
3495
- this.config.onVideoStop?.();
3496
- } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
3497
- const slotId = cmd.payload.slot;
3498
- if (cmd.payload.url) {
3499
- this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
3500
- this.config.onVideoPlay?.(cmd.payload.url);
3501
- } else {
3502
- this.log("Received videoPlaySlot:", slotId);
3503
- this.playSlot(slotId);
3504
- }
3505
- } else if (this.config.onCommand) {
3506
- this.log("Received command:", cmd.type, cmd.payload);
3507
- this.config.onCommand(cmd.type, cmd.payload);
4618
+ if (typeof cmd.id === "string" && cmd.id !== "") {
4619
+ if (this.seenCommandIds.has(cmd.id)) continue;
4620
+ this.markCommandSeen(cmd.id);
4621
+ if (typeof cmd.timestamp === "number" && cmd.timestamp > this.lastCommandTimestamp) this.lastCommandTimestamp = cmd.timestamp;
4622
+ } else {
4623
+ if (cmd.timestamp <= this.lastCommandTimestamp) continue;
4624
+ this.lastCommandTimestamp = cmd.timestamp;
4625
+ }
4626
+ try {
4627
+ this.runCommand(cmd);
4628
+ } catch (err) {
4629
+ this.log("Command handler failed:", cmd.type, err);
3508
4630
  }
3509
4631
  }
3510
4632
  } catch (err) {
3511
4633
  }
3512
4634
  }
4635
+ /** One queued command on this copy: the SDK's own types here, a registered control's option, else the scene's onCommand */
4636
+ runCommand(cmd) {
4637
+ const control = cmd.type === "sceneControl" && this.venue ? this.controlCommand(cmd.payload) : null;
4638
+ if (cmd.type === "broadcast" && cmd.payload?.text) {
4639
+ const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
4640
+ this.log("Received broadcast:", msg);
4641
+ this.config.onBroadcast?.(msg);
4642
+ } else if (cmd.type === "clearBroadcast") {
4643
+ this.log("Received clearBroadcast");
4644
+ hideNotification();
4645
+ } else if (cmd.type === "kickBanned" || cmd.type === "kickAll") {
4646
+ this.log("Received kick:", cmd.type, cmd.payload);
4647
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4648
+ this.config.onCommand?.(cmd.type, cmd.payload);
4649
+ } else if (cmd.type === "privateMode" && this.venue) {
4650
+ this.log("Received privateMode - re-reading my standing");
4651
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4652
+ } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
4653
+ this.log("Received video play:", cmd.type, cmd.payload.url);
4654
+ this.playUrl(cmd.payload.url);
4655
+ } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
4656
+ this.log("Received video stop/clear:", cmd.type);
4657
+ if (cmd.type === "videoClear") this.currentVideoUrl = null;
4658
+ this.config.onVideoStop?.();
4659
+ } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
4660
+ const slotId = cmd.payload.slot;
4661
+ if (cmd.payload.url) {
4662
+ this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
4663
+ this.playUrl(cmd.payload.url);
4664
+ } else {
4665
+ this.log("Received videoPlaySlot:", slotId);
4666
+ this.playSlot(slotId);
4667
+ }
4668
+ } else if (cmd.type === "framesRefresh") {
4669
+ this.log("Received framesRefresh");
4670
+ this.client.frames?.refresh();
4671
+ } else if (control) {
4672
+ this.log("Received scene control:", control.control.id, control.option);
4673
+ this.applyControl(control.control, control.option);
4674
+ } else if (this.config.onCommand) {
4675
+ this.log("Received command:", cmd.type, cmd.payload);
4676
+ this.config.onCommand(cmd.type, cmd.payload);
4677
+ }
4678
+ }
3513
4679
  // --- Stream API Calls ---
3514
4680
  async fetchStreamData() {
3515
4681
  if (this.streamFetched || !this.playerWallet) return;
@@ -3551,6 +4717,7 @@ var AdminPanelUIModule = class {
3551
4717
  defaultSlot: data.defaultSlot || null,
3552
4718
  videoSlots: data.videoSlots || {}
3553
4719
  };
4720
+ if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
3554
4721
  this.videoStateFetched = true;
3555
4722
  this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
3556
4723
  }
@@ -3565,7 +4732,7 @@ var AdminPanelUIModule = class {
3565
4732
  const slot = this.videoState?.videoSlots?.[slotId];
3566
4733
  if (slot?.url) {
3567
4734
  this.log("Playing slot:", slotId, slot.url);
3568
- this.config.onVideoPlay?.(slot.url);
4735
+ this.playUrl(slot.url);
3569
4736
  } else {
3570
4737
  this.log("Slot has no URL:", slotId);
3571
4738
  this.config.onVideoSlotPlay?.(slotId);
@@ -3580,7 +4747,7 @@ var AdminPanelUIModule = class {
3580
4747
  const slot = this.videoState.videoSlots?.[defaultSlot];
3581
4748
  if (slot?.url) {
3582
4749
  this.log("Auto-playing default slot:", defaultSlot);
3583
- this.config.onVideoPlay?.(slot.url);
4750
+ this.playUrl(slot.url);
3584
4751
  }
3585
4752
  }
3586
4753
  async createChannel() {
@@ -3643,36 +4810,89 @@ var AdminPanelUIModule = class {
3643
4810
  }
3644
4811
  this.trialClaiming = false;
3645
4812
  }
4813
+ /**
4814
+ * Delete, step one (thestatic.tv 2026-11-13): the delete takes the channel's recordings since that day, and only
4815
+ * once the caller has acknowledged how many. So Delete asks first - a signed GET to the same route, which deletes
4816
+ * nothing - and opens the confirm with what it answered. It posted the delete at once with an empty body, which the
4817
+ * server now refuses for a channel that holds a recording. The look is a GET and never a flag in a delete's body:
4818
+ * a server from before that day answers a GET 405 (said below, nothing deleted), where it would read a body flag as
4819
+ * nothing and delete.
4820
+ */
3646
4821
  async deleteChannel() {
3647
4822
  if (!this.playerWallet || this.channelDeleting || !this.streamData?.hasChannel) return;
3648
4823
  this.channelDeleting = true;
3649
4824
  this.channelDeleteError = "";
4825
+ this.channelDeleteLook = null;
4826
+ this.channelDeleteChanged = false;
3650
4827
  try {
3651
- this.log("Deleting channel for scene...");
4828
+ this.log("Reading what a channel delete would take...");
4829
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`);
4830
+ const data = await res.json().catch(() => ({}));
4831
+ const figures = figuresOf(data);
4832
+ if (res.ok && figures) {
4833
+ this.channelDeleteLook = { figures, unlinkOnly: data.unlinkOnly === true };
4834
+ } else if (res.status === 405) {
4835
+ this.channelDeleteError = "The server cannot show what a delete takes - nothing was deleted";
4836
+ } else if (res.ok) {
4837
+ this.channelDeleteError = "The server showed no figures - nothing was deleted";
4838
+ } else {
4839
+ this.channelDeleteError = data.error || "Could not read the channel - nothing was deleted";
4840
+ this.log("Channel delete look refused:", data.error);
4841
+ }
4842
+ } catch (err) {
4843
+ this.channelDeleteError = "Network error - nothing was deleted";
4844
+ this.log("Channel delete look error:", err);
4845
+ }
4846
+ this.channelDeleting = false;
4847
+ }
4848
+ /**
4849
+ * Delete, step two: the delete, with the figures the confirm showed sent back as `acknowledge`. A count that moved
4850
+ * since the look (the server's 409 with the figures as they are now) re-opens the confirm with them, marked changed -
4851
+ * never sent on. Anything else refused is said, the confirm closed.
4852
+ */
4853
+ async confirmDeleteChannel() {
4854
+ const look = this.channelDeleteLook;
4855
+ if (!this.playerWallet || this.channelDeleting || !look) return;
4856
+ this.channelDeleting = true;
4857
+ this.channelDeleteError = "";
4858
+ try {
4859
+ this.log("Deleting channel for scene...", look.figures);
3652
4860
  const res = await this.signedRequest(
3653
4861
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
3654
4862
  {
3655
4863
  method: "POST",
3656
4864
  headers: { "Content-Type": "application/json" },
3657
- body: JSON.stringify({})
4865
+ body: JSON.stringify({ acknowledge: look.figures })
3658
4866
  }
3659
4867
  );
3660
- const data = await res.json();
4868
+ const data = await res.json().catch(() => ({}));
4869
+ const moved = res.status === 409 && data.confirmRequired === true ? figuresOf(data) : null;
3661
4870
  if (res.ok) {
3662
4871
  this.log("Channel deleted:", data);
4872
+ this.channelDeleteLook = null;
3663
4873
  this.streamData = null;
3664
4874
  this.streamFetched = false;
3665
- this.config.onBroadcast?.("Channel deleted successfully");
4875
+ const gone = typeof data.recordingsDeleted === "number" && data.recordingsDeleted > 0 ? ` with ${data.recordingsDeleted} recording${data.recordingsDeleted === 1 ? "" : "s"}` : "";
4876
+ this.config.onBroadcast?.(`Channel deleted${gone}`);
4877
+ } else if (moved) {
4878
+ this.channelDeleteLook = { figures: moved, unlinkOnly: false };
4879
+ this.channelDeleteChanged = true;
3666
4880
  } else {
4881
+ this.channelDeleteLook = null;
3667
4882
  this.channelDeleteError = data.error || "Failed to delete channel";
3668
4883
  this.log("Channel deletion failed:", data.error);
3669
4884
  }
3670
4885
  } catch (err) {
4886
+ this.channelDeleteLook = null;
3671
4887
  this.channelDeleteError = "Network error deleting channel";
3672
4888
  this.log("Channel deletion error:", err);
3673
4889
  }
3674
4890
  this.channelDeleting = false;
3675
4891
  }
4892
+ cancelDeleteChannel() {
4893
+ this.channelDeleteLook = null;
4894
+ this.channelDeleteChanged = false;
4895
+ }
3676
4896
  async startStream() {
3677
4897
  if (!this.playerWallet || this.streamControlling || !this.streamData?.hasChannel || this.streamData.isLive) return;
3678
4898
  if ((this.streamData.sparksBalance || 0) <= 0) {
@@ -3879,6 +5099,7 @@ var AdminPanelUIModule = class {
3879
5099
  this.modStatus = "saved";
3880
5100
  this.log("Banned wallet:", normalized);
3881
5101
  this.config.onCommand?.("kickBanned", { wallet: normalized });
5102
+ await this.sendSceneCommand("kickBanned", { wallet: normalized }, this.kickLine("Banned and kicked"));
3882
5103
  } else {
3883
5104
  this.modStatus = "error";
3884
5105
  }
@@ -3913,15 +5134,142 @@ var AdminPanelUIModule = class {
3913
5134
  this.log("Unban error:", err);
3914
5135
  }
3915
5136
  }
3916
- banKickPlayer() {
3917
- (0, import_RestrictedActions3.movePlayerTo)({ newRelativePosition: BAN_KICK_POSITION });
3918
- this.log("Player ban-kicked");
5137
+ /**
5138
+ * Queue a command on thestatic.tv for every visitor's copy of the scene (2026-11-17): a signed POST to the scene's
5139
+ * commands route, which takes it from the scene's owner, an admin or an authorized user at the scene's registered
5140
+ * location, and which every copy's poll reads within its 30-second window. The one sender for the kicks, the scene
5141
+ * controls and, since 2026-11-18, the Video and Broadcast buttons; each shows what it came to on its section's own
5142
+ * line. The command id the server answers goes into the seen set, so this copy's poll does not run its own press a
5143
+ * second time. Returns that id (empty when the answer carries none), or null when the command was not sent.
5144
+ */
5145
+ async sendSceneCommand(type, payload, line) {
5146
+ const data = await this.sendSigned("commands", { type, payload }, line);
5147
+ if (data === null) return null;
5148
+ const id = typeof data.commandId === "string" ? data.commandId : "";
5149
+ if (id !== "") this.markCommandSeen(id);
5150
+ return id;
5151
+ }
5152
+ /**
5153
+ * The one signed sender's POST (2026-11-18; since 2026-11-19 private mode's switch goes through it too, to its own
5154
+ * route): signed as the presser to one of the scene's routes on thestatic.tv, which decides whether the presser may;
5155
+ * what it came to shown on the section's line in a control's four words. Returns the answer, or null when not sent.
5156
+ */
5157
+ async sendSigned(route, body, line) {
5158
+ try {
5159
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/${route}`, {
5160
+ method: "POST",
5161
+ headers: { "Content-Type": "application/json" },
5162
+ body: JSON.stringify(body)
5163
+ });
5164
+ const parsed = await res.json().catch(() => ({}));
5165
+ const data = parsed && typeof parsed === "object" ? parsed : {};
5166
+ if (res.ok) {
5167
+ line.show(line.sent);
5168
+ return data;
5169
+ }
5170
+ line.show(res.status === 401 || res.status === 403 ? `${line.notSent}: no access` : `${line.notSent}: HTTP ${res.status}`);
5171
+ this.log("Refused:", route, body.type ?? "", res.status, data.error);
5172
+ } catch (err) {
5173
+ line.show(`${line.notSent}: network error`);
5174
+ this.log("Send error:", route, err);
5175
+ }
5176
+ return null;
5177
+ }
5178
+ /**
5179
+ * PRIVATE MODE ON / OFF (2026-11-19, Venue; thestatic-hq docs/MERGE-CONTRACT-2026-11-19.md section 2): `{ on }` to
5180
+ * the scene's private route through the one signed sender. thestatic.tv decides who may switch it (its scene access
5181
+ * check) and queues `privateMode` for every copy, this one included, which re-reads its standing on it. The state
5182
+ * shown follows the server's answer, never the press.
5183
+ */
5184
+ async setPrivateMode(on) {
5185
+ if (!this.venue) return;
5186
+ const data = await this.sendSigned("private", { on }, this.privateLine);
5187
+ if (typeof data?.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
3919
5188
  }
5189
+ /** KICK ALL: every visitor who cannot moderate the scene is moved out and kept out for a while (2026-11-17) */
5190
+ async kickAll() {
5191
+ this.log("KICK ALL clicked");
5192
+ this.config.onCommand?.("kickAll", {});
5193
+ await this.sendSceneCommand("kickAll", {}, this.kickLine("KICK ALL sent"));
5194
+ }
5195
+ /**
5196
+ * BROADCAST (2026-11-18): queued for every visitor, as the scene's page on thestatic.tv sends it - `from` the presser's
5197
+ * display name, ADMIN when the explorer has none (the page's own default) - and shown here at once as everyone sees
5198
+ * it, `from: text`. Until then the in-world Send reached the presser's copy alone.
5199
+ */
3920
5200
  sendBroadcast() {
3921
- if (!this.broadcastText.trim()) return;
3922
- this.config.onBroadcast?.(this.broadcastText.trim());
5201
+ const text = this.broadcastText.trim();
5202
+ if (!text) return;
5203
+ const from = this.myName();
5204
+ this.config.onBroadcast?.(`${from}: ${text}`);
3923
5205
  this.broadcastText = "";
3924
5206
  this.log("Broadcast sent");
5207
+ this.sendSceneCommand("broadcast", { text, from }, this.broadcastLine).catch(() => {
5208
+ });
5209
+ }
5210
+ /** The presser's display name for a broadcast's from, ADMIN when the explorer has none; within the route's 100 */
5211
+ myName() {
5212
+ try {
5213
+ const name = (0, import_players2.getPlayer)()?.name;
5214
+ if (typeof name === "string" && name.trim() !== "") return name.trim().slice(0, 100);
5215
+ } catch {
5216
+ }
5217
+ return "ADMIN";
5218
+ }
5219
+ // --- The Video tab's buttons (2026-11-18): each does here at once what it did, then queues the same for everyone ---
5220
+ /** PLAY NOW: the typed url plays here and is queued as videoSetUrl, which thestatic.tv keeps for later arrivals */
5221
+ playNow() {
5222
+ const url = this.customVideoUrl.trim();
5223
+ if (!url) return;
5224
+ this.playUrl(url);
5225
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5226
+ });
5227
+ }
5228
+ /** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
5229
+ playStreamOnScreen(url) {
5230
+ this.playUrl(url);
5231
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5232
+ });
5233
+ }
5234
+ /** 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 */
5235
+ pressSlot(slotId) {
5236
+ this.playSlot(slotId);
5237
+ this.sendSceneCommand("videoPlaySlot", { slot: slotId }, this.videoLine).catch(() => {
5238
+ });
5239
+ }
5240
+ /**
5241
+ * PLAYBACK Play: the current video - the one the screen last played here, or the scene's current url from the video
5242
+ * state at load - plays again here and is queued as videoPlay with its url; with none known nothing is sent and the
5243
+ * line says so. onCommand gets ('videoPlay', { playing: true }) as it did before, for a scene that reads it.
5244
+ */
5245
+ playbackPlay() {
5246
+ this.config.onCommand?.("videoPlay", { playing: true });
5247
+ const url = this.currentVideoUrl;
5248
+ if (!url) {
5249
+ this.videoStatus = "Not sent: no video";
5250
+ return;
5251
+ }
5252
+ this.playUrl(url);
5253
+ this.sendSceneCommand("videoPlay", { url }, this.videoLine).catch(() => {
5254
+ });
5255
+ }
5256
+ /** Stop: the screen stops here and videoStop is queued for everyone */
5257
+ playbackStop() {
5258
+ this.config.onVideoStop?.();
5259
+ this.sendSceneCommand("videoStop", {}, this.videoLine).catch(() => {
5260
+ });
5261
+ }
5262
+ /**
5263
+ * Reset Default: the screen goes back to its default here - what every copy does on a queued videoClear - and
5264
+ * videoClear is queued, which also clears the scene's kept url on thestatic.tv. onCommand gets ('videoClear', {}) as
5265
+ * it did before.
5266
+ */
5267
+ resetDefault() {
5268
+ this.config.onCommand?.("videoClear", {});
5269
+ this.currentVideoUrl = null;
5270
+ this.config.onVideoStop?.();
5271
+ this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
5272
+ });
3925
5273
  }
3926
5274
  setActiveTab(tab) {
3927
5275
  const previousTab = this.activeTab;
@@ -3935,6 +5283,22 @@ var AdminPanelUIModule = class {
3935
5283
  this.stopStreamPolling();
3936
5284
  }
3937
5285
  }
5286
+ /** A control's button (2026-11-18): the option's label, highlighted while that option is current on this copy */
5287
+ controlButton(control, option, label) {
5288
+ const current = this.currentOption[control.id] === option;
5289
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
5290
+ import_react_ecs6.Button,
5291
+ {
5292
+ key: `control-${control.id}-${option}`,
5293
+ uiTransform: { minWidth: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4, padding: { left: 10, right: 10 } },
5294
+ uiBackground: { color: current ? C2.cyan : C2.btn },
5295
+ value: label,
5296
+ fontSize: this.theme.buttonSmall,
5297
+ color: current ? import_math7.Color4.Black() : C2.text,
5298
+ onMouseDown: () => this.pressControl(control, option)
5299
+ }
5300
+ );
5301
+ }
3938
5302
  /**
3939
5303
  * Render a scaled notification banner
3940
5304
  * Uses same layout as NotificationBanner but with scaled font size
@@ -3945,8 +5309,8 @@ var AdminPanelUIModule = class {
3945
5309
  if (!state.visible) return null;
3946
5310
  const N2 = UI_DIMENSIONS.notification;
3947
5311
  const colors = THEME.colors;
3948
- return /* @__PURE__ */ import_react_ecs5.default.createElement(
3949
- import_react_ecs5.UiEntity,
5312
+ return /* @__PURE__ */ import_react_ecs6.default.createElement(
5313
+ import_react_ecs6.UiEntity,
3950
5314
  {
3951
5315
  uiTransform: {
3952
5316
  positionType: "absolute",
@@ -3956,8 +5320,8 @@ var AdminPanelUIModule = class {
3956
5320
  alignItems: "center"
3957
5321
  }
3958
5322
  },
3959
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3960
- import_react_ecs5.UiEntity,
5323
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5324
+ import_react_ecs6.UiEntity,
3961
5325
  {
3962
5326
  uiTransform: {
3963
5327
  minWidth: this.s(200),
@@ -3969,15 +5333,15 @@ var AdminPanelUIModule = class {
3969
5333
  },
3970
5334
  uiBackground: { color: colors.panel }
3971
5335
  },
3972
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3973
- import_react_ecs5.UiEntity,
5336
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5337
+ import_react_ecs6.UiEntity,
3974
5338
  {
3975
5339
  uiTransform: { width: N2.borderWidth, height: "100%" },
3976
5340
  uiBackground: { color: colors.cyan }
3977
5341
  }
3978
5342
  ),
3979
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3980
- import_react_ecs5.UiEntity,
5343
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5344
+ import_react_ecs6.UiEntity,
3981
5345
  {
3982
5346
  uiTransform: {
3983
5347
  flexGrow: 1,
@@ -3987,8 +5351,8 @@ var AdminPanelUIModule = class {
3987
5351
  alignItems: "center"
3988
5352
  }
3989
5353
  },
3990
- /* @__PURE__ */ import_react_ecs5.default.createElement(
3991
- import_react_ecs5.Label,
5354
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5355
+ import_react_ecs6.Label,
3992
5356
  {
3993
5357
  value: state.text,
3994
5358
  fontSize: this.s(N2.fontSize),
@@ -3997,8 +5361,8 @@ var AdminPanelUIModule = class {
3997
5361
  }
3998
5362
  )
3999
5363
  ),
4000
- /* @__PURE__ */ import_react_ecs5.default.createElement(
4001
- import_react_ecs5.UiEntity,
5364
+ /* @__PURE__ */ import_react_ecs6.default.createElement(
5365
+ import_react_ecs6.UiEntity,
4002
5366
  {
4003
5367
  uiTransform: { width: 5, height: 5, margin: { right: 10 } },
4004
5368
  uiBackground: { color: colors.cyan }
@@ -4010,7 +5374,7 @@ var AdminPanelUIModule = class {
4010
5374
  };
4011
5375
 
4012
5376
  // src/StaticTVClient.ts
4013
- var import_ecs4 = require("@dcl/sdk/ecs");
5377
+ var import_ecs5 = require("@dcl/sdk/ecs");
4014
5378
  var utils = __toESM(require("@dcl-sdk/utils"));
4015
5379
  var DEFAULT_BASE_URL = "https://thestatic.tv/api/v1/dcl";
4016
5380
  var DEFAULT_FALLBACK_VIDEO = "https://media.thestatic.tv/fallback-loop.mp4";
@@ -4052,9 +5416,13 @@ var StaticTVClient = class {
4052
5416
  this._keyId = null;
4053
5417
  this._disabled = false;
4054
5418
  this._tier = "free";
5419
+ /** Venue (2026-11-19): the server's flag beside a Pro tier; the event features need it */
5420
+ this._venue = false;
4055
5421
  this._standardFeaturesEnabled = false;
4056
5422
  this._proFeaturesEnabled = false;
4057
5423
  this._pendingProConfig = null;
5424
+ /** Controls registered before the admin panel exists (the tier not yet confirmed) - handed to it at init (2026-11-18) */
5425
+ this._pendingControls = [];
4058
5426
  this._featuresResolved = false;
4059
5427
  /** Guide module - fetch channel lineup (standard/pro tier) */
4060
5428
  this.guide = null;
@@ -4098,6 +5466,8 @@ var StaticTVClient = class {
4098
5466
  };
4099
5467
  this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
4100
5468
  this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
5469
+ this.frames = new FramesModule(this);
5470
+ if (config.frames) this.frames.register(config.frames);
4101
5471
  if (!config.apiKey) {
4102
5472
  this._disabled = true;
4103
5473
  this._keyType = null;
@@ -4228,7 +5598,7 @@ var StaticTVClient = class {
4228
5598
  * @internal
4229
5599
  */
4230
5600
  async signedRequest(endpoint, init = {}) {
4231
- const response = await (0, import_SignedFetch3.signedFetch)({
5601
+ const response = await (0, import_SignedFetch4.signedFetch)({
4232
5602
  url: `${this.apiUrl}${endpoint}`,
4233
5603
  init: {
4234
5604
  method: init.method || "POST",
@@ -4288,6 +5658,7 @@ var StaticTVClient = class {
4288
5658
  * @param url Video URL to play
4289
5659
  */
4290
5660
  playVideo(url) {
5661
+ if (this.isVisitorBlocked) return;
4291
5662
  const screen = this.config.videoScreen;
4292
5663
  if (screen !== void 0) {
4293
5664
  this.log(`Playing video: ${url}`);
@@ -4322,9 +5693,9 @@ var StaticTVClient = class {
4322
5693
  const fallbackUrl = this.config.fallbackVideoUrl;
4323
5694
  const fallbackDisabled = fallbackUrl === "";
4324
5695
  if (fallbackDisabled) {
4325
- if (import_ecs4.VideoPlayer.has(screen)) {
5696
+ if (import_ecs5.VideoPlayer.has(screen)) {
4326
5697
  this.log("Stopping video (no fallback)");
4327
- import_ecs4.VideoPlayer.getMutable(screen).playing = false;
5698
+ import_ecs5.VideoPlayer.getMutable(screen).playing = false;
4328
5699
  }
4329
5700
  this._currentVideoUrl = "";
4330
5701
  } else {
@@ -4345,16 +5716,17 @@ var StaticTVClient = class {
4345
5716
  _playVideoInternal(url, isFallback = false, isLiveStream = false) {
4346
5717
  const screen = this.config.videoScreen;
4347
5718
  if (screen === void 0) return;
5719
+ if (this.isVisitorBlocked) return;
4348
5720
  this._clearVerificationTimeout();
4349
5721
  this._streamVerified = false;
4350
- if (import_ecs4.VideoPlayer.has(screen)) {
4351
- const player = import_ecs4.VideoPlayer.getMutable(screen);
5722
+ if (import_ecs5.VideoPlayer.has(screen)) {
5723
+ const player = import_ecs5.VideoPlayer.getMutable(screen);
4352
5724
  player.src = url;
4353
5725
  player.playing = true;
4354
5726
  player.loop = isFallback;
4355
5727
  player.volume = 1;
4356
5728
  } else {
4357
- import_ecs4.VideoPlayer.create(screen, {
5729
+ import_ecs5.VideoPlayer.create(screen, {
4358
5730
  src: url,
4359
5731
  playing: true,
4360
5732
  loop: isFallback,
@@ -4376,8 +5748,8 @@ var StaticTVClient = class {
4376
5748
  const screen = this.config.videoScreen;
4377
5749
  if (screen === void 0) return;
4378
5750
  this._videoEventsRegistered = true;
4379
- import_ecs4.videoEventsSystem.registerVideoEventsEntity(screen, (videoEvent) => {
4380
- if (videoEvent.state === import_ecs4.VideoState.VS_PLAYING) {
5751
+ import_ecs5.videoEventsSystem.registerVideoEventsEntity(screen, (videoEvent) => {
5752
+ if (videoEvent.state === import_ecs5.VideoState.VS_PLAYING) {
4381
5753
  const timeSinceStart = Date.now() - this._verificationStartTime;
4382
5754
  const MIN_VERIFICATION_DELAY = 2e3;
4383
5755
  if (this._pendingVideoData && !this._streamVerified && timeSinceStart >= MIN_VERIFICATION_DELAY) {
@@ -4386,7 +5758,7 @@ var StaticTVClient = class {
4386
5758
  this.log(`Stream verified: ${this._pendingVideoData.name} (after ${timeSinceStart}ms)`);
4387
5759
  }
4388
5760
  }
4389
- if (videoEvent.state === import_ecs4.VideoState.VS_ERROR) {
5761
+ if (videoEvent.state === import_ecs5.VideoState.VS_ERROR) {
4390
5762
  if (this._pendingVideoData) {
4391
5763
  this.log(`Stream error for: ${this._pendingVideoData.name}`);
4392
5764
  this._handleStreamOffline();
@@ -4468,6 +5840,7 @@ var StaticTVClient = class {
4468
5840
  */
4469
5841
  _handleGuideVideoSelect(video) {
4470
5842
  if (!video.src) return;
5843
+ if (this.isVisitorBlocked) return;
4471
5844
  this._pendingVideoData = video;
4472
5845
  const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
4473
5846
  this._playVideoWithVerification(video, isLiveStream);
@@ -4544,6 +5917,74 @@ var StaticTVClient = class {
4544
5917
  this.log(`Stream confirmed playing: ${this._pendingVideoData.name}`);
4545
5918
  }
4546
5919
  }
5920
+ /**
5921
+ * True while this visitor is banned from the scene or kicked out of it (Pro tier, 2026-11-17), or kept out by its
5922
+ * private mode (Venue, 2026-11-19): the SDK keeps them out of the scene's parcels, shows them only the notice and
5923
+ * plays them no video. A scene with its own media (a radio, its own screen) checks this, or passes
5924
+ * `onBlockedChange`, and stops it.
5925
+ */
5926
+ get isVisitorBlocked() {
5927
+ return this.adminPanel?.isVisitorBlocked ?? false;
5928
+ }
5929
+ /**
5930
+ * This visitor's standing: 'banned', 'kicked', 'private' (2026-11-19) or 'clear', in that precedence (always 'clear'
5931
+ * without the Pro tier's admin panel)
5932
+ */
5933
+ get visitorStanding() {
5934
+ return this.adminPanel?.moderation.standing ?? "clear";
5935
+ }
5936
+ /**
5937
+ * True when the last standing read said this visitor is a TheStatic.tv citizen - their wallet linked to an account
5938
+ * (2026-11-19). False before a read, from a server that does not answer it, and without the Pro tier's admin panel.
5939
+ * For a fresh answer, `checkCitizen()`.
5940
+ */
5941
+ get visitorIsCitizen() {
5942
+ return this.adminPanel?.moderation.isCitizen ?? false;
5943
+ }
5944
+ /**
5945
+ * Whether this visitor is a TheStatic.tv citizen, fresh (2026-11-19): a read of the scene's admin-check through the
5946
+ * moderation module - the last answer when it is under 5 s old, else the next read, gated as every standing read
5947
+ * is. False without the Pro tier's admin panel, and when no read has answered. A scene's citizens-only door asks
5948
+ * this instead of calling a route of its own; thestatic.tv answers it from the signed request, so a scene cannot
5949
+ * claim a citizen.
5950
+ */
5951
+ async checkCitizen() {
5952
+ if (!this.adminPanel) return false;
5953
+ try {
5954
+ return await this.adminPanel.moderation.checkCitizen();
5955
+ } catch {
5956
+ return false;
5957
+ }
5958
+ }
5959
+ /**
5960
+ * The admin panel's moderation reports blocked on or off (2026-11-17): the panels close, the SDK's own video
5961
+ * stops (and its fallback loop comes back once clear), the watch heartbeat stops, and the scene hears of it.
5962
+ * @internal
5963
+ */
5964
+ _onBlockedChange(blocked, standing) {
5965
+ const screen = this.config.videoScreen;
5966
+ if (blocked) {
5967
+ this.guideUI?.hide();
5968
+ this.chatUI?.hide();
5969
+ this.heartbeat?.stopWatching();
5970
+ this._pendingVideoData = null;
5971
+ this._clearVerificationTimeout();
5972
+ if (screen !== void 0 && import_ecs5.VideoPlayer.has(screen)) {
5973
+ import_ecs5.VideoPlayer.getMutable(screen).playing = false;
5974
+ }
5975
+ this._currentVideoUrl = "";
5976
+ } else if (screen !== void 0) {
5977
+ const fallbackUrl = this.config.fallbackVideoUrl !== void 0 ? this.config.fallbackVideoUrl : DEFAULT_FALLBACK_VIDEO;
5978
+ if (fallbackUrl !== "") this._playVideoInternal(fallbackUrl, true);
5979
+ }
5980
+ if (this.config.onBlockedChange) {
5981
+ try {
5982
+ this.config.onBlockedChange(blocked, standing);
5983
+ } catch (err) {
5984
+ this.error("onBlockedChange failed", err);
5985
+ }
5986
+ }
5987
+ }
4547
5988
  /**
4548
5989
  * Internal handler for broadcast messages
4549
5990
  * @internal
@@ -4602,8 +6043,15 @@ var StaticTVClient = class {
4602
6043
  onBroadcast: (text) => this._handleBroadcast(text),
4603
6044
  onCommand: this.config.onCommand || this._pendingProConfig?.onCommand,
4604
6045
  // Merge other settings from enableProFeatures if provided
4605
- ...this._pendingProConfig
6046
+ ...this._pendingProConfig,
6047
+ // The scene's controls (2026-11-18): the constructor's, enableProFeatures()'s, and any registered before now
6048
+ controls: [
6049
+ ...this.config.controls || [],
6050
+ ...this._pendingProConfig?.controls || [],
6051
+ ...this._pendingControls
6052
+ ]
4606
6053
  };
6054
+ this._pendingControls = [];
4607
6055
  this.adminPanel = new AdminPanelUIModule(this, adminConfig);
4608
6056
  this._proFeaturesEnabled = true;
4609
6057
  this.adminPanel.init().catch((err) => {
@@ -4647,8 +6095,9 @@ var StaticTVClient = class {
4647
6095
  getSceneId() {
4648
6096
  return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4649
6097
  }
4650
- _enableFeaturesForTier(tier, keyId) {
6098
+ _enableFeaturesForTier(tier, keyId, venue = false) {
4651
6099
  this._tier = tier;
6100
+ this._venue = tier === "pro" && venue === true;
4652
6101
  if (keyId) {
4653
6102
  this._keyId = keyId;
4654
6103
  }
@@ -4663,6 +6112,7 @@ var StaticTVClient = class {
4663
6112
  this.log("Pro tier detected but no video config - call enableProFeatures() or set videoScreen to enable admin panel");
4664
6113
  }
4665
6114
  }
6115
+ if (this._venue) this.frames.enable();
4666
6116
  this._resolveFeaturesReady(tier);
4667
6117
  }
4668
6118
  /**
@@ -4690,6 +6140,13 @@ var StaticTVClient = class {
4690
6140
  get hasProFeatures() {
4691
6141
  return this._proFeaturesEnabled;
4692
6142
  }
6143
+ /**
6144
+ * True when the server confirmed the Venue tier (2026-11-19): Pro plus the event features - scene
6145
+ * controls, frames, private mode. `tier` stays 'pro' for a Venue scene, so a scene's own Pro checks hold.
6146
+ */
6147
+ get hasVenueFeatures() {
6148
+ return this._venue;
6149
+ }
4693
6150
  /**
4694
6151
  * @deprecated Use `tier` instead
4695
6152
  */
@@ -4759,6 +6216,57 @@ var StaticTVClient = class {
4759
6216
  }
4760
6217
  this.adminPanel.registerSceneTab(tab);
4761
6218
  }
6219
+ /**
6220
+ * Register scene controls for the Admin Panel's CONTROLS tab and the scene's page on thestatic.tv (2026-11-18;
6221
+ * the Venue tier since 2026-11-19, Pro until then) - the same as passing `controls` in the config. Before the panel
6222
+ * exists (the tier not yet confirmed) they are kept and handed to it at init; after, they join the tab at once. On a
6223
+ * Pro scene without Venue they are kept and never drawn, uploaded or run. See `SceneControl`.
6224
+ *
6225
+ * @example
6226
+ * ```typescript
6227
+ * staticTV.registerControls([{
6228
+ * id: 'digifog', label: 'DigiFog', off: true, persist: true,
6229
+ * options: [{ id: 'stars', label: 'Stars' }, { id: 'pulse', label: 'Pulse' }],
6230
+ * onChange: (option) => fog.play(option)
6231
+ * }])
6232
+ * ```
6233
+ */
6234
+ registerControls(controls) {
6235
+ if (!this.adminPanel) {
6236
+ this._pendingControls.push(...controls);
6237
+ this.log(`Scene controls registered (${controls.length}) - the admin panel takes them when the Pro tier is confirmed`);
6238
+ return;
6239
+ }
6240
+ this.adminPanel.registerControls(controls);
6241
+ }
6242
+ /**
6243
+ * Register picture frames (Venue tier, 2026-11-19) - the same as passing `frames` in the config. Kept whatever the
6244
+ * tier (without Venue `openFrame` still opens a default's link); once Venue is known, a frame registered now gets the
6245
+ * content the last read gave at once. A frame registered again by id
6246
+ * replaces the earlier one; at most 64. Only the shape is checked here - thestatic.tv checks the ids, labels and URLs
6247
+ * when the declaration is uploaded. See `SceneFrame`.
6248
+ *
6249
+ * @example
6250
+ * ```typescript
6251
+ * staticTV.registerFrames([{
6252
+ * id: 'f00', label: 'Ground floor, west wall',
6253
+ * default: { image: 'https://example.com/poster.png' },
6254
+ * onContent: (c) => showPicture(frameEntity, c.image, c.text)
6255
+ * }])
6256
+ * ```
6257
+ */
6258
+ registerFrames(frames) {
6259
+ this.frames.register(frames);
6260
+ }
6261
+ /**
6262
+ * A visitor clicked a frame (2026-11-19): the link opens when it is an https: one - the content's, else the frame's
6263
+ * default's, so a frame works before Venue is on - and, with Venue, the click is counted on thestatic.tv under the
6264
+ * picture the frame shows (signed, fire and forget). Call it from the frame's own pointer handler. Nothing happens
6265
+ * for an id the scene did not declare.
6266
+ */
6267
+ openFrame(id) {
6268
+ this.frames.open(id);
6269
+ }
4762
6270
  /**
4763
6271
  * Close Admin/Guide panels (they share the same screen space)
4764
6272
  * Chat is independent and stays open.
@@ -4831,16 +6339,19 @@ var StaticTVClient = class {
4831
6339
  0 && (module.exports = {
4832
6340
  AdminPanelUIModule,
4833
6341
  ChatUIModule,
6342
+ FramesModule,
4834
6343
  GuideModule,
4835
6344
  GuideUIModule,
4836
6345
  HeartbeatModule,
4837
6346
  InteractionsModule,
4838
6347
  KEY_TYPE_CHANNEL,
4839
6348
  KEY_TYPE_SCENE,
6349
+ ModerationModule,
4840
6350
  NotificationBanner,
4841
6351
  SessionModule,
4842
6352
  StaticTVClient,
4843
6353
  fetchUserData,
6354
+ getParcelRects,
4844
6355
  getPlayerDisplayName,
4845
6356
  getPlayerPosition,
4846
6357
  getPlayerWallet,