@thestatic-tv/dcl-sdk 2.9.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ async function request(url, options = {}) {
17
17
  }
18
18
 
19
19
  // src/StaticTVClient.ts
20
- import { signedFetch as signedFetch3 } from "~system/SignedFetch";
20
+ import { signedFetch as signedFetch4 } from "~system/SignedFetch";
21
21
 
22
22
  // src/modules/guide.ts
23
23
  var GuideModule = class {
@@ -209,9 +209,104 @@ function dclClearTimeout(timeoutId) {
209
209
  // src/utils/bounds.ts
210
210
  import { engine as engine2, Transform } from "@dcl/sdk/ecs";
211
211
  import { getSceneInformation } from "~system/Runtime";
212
+
213
+ // src/utils/walls.ts
212
214
  var PARCEL_SIZE = 16;
215
+ var EDGE_STRIP = 1;
216
+ var WALL_TOP_MAX = 32;
217
+ var GROUND_REACH = 3;
218
+ function heightLimit(parcels) {
219
+ return Math.log2(parcels + 1) * 20;
220
+ }
221
+ function wallTop(parcels) {
222
+ return Math.min(WALL_TOP_MAX, heightLimit(parcels) - 4);
223
+ }
224
+ function parcelRects(parcels, base) {
225
+ const parse = (p) => {
226
+ const parts = String(p).split(",");
227
+ if (parts.length !== 2) return null;
228
+ const [x, z] = parts.map((n) => parseInt(n, 10));
229
+ return Number.isFinite(x) && Number.isFinite(z) ? { x, z } : null;
230
+ };
231
+ const coords = parcels.map(parse).filter((c) => c !== null);
232
+ const origin = base && parse(base) || coords[0];
233
+ if (!origin) return [];
234
+ return coords.map((c) => {
235
+ const minX = (c.x - origin.x) * PARCEL_SIZE;
236
+ const minZ = (c.z - origin.z) * PARCEL_SIZE;
237
+ return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
238
+ });
239
+ }
240
+ function outerSides(rect, rects) {
241
+ const at = (minX, minZ) => rects.some((r) => r.minX === minX && r.minZ === minZ);
242
+ const sides = [];
243
+ if (!at(rect.minX - PARCEL_SIZE, rect.minZ)) sides.push("west");
244
+ if (!at(rect.minX + PARCEL_SIZE, rect.minZ)) sides.push("east");
245
+ if (!at(rect.minX, rect.minZ - PARCEL_SIZE)) sides.push("south");
246
+ if (!at(rect.minX, rect.minZ + PARCEL_SIZE)) sides.push("north");
247
+ return sides;
248
+ }
249
+ function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
250
+ return rects.map((r) => {
251
+ const outer = outerSides(r, rects);
252
+ return {
253
+ minX: r.minX + (outer.includes("west") ? strip : 0),
254
+ maxX: r.maxX - (outer.includes("east") ? strip : 0),
255
+ minZ: r.minZ + (outer.includes("south") ? strip : 0),
256
+ maxZ: r.maxZ - (outer.includes("north") ? strip : 0),
257
+ top
258
+ };
259
+ });
260
+ }
261
+ function inParcels(p, rects) {
262
+ return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
263
+ }
264
+ function spawnPointOf(metadata) {
265
+ const points = metadata?.spawnPoints;
266
+ if (!Array.isArray(points) || points.length === 0) return null;
267
+ const chosen = points.find((s) => s && s.default === true) || points[0];
268
+ const position = chosen?.position;
269
+ const coordinate = (v) => {
270
+ const values = (Array.isArray(v) ? v : [v]).filter((n) => typeof n === "number" && Number.isFinite(n));
271
+ return values.length === 0 ? null : (Math.min(...values) + Math.max(...values)) / 2;
272
+ };
273
+ const x = coordinate(position?.x);
274
+ const y = coordinate(position?.y);
275
+ const z = coordinate(position?.z);
276
+ return x === null || y === null || z === null ? null : { x, y, z };
277
+ }
278
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
279
+ function entryPoint(boxes, rects, spawn, from) {
280
+ const IN = 0.5;
281
+ const target = spawn || from || { x: 0, y: 0, z: 0 };
282
+ const y = spawn ? Math.max(0, spawn.y) : 0;
283
+ let best = null;
284
+ let bestDistance = Infinity;
285
+ rects.forEach((rect, i) => {
286
+ const b = boxes[i];
287
+ if (!b) return;
288
+ const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
289
+ for (const side of outerSides(rect, rects)) {
290
+ const point = side === "west" ? { x: (rect.minX + b.minX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "east" ? { x: (rect.maxX + b.maxX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "south" ? { x: along(b.minX, b.maxX, target.x), z: (rect.minZ + b.minZ) / 2 } : { x: along(b.minX, b.maxX, target.x), z: (rect.maxZ + b.maxZ) / 2 };
291
+ const distance = Math.hypot(point.x - target.x, point.z - target.z);
292
+ if (distance < bestDistance) {
293
+ bestDistance = distance;
294
+ best = { x: point.x, y, z: point.z };
295
+ }
296
+ }
297
+ });
298
+ return best;
299
+ }
300
+ function mustMoveToEntry(p, boxes, rects, entryY) {
301
+ if (!inParcels(p, rects)) return false;
302
+ const overWall = boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ);
303
+ return overWall || p.y > entryY + GROUND_REACH;
304
+ }
305
+
306
+ // src/utils/bounds.ts
213
307
  var cachedBounds = null;
214
308
  var cachedParcelRects = [];
309
+ var cachedSpawn = null;
215
310
  var boundsInitialized = false;
216
311
  var boundsError = false;
217
312
  function parseParcel(parcel) {
@@ -237,6 +332,7 @@ async function getSceneBounds() {
237
332
  const metadata = JSON.parse(sceneInfo.metadataJson);
238
333
  parcels = metadata?.scene?.parcels || [];
239
334
  baseParcel = metadata?.scene?.base;
335
+ cachedSpawn = spawnPointOf(metadata);
240
336
  }
241
337
  if (parcels.length === 0) {
242
338
  boundsError = true;
@@ -252,11 +348,7 @@ async function getSceneBounds() {
252
348
  boundsError = true;
253
349
  return null;
254
350
  }
255
- cachedParcelRects = coords.map((c) => {
256
- const minX = (c.x - base.x) * PARCEL_SIZE;
257
- const minZ = (c.z - base.z) * PARCEL_SIZE;
258
- return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
259
- });
351
+ cachedParcelRects = parcelRects(parcels, baseParcel);
260
352
  const worldMinX = Math.min(...coords.map((c) => c.x));
261
353
  const worldMaxX = Math.max(...coords.map((c) => c.x));
262
354
  const worldMinZ = Math.min(...coords.map((c) => c.z));
@@ -292,6 +384,12 @@ function isPlayerInBounds(_bounds) {
292
384
  return false;
293
385
  }
294
386
  }
387
+ function getParcelRects() {
388
+ return cachedParcelRects.map((r) => ({ ...r }));
389
+ }
390
+ function getSpawnPoint() {
391
+ return cachedSpawn ? { ...cachedSpawn } : null;
392
+ }
295
393
  function getPlayerPosition() {
296
394
  try {
297
395
  const transform = Transform.getOrNull(engine2.PlayerEntity);
@@ -434,7 +532,7 @@ var SessionModule = class {
434
532
  this._tier = normalizeTier(response.sdkType);
435
533
  this.startHeartbeat();
436
534
  this.client.log(`Session started: ${this.sessionId}, tier: ${this._tier}`);
437
- this.client._enableFeaturesForTier(this._tier, this._keyId);
535
+ this.client._enableFeaturesForTier(this._tier, this._keyId, this._tier === "pro" && response.venue === true);
438
536
  return this.sessionId;
439
537
  }
440
538
  this.client._settleFeaturesAsFree();
@@ -693,10 +791,280 @@ var InteractionsModule = class {
693
791
  }
694
792
  };
695
793
 
794
+ // src/modules/frames.ts
795
+ import { signedFetch } from "~system/SignedFetch";
796
+ import { openExternalUrl } from "~system/RestrictedActions";
797
+ var FRAMES_MAX = 64;
798
+ var REFRESH_JITTER_MS = 3e3;
799
+ var DEFAULT_VERSION = "default";
800
+ var IMAGE_MAX = 1e3;
801
+ var TEXT_MAX = 120;
802
+ var LINK_MAX = 1e3;
803
+ var VERSION_MAX = 40;
804
+ var HTTPS = /^https:/i;
805
+ function isSceneFrame(value) {
806
+ if (!value || typeof value !== "object") return false;
807
+ const f = value;
808
+ if (typeof f.id !== "string" || typeof f.label !== "string" || typeof f.onContent !== "function") return false;
809
+ const d = f.default;
810
+ if (d === void 0 || d === null) return true;
811
+ if (typeof d !== "object") return false;
812
+ const { image, text, link } = d;
813
+ return typeof image === "string" && (text === void 0 || typeof text === "string") && (link === void 0 || typeof link === "string");
814
+ }
815
+ function defaultContent(frame) {
816
+ const d = frame.default;
817
+ if (!d) return null;
818
+ return { image: d.image, text: d.text || "", link: d.link || "", version: DEFAULT_VERSION };
819
+ }
820
+ function savedContent(value) {
821
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
822
+ const v = value;
823
+ const image = v.image;
824
+ const text = v.text === void 0 || v.text === null ? "" : v.text;
825
+ const link = v.link === void 0 || v.link === null ? "" : v.link;
826
+ const version = v.version;
827
+ if (typeof image !== "string" || image.length > IMAGE_MAX || !HTTPS.test(image)) return null;
828
+ if (typeof text !== "string" || text.length > TEXT_MAX) return null;
829
+ if (typeof link !== "string" || link.length > LINK_MAX || link !== "" && !HTTPS.test(link)) return null;
830
+ if (typeof version !== "string" || version === "" || version.length > VERSION_MAX) return null;
831
+ return { image, text, link, version };
832
+ }
833
+ function sameContent(a, b) {
834
+ return b !== null && a.image === b.image && a.text === b.text && a.link === b.link && a.version === b.version;
835
+ }
836
+ function errorOf(body) {
837
+ try {
838
+ const data = body ? JSON.parse(body) : null;
839
+ return data && typeof data.error === "string" ? data.error : "";
840
+ } catch {
841
+ return "";
842
+ }
843
+ }
844
+ var FramesModule = class {
845
+ constructor(host) {
846
+ this.entries = /* @__PURE__ */ new Map();
847
+ /** Venue is known: the reads, the upload and the clicks may go */
848
+ this.enabled = false;
849
+ /** This copy's admin check succeeded: the declaration may be uploaded */
850
+ this.adminOk = false;
851
+ this.uploaded = false;
852
+ this.loadReadStarted = false;
853
+ /** The last good read's `frames` object (saved content by frame id), or null until a read succeeds */
854
+ this.answer = null;
855
+ /** Reads are numbered as they start; an answer older than the one shown is dropped */
856
+ this.readSeq = 0;
857
+ this.shownSeq = 0;
858
+ /** A framesRefresh is waiting out its jitter: another inside the wait shares its read */
859
+ this.refreshWaiting = false;
860
+ this.host = host;
861
+ }
862
+ /** The declared frames' ids, in the order they were first registered */
863
+ get ids() {
864
+ return [...this.entries.keys()];
865
+ }
866
+ /** True once Venue is known for this scene */
867
+ get isEnabled() {
868
+ return this.enabled;
869
+ }
870
+ /**
871
+ * Declare frames: kept until Venue is known; after, a frame registered now gets what the last read gave at once,
872
+ * and the load read and the upload that waited on frames go now (each still once a load)
873
+ */
874
+ register(frames) {
875
+ if (!Array.isArray(frames)) {
876
+ this.host.log("registerFrames skipped - not a list of frames");
877
+ return;
878
+ }
879
+ for (const frame of frames) {
880
+ if (!isSceneFrame(frame)) {
881
+ this.host.log("Frame skipped - not a SceneFrame:", frame);
882
+ continue;
883
+ }
884
+ if (!this.entries.has(frame.id) && this.entries.size >= FRAMES_MAX) {
885
+ this.host.warn(`Frame ${frame.id} skipped - at most ${FRAMES_MAX} frames a scene`);
886
+ continue;
887
+ }
888
+ this.entries.set(frame.id, { frame, shown: null });
889
+ }
890
+ this.host.log("Registered frames:", this.ids);
891
+ if (!this.enabled) return;
892
+ this.apply();
893
+ this.loadRead();
894
+ this.upload().catch(() => {
895
+ });
896
+ }
897
+ /** Venue is known (the client calls this once the session confirms it): the load read, and the upload if it waited */
898
+ enable() {
899
+ if (this.enabled) return;
900
+ this.enabled = true;
901
+ this.loadRead();
902
+ this.upload().catch(() => {
903
+ });
904
+ }
905
+ /** This copy's admin check succeeded (the admin panel calls this): the declaration goes up once Venue is known */
906
+ adminCheckSucceeded() {
907
+ this.adminOk = true;
908
+ this.upload().catch(() => {
909
+ });
910
+ }
911
+ /**
912
+ * A queued framesRefresh (the scene's page saved or reset a frame): read again after a random wait of up to
913
+ * REFRESH_JITTER_MS. Refreshes that arrive inside the wait share its read.
914
+ */
915
+ refresh() {
916
+ if (!this.enabled || this.entries.size === 0 || this.refreshWaiting) return;
917
+ this.refreshWaiting = true;
918
+ const wait = Math.floor(Math.random() * REFRESH_JITTER_MS);
919
+ this.host.log(`Frames refresh in ${wait} ms`);
920
+ dclSetTimeout(() => {
921
+ this.refreshWaiting = false;
922
+ this.loadReadStarted = true;
923
+ this.read().catch(() => {
924
+ });
925
+ }, wait);
926
+ }
927
+ /**
928
+ * A visitor clicked a frame. The link opens when it is an https: one: the shown content's, else the frame's default's
929
+ * - so a scene without Venue (or before its read lands), which shows its own defaults, has no dead frames. The click is
930
+ * posted signed under the shown version (fire and forget; a failure is logged, never shown) only with Venue and
931
+ * something shown. An id not declared opens nothing and posts nothing.
932
+ */
933
+ open(id) {
934
+ const entry = typeof id === "string" ? this.entries.get(id) : void 0;
935
+ if (!entry) {
936
+ this.host.log("openFrame: no frame declared with this id:", id);
937
+ return;
938
+ }
939
+ const shown = entry.shown;
940
+ if (this.enabled && shown) this.postClick(entry.frame.id, shown.version).catch(() => {
941
+ });
942
+ else this.host.log("openFrame: no click counted - no Venue, or the frame shows nothing yet:", id);
943
+ const link = shown ? shown.link : entry.frame.default?.link || "";
944
+ if (link !== "" && HTTPS.test(link)) {
945
+ try {
946
+ Promise.resolve(openExternalUrl({ url: link })).catch((err) => this.host.log("Frame link not opened:", err));
947
+ } catch (err) {
948
+ this.host.log("Frame link not opened:", err);
949
+ }
950
+ }
951
+ }
952
+ /** The routes' base for this scene: the scene id encoded, as any value in a url path is */
953
+ sceneUrl() {
954
+ const sceneId = this.host.getSceneId();
955
+ if (!sceneId) return null;
956
+ return `${this.host.getBaseUrl()}/scene/${encodeURIComponent(sceneId)}`;
957
+ }
958
+ /** The read at load: once, when Venue is known and a frame is declared */
959
+ loadRead() {
960
+ if (this.loadReadStarted || !this.enabled || this.entries.size === 0) return;
961
+ this.loadReadStarted = true;
962
+ this.read().catch(() => {
963
+ });
964
+ }
965
+ /** Read the saved content and show it; a failed read keeps what was shown */
966
+ async read() {
967
+ const base = this.sceneUrl();
968
+ if (!base) {
969
+ this.host.log("Frames: no scene id - nothing read");
970
+ return;
971
+ }
972
+ const seq = ++this.readSeq;
973
+ let frames;
974
+ try {
975
+ const res = await fetch(`${base}/frames`);
976
+ if (!res.ok) {
977
+ this.host.log("Frames read refused:", res.status);
978
+ return;
979
+ }
980
+ const data = await res.json();
981
+ const raw = data && typeof data === "object" ? data.frames : void 0;
982
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
983
+ this.host.log("Frames read: the answer holds no frames");
984
+ return;
985
+ }
986
+ frames = raw;
987
+ } catch (err) {
988
+ this.host.log("Frames read error:", err);
989
+ return;
990
+ }
991
+ if (seq < this.shownSeq) return;
992
+ this.shownSeq = seq;
993
+ this.answer = frames;
994
+ this.apply();
995
+ }
996
+ /** A frame's content from the last good read: its saved content when usable, else its default, else null */
997
+ contentFor(frame) {
998
+ const answer = this.answer;
999
+ if (answer && Object.prototype.hasOwnProperty.call(answer, frame.id)) {
1000
+ const saved = savedContent(answer[frame.id]);
1001
+ if (saved) return saved;
1002
+ this.host.log("Frames: saved content not usable, ignored:", frame.id);
1003
+ }
1004
+ return defaultContent(frame);
1005
+ }
1006
+ /** Each declared frame's content handed to its onContent when it differs from what the frame shows */
1007
+ apply() {
1008
+ if (!this.enabled || this.answer === null) return;
1009
+ for (const entry of [...this.entries.values()]) {
1010
+ const content = this.contentFor(entry.frame);
1011
+ if (!content || sameContent(content, entry.shown)) continue;
1012
+ try {
1013
+ entry.frame.onContent({ ...content });
1014
+ entry.shown = content;
1015
+ } catch (err) {
1016
+ this.host.error(`Frame ${entry.frame.id}: onContent failed`, err);
1017
+ }
1018
+ }
1019
+ }
1020
+ /** The declaration - ids, labels, defaults, never the handlers - once a load, in its own request to the config route */
1021
+ async upload() {
1022
+ if (this.uploaded || !this.enabled || !this.adminOk || this.entries.size === 0) return;
1023
+ const base = this.sceneUrl();
1024
+ if (!base) return;
1025
+ this.uploaded = true;
1026
+ const frames = [...this.entries.values()].map(({ frame }) => {
1027
+ const d = frame.default;
1028
+ return {
1029
+ id: frame.id,
1030
+ label: frame.label,
1031
+ ...d ? { default: { image: d.image, text: d.text || "", link: d.link || "" } } : {}
1032
+ };
1033
+ });
1034
+ try {
1035
+ const res = await signedFetch({
1036
+ url: `${base}/config`,
1037
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frames }) }
1038
+ });
1039
+ if (res.ok) {
1040
+ this.host.log("Frames declared:", frames.map((f) => f.id));
1041
+ return;
1042
+ }
1043
+ this.host.log("Frames declaration refused:", res.status, errorOf(res.body));
1044
+ } catch (err) {
1045
+ this.host.log("Frames declaration error:", err);
1046
+ }
1047
+ }
1048
+ /** The click, signed: thestatic.tv counts it under the frame's shown version (one a wallet a frame a 10 s) */
1049
+ async postClick(id, version) {
1050
+ const base = this.sceneUrl();
1051
+ if (!base) return;
1052
+ try {
1053
+ const res = await signedFetch({
1054
+ url: `${base}/frames/click`,
1055
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frame: id, version }) }
1056
+ });
1057
+ if (!res.ok) this.host.log("Frame click refused:", id, res.status, errorOf(res.body));
1058
+ } catch (err) {
1059
+ this.host.log("Frame click error:", id, err);
1060
+ }
1061
+ }
1062
+ };
1063
+
696
1064
  // src/ui/guide-ui.tsx
697
1065
  import ReactEcs2, { UiEntity as UiEntity2, Input as Input2, Label as Label2 } from "@dcl/sdk/react-ecs";
698
1066
  import { Color4 as Color43 } from "@dcl/sdk/math";
699
- import { openExternalUrl } from "~system/RestrictedActions";
1067
+ import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
700
1068
 
701
1069
  // src/ui/theme.ts
702
1070
  import { Color4 } from "@dcl/sdk/math";
@@ -965,6 +1333,7 @@ var GuideUIModule = class {
965
1333
  * Always renders toggle button, plus panel when visible
966
1334
  */
967
1335
  this.getComponent = () => {
1336
+ if (this.client.isVisitorBlocked) return null;
968
1337
  const windowW = UI_DIMENSIONS.guide.width;
969
1338
  const windowH = UI_DIMENSIONS.guide.height;
970
1339
  return ReactEcs2.createElement(UiEntity2, {
@@ -1186,7 +1555,7 @@ var GuideUIModule = class {
1186
1555
  handleChannelClick(video) {
1187
1556
  const baseUrl = this.getBaseUrl();
1188
1557
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
1189
- openExternalUrl({ url: channelUrl });
1558
+ openExternalUrl2({ url: channelUrl });
1190
1559
  }
1191
1560
  renderLeftPanel() {
1192
1561
  const sidebarW = this.s(UI_DIMENSIONS.guide.sidebar.width);
@@ -1728,12 +2097,13 @@ var GuideUIModule = class {
1728
2097
  // src/ui/chat-ui.tsx
1729
2098
  import ReactEcs3, { UiEntity as UiEntity3, Label as Label3, Input as Input3, Button as Button2 } from "@dcl/sdk/react-ecs";
1730
2099
  import { Color4 as Color44 } from "@dcl/sdk/math";
1731
- import { signedFetch } from "~system/SignedFetch";
2100
+ import { signedFetch as signedFetch2 } from "~system/SignedFetch";
1732
2101
  import { getPlayer } from "@dcl/sdk/players";
1733
- import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
2102
+ import { openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
1734
2103
  var POLL_INTERVAL_ACTIVE = 5e3;
1735
2104
  var POLL_INTERVAL_PASSIVE = 3e4;
1736
2105
  var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
2106
+ var HISTORY_ERROR_ID = "sys-history-error";
1737
2107
  var ChatUIModule = class {
1738
2108
  constructor(client, config = {}) {
1739
2109
  // Visibility state
@@ -1757,6 +2127,8 @@ var ChatUIModule = class {
1757
2127
  this.systemMessages = [];
1758
2128
  this.inputText = "";
1759
2129
  this.chatScrollOffset = 0;
2130
+ // The last history read's failure, shown as the messages' last line until a read succeeds (2026-11-17)
2131
+ this.historyError = "";
1760
2132
  // UI preferences
1761
2133
  this.position = "right";
1762
2134
  // Timers
@@ -1771,6 +2143,7 @@ var ChatUIModule = class {
1771
2143
  * Always renders toggle button, plus panel when visible
1772
2144
  */
1773
2145
  this.getComponent = () => {
2146
+ if (this.client.isVisitorBlocked) return null;
1774
2147
  const scaledTheme = scaleChatTheme(DEFAULT_CHAT_THEME, this.client.uiScale);
1775
2148
  const positionStyle = this.getPositionStyle();
1776
2149
  return ReactEcs3.createElement(UiEntity3, {
@@ -1911,7 +2284,7 @@ var ChatUIModule = class {
1911
2284
  this.isSigningIn = true;
1912
2285
  try {
1913
2286
  const baseUrl = this.getBaseUrl();
1914
- const response = await signedFetch({
2287
+ const response = await signedFetch2({
1915
2288
  url: `${baseUrl}/api/auth/dcl`,
1916
2289
  init: {
1917
2290
  method: "POST",
@@ -1963,8 +2336,13 @@ var ChatUIModule = class {
1963
2336
  async fetchMessages() {
1964
2337
  try {
1965
2338
  const baseUrl = this.getBaseUrl();
1966
- const response = await fetch(`${baseUrl}/api/chat/history?channelId=${this.currentChannelId}`);
2339
+ const response = await fetch(`${baseUrl}/api/chat/history?channelId=${encodeURIComponent(this.currentChannelId)}`);
2340
+ if (!response.ok) {
2341
+ this.historyError = `CHAT HISTORY UNAVAILABLE (${response.status})`;
2342
+ return;
2343
+ }
1967
2344
  const data = await response.json();
2345
+ this.historyError = "";
1968
2346
  if (data.messages) {
1969
2347
  const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
1970
2348
  const recentMsgs = data.messages.filter(
@@ -1992,6 +2370,7 @@ var ChatUIModule = class {
1992
2370
  this.realMessages = sortedMsgs;
1993
2371
  }
1994
2372
  } catch (e) {
2373
+ this.historyError = "CHAT HISTORY UNAVAILABLE";
1995
2374
  }
1996
2375
  }
1997
2376
  async handleSend() {
@@ -2007,7 +2386,7 @@ var ChatUIModule = class {
2007
2386
  this.inputText = "";
2008
2387
  try {
2009
2388
  const baseUrl = this.getBaseUrl();
2010
- const response = await signedFetch({
2389
+ const response = await signedFetch2({
2011
2390
  url: `${baseUrl}/api/chat/send`,
2012
2391
  init: {
2013
2392
  method: "POST",
@@ -2050,6 +2429,7 @@ var ChatUIModule = class {
2050
2429
  switchChannel(channelId) {
2051
2430
  this.currentChannelId = channelId;
2052
2431
  this.realMessages = [];
2432
+ this.historyError = "";
2053
2433
  this.showChannelDropdown = false;
2054
2434
  this.chatScrollOffset = 0;
2055
2435
  this.channelPage = 0;
@@ -2164,6 +2544,16 @@ var ChatUIModule = class {
2164
2544
  }
2165
2545
  renderMessagesArea(theme) {
2166
2546
  const allMessages = [...this.systemMessages, ...this.realMessages];
2547
+ if (this.historyError) {
2548
+ allMessages.push({
2549
+ id: HISTORY_ERROR_ID,
2550
+ username: "SYSTEM",
2551
+ text: this.historyError,
2552
+ uid: "system",
2553
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2554
+ isSystem: true
2555
+ });
2556
+ }
2167
2557
  const totalMessages = allMessages.length;
2168
2558
  const maxOffset = Math.max(0, totalMessages - UI_DIMENSIONS.chat.messagesPerPage);
2169
2559
  if (this.chatScrollOffset > maxOffset) this.chatScrollOffset = maxOffset;
@@ -2250,7 +2640,12 @@ var ChatUIModule = class {
2250
2640
  return ReactEcs3.createElement(UiEntity3, {
2251
2641
  key: msg.id,
2252
2642
  uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2253
- uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2643
+ uiText: {
2644
+ value: msg.text,
2645
+ fontSize: theme.systemMessage,
2646
+ color: msg.id === HISTORY_ERROR_ID ? THEME.colors.yellow : THEME.colors.green,
2647
+ textAlign: "middle-left"
2648
+ }
2254
2649
  });
2255
2650
  }
2256
2651
  renderChatMessage(msg, theme) {
@@ -2365,7 +2760,7 @@ var ChatUIModule = class {
2365
2760
  uiBackground: { color: THEME.colors.cyan },
2366
2761
  color: Color44.Black(),
2367
2762
  onMouseDown: () => {
2368
- openExternalUrl2({ url: `${baseUrl}/apply` });
2763
+ openExternalUrl3({ url: `${baseUrl}/login` });
2369
2764
  }
2370
2765
  })
2371
2766
  ]
@@ -2537,11 +2932,11 @@ var ChatUIModule = class {
2537
2932
  };
2538
2933
 
2539
2934
  // src/ui/admin-panel-ui.tsx
2540
- import ReactEcs5, { UiEntity as UiEntity5, Button as Button3, Label as Label5, Input as Input4 } from "@dcl/sdk/react-ecs";
2541
- import { Color4 as Color45, Vector3 } from "@dcl/sdk/math";
2935
+ import ReactEcs6, { UiEntity as UiEntity6, Button as Button4, Label as Label6, Input as Input4 } from "@dcl/sdk/react-ecs";
2936
+ import { Color4 as Color46 } from "@dcl/sdk/math";
2542
2937
  import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
2543
- import { movePlayerTo, openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
2544
- import { signedFetch as signedFetch2 } from "~system/SignedFetch";
2938
+ import { openExternalUrl as openExternalUrl5 } from "~system/RestrictedActions";
2939
+ import { signedFetch as signedFetch3 } from "~system/SignedFetch";
2545
2940
 
2546
2941
  // src/ui/ui-renderer.tsx
2547
2942
  import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
@@ -2649,6 +3044,7 @@ function createStaticUI(client) {
2649
3044
  initNotificationSystem();
2650
3045
  return function StaticUI() {
2651
3046
  const currentScale = client.uiScale;
3047
+ const blocked = client.isVisitorBlocked;
2652
3048
  const guideComponent = client.guideUI?.getComponent() ?? null;
2653
3049
  const chatComponent = client.chatUI?.getComponent() ?? null;
2654
3050
  const adminComponent = client.adminPanel?.getComponent() ?? null;
@@ -2664,7 +3060,7 @@ function createStaticUI(client) {
2664
3060
  alignItems: "center"
2665
3061
  }
2666
3062
  },
2667
- /* @__PURE__ */ ReactEcs4.createElement(NotificationBanner, null),
3063
+ blocked ? null : /* @__PURE__ */ ReactEcs4.createElement(NotificationBanner, null),
2668
3064
  guideComponent,
2669
3065
  chatComponent,
2670
3066
  adminComponent
@@ -2676,8 +3072,389 @@ function setupStaticUI(client) {
2676
3072
  ReactEcsRenderer.setUiRenderer(StaticUI);
2677
3073
  }
2678
3074
 
3075
+ // src/ui/blocked-notice.tsx
3076
+ import ReactEcs5, { UiEntity as UiEntity5, Label as Label5, Button as Button3 } from "@dcl/sdk/react-ecs";
3077
+ import { Color4 as Color45 } from "@dcl/sdk/math";
3078
+ import { openExternalUrl as openExternalUrl4 } from "~system/RestrictedActions";
3079
+ var DEFAULT_SITE_URL = "https://thestatic.tv";
3080
+ function blockedNoticeLines(standing, kickLeftMs) {
3081
+ if (standing === "banned") {
3082
+ return ["BANNED FROM THIS SCENE", "The scene's moderators banned", "this wallet."];
3083
+ }
3084
+ if (standing === "kicked") {
3085
+ const minutes = Math.max(1, Math.ceil(kickLeftMs / 6e4));
3086
+ return ["REMOVED FROM THIS SCENE", "A moderator cleared the scene.", `You can come back in ${minutes} min.`];
3087
+ }
3088
+ if (standing === "private") {
3089
+ return ["PRIVATE EVENT", "Open to TheStatic.tv citizens right now."];
3090
+ }
3091
+ return [];
3092
+ }
3093
+ function blockedNoticeAction(standing, siteUrl = DEFAULT_SITE_URL) {
3094
+ if (standing === "private") return { label: "BECOME A CITIZEN", url: `${siteUrl}/login` };
3095
+ return null;
3096
+ }
3097
+ function BlockedNotice(props) {
3098
+ const lines = blockedNoticeLines(props.standing, props.kickLeftMs);
3099
+ if (lines.length === 0) return null;
3100
+ const s = (v) => Math.round(v * props.scale);
3101
+ const [title, ...body] = lines;
3102
+ const action = blockedNoticeAction(props.standing, props.siteUrl || DEFAULT_SITE_URL);
3103
+ return /* @__PURE__ */ ReactEcs5.createElement(
3104
+ UiEntity5,
3105
+ {
3106
+ uiTransform: {
3107
+ width: "100%",
3108
+ height: "100%",
3109
+ positionType: "absolute",
3110
+ justifyContent: "center",
3111
+ alignItems: "center"
3112
+ }
3113
+ },
3114
+ /* @__PURE__ */ ReactEcs5.createElement(
3115
+ UiEntity5,
3116
+ {
3117
+ uiTransform: { width: s(460), flexDirection: "column", alignItems: "center", padding: s(20) },
3118
+ uiBackground: { color: Color45.create(0.05, 0.05, 0.08, 0.95) }
3119
+ },
3120
+ /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: title, fontSize: s(22), color: Color45.create(0.9, 0.2, 0.2, 1), uiTransform: { height: s(34) } }),
3121
+ body.map((line, i) => /* @__PURE__ */ ReactEcs5.createElement(Label5, { key: `blocked-line-${i}`, value: line, fontSize: s(16), color: Color45.White(), uiTransform: { height: s(26) } })),
3122
+ action && /* @__PURE__ */ ReactEcs5.createElement(
3123
+ Button3,
3124
+ {
3125
+ uiTransform: { width: s(220), height: s(36), margin: { top: s(12) } },
3126
+ uiBackground: { color: Color45.create(0, 0.8, 0.8, 1) },
3127
+ value: action.label,
3128
+ fontSize: s(16),
3129
+ color: Color45.Black(),
3130
+ onMouseDown: () => {
3131
+ openExternalUrl4({ url: action.url });
3132
+ }
3133
+ }
3134
+ )
3135
+ )
3136
+ );
3137
+ }
3138
+
3139
+ // src/utils/player-wait.ts
3140
+ var PLAYER_WAIT_STEP_MS = 1e3;
3141
+ var PLAYER_WAIT_MAX_MS = 30 * 1e3;
3142
+ var isGuest = (player) => player.isGuest === true;
3143
+ var PlayerWait = class {
3144
+ constructor(deps) {
3145
+ this.timerId = null;
3146
+ this.reads = 0;
3147
+ /** This wait has checked a guest reading already */
3148
+ this.guestChecked = false;
3149
+ this.deps = deps;
3150
+ }
3151
+ get stepMs() {
3152
+ return this.deps.stepMs ?? PLAYER_WAIT_STEP_MS;
3153
+ }
3154
+ get maxMs() {
3155
+ return this.deps.maxMs ?? PLAYER_WAIT_MAX_MS;
3156
+ }
3157
+ /** True while a wait is reading the player */
3158
+ get waiting() {
3159
+ return this.timerId !== null;
3160
+ }
3161
+ /**
3162
+ * The check with the player now, or - with no player yet - a wait that runs it once one appears. A guest reading is
3163
+ * checked now and the wait goes on for a non-guest one. Resolves when the check is done, or at once when there is
3164
+ * none to run.
3165
+ */
3166
+ async run() {
3167
+ const player = this.read();
3168
+ if (player && !isGuest(player)) {
3169
+ this.stop();
3170
+ await this.deps.check(player);
3171
+ return;
3172
+ }
3173
+ if (player) {
3174
+ this.start("A guest reading - checked now; waiting for a non-guest one");
3175
+ this.guestChecked = true;
3176
+ await this.deps.check(player);
3177
+ return;
3178
+ }
3179
+ this.start("No player data yet - waiting for one");
3180
+ }
3181
+ /** A wait, unless one is running (one at a time) */
3182
+ start(msg) {
3183
+ if (this.timerId !== null) return;
3184
+ this.reads = 0;
3185
+ this.guestChecked = false;
3186
+ this.deps.log?.(msg);
3187
+ this.timerId = this.deps.setInterval(() => this.tick(), this.stepMs);
3188
+ }
3189
+ tick() {
3190
+ this.reads++;
3191
+ const player = this.read();
3192
+ if (player && !isGuest(player)) {
3193
+ this.stop();
3194
+ this.deps.log?.(`Player resolved after ${this.reads} read(s)`);
3195
+ this.deps.check(player).catch(() => {
3196
+ });
3197
+ return;
3198
+ }
3199
+ if (player && !this.guestChecked) {
3200
+ this.guestChecked = true;
3201
+ this.deps.log?.(`A guest reading after ${this.reads} read(s) - checked now; still waiting for a non-guest one`);
3202
+ this.deps.check(player).catch(() => {
3203
+ });
3204
+ }
3205
+ if (this.reads * this.stepMs >= this.maxMs) {
3206
+ this.stop();
3207
+ this.deps.log?.(`No non-guest player after ${this.maxMs / 1e3} s - no further check`);
3208
+ }
3209
+ }
3210
+ stop() {
3211
+ if (this.timerId === null) return;
3212
+ this.deps.clearInterval(this.timerId);
3213
+ this.timerId = null;
3214
+ }
3215
+ read() {
3216
+ try {
3217
+ const player = this.deps.getPlayer();
3218
+ return player && player.userId ? player : null;
3219
+ } catch {
3220
+ return null;
3221
+ }
3222
+ }
3223
+ };
3224
+
3225
+ // src/modules/moderation.ts
3226
+ import { engine as engine4, Transform as Transform2, MeshCollider, ColliderLayer } from "@dcl/sdk/ecs";
3227
+ import { Vector3 } from "@dcl/sdk/math";
3228
+ import { movePlayerTo } from "~system/RestrictedActions";
3229
+ var KICK_MS = 2 * 60 * 1e3;
3230
+ var REREAD_MS = 60 * 1e3;
3231
+ var READ_GAP_MS = 5e3;
3232
+ var HINT_SPREAD_MS = 3e3;
3233
+ var CITIZEN_WAIT_MS = 1e4;
3234
+ var CHECK_EVERY_S = 1;
3235
+ function namesMe(wallet, mine) {
3236
+ if (typeof wallet !== "string" || wallet === "") return false;
3237
+ if (typeof mine !== "string" || mine === "") return false;
3238
+ return wallet.toLowerCase() === mine.toLowerCase();
3239
+ }
3240
+ var ModerationModule = class {
3241
+ constructor(deps) {
3242
+ this.banned = false;
3243
+ this.kickedUntil = 0;
3244
+ this.canModerate = false;
3245
+ // Private mode (2026-11-19): the last answer's word on this visitor, its isCitizen and when it came, a hint's read
3246
+ // waiting its random spread, and the callers of checkCitizen() waiting on the next read
3247
+ this.privateBlocked = false;
3248
+ this.citizen = false;
3249
+ this.citizenAnsweredAt = null;
3250
+ this.hintDueAt = null;
3251
+ this.readWaiters = [];
3252
+ this.rects = [];
3253
+ this.boxes = [];
3254
+ this.spawn = null;
3255
+ this.wallEntities = [];
3256
+ this.lastBlocked = false;
3257
+ this.lastStanding = "clear";
3258
+ this.lastReadAt = Number.NEGATIVE_INFINITY;
3259
+ this.readInFlight = false;
3260
+ this.readPending = false;
3261
+ this.wasInScene = null;
3262
+ this.sinceCheck = 0;
3263
+ this.started = false;
3264
+ /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor out of place moved to the front entry */
3265
+ this.system = (dt) => {
3266
+ if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
3267
+ this.hintDueAt = null;
3268
+ this.requestRead();
3269
+ }
3270
+ if (this.readWaiters.length > 0) {
3271
+ const t = this.now();
3272
+ const expired = this.readWaiters.filter((w) => t >= w.deadline);
3273
+ if (expired.length > 0) {
3274
+ this.readWaiters = this.readWaiters.filter((w) => t < w.deadline);
3275
+ for (const w of expired) w.resolve();
3276
+ }
3277
+ }
3278
+ this.sinceCheck += dt;
3279
+ if (this.sinceCheck < CHECK_EVERY_S) return;
3280
+ this.sinceCheck = 0;
3281
+ const now = this.now();
3282
+ if (this.kickedUntil > 0 && now >= this.kickedUntil) {
3283
+ this.kickedUntil = 0;
3284
+ this.sync();
3285
+ }
3286
+ const me = getPlayerPosition();
3287
+ const inScene = me !== null && this.rects.length > 0 && inParcels(me, this.rects);
3288
+ if (inScene && this.wasInScene === false) this.readPending = true;
3289
+ if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
3290
+ this.wasInScene = inScene;
3291
+ this.tryRead();
3292
+ if (me && this.blocked) {
3293
+ const to = entryPoint(this.boxes, this.rects, this.spawn, me);
3294
+ if (to && mustMoveToEntry(me, this.boxes, this.rects, to.y)) {
3295
+ this.log("Blocked and inside the scene - moving to the front entry", to);
3296
+ Promise.resolve(movePlayerTo({ newRelativePosition: Vector3.create(to.x, to.y, to.z) })).catch(() => {
3297
+ });
3298
+ }
3299
+ }
3300
+ };
3301
+ this.deps = deps;
3302
+ }
3303
+ now() {
3304
+ return this.deps.now ? this.deps.now() : Date.now();
3305
+ }
3306
+ log(msg, ...args) {
3307
+ this.deps.log?.(msg, ...args);
3308
+ }
3309
+ /** Reads the scene's parcels and starts the checks (once) */
3310
+ async start() {
3311
+ if (this.started) return;
3312
+ this.started = true;
3313
+ engine4.addSystem(this.system);
3314
+ try {
3315
+ await getSceneBounds();
3316
+ this.rects = getParcelRects();
3317
+ this.boxes = wallBoxes(this.rects);
3318
+ this.spawn = getSpawnPoint();
3319
+ } catch {
3320
+ }
3321
+ this.sync();
3322
+ }
3323
+ /** banned, kicked (KICK ALL, until it lapses), private (the scene's private mode) or clear - in that precedence */
3324
+ get standing() {
3325
+ if (this.banned) return "banned";
3326
+ if (this.kickedUntil > 0 && this.now() < this.kickedUntil) return "kicked";
3327
+ if (this.privateBlocked) return "private";
3328
+ return "clear";
3329
+ }
3330
+ /** The last answer's isCitizen (2026-11-19): false before one, and from a server that does not answer it */
3331
+ get isCitizen() {
3332
+ return this.citizen;
3333
+ }
3334
+ /**
3335
+ * Whether this visitor is a TheStatic.tv citizen (2026-11-19): the last answer when it is under READ_GAP_MS old, else
3336
+ * the answer of the next read - started now, or the one in flight - through the same gate as every other read. A
3337
+ * read that fails answers what the last one said (false before any), and so does one that has not settled within
3338
+ * CITIZEN_WAIT_MS (the module's system ends that wait).
3339
+ */
3340
+ async checkCitizen() {
3341
+ if (this.citizenAnsweredAt !== null && this.now() - this.citizenAnsweredAt < READ_GAP_MS) return this.citizen;
3342
+ await new Promise((resolve) => {
3343
+ this.readWaiters.push({ resolve, deadline: this.now() + CITIZEN_WAIT_MS });
3344
+ if (!this.readInFlight) this.requestRead();
3345
+ });
3346
+ return this.citizen;
3347
+ }
3348
+ get blocked() {
3349
+ return this.standing !== "clear";
3350
+ }
3351
+ /** How long a kick has left, in ms (0 when not kicked) */
3352
+ get kickLeftMs() {
3353
+ return this.standing === "kicked" ? Math.max(0, this.kickedUntil - this.now()) : 0;
3354
+ }
3355
+ /**
3356
+ * admin-check's answer: the ban list's word on this visitor, whether they moderate the scene, and (2026-11-19) the
3357
+ * private mode's word and whether they are a citizen. Only the boolean true counts, so an answer without the new
3358
+ * fields reads as open and not a citizen. One who can moderate is never walled by private mode here, whatever the
3359
+ * answer says (the server admits them; this keeps a wrong answer from locking an admin out).
3360
+ */
3361
+ applyStanding(answer) {
3362
+ this.banned = answer.isBanned === true;
3363
+ this.canModerate = answer.canModerate === true;
3364
+ this.privateBlocked = answer.privateBlocked === true && !this.canModerate;
3365
+ this.citizen = answer.isCitizen === true;
3366
+ this.citizenAnsweredAt = this.now();
3367
+ this.lastReadAt = Math.max(this.lastReadAt, this.now());
3368
+ this.sync();
3369
+ }
3370
+ /**
3371
+ * A command from the scene's queue (the poll every visitor runs). Returns true for the three this module takes.
3372
+ * kickBanned names a wallet: the named visitor re-reads their standing, every other visitor does nothing.
3373
+ * privateMode (2026-11-19) is a hint for every visitor: its payload is not read - a re-read after a random wait of up
3374
+ * to HINT_SPREAD_MS, joined by any hint that comes while it waits, and still gated by one read in flight and
3375
+ * READ_GAP_MS, so no number of hints makes this copy read faster than that.
3376
+ */
3377
+ handleCommand(type, payload) {
3378
+ if (type === "privateMode") {
3379
+ if (this.hintDueAt === null) {
3380
+ const r = this.deps.random ? this.deps.random() : Math.random();
3381
+ const wait = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) * HINT_SPREAD_MS : 0;
3382
+ this.hintDueAt = this.now() + wait;
3383
+ this.log(`Private mode changed - reading my standing in ${Math.round(wait)} ms`);
3384
+ }
3385
+ return true;
3386
+ }
3387
+ if (type === "kickBanned") {
3388
+ if (namesMe(payload?.wallet, this.deps.myWallet())) {
3389
+ this.log("A kick names me - reading my standing");
3390
+ this.requestRead();
3391
+ }
3392
+ return true;
3393
+ }
3394
+ if (type === "kickAll") {
3395
+ if (!this.canModerate) {
3396
+ this.kickedUntil = this.now() + KICK_MS;
3397
+ this.sync();
3398
+ }
3399
+ return true;
3400
+ }
3401
+ return false;
3402
+ }
3403
+ /** Ask for a fresh standing read: at once when the gate allows, else as soon as it does */
3404
+ requestRead() {
3405
+ this.readPending = true;
3406
+ this.tryRead();
3407
+ }
3408
+ tryRead() {
3409
+ if (!this.readPending || this.readInFlight) return;
3410
+ const now = this.now();
3411
+ if (now - this.lastReadAt < READ_GAP_MS) return;
3412
+ this.readPending = false;
3413
+ this.readInFlight = true;
3414
+ this.lastReadAt = now;
3415
+ this.deps.reread().catch(() => {
3416
+ }).finally(() => {
3417
+ this.readInFlight = false;
3418
+ const waiters = this.readWaiters;
3419
+ this.readWaiters = [];
3420
+ for (const w of waiters) w.resolve();
3421
+ });
3422
+ }
3423
+ /** The walls follow blocked; the scene hears of a change */
3424
+ sync() {
3425
+ const standing = this.standing;
3426
+ const blocked = standing !== "clear";
3427
+ if (blocked && this.wallEntities.length === 0) this.raiseWalls();
3428
+ if (!blocked && this.wallEntities.length > 0) this.lowerWalls();
3429
+ if (blocked !== this.lastBlocked || standing !== this.lastStanding) {
3430
+ this.lastBlocked = blocked;
3431
+ this.lastStanding = standing;
3432
+ this.log(`Standing: ${standing}`);
3433
+ this.deps.onChange?.(blocked, standing);
3434
+ }
3435
+ }
3436
+ raiseWalls() {
3437
+ for (const b of this.boxes) {
3438
+ const wall = engine4.addEntity();
3439
+ Transform2.create(wall, {
3440
+ position: Vector3.create((b.minX + b.maxX) / 2, b.top / 2, (b.minZ + b.maxZ) / 2),
3441
+ scale: Vector3.create(b.maxX - b.minX, b.top, b.maxZ - b.minZ)
3442
+ });
3443
+ MeshCollider.setBox(wall, ColliderLayer.CL_PHYSICS);
3444
+ this.wallEntities.push(wall);
3445
+ }
3446
+ }
3447
+ lowerWalls() {
3448
+ for (const wall of this.wallEntities) engine4.removeEntity(wall);
3449
+ this.wallEntities = [];
3450
+ }
3451
+ /** The walls this copy has up (one per parcel while blocked) */
3452
+ get wallCount() {
3453
+ return this.wallEntities.length;
3454
+ }
3455
+ };
3456
+
2679
3457
  // src/ui/admin-panel-ui.tsx
2680
- var BAN_KICK_POSITION = Vector3.create(16, -50, 16);
2681
3458
  var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
2682
3459
  function figuresOf(value) {
2683
3460
  const figures = value?.figures;
@@ -2710,22 +3487,23 @@ function channelDeleteLines(look, changed) {
2710
3487
  lines.push("Stream history is kept");
2711
3488
  return lines;
2712
3489
  }
3490
+ var SEEN_COMMAND_IDS_MAX = 200;
2713
3491
  var C2 = {
2714
- bg: Color45.create(0.08, 0.08, 0.12, 0.98),
2715
- header: Color45.create(0.9, 0.15, 0.15, 1),
2716
- tabActive: Color45.create(0, 0.7, 0.7, 1),
2717
- tabInactive: Color45.create(0.15, 0.15, 0.2, 1),
2718
- section: Color45.create(0.12, 0.12, 0.18, 1),
2719
- btn: Color45.create(0.2, 0.2, 0.28, 1),
2720
- cyan: Color45.create(0, 0.8, 0.8, 1),
2721
- magenta: Color45.create(0.85, 0.2, 0.55, 1),
2722
- yellow: Color45.create(0.95, 0.75, 0.1, 1),
2723
- green: Color45.create(0.2, 0.75, 0.3, 1),
2724
- red: Color45.create(0.85, 0.2, 0.2, 1),
2725
- purple: Color45.create(0.6, 0.3, 0.85, 1),
2726
- orange: Color45.create(0.95, 0.5, 0.15, 1),
2727
- text: Color45.White(),
2728
- textDim: Color45.create(0.6, 0.6, 0.7, 1)
3492
+ bg: Color46.create(0.08, 0.08, 0.12, 0.98),
3493
+ header: Color46.create(0.9, 0.15, 0.15, 1),
3494
+ tabActive: Color46.create(0, 0.7, 0.7, 1),
3495
+ tabInactive: Color46.create(0.15, 0.15, 0.2, 1),
3496
+ section: Color46.create(0.12, 0.12, 0.18, 1),
3497
+ btn: Color46.create(0.2, 0.2, 0.28, 1),
3498
+ cyan: Color46.create(0, 0.8, 0.8, 1),
3499
+ magenta: Color46.create(0.85, 0.2, 0.55, 1),
3500
+ yellow: Color46.create(0.95, 0.75, 0.1, 1),
3501
+ green: Color46.create(0.2, 0.75, 0.3, 1),
3502
+ red: Color46.create(0.85, 0.2, 0.2, 1),
3503
+ purple: Color46.create(0.6, 0.3, 0.85, 1),
3504
+ orange: Color46.create(0.95, 0.5, 0.15, 1),
3505
+ text: Color46.White(),
3506
+ textDim: Color46.create(0.6, 0.6, 0.7, 1)
2729
3507
  };
2730
3508
  var AdminPanelUIModule = class {
2731
3509
  // UI scaling - uses shared client.uiScale
@@ -2767,34 +3545,90 @@ var AdminPanelUIModule = class {
2767
3545
  this.broadcastText = "";
2768
3546
  this.modStatus = "";
2769
3547
  this.modsFetched = false;
3548
+ // What the last kick sent from the Mod tab came to (2026-11-17): KICK ALL and the ban's kick are queued on
3549
+ // thestatic.tv, where every visitor's copy reads them
3550
+ this.kickStatus = "";
3551
+ // The Video and Broadcast buttons go through the same queue since 2026-11-18 (until then they reached the presser's
3552
+ // copy alone): what the last send from each came to, one line a section
3553
+ this.videoStatus = "";
3554
+ this.broadcastStatus = "";
3555
+ /** 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 */
3556
+ this.currentVideoUrl = null;
3557
+ // Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
3558
+ // status line, and the once-a-load gates for the declaration's upload and the saved state's read
3559
+ this.controls = [];
3560
+ this.currentOption = {};
3561
+ this.controlStatus = "";
3562
+ this.controlsUploaded = false;
3563
+ this.stateRead = false;
3564
+ /** init has read the video state: the saved control state may be read now (a persist control registered later reads then) */
3565
+ this.loadReadsDone = false;
3566
+ // The command poll (2026-11-18): the server's cursor, sent back as since once known, and the ids seen - the last
3567
+ // SEEN_COMMAND_IDS_MAX, this copy's own sends among them - so no command runs twice here
3568
+ this.commandCursor = null;
3569
+ this.seenCommandIds = /* @__PURE__ */ new Set();
3570
+ this.seenCommandOrder = [];
3571
+ this.controlLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3572
+ this.controlStatus = line;
3573
+ } };
3574
+ this.videoLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3575
+ this.videoStatus = line;
3576
+ } };
3577
+ this.broadcastLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3578
+ this.broadcastStatus = line;
3579
+ } };
3580
+ // Private mode (2026-11-19, Venue): the switch's state from the last read (null until an answer carries it), and the
3581
+ // MOD tab's line for the switch
3582
+ this.privateModeOn = null;
3583
+ this.privateStatus = "";
3584
+ this.privateLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3585
+ this.privateStatus = line;
3586
+ } };
2770
3587
  // --- UI Components ---
2771
- this.SectionHead = ({ label, color }) => /* @__PURE__ */ ReactEcs5.createElement(
2772
- UiEntity5,
3588
+ this.SectionHead = ({ label, color }) => /* @__PURE__ */ ReactEcs6.createElement(
3589
+ UiEntity6,
2773
3590
  {
2774
3591
  uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.sectionHeadHeight), margin: { bottom: 8 }, padding: { left: 10 }, alignItems: "center" },
2775
- uiBackground: { color: Color45.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
3592
+ uiBackground: { color: Color46.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
2776
3593
  },
2777
- /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: label, fontSize: this.theme.sectionHead, color })
3594
+ /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: label, fontSize: this.theme.sectionHead, color })
2778
3595
  );
2779
- this.TabBtn = ({ label, tab }) => /* @__PURE__ */ ReactEcs5.createElement(
2780
- Button3,
3596
+ this.TabBtn = ({ label, tab }) => /* @__PURE__ */ ReactEcs6.createElement(
3597
+ Button4,
2781
3598
  {
2782
3599
  uiTransform: { flexGrow: 1, height: this.s(UI_DIMENSIONS.admin.tabHeight), justifyContent: "center", alignItems: "center" },
2783
3600
  uiBackground: { color: this.activeTab === tab ? C2.tabActive : C2.tabInactive },
2784
3601
  value: label,
2785
3602
  fontSize: this.theme.tabButton,
2786
- color: this.activeTab === tab ? Color45.Black() : C2.text,
3603
+ color: this.activeTab === tab ? Color46.Black() : C2.text,
2787
3604
  textAlign: "middle-center",
2788
3605
  onMouseDown: () => this.setActiveTab(tab)
2789
3606
  }
2790
3607
  );
3608
+ /**
3609
+ * The CONTROLS tab (2026-11-18): a section per registered control, a button per option, OFF when the control has one,
3610
+ * the current option highlighted, and one status line for the last press. Listed first in the tab bar, only when
3611
+ * controls are registered, for the same admins the VIDEO tab is.
3612
+ */
3613
+ this.ControlsTab = () => {
3614
+ const t = this.theme;
3615
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.controls.map((control) => /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { key: `control-${control.id}`, uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: control.label, color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { 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__ */ ReactEcs6.createElement(
3616
+ Label6,
3617
+ {
3618
+ value: this.controlStatus,
3619
+ fontSize: t.status,
3620
+ color: this.controlStatus.startsWith("Not sent") ? C2.red : C2.green,
3621
+ uiTransform: { height: this.s(18) }
3622
+ }
3623
+ ));
3624
+ };
2791
3625
  this.VideoTab = () => {
2792
3626
  if (!this.streamFetched) {
2793
3627
  this.fetchStreamData();
2794
3628
  }
2795
3629
  const t = this.theme;
2796
- return /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2797
- Button3,
3630
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3631
+ Button4,
2798
3632
  {
2799
3633
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2800
3634
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
@@ -2803,8 +3637,8 @@ var AdminPanelUIModule = class {
2803
3637
  color: C2.text,
2804
3638
  onMouseDown: () => this.claimTrial()
2805
3639
  }
2806
- ), this.trialClaimError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs5.createElement(
2807
- Button3,
3640
+ ), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs6.createElement(
3641
+ Button4,
2808
3642
  {
2809
3643
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2810
3644
  uiBackground: { color: this.channelCreating ? C2.btn : C2.cyan },
@@ -2813,47 +3647,47 @@ var AdminPanelUIModule = class {
2813
3647
  color: C2.text,
2814
3648
  onMouseDown: () => this.createChannel()
2815
3649
  }
2816
- ), this.channelCreateError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { 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__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2817
- Label5,
3650
+ ), this.channelCreateError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { 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__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3651
+ Label6,
2818
3652
  {
2819
3653
  value: this.streamData.isLive ? `LIVE \u2022 ${this.streamData.currentViewers || 0} viewers` : "OFFLINE",
2820
3654
  fontSize: t.label,
2821
3655
  color: this.streamData.isLive ? C2.red : C2.textDim
2822
3656
  }
2823
- ), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ ReactEcs5.createElement(
2824
- Label5,
3657
+ ), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ ReactEcs6.createElement(
3658
+ Label6,
2825
3659
  {
2826
3660
  value: `Channel: ${this.streamData.channelName || this.streamData.channelId}`,
2827
3661
  fontSize: t.labelSmall,
2828
3662
  color: C2.textDim,
2829
3663
  uiTransform: { margin: { bottom: 10 } }
2830
3664
  }
2831
- ), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2832
- Label5,
3665
+ ), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3666
+ Label6,
2833
3667
  {
2834
3668
  value: this.streamData.rtmpUrl || "Loading...",
2835
3669
  fontSize: t.label,
2836
3670
  color: this.streamData.rtmpUrl ? C2.text : C2.textDim,
2837
3671
  uiTransform: { margin: { left: 6 } }
2838
3672
  }
2839
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2840
- Label5,
3673
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3674
+ Label6,
2841
3675
  {
2842
3676
  value: this.streamData.streamKey || "Loading...",
2843
3677
  fontSize: t.label,
2844
3678
  color: this.streamData.streamKey ? C2.cyan : C2.textDim,
2845
3679
  uiTransform: { margin: { left: 6 } }
2846
3680
  }
2847
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2848
- Label5,
3681
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3682
+ Label6,
2849
3683
  {
2850
3684
  value: this.streamData.hlsUrl || "Not available",
2851
3685
  fontSize: t.label,
2852
3686
  color: this.streamData.hlsUrl ? C2.green : C2.textDim,
2853
3687
  uiTransform: { margin: { left: 6 } }
2854
3688
  }
2855
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs5.createElement(
2856
- Button3,
3689
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
3690
+ Button4,
2857
3691
  {
2858
3692
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2859
3693
  uiBackground: { color: this.streamControlling ? C2.btn : C2.green },
@@ -2862,8 +3696,8 @@ var AdminPanelUIModule = class {
2862
3696
  color: C2.text,
2863
3697
  onMouseDown: () => this.startStream()
2864
3698
  }
2865
- ), this.streamData.isLive && /* @__PURE__ */ ReactEcs5.createElement(
2866
- Button3,
3699
+ ), this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
3700
+ Button4,
2867
3701
  {
2868
3702
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2869
3703
  uiBackground: { color: this.streamControlling ? C2.btn : C2.red },
@@ -2872,18 +3706,18 @@ var AdminPanelUIModule = class {
2872
3706
  color: C2.text,
2873
3707
  onMouseDown: () => this.stopStream()
2874
3708
  }
2875
- ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs5.createElement(
2876
- Button3,
3709
+ ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs6.createElement(
3710
+ Button4,
2877
3711
  {
2878
3712
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2879
3713
  uiBackground: { color: C2.cyan },
2880
3714
  value: "Play on Screen",
2881
3715
  fontSize: t.buttonSmall,
2882
3716
  color: C2.text,
2883
- onMouseDown: () => this.config.onVideoPlay?.(this.streamData.hlsUrl)
3717
+ onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
2884
3718
  }
2885
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2886
- Button3,
3719
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3720
+ Button4,
2887
3721
  {
2888
3722
  uiTransform: { width: this.s(80), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2889
3723
  uiBackground: { color: C2.btn },
@@ -2892,8 +3726,8 @@ var AdminPanelUIModule = class {
2892
3726
  color: C2.text,
2893
3727
  onMouseDown: () => this.refreshStreamStatus()
2894
3728
  }
2895
- ), /* @__PURE__ */ ReactEcs5.createElement(
2896
- Button3,
3729
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3730
+ Button4,
2897
3731
  {
2898
3732
  uiTransform: { width: this.s(95), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2899
3733
  uiBackground: { color: this.keyRotating ? C2.btn : C2.yellow },
@@ -2902,8 +3736,8 @@ var AdminPanelUIModule = class {
2902
3736
  color: C2.text,
2903
3737
  onMouseDown: () => this.rotateStreamKey()
2904
3738
  }
2905
- ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ ReactEcs5.createElement(
2906
- Button3,
3739
+ ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ ReactEcs6.createElement(
3740
+ Button4,
2907
3741
  {
2908
3742
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2909
3743
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2912,8 +3746,8 @@ var AdminPanelUIModule = class {
2912
3746
  color: C2.text,
2913
3747
  onMouseDown: () => this.deleteChannel()
2914
3748
  }
2915
- )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ ReactEcs5.createElement(Label5, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2916
- Button3,
3749
+ )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ ReactEcs6.createElement(Label6, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3750
+ Button4,
2917
3751
  {
2918
3752
  uiTransform: { width: this.s(120), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2919
3753
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2922,8 +3756,8 @@ var AdminPanelUIModule = class {
2922
3756
  color: C2.text,
2923
3757
  onMouseDown: () => this.confirmDeleteChannel()
2924
3758
  }
2925
- ), /* @__PURE__ */ ReactEcs5.createElement(
2926
- Button3,
3759
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3760
+ Button4,
2927
3761
  {
2928
3762
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2929
3763
  uiBackground: { color: C2.btn },
@@ -2932,11 +3766,11 @@ var AdminPanelUIModule = class {
2932
3766
  color: C2.text,
2933
3767
  onMouseDown: () => this.cancelDeleteChannel()
2934
3768
  }
2935
- ))), this.streamControlStatus === "started" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3769
+ ))), this.streamControlStatus === "started" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
2936
3770
  Input4,
2937
3771
  {
2938
3772
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
2939
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3773
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
2940
3774
  placeholder: "Video URL...",
2941
3775
  placeholderColor: C2.textDim,
2942
3776
  color: C2.text,
@@ -2946,20 +3780,18 @@ var AdminPanelUIModule = class {
2946
3780
  this.customVideoUrl = val;
2947
3781
  }
2948
3782
  }
2949
- ), /* @__PURE__ */ ReactEcs5.createElement(
2950
- Button3,
3783
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3784
+ Button4,
2951
3785
  {
2952
3786
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
2953
3787
  uiBackground: { color: C2.green },
2954
3788
  value: "Play",
2955
3789
  fontSize: t.button,
2956
3790
  color: C2.text,
2957
- onMouseDown: () => {
2958
- if (this.customVideoUrl) this.config.onVideoPlay?.(this.customVideoUrl);
2959
- }
3791
+ onMouseDown: () => this.playNow()
2960
3792
  }
2961
- ), /* @__PURE__ */ ReactEcs5.createElement(
2962
- Button3,
3793
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3794
+ Button4,
2963
3795
  {
2964
3796
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 6 } },
2965
3797
  uiBackground: { color: C2.btn },
@@ -2970,55 +3802,82 @@ var AdminPanelUIModule = class {
2970
3802
  this.customVideoUrl = "";
2971
3803
  }
2972
3804
  }
2973
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2974
- Button3,
3805
+ )), this.videoStatus && /* @__PURE__ */ ReactEcs6.createElement(
3806
+ Label6,
3807
+ {
3808
+ value: this.videoStatus,
3809
+ fontSize: t.status,
3810
+ color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
3811
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3812
+ }
3813
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3814
+ Button4,
2975
3815
  {
2976
3816
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2977
3817
  uiBackground: { color: C2.green },
2978
3818
  value: "Play",
2979
3819
  fontSize: t.button,
2980
3820
  color: C2.text,
2981
- onMouseDown: () => this.config.onCommand?.("videoPlay", { playing: true })
3821
+ onMouseDown: () => this.playbackPlay()
2982
3822
  }
2983
- ), /* @__PURE__ */ ReactEcs5.createElement(
2984
- Button3,
3823
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3824
+ Button4,
2985
3825
  {
2986
3826
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2987
3827
  uiBackground: { color: C2.red },
2988
3828
  value: "Stop",
2989
3829
  fontSize: t.button,
2990
3830
  color: C2.text,
2991
- onMouseDown: () => this.config.onVideoStop?.()
3831
+ onMouseDown: () => this.playbackStop()
2992
3832
  }
2993
- ), /* @__PURE__ */ ReactEcs5.createElement(
2994
- Button3,
3833
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3834
+ Button4,
2995
3835
  {
2996
3836
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2997
3837
  uiBackground: { color: C2.btn },
2998
3838
  value: "Reset Default",
2999
3839
  fontSize: t.buttonSmall,
3000
3840
  color: C2.text,
3001
- onMouseDown: () => this.config.onCommand?.("videoClear", {})
3841
+ onMouseDown: () => this.resetDefault()
3002
3842
  }
3003
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(Button3, { 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__ */ ReactEcs5.createElement(Button3, { 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__ */ ReactEcs5.createElement(Button3, { 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__ */ ReactEcs5.createElement(Button3, { 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__ */ ReactEcs5.createElement(Button3, { 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__ */ ReactEcs5.createElement(
3004
- Button3,
3843
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, ["slot1", "slot2", "slot3", "slot4", "slot5"].map((slot, i) => /* @__PURE__ */ ReactEcs6.createElement(
3844
+ Button4,
3845
+ {
3846
+ key: `play-${slot}`,
3847
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3848
+ uiBackground: { color: C2.cyan },
3849
+ value: `Play ${i + 1}`,
3850
+ fontSize: t.button,
3851
+ color: C2.text,
3852
+ onMouseDown: () => this.pressSlot(slot)
3853
+ }
3854
+ ))), /* @__PURE__ */ ReactEcs6.createElement(
3855
+ Button4,
3005
3856
  {
3006
3857
  uiTransform: { height: this.s(24) },
3007
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
3858
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3008
3859
  value: "Edit slots at thestatic.tv",
3009
3860
  fontSize: t.labelSmall,
3010
3861
  color: C2.cyan,
3011
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3862
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3012
3863
  }
3013
3864
  ));
3014
3865
  };
3015
3866
  this.ModTab = () => {
3016
3867
  const t = this.theme;
3017
- return /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Error - check input", fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3868
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Error - check input", fontSize: t.status, color: C2.red }), this.kickStatus && /* @__PURE__ */ ReactEcs6.createElement(
3869
+ Label6,
3870
+ {
3871
+ value: this.kickStatus,
3872
+ fontSize: t.status,
3873
+ color: this.kickStatus.startsWith("Kick not sent") ? C2.red : C2.green,
3874
+ uiTransform: { height: this.s(18) }
3875
+ }
3876
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3018
3877
  Input4,
3019
3878
  {
3020
3879
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3021
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3880
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3022
3881
  placeholder: "Message to all players...",
3023
3882
  placeholderColor: C2.textDim,
3024
3883
  color: C2.text,
@@ -3028,8 +3887,8 @@ var AdminPanelUIModule = class {
3028
3887
  this.broadcastText = val;
3029
3888
  }
3030
3889
  }
3031
- ), /* @__PURE__ */ ReactEcs5.createElement(
3032
- Button3,
3890
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3891
+ Button4,
3033
3892
  {
3034
3893
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3035
3894
  uiBackground: { color: C2.orange },
@@ -3038,27 +3897,51 @@ var AdminPanelUIModule = class {
3038
3897
  color: C2.text,
3039
3898
  onMouseDown: () => this.sendBroadcast()
3040
3899
  }
3041
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3042
- Button3,
3900
+ )), this.broadcastStatus && /* @__PURE__ */ ReactEcs6.createElement(
3901
+ Label6,
3902
+ {
3903
+ value: this.broadcastStatus,
3904
+ fontSize: t.status,
3905
+ color: this.broadcastStatus.startsWith("Not sent") ? C2.red : C2.green,
3906
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3907
+ }
3908
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3909
+ Button4,
3043
3910
  {
3044
3911
  uiTransform: { width: this.s(130), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: 4 },
3045
3912
  uiBackground: { color: C2.red },
3046
3913
  value: "KICK ALL",
3047
3914
  fontSize: t.button,
3048
3915
  color: C2.text,
3049
- onMouseDown: () => {
3050
- this.log("KICK ALL clicked");
3051
- this.config.onCommand?.("kickAll", {});
3052
- }
3916
+ onMouseDown: () => this.kickAll()
3917
+ }
3918
+ )), this.venue && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PRIVATE MODE", color: C2.yellow }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "While ON, only citizens get in", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { height: this.s(18), margin: { bottom: 4 } } }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, [true, false].map((on) => /* @__PURE__ */ ReactEcs6.createElement(
3919
+ Button4,
3920
+ {
3921
+ key: `private-${on ? "on" : "off"}`,
3922
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3923
+ uiBackground: { color: this.privateModeOn === on ? C2.yellow : C2.btn },
3924
+ value: on ? "ON" : "OFF",
3925
+ fontSize: t.buttonSmall,
3926
+ color: this.privateModeOn === on ? Color46.Black() : C2.text,
3927
+ onMouseDown: () => this.setPrivateMode(on)
3928
+ }
3929
+ ))), this.privateStatus && /* @__PURE__ */ ReactEcs6.createElement(
3930
+ Label6,
3931
+ {
3932
+ value: this.privateStatus,
3933
+ fontSize: t.status,
3934
+ color: this.privateStatus.startsWith("Not sent") ? C2.red : C2.green,
3935
+ uiTransform: { height: this.s(18) }
3053
3936
  }
3054
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ ReactEcs5.createElement(
3055
- UiEntity5,
3937
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ ReactEcs6.createElement(
3938
+ UiEntity6,
3056
3939
  {
3057
3940
  key: `admin-${i}`,
3058
3941
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3059
3942
  },
3060
- /* @__PURE__ */ ReactEcs5.createElement(
3061
- Label5,
3943
+ /* @__PURE__ */ ReactEcs6.createElement(
3944
+ Label6,
3062
3945
  {
3063
3946
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3064
3947
  fontSize: t.label,
@@ -3066,8 +3949,8 @@ var AdminPanelUIModule = class {
3066
3949
  uiTransform: { width: this.s(130) }
3067
3950
  }
3068
3951
  ),
3069
- /* @__PURE__ */ ReactEcs5.createElement(
3070
- Button3,
3952
+ /* @__PURE__ */ ReactEcs6.createElement(
3953
+ Button4,
3071
3954
  {
3072
3955
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3073
3956
  uiBackground: { color: C2.btn },
@@ -3077,11 +3960,11 @@ var AdminPanelUIModule = class {
3077
3960
  onMouseDown: () => this.removeSceneAdmin(wallet)
3078
3961
  }
3079
3962
  )
3080
- ))), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3963
+ ))), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3081
3964
  Input4,
3082
3965
  {
3083
3966
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3084
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3967
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3085
3968
  placeholder: "0x... add admin",
3086
3969
  placeholderColor: C2.textDim,
3087
3970
  color: C2.text,
@@ -3091,8 +3974,8 @@ var AdminPanelUIModule = class {
3091
3974
  this.newAdminWallet = val;
3092
3975
  }
3093
3976
  }
3094
- ), /* @__PURE__ */ ReactEcs5.createElement(
3095
- Button3,
3977
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3978
+ Button4,
3096
3979
  {
3097
3980
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3098
3981
  uiBackground: { color: C2.purple },
@@ -3103,14 +3986,14 @@ var AdminPanelUIModule = class {
3103
3986
  if (this.newAdminWallet) this.addSceneAdmin(this.newAdminWallet);
3104
3987
  }
3105
3988
  }
3106
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ ReactEcs5.createElement(
3107
- UiEntity5,
3989
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ ReactEcs6.createElement(
3990
+ UiEntity6,
3108
3991
  {
3109
3992
  key: `ban-${i}`,
3110
3993
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3111
3994
  },
3112
- /* @__PURE__ */ ReactEcs5.createElement(
3113
- Label5,
3995
+ /* @__PURE__ */ ReactEcs6.createElement(
3996
+ Label6,
3114
3997
  {
3115
3998
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3116
3999
  fontSize: t.label,
@@ -3118,8 +4001,8 @@ var AdminPanelUIModule = class {
3118
4001
  uiTransform: { width: this.s(130) }
3119
4002
  }
3120
4003
  ),
3121
- /* @__PURE__ */ ReactEcs5.createElement(
3122
- Button3,
4004
+ /* @__PURE__ */ ReactEcs6.createElement(
4005
+ Button4,
3123
4006
  {
3124
4007
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3125
4008
  uiBackground: { color: C2.green },
@@ -3129,11 +4012,11 @@ var AdminPanelUIModule = class {
3129
4012
  onMouseDown: () => this.unbanWallet(wallet)
3130
4013
  }
3131
4014
  )
3132
- ))), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(
4015
+ ))), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3133
4016
  Input4,
3134
4017
  {
3135
4018
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3136
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
4019
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3137
4020
  placeholder: "0x... ban wallet",
3138
4021
  placeholderColor: C2.textDim,
3139
4022
  color: C2.text,
@@ -3143,8 +4026,8 @@ var AdminPanelUIModule = class {
3143
4026
  this.newBanWallet = val;
3144
4027
  }
3145
4028
  }
3146
- ), /* @__PURE__ */ ReactEcs5.createElement(
3147
- Button3,
4029
+ ), /* @__PURE__ */ ReactEcs6.createElement(
4030
+ Button4,
3148
4031
  {
3149
4032
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3150
4033
  uiBackground: { color: C2.red },
@@ -3155,15 +4038,15 @@ var AdminPanelUIModule = class {
3155
4038
  if (this.newBanWallet) this.banWallet(this.newBanWallet);
3156
4039
  }
3157
4040
  }
3158
- )), /* @__PURE__ */ ReactEcs5.createElement(
3159
- Button3,
4041
+ )), /* @__PURE__ */ ReactEcs6.createElement(
4042
+ Button4,
3160
4043
  {
3161
4044
  uiTransform: { height: this.s(24) },
3162
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
4045
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3163
4046
  value: "Manage at thestatic.tv",
3164
4047
  fontSize: t.labelSmall,
3165
4048
  color: C2.cyan,
3166
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4049
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3167
4050
  }
3168
4051
  ));
3169
4052
  };
@@ -3172,11 +4055,24 @@ var AdminPanelUIModule = class {
3172
4055
  * Always renders notification (scaled), admin panel only for admins
3173
4056
  */
3174
4057
  this.getComponent = () => {
4058
+ if (this.moderation.blocked) {
4059
+ return BlockedNotice({
4060
+ standing: this.moderation.standing,
4061
+ kickLeftMs: this.moderation.kickLeftMs,
4062
+ scale: this.client.uiScale,
4063
+ // thestatic.tv's own origin, for a private event's BECOME A CITIZEN (2026-11-19): the API base less its path, as
4064
+ // the chat's REGISTER IDENTITY derives its /login
4065
+ siteUrl: this.baseUrl.replace("/api/v1/dcl", "")
4066
+ });
4067
+ }
3175
4068
  if (!this.isAdmin) {
3176
4069
  return this.renderScaledNotification();
3177
4070
  }
3178
4071
  const t = this.theme;
3179
4072
  const tabs = [];
4073
+ if (this.venue && this.controls.length > 0) {
4074
+ tabs.push({ label: "CONTROLS", id: "controls" });
4075
+ }
3180
4076
  if (this.config.sceneTabs && this.config.sceneTabs.length > 0) {
3181
4077
  this.config.sceneTabs.forEach((tab) => tabs.push({ label: tab.label, id: tab.id }));
3182
4078
  }
@@ -3189,8 +4085,8 @@ var AdminPanelUIModule = class {
3189
4085
  if (!tabs.find((tab) => tab.id === this.activeTab) && tabs.length > 0) {
3190
4086
  this.activeTab = tabs[0].id;
3191
4087
  }
3192
- return /* @__PURE__ */ ReactEcs5.createElement(
3193
- UiEntity5,
4088
+ return /* @__PURE__ */ ReactEcs6.createElement(
4089
+ UiEntity6,
3194
4090
  {
3195
4091
  uiTransform: {
3196
4092
  width: "100%",
@@ -3199,16 +4095,16 @@ var AdminPanelUIModule = class {
3199
4095
  }
3200
4096
  },
3201
4097
  this.renderScaledNotification(),
3202
- /* @__PURE__ */ ReactEcs5.createElement(
3203
- UiEntity5,
4098
+ /* @__PURE__ */ ReactEcs6.createElement(
4099
+ UiEntity6,
3204
4100
  {
3205
4101
  uiTransform: {
3206
4102
  position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
3207
4103
  positionType: "absolute"
3208
4104
  }
3209
4105
  },
3210
- /* @__PURE__ */ ReactEcs5.createElement(
3211
- Button3,
4106
+ /* @__PURE__ */ ReactEcs6.createElement(
4107
+ Button4,
3212
4108
  {
3213
4109
  uiTransform: { width: this.s(100), height: this.s(45) },
3214
4110
  uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
@@ -3219,8 +4115,8 @@ var AdminPanelUIModule = class {
3219
4115
  }
3220
4116
  )
3221
4117
  ),
3222
- this.panelOpen && /* @__PURE__ */ ReactEcs5.createElement(
3223
- UiEntity5,
4118
+ this.panelOpen && /* @__PURE__ */ ReactEcs6.createElement(
4119
+ UiEntity6,
3224
4120
  {
3225
4121
  key: `admin-panel-${this.client.uiScale}`,
3226
4122
  uiTransform: {
@@ -3233,8 +4129,8 @@ var AdminPanelUIModule = class {
3233
4129
  },
3234
4130
  uiBackground: { color: C2.bg }
3235
4131
  },
3236
- /* @__PURE__ */ ReactEcs5.createElement(
3237
- UiEntity5,
4132
+ /* @__PURE__ */ ReactEcs6.createElement(
4133
+ UiEntity6,
3238
4134
  {
3239
4135
  uiTransform: {
3240
4136
  width: "100%",
@@ -3246,12 +4142,12 @@ var AdminPanelUIModule = class {
3246
4142
  },
3247
4143
  uiBackground: { color: C2.header }
3248
4144
  },
3249
- /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
3250
- /* @__PURE__ */ ReactEcs5.createElement(
3251
- Button3,
4145
+ /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
4146
+ /* @__PURE__ */ ReactEcs6.createElement(
4147
+ Button4,
3252
4148
  {
3253
4149
  uiTransform: { width: this.s(28), height: this.s(28) },
3254
- uiBackground: { color: Color45.create(0, 0, 0, 0.3) },
4150
+ uiBackground: { color: Color46.create(0, 0, 0, 0.3) },
3255
4151
  value: "X",
3256
4152
  fontSize: t.header,
3257
4153
  color: THEME.colors.red,
@@ -3259,9 +4155,9 @@ var AdminPanelUIModule = class {
3259
4155
  }
3260
4156
  )
3261
4157
  ),
3262
- /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ ReactEcs5.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
3263
- /* @__PURE__ */ ReactEcs5.createElement(
3264
- UiEntity5,
4158
+ /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ ReactEcs6.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
4159
+ /* @__PURE__ */ ReactEcs6.createElement(
4160
+ UiEntity6,
3265
4161
  {
3266
4162
  uiTransform: {
3267
4163
  width: "100%",
@@ -3270,12 +4166,13 @@ var AdminPanelUIModule = class {
3270
4166
  flexDirection: "column"
3271
4167
  }
3272
4168
  },
3273
- this.activeTab === "video" && /* @__PURE__ */ ReactEcs5.createElement(this.VideoTab, null),
3274
- this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ ReactEcs5.createElement(this.ModTab, null),
4169
+ this.activeTab === "controls" && this.venue && this.controls.length > 0 && /* @__PURE__ */ ReactEcs6.createElement(this.ControlsTab, null),
4170
+ this.activeTab === "video" && /* @__PURE__ */ ReactEcs6.createElement(this.VideoTab, null),
4171
+ this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ ReactEcs6.createElement(this.ModTab, null),
3275
4172
  this.config.sceneTabs?.map((tab) => this.activeTab === tab.id && tab.render())
3276
4173
  ),
3277
- /* @__PURE__ */ ReactEcs5.createElement(
3278
- UiEntity5,
4174
+ /* @__PURE__ */ ReactEcs6.createElement(
4175
+ UiEntity6,
3279
4176
  {
3280
4177
  uiTransform: {
3281
4178
  width: "100%",
@@ -3285,15 +4182,15 @@ var AdminPanelUIModule = class {
3285
4182
  },
3286
4183
  uiBackground: { color: C2.section }
3287
4184
  },
3288
- /* @__PURE__ */ ReactEcs5.createElement(
3289
- Button3,
4185
+ /* @__PURE__ */ ReactEcs6.createElement(
4186
+ Button4,
3290
4187
  {
3291
4188
  uiTransform: { height: this.s(24) },
3292
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
4189
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3293
4190
  value: `thestatic.tv/scene/${this.config.sceneId}`,
3294
4191
  fontSize: t.labelSmall,
3295
4192
  color: C2.cyan,
3296
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4193
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3297
4194
  }
3298
4195
  )
3299
4196
  )
@@ -3314,14 +4211,41 @@ var AdminPanelUIModule = class {
3314
4211
  // Ensure sceneId is set
3315
4212
  };
3316
4213
  this.baseUrl = client.getBaseUrl();
4214
+ this.moderation = new ModerationModule({
4215
+ reread: () => this.checkAdminStatus(),
4216
+ myWallet: () => this.myWallet(),
4217
+ onChange: (blocked, standing) => this.onStandingChange(blocked, standing),
4218
+ log: (msg, ...args) => this.log(msg, ...args)
4219
+ });
4220
+ this.adminWait = new PlayerWait({
4221
+ getPlayer: () => getPlayer2(),
4222
+ setInterval: dclSetInterval,
4223
+ clearInterval: dclClearInterval,
4224
+ check: (player) => this.checkAdminFor(player),
4225
+ log: (msg) => this.log(msg)
4226
+ });
3317
4227
  if (config.headerColor) {
3318
- C2.header = Color45.create(
4228
+ C2.header = Color46.create(
3319
4229
  config.headerColor.r,
3320
4230
  config.headerColor.g,
3321
4231
  config.headerColor.b,
3322
4232
  config.headerColor.a
3323
4233
  );
3324
4234
  }
4235
+ if (config.controls && config.controls.length > 0) this.registerControls(config.controls);
4236
+ }
4237
+ kickLine(sent) {
4238
+ return { sent, notSent: "Kick not sent", show: (line) => {
4239
+ this.kickStatus = line;
4240
+ } };
4241
+ }
4242
+ /**
4243
+ * The Venue tier (2026-11-19): scene controls and private mode are Venue's, so the CONTROLS tab, the declaration's
4244
+ * upload, a press, the saved state's read, a queued control's run and the private-mode switch all need it. The
4245
+ * client knows it from the session start, before this panel exists.
4246
+ */
4247
+ get venue() {
4248
+ return this.client.hasVenueFeatures === true;
3325
4249
  }
3326
4250
  log(msg, ...args) {
3327
4251
  if (this.config.debug) {
@@ -3340,26 +4264,36 @@ var AdminPanelUIModule = class {
3340
4264
  * Initialize the admin panel - checks admin status and fetches video state
3341
4265
  */
3342
4266
  async init() {
4267
+ this.moderation.start().catch(() => {
4268
+ });
3343
4269
  await this.checkAdminStatus();
3344
4270
  await this.fetchVideoState();
3345
4271
  this.autoPlayDefault();
4272
+ this.loadReadsDone = true;
4273
+ await this.readSavedState();
3346
4274
  this.startCommandPolling();
3347
4275
  this.log("Initialized");
3348
4276
  }
3349
4277
  /**
3350
- * Check if current player is an admin for this scene
4278
+ * Check if current player is an admin for this scene. With no player yet it waits for one on the SDK's timer and
4279
+ * checks then (utils/player-wait.ts): one wait at a time, ended quietly after 30 s with no wallet. A guest reading
4280
+ * (isGuest true) is checked at once and the wait goes on for a non-guest reading, checked once more if one comes
4281
+ * within the 30 s. Resolves when the check is done, or at once when there is none to run.
3351
4282
  */
3352
4283
  async checkAdminStatus() {
3353
- const player = getPlayer2();
3354
- if (!player?.userId) {
3355
- this.log("No player data yet");
3356
- return;
3357
- }
4284
+ await this.adminWait.run();
4285
+ }
4286
+ /** The admin check proper, for a player the explorer has resolved */
4287
+ async checkAdminFor(player) {
3358
4288
  this.playerWallet = player.userId;
3359
4289
  if (this.config.forceAdmin) {
3360
4290
  this.isAdmin = true;
3361
4291
  this.isOwner = true;
4292
+ this.moderation.applyStanding({ isBanned: false, canModerate: true });
3362
4293
  this.log("Admin status FORCED (forceAdmin: true)");
4294
+ this.uploadControls().catch(() => {
4295
+ });
4296
+ this.client.frames?.adminCheckSucceeded();
3363
4297
  return;
3364
4298
  }
3365
4299
  try {
@@ -3370,17 +4304,54 @@ var AdminPanelUIModule = class {
3370
4304
  const data = await res.json();
3371
4305
  this.isAdmin = data.showButton ?? data.hasAccess;
3372
4306
  this.isOwner = data.isOwner || data.isSceneAdmin;
3373
- if (data.isBanned) {
4307
+ const wasBanned = this.moderation.standing === "banned";
4308
+ if (typeof data.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
4309
+ this.moderation.applyStanding({
4310
+ isBanned: data.isBanned === true,
4311
+ canModerate: data.showButton === true || data.hasAccess === true,
4312
+ privateBlocked: data.privateBlocked === true,
4313
+ isCitizen: data.isCitizen === true
4314
+ });
4315
+ if (data.isBanned === true && !wasBanned) {
3374
4316
  this.config.onBroadcast?.("You have been banned from this scene.");
3375
- this.banKickPlayer();
3376
- this.log("Player is banned - kicking");
4317
+ this.log("Player is banned - blocked");
3377
4318
  }
3378
4319
  this.log("Admin status:", this.isAdmin, "Owner:", this.isOwner);
4320
+ if (this.isAdmin) this.uploadControls().catch(() => {
4321
+ });
4322
+ if (this.isAdmin) this.client.frames?.adminCheckSucceeded();
3379
4323
  }
3380
4324
  } catch (err) {
3381
4325
  this.log("Admin check error:", err);
3382
4326
  }
3383
4327
  }
4328
+ /** My wallet, lowercased: admin-check's player, else the explorer's */
4329
+ myWallet() {
4330
+ let wallet = this.playerWallet;
4331
+ if (!wallet) {
4332
+ try {
4333
+ wallet = getPlayer2()?.userId || "";
4334
+ } catch {
4335
+ wallet = "";
4336
+ }
4337
+ }
4338
+ return wallet ? wallet.toLowerCase() : null;
4339
+ }
4340
+ /** Blocked turned on or off: the panel closes, and the client stops what it plays and tells the scene */
4341
+ onStandingChange(blocked, standing) {
4342
+ if (blocked) this.hide();
4343
+ this.client._onBlockedChange?.(blocked, standing);
4344
+ }
4345
+ /** True while this visitor is banned or kicked (2026-11-17) */
4346
+ get isVisitorBlocked() {
4347
+ return this.moderation.blocked;
4348
+ }
4349
+ /** A url the scene's queue or the slots would play - nothing while this visitor is blocked */
4350
+ playUrl(url) {
4351
+ if (this.moderation.blocked) return;
4352
+ this.currentVideoUrl = url;
4353
+ this.config.onVideoPlay?.(url);
4354
+ }
3384
4355
  /**
3385
4356
  * Toggle the admin panel open/closed
3386
4357
  */
@@ -3432,6 +4403,128 @@ var AdminPanelUIModule = class {
3432
4403
  this.config.sceneTabs.push(tab);
3433
4404
  this.log("Registered scene tab:", tab.label);
3434
4405
  }
4406
+ // --- Scene controls (2026-11-18; Venue since 2026-11-19, Pro until then) ---
4407
+ /**
4408
+ * Register scene controls: the CONTROLS tab draws them, a press reaches every visitor's copy through the scene's
4409
+ * queue, and the declaration goes to the scene's record once an admin's check has succeeded. The same as the config's
4410
+ * `controls`; a control registered again by id replaces the earlier one. Only the shape is checked here - thestatic.tv
4411
+ * checks the ids, labels and bounds when the declaration is uploaded, and every press against it.
4412
+ */
4413
+ registerControls(controls) {
4414
+ for (const control of controls) {
4415
+ if (!control || typeof control.id !== "string" || !Array.isArray(control.options) || typeof control.onChange !== "function") {
4416
+ this.log("Scene control skipped - not a SceneControl:", control);
4417
+ continue;
4418
+ }
4419
+ const at = this.controls.findIndex((c) => c.id === control.id);
4420
+ if (at >= 0) this.controls[at] = control;
4421
+ else this.controls.push(control);
4422
+ }
4423
+ this.log("Registered scene controls:", this.controls.map((c) => c.id));
4424
+ this.readSavedState().catch(() => {
4425
+ });
4426
+ this.uploadControls().catch(() => {
4427
+ });
4428
+ }
4429
+ /** True when `option` is one of the control's, or 'off' on a control that has OFF */
4430
+ isControlOption(control, option) {
4431
+ if (option === "off") return control.off === true;
4432
+ return control.options.some((o) => o.id === option);
4433
+ }
4434
+ /** A queued sceneControl's registered control and valid option, or null for anything else */
4435
+ controlCommand(payload) {
4436
+ const p = payload;
4437
+ if (!p || typeof p.control !== "string" || typeof p.option !== "string") return null;
4438
+ const control = this.controls.find((c) => c.id === p.control);
4439
+ if (!control || !this.isControlOption(control, p.option)) return null;
4440
+ return { control, option: p.option };
4441
+ }
4442
+ /** Run a control's option on this copy and mark it current; a handler that throws is logged and breaks nothing else */
4443
+ applyControl(control, option) {
4444
+ this.currentOption[control.id] = option;
4445
+ try {
4446
+ control.onChange(option);
4447
+ } catch (err) {
4448
+ this.log("Control handler failed:", control.id, option, err);
4449
+ }
4450
+ }
4451
+ /** A press in the CONTROLS tab: this copy runs it at once, then everyone's through the queue (Venue, 2026-11-19) */
4452
+ async pressControl(control, option) {
4453
+ if (!this.venue) return;
4454
+ this.applyControl(control, option);
4455
+ await this.sendSceneCommand("sceneControl", { control: control.id, option }, this.controlLine);
4456
+ }
4457
+ /**
4458
+ * The saved option of every persist control, read once a load from the scene's public state route - after the admin
4459
+ * check and the video state, before the poll starts - and run on this copy, so a late arrival sees what the last
4460
+ * 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
4461
+ * option keeps the scene's own default.
4462
+ */
4463
+ async readSavedState() {
4464
+ if (this.stateRead || !this.loadReadsDone || !this.venue) return;
4465
+ const persisted = this.controls.filter((c) => c.persist === true);
4466
+ if (persisted.length === 0) return;
4467
+ this.stateRead = true;
4468
+ try {
4469
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/state`);
4470
+ if (!res.ok) {
4471
+ this.log("Scene state read refused:", res.status);
4472
+ return;
4473
+ }
4474
+ const data = await res.json();
4475
+ const state = data && typeof data.state === "object" && data.state !== null ? data.state : {};
4476
+ for (const control of persisted) {
4477
+ const saved = state[control.id];
4478
+ if (typeof saved === "string" && this.isControlOption(control, saved)) {
4479
+ this.log("Saved control option:", control.id, saved);
4480
+ this.applyControl(control, saved);
4481
+ }
4482
+ }
4483
+ } catch (err) {
4484
+ this.log("Scene state read error:", err);
4485
+ }
4486
+ }
4487
+ /**
4488
+ * The declaration - each control's id, label, options, off and persist, never its handler - posted once a load to the
4489
+ * scene's record on thestatic.tv, from a copy whose admin check succeeded, so the scene's page draws the same buttons.
4490
+ * thestatic.tv checks the shape and bounds and writes only a declaration that differs. A refusal is logged, never
4491
+ * shown to the visitor, and not retried in this load.
4492
+ */
4493
+ async uploadControls() {
4494
+ if (this.controlsUploaded || !this.isAdmin || !this.venue || this.controls.length === 0) return;
4495
+ this.controlsUploaded = true;
4496
+ const controls = this.controls.map((c) => ({
4497
+ id: c.id,
4498
+ label: c.label,
4499
+ options: c.options.map((o) => ({ id: o.id, label: o.label })),
4500
+ off: c.off === true,
4501
+ persist: c.persist === true
4502
+ }));
4503
+ try {
4504
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/config`, {
4505
+ method: "POST",
4506
+ headers: { "Content-Type": "application/json" },
4507
+ body: JSON.stringify({ controls })
4508
+ });
4509
+ if (res.ok) {
4510
+ this.log("Scene controls declared:", controls.map((c) => c.id));
4511
+ return;
4512
+ }
4513
+ const data = await res.json().catch(() => ({}));
4514
+ this.log("Scene controls declaration refused:", res.status, data.error);
4515
+ } catch (err) {
4516
+ this.log("Scene controls declaration error:", err);
4517
+ }
4518
+ }
4519
+ /** Remember a command id the poll has run or this copy has sent, forgetting the oldest past SEEN_COMMAND_IDS_MAX */
4520
+ markCommandSeen(id) {
4521
+ if (this.seenCommandIds.has(id)) return;
4522
+ this.seenCommandIds.add(id);
4523
+ this.seenCommandOrder.push(id);
4524
+ while (this.seenCommandOrder.length > SEEN_COMMAND_IDS_MAX) {
4525
+ this.seenCommandIds.delete(this.seenCommandOrder.shift());
4526
+ }
4527
+ }
3435
4528
  // --- Stream Polling ---
3436
4529
  startStreamPolling() {
3437
4530
  if (this.pollIntervalId !== null) return;
@@ -3472,52 +4565,91 @@ var AdminPanelUIModule = class {
3472
4565
  * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3473
4566
  */
3474
4567
  async signedRequest(url, init = {}) {
3475
- const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
4568
+ const res = await signedFetch3({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3476
4569
  return {
3477
4570
  ok: res.ok,
3478
4571
  status: res.status,
3479
4572
  json: async () => res.body ? JSON.parse(res.body) : {}
3480
4573
  };
3481
4574
  }
4575
+ /**
4576
+ * 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
4577
+ * cursor back as `since` once it has one - the first poll has none, so the 30-second replay on load stays, which the
4578
+ * kicks rely on - and tells commands apart by id: a bounded set of the last SEEN_COMMAND_IDS_MAX, this copy's own
4579
+ * sends among them (a press is not run twice here), so two commands in one millisecond both run. A command with no id
4580
+ * falls back to the timestamp rule every command used until then, and a server that answers no cursor (production
4581
+ * before 2026-11-18) gets no since and is read as before.
4582
+ */
3482
4583
  async pollCommands() {
3483
4584
  try {
3484
- const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
4585
+ const since = this.commandCursor !== null ? `?since=${this.commandCursor}` : "";
4586
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands${since}`);
3485
4587
  if (!res.ok) return;
3486
4588
  const data = await res.json();
3487
4589
  const commands = data.commands || [];
4590
+ if (typeof data.cursor === "number") this.commandCursor = data.cursor;
3488
4591
  for (const cmd of commands) {
3489
- if (cmd.timestamp <= this.lastCommandTimestamp) continue;
3490
- this.lastCommandTimestamp = cmd.timestamp;
3491
- if (cmd.type === "broadcast" && cmd.payload?.text) {
3492
- const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
3493
- this.log("Received broadcast:", msg);
3494
- this.config.onBroadcast?.(msg);
3495
- } else if (cmd.type === "clearBroadcast") {
3496
- this.log("Received clearBroadcast");
3497
- hideNotification();
3498
- } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
3499
- this.log("Received video play:", cmd.type, cmd.payload.url);
3500
- this.config.onVideoPlay?.(cmd.payload.url);
3501
- } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
3502
- this.log("Received video stop/clear:", cmd.type);
3503
- this.config.onVideoStop?.();
3504
- } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
3505
- const slotId = cmd.payload.slot;
3506
- if (cmd.payload.url) {
3507
- this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
3508
- this.config.onVideoPlay?.(cmd.payload.url);
3509
- } else {
3510
- this.log("Received videoPlaySlot:", slotId);
3511
- this.playSlot(slotId);
3512
- }
3513
- } else if (this.config.onCommand) {
3514
- this.log("Received command:", cmd.type, cmd.payload);
3515
- this.config.onCommand(cmd.type, cmd.payload);
4592
+ if (typeof cmd.id === "string" && cmd.id !== "") {
4593
+ if (this.seenCommandIds.has(cmd.id)) continue;
4594
+ this.markCommandSeen(cmd.id);
4595
+ if (typeof cmd.timestamp === "number" && cmd.timestamp > this.lastCommandTimestamp) this.lastCommandTimestamp = cmd.timestamp;
4596
+ } else {
4597
+ if (cmd.timestamp <= this.lastCommandTimestamp) continue;
4598
+ this.lastCommandTimestamp = cmd.timestamp;
4599
+ }
4600
+ try {
4601
+ this.runCommand(cmd);
4602
+ } catch (err) {
4603
+ this.log("Command handler failed:", cmd.type, err);
3516
4604
  }
3517
4605
  }
3518
4606
  } catch (err) {
3519
4607
  }
3520
4608
  }
4609
+ /** One queued command on this copy: the SDK's own types here, a registered control's option, else the scene's onCommand */
4610
+ runCommand(cmd) {
4611
+ const control = cmd.type === "sceneControl" && this.venue ? this.controlCommand(cmd.payload) : null;
4612
+ if (cmd.type === "broadcast" && cmd.payload?.text) {
4613
+ const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
4614
+ this.log("Received broadcast:", msg);
4615
+ this.config.onBroadcast?.(msg);
4616
+ } else if (cmd.type === "clearBroadcast") {
4617
+ this.log("Received clearBroadcast");
4618
+ hideNotification();
4619
+ } else if (cmd.type === "kickBanned" || cmd.type === "kickAll") {
4620
+ this.log("Received kick:", cmd.type, cmd.payload);
4621
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4622
+ this.config.onCommand?.(cmd.type, cmd.payload);
4623
+ } else if (cmd.type === "privateMode" && this.venue) {
4624
+ this.log("Received privateMode - re-reading my standing");
4625
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4626
+ } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
4627
+ this.log("Received video play:", cmd.type, cmd.payload.url);
4628
+ this.playUrl(cmd.payload.url);
4629
+ } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
4630
+ this.log("Received video stop/clear:", cmd.type);
4631
+ if (cmd.type === "videoClear") this.currentVideoUrl = null;
4632
+ this.config.onVideoStop?.();
4633
+ } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
4634
+ const slotId = cmd.payload.slot;
4635
+ if (cmd.payload.url) {
4636
+ this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
4637
+ this.playUrl(cmd.payload.url);
4638
+ } else {
4639
+ this.log("Received videoPlaySlot:", slotId);
4640
+ this.playSlot(slotId);
4641
+ }
4642
+ } else if (cmd.type === "framesRefresh") {
4643
+ this.log("Received framesRefresh");
4644
+ this.client.frames?.refresh();
4645
+ } else if (control) {
4646
+ this.log("Received scene control:", control.control.id, control.option);
4647
+ this.applyControl(control.control, control.option);
4648
+ } else if (this.config.onCommand) {
4649
+ this.log("Received command:", cmd.type, cmd.payload);
4650
+ this.config.onCommand(cmd.type, cmd.payload);
4651
+ }
4652
+ }
3521
4653
  // --- Stream API Calls ---
3522
4654
  async fetchStreamData() {
3523
4655
  if (this.streamFetched || !this.playerWallet) return;
@@ -3559,6 +4691,7 @@ var AdminPanelUIModule = class {
3559
4691
  defaultSlot: data.defaultSlot || null,
3560
4692
  videoSlots: data.videoSlots || {}
3561
4693
  };
4694
+ if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
3562
4695
  this.videoStateFetched = true;
3563
4696
  this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
3564
4697
  }
@@ -3573,7 +4706,7 @@ var AdminPanelUIModule = class {
3573
4706
  const slot = this.videoState?.videoSlots?.[slotId];
3574
4707
  if (slot?.url) {
3575
4708
  this.log("Playing slot:", slotId, slot.url);
3576
- this.config.onVideoPlay?.(slot.url);
4709
+ this.playUrl(slot.url);
3577
4710
  } else {
3578
4711
  this.log("Slot has no URL:", slotId);
3579
4712
  this.config.onVideoSlotPlay?.(slotId);
@@ -3588,7 +4721,7 @@ var AdminPanelUIModule = class {
3588
4721
  const slot = this.videoState.videoSlots?.[defaultSlot];
3589
4722
  if (slot?.url) {
3590
4723
  this.log("Auto-playing default slot:", defaultSlot);
3591
- this.config.onVideoPlay?.(slot.url);
4724
+ this.playUrl(slot.url);
3592
4725
  }
3593
4726
  }
3594
4727
  async createChannel() {
@@ -3940,6 +5073,7 @@ var AdminPanelUIModule = class {
3940
5073
  this.modStatus = "saved";
3941
5074
  this.log("Banned wallet:", normalized);
3942
5075
  this.config.onCommand?.("kickBanned", { wallet: normalized });
5076
+ await this.sendSceneCommand("kickBanned", { wallet: normalized }, this.kickLine("Banned and kicked"));
3943
5077
  } else {
3944
5078
  this.modStatus = "error";
3945
5079
  }
@@ -3974,15 +5108,142 @@ var AdminPanelUIModule = class {
3974
5108
  this.log("Unban error:", err);
3975
5109
  }
3976
5110
  }
3977
- banKickPlayer() {
3978
- movePlayerTo({ newRelativePosition: BAN_KICK_POSITION });
3979
- this.log("Player ban-kicked");
5111
+ /**
5112
+ * Queue a command on thestatic.tv for every visitor's copy of the scene (2026-11-17): a signed POST to the scene's
5113
+ * commands route, which takes it from the scene's owner, an admin or an authorized user at the scene's registered
5114
+ * location, and which every copy's poll reads within its 30-second window. The one sender for the kicks, the scene
5115
+ * controls and, since 2026-11-18, the Video and Broadcast buttons; each shows what it came to on its section's own
5116
+ * line. The command id the server answers goes into the seen set, so this copy's poll does not run its own press a
5117
+ * second time. Returns that id (empty when the answer carries none), or null when the command was not sent.
5118
+ */
5119
+ async sendSceneCommand(type, payload, line) {
5120
+ const data = await this.sendSigned("commands", { type, payload }, line);
5121
+ if (data === null) return null;
5122
+ const id = typeof data.commandId === "string" ? data.commandId : "";
5123
+ if (id !== "") this.markCommandSeen(id);
5124
+ return id;
3980
5125
  }
5126
+ /**
5127
+ * The one signed sender's POST (2026-11-18; since 2026-11-19 private mode's switch goes through it too, to its own
5128
+ * route): signed as the presser to one of the scene's routes on thestatic.tv, which decides whether the presser may;
5129
+ * what it came to shown on the section's line in a control's four words. Returns the answer, or null when not sent.
5130
+ */
5131
+ async sendSigned(route, body, line) {
5132
+ try {
5133
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/${route}`, {
5134
+ method: "POST",
5135
+ headers: { "Content-Type": "application/json" },
5136
+ body: JSON.stringify(body)
5137
+ });
5138
+ const parsed = await res.json().catch(() => ({}));
5139
+ const data = parsed && typeof parsed === "object" ? parsed : {};
5140
+ if (res.ok) {
5141
+ line.show(line.sent);
5142
+ return data;
5143
+ }
5144
+ line.show(res.status === 401 || res.status === 403 ? `${line.notSent}: no access` : `${line.notSent}: HTTP ${res.status}`);
5145
+ this.log("Refused:", route, body.type ?? "", res.status, data.error);
5146
+ } catch (err) {
5147
+ line.show(`${line.notSent}: network error`);
5148
+ this.log("Send error:", route, err);
5149
+ }
5150
+ return null;
5151
+ }
5152
+ /**
5153
+ * PRIVATE MODE ON / OFF (2026-11-19, Venue; thestatic-hq docs/MERGE-CONTRACT-2026-11-19.md section 2): `{ on }` to
5154
+ * the scene's private route through the one signed sender. thestatic.tv decides who may switch it (its scene access
5155
+ * check) and queues `privateMode` for every copy, this one included, which re-reads its standing on it. The state
5156
+ * shown follows the server's answer, never the press.
5157
+ */
5158
+ async setPrivateMode(on) {
5159
+ if (!this.venue) return;
5160
+ const data = await this.sendSigned("private", { on }, this.privateLine);
5161
+ if (typeof data?.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
5162
+ }
5163
+ /** KICK ALL: every visitor who cannot moderate the scene is moved out and kept out for a while (2026-11-17) */
5164
+ async kickAll() {
5165
+ this.log("KICK ALL clicked");
5166
+ this.config.onCommand?.("kickAll", {});
5167
+ await this.sendSceneCommand("kickAll", {}, this.kickLine("KICK ALL sent"));
5168
+ }
5169
+ /**
5170
+ * BROADCAST (2026-11-18): queued for every visitor, as the scene's page on thestatic.tv sends it - `from` the presser's
5171
+ * display name, ADMIN when the explorer has none (the page's own default) - and shown here at once as everyone sees
5172
+ * it, `from: text`. Until then the in-world Send reached the presser's copy alone.
5173
+ */
3981
5174
  sendBroadcast() {
3982
- if (!this.broadcastText.trim()) return;
3983
- this.config.onBroadcast?.(this.broadcastText.trim());
5175
+ const text = this.broadcastText.trim();
5176
+ if (!text) return;
5177
+ const from = this.myName();
5178
+ this.config.onBroadcast?.(`${from}: ${text}`);
3984
5179
  this.broadcastText = "";
3985
5180
  this.log("Broadcast sent");
5181
+ this.sendSceneCommand("broadcast", { text, from }, this.broadcastLine).catch(() => {
5182
+ });
5183
+ }
5184
+ /** The presser's display name for a broadcast's from, ADMIN when the explorer has none; within the route's 100 */
5185
+ myName() {
5186
+ try {
5187
+ const name = getPlayer2()?.name;
5188
+ if (typeof name === "string" && name.trim() !== "") return name.trim().slice(0, 100);
5189
+ } catch {
5190
+ }
5191
+ return "ADMIN";
5192
+ }
5193
+ // --- The Video tab's buttons (2026-11-18): each does here at once what it did, then queues the same for everyone ---
5194
+ /** PLAY NOW: the typed url plays here and is queued as videoSetUrl, which thestatic.tv keeps for later arrivals */
5195
+ playNow() {
5196
+ const url = this.customVideoUrl.trim();
5197
+ if (!url) return;
5198
+ this.playUrl(url);
5199
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5200
+ });
5201
+ }
5202
+ /** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
5203
+ playStreamOnScreen(url) {
5204
+ this.playUrl(url);
5205
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5206
+ });
5207
+ }
5208
+ /** 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 */
5209
+ pressSlot(slotId) {
5210
+ this.playSlot(slotId);
5211
+ this.sendSceneCommand("videoPlaySlot", { slot: slotId }, this.videoLine).catch(() => {
5212
+ });
5213
+ }
5214
+ /**
5215
+ * PLAYBACK Play: the current video - the one the screen last played here, or the scene's current url from the video
5216
+ * state at load - plays again here and is queued as videoPlay with its url; with none known nothing is sent and the
5217
+ * line says so. onCommand gets ('videoPlay', { playing: true }) as it did before, for a scene that reads it.
5218
+ */
5219
+ playbackPlay() {
5220
+ this.config.onCommand?.("videoPlay", { playing: true });
5221
+ const url = this.currentVideoUrl;
5222
+ if (!url) {
5223
+ this.videoStatus = "Not sent: no video";
5224
+ return;
5225
+ }
5226
+ this.playUrl(url);
5227
+ this.sendSceneCommand("videoPlay", { url }, this.videoLine).catch(() => {
5228
+ });
5229
+ }
5230
+ /** Stop: the screen stops here and videoStop is queued for everyone */
5231
+ playbackStop() {
5232
+ this.config.onVideoStop?.();
5233
+ this.sendSceneCommand("videoStop", {}, this.videoLine).catch(() => {
5234
+ });
5235
+ }
5236
+ /**
5237
+ * Reset Default: the screen goes back to its default here - what every copy does on a queued videoClear - and
5238
+ * videoClear is queued, which also clears the scene's kept url on thestatic.tv. onCommand gets ('videoClear', {}) as
5239
+ * it did before.
5240
+ */
5241
+ resetDefault() {
5242
+ this.config.onCommand?.("videoClear", {});
5243
+ this.currentVideoUrl = null;
5244
+ this.config.onVideoStop?.();
5245
+ this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
5246
+ });
3986
5247
  }
3987
5248
  setActiveTab(tab) {
3988
5249
  const previousTab = this.activeTab;
@@ -3996,6 +5257,22 @@ var AdminPanelUIModule = class {
3996
5257
  this.stopStreamPolling();
3997
5258
  }
3998
5259
  }
5260
+ /** A control's button (2026-11-18): the option's label, highlighted while that option is current on this copy */
5261
+ controlButton(control, option, label) {
5262
+ const current = this.currentOption[control.id] === option;
5263
+ return /* @__PURE__ */ ReactEcs6.createElement(
5264
+ Button4,
5265
+ {
5266
+ key: `control-${control.id}-${option}`,
5267
+ uiTransform: { minWidth: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4, padding: { left: 10, right: 10 } },
5268
+ uiBackground: { color: current ? C2.cyan : C2.btn },
5269
+ value: label,
5270
+ fontSize: this.theme.buttonSmall,
5271
+ color: current ? Color46.Black() : C2.text,
5272
+ onMouseDown: () => this.pressControl(control, option)
5273
+ }
5274
+ );
5275
+ }
3999
5276
  /**
4000
5277
  * Render a scaled notification banner
4001
5278
  * Uses same layout as NotificationBanner but with scaled font size
@@ -4006,8 +5283,8 @@ var AdminPanelUIModule = class {
4006
5283
  if (!state.visible) return null;
4007
5284
  const N2 = UI_DIMENSIONS.notification;
4008
5285
  const colors = THEME.colors;
4009
- return /* @__PURE__ */ ReactEcs5.createElement(
4010
- UiEntity5,
5286
+ return /* @__PURE__ */ ReactEcs6.createElement(
5287
+ UiEntity6,
4011
5288
  {
4012
5289
  uiTransform: {
4013
5290
  positionType: "absolute",
@@ -4017,8 +5294,8 @@ var AdminPanelUIModule = class {
4017
5294
  alignItems: "center"
4018
5295
  }
4019
5296
  },
4020
- /* @__PURE__ */ ReactEcs5.createElement(
4021
- UiEntity5,
5297
+ /* @__PURE__ */ ReactEcs6.createElement(
5298
+ UiEntity6,
4022
5299
  {
4023
5300
  uiTransform: {
4024
5301
  minWidth: this.s(200),
@@ -4030,15 +5307,15 @@ var AdminPanelUIModule = class {
4030
5307
  },
4031
5308
  uiBackground: { color: colors.panel }
4032
5309
  },
4033
- /* @__PURE__ */ ReactEcs5.createElement(
4034
- UiEntity5,
5310
+ /* @__PURE__ */ ReactEcs6.createElement(
5311
+ UiEntity6,
4035
5312
  {
4036
5313
  uiTransform: { width: N2.borderWidth, height: "100%" },
4037
5314
  uiBackground: { color: colors.cyan }
4038
5315
  }
4039
5316
  ),
4040
- /* @__PURE__ */ ReactEcs5.createElement(
4041
- UiEntity5,
5317
+ /* @__PURE__ */ ReactEcs6.createElement(
5318
+ UiEntity6,
4042
5319
  {
4043
5320
  uiTransform: {
4044
5321
  flexGrow: 1,
@@ -4048,8 +5325,8 @@ var AdminPanelUIModule = class {
4048
5325
  alignItems: "center"
4049
5326
  }
4050
5327
  },
4051
- /* @__PURE__ */ ReactEcs5.createElement(
4052
- Label5,
5328
+ /* @__PURE__ */ ReactEcs6.createElement(
5329
+ Label6,
4053
5330
  {
4054
5331
  value: state.text,
4055
5332
  fontSize: this.s(N2.fontSize),
@@ -4058,8 +5335,8 @@ var AdminPanelUIModule = class {
4058
5335
  }
4059
5336
  )
4060
5337
  ),
4061
- /* @__PURE__ */ ReactEcs5.createElement(
4062
- UiEntity5,
5338
+ /* @__PURE__ */ ReactEcs6.createElement(
5339
+ UiEntity6,
4063
5340
  {
4064
5341
  uiTransform: { width: 5, height: 5, margin: { right: 10 } },
4065
5342
  uiBackground: { color: colors.cyan }
@@ -4113,9 +5390,13 @@ var StaticTVClient = class {
4113
5390
  this._keyId = null;
4114
5391
  this._disabled = false;
4115
5392
  this._tier = "free";
5393
+ /** Venue (2026-11-19): the server's flag beside a Pro tier; the event features need it */
5394
+ this._venue = false;
4116
5395
  this._standardFeaturesEnabled = false;
4117
5396
  this._proFeaturesEnabled = false;
4118
5397
  this._pendingProConfig = null;
5398
+ /** Controls registered before the admin panel exists (the tier not yet confirmed) - handed to it at init (2026-11-18) */
5399
+ this._pendingControls = [];
4119
5400
  this._featuresResolved = false;
4120
5401
  /** Guide module - fetch channel lineup (standard/pro tier) */
4121
5402
  this.guide = null;
@@ -4159,6 +5440,8 @@ var StaticTVClient = class {
4159
5440
  };
4160
5441
  this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
4161
5442
  this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
5443
+ this.frames = new FramesModule(this);
5444
+ if (config.frames) this.frames.register(config.frames);
4162
5445
  if (!config.apiKey) {
4163
5446
  this._disabled = true;
4164
5447
  this._keyType = null;
@@ -4289,7 +5572,7 @@ var StaticTVClient = class {
4289
5572
  * @internal
4290
5573
  */
4291
5574
  async signedRequest(endpoint, init = {}) {
4292
- const response = await signedFetch3({
5575
+ const response = await signedFetch4({
4293
5576
  url: `${this.apiUrl}${endpoint}`,
4294
5577
  init: {
4295
5578
  method: init.method || "POST",
@@ -4349,6 +5632,7 @@ var StaticTVClient = class {
4349
5632
  * @param url Video URL to play
4350
5633
  */
4351
5634
  playVideo(url) {
5635
+ if (this.isVisitorBlocked) return;
4352
5636
  const screen = this.config.videoScreen;
4353
5637
  if (screen !== void 0) {
4354
5638
  this.log(`Playing video: ${url}`);
@@ -4406,6 +5690,7 @@ var StaticTVClient = class {
4406
5690
  _playVideoInternal(url, isFallback = false, isLiveStream = false) {
4407
5691
  const screen = this.config.videoScreen;
4408
5692
  if (screen === void 0) return;
5693
+ if (this.isVisitorBlocked) return;
4409
5694
  this._clearVerificationTimeout();
4410
5695
  this._streamVerified = false;
4411
5696
  if (VideoPlayer.has(screen)) {
@@ -4529,6 +5814,7 @@ var StaticTVClient = class {
4529
5814
  */
4530
5815
  _handleGuideVideoSelect(video) {
4531
5816
  if (!video.src) return;
5817
+ if (this.isVisitorBlocked) return;
4532
5818
  this._pendingVideoData = video;
4533
5819
  const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
4534
5820
  this._playVideoWithVerification(video, isLiveStream);
@@ -4605,6 +5891,74 @@ var StaticTVClient = class {
4605
5891
  this.log(`Stream confirmed playing: ${this._pendingVideoData.name}`);
4606
5892
  }
4607
5893
  }
5894
+ /**
5895
+ * True while this visitor is banned from the scene or kicked out of it (Pro tier, 2026-11-17), or kept out by its
5896
+ * private mode (Venue, 2026-11-19): the SDK keeps them out of the scene's parcels, shows them only the notice and
5897
+ * plays them no video. A scene with its own media (a radio, its own screen) checks this, or passes
5898
+ * `onBlockedChange`, and stops it.
5899
+ */
5900
+ get isVisitorBlocked() {
5901
+ return this.adminPanel?.isVisitorBlocked ?? false;
5902
+ }
5903
+ /**
5904
+ * This visitor's standing: 'banned', 'kicked', 'private' (2026-11-19) or 'clear', in that precedence (always 'clear'
5905
+ * without the Pro tier's admin panel)
5906
+ */
5907
+ get visitorStanding() {
5908
+ return this.adminPanel?.moderation.standing ?? "clear";
5909
+ }
5910
+ /**
5911
+ * True when the last standing read said this visitor is a TheStatic.tv citizen - their wallet linked to an account
5912
+ * (2026-11-19). False before a read, from a server that does not answer it, and without the Pro tier's admin panel.
5913
+ * For a fresh answer, `checkCitizen()`.
5914
+ */
5915
+ get visitorIsCitizen() {
5916
+ return this.adminPanel?.moderation.isCitizen ?? false;
5917
+ }
5918
+ /**
5919
+ * Whether this visitor is a TheStatic.tv citizen, fresh (2026-11-19): a read of the scene's admin-check through the
5920
+ * moderation module - the last answer when it is under 5 s old, else the next read, gated as every standing read
5921
+ * is. False without the Pro tier's admin panel, and when no read has answered. A scene's citizens-only door asks
5922
+ * this instead of calling a route of its own; thestatic.tv answers it from the signed request, so a scene cannot
5923
+ * claim a citizen.
5924
+ */
5925
+ async checkCitizen() {
5926
+ if (!this.adminPanel) return false;
5927
+ try {
5928
+ return await this.adminPanel.moderation.checkCitizen();
5929
+ } catch {
5930
+ return false;
5931
+ }
5932
+ }
5933
+ /**
5934
+ * The admin panel's moderation reports blocked on or off (2026-11-17): the panels close, the SDK's own video
5935
+ * stops (and its fallback loop comes back once clear), the watch heartbeat stops, and the scene hears of it.
5936
+ * @internal
5937
+ */
5938
+ _onBlockedChange(blocked, standing) {
5939
+ const screen = this.config.videoScreen;
5940
+ if (blocked) {
5941
+ this.guideUI?.hide();
5942
+ this.chatUI?.hide();
5943
+ this.heartbeat?.stopWatching();
5944
+ this._pendingVideoData = null;
5945
+ this._clearVerificationTimeout();
5946
+ if (screen !== void 0 && VideoPlayer.has(screen)) {
5947
+ VideoPlayer.getMutable(screen).playing = false;
5948
+ }
5949
+ this._currentVideoUrl = "";
5950
+ } else if (screen !== void 0) {
5951
+ const fallbackUrl = this.config.fallbackVideoUrl !== void 0 ? this.config.fallbackVideoUrl : DEFAULT_FALLBACK_VIDEO;
5952
+ if (fallbackUrl !== "") this._playVideoInternal(fallbackUrl, true);
5953
+ }
5954
+ if (this.config.onBlockedChange) {
5955
+ try {
5956
+ this.config.onBlockedChange(blocked, standing);
5957
+ } catch (err) {
5958
+ this.error("onBlockedChange failed", err);
5959
+ }
5960
+ }
5961
+ }
4608
5962
  /**
4609
5963
  * Internal handler for broadcast messages
4610
5964
  * @internal
@@ -4663,8 +6017,15 @@ var StaticTVClient = class {
4663
6017
  onBroadcast: (text) => this._handleBroadcast(text),
4664
6018
  onCommand: this.config.onCommand || this._pendingProConfig?.onCommand,
4665
6019
  // Merge other settings from enableProFeatures if provided
4666
- ...this._pendingProConfig
6020
+ ...this._pendingProConfig,
6021
+ // The scene's controls (2026-11-18): the constructor's, enableProFeatures()'s, and any registered before now
6022
+ controls: [
6023
+ ...this.config.controls || [],
6024
+ ...this._pendingProConfig?.controls || [],
6025
+ ...this._pendingControls
6026
+ ]
4667
6027
  };
6028
+ this._pendingControls = [];
4668
6029
  this.adminPanel = new AdminPanelUIModule(this, adminConfig);
4669
6030
  this._proFeaturesEnabled = true;
4670
6031
  this.adminPanel.init().catch((err) => {
@@ -4708,8 +6069,9 @@ var StaticTVClient = class {
4708
6069
  getSceneId() {
4709
6070
  return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4710
6071
  }
4711
- _enableFeaturesForTier(tier, keyId) {
6072
+ _enableFeaturesForTier(tier, keyId, venue = false) {
4712
6073
  this._tier = tier;
6074
+ this._venue = tier === "pro" && venue === true;
4713
6075
  if (keyId) {
4714
6076
  this._keyId = keyId;
4715
6077
  }
@@ -4724,6 +6086,7 @@ var StaticTVClient = class {
4724
6086
  this.log("Pro tier detected but no video config - call enableProFeatures() or set videoScreen to enable admin panel");
4725
6087
  }
4726
6088
  }
6089
+ if (this._venue) this.frames.enable();
4727
6090
  this._resolveFeaturesReady(tier);
4728
6091
  }
4729
6092
  /**
@@ -4751,6 +6114,13 @@ var StaticTVClient = class {
4751
6114
  get hasProFeatures() {
4752
6115
  return this._proFeaturesEnabled;
4753
6116
  }
6117
+ /**
6118
+ * True when the server confirmed the Venue tier (2026-11-19): Pro plus the event features - scene
6119
+ * controls, frames, private mode. `tier` stays 'pro' for a Venue scene, so a scene's own Pro checks hold.
6120
+ */
6121
+ get hasVenueFeatures() {
6122
+ return this._venue;
6123
+ }
4754
6124
  /**
4755
6125
  * @deprecated Use `tier` instead
4756
6126
  */
@@ -4820,6 +6190,57 @@ var StaticTVClient = class {
4820
6190
  }
4821
6191
  this.adminPanel.registerSceneTab(tab);
4822
6192
  }
6193
+ /**
6194
+ * Register scene controls for the Admin Panel's CONTROLS tab and the scene's page on thestatic.tv (2026-11-18;
6195
+ * the Venue tier since 2026-11-19, Pro until then) - the same as passing `controls` in the config. Before the panel
6196
+ * exists (the tier not yet confirmed) they are kept and handed to it at init; after, they join the tab at once. On a
6197
+ * Pro scene without Venue they are kept and never drawn, uploaded or run. See `SceneControl`.
6198
+ *
6199
+ * @example
6200
+ * ```typescript
6201
+ * staticTV.registerControls([{
6202
+ * id: 'digifog', label: 'DigiFog', off: true, persist: true,
6203
+ * options: [{ id: 'stars', label: 'Stars' }, { id: 'pulse', label: 'Pulse' }],
6204
+ * onChange: (option) => fog.play(option)
6205
+ * }])
6206
+ * ```
6207
+ */
6208
+ registerControls(controls) {
6209
+ if (!this.adminPanel) {
6210
+ this._pendingControls.push(...controls);
6211
+ this.log(`Scene controls registered (${controls.length}) - the admin panel takes them when the Pro tier is confirmed`);
6212
+ return;
6213
+ }
6214
+ this.adminPanel.registerControls(controls);
6215
+ }
6216
+ /**
6217
+ * Register picture frames (Venue tier, 2026-11-19) - the same as passing `frames` in the config. Kept whatever the
6218
+ * tier (without Venue `openFrame` still opens a default's link); once Venue is known, a frame registered now gets the
6219
+ * content the last read gave at once. A frame registered again by id
6220
+ * replaces the earlier one; at most 64. Only the shape is checked here - thestatic.tv checks the ids, labels and URLs
6221
+ * when the declaration is uploaded. See `SceneFrame`.
6222
+ *
6223
+ * @example
6224
+ * ```typescript
6225
+ * staticTV.registerFrames([{
6226
+ * id: 'f00', label: 'Ground floor, west wall',
6227
+ * default: { image: 'https://example.com/poster.png' },
6228
+ * onContent: (c) => showPicture(frameEntity, c.image, c.text)
6229
+ * }])
6230
+ * ```
6231
+ */
6232
+ registerFrames(frames) {
6233
+ this.frames.register(frames);
6234
+ }
6235
+ /**
6236
+ * A visitor clicked a frame (2026-11-19): the link opens when it is an https: one - the content's, else the frame's
6237
+ * default's, so a frame works before Venue is on - and, with Venue, the click is counted on thestatic.tv under the
6238
+ * picture the frame shows (signed, fire and forget). Call it from the frame's own pointer handler. Nothing happens
6239
+ * for an id the scene did not declare.
6240
+ */
6241
+ openFrame(id) {
6242
+ this.frames.open(id);
6243
+ }
4823
6244
  /**
4824
6245
  * Close Admin/Guide panels (they share the same screen space)
4825
6246
  * Chat is independent and stays open.
@@ -4891,16 +6312,19 @@ var StaticTVClient = class {
4891
6312
  export {
4892
6313
  AdminPanelUIModule,
4893
6314
  ChatUIModule,
6315
+ FramesModule,
4894
6316
  GuideModule,
4895
6317
  GuideUIModule,
4896
6318
  HeartbeatModule,
4897
6319
  InteractionsModule,
4898
6320
  KEY_TYPE_CHANNEL,
4899
6321
  KEY_TYPE_SCENE,
6322
+ ModerationModule,
4900
6323
  NotificationBanner,
4901
6324
  SessionModule,
4902
6325
  StaticTVClient,
4903
6326
  fetchUserData,
6327
+ getParcelRects,
4904
6328
  getPlayerDisplayName,
4905
6329
  getPlayerPosition,
4906
6330
  getPlayerWallet,