@unseenco/theatre-core 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,32 +1,11 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __knownSymbol = (name, symbol) => {
13
- if (symbol = Symbol[name])
14
- return symbol;
15
- throw Error("Symbol." + name + " is not defined");
16
- };
17
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
- var __spreadValues = (a2, b2) => {
19
- for (var prop in b2 || (b2 = {}))
20
- if (__hasOwnProp.call(b2, prop))
21
- __defNormalProp(a2, prop, b2[prop]);
22
- if (__getOwnPropSymbols)
23
- for (var prop of __getOwnPropSymbols(b2)) {
24
- if (__propIsEnum.call(b2, prop))
25
- __defNormalProp(a2, prop, b2[prop]);
26
- }
27
- return a2;
28
- };
29
- var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
30
9
  var __commonJS = (cb, mod) => function __require() {
31
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
32
11
  };
@@ -55,43 +34,6 @@ var __publicField = (obj, key, value) => {
55
34
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
56
35
  return value;
57
36
  };
58
- var __await = function(promise, isYieldStar) {
59
- this[0] = promise;
60
- this[1] = isYieldStar;
61
- };
62
- var __yieldStar = (value) => {
63
- var obj = value[__knownSymbol("asyncIterator")];
64
- var isAwait = false;
65
- var method;
66
- var it = {};
67
- if (obj == null) {
68
- obj = value[__knownSymbol("iterator")]();
69
- method = (k2) => it[k2] = (x2) => obj[k2](x2);
70
- } else {
71
- obj = obj.call(value);
72
- method = (k2) => it[k2] = (v2) => {
73
- if (isAwait) {
74
- isAwait = false;
75
- if (k2 === "throw")
76
- throw v2;
77
- return v2;
78
- }
79
- isAwait = true;
80
- return {
81
- done: false,
82
- value: new __await(new Promise((resolve) => {
83
- var x2 = obj[k2](v2);
84
- if (!(x2 instanceof Object))
85
- throw TypeError("Object expected");
86
- resolve(x2);
87
- }), 1)
88
- };
89
- };
90
- }
91
- return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x2) => {
92
- throw x2;
93
- }, "return" in obj && method("return"), it;
94
- };
95
37
 
96
38
  // ../node_modules/timing-function/lib/UnitBezier.js
97
39
  var require_UnitBezier = __commonJS({
@@ -1224,7 +1166,7 @@ function deepMergeWithCache(base, override, cache2) {
1224
1166
  if (possibleCachedValue && possibleCachedValue.override === override) {
1225
1167
  return possibleCachedValue.merged;
1226
1168
  }
1227
- const merged = __spreadValues({}, base);
1169
+ const merged = { ...base };
1228
1170
  for (const key of Object.keys(override)) {
1229
1171
  const valueInOverride = override[key];
1230
1172
  const valueInBase = base[key];
@@ -3144,7 +3086,7 @@ var TheatreSheetObject = class {
3144
3086
  return privateAPI(this).sheet.project.publicApi;
3145
3087
  }
3146
3088
  get address() {
3147
- return __spreadValues({}, privateAPI(this).address);
3089
+ return { ...privateAPI(this).address };
3148
3090
  }
3149
3091
  _valuesPrism() {
3150
3092
  return this._cache.get("_valuesPrism", () => {
@@ -3319,10 +3261,9 @@ function stripTransientPathsFromSerializableMap(map, prefixes) {
3319
3261
  return result;
3320
3262
  }
3321
3263
  function stripTransientPathsFromSequenceTracks(sequence, objectKey, prefixes) {
3322
- var _a;
3323
3264
  if (!sequence || prefixes.size === 0)
3324
3265
  return;
3325
- const objectTracks = (_a = sequence.tracksByObject) == null ? void 0 : _a[objectKey];
3266
+ const objectTracks = sequence.tracksByObject?.[objectKey];
3326
3267
  if (!objectTracks)
3327
3268
  return;
3328
3269
  for (const [encodedPath, trackId] of Object.entries(
@@ -3370,7 +3311,7 @@ function stripTransientPropsFromObjectInSheetState(sheetState, objectKey, prefix
3370
3311
  for (const variantOverrides of Object.values(
3371
3312
  sheetState.staticOverridesByVariant
3372
3313
  )) {
3373
- const objOverrides = variantOverrides == null ? void 0 : variantOverrides.byObject[objectKey];
3314
+ const objOverrides = variantOverrides?.byObject[objectKey];
3374
3315
  if (objOverrides) {
3375
3316
  variantOverrides.byObject[objectKey] = stripTransientPathsFromSerializableMap(objOverrides, prefixes);
3376
3317
  }
@@ -3458,10 +3399,10 @@ var compoundHasSimpleDescendants = memoizeFn(
3458
3399
  function* iteratePropType(conf, pathPrefix) {
3459
3400
  if (conf.type === "compound") {
3460
3401
  for (const key in conf.props) {
3461
- yield* __yieldStar(iteratePropType(conf.props[key], [
3402
+ yield* iteratePropType(conf.props[key], [
3462
3403
  ...pathPrefix,
3463
3404
  key
3464
- ]));
3405
+ ]);
3465
3406
  }
3466
3407
  } else if (conf.type === "enum") {
3467
3408
  throw new Error("Not implemented yet");
@@ -3498,7 +3439,7 @@ var hoop = (s2, path, reducer) => {
3498
3439
  const newVal = hoop(oldVal, restOfPath, reducer);
3499
3440
  if (oldVal === newVal)
3500
3441
  return s2;
3501
- const newS = __spreadProps(__spreadValues({}, s2), { [key]: newVal });
3442
+ const newS = { ...s2, [key]: newVal };
3502
3443
  return newS;
3503
3444
  } else {
3504
3445
  const [key, ...restOfPath] = path;
@@ -3576,12 +3517,10 @@ function mergeSequenceTrackMaps(defaultTracks, overrideTracks, activeVariant) {
3576
3517
  return merged;
3577
3518
  }
3578
3519
  function getDefaultStaticOverridesByObject(sheetState) {
3579
- var _a;
3580
- return (_a = sheetState == null ? void 0 : sheetState.staticOverrides) == null ? void 0 : _a.byObject;
3520
+ return sheetState?.staticOverrides?.byObject;
3581
3521
  }
3582
3522
  function getEffectiveStaticOverrideForObject(sheetState, variantId, objectKey) {
3583
- var _a, _b, _c, _d;
3584
- const defaultOverrides = (_a = getDefaultStaticOverridesByObject(sheetState)) == null ? void 0 : _a[objectKey];
3523
+ const defaultOverrides = getDefaultStaticOverridesByObject(sheetState)?.[objectKey];
3585
3524
  if (variantId === DEFAULT_SEQUENCE_VARIANT) {
3586
3525
  return defaultOverrides;
3587
3526
  }
@@ -3589,7 +3528,7 @@ function getEffectiveStaticOverrideForObject(sheetState, variantId, objectKey) {
3589
3528
  sheetState,
3590
3529
  variantId,
3591
3530
  objectKey
3592
- ) ? (_d = (_c = (_b = sheetState == null ? void 0 : sheetState.staticOverridesByVariant) == null ? void 0 : _b[variantId]) == null ? void 0 : _c.byObject) == null ? void 0 : _d[objectKey] : void 0;
3531
+ ) ? sheetState?.staticOverridesByVariant?.[variantId]?.byObject?.[objectKey] : void 0;
3593
3532
  if (!defaultOverrides && !variantOverrides)
3594
3533
  return void 0;
3595
3534
  if (!variantOverrides)
@@ -3599,16 +3538,14 @@ function getEffectiveStaticOverrideForObject(sheetState, variantId, objectKey) {
3599
3538
  return merge_default(cloneDeep_default(defaultOverrides), cloneDeep_default(variantOverrides));
3600
3539
  }
3601
3540
  function isObjectAssignedToSequenceVariant(sheetState, variantId, objectKey) {
3602
- var _a, _b, _c;
3603
3541
  if (variantId === DEFAULT_SEQUENCE_VARIANT)
3604
3542
  return true;
3605
- return (_c = (_b = (_a = sheetState == null ? void 0 : sheetState.variantObjectOverrides) == null ? void 0 : _a[variantId]) == null ? void 0 : _b.includes(objectKey)) != null ? _c : false;
3543
+ return sheetState?.variantObjectOverrides?.[variantId]?.includes(objectKey) ?? false;
3606
3544
  }
3607
3545
  function getSequenceStateFromSheet(sheetState, variantId) {
3608
- var _a;
3609
3546
  if (!sheetState)
3610
3547
  return void 0;
3611
- if ((_a = sheetState.sequencesById) == null ? void 0 : _a[variantId]) {
3548
+ if (sheetState.sequencesById?.[variantId]) {
3612
3549
  return sheetState.sequencesById[variantId];
3613
3550
  }
3614
3551
  if (variantId === DEFAULT_SEQUENCE_VARIANT && sheetState.sequence) {
@@ -3617,25 +3554,23 @@ function getSequenceStateFromSheet(sheetState, variantId) {
3617
3554
  return void 0;
3618
3555
  }
3619
3556
  function valTrackIdByPropPathForObject(sheetStatePointer, variantId, objectKey) {
3620
- var _a, _b, _c, _d;
3621
3557
  (0, import_theatre_dataverse5.val)(sheetStatePointer.sequencesById);
3622
3558
  const sequenceFromMap = (0, import_theatre_dataverse5.val)(sheetStatePointer.sequencesById[variantId]);
3623
3559
  if (sequenceFromMap !== void 0) {
3624
3560
  (0, import_theatre_dataverse5.val)(sheetStatePointer.sequencesById[variantId].tracksByObject);
3625
3561
  return (0, import_theatre_dataverse5.val)(
3626
- (_a = sheetStatePointer.sequencesById[variantId].tracksByObject[objectKey]) == null ? void 0 : _a.trackIdByPropPath
3562
+ sheetStatePointer.sequencesById[variantId].tracksByObject[objectKey]?.trackIdByPropPath
3627
3563
  );
3628
3564
  }
3629
3565
  if (variantId === DEFAULT_SEQUENCE_VARIANT) {
3630
- (0, import_theatre_dataverse5.val)((_b = sheetStatePointer.sequence) == null ? void 0 : _b.tracksByObject);
3566
+ (0, import_theatre_dataverse5.val)(sheetStatePointer.sequence?.tracksByObject);
3631
3567
  return (0, import_theatre_dataverse5.val)(
3632
- (_d = (_c = sheetStatePointer.sequence) == null ? void 0 : _c.tracksByObject[objectKey]) == null ? void 0 : _d.trackIdByPropPath
3568
+ sheetStatePointer.sequence?.tracksByObject[objectKey]?.trackIdByPropPath
3633
3569
  );
3634
3570
  }
3635
3571
  return void 0;
3636
3572
  }
3637
3573
  function valUnsequencedPropPathsForObject(sheetStatePointer, variantId, objectKey) {
3638
- var _a;
3639
3574
  if (variantId === DEFAULT_SEQUENCE_VARIANT)
3640
3575
  return void 0;
3641
3576
  (0, import_theatre_dataverse5.val)(sheetStatePointer.sequencesById);
@@ -3643,7 +3578,7 @@ function valUnsequencedPropPathsForObject(sheetStatePointer, variantId, objectKe
3643
3578
  if (sequenceFromMap !== void 0) {
3644
3579
  (0, import_theatre_dataverse5.val)(sheetStatePointer.sequencesById[variantId].tracksByObject);
3645
3580
  return (0, import_theatre_dataverse5.val)(
3646
- (_a = sheetStatePointer.sequencesById[variantId].tracksByObject[objectKey]) == null ? void 0 : _a.unsequencedPropPaths
3581
+ sheetStatePointer.sequencesById[variantId].tracksByObject[objectKey]?.unsequencedPropPaths
3647
3582
  );
3648
3583
  }
3649
3584
  return void 0;
@@ -3670,9 +3605,8 @@ function validateSequenceVariantIdOrThrow(value, fnName) {
3670
3605
  return idTrimmed;
3671
3606
  }
3672
3607
  function pointerToSequenceTrackData(sheetStatePointer, variantId, objectKey, trackId) {
3673
- var _a;
3674
3608
  const sheetState = (0, import_theatre_dataverse5.val)(sheetStatePointer);
3675
- if ((_a = sheetState == null ? void 0 : sheetState.sequencesById) == null ? void 0 : _a[variantId]) {
3609
+ if (sheetState?.sequencesById?.[variantId]) {
3676
3610
  return sheetStatePointer.sequencesById[variantId].tracksByObject[objectKey].trackData[trackId];
3677
3611
  }
3678
3612
  return sheetStatePointer.sequence.tracksByObject[objectKey].trackData[trackId];
@@ -3736,9 +3670,10 @@ var SheetObject = class {
3736
3670
  );
3737
3671
  this._logger._trace("creating object");
3738
3672
  this._internalUtilCtx = { logger: this._logger.utilFor.internal() };
3739
- this.address = __spreadProps(__spreadValues({}, template.address), {
3673
+ this.address = {
3674
+ ...template.address,
3740
3675
  sheetInstanceId: sheet.address.sheetInstanceId
3741
- });
3676
+ };
3742
3677
  this.publicApi = new TheatreSheetObject(this);
3743
3678
  }
3744
3679
  get type() {
@@ -4057,15 +3992,14 @@ var DEFAULTS = {
4057
3992
  return collapsed;
4058
3993
  },
4059
3994
  css(name) {
4060
- var _a, _b, _c, _d;
4061
3995
  const found = this.cssMemo.get(name);
4062
3996
  if (found)
4063
3997
  return found;
4064
- let css = "color:".concat((_b = (_a = this.color) == null ? void 0 : _a.call(this, name)) != null ? _b : "hsl(".concat((name.charCodeAt(0) + name.charCodeAt(name.length - 1)) % 360, ", 100%, 60%)"));
4065
- if ((_c = this.bold) == null ? void 0 : _c.test(name)) {
3998
+ let css = "color:".concat(this.color?.(name) ?? "hsl(".concat((name.charCodeAt(0) + name.charCodeAt(name.length - 1)) % 360, ", 100%, 60%)"));
3999
+ if (this.bold?.test(name)) {
4066
4000
  css += ";font-weight:600";
4067
4001
  }
4068
- if ((_d = this.italic) == null ? void 0 : _d.test(name)) {
4002
+ if (this.italic?.test(name)) {
4069
4003
  css += ";font-style:italic";
4070
4004
  }
4071
4005
  this.cssMemo.set(name, css);
@@ -4074,7 +4008,7 @@ var DEFAULTS = {
4074
4008
  }
4075
4009
  };
4076
4010
  function createTheatreInternalLogger(useConsole = console, _options = {}) {
4077
- const ref = __spreadProps(__spreadValues({}, DEFAULTS), { includes: __spreadValues({}, DEFAULTS.includes) });
4011
+ const ref = { ...DEFAULTS, includes: { ...DEFAULTS.includes } };
4078
4012
  const createConsole = {
4079
4013
  styled: createConsoleLoggerStyled.bind(ref, useConsole),
4080
4014
  noStyle: createConsoleLoggerNoStyle.bind(ref, useConsole)
@@ -4086,12 +4020,11 @@ function createTheatreInternalLogger(useConsole = console, _options = {}) {
4086
4020
  ref.create = getConCreate();
4087
4021
  return {
4088
4022
  configureLogger(config) {
4089
- var _a;
4090
4023
  if (config === "console") {
4091
4024
  ref.loggerConsoleStyle = DEFAULTS.loggerConsoleStyle;
4092
4025
  ref.create = getConCreate();
4093
4026
  } else if (config.type === "console") {
4094
- ref.loggerConsoleStyle = (_a = config.style) != null ? _a : DEFAULTS.loggerConsoleStyle;
4027
+ ref.loggerConsoleStyle = config.style ?? DEFAULTS.loggerConsoleStyle;
4095
4028
  ref.create = getConCreate();
4096
4029
  } else if (config.type === "keyed") {
4097
4030
  ref.creatExt = (source) => config.keyed(source.names);
@@ -4102,12 +4035,11 @@ function createTheatreInternalLogger(useConsole = console, _options = {}) {
4102
4035
  }
4103
4036
  },
4104
4037
  configureLogging(config) {
4105
- var _a, _b, _c, _d, _e;
4106
- ref.includes.dev = (_a = config.dev) != null ? _a : DEFAULTS.includes.dev;
4107
- ref.includes.internal = (_b = config.internal) != null ? _b : DEFAULTS.includes.internal;
4108
- ref.includes.min = (_c = config.min) != null ? _c : DEFAULTS.includes.min;
4109
- ref.include = (_d = config.include) != null ? _d : DEFAULTS.include;
4110
- ref.loggingConsoleStyle = (_e = config.consoleStyle) != null ? _e : DEFAULTS.loggingConsoleStyle;
4038
+ ref.includes.dev = config.dev ?? DEFAULTS.includes.dev;
4039
+ ref.includes.internal = config.internal ?? DEFAULTS.includes.internal;
4040
+ ref.includes.min = config.min ?? DEFAULTS.includes.min;
4041
+ ref.include = config.include ?? DEFAULTS.include;
4042
+ ref.loggingConsoleStyle = config.consoleStyle ?? DEFAULTS.loggingConsoleStyle;
4111
4043
  ref.create = getConCreate();
4112
4044
  },
4113
4045
  getLogger() {
@@ -4123,7 +4055,7 @@ function configNamedToKeyed(namedFn, source) {
4123
4055
  return namedFn(names);
4124
4056
  }
4125
4057
  function createExtLogger(source) {
4126
- const includes = __spreadValues(__spreadValues({}, this.includes), this.include(source));
4058
+ const includes = { ...this.includes, ...this.include(source) };
4127
4059
  const f2 = this.filtered;
4128
4060
  const named = this.named.bind(this, source);
4129
4061
  const ext = this.creatExt(source);
@@ -4227,7 +4159,7 @@ function createExtLogger(source) {
4227
4159
  return logger;
4228
4160
  }
4229
4161
  function createConsoleLoggerStyled(con, source) {
4230
- const includes = __spreadValues(__spreadValues({}, this.includes), this.include(source));
4162
+ const includes = { ...this.includes, ...this.include(source) };
4231
4163
  const styleArgs = [];
4232
4164
  let prefix = "";
4233
4165
  for (let i2 = 0; i2 < source.names.length; i2++) {
@@ -4260,7 +4192,7 @@ function styledKapowPrefix(args) {
4260
4192
  return start;
4261
4193
  }
4262
4194
  function createConsoleLoggerNoStyle(con, source) {
4263
- const includes = __spreadValues(__spreadValues({}, this.includes), this.include(source));
4195
+ const includes = { ...this.includes, ...this.include(source) };
4264
4196
  let prefix = "";
4265
4197
  for (let i2 = 0; i2 < source.names.length; i2++) {
4266
4198
  const { name, key } = source.names[i2];
@@ -4453,7 +4385,7 @@ var SheetObjectTemplate = class {
4453
4385
  __publicField(this, "_transientPropPaths", /* @__PURE__ */ new Set());
4454
4386
  __publicField(this, "_staticPropPaths", /* @__PURE__ */ new Set());
4455
4387
  __publicField(this, "_visibleInOutline", true);
4456
- this.address = __spreadProps(__spreadValues({}, sheetTemplate.address), { objectKey });
4388
+ this.address = { ...sheetTemplate.address, objectKey };
4457
4389
  this._config = new import_theatre_dataverse7.Atom(config);
4458
4390
  this._temp_actions_atom = new import_theatre_dataverse7.Atom(_temp_actions);
4459
4391
  this._transientPropPaths = normalizeTransientPropPaths(
@@ -4605,13 +4537,12 @@ var SheetObjectTemplate = class {
4605
4537
  return this._cache.get(
4606
4538
  "getStaticValues:".concat(sequenceVariant),
4607
4539
  () => (0, import_theatre_dataverse7.prism)(() => {
4608
- var _a;
4609
4540
  const sheetState = (0, import_theatre_dataverse7.val)(this.pointerToSheetState);
4610
- const json = (_a = getEffectiveStaticOverrideForObject(
4541
+ const json = getEffectiveStaticOverrideForObject(
4611
4542
  sheetState,
4612
4543
  sequenceVariant,
4613
4544
  this.address.objectKey
4614
- )) != null ? _a : {};
4545
+ ) ?? {};
4615
4546
  const config = (0, import_theatre_dataverse7.val)(this.configPointer);
4616
4547
  const deserialized = config.deserializeAndSanitize(json) || {};
4617
4548
  const withoutNonPersisting = stripNonPersistingPropValuesFromMap(
@@ -4636,8 +4567,7 @@ var SheetObjectTemplate = class {
4636
4567
  return this._cache.get(
4637
4568
  "getAhistoricStaticValues",
4638
4569
  () => (0, import_theatre_dataverse7.prism)(() => {
4639
- var _a;
4640
- const json = (_a = (0, import_theatre_dataverse7.val)(this.pointerToAhistoricStaticOverrides)) != null ? _a : {};
4570
+ const json = (0, import_theatre_dataverse7.val)(this.pointerToAhistoricStaticOverrides) ?? {};
4641
4571
  const config = (0, import_theatre_dataverse7.val)(this.configPointer);
4642
4572
  const deserialized = config.deserializeAndSanitize(json) || {};
4643
4573
  return stripNonPersistingPropValuesFromMap(deserialized, config);
@@ -4688,7 +4618,7 @@ var SheetObjectTemplate = class {
4688
4618
  )) {
4689
4619
  if (!effectiveTrack)
4690
4620
  continue;
4691
- if (unsequencedPropPathSet == null ? void 0 : unsequencedPropPathSet.has(
4621
+ if (unsequencedPropPathSet?.has(
4692
4622
  pathToPropInString
4693
4623
  )) {
4694
4624
  continue;
@@ -4747,9 +4677,8 @@ var SheetObjectTemplate = class {
4747
4677
  );
4748
4678
  }
4749
4679
  getSequenceVariantOwningTrack(trackId, activeVariant) {
4750
- var _a;
4751
4680
  const tracks = this.getArrayOfValidSequenceTracks(activeVariant).getValue();
4752
- return (_a = tracks.find((t2) => t2.trackId === trackId)) == null ? void 0 : _a.trackVariant;
4681
+ return tracks.find((t2) => t2.trackId === trackId)?.trackVariant;
4753
4682
  }
4754
4683
  /**
4755
4684
  * @returns The static overrides that are not sequenced. Returns undefined if there are no static overrides,
@@ -5038,7 +4967,6 @@ var notifications = "__TheatreJS_Notifications";
5038
4967
 
5039
4968
  // shared/src/notify.ts
5040
4969
  var createHandler = (type) => (...args) => {
5041
- var _a;
5042
4970
  switch (type) {
5043
4971
  case "success": {
5044
4972
  logger_default.debug(args.slice(0, 2).join("\n"));
@@ -5057,7 +4985,7 @@ var createHandler = (type) => (...args) => {
5057
4985
  }
5058
4986
  return typeof window !== "undefined" ? (
5059
4987
  // @ts-ignore
5060
- (_a = window[notifications]) == null ? void 0 : _a.notify[type](...args)
4988
+ window[notifications]?.notify[type](...args)
5061
4989
  ) : void 0;
5062
4990
  };
5063
4991
  var notify = {
@@ -5105,13 +5033,13 @@ var AudioPlaybackController = class {
5105
5033
  this._playing = true;
5106
5034
  let stop = void 0;
5107
5035
  const play = () => {
5108
- stop == null ? void 0 : stop();
5036
+ stop?.();
5109
5037
  stop = this._loopInRange(rangeD.getValue(), ticker).stop;
5110
5038
  };
5111
5039
  const untapFromRangeD = rangeD.onStale(play);
5112
5040
  play();
5113
5041
  this._stopPlayCallback = () => {
5114
- stop == null ? void 0 : stop();
5042
+ stop?.();
5115
5043
  untapFromRangeD();
5116
5044
  deferred.resolve(false);
5117
5045
  };
@@ -5175,7 +5103,7 @@ var AudioPlaybackController = class {
5175
5103
  this._updatePositionInState(time);
5176
5104
  }
5177
5105
  _updatePositionInState(time) {
5178
- this._state.reduce((s2) => __spreadProps(__spreadValues({}, s2), { position: time }));
5106
+ this._state.reduce((s2) => ({ ...s2, position: time }));
5179
5107
  }
5180
5108
  getCurrentPosition() {
5181
5109
  return this._state.get().position;
@@ -5271,32 +5199,29 @@ var AudioPlaybackController = class {
5271
5199
  var import_theatre_dataverse10 = require("@unseenco/theatre-dataverse");
5272
5200
  var lastDriverId = 0;
5273
5201
  function createRafDriver(conf) {
5274
- var _a;
5275
5202
  const tick = (time) => {
5276
5203
  ticker.tick(time);
5277
5204
  };
5278
5205
  const ticker = new import_theatre_dataverse10.Ticker({
5279
5206
  onActive() {
5280
- var _a2;
5281
- (_a2 = conf == null ? void 0 : conf.start) == null ? void 0 : _a2.call(conf);
5207
+ conf?.start?.();
5282
5208
  },
5283
5209
  onDormant() {
5284
- var _a2;
5285
- (_a2 = conf == null ? void 0 : conf.stop) == null ? void 0 : _a2.call(conf);
5210
+ conf?.stop?.();
5286
5211
  }
5287
5212
  });
5288
5213
  const driverPublicApi = {
5289
5214
  tick,
5290
5215
  id: lastDriverId++,
5291
- name: (_a = conf == null ? void 0 : conf.name) != null ? _a : "CustomRafDriver-".concat(lastDriverId),
5216
+ name: conf?.name ?? "CustomRafDriver-".concat(lastDriverId),
5292
5217
  type: "Theatre_RafDriver_PublicAPI"
5293
5218
  };
5294
5219
  const driverPrivateApi = {
5295
5220
  type: "Theatre_RafDriver_PrivateAPI",
5296
5221
  publicApi: driverPublicApi,
5297
5222
  ticker,
5298
- start: conf == null ? void 0 : conf.start,
5299
- stop: conf == null ? void 0 : conf.stop
5223
+ start: conf?.start,
5224
+ stop: conf?.stop
5300
5225
  };
5301
5226
  setPrivateAPI(driverPublicApi, driverPrivateApi);
5302
5227
  return driverPublicApi;
@@ -5360,8 +5285,8 @@ var TheatreSequence = class {
5360
5285
  play(conf) {
5361
5286
  const priv = privateAPI(this);
5362
5287
  if (priv._project.isReady()) {
5363
- const ticker = (conf == null ? void 0 : conf.rafDriver) ? privateAPI(conf.rafDriver).ticker : getCoreTicker();
5364
- return priv.play(conf != null ? conf : {}, ticker);
5288
+ const ticker = conf?.rafDriver ? privateAPI(conf.rafDriver).ticker : getCoreTicker();
5289
+ return priv.play(conf ?? {}, ticker);
5365
5290
  } else {
5366
5291
  if (process.env.NODE_ENV !== "production") {
5367
5292
  notify.warning(
@@ -5552,10 +5477,10 @@ var Sequence = class {
5552
5477
  );
5553
5478
  });
5554
5479
  this._logger = _project._logger.named("Sheet", _sheet.address.sheetId).named("Instance", _sheet.address.sheetInstanceId).named("Variant", _sequenceVariant);
5555
- this.address = __spreadProps(__spreadValues({}, this._sheet.address), { sequenceName: _sequenceVariant });
5480
+ this.address = { ...this._sheet.address, sequenceName: _sequenceVariant };
5556
5481
  this.publicApi = new TheatreSequence(this);
5557
5482
  this._playbackControllerBox = new import_theatre_dataverse12.Atom(
5558
- playbackController != null ? playbackController : new DefaultPlaybackController()
5483
+ playbackController ?? new DefaultPlaybackController()
5559
5484
  );
5560
5485
  this._prismOfStatePointer = (0, import_theatre_dataverse14.prism)(
5561
5486
  () => this._playbackControllerBox.prism.getValue().statePointer
@@ -5600,7 +5525,6 @@ var Sequence = class {
5600
5525
  * Theoretically, this method can be called from inside a prism so it can be reactive.
5601
5526
  */
5602
5527
  getKeyframesOfSimpleProp(prop) {
5603
- var _a;
5604
5528
  const { path, root: root2 } = (0, import_theatre_dataverse11.getPointerParts)(prop);
5605
5529
  if (!isSheetObject(root2)) {
5606
5530
  throw new InvalidArgumentError(
@@ -5610,7 +5534,7 @@ var Sequence = class {
5610
5534
  const sheetState = (0, import_theatre_dataverse14.val)(
5611
5535
  this._project.pointers.historic.sheetsById[this._sheet.address.sheetId]
5612
5536
  );
5613
- const trackP = (_a = getSequenceStateFromSheet(sheetState, this._sequenceVariant)) == null ? void 0 : _a.tracksByObject[root2.address.objectKey];
5537
+ const trackP = getSequenceStateFromSheet(sheetState, this._sequenceVariant)?.tracksByObject[root2.address.objectKey];
5614
5538
  if (!trackP) {
5615
5539
  return [];
5616
5540
  }
@@ -5913,11 +5837,12 @@ function rgba2hex(rgba2, {
5913
5837
  return "#".concat(hex);
5914
5838
  }
5915
5839
  function decorateRgba(rgba2) {
5916
- return __spreadProps(__spreadValues({}, rgba2), {
5840
+ return {
5841
+ ...rgba2,
5917
5842
  toString() {
5918
5843
  return rgba2hex(this, { removeAlphaIfOpaque: true });
5919
5844
  }
5920
- });
5845
+ };
5921
5846
  }
5922
5847
  function clampRgba(rgba2) {
5923
5848
  return Object.fromEntries(
@@ -6125,8 +6050,7 @@ var file = (defaultValue, opts = {}) => {
6125
6050
  validateCommonOpts("t.file(defaultValue, opts)", opts);
6126
6051
  }
6127
6052
  const interpolate = (left, right, progression) => {
6128
- var _a;
6129
- const stringInterpolate = (_a = opts.interpolate) != null ? _a : leftInterpolate;
6053
+ const stringInterpolate = opts.interpolate ?? leftInterpolate;
6130
6054
  return {
6131
6055
  type: "file",
6132
6056
  id: stringInterpolate(left.id, right.id, progression)
@@ -6160,8 +6084,7 @@ var image = (defaultValue, opts = {}) => {
6160
6084
  validateCommonOpts("t.image(defaultValue, opts)", opts);
6161
6085
  }
6162
6086
  const interpolate = (left, right, progression) => {
6163
- var _a;
6164
- const stringInterpolate = (_a = opts.interpolate) != null ? _a : leftInterpolate;
6087
+ const stringInterpolate = opts.interpolate ?? leftInterpolate;
6165
6088
  return {
6166
6089
  type: "image",
6167
6090
  id: stringInterpolate(left.id, right.id, progression)
@@ -6192,7 +6115,6 @@ var _ensureImage = (val11) => {
6192
6115
  return val11;
6193
6116
  };
6194
6117
  var number = (defaultValue, opts = {}) => {
6195
- var _a;
6196
6118
  if (process.env.NODE_ENV !== "production") {
6197
6119
  validateCommonOpts("t.number(defaultValue, opts)", opts);
6198
6120
  if (typeof defaultValue !== "number" || !isFinite(defaultValue)) {
@@ -6249,18 +6171,18 @@ var number = (defaultValue, opts = {}) => {
6249
6171
  }
6250
6172
  }
6251
6173
  }
6252
- return __spreadProps(__spreadValues({
6174
+ return {
6253
6175
  type: "number",
6254
6176
  valueType: 0,
6255
6177
  default: defaultValue,
6256
- [propTypeSymbol]: "TheatrePropType"
6257
- }, opts ? opts : {}), {
6178
+ [propTypeSymbol]: "TheatrePropType",
6179
+ ...opts ? opts : {},
6258
6180
  label: opts.label,
6259
- nudgeFn: (_a = opts.nudgeFn) != null ? _a : defaultNumberNudgeFn,
6181
+ nudgeFn: opts.nudgeFn ?? defaultNumberNudgeFn,
6260
6182
  nudgeMultiplier: typeof opts.nudgeMultiplier === "number" ? opts.nudgeMultiplier : void 0,
6261
6183
  interpolate: _interpolateNumber,
6262
6184
  deserializeAndSanitize: numberDeserializer(opts.range)
6263
- });
6185
+ };
6264
6186
  };
6265
6187
  var numberDeserializer = (range) => range ? (json) => {
6266
6188
  if (!(typeof json === "number" && isFinite(json)))
@@ -6338,7 +6260,6 @@ var _interpolateRgba = (left, right, progression) => {
6338
6260
  return decorateRgba(interpolatedRgba);
6339
6261
  };
6340
6262
  var boolean = (defaultValue, opts = {}) => {
6341
- var _a;
6342
6263
  if (process.env.NODE_ENV !== "production") {
6343
6264
  validateCommonOpts("t.boolean(defaultValue, opts)", opts);
6344
6265
  if (typeof defaultValue !== "boolean") {
@@ -6355,7 +6276,7 @@ var boolean = (defaultValue, opts = {}) => {
6355
6276
  valueType: null,
6356
6277
  [propTypeSymbol]: "TheatrePropType",
6357
6278
  label: opts.label,
6358
- interpolate: (_a = opts.interpolate) != null ? _a : leftInterpolate,
6279
+ interpolate: opts.interpolate ?? leftInterpolate,
6359
6280
  deserializeAndSanitize: _ensureBoolean
6360
6281
  };
6361
6282
  };
@@ -6366,7 +6287,6 @@ function leftInterpolate(left) {
6366
6287
  return left;
6367
6288
  }
6368
6289
  var string = (defaultValue, opts = {}) => {
6369
- var _a;
6370
6290
  if (process.env.NODE_ENV !== "production") {
6371
6291
  validateCommonOpts("t.string(defaultValue, opts)", opts);
6372
6292
  if (typeof defaultValue !== "string") {
@@ -6383,7 +6303,7 @@ var string = (defaultValue, opts = {}) => {
6383
6303
  valueType: null,
6384
6304
  [propTypeSymbol]: "TheatrePropType",
6385
6305
  label: opts.label,
6386
- interpolate: (_a = opts.interpolate) != null ? _a : leftInterpolate,
6306
+ interpolate: opts.interpolate ?? leftInterpolate,
6387
6307
  deserializeAndSanitize: _ensureString
6388
6308
  };
6389
6309
  };
@@ -6391,16 +6311,15 @@ function _ensureString(s2) {
6391
6311
  return typeof s2 === "string" ? s2 : void 0;
6392
6312
  }
6393
6313
  function stringLiteral(defaultValue, valuesAndLabels, opts = {}) {
6394
- var _a, _b;
6395
6314
  return {
6396
6315
  type: "stringLiteral",
6397
6316
  default: defaultValue,
6398
- valuesAndLabels: __spreadValues({}, valuesAndLabels),
6317
+ valuesAndLabels: { ...valuesAndLabels },
6399
6318
  [propTypeSymbol]: "TheatrePropType",
6400
6319
  valueType: null,
6401
- as: (_a = opts.as) != null ? _a : "menu",
6320
+ as: opts.as ?? "menu",
6402
6321
  label: opts.label,
6403
- interpolate: (_b = opts.interpolate) != null ? _b : leftInterpolate,
6322
+ interpolate: opts.interpolate ?? leftInterpolate,
6404
6323
  deserializeAndSanitize(json) {
6405
6324
  if (typeof json !== "string")
6406
6325
  return void 0;
@@ -6418,12 +6337,11 @@ var defaultNumberNudgeFn = ({
6418
6337
  deltaFraction,
6419
6338
  magnitude
6420
6339
  }) => {
6421
- var _a;
6422
6340
  const { range } = config;
6423
6341
  if (!config.nudgeMultiplier && range && !range.includes(Infinity) && !range.includes(-Infinity)) {
6424
6342
  return deltaFraction * (range[1] - range[0]) * magnitude;
6425
6343
  }
6426
- return deltaX * magnitude * ((_a = config.nudgeMultiplier) != null ? _a : 1);
6344
+ return deltaX * magnitude * (config.nudgeMultiplier ?? 1);
6427
6345
  };
6428
6346
 
6429
6347
  // shared/src/utils/slashedPaths.ts
@@ -6500,13 +6418,13 @@ var TheatreSheet = class {
6500
6418
  );
6501
6419
  const existingObject = internal2.getObject(sanitizedPath);
6502
6420
  const nativeObject = null;
6503
- const actions = opts == null ? void 0 : opts.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
6421
+ const actions = opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;
6504
6422
  if (existingObject) {
6505
6423
  if (process.env.NODE_ENV !== "production") {
6506
6424
  const prevConfig = weakMapOfUnsanitizedProps.get(existingObject);
6507
6425
  if (prevConfig) {
6508
6426
  if (!(0, import_fast_deep_equal.default)(config, prevConfig)) {
6509
- if ((opts == null ? void 0 : opts.reconfigure) === true) {
6427
+ if (opts?.reconfigure === true) {
6510
6428
  const sanitizedConfig = compound(config);
6511
6429
  existingObject.template.reconfigure(sanitizedConfig);
6512
6430
  if (opts.transient !== void 0) {
@@ -6534,16 +6452,16 @@ var TheatreSheet = class {
6534
6452
  if (actions) {
6535
6453
  existingObject.template._temp_setActions(actions);
6536
6454
  }
6537
- if ((opts == null ? void 0 : opts.visible) !== void 0) {
6455
+ if (opts?.visible !== void 0) {
6538
6456
  existingObject.template.setVisibleInOutline(opts.visible);
6539
6457
  }
6540
- if ((opts == null ? void 0 : opts.transient) !== void 0) {
6458
+ if (opts?.transient !== void 0) {
6541
6459
  existingObject.template.setTransientPropPaths(
6542
6460
  opts.transient,
6543
6461
  existingObject.template.staticConfig
6544
6462
  );
6545
6463
  }
6546
- if ((opts == null ? void 0 : opts.static) !== void 0) {
6464
+ if (opts?.static !== void 0) {
6547
6465
  existingObject.template.setStaticPropPaths(
6548
6466
  opts.static,
6549
6467
  existingObject.template.staticConfig
@@ -6557,9 +6475,9 @@ var TheatreSheet = class {
6557
6475
  nativeObject,
6558
6476
  sanitizedConfig,
6559
6477
  actions,
6560
- opts == null ? void 0 : opts.visible,
6561
- opts == null ? void 0 : opts.transient,
6562
- opts == null ? void 0 : opts.static
6478
+ opts?.visible,
6479
+ opts?.transient,
6480
+ opts?.static
6563
6481
  );
6564
6482
  if (process.env.NODE_ENV !== "production") {
6565
6483
  weakMapOfUnsanitizedProps.set(object, config);
@@ -6583,7 +6501,7 @@ var TheatreSheet = class {
6583
6501
  return privateAPI(this).project.publicApi;
6584
6502
  }
6585
6503
  get address() {
6586
- return __spreadValues({}, privateAPI(this).address);
6504
+ return { ...privateAPI(this).address };
6587
6505
  }
6588
6506
  detachObject(key) {
6589
6507
  const internal2 = privateAPI(this);
@@ -6609,7 +6527,7 @@ var TheatreSheet = class {
6609
6527
  "sheet.declareOutlineNamespace"
6610
6528
  );
6611
6529
  internal2.template.setOutlineNamespaceConfig(parsedPath.join(" / "), {
6612
- defaultCollapsed: opts == null ? void 0 : opts.collapsed
6530
+ defaultCollapsed: opts?.collapsed
6613
6531
  });
6614
6532
  }
6615
6533
  setOutlineNamespaceCollapsed(namespacePath, collapsed) {
@@ -6652,9 +6570,10 @@ var Sheet = class {
6652
6570
  this._logger = template.project._logger.named("Sheet", instanceId);
6653
6571
  this._logger._trace("creating sheet");
6654
6572
  this.project = template.project;
6655
- this.address = __spreadProps(__spreadValues({}, template.address), {
6573
+ this.address = {
6574
+ ...template.address,
6656
6575
  sheetInstanceId: this.instanceId
6657
- });
6576
+ };
6658
6577
  this.publicApi = new TheatreSheet(this);
6659
6578
  this.effectiveActiveSequenceVariantD = (0, import_theatre_dataverse15.prism)(() => {
6660
6579
  const studioOverride = (0, import_theatre_dataverse15.val)(this._studioPreviewVariantOverride.pointer);
@@ -6690,34 +6609,32 @@ var Sheet = class {
6690
6609
  }
6691
6610
  deleteObject(objectKey) {
6692
6611
  this._objects.reduce((state) => {
6693
- const newState = __spreadValues({}, state);
6612
+ const newState = { ...state };
6694
6613
  delete newState[objectKey];
6695
6614
  return newState;
6696
6615
  });
6697
6616
  }
6698
6617
  getSequence(variant) {
6699
- const variantId = variant != null ? variant : (0, import_theatre_dataverse15.val)(this._activeSequenceVariant.pointer);
6618
+ const variantId = variant ?? (0, import_theatre_dataverse15.val)(this._activeSequenceVariant.pointer);
6700
6619
  if (!this._sequences[variantId]) {
6701
6620
  const lengthD = (0, import_theatre_dataverse15.prism)(() => {
6702
- var _a;
6703
6621
  const sheetState = (0, import_theatre_dataverse15.val)(
6704
6622
  this.project.pointers.historic.sheetsById[this.address.sheetId]
6705
6623
  );
6706
- const unsanitized = (_a = getSequenceStateFromSheet(
6624
+ const unsanitized = getSequenceStateFromSheet(
6707
6625
  sheetState,
6708
6626
  variantId
6709
- )) == null ? void 0 : _a.length;
6627
+ )?.length;
6710
6628
  return sanitizeSequenceLength(unsanitized);
6711
6629
  });
6712
6630
  const subUnitsPerUnitD = (0, import_theatre_dataverse15.prism)(() => {
6713
- var _a;
6714
6631
  const sheetState = (0, import_theatre_dataverse15.val)(
6715
6632
  this.project.pointers.historic.sheetsById[this.address.sheetId]
6716
6633
  );
6717
- const unsanitized = (_a = getSequenceStateFromSheet(
6634
+ const unsanitized = getSequenceStateFromSheet(
6718
6635
  sheetState,
6719
6636
  variantId
6720
- )) == null ? void 0 : _a.subUnitsPerUnit;
6637
+ )?.subUnitsPerUnit;
6721
6638
  return sanitizeSequenceSubUnitsPerUnit(unsanitized);
6722
6639
  });
6723
6640
  this._sequences[variantId] = new Sequence(
@@ -6780,7 +6697,7 @@ var SheetTemplate = class {
6780
6697
  __publicField(this, "_pendingOutlineNamespaces", {});
6781
6698
  __publicField(this, "_sequenceVariants", [DEFAULT_SEQUENCE_VARIANT]);
6782
6699
  __publicField(this, "_visibleInOutline", true);
6783
- this.address = __spreadProps(__spreadValues({}, project.address), { sheetId });
6700
+ this.address = { ...project.address, sheetId };
6784
6701
  }
6785
6702
  getInstance(instanceId) {
6786
6703
  let inst = this._instances.get()[instanceId];
@@ -6814,7 +6731,10 @@ var SheetTemplate = class {
6814
6731
  return template;
6815
6732
  }
6816
6733
  setOutlineNamespaceConfig(namespacePathKey, config) {
6817
- this._pendingOutlineNamespaces[namespacePathKey] = __spreadValues(__spreadValues({}, this._pendingOutlineNamespaces[namespacePathKey]), config);
6734
+ this._pendingOutlineNamespaces[namespacePathKey] = {
6735
+ ...this._pendingOutlineNamespaces[namespacePathKey],
6736
+ ...config
6737
+ };
6818
6738
  this.project._commitOutlineNamespaceConfig(
6819
6739
  this.address.sheetId,
6820
6740
  namespacePathKey,
@@ -7245,15 +7165,15 @@ var globals_default = globals;
7245
7165
  async function initialiseProjectState(studio, project, onDiskState) {
7246
7166
  await delay_default(0);
7247
7167
  studio.transaction(({ drafts }) => {
7248
- var _a, _b, _c;
7168
+ var _a;
7249
7169
  const projectId = project.address.projectId;
7250
7170
  drafts.ephemeral.coreByProject[projectId] = {
7251
7171
  lastExportedObject: null,
7252
7172
  loadingState: { type: "loading" }
7253
7173
  };
7254
- (_b = (_a = drafts.ahistoric.coreByProject)[projectId]) != null ? _b : _a[projectId] = {
7174
+ (_a = drafts.ahistoric.coreByProject)[projectId] ?? (_a[projectId] = {
7255
7175
  ahistoricStuff: ""
7256
- };
7176
+ });
7257
7177
  function useInitialState() {
7258
7178
  drafts.ephemeral.coreByProject[projectId].loadingState = {
7259
7179
  type: "loaded"
@@ -7281,7 +7201,7 @@ async function initialiseProjectState(studio, project, onDiskState) {
7281
7201
  onDiskState: onDiskState2
7282
7202
  };
7283
7203
  }
7284
- const browserState = (_c = e(drafts.historic)) == null ? void 0 : _c.coreByProject[project.address.projectId];
7204
+ const browserState = e(drafts.historic)?.coreByProject[project.address.projectId];
7285
7205
  if (!browserState) {
7286
7206
  if (!onDiskState) {
7287
7207
  useInitialState();
@@ -7478,8 +7398,7 @@ var RemoteSync = class {
7478
7398
  function noop2() {
7479
7399
  }
7480
7400
  function _coreLogger(config) {
7481
- var _a, _b;
7482
- const internalMin = ((_a = config == null ? void 0 : config.logging) == null ? void 0 : _a.internal) ? (_b = config.logging.min) != null ? _b : 256 /* WARN */ : Infinity;
7401
+ const internalMin = config?.logging?.internal ? config.logging.min ?? 256 /* WARN */ : Infinity;
7483
7402
  const shouldDebugLogger = internalMin <= 128 /* DEBUG */;
7484
7403
  const shouldShowLoggerErrors = internalMin <= 512 /* ERROR */;
7485
7404
  const internal2 = createTheatreInternalLogger(void 0, {
@@ -7544,7 +7463,7 @@ function stripImageAssetsFromAhistoricStaticOverrides(ahistoricStaticOverridesBy
7544
7463
  forEachPropDeep(
7545
7464
  cloned,
7546
7465
  (value, path) => {
7547
- if ((value == null ? void 0 : value.type) === "image") {
7466
+ if (value?.type === "image") {
7548
7467
  removePathFromObject(cloned, path);
7549
7468
  }
7550
7469
  },
@@ -7578,7 +7497,6 @@ var Project = class {
7578
7497
  __publicField(this, "_remoteSync");
7579
7498
  __publicField(this, "type", "Theatre_Project");
7580
7499
  __publicField(this, "_logger");
7581
- var _a;
7582
7500
  this._logger = _coreLogger({ logging: { dev: true } }).named("Project", id);
7583
7501
  this._logger.traceDev("creating project");
7584
7502
  this.address = { projectId: id };
@@ -7587,7 +7505,7 @@ var Project = class {
7587
7505
  ahistoric: {
7588
7506
  ahistoricStuff: ""
7589
7507
  },
7590
- historic: (_a = config.state) != null ? _a : {
7508
+ historic: config.state ?? {
7591
7509
  sheetsById: {},
7592
7510
  definitionVersion: globals_default.currentProjectStateDefinitionVersion,
7593
7511
  revisionHistory: []
@@ -7602,10 +7520,7 @@ var Project = class {
7602
7520
  this._onDiskStateAtom = onDiskStateAtom;
7603
7521
  this._assetStorageReadyDeferred = defer();
7604
7522
  this.assetStorage = {
7605
- getAssetUrl: (assetId) => {
7606
- var _a2;
7607
- return "".concat((_a2 = config.assets) == null ? void 0 : _a2.baseUrl, "/").concat(assetId);
7608
- },
7523
+ getAssetUrl: (assetId) => "".concat(config.assets?.baseUrl, "/").concat(assetId),
7609
7524
  // Until the asset storage is ready, we'll throw an error when the user tries to use it
7610
7525
  createAsset: () => {
7611
7526
  throw new Error("Please wait for Project.ready to use assets.");
@@ -7670,7 +7585,6 @@ var Project = class {
7670
7585
  }
7671
7586
  this._studio = studio;
7672
7587
  studio.initialized.then(async () => {
7673
- var _a;
7674
7588
  await initialiseProjectState(studio, this, this.config.state);
7675
7589
  this._pointerProxies.historic.setPointer(
7676
7590
  studio.atomP.historic.coreByProject[this.address.projectId]
@@ -7682,7 +7596,7 @@ var Project = class {
7682
7596
  studio.atomP.ephemeral.coreByProject[this.address.projectId]
7683
7597
  );
7684
7598
  this._stripImageAssetsFromAhistoricState();
7685
- await studio.createAssetStorage(this, (_a = this.config.assets) == null ? void 0 : _a.baseUrl).then((assetStorage) => {
7599
+ await studio.createAssetStorage(this, this.config.assets?.baseUrl).then((assetStorage) => {
7686
7600
  this.assetStorage = assetStorage;
7687
7601
  this._assetStorageReadyDeferred.resolve(void 0);
7688
7602
  });
@@ -7707,9 +7621,9 @@ var Project = class {
7707
7621
  let template = this._sheetTemplates.get()[sheetId];
7708
7622
  if (!template) {
7709
7623
  template = new SheetTemplate(this, sheetId);
7710
- this._sheetTemplates.reduce((s2) => __spreadProps(__spreadValues({}, s2), { [sheetId]: template }));
7624
+ this._sheetTemplates.reduce((s2) => ({ ...s2, [sheetId]: template }));
7711
7625
  }
7712
- if ((opts == null ? void 0 : opts.visible) !== void 0) {
7626
+ if (opts?.visible !== void 0) {
7713
7627
  template.setVisibleInOutline(opts.visible);
7714
7628
  }
7715
7629
  const sheet = template.getInstance(instanceId);
@@ -7718,12 +7632,15 @@ var Project = class {
7718
7632
  }
7719
7633
  _commitOutlineNamespaceConfig(sheetId, namespacePathKey, config) {
7720
7634
  this._mutateCoreAhistoric((ahistoric) => {
7721
- var _a, _b, _c, _d;
7722
- (_a = ahistoric.sheetsById) != null ? _a : ahistoric.sheetsById = {};
7723
- (_c = (_b = ahistoric.sheetsById)[sheetId]) != null ? _c : _b[sheetId] = { staticOverrides: { byObject: {} } };
7635
+ var _a;
7636
+ ahistoric.sheetsById ?? (ahistoric.sheetsById = {});
7637
+ (_a = ahistoric.sheetsById)[sheetId] ?? (_a[sheetId] = { staticOverrides: { byObject: {} } });
7724
7638
  const sheetState = ahistoric.sheetsById[sheetId];
7725
- (_d = sheetState.outlineNamespaces) != null ? _d : sheetState.outlineNamespaces = {};
7726
- sheetState.outlineNamespaces[namespacePathKey] = __spreadValues(__spreadValues({}, sheetState.outlineNamespaces[namespacePathKey]), config);
7639
+ sheetState.outlineNamespaces ?? (sheetState.outlineNamespaces = {});
7640
+ sheetState.outlineNamespaces[namespacePathKey] = {
7641
+ ...sheetState.outlineNamespaces[namespacePathKey],
7642
+ ...config
7643
+ };
7727
7644
  });
7728
7645
  }
7729
7646
  _flushPendingOutlineNamespaces() {
@@ -7749,25 +7666,23 @@ var Project = class {
7749
7666
  if (this._studio) {
7750
7667
  this._studio.transaction(
7751
7668
  ({ drafts }) => {
7752
- var _a;
7753
7669
  const projectAhistoric = drafts.ahistoric.coreByProject[this.address.projectId];
7754
- (_a = projectAhistoric.sheetsById) != null ? _a : projectAhistoric.sheetsById = {};
7670
+ projectAhistoric.sheetsById ?? (projectAhistoric.sheetsById = {});
7755
7671
  fn2(projectAhistoric);
7756
7672
  },
7757
7673
  { undoable: false }
7758
7674
  );
7759
7675
  } else {
7760
7676
  this._onDiskStateAtom.reduce((state) => {
7761
- const ahistoric = __spreadValues({}, state.ahistoric);
7677
+ const ahistoric = { ...state.ahistoric };
7762
7678
  fn2(ahistoric);
7763
- return __spreadProps(__spreadValues({}, state), { ahistoric });
7679
+ return { ...state, ahistoric };
7764
7680
  });
7765
7681
  }
7766
7682
  }
7767
7683
  _stripImageAssetsFromAhistoricState() {
7768
7684
  const strip = (ahistoric) => {
7769
- var _a;
7770
- for (const sheetState of Object.values((_a = ahistoric.sheetsById) != null ? _a : {})) {
7685
+ for (const sheetState of Object.values(ahistoric.sheetsById ?? {})) {
7771
7686
  if (!sheetState)
7772
7687
  continue;
7773
7688
  stripImageAssetsFromAhistoricStaticOverrides(
@@ -7790,8 +7705,7 @@ var Project = class {
7790
7705
  if (paths.size === 0)
7791
7706
  return;
7792
7707
  const strip = (ahistoric) => {
7793
- var _a;
7794
- const sheetState = (_a = ahistoric.sheetsById) == null ? void 0 : _a[sheetId];
7708
+ const sheetState = ahistoric.sheetsById?.[sheetId];
7795
7709
  if (!sheetState)
7796
7710
  return;
7797
7711
  const staticOverrides = sheetState.staticOverrides.byObject[objectKey];
@@ -7832,9 +7746,9 @@ var Project = class {
7832
7746
  });
7833
7747
  } else {
7834
7748
  this._onDiskStateAtom.reduce((state) => {
7835
- const historic = __spreadValues({}, state.historic);
7749
+ const historic = { ...state.historic };
7836
7750
  strip(historic);
7837
- return __spreadProps(__spreadValues({}, state), { historic });
7751
+ return { ...state, historic };
7838
7752
  });
7839
7753
  }
7840
7754
  }
@@ -7859,9 +7773,9 @@ var Project = class {
7859
7773
  });
7860
7774
  } else {
7861
7775
  this._onDiskStateAtom.reduce((state) => {
7862
- const historic = __spreadValues({}, state.historic);
7776
+ const historic = { ...state.historic };
7863
7777
  strip(historic);
7864
- return __spreadProps(__spreadValues({}, state), { historic });
7778
+ return { ...state, historic };
7865
7779
  });
7866
7780
  }
7867
7781
  }
@@ -7886,9 +7800,9 @@ var Project = class {
7886
7800
  });
7887
7801
  } else {
7888
7802
  this._onDiskStateAtom.reduce((state) => {
7889
- const historic = __spreadValues({}, state.historic);
7803
+ const historic = { ...state.historic };
7890
7804
  strip(historic);
7891
- return __spreadProps(__spreadValues({}, state), { historic });
7805
+ return { ...state, historic };
7892
7806
  });
7893
7807
  }
7894
7808
  }
@@ -7939,7 +7853,7 @@ var TheatreProject = class {
7939
7853
  return privateAPI(this).isReady();
7940
7854
  }
7941
7855
  get address() {
7942
- return __spreadValues({}, privateAPI(this).address);
7856
+ return { ...privateAPI(this).address };
7943
7857
  }
7944
7858
  getAssetUrl(asset) {
7945
7859
  if (!this.isReady) {
@@ -8076,7 +7990,7 @@ var CoreBundle = class {
8076
7990
  return "Theatre_CoreBundle";
8077
7991
  }
8078
7992
  get version() {
8079
- return "0.1.5";
7993
+ return "0.1.7";
8080
7994
  }
8081
7995
  getBitsForStudio(studio, callback) {
8082
7996
  if (this._studio) {