@tomorrowevening/hermes 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +10 -0
  3. package/dist/hermes.js +1202 -0
  4. package/dist/hermes.umd.cjs +29 -0
  5. package/dist/images/debug/icon_camera.png +0 -0
  6. package/dist/images/debug/icon_folder.png +0 -0
  7. package/dist/images/debug/icon_interactive.png +0 -0
  8. package/dist/images/debug/icon_lights.png +0 -0
  9. package/dist/images/debug/icon_refresh.png +0 -0
  10. package/dist/images/debug/icon_ui.png +0 -0
  11. package/dist/images/debug/icon_utils.png +0 -0
  12. package/dist/images/debug/icon_world.png +0 -0
  13. package/dist/style.css +1 -0
  14. package/package.json +63 -0
  15. package/src/core/Application.ts +69 -0
  16. package/src/core/RemoteController.ts +135 -0
  17. package/src/core/remote/BaseRemote.ts +16 -0
  18. package/src/core/remote/RemoteComponents.ts +32 -0
  19. package/src/core/remote/RemoteTheatre.ts +117 -0
  20. package/src/core/remote/RemoteTweakpane.ts +176 -0
  21. package/src/core/types.ts +43 -0
  22. package/src/editor/Editor.tsx +15 -0
  23. package/src/editor/components/Draggable.tsx +40 -0
  24. package/src/editor/components/DraggableItem.tsx +22 -0
  25. package/src/editor/components/Dropdown.tsx +30 -0
  26. package/src/editor/components/DropdownItem.tsx +64 -0
  27. package/src/editor/components/NavButton.tsx +11 -0
  28. package/src/editor/components/icons/CloseIcon.tsx +7 -0
  29. package/src/editor/components/icons/DragIcon.tsx +9 -0
  30. package/src/editor/components/types.ts +41 -0
  31. package/src/editor/global.ts +13 -0
  32. package/src/editor/sceneHierarchy/ChildObject.tsx +56 -0
  33. package/src/editor/sceneHierarchy/ContainerObject.tsx +12 -0
  34. package/src/editor/sceneHierarchy/SceneHierarchy.tsx +77 -0
  35. package/src/editor/sceneHierarchy/types.ts +10 -0
  36. package/src/editor/sceneHierarchy/utils.ts +25 -0
  37. package/src/editor/scss/_debug.scss +68 -0
  38. package/src/editor/scss/_draggable.scss +43 -0
  39. package/src/editor/scss/_dropdown.scss +83 -0
  40. package/src/editor/scss/_sceneHierarchy.scss +170 -0
  41. package/src/editor/scss/_theme.scss +9 -0
  42. package/src/editor/scss/index.scss +58 -0
  43. package/src/editor/utils.ts +20 -0
  44. package/src/example/App.css +6 -0
  45. package/src/example/App.tsx +88 -0
  46. package/src/example/constants.ts +13 -0
  47. package/src/example/index.scss +37 -0
  48. package/src/example/main.tsx +75 -0
  49. package/src/library.ts +16 -0
  50. package/src/vite-env.d.ts +1 -0
  51. package/types/core/Application.d.ts +21 -0
  52. package/types/core/RemoteController.d.ts +2 -0
  53. package/types/core/remote/BaseRemote.d.ts +6 -0
  54. package/types/core/remote/RemoteComponents.d.ts +7 -0
  55. package/types/core/remote/RemoteDebug.d.ts +23 -0
  56. package/types/core/remote/RemoteTheatre.d.ts +16 -0
  57. package/types/core/remote/RemoteTweakpane.d.ts +23 -0
  58. package/types/core/types.d.ts +13 -0
  59. package/types/debug/Editor.d.ts +8 -0
  60. package/types/debug/components/Draggable.d.ts +2 -0
  61. package/types/debug/components/DraggableItem.d.ts +2 -0
  62. package/types/debug/components/Dropdown.d.ts +2 -0
  63. package/types/debug/components/DropdownItem.d.ts +2 -0
  64. package/types/debug/components/NavButton.d.ts +5 -0
  65. package/types/debug/components/icons/CloseIcon.d.ts +2 -0
  66. package/types/debug/components/icons/DragIcon.d.ts +2 -0
  67. package/types/debug/components/types.d.ts +31 -0
  68. package/types/debug/global.d.ts +9 -0
  69. package/types/debug/sceneHierarchy/ChildObject.d.ts +2 -0
  70. package/types/debug/sceneHierarchy/ContainerObject.d.ts +2 -0
  71. package/types/debug/sceneHierarchy/SceneHierarchy.d.ts +13 -0
  72. package/types/debug/sceneHierarchy/types.d.ts +8 -0
  73. package/types/debug/sceneHierarchy/utils.d.ts +2 -0
  74. package/types/debug/utils.d.ts +4 -0
  75. package/types/editor/Editor.d.ts +8 -0
  76. package/types/editor/components/Draggable.d.ts +2 -0
  77. package/types/editor/components/DraggableItem.d.ts +2 -0
  78. package/types/editor/components/Dropdown.d.ts +2 -0
  79. package/types/editor/components/DropdownItem.d.ts +2 -0
  80. package/types/editor/components/NavButton.d.ts +5 -0
  81. package/types/editor/components/icons/CloseIcon.d.ts +2 -0
  82. package/types/editor/components/icons/DragIcon.d.ts +2 -0
  83. package/types/editor/components/types.d.ts +31 -0
  84. package/types/editor/global.d.ts +9 -0
  85. package/types/editor/sceneHierarchy/ChildObject.d.ts +2 -0
  86. package/types/editor/sceneHierarchy/ContainerObject.d.ts +2 -0
  87. package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +13 -0
  88. package/types/editor/sceneHierarchy/types.d.ts +8 -0
  89. package/types/editor/sceneHierarchy/utils.d.ts +2 -0
  90. package/types/editor/utils.d.ts +4 -0
  91. package/types/example/App.d.ts +3 -0
  92. package/types/example/constants.d.ts +3 -0
  93. package/types/example/main.d.ts +1 -0
  94. package/types/library.d.ts +14 -0
package/dist/hermes.js ADDED
@@ -0,0 +1,1202 @@
1
+ var mt = Object.defineProperty;
2
+ var gt = (a, n, r) => n in a ? mt(a, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[n] = r;
3
+ var y = (a, n, r) => (gt(a, typeof n != "symbol" ? n + "" : n, r), r);
4
+ import { getProject as Et } from "@theatre/core";
5
+ import { Pane as yt } from "tweakpane";
6
+ import * as Ct from "@tweakpane/plugin-essentials";
7
+ import { EventDispatcher as _t } from "three";
8
+ import Pe, { useState as Y, Component as jt } from "react";
9
+ import { Reorder as De } from "framer-motion";
10
+ import U from "@theatre/studio";
11
+ class ae {
12
+ constructor(n) {
13
+ y(this, "app");
14
+ this.app = n;
15
+ }
16
+ dispose() {
17
+ }
18
+ }
19
+ class St extends ae {
20
+ constructor(n) {
21
+ super(n);
22
+ }
23
+ selectDropdown(n, r) {
24
+ this.app.send({
25
+ event: "selectComponent",
26
+ data: {
27
+ dropdown: n,
28
+ value: r
29
+ }
30
+ });
31
+ }
32
+ updateDropdown(n, r) {
33
+ this.app.send({
34
+ event: "draggableListUpdate",
35
+ data: {
36
+ dropdown: n,
37
+ value: r
38
+ }
39
+ });
40
+ }
41
+ }
42
+ function Rt() {
43
+ return Math.round(Math.random() * 1e6).toString();
44
+ }
45
+ function Tt(a) {
46
+ return a.r !== void 0 && a.g !== void 0 && a.b !== void 0;
47
+ }
48
+ const Ie = () => {
49
+ };
50
+ class xt extends ae {
51
+ constructor(r, o, i) {
52
+ super(r);
53
+ y(this, "project");
54
+ y(this, "sheets");
55
+ y(this, "sheetObjects");
56
+ y(this, "sheetObjectCBs");
57
+ y(this, "sheetObjectUnsubscribe");
58
+ this.project = Et(o, i), this.sheets = /* @__PURE__ */ new Map(), this.sheetObjects = /* @__PURE__ */ new Map(), this.sheetObjectCBs = /* @__PURE__ */ new Map(), this.sheetObjectUnsubscribe = /* @__PURE__ */ new Map();
59
+ }
60
+ dispose() {
61
+ this.project = void 0, this.sheets = /* @__PURE__ */ new Map(), this.sheetObjects = /* @__PURE__ */ new Map(), this.sheetObjectCBs = /* @__PURE__ */ new Map(), this.sheetObjectUnsubscribe = /* @__PURE__ */ new Map();
62
+ }
63
+ sheet(r) {
64
+ var i;
65
+ if (this.project === void 0) {
66
+ console.error("Theatre Project hasn't been created yet.");
67
+ return;
68
+ }
69
+ let o = this.sheets.get(r);
70
+ return o !== void 0 || (o = (i = this.project) == null ? void 0 : i.sheet(r), this.sheets.set(r, o)), o;
71
+ }
72
+ sheetObject(r, o, i, l) {
73
+ if (this.project === void 0) {
74
+ console.error("Theatre Project hasn't been created yet.");
75
+ return;
76
+ }
77
+ const g = this.sheets.get(r);
78
+ if (g === void 0)
79
+ return;
80
+ const b = `${r}_${o}`;
81
+ let d = this.sheetObjects.get(b);
82
+ if (d !== void 0)
83
+ return d = g.object(o, { ...i, ...d.value }, { reconfigure: !0 }), d;
84
+ d = g.object(o, i), this.sheetObjects.set(b, d), this.sheetObjectCBs.set(b, l !== void 0 ? l : Ie);
85
+ const E = d.onValuesChange((v) => {
86
+ if (this.app.editor) {
87
+ for (const C in v) {
88
+ const j = v[C];
89
+ typeof j == "object" && Tt(j) && (v[C] = {
90
+ r: j.r,
91
+ g: j.g,
92
+ b: j.b,
93
+ a: j.a
94
+ });
95
+ }
96
+ this.app.send({
97
+ event: "updateSheetObject",
98
+ data: {
99
+ sheetObject: b,
100
+ values: v
101
+ }
102
+ });
103
+ } else {
104
+ const C = this.sheetObjectCBs.get(b);
105
+ C !== void 0 && C(v);
106
+ }
107
+ });
108
+ return this.sheetObjectUnsubscribe.set(b, E), d;
109
+ }
110
+ unsubscribe(r) {
111
+ if (this.project === void 0) {
112
+ console.error("Theatre Project hasn't been created yet.");
113
+ return;
114
+ }
115
+ const o = `${r.address.sheetId}_${r.address.objectKey}`, i = this.sheetObjectUnsubscribe.get(o);
116
+ i !== void 0 && i();
117
+ }
118
+ }
119
+ class wt extends ae {
120
+ constructor(r) {
121
+ super(r);
122
+ y(this, "appTab");
123
+ y(this, "systemTab");
124
+ y(this, "utilsTab");
125
+ y(this, "bindCBs");
126
+ y(this, "buttonCBs");
127
+ y(this, "pane");
128
+ y(this, "appCallbacks", 0);
129
+ y(this, "editorCallbacks", 0);
130
+ this.bindCBs = /* @__PURE__ */ new Map(), this.buttonCBs = /* @__PURE__ */ new Map(), r.editor && this.createGUI();
131
+ }
132
+ createGUI() {
133
+ this.pane = new yt({ title: "GUI" }), this.pane.registerPlugin(Ct);
134
+ const r = this.pane.element.parentElement;
135
+ r.style.left = "50%", r.style.top = "0", r.style.maxHeight = "100%", r.style.overflowX = "hidden", r.style.overflowY = "auto", r.style.transform = "translateX(-50%)", r.style.width = "300px", r.style.zIndex = "100";
136
+ const o = this.pane.addTab({
137
+ pages: [{ title: "App" }, { title: "System" }, { title: "Tools" }]
138
+ });
139
+ this.appTab = o.pages[0], this.systemTab = o.pages[1], this.utilsTab = o.pages[2];
140
+ }
141
+ dispose() {
142
+ var r, o, i, l;
143
+ this.bindCBs.clear(), this.buttonCBs.clear(), this.appCallbacks = 0, this.editorCallbacks = 0, this.app.editor && ((r = this.appTab) == null || r.dispose(), (o = this.systemTab) == null || o.dispose(), (i = this.utilsTab) == null || i.dispose(), (l = this.pane) == null || l.dispose(), this.appTab = void 0, this.systemTab = void 0, this.utilsTab = void 0, this.pane = void 0);
144
+ }
145
+ addFolder(r, o = void 0, i = void 0) {
146
+ if (this.app.editor)
147
+ return this.pane === void 0 && this.createGUI(), (i !== void 0 ? i : this.appTab).addFolder({
148
+ title: r,
149
+ ...o
150
+ });
151
+ this.app.send({
152
+ event: "addFolder",
153
+ data: {
154
+ name: r,
155
+ params: o,
156
+ parent: i
157
+ }
158
+ });
159
+ }
160
+ get bindID() {
161
+ return `debug_${Math.max(this.appCallbacks, this.editorCallbacks)}`;
162
+ }
163
+ // Binding
164
+ bind(r, o, i, l = void 0) {
165
+ const g = this.bindID, b = i.onChange !== void 0 ? i.onChange : Ie;
166
+ this.bindCBs.set(g, b), this.app.editor ? (this.pane === void 0 && this.createGUI(), (l !== void 0 ? l : this.appTab).addBinding(r, o, i).on("change", (E) => {
167
+ this.app.send({
168
+ event: "updateBind",
169
+ data: {
170
+ id: g,
171
+ value: E.value
172
+ }
173
+ });
174
+ }), this.editorCallbacks++) : (this.app.send({
175
+ event: "bindObject",
176
+ data: {
177
+ id: g,
178
+ name: o,
179
+ params: i,
180
+ parent: l
181
+ }
182
+ }), this.appCallbacks++);
183
+ }
184
+ triggerBind(r, o) {
185
+ const i = this.bindCBs.get(r);
186
+ i !== void 0 ? i(o) : console.warn(`No callback for: ${r}`, o);
187
+ }
188
+ // Buttons
189
+ button(r, o, i = void 0) {
190
+ const l = this.bindID;
191
+ this.buttonCBs.set(l, o), this.app.editor ? (this.pane === void 0 && this.createGUI(), (i !== void 0 ? i : this.appTab).addButton({ title: r }).on("click", () => {
192
+ this.app.send({
193
+ event: "clickButton",
194
+ data: {
195
+ id: l
196
+ }
197
+ });
198
+ }), this.editorCallbacks++) : (this.app.send({
199
+ event: "addButton",
200
+ data: {
201
+ id: l,
202
+ name: r,
203
+ callback: o,
204
+ parent: i
205
+ }
206
+ }), this.appCallbacks++);
207
+ }
208
+ triggerButton(r) {
209
+ const o = this.buttonCBs.get(r);
210
+ o !== void 0 && o();
211
+ }
212
+ }
213
+ class Gt {
214
+ constructor(n, r) {
215
+ y(this, "components");
216
+ y(this, "debug");
217
+ y(this, "theatre");
218
+ // Protected
219
+ y(this, "mode", "listener");
220
+ y(this, "channel");
221
+ this.editor = n && document.location.hash.search(r) > -1, n && (this.channel = new BroadcastChannel("theatre"));
222
+ }
223
+ setupComponents() {
224
+ this.components = new St(this);
225
+ }
226
+ setupGUI() {
227
+ this.debug = new wt(this);
228
+ }
229
+ setupTheatre(n, r) {
230
+ this.theatre = new xt(this, n, r);
231
+ }
232
+ dispose() {
233
+ var n, r, o;
234
+ (n = this.components) == null || n.dispose(), (r = this.debug) == null || r.dispose(), (o = this.theatre) == null || o.dispose();
235
+ }
236
+ // Remote
237
+ send(n) {
238
+ this.mode === "editor" && this.channel !== void 0 && this.channel.postMessage(n);
239
+ }
240
+ listen(n) {
241
+ this.mode === "listener" && this.channel !== void 0 && (this.channel.onmessage = (r) => {
242
+ n(r.data);
243
+ });
244
+ }
245
+ // Getters / Setters
246
+ get editor() {
247
+ return this.mode === "editor";
248
+ }
249
+ set editor(n) {
250
+ n && (this.mode = "editor", document.title += " - Editor");
251
+ }
252
+ }
253
+ const k = new _t(), P = {
254
+ // Components
255
+ SELECT_DROPDOWN: "ToolEvents::selectDropdown",
256
+ DRAG_UPDATE: "ToolEvents::dragUpdate",
257
+ // SceneHierarchy
258
+ INSPECT_ITEM: "ToolEvents::inspectItem",
259
+ REFRESH_SCENE: "ToolEvents::refreshScene",
260
+ SET_SCENE: "ToolEvents::setScene"
261
+ };
262
+ var ne = { exports: {} }, L = {};
263
+ /**
264
+ * @license React
265
+ * react-jsx-runtime.production.min.js
266
+ *
267
+ * Copyright (c) Facebook, Inc. and its affiliates.
268
+ *
269
+ * This source code is licensed under the MIT license found in the
270
+ * LICENSE file in the root directory of this source tree.
271
+ */
272
+ var Oe;
273
+ function Ot() {
274
+ if (Oe)
275
+ return L;
276
+ Oe = 1;
277
+ var a = Pe, n = Symbol.for("react.element"), r = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, i = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
278
+ function g(b, d, E) {
279
+ var v, C = {}, j = null, D = null;
280
+ E !== void 0 && (j = "" + E), d.key !== void 0 && (j = "" + d.key), d.ref !== void 0 && (D = d.ref);
281
+ for (v in d)
282
+ o.call(d, v) && !l.hasOwnProperty(v) && (C[v] = d[v]);
283
+ if (b && b.defaultProps)
284
+ for (v in d = b.defaultProps, d)
285
+ C[v] === void 0 && (C[v] = d[v]);
286
+ return { $$typeof: n, type: b, key: j, ref: D, props: C, _owner: i.current };
287
+ }
288
+ return L.Fragment = r, L.jsx = g, L.jsxs = g, L;
289
+ }
290
+ var W = {};
291
+ /**
292
+ * @license React
293
+ * react-jsx-runtime.development.js
294
+ *
295
+ * Copyright (c) Facebook, Inc. and its affiliates.
296
+ *
297
+ * This source code is licensed under the MIT license found in the
298
+ * LICENSE file in the root directory of this source tree.
299
+ */
300
+ var ke;
301
+ function kt() {
302
+ return ke || (ke = 1, process.env.NODE_ENV !== "production" && function() {
303
+ var a = Pe, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), b = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), M = Symbol.iterator, Ae = "@@iterator";
304
+ function Me(e) {
305
+ if (e === null || typeof e != "object")
306
+ return null;
307
+ var t = M && e[M] || e[Ae];
308
+ return typeof t == "function" ? t : null;
309
+ }
310
+ var N = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
311
+ function R(e) {
312
+ {
313
+ for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), c = 1; c < t; c++)
314
+ s[c - 1] = arguments[c];
315
+ Be("error", e, s);
316
+ }
317
+ }
318
+ function Be(e, t, s) {
319
+ {
320
+ var c = N.ReactDebugCurrentFrame, p = c.getStackAddendum();
321
+ p !== "" && (t += "%s", s = s.concat([p]));
322
+ var m = s.map(function(h) {
323
+ return String(h);
324
+ });
325
+ m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m);
326
+ }
327
+ }
328
+ var $e = !1, Ue = !1, Le = !1, We = !1, Ye = !1, ie;
329
+ ie = Symbol.for("react.module.reference");
330
+ function Ve(e) {
331
+ return !!(typeof e == "string" || typeof e == "function" || e === o || e === l || Ye || e === i || e === E || e === v || We || e === D || $e || Ue || Le || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === C || e.$$typeof === g || e.$$typeof === b || e.$$typeof === d || // This needs to include all possible module reference object
332
+ // types supported by any Flight configuration anywhere since
333
+ // we don't know which Flight build this will end up being used
334
+ // with.
335
+ e.$$typeof === ie || e.getModuleId !== void 0));
336
+ }
337
+ function He(e, t, s) {
338
+ var c = e.displayName;
339
+ if (c)
340
+ return c;
341
+ var p = t.displayName || t.name || "";
342
+ return p !== "" ? s + "(" + p + ")" : s;
343
+ }
344
+ function se(e) {
345
+ return e.displayName || "Context";
346
+ }
347
+ function w(e) {
348
+ if (e == null)
349
+ return null;
350
+ if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
351
+ return e.displayName || e.name || null;
352
+ if (typeof e == "string")
353
+ return e;
354
+ switch (e) {
355
+ case o:
356
+ return "Fragment";
357
+ case r:
358
+ return "Portal";
359
+ case l:
360
+ return "Profiler";
361
+ case i:
362
+ return "StrictMode";
363
+ case E:
364
+ return "Suspense";
365
+ case v:
366
+ return "SuspenseList";
367
+ }
368
+ if (typeof e == "object")
369
+ switch (e.$$typeof) {
370
+ case b:
371
+ var t = e;
372
+ return se(t) + ".Consumer";
373
+ case g:
374
+ var s = e;
375
+ return se(s._context) + ".Provider";
376
+ case d:
377
+ return He(e, e.render, "ForwardRef");
378
+ case C:
379
+ var c = e.displayName || null;
380
+ return c !== null ? c : w(e.type) || "Memo";
381
+ case j: {
382
+ var p = e, m = p._payload, h = p._init;
383
+ try {
384
+ return w(h(m));
385
+ } catch {
386
+ return null;
387
+ }
388
+ }
389
+ }
390
+ return null;
391
+ }
392
+ var I = Object.assign, B = 0, oe, ce, le, ue, de, fe, he;
393
+ function ve() {
394
+ }
395
+ ve.__reactDisabledLog = !0;
396
+ function Ge() {
397
+ {
398
+ if (B === 0) {
399
+ oe = console.log, ce = console.info, le = console.warn, ue = console.error, de = console.group, fe = console.groupCollapsed, he = console.groupEnd;
400
+ var e = {
401
+ configurable: !0,
402
+ enumerable: !0,
403
+ value: ve,
404
+ writable: !0
405
+ };
406
+ Object.defineProperties(console, {
407
+ info: e,
408
+ log: e,
409
+ warn: e,
410
+ error: e,
411
+ group: e,
412
+ groupCollapsed: e,
413
+ groupEnd: e
414
+ });
415
+ }
416
+ B++;
417
+ }
418
+ }
419
+ function qe() {
420
+ {
421
+ if (B--, B === 0) {
422
+ var e = {
423
+ configurable: !0,
424
+ enumerable: !0,
425
+ writable: !0
426
+ };
427
+ Object.defineProperties(console, {
428
+ log: I({}, e, {
429
+ value: oe
430
+ }),
431
+ info: I({}, e, {
432
+ value: ce
433
+ }),
434
+ warn: I({}, e, {
435
+ value: le
436
+ }),
437
+ error: I({}, e, {
438
+ value: ue
439
+ }),
440
+ group: I({}, e, {
441
+ value: de
442
+ }),
443
+ groupCollapsed: I({}, e, {
444
+ value: fe
445
+ }),
446
+ groupEnd: I({}, e, {
447
+ value: he
448
+ })
449
+ });
450
+ }
451
+ B < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
452
+ }
453
+ }
454
+ var J = N.ReactCurrentDispatcher, K;
455
+ function V(e, t, s) {
456
+ {
457
+ if (K === void 0)
458
+ try {
459
+ throw Error();
460
+ } catch (p) {
461
+ var c = p.stack.trim().match(/\n( *(at )?)/);
462
+ K = c && c[1] || "";
463
+ }
464
+ return `
465
+ ` + K + e;
466
+ }
467
+ }
468
+ var X = !1, H;
469
+ {
470
+ var ze = typeof WeakMap == "function" ? WeakMap : Map;
471
+ H = new ze();
472
+ }
473
+ function pe(e, t) {
474
+ if (!e || X)
475
+ return "";
476
+ {
477
+ var s = H.get(e);
478
+ if (s !== void 0)
479
+ return s;
480
+ }
481
+ var c;
482
+ X = !0;
483
+ var p = Error.prepareStackTrace;
484
+ Error.prepareStackTrace = void 0;
485
+ var m;
486
+ m = J.current, J.current = null, Ge();
487
+ try {
488
+ if (t) {
489
+ var h = function() {
490
+ throw Error();
491
+ };
492
+ if (Object.defineProperty(h.prototype, "props", {
493
+ set: function() {
494
+ throw Error();
495
+ }
496
+ }), typeof Reflect == "object" && Reflect.construct) {
497
+ try {
498
+ Reflect.construct(h, []);
499
+ } catch (O) {
500
+ c = O;
501
+ }
502
+ Reflect.construct(e, [], h);
503
+ } else {
504
+ try {
505
+ h.call();
506
+ } catch (O) {
507
+ c = O;
508
+ }
509
+ e.call(h.prototype);
510
+ }
511
+ } else {
512
+ try {
513
+ throw Error();
514
+ } catch (O) {
515
+ c = O;
516
+ }
517
+ e();
518
+ }
519
+ } catch (O) {
520
+ if (O && c && typeof O.stack == "string") {
521
+ for (var f = O.stack.split(`
522
+ `), T = c.stack.split(`
523
+ `), _ = f.length - 1, S = T.length - 1; _ >= 1 && S >= 0 && f[_] !== T[S]; )
524
+ S--;
525
+ for (; _ >= 1 && S >= 0; _--, S--)
526
+ if (f[_] !== T[S]) {
527
+ if (_ !== 1 || S !== 1)
528
+ do
529
+ if (_--, S--, S < 0 || f[_] !== T[S]) {
530
+ var x = `
531
+ ` + f[_].replace(" at new ", " at ");
532
+ return e.displayName && x.includes("<anonymous>") && (x = x.replace("<anonymous>", e.displayName)), typeof e == "function" && H.set(e, x), x;
533
+ }
534
+ while (_ >= 1 && S >= 0);
535
+ break;
536
+ }
537
+ }
538
+ } finally {
539
+ X = !1, J.current = m, qe(), Error.prepareStackTrace = p;
540
+ }
541
+ var A = e ? e.displayName || e.name : "", we = A ? V(A) : "";
542
+ return typeof e == "function" && H.set(e, we), we;
543
+ }
544
+ function Je(e, t, s) {
545
+ return pe(e, !1);
546
+ }
547
+ function Ke(e) {
548
+ var t = e.prototype;
549
+ return !!(t && t.isReactComponent);
550
+ }
551
+ function G(e, t, s) {
552
+ if (e == null)
553
+ return "";
554
+ if (typeof e == "function")
555
+ return pe(e, Ke(e));
556
+ if (typeof e == "string")
557
+ return V(e);
558
+ switch (e) {
559
+ case E:
560
+ return V("Suspense");
561
+ case v:
562
+ return V("SuspenseList");
563
+ }
564
+ if (typeof e == "object")
565
+ switch (e.$$typeof) {
566
+ case d:
567
+ return Je(e.render);
568
+ case C:
569
+ return G(e.type, t, s);
570
+ case j: {
571
+ var c = e, p = c._payload, m = c._init;
572
+ try {
573
+ return G(m(p), t, s);
574
+ } catch {
575
+ }
576
+ }
577
+ }
578
+ return "";
579
+ }
580
+ var q = Object.prototype.hasOwnProperty, be = {}, me = N.ReactDebugCurrentFrame;
581
+ function z(e) {
582
+ if (e) {
583
+ var t = e._owner, s = G(e.type, e._source, t ? t.type : null);
584
+ me.setExtraStackFrame(s);
585
+ } else
586
+ me.setExtraStackFrame(null);
587
+ }
588
+ function Xe(e, t, s, c, p) {
589
+ {
590
+ var m = Function.call.bind(q);
591
+ for (var h in e)
592
+ if (m(e, h)) {
593
+ var f = void 0;
594
+ try {
595
+ if (typeof e[h] != "function") {
596
+ var T = Error((c || "React class") + ": " + s + " type `" + h + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[h] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
597
+ throw T.name = "Invariant Violation", T;
598
+ }
599
+ f = e[h](t, h, c, s, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
600
+ } catch (_) {
601
+ f = _;
602
+ }
603
+ f && !(f instanceof Error) && (z(p), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", s, h, typeof f), z(null)), f instanceof Error && !(f.message in be) && (be[f.message] = !0, z(p), R("Failed %s type: %s", s, f.message), z(null));
604
+ }
605
+ }
606
+ }
607
+ var Ze = Array.isArray;
608
+ function Z(e) {
609
+ return Ze(e);
610
+ }
611
+ function Qe(e) {
612
+ {
613
+ var t = typeof Symbol == "function" && Symbol.toStringTag, s = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
614
+ return s;
615
+ }
616
+ }
617
+ function et(e) {
618
+ try {
619
+ return ge(e), !1;
620
+ } catch {
621
+ return !0;
622
+ }
623
+ }
624
+ function ge(e) {
625
+ return "" + e;
626
+ }
627
+ function Ee(e) {
628
+ if (et(e))
629
+ return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Qe(e)), ge(e);
630
+ }
631
+ var $ = N.ReactCurrentOwner, tt = {
632
+ key: !0,
633
+ ref: !0,
634
+ __self: !0,
635
+ __source: !0
636
+ }, ye, Ce, Q;
637
+ Q = {};
638
+ function rt(e) {
639
+ if (q.call(e, "ref")) {
640
+ var t = Object.getOwnPropertyDescriptor(e, "ref").get;
641
+ if (t && t.isReactWarning)
642
+ return !1;
643
+ }
644
+ return e.ref !== void 0;
645
+ }
646
+ function nt(e) {
647
+ if (q.call(e, "key")) {
648
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
649
+ if (t && t.isReactWarning)
650
+ return !1;
651
+ }
652
+ return e.key !== void 0;
653
+ }
654
+ function at(e, t) {
655
+ if (typeof e.ref == "string" && $.current && t && $.current.stateNode !== t) {
656
+ var s = w($.current.type);
657
+ Q[s] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', w($.current.type), e.ref), Q[s] = !0);
658
+ }
659
+ }
660
+ function it(e, t) {
661
+ {
662
+ var s = function() {
663
+ ye || (ye = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
664
+ };
665
+ s.isReactWarning = !0, Object.defineProperty(e, "key", {
666
+ get: s,
667
+ configurable: !0
668
+ });
669
+ }
670
+ }
671
+ function st(e, t) {
672
+ {
673
+ var s = function() {
674
+ Ce || (Ce = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
675
+ };
676
+ s.isReactWarning = !0, Object.defineProperty(e, "ref", {
677
+ get: s,
678
+ configurable: !0
679
+ });
680
+ }
681
+ }
682
+ var ot = function(e, t, s, c, p, m, h) {
683
+ var f = {
684
+ // This tag allows us to uniquely identify this as a React Element
685
+ $$typeof: n,
686
+ // Built-in properties that belong on the element
687
+ type: e,
688
+ key: t,
689
+ ref: s,
690
+ props: h,
691
+ // Record the component responsible for creating this element.
692
+ _owner: m
693
+ };
694
+ return f._store = {}, Object.defineProperty(f._store, "validated", {
695
+ configurable: !1,
696
+ enumerable: !1,
697
+ writable: !0,
698
+ value: !1
699
+ }), Object.defineProperty(f, "_self", {
700
+ configurable: !1,
701
+ enumerable: !1,
702
+ writable: !1,
703
+ value: c
704
+ }), Object.defineProperty(f, "_source", {
705
+ configurable: !1,
706
+ enumerable: !1,
707
+ writable: !1,
708
+ value: p
709
+ }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
710
+ };
711
+ function ct(e, t, s, c, p) {
712
+ {
713
+ var m, h = {}, f = null, T = null;
714
+ s !== void 0 && (Ee(s), f = "" + s), nt(t) && (Ee(t.key), f = "" + t.key), rt(t) && (T = t.ref, at(t, p));
715
+ for (m in t)
716
+ q.call(t, m) && !tt.hasOwnProperty(m) && (h[m] = t[m]);
717
+ if (e && e.defaultProps) {
718
+ var _ = e.defaultProps;
719
+ for (m in _)
720
+ h[m] === void 0 && (h[m] = _[m]);
721
+ }
722
+ if (f || T) {
723
+ var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
724
+ f && it(h, S), T && st(h, S);
725
+ }
726
+ return ot(e, f, T, p, c, $.current, h);
727
+ }
728
+ }
729
+ var ee = N.ReactCurrentOwner, _e = N.ReactDebugCurrentFrame;
730
+ function F(e) {
731
+ if (e) {
732
+ var t = e._owner, s = G(e.type, e._source, t ? t.type : null);
733
+ _e.setExtraStackFrame(s);
734
+ } else
735
+ _e.setExtraStackFrame(null);
736
+ }
737
+ var te;
738
+ te = !1;
739
+ function re(e) {
740
+ return typeof e == "object" && e !== null && e.$$typeof === n;
741
+ }
742
+ function je() {
743
+ {
744
+ if (ee.current) {
745
+ var e = w(ee.current.type);
746
+ if (e)
747
+ return `
748
+
749
+ Check the render method of \`` + e + "`.";
750
+ }
751
+ return "";
752
+ }
753
+ }
754
+ function lt(e) {
755
+ {
756
+ if (e !== void 0) {
757
+ var t = e.fileName.replace(/^.*[\\\/]/, ""), s = e.lineNumber;
758
+ return `
759
+
760
+ Check your code at ` + t + ":" + s + ".";
761
+ }
762
+ return "";
763
+ }
764
+ }
765
+ var Se = {};
766
+ function ut(e) {
767
+ {
768
+ var t = je();
769
+ if (!t) {
770
+ var s = typeof e == "string" ? e : e.displayName || e.name;
771
+ s && (t = `
772
+
773
+ Check the top-level render call using <` + s + ">.");
774
+ }
775
+ return t;
776
+ }
777
+ }
778
+ function Re(e, t) {
779
+ {
780
+ if (!e._store || e._store.validated || e.key != null)
781
+ return;
782
+ e._store.validated = !0;
783
+ var s = ut(t);
784
+ if (Se[s])
785
+ return;
786
+ Se[s] = !0;
787
+ var c = "";
788
+ e && e._owner && e._owner !== ee.current && (c = " It was passed a child from " + w(e._owner.type) + "."), F(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', s, c), F(null);
789
+ }
790
+ }
791
+ function Te(e, t) {
792
+ {
793
+ if (typeof e != "object")
794
+ return;
795
+ if (Z(e))
796
+ for (var s = 0; s < e.length; s++) {
797
+ var c = e[s];
798
+ re(c) && Re(c, t);
799
+ }
800
+ else if (re(e))
801
+ e._store && (e._store.validated = !0);
802
+ else if (e) {
803
+ var p = Me(e);
804
+ if (typeof p == "function" && p !== e.entries)
805
+ for (var m = p.call(e), h; !(h = m.next()).done; )
806
+ re(h.value) && Re(h.value, t);
807
+ }
808
+ }
809
+ }
810
+ function dt(e) {
811
+ {
812
+ var t = e.type;
813
+ if (t == null || typeof t == "string")
814
+ return;
815
+ var s;
816
+ if (typeof t == "function")
817
+ s = t.propTypes;
818
+ else if (typeof t == "object" && (t.$$typeof === d || // Note: Memo only checks outer props here.
819
+ // Inner props are checked in the reconciler.
820
+ t.$$typeof === C))
821
+ s = t.propTypes;
822
+ else
823
+ return;
824
+ if (s) {
825
+ var c = w(t);
826
+ Xe(s, e.props, "prop", c, e);
827
+ } else if (t.PropTypes !== void 0 && !te) {
828
+ te = !0;
829
+ var p = w(t);
830
+ R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", p || "Unknown");
831
+ }
832
+ typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
833
+ }
834
+ }
835
+ function ft(e) {
836
+ {
837
+ for (var t = Object.keys(e.props), s = 0; s < t.length; s++) {
838
+ var c = t[s];
839
+ if (c !== "children" && c !== "key") {
840
+ F(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), F(null);
841
+ break;
842
+ }
843
+ }
844
+ e.ref !== null && (F(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
845
+ }
846
+ }
847
+ function xe(e, t, s, c, p, m) {
848
+ {
849
+ var h = Ve(e);
850
+ if (!h) {
851
+ var f = "";
852
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (f += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
853
+ var T = lt(p);
854
+ T ? f += T : f += je();
855
+ var _;
856
+ e === null ? _ = "null" : Z(e) ? _ = "array" : e !== void 0 && e.$$typeof === n ? (_ = "<" + (w(e.type) || "Unknown") + " />", f = " Did you accidentally export a JSX literal instead of a component?") : _ = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _, f);
857
+ }
858
+ var S = ct(e, t, s, p, m);
859
+ if (S == null)
860
+ return S;
861
+ if (h) {
862
+ var x = t.children;
863
+ if (x !== void 0)
864
+ if (c)
865
+ if (Z(x)) {
866
+ for (var A = 0; A < x.length; A++)
867
+ Te(x[A], e);
868
+ Object.freeze && Object.freeze(x);
869
+ } else
870
+ R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
871
+ else
872
+ Te(x, e);
873
+ }
874
+ return e === o ? ft(S) : dt(S), S;
875
+ }
876
+ }
877
+ function ht(e, t, s) {
878
+ return xe(e, t, s, !0);
879
+ }
880
+ function vt(e, t, s) {
881
+ return xe(e, t, s, !1);
882
+ }
883
+ var pt = vt, bt = ht;
884
+ W.Fragment = o, W.jsx = pt, W.jsxs = bt;
885
+ }()), W;
886
+ }
887
+ process.env.NODE_ENV === "production" ? ne.exports = Ot() : ne.exports = kt();
888
+ var u = ne.exports;
889
+ function Ne(a) {
890
+ return a.title.search("<") > -1 ? /* @__PURE__ */ u.jsx("button", { className: "svg", dangerouslySetInnerHTML: { __html: a.title } }) : /* @__PURE__ */ u.jsx("button", { children: a.title });
891
+ }
892
+ const Pt = /* @__PURE__ */ u.jsxs("svg", { className: "closeIcon", width: "14", height: "14", fill: "none", stroke: "#666666", strokeMiterlimit: "10", children: [
893
+ /* @__PURE__ */ u.jsx("circle", { cx: "7", cy: "7", r: "6" }),
894
+ /* @__PURE__ */ u.jsx("line", { x1: "4", y1: "4", x2: "10", y2: "10" }),
895
+ /* @__PURE__ */ u.jsx("line", { x1: "4", y1: "10", x2: "10", y2: "4" })
896
+ ] }), Dt = /* @__PURE__ */ u.jsx("svg", { className: "dragIcon", width: "14", height: "14", fill: "#666666", stroke: "none", children: /* @__PURE__ */ u.jsx(
897
+ "path",
898
+ {
899
+ d: `M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
900
+ C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
901
+ C11,8.22,10.74,8,10.43,8z`
902
+ }
903
+ ) });
904
+ function It(a) {
905
+ return /* @__PURE__ */ u.jsx(De.Item, { value: a.title, children: /* @__PURE__ */ u.jsxs("div", { children: [
906
+ Dt,
907
+ /* @__PURE__ */ u.jsx("span", { children: a.title }),
908
+ /* @__PURE__ */ u.jsx("button", { className: "closeIcon", onClick: () => {
909
+ a.onDelete(a.index);
910
+ }, children: Pt })
911
+ ] }) }, a.title);
912
+ }
913
+ function Nt(a) {
914
+ const [n, r] = Y(!1), [o, i] = Y(a.options), l = (E) => {
915
+ a.onDragComplete(E), i(E);
916
+ }, g = (E) => {
917
+ const v = [...o];
918
+ v.splice(E, 1), l(v);
919
+ }, b = [];
920
+ o.forEach((E, v) => {
921
+ b.push(/* @__PURE__ */ u.jsx(It, { index: v, title: E, onDelete: g }, E));
922
+ });
923
+ let d = "dropdown draggable";
924
+ return a.subdropdown && (d += " subdropdown"), /* @__PURE__ */ u.jsxs("div", { className: d, onMouseEnter: () => r(!0), onMouseLeave: () => r(!1), children: [
925
+ /* @__PURE__ */ u.jsx(Ne, { title: a.title }),
926
+ /* @__PURE__ */ u.jsx(De.Group, { axis: "y", values: o, onReorder: l, style: { visibility: n ? "visible" : "hidden" }, children: b })
927
+ ] });
928
+ }
929
+ function Ft(a) {
930
+ const [n, r] = Y(!1), o = [];
931
+ a.options.map((l, g) => {
932
+ a.onSelect !== void 0 && (l.onSelect = a.onSelect), o.push(/* @__PURE__ */ u.jsx(At, { option: l }, g));
933
+ });
934
+ let i = "dropdown";
935
+ return a.subdropdown && (i += " subdropdown"), /* @__PURE__ */ u.jsxs("div", { className: i, onMouseEnter: () => r(!0), onMouseLeave: () => r(!1), children: [
936
+ /* @__PURE__ */ u.jsx(Ne, { title: a.title }),
937
+ /* @__PURE__ */ u.jsx("ul", { style: { visibility: n ? "visible" : "hidden" }, children: o })
938
+ ] });
939
+ }
940
+ function At(a) {
941
+ const { option: n } = a, [r, o] = Y("");
942
+ let i = null;
943
+ switch (n.type) {
944
+ case "draggable":
945
+ i = /* @__PURE__ */ u.jsx(
946
+ Nt,
947
+ {
948
+ title: n.title,
949
+ options: n.value,
950
+ onDragComplete: (l) => {
951
+ n.onDragComplete !== void 0 && n.onDragComplete(l);
952
+ },
953
+ subdropdown: !0
954
+ }
955
+ );
956
+ break;
957
+ case "dropdown":
958
+ i = /* @__PURE__ */ u.jsx(
959
+ Ft,
960
+ {
961
+ title: n.title,
962
+ options: n.value,
963
+ onSelect: n.onSelect,
964
+ subdropdown: !0
965
+ }
966
+ );
967
+ break;
968
+ case "option":
969
+ i = /* @__PURE__ */ u.jsx(
970
+ "button",
971
+ {
972
+ onClick: () => {
973
+ n.onSelect !== void 0 && n.onSelect(n.value), n.selectable && (r !== n.title ? o(n.title) : o(""));
974
+ },
975
+ children: n.title
976
+ }
977
+ );
978
+ break;
979
+ }
980
+ return /* @__PURE__ */ u.jsx("li", { className: r === n.title ? "selected" : "", children: i }, Rt());
981
+ }
982
+ function qt(a) {
983
+ let n;
984
+ const r = () => {
985
+ U.ui.hide(), a.listen((i) => {
986
+ var g, b, d, E, v, C, j, D, M;
987
+ let l;
988
+ switch (i.event) {
989
+ case "draggableListUpdate":
990
+ k.dispatchEvent({ type: P.DRAG_UPDATE, value: i.data });
991
+ break;
992
+ case "selectComponent":
993
+ k.dispatchEvent({ type: P.SELECT_DROPDOWN, value: i.data });
994
+ break;
995
+ case "addFolder":
996
+ (g = a.debug) == null || g.addFolder(i.data.name, i.data.params, i.data.parent);
997
+ break;
998
+ case "bindObject":
999
+ (b = a.debug) == null || b.bind(i.data.name, i.data.params, i.data.parent);
1000
+ break;
1001
+ case "updateBind":
1002
+ (d = a.debug) == null || d.triggerBind(i.data.id, i.data.value);
1003
+ break;
1004
+ case "addButton":
1005
+ (E = a.debug) == null || E.button(i.data.name, i.data.callback, i.data.parent);
1006
+ break;
1007
+ case "clickButton":
1008
+ (v = a.debug) == null || v.triggerButton(i.data.id);
1009
+ break;
1010
+ case "setSheet":
1011
+ l = (C = a.theatre) == null ? void 0 : C.sheets.get(i.data.sheet), l !== void 0 && (n = l, U.setSelection([l]));
1012
+ break;
1013
+ case "setSheetObject":
1014
+ l = (j = a.theatre) == null ? void 0 : j.sheetObjects.get(`${i.data.sheet}_${i.data.key}`), l !== void 0 && U.setSelection([l]);
1015
+ break;
1016
+ case "updateSheetObject":
1017
+ l = (D = a.theatre) == null ? void 0 : D.sheetObjectCBs.get(i.data.sheetObject), l !== void 0 && l(i.data.values);
1018
+ break;
1019
+ case "updateTimeline":
1020
+ n = (M = a.theatre) == null ? void 0 : M.sheets.get(i.data.sheet), n !== void 0 && (n.sequence.position = i.data.position);
1021
+ break;
1022
+ }
1023
+ });
1024
+ }, o = () => {
1025
+ U.ui.restore(), U.onSelectionChange((b) => {
1026
+ b.length < 1 || b.forEach((d) => {
1027
+ var j;
1028
+ let E = d.address.sheetId, v = "setSheet", C = {};
1029
+ switch (d.type) {
1030
+ case "Theatre_Sheet_PublicAPI":
1031
+ v = "setSheet", C = {
1032
+ sheet: d.address.sheetId
1033
+ }, n = (j = a.theatre) == null ? void 0 : j.sheets.get(d.address.sheetId);
1034
+ break;
1035
+ case "Theatre_SheetObject_PublicAPI":
1036
+ v = "setSheetObject", E += `_${d.address.objectKey}`, C = {
1037
+ id: E,
1038
+ sheet: d.address.sheetId,
1039
+ key: d.address.objectKey
1040
+ };
1041
+ break;
1042
+ }
1043
+ a.send({ event: v, data: C });
1044
+ });
1045
+ });
1046
+ let i = 0;
1047
+ const l = () => {
1048
+ if (n !== void 0 && i !== n.sequence.position) {
1049
+ i = n.sequence.position;
1050
+ const b = n;
1051
+ a.send({
1052
+ event: "updateTimeline",
1053
+ data: {
1054
+ position: i,
1055
+ sheet: b.address.sheetId
1056
+ }
1057
+ });
1058
+ }
1059
+ }, g = () => {
1060
+ l(), requestAnimationFrame(g);
1061
+ };
1062
+ l(), g();
1063
+ };
1064
+ a.editor ? o() : r();
1065
+ }
1066
+ function Mt(a) {
1067
+ if (a.name === "cameras")
1068
+ return "camera";
1069
+ if (a.name === "interactive")
1070
+ return "interactive";
1071
+ if (a.name === "lights")
1072
+ return "light";
1073
+ if (a.name === "ui")
1074
+ return "ui";
1075
+ if (a.name === "utils")
1076
+ return "utils";
1077
+ const n = a.type;
1078
+ return n.search("Helper") > -1 ? "icon_utils" : n.search("Camera") > -1 ? "camera" : n.search("Light") > -1 ? "light" : "obj3D";
1079
+ }
1080
+ function Fe(a) {
1081
+ const [n, r] = Y(!1);
1082
+ let o = null, i = !1;
1083
+ if (a.child.children.length > 0) {
1084
+ i = !0;
1085
+ const l = [];
1086
+ a.child.children.map((g) => {
1087
+ l.push(/* @__PURE__ */ u.jsx(Fe, { child: g }, Math.random()));
1088
+ }), o = /* @__PURE__ */ u.jsx("div", { className: `container ${n ? "" : "closed"}`, children: l });
1089
+ }
1090
+ return /* @__PURE__ */ u.jsxs("div", { className: "childObject", children: [
1091
+ /* @__PURE__ */ u.jsxs("div", { className: "child", children: [
1092
+ i ? /* @__PURE__ */ u.jsx(
1093
+ "button",
1094
+ {
1095
+ className: "status",
1096
+ style: {
1097
+ backgroundPositionX: n ? "-14px" : "2px"
1098
+ },
1099
+ onClick: () => {
1100
+ r(!n);
1101
+ }
1102
+ }
1103
+ ) : null,
1104
+ /* @__PURE__ */ u.jsx(
1105
+ "button",
1106
+ {
1107
+ className: "name",
1108
+ style: {
1109
+ left: i ? "20px" : "5px"
1110
+ },
1111
+ onClick: () => {
1112
+ k.dispatchEvent({ type: P.INSPECT_ITEM, value: a.child });
1113
+ },
1114
+ children: a.child.name.length > 0 ? `${a.child.name} (${a.child.type})` : `${a.child.type}::${a.child.uuid}`
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ u.jsx("div", { className: `icon ${Mt(a.child)}` })
1118
+ ] }),
1119
+ o
1120
+ ] }, Math.random());
1121
+ }
1122
+ function Bt(a) {
1123
+ const n = [];
1124
+ return a.child.children.map((r) => {
1125
+ n.push(/* @__PURE__ */ u.jsx(Fe, { child: r }, Math.random()));
1126
+ }), /* @__PURE__ */ u.jsx("div", { className: "scene", children: n });
1127
+ }
1128
+ class zt extends jt {
1129
+ constructor(r) {
1130
+ super(r);
1131
+ // Private
1132
+ y(this, "onUpdate", () => {
1133
+ });
1134
+ y(this, "toggleOpen", () => {
1135
+ this.setState(() => ({
1136
+ open: !this.componentState.open
1137
+ }));
1138
+ });
1139
+ y(this, "onRefresh", () => {
1140
+ k.dispatchEvent({ type: P.INSPECT_ITEM, value: this.componentState.scene });
1141
+ });
1142
+ y(this, "onSetScene", (r) => {
1143
+ console.log("SceneHierarchy::onSetScene", r), this.setState(() => ({
1144
+ scene: r.value
1145
+ }));
1146
+ });
1147
+ this.state = {
1148
+ open: !1,
1149
+ scene: null
1150
+ }, k.addEventListener(P.REFRESH_SCENE, this.onUpdate), k.addEventListener(P.SET_SCENE, this.onSetScene);
1151
+ }
1152
+ componentWillUnmount() {
1153
+ k.removeEventListener(P.REFRESH_SCENE, this.onUpdate), k.removeEventListener(P.SET_SCENE, this.onSetScene);
1154
+ }
1155
+ render() {
1156
+ const r = this.componentState.scene !== null ? `Hierarchy: ${this.componentState.scene.name}` : "Hierarchy";
1157
+ return /* @__PURE__ */ u.jsxs("div", { id: "SceneHierarchy", children: [
1158
+ /* @__PURE__ */ u.jsxs("div", { className: "header", children: [
1159
+ /* @__PURE__ */ u.jsx(
1160
+ "button",
1161
+ {
1162
+ className: "status",
1163
+ style: {
1164
+ backgroundPositionX: this.componentState.open ? "-14px" : "2px"
1165
+ },
1166
+ onClick: this.toggleOpen
1167
+ }
1168
+ ),
1169
+ /* @__PURE__ */ u.jsx("span", { children: r }),
1170
+ /* @__PURE__ */ u.jsx("button", { className: "refresh hideText", onClick: this.onRefresh, children: "Refresh" })
1171
+ ] }),
1172
+ this.componentState.scene !== null && this.componentState.open ? /* @__PURE__ */ u.jsx(Bt, { child: this.componentState.scene }) : null
1173
+ ] });
1174
+ }
1175
+ // Getters / Setters
1176
+ get componentState() {
1177
+ return this.state;
1178
+ }
1179
+ }
1180
+ function Jt(a) {
1181
+ return /* @__PURE__ */ u.jsxs("div", { className: "editor", children: [
1182
+ /* @__PURE__ */ u.jsx("div", { className: "navBar", children: a.children }),
1183
+ a.components
1184
+ ] });
1185
+ }
1186
+ export {
1187
+ Gt as Application,
1188
+ ae as BaseRemote,
1189
+ Nt as Draggable,
1190
+ It as DraggableItem,
1191
+ Ft as Dropdown,
1192
+ At as DropdownItem,
1193
+ Jt as Editor,
1194
+ Ne as NavButton,
1195
+ St as RemoteComponents,
1196
+ qt as RemoteController,
1197
+ xt as RemoteTheatre,
1198
+ wt as RemoteTweakpane,
1199
+ zt as SceneHierarchy,
1200
+ P as ToolEvents,
1201
+ k as debugDispatcher
1202
+ };