@unseenco/theatre-gsap 0.4.1 → 0.4.3

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
@@ -20,36 +20,2225 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- attachGsapSequenceBridge: () => attachGsapSequenceBridge,
23
+ attachGsapSequenceBridge: () => import_theatre_core.attachGsapSequenceBridge,
24
24
  configureTheatreGsap: () => configureTheatreGsap,
25
- getAnimationEntry: () => getAnimationEntry,
25
+ getAnimationEntry: () => getAnimationEntry2,
26
26
  getAnimationEntryById: () => getAnimationEntryById,
27
- getAnimationEntryForSheetObject: () => getAnimationEntryForSheetObject,
27
+ getAnimationEntryForSheetObject: () => getAnimationEntryForSheetObject2,
28
28
  getTheatreGsapConfig: () => getTheatreGsapConfig,
29
- listAnimationEntries: () => listAnimationEntries,
29
+ listAnimationEntries: () => listAnimationEntries2,
30
30
  registerGsapAnimation: () => registerGsapAnimation
31
31
  });
32
32
  module.exports = __toCommonJS(src_exports);
33
33
 
34
34
  // src/registerGsapAnimation.ts
35
35
  var import_privateAPIs = require("@unseenco/theatre-core/privateAPIs");
36
- var import_buildGsapSheetObjectKey = require("@unseenco/theatre-shared/gsap/buildGsapSheetObjectKey");
37
- var import_gsapAnimationRegistry2 = require("@unseenco/theatre-shared/gsap/gsapAnimationRegistry");
36
+
37
+ // ../../theatre/shared/src/utils/errors.ts
38
+ var TheatreError = class extends Error {
39
+ };
40
+ var InvalidArgumentError = class extends TheatreError {
41
+ };
42
+
43
+ // ../../theatre/shared/src/_logger/logger.ts
44
+ function lazy(f) {
45
+ return function lazyLogIncluded(m, lazyArg) {
46
+ return f(m, lazyArg());
47
+ };
48
+ }
49
+ var LEVELS = {
50
+ _hmm: getLogMeta(524 /* _HMM */),
51
+ _todo: getLogMeta(522 /* _TODO */),
52
+ _error: getLogMeta(521 /* _ERROR */),
53
+ errorDev: getLogMeta(529 /* ERROR_DEV */),
54
+ errorPublic: getLogMeta(545 /* ERROR_PUBLIC */),
55
+ _kapow: getLogMeta(268 /* _KAPOW */),
56
+ _warn: getLogMeta(265 /* _WARN */),
57
+ warnDev: getLogMeta(273 /* WARN_DEV */),
58
+ warnPublic: getLogMeta(289 /* WARN_PUBLIC */),
59
+ _debug: getLogMeta(137 /* _DEBUG */),
60
+ debugDev: getLogMeta(145 /* DEBUG_DEV */),
61
+ _trace: getLogMeta(73 /* _TRACE */),
62
+ traceDev: getLogMeta(81 /* TRACE_DEV */)
63
+ };
64
+ function getLogMeta(level) {
65
+ return Object.freeze({
66
+ audience: hasFlag(level, 8 /* INTERNAL */) ? "internal" : hasFlag(level, 16 /* DEV */) ? "dev" : "public",
67
+ category: hasFlag(level, 4 /* TROUBLESHOOTING */) ? "troubleshooting" : hasFlag(level, 2 /* TODO */) ? "todo" : "general",
68
+ level: (
69
+ // I think this is equivalent... but I'm not using it until we have tests.
70
+ // this code won't really impact performance much anyway, since it's just computed once
71
+ // up front.
72
+ // level &
73
+ // (TheatreLoggerLevel.TRACE |
74
+ // TheatreLoggerLevel.DEBUG |
75
+ // TheatreLoggerLevel.WARN |
76
+ // TheatreLoggerLevel.ERROR),
77
+ hasFlag(level, 512 /* ERROR */) ? 512 /* ERROR */ : hasFlag(level, 256 /* WARN */) ? 256 /* WARN */ : hasFlag(level, 128 /* DEBUG */) ? 128 /* DEBUG */ : (
78
+ // no other option
79
+ 64 /* TRACE */
80
+ )
81
+ )
82
+ });
83
+ }
84
+ function hasFlag(level, flag) {
85
+ return (level & flag) === flag;
86
+ }
87
+ function shouldLog(includes, level) {
88
+ return ((level & 32 /* PUBLIC */) === 32 /* PUBLIC */ ? true : (level & 16 /* DEV */) === 16 /* DEV */ ? includes.dev : (level & 8 /* INTERNAL */) === 8 /* INTERNAL */ ? includes.internal : false) && includes.min <= level;
89
+ }
90
+ var DEFAULTS = {
91
+ loggingConsoleStyle: true,
92
+ loggerConsoleStyle: true,
93
+ includes: Object.freeze({
94
+ internal: false,
95
+ dev: false,
96
+ min: 256 /* WARN */
97
+ }),
98
+ filtered: function defaultFiltered() {
99
+ },
100
+ include: function defaultInclude() {
101
+ return {};
102
+ },
103
+ create: null,
104
+ creatExt: null,
105
+ named(parent, name, key) {
106
+ return this.create({
107
+ names: [...parent.names, { name, key }]
108
+ });
109
+ },
110
+ style: {
111
+ bold: void 0,
112
+ // /Service$/
113
+ italic: void 0,
114
+ // /Model$/
115
+ cssMemo: /* @__PURE__ */ new Map([
116
+ // handle empty names so we don't have to check for
117
+ // name.length > 0 during this.css('')
118
+ ["", ""]
119
+ // bring a specific override
120
+ // ["Marker", "color:#aea9ff;font-size:0.75em;text-transform:uppercase"]
121
+ ]),
122
+ collapseOnRE: /[a-z- ]+/g,
123
+ color: void 0,
124
+ // create collapsed name
125
+ // insert collapsed name into cssMemo with original's style
126
+ collapsed(name) {
127
+ if (name.length < 5)
128
+ return name;
129
+ const collapsed = name.replace(this.collapseOnRE, "");
130
+ if (!this.cssMemo.has(collapsed)) {
131
+ this.cssMemo.set(collapsed, this.css(name));
132
+ }
133
+ return collapsed;
134
+ },
135
+ css(name) {
136
+ const found = this.cssMemo.get(name);
137
+ if (found)
138
+ return found;
139
+ let css = `color:${this.color?.(name) ?? `hsl(${(name.charCodeAt(0) + name.charCodeAt(name.length - 1)) % 360}, 100%, 60%)`}`;
140
+ if (this.bold?.test(name)) {
141
+ css += ";font-weight:600";
142
+ }
143
+ if (this.italic?.test(name)) {
144
+ css += ";font-style:italic";
145
+ }
146
+ this.cssMemo.set(name, css);
147
+ return css;
148
+ }
149
+ }
150
+ };
151
+ function createTheatreInternalLogger(useConsole = console, _options = {}) {
152
+ const ref2 = { ...DEFAULTS, includes: { ...DEFAULTS.includes } };
153
+ const createConsole = {
154
+ styled: createConsoleLoggerStyled.bind(ref2, useConsole),
155
+ noStyle: createConsoleLoggerNoStyle.bind(ref2, useConsole)
156
+ };
157
+ const createExtBound = createExtLogger.bind(ref2);
158
+ function getConCreate() {
159
+ return ref2.loggingConsoleStyle && ref2.loggerConsoleStyle ? createConsole.styled : createConsole.noStyle;
160
+ }
161
+ ref2.create = getConCreate();
162
+ return {
163
+ configureLogger(config) {
164
+ if (config === "console") {
165
+ ref2.loggerConsoleStyle = DEFAULTS.loggerConsoleStyle;
166
+ ref2.create = getConCreate();
167
+ } else if (config.type === "console") {
168
+ ref2.loggerConsoleStyle = config.style ?? DEFAULTS.loggerConsoleStyle;
169
+ ref2.create = getConCreate();
170
+ } else if (config.type === "keyed") {
171
+ ref2.creatExt = (source2) => config.keyed(source2.names);
172
+ ref2.create = createExtBound;
173
+ } else if (config.type === "named") {
174
+ ref2.creatExt = configNamedToKeyed.bind(null, config.named);
175
+ ref2.create = createExtBound;
176
+ }
177
+ },
178
+ configureLogging(config) {
179
+ ref2.includes.dev = config.dev ?? DEFAULTS.includes.dev;
180
+ ref2.includes.internal = config.internal ?? DEFAULTS.includes.internal;
181
+ ref2.includes.min = config.min ?? DEFAULTS.includes.min;
182
+ ref2.include = config.include ?? DEFAULTS.include;
183
+ ref2.loggingConsoleStyle = config.consoleStyle ?? DEFAULTS.loggingConsoleStyle;
184
+ ref2.create = getConCreate();
185
+ },
186
+ getLogger() {
187
+ return ref2.create({ names: [] });
188
+ }
189
+ };
190
+ }
191
+ function configNamedToKeyed(namedFn, source2) {
192
+ const names = [];
193
+ for (let { name, key } of source2.names) {
194
+ names.push(key == null ? name : `${name} (${key})`);
195
+ }
196
+ return namedFn(names);
197
+ }
198
+ function createExtLogger(source2) {
199
+ const includes = { ...this.includes, ...this.include(source2) };
200
+ const f = this.filtered;
201
+ const named = this.named.bind(this, source2);
202
+ const ext = this.creatExt(source2);
203
+ const _HMM = shouldLog(includes, 524 /* _HMM */);
204
+ const _TODO = shouldLog(includes, 522 /* _TODO */);
205
+ const _ERROR = shouldLog(includes, 521 /* _ERROR */);
206
+ const ERROR_DEV = shouldLog(includes, 529 /* ERROR_DEV */);
207
+ const ERROR_PUBLIC = shouldLog(includes, 545 /* ERROR_PUBLIC */);
208
+ const _WARN = shouldLog(includes, 265 /* _WARN */);
209
+ const _KAPOW = shouldLog(includes, 268 /* _KAPOW */);
210
+ const WARN_DEV = shouldLog(includes, 273 /* WARN_DEV */);
211
+ const WARN_PUBLIC = shouldLog(includes, 289 /* WARN_PUBLIC */);
212
+ const _DEBUG = shouldLog(includes, 137 /* _DEBUG */);
213
+ const DEBUG_DEV = shouldLog(includes, 145 /* DEBUG_DEV */);
214
+ const _TRACE = shouldLog(includes, 73 /* _TRACE */);
215
+ const TRACE_DEV = shouldLog(includes, 81 /* TRACE_DEV */);
216
+ const _hmm = _HMM ? ext.error.bind(ext, LEVELS._hmm) : f.bind(source2, 524 /* _HMM */);
217
+ const _todo = _TODO ? ext.error.bind(ext, LEVELS._todo) : f.bind(source2, 522 /* _TODO */);
218
+ const _error = _ERROR ? ext.error.bind(ext, LEVELS._error) : f.bind(source2, 521 /* _ERROR */);
219
+ const errorDev = ERROR_DEV ? ext.error.bind(ext, LEVELS.errorDev) : f.bind(source2, 529 /* ERROR_DEV */);
220
+ const errorPublic = ERROR_PUBLIC ? ext.error.bind(ext, LEVELS.errorPublic) : f.bind(source2, 545 /* ERROR_PUBLIC */);
221
+ const _kapow = _KAPOW ? ext.warn.bind(ext, LEVELS._kapow) : f.bind(source2, 268 /* _KAPOW */);
222
+ const _warn = _WARN ? ext.warn.bind(ext, LEVELS._warn) : f.bind(source2, 265 /* _WARN */);
223
+ const warnDev = WARN_DEV ? ext.warn.bind(ext, LEVELS.warnDev) : f.bind(source2, 273 /* WARN_DEV */);
224
+ const warnPublic = WARN_PUBLIC ? ext.warn.bind(ext, LEVELS.warnPublic) : f.bind(source2, 273 /* WARN_DEV */);
225
+ const _debug = _DEBUG ? ext.debug.bind(ext, LEVELS._debug) : f.bind(source2, 137 /* _DEBUG */);
226
+ const debugDev = DEBUG_DEV ? ext.debug.bind(ext, LEVELS.debugDev) : f.bind(source2, 145 /* DEBUG_DEV */);
227
+ const _trace = _TRACE ? ext.trace.bind(ext, LEVELS._trace) : f.bind(source2, 73 /* _TRACE */);
228
+ const traceDev = TRACE_DEV ? ext.trace.bind(ext, LEVELS.traceDev) : f.bind(source2, 81 /* TRACE_DEV */);
229
+ const logger = {
230
+ _hmm,
231
+ _todo,
232
+ _error,
233
+ errorDev,
234
+ errorPublic,
235
+ _kapow,
236
+ _warn,
237
+ warnDev,
238
+ warnPublic,
239
+ _debug,
240
+ debugDev,
241
+ _trace,
242
+ traceDev,
243
+ lazy: {
244
+ _hmm: _HMM ? lazy(_hmm) : _hmm,
245
+ _todo: _TODO ? lazy(_todo) : _todo,
246
+ _error: _ERROR ? lazy(_error) : _error,
247
+ errorDev: ERROR_DEV ? lazy(errorDev) : errorDev,
248
+ errorPublic: ERROR_PUBLIC ? lazy(errorPublic) : errorPublic,
249
+ _kapow: _KAPOW ? lazy(_kapow) : _kapow,
250
+ _warn: _WARN ? lazy(_warn) : _warn,
251
+ warnDev: WARN_DEV ? lazy(warnDev) : warnDev,
252
+ warnPublic: WARN_PUBLIC ? lazy(warnPublic) : warnPublic,
253
+ _debug: _DEBUG ? lazy(_debug) : _debug,
254
+ debugDev: DEBUG_DEV ? lazy(debugDev) : debugDev,
255
+ _trace: _TRACE ? lazy(_trace) : _trace,
256
+ traceDev: TRACE_DEV ? lazy(traceDev) : traceDev
257
+ },
258
+ //
259
+ named,
260
+ utilFor: {
261
+ internal() {
262
+ return {
263
+ debug: logger._debug,
264
+ error: logger._error,
265
+ warn: logger._warn,
266
+ trace: logger._trace,
267
+ named(name, key) {
268
+ return logger.named(name, key).utilFor.internal();
269
+ }
270
+ };
271
+ },
272
+ dev() {
273
+ return {
274
+ debug: logger.debugDev,
275
+ error: logger.errorDev,
276
+ warn: logger.warnDev,
277
+ trace: logger.traceDev,
278
+ named(name, key) {
279
+ return logger.named(name, key).utilFor.dev();
280
+ }
281
+ };
282
+ },
283
+ public() {
284
+ return {
285
+ error: logger.errorPublic,
286
+ warn: logger.warnPublic,
287
+ debug(message, obj) {
288
+ logger._warn(`(public "debug" filtered out) ${message}`, obj);
289
+ },
290
+ trace(message, obj) {
291
+ logger._warn(`(public "trace" filtered out) ${message}`, obj);
292
+ },
293
+ named(name, key) {
294
+ return logger.named(name, key).utilFor.public();
295
+ }
296
+ };
297
+ }
298
+ }
299
+ };
300
+ return logger;
301
+ }
302
+ function createConsoleLoggerStyled(con, source2) {
303
+ const includes = { ...this.includes, ...this.include(source2) };
304
+ const styleArgs = [];
305
+ let prefix = "";
306
+ for (let i = 0; i < source2.names.length; i++) {
307
+ const { name, key } = source2.names[i];
308
+ prefix += ` %c${name}`;
309
+ styleArgs.push(this.style.css(name));
310
+ if (key != null) {
311
+ const keyStr = `%c#${key}`;
312
+ prefix += keyStr;
313
+ styleArgs.push(this.style.css(keyStr));
314
+ }
315
+ }
316
+ const f = this.filtered;
317
+ const named = this.named.bind(this, source2);
318
+ const prefixArr = [prefix, ...styleArgs];
319
+ return _createConsoleLogger(
320
+ f,
321
+ source2,
322
+ includes,
323
+ con,
324
+ prefixArr,
325
+ styledKapowPrefix(prefixArr),
326
+ named
327
+ );
328
+ }
329
+ function styledKapowPrefix(args) {
330
+ const start = args.slice(0);
331
+ for (let i = 1; i < start.length; i++)
332
+ start[i] += ";background-color:#e0005a;padding:2px;color:white";
333
+ return start;
334
+ }
335
+ function createConsoleLoggerNoStyle(con, source2) {
336
+ const includes = { ...this.includes, ...this.include(source2) };
337
+ let prefix = "";
338
+ for (let i = 0; i < source2.names.length; i++) {
339
+ const { name, key } = source2.names[i];
340
+ prefix += ` ${name}`;
341
+ if (key != null) {
342
+ prefix += `#${key}`;
343
+ }
344
+ }
345
+ const f = this.filtered;
346
+ const named = this.named.bind(this, source2);
347
+ const prefixArr = [prefix];
348
+ return _createConsoleLogger(
349
+ f,
350
+ source2,
351
+ includes,
352
+ con,
353
+ prefixArr,
354
+ prefixArr,
355
+ named
356
+ );
357
+ }
358
+ function _createConsoleLogger(f, source2, includes, con, prefix, kapowPrefix, named) {
359
+ const _HMM = shouldLog(includes, 524 /* _HMM */);
360
+ const _TODO = shouldLog(includes, 522 /* _TODO */);
361
+ const _ERROR = shouldLog(includes, 521 /* _ERROR */);
362
+ const ERROR_DEV = shouldLog(includes, 529 /* ERROR_DEV */);
363
+ const ERROR_PUBLIC = shouldLog(includes, 545 /* ERROR_PUBLIC */);
364
+ const _WARN = shouldLog(includes, 265 /* _WARN */);
365
+ const _KAPOW = shouldLog(includes, 268 /* _KAPOW */);
366
+ const WARN_DEV = shouldLog(includes, 273 /* WARN_DEV */);
367
+ const WARN_PUBLIC = shouldLog(includes, 289 /* WARN_PUBLIC */);
368
+ const _DEBUG = shouldLog(includes, 137 /* _DEBUG */);
369
+ const DEBUG_DEV = shouldLog(includes, 145 /* DEBUG_DEV */);
370
+ const _TRACE = shouldLog(includes, 73 /* _TRACE */);
371
+ const TRACE_DEV = shouldLog(includes, 81 /* TRACE_DEV */);
372
+ const _hmm = _HMM ? con.error.bind(con, ...prefix) : f.bind(source2, 524 /* _HMM */);
373
+ const _todo = _TODO ? con.error.bind(con, ...prefix) : f.bind(source2, 522 /* _TODO */);
374
+ const _error = _ERROR ? con.error.bind(con, ...prefix) : f.bind(source2, 521 /* _ERROR */);
375
+ const errorDev = ERROR_DEV ? con.error.bind(con, ...prefix) : f.bind(source2, 529 /* ERROR_DEV */);
376
+ const errorPublic = ERROR_PUBLIC ? con.error.bind(con, ...prefix) : f.bind(source2, 545 /* ERROR_PUBLIC */);
377
+ const _kapow = _KAPOW ? con.warn.bind(con, ...kapowPrefix) : f.bind(source2, 268 /* _KAPOW */);
378
+ const _warn = _WARN ? con.warn.bind(con, ...prefix) : f.bind(source2, 265 /* _WARN */);
379
+ const warnDev = WARN_DEV ? con.warn.bind(con, ...prefix) : f.bind(source2, 273 /* WARN_DEV */);
380
+ const warnPublic = WARN_PUBLIC ? con.warn.bind(con, ...prefix) : f.bind(source2, 273 /* WARN_DEV */);
381
+ const _debug = _DEBUG ? con.info.bind(con, ...prefix) : f.bind(source2, 137 /* _DEBUG */);
382
+ const debugDev = DEBUG_DEV ? con.info.bind(con, ...prefix) : f.bind(source2, 145 /* DEBUG_DEV */);
383
+ const _trace = _TRACE ? con.debug.bind(con, ...prefix) : f.bind(source2, 73 /* _TRACE */);
384
+ const traceDev = TRACE_DEV ? con.debug.bind(con, ...prefix) : f.bind(source2, 81 /* TRACE_DEV */);
385
+ const logger = {
386
+ _hmm,
387
+ _todo,
388
+ _error,
389
+ errorDev,
390
+ errorPublic,
391
+ _kapow,
392
+ _warn,
393
+ warnDev,
394
+ warnPublic,
395
+ _debug,
396
+ debugDev,
397
+ _trace,
398
+ traceDev,
399
+ lazy: {
400
+ _hmm: _HMM ? lazy(_hmm) : _hmm,
401
+ _todo: _TODO ? lazy(_todo) : _todo,
402
+ _error: _ERROR ? lazy(_error) : _error,
403
+ errorDev: ERROR_DEV ? lazy(errorDev) : errorDev,
404
+ errorPublic: ERROR_PUBLIC ? lazy(errorPublic) : errorPublic,
405
+ _kapow: _KAPOW ? lazy(_kapow) : _kapow,
406
+ _warn: _WARN ? lazy(_warn) : _warn,
407
+ warnDev: WARN_DEV ? lazy(warnDev) : warnDev,
408
+ warnPublic: WARN_PUBLIC ? lazy(warnPublic) : warnPublic,
409
+ _debug: _DEBUG ? lazy(_debug) : _debug,
410
+ debugDev: DEBUG_DEV ? lazy(debugDev) : debugDev,
411
+ _trace: _TRACE ? lazy(_trace) : _trace,
412
+ traceDev: TRACE_DEV ? lazy(traceDev) : traceDev
413
+ },
414
+ //
415
+ named,
416
+ utilFor: {
417
+ internal() {
418
+ return {
419
+ debug: logger._debug,
420
+ error: logger._error,
421
+ warn: logger._warn,
422
+ trace: logger._trace,
423
+ named(name, key) {
424
+ return logger.named(name, key).utilFor.internal();
425
+ }
426
+ };
427
+ },
428
+ dev() {
429
+ return {
430
+ debug: logger.debugDev,
431
+ error: logger.errorDev,
432
+ warn: logger.warnDev,
433
+ trace: logger.traceDev,
434
+ named(name, key) {
435
+ return logger.named(name, key).utilFor.dev();
436
+ }
437
+ };
438
+ },
439
+ public() {
440
+ return {
441
+ error: logger.errorPublic,
442
+ warn: logger.warnPublic,
443
+ debug(message, obj) {
444
+ logger._warn(`(public "debug" filtered out) ${message}`, obj);
445
+ },
446
+ trace(message, obj) {
447
+ logger._warn(`(public "trace" filtered out) ${message}`, obj);
448
+ },
449
+ named(name, key) {
450
+ return logger.named(name, key).utilFor.public();
451
+ }
452
+ };
453
+ }
454
+ }
455
+ };
456
+ return logger;
457
+ }
458
+
459
+ // ../../theatre/shared/src/logger.ts
460
+ var internal = createTheatreInternalLogger(console, {
461
+ _debug: function() {
462
+ },
463
+ _error: function() {
464
+ }
465
+ });
466
+ internal.configureLogging({
467
+ dev: true,
468
+ min: 64 /* TRACE */
469
+ });
470
+ var logger_default = internal.getLogger().named("Theatre.js (default logger)").utilFor.dev();
471
+
472
+ // ../../theatre/shared/src/globalVariableNames.ts
473
+ var notifications = "__TheatreJS_Notifications";
474
+
475
+ // ../../theatre/shared/src/notify.ts
476
+ var createHandler = (type) => (...args) => {
477
+ switch (type) {
478
+ case "success": {
479
+ logger_default.debug(args.slice(0, 2).join("\n"));
480
+ break;
481
+ }
482
+ case "info": {
483
+ logger_default.debug(args.slice(0, 2).join("\n"));
484
+ break;
485
+ }
486
+ case "warning": {
487
+ logger_default.warn(args.slice(0, 2).join("\n"));
488
+ break;
489
+ }
490
+ case "error": {
491
+ }
492
+ }
493
+ return typeof window !== "undefined" ? (
494
+ // @ts-ignore
495
+ window[notifications]?.notify[type](...args)
496
+ ) : void 0;
497
+ };
498
+ var notify = {
499
+ warning: createHandler("warning"),
500
+ success: createHandler("success"),
501
+ info: createHandler("info"),
502
+ error: createHandler("error")
503
+ };
504
+ if (typeof window !== "undefined") {
505
+ window.addEventListener("error", (e) => {
506
+ notify.error(
507
+ `An error occurred`,
508
+ `<pre>${e.message}</pre>
509
+
510
+ See **console** for details.`
511
+ );
512
+ });
513
+ window.addEventListener("unhandledrejection", (e) => {
514
+ notify.error(
515
+ `An error occurred`,
516
+ `<pre>${e.reason}</pre>
517
+
518
+ See **console** for details.`
519
+ );
520
+ });
521
+ }
522
+
523
+ // ../../theatre/shared/src/utils/slashedPaths.ts
524
+ var normalizeSlashedPath = (p) => p.replace(/^[\s\/]*/, "").replace(/[\s\/]*$/, "").replace(/\s*\/\s*/g, " / ");
525
+ var getValidationErrorsOfSlashedPath = (p) => {
526
+ if (typeof p !== "string")
527
+ return `it is not a string. (it is a ${typeof p})`;
528
+ const components = p.split(/\//);
529
+ if (components.length === 0)
530
+ return `it is empty.`;
531
+ for (let i = 0; i < components.length; i++) {
532
+ const component = components[i].trim();
533
+ if (component.length === 0)
534
+ return `the component #${i + 1} is empty.`;
535
+ if (component.length > 64)
536
+ return `the component '${component}' must have 64 characters or less.`;
537
+ }
538
+ };
539
+ function validateAndSanitiseSlashedPathOrThrow(unsanitisedPath, fnName) {
540
+ const sanitisedPath = normalizeSlashedPath(unsanitisedPath);
541
+ if (process.env.NODE_ENV !== "development") {
542
+ return sanitisedPath;
543
+ }
544
+ const validation = getValidationErrorsOfSlashedPath(sanitisedPath);
545
+ if (validation) {
546
+ throw new InvalidArgumentError(
547
+ `The path in ${fnName}(${typeof unsanitisedPath === "string" ? `"${unsanitisedPath}"` : ""}) is invalid because ${validation}`
548
+ );
549
+ }
550
+ if (unsanitisedPath !== sanitisedPath) {
551
+ notify.warning(
552
+ "Invalid path provided to object",
553
+ `The path in \`${fnName}("${unsanitisedPath}")\` was sanitized to \`"${sanitisedPath}"\`.
554
+
555
+ Please replace the path with the sanitized one, otherwise it will likely break in the future.`,
556
+ [
557
+ {
558
+ url: "https://www.theatrejs.com/docs/latest/manual/objects#creating-sheet-objects",
559
+ title: "Sheet Objects"
560
+ },
561
+ {
562
+ url: "https://www.theatrejs.com/docs/latest/api/core#sheet.object",
563
+ title: "API"
564
+ }
565
+ ]
566
+ );
567
+ }
568
+ return sanitisedPath;
569
+ }
570
+
571
+ // ../../theatre/shared/src/gsap/buildGsapSheetObjectKey.ts
572
+ function buildGsapSheetObjectKey(namespace, label) {
573
+ return validateAndSanitiseSlashedPathOrThrow(
574
+ `${namespace} / ${label}`,
575
+ "buildGsapSheetObjectKey"
576
+ );
577
+ }
578
+
579
+ // ../../theatre/shared/src/gsap/introspectGsapTimelineChildren.ts
580
+ function isGsapTimeline(animation) {
581
+ const root2 = animation;
582
+ const children = root2.getChildren?.(false, true, false);
583
+ return Array.isArray(children) && children.length > 0;
584
+ }
585
+ function childLabel(child, index) {
586
+ const tween = child;
587
+ const id = tween.vars?.id;
588
+ if (typeof id === "string" && id.length > 0)
589
+ return id;
590
+ return `Tween ${index + 1}`;
591
+ }
592
+ function readChildLocalTiming(child) {
593
+ const tween = child;
594
+ const localStart = typeof tween.startTime === "function" ? tween.startTime() : 0;
595
+ let localDuration = typeof tween.duration === "function" ? tween.duration() : 0;
596
+ if (localDuration <= 0 && typeof tween.endTime === "function") {
597
+ localDuration = Math.max(tween.endTime() - localStart, 0.01);
598
+ }
599
+ return {
600
+ localStart: Math.max(localStart, 0),
601
+ localDuration: Math.max(localDuration, 0.01)
602
+ };
603
+ }
604
+ function introspectGsapTimelineChildren(animation) {
605
+ if (!isGsapTimeline(animation))
606
+ return [];
607
+ const root2 = animation;
608
+ const raw = root2.getChildren(false, true, false);
609
+ return raw.map((child, index) => {
610
+ const { localStart, localDuration } = readChildLocalTiming(child);
611
+ return {
612
+ childId: `child_${index}`,
613
+ label: childLabel(child, index),
614
+ localStart,
615
+ localDuration
616
+ };
617
+ });
618
+ }
619
+ function linkGsapTimelineChildAnimations(animation) {
620
+ const map = /* @__PURE__ */ new Map();
621
+ if (!isGsapTimeline(animation))
622
+ return map;
623
+ const root2 = animation;
624
+ const raw = root2.getChildren(false, true, false);
625
+ raw.forEach((child, index) => {
626
+ map.set(`child_${index}`, child);
627
+ });
628
+ return map;
629
+ }
630
+
631
+ // ../../theatre/shared/src/gsap/gsapSheetObjectKey.ts
632
+ var GSAP_NAMESPACE_STORE_KEY = "__unseenco_theatre_gsap_configuredNamespace__";
633
+ function setConfiguredGsapSheetObjectNamespace(namespace) {
634
+ const g = globalThis;
635
+ g[GSAP_NAMESPACE_STORE_KEY] = namespace.trim();
636
+ }
637
+
638
+ // ../../theatre/shared/src/gsap/syncGsapClipProgress.ts
639
+ function readGsapTweenTimelineDuration(animation) {
640
+ const tween = animation;
641
+ const total = tween.totalDuration?.();
642
+ if (typeof total === "number" && total > 0)
643
+ return total;
644
+ const d = tween.duration();
645
+ return d > 0 ? d : 1;
646
+ }
647
+
648
+ // ../../theatre/shared/src/gsap/gsapClipBaseline.ts
649
+ function cloneTimelineChildren(children) {
650
+ return children.map((c) => ({ ...c }));
651
+ }
652
+ function buildGsapClipBaselineTiming(p) {
653
+ const duration = Math.max(p.duration, 0.01);
654
+ const baseline = { duration };
655
+ if (p.timelineChildren && p.timelineChildren.length > 0) {
656
+ baseline.timelineSpan = p.timelineSpan ?? duration;
657
+ baseline.timelineChildren = cloneTimelineChildren(p.timelineChildren);
658
+ }
659
+ return baseline;
660
+ }
661
+
662
+ // ../../theatre/shared/src/gsap/gsapObjectBinding.ts
663
+ var STORE_KEY = "__unseenco_theatre_gsap_objectBindings__";
664
+ function addressKey(sheetObject) {
665
+ const a = sheetObject.address;
666
+ return `${a.projectId}|${a.sheetId}|${a.sheetInstanceId}|${a.objectKey}`;
667
+ }
668
+ function getStore() {
669
+ const g = globalThis;
670
+ if (!g[STORE_KEY]) {
671
+ g[STORE_KEY] = /* @__PURE__ */ new Map();
672
+ }
673
+ return g[STORE_KEY];
674
+ }
675
+ function registerGsapObjectBinding(sheetObject, binding) {
676
+ getStore().set(addressKey(sheetObject), binding);
677
+ }
678
+
679
+ // ../../node_modules/lodash-es/isArray.js
680
+ var isArray = Array.isArray;
681
+ var isArray_default = isArray;
682
+
683
+ // ../../node_modules/lodash-es/_freeGlobal.js
684
+ var freeGlobal = typeof window == "object" && window && window.Object === Object && window;
685
+ var freeGlobal_default = freeGlobal;
686
+
687
+ // ../../node_modules/lodash-es/_root.js
688
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
689
+ var root = freeGlobal_default || freeSelf || Function("return this")();
690
+ var root_default = root;
691
+
692
+ // ../../node_modules/lodash-es/_Symbol.js
693
+ var Symbol2 = root_default.Symbol;
694
+ var Symbol_default = Symbol2;
695
+
696
+ // ../../node_modules/lodash-es/_getRawTag.js
697
+ var objectProto = Object.prototype;
698
+ var hasOwnProperty = objectProto.hasOwnProperty;
699
+ var nativeObjectToString = objectProto.toString;
700
+ var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
701
+ function getRawTag(value) {
702
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
703
+ try {
704
+ value[symToStringTag] = void 0;
705
+ var unmasked = true;
706
+ } catch (e) {
707
+ }
708
+ var result = nativeObjectToString.call(value);
709
+ if (unmasked) {
710
+ if (isOwn) {
711
+ value[symToStringTag] = tag;
712
+ } else {
713
+ delete value[symToStringTag];
714
+ }
715
+ }
716
+ return result;
717
+ }
718
+ var getRawTag_default = getRawTag;
719
+
720
+ // ../../node_modules/lodash-es/_objectToString.js
721
+ var objectProto2 = Object.prototype;
722
+ var nativeObjectToString2 = objectProto2.toString;
723
+ function objectToString(value) {
724
+ return nativeObjectToString2.call(value);
725
+ }
726
+ var objectToString_default = objectToString;
727
+
728
+ // ../../node_modules/lodash-es/_baseGetTag.js
729
+ var nullTag = "[object Null]";
730
+ var undefinedTag = "[object Undefined]";
731
+ var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
732
+ function baseGetTag(value) {
733
+ if (value == null) {
734
+ return value === void 0 ? undefinedTag : nullTag;
735
+ }
736
+ return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
737
+ }
738
+ var baseGetTag_default = baseGetTag;
739
+
740
+ // ../../node_modules/lodash-es/isObjectLike.js
741
+ function isObjectLike(value) {
742
+ return value != null && typeof value == "object";
743
+ }
744
+ var isObjectLike_default = isObjectLike;
745
+
746
+ // ../../node_modules/lodash-es/isSymbol.js
747
+ var symbolTag = "[object Symbol]";
748
+ function isSymbol(value) {
749
+ return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
750
+ }
751
+ var isSymbol_default = isSymbol;
752
+
753
+ // ../../node_modules/lodash-es/_isKey.js
754
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
755
+ var reIsPlainProp = /^\w*$/;
756
+ function isKey(value, object) {
757
+ if (isArray_default(value)) {
758
+ return false;
759
+ }
760
+ var type = typeof value;
761
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default(value)) {
762
+ return true;
763
+ }
764
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
765
+ }
766
+ var isKey_default = isKey;
767
+
768
+ // ../../node_modules/lodash-es/isObject.js
769
+ function isObject(value) {
770
+ var type = typeof value;
771
+ return value != null && (type == "object" || type == "function");
772
+ }
773
+ var isObject_default = isObject;
774
+
775
+ // ../../node_modules/lodash-es/isFunction.js
776
+ var asyncTag = "[object AsyncFunction]";
777
+ var funcTag = "[object Function]";
778
+ var genTag = "[object GeneratorFunction]";
779
+ var proxyTag = "[object Proxy]";
780
+ function isFunction(value) {
781
+ if (!isObject_default(value)) {
782
+ return false;
783
+ }
784
+ var tag = baseGetTag_default(value);
785
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
786
+ }
787
+ var isFunction_default = isFunction;
788
+
789
+ // ../../node_modules/lodash-es/_coreJsData.js
790
+ var coreJsData = root_default["__core-js_shared__"];
791
+ var coreJsData_default = coreJsData;
792
+
793
+ // ../../node_modules/lodash-es/_isMasked.js
794
+ var maskSrcKey = function() {
795
+ var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
796
+ return uid ? "Symbol(src)_1." + uid : "";
797
+ }();
798
+ function isMasked(func) {
799
+ return !!maskSrcKey && maskSrcKey in func;
800
+ }
801
+ var isMasked_default = isMasked;
802
+
803
+ // ../../node_modules/lodash-es/_toSource.js
804
+ var funcProto = Function.prototype;
805
+ var funcToString = funcProto.toString;
806
+ function toSource(func) {
807
+ if (func != null) {
808
+ try {
809
+ return funcToString.call(func);
810
+ } catch (e) {
811
+ }
812
+ try {
813
+ return func + "";
814
+ } catch (e) {
815
+ }
816
+ }
817
+ return "";
818
+ }
819
+ var toSource_default = toSource;
820
+
821
+ // ../../node_modules/lodash-es/_baseIsNative.js
822
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
823
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
824
+ var funcProto2 = Function.prototype;
825
+ var objectProto3 = Object.prototype;
826
+ var funcToString2 = funcProto2.toString;
827
+ var hasOwnProperty2 = objectProto3.hasOwnProperty;
828
+ var reIsNative = RegExp(
829
+ "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
830
+ );
831
+ function baseIsNative(value) {
832
+ if (!isObject_default(value) || isMasked_default(value)) {
833
+ return false;
834
+ }
835
+ var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
836
+ return pattern.test(toSource_default(value));
837
+ }
838
+ var baseIsNative_default = baseIsNative;
839
+
840
+ // ../../node_modules/lodash-es/_getValue.js
841
+ function getValue(object, key) {
842
+ return object == null ? void 0 : object[key];
843
+ }
844
+ var getValue_default = getValue;
845
+
846
+ // ../../node_modules/lodash-es/_getNative.js
847
+ function getNative(object, key) {
848
+ var value = getValue_default(object, key);
849
+ return baseIsNative_default(value) ? value : void 0;
850
+ }
851
+ var getNative_default = getNative;
852
+
853
+ // ../../node_modules/lodash-es/_nativeCreate.js
854
+ var nativeCreate = getNative_default(Object, "create");
855
+ var nativeCreate_default = nativeCreate;
856
+
857
+ // ../../node_modules/lodash-es/_hashClear.js
858
+ function hashClear() {
859
+ this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
860
+ this.size = 0;
861
+ }
862
+ var hashClear_default = hashClear;
863
+
864
+ // ../../node_modules/lodash-es/_hashDelete.js
865
+ function hashDelete(key) {
866
+ var result = this.has(key) && delete this.__data__[key];
867
+ this.size -= result ? 1 : 0;
868
+ return result;
869
+ }
870
+ var hashDelete_default = hashDelete;
871
+
872
+ // ../../node_modules/lodash-es/_hashGet.js
873
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
874
+ var objectProto4 = Object.prototype;
875
+ var hasOwnProperty3 = objectProto4.hasOwnProperty;
876
+ function hashGet(key) {
877
+ var data = this.__data__;
878
+ if (nativeCreate_default) {
879
+ var result = data[key];
880
+ return result === HASH_UNDEFINED ? void 0 : result;
881
+ }
882
+ return hasOwnProperty3.call(data, key) ? data[key] : void 0;
883
+ }
884
+ var hashGet_default = hashGet;
885
+
886
+ // ../../node_modules/lodash-es/_hashHas.js
887
+ var objectProto5 = Object.prototype;
888
+ var hasOwnProperty4 = objectProto5.hasOwnProperty;
889
+ function hashHas(key) {
890
+ var data = this.__data__;
891
+ return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty4.call(data, key);
892
+ }
893
+ var hashHas_default = hashHas;
894
+
895
+ // ../../node_modules/lodash-es/_hashSet.js
896
+ var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
897
+ function hashSet(key, value) {
898
+ var data = this.__data__;
899
+ this.size += this.has(key) ? 0 : 1;
900
+ data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
901
+ return this;
902
+ }
903
+ var hashSet_default = hashSet;
904
+
905
+ // ../../node_modules/lodash-es/_Hash.js
906
+ function Hash(entries) {
907
+ var index = -1, length = entries == null ? 0 : entries.length;
908
+ this.clear();
909
+ while (++index < length) {
910
+ var entry = entries[index];
911
+ this.set(entry[0], entry[1]);
912
+ }
913
+ }
914
+ Hash.prototype.clear = hashClear_default;
915
+ Hash.prototype["delete"] = hashDelete_default;
916
+ Hash.prototype.get = hashGet_default;
917
+ Hash.prototype.has = hashHas_default;
918
+ Hash.prototype.set = hashSet_default;
919
+ var Hash_default = Hash;
920
+
921
+ // ../../node_modules/lodash-es/_listCacheClear.js
922
+ function listCacheClear() {
923
+ this.__data__ = [];
924
+ this.size = 0;
925
+ }
926
+ var listCacheClear_default = listCacheClear;
927
+
928
+ // ../../node_modules/lodash-es/eq.js
929
+ function eq(value, other) {
930
+ return value === other || value !== value && other !== other;
931
+ }
932
+ var eq_default = eq;
933
+
934
+ // ../../node_modules/lodash-es/_assocIndexOf.js
935
+ function assocIndexOf(array, key) {
936
+ var length = array.length;
937
+ while (length--) {
938
+ if (eq_default(array[length][0], key)) {
939
+ return length;
940
+ }
941
+ }
942
+ return -1;
943
+ }
944
+ var assocIndexOf_default = assocIndexOf;
945
+
946
+ // ../../node_modules/lodash-es/_listCacheDelete.js
947
+ var arrayProto = Array.prototype;
948
+ var splice = arrayProto.splice;
949
+ function listCacheDelete(key) {
950
+ var data = this.__data__, index = assocIndexOf_default(data, key);
951
+ if (index < 0) {
952
+ return false;
953
+ }
954
+ var lastIndex = data.length - 1;
955
+ if (index == lastIndex) {
956
+ data.pop();
957
+ } else {
958
+ splice.call(data, index, 1);
959
+ }
960
+ --this.size;
961
+ return true;
962
+ }
963
+ var listCacheDelete_default = listCacheDelete;
964
+
965
+ // ../../node_modules/lodash-es/_listCacheGet.js
966
+ function listCacheGet(key) {
967
+ var data = this.__data__, index = assocIndexOf_default(data, key);
968
+ return index < 0 ? void 0 : data[index][1];
969
+ }
970
+ var listCacheGet_default = listCacheGet;
971
+
972
+ // ../../node_modules/lodash-es/_listCacheHas.js
973
+ function listCacheHas(key) {
974
+ return assocIndexOf_default(this.__data__, key) > -1;
975
+ }
976
+ var listCacheHas_default = listCacheHas;
977
+
978
+ // ../../node_modules/lodash-es/_listCacheSet.js
979
+ function listCacheSet(key, value) {
980
+ var data = this.__data__, index = assocIndexOf_default(data, key);
981
+ if (index < 0) {
982
+ ++this.size;
983
+ data.push([key, value]);
984
+ } else {
985
+ data[index][1] = value;
986
+ }
987
+ return this;
988
+ }
989
+ var listCacheSet_default = listCacheSet;
990
+
991
+ // ../../node_modules/lodash-es/_ListCache.js
992
+ function ListCache(entries) {
993
+ var index = -1, length = entries == null ? 0 : entries.length;
994
+ this.clear();
995
+ while (++index < length) {
996
+ var entry = entries[index];
997
+ this.set(entry[0], entry[1]);
998
+ }
999
+ }
1000
+ ListCache.prototype.clear = listCacheClear_default;
1001
+ ListCache.prototype["delete"] = listCacheDelete_default;
1002
+ ListCache.prototype.get = listCacheGet_default;
1003
+ ListCache.prototype.has = listCacheHas_default;
1004
+ ListCache.prototype.set = listCacheSet_default;
1005
+ var ListCache_default = ListCache;
1006
+
1007
+ // ../../node_modules/lodash-es/_Map.js
1008
+ var Map2 = getNative_default(root_default, "Map");
1009
+ var Map_default = Map2;
1010
+
1011
+ // ../../node_modules/lodash-es/_mapCacheClear.js
1012
+ function mapCacheClear() {
1013
+ this.size = 0;
1014
+ this.__data__ = {
1015
+ "hash": new Hash_default(),
1016
+ "map": new (Map_default || ListCache_default)(),
1017
+ "string": new Hash_default()
1018
+ };
1019
+ }
1020
+ var mapCacheClear_default = mapCacheClear;
1021
+
1022
+ // ../../node_modules/lodash-es/_isKeyable.js
1023
+ function isKeyable(value) {
1024
+ var type = typeof value;
1025
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1026
+ }
1027
+ var isKeyable_default = isKeyable;
1028
+
1029
+ // ../../node_modules/lodash-es/_getMapData.js
1030
+ function getMapData(map, key) {
1031
+ var data = map.__data__;
1032
+ return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1033
+ }
1034
+ var getMapData_default = getMapData;
1035
+
1036
+ // ../../node_modules/lodash-es/_mapCacheDelete.js
1037
+ function mapCacheDelete(key) {
1038
+ var result = getMapData_default(this, key)["delete"](key);
1039
+ this.size -= result ? 1 : 0;
1040
+ return result;
1041
+ }
1042
+ var mapCacheDelete_default = mapCacheDelete;
1043
+
1044
+ // ../../node_modules/lodash-es/_mapCacheGet.js
1045
+ function mapCacheGet(key) {
1046
+ return getMapData_default(this, key).get(key);
1047
+ }
1048
+ var mapCacheGet_default = mapCacheGet;
1049
+
1050
+ // ../../node_modules/lodash-es/_mapCacheHas.js
1051
+ function mapCacheHas(key) {
1052
+ return getMapData_default(this, key).has(key);
1053
+ }
1054
+ var mapCacheHas_default = mapCacheHas;
1055
+
1056
+ // ../../node_modules/lodash-es/_mapCacheSet.js
1057
+ function mapCacheSet(key, value) {
1058
+ var data = getMapData_default(this, key), size = data.size;
1059
+ data.set(key, value);
1060
+ this.size += data.size == size ? 0 : 1;
1061
+ return this;
1062
+ }
1063
+ var mapCacheSet_default = mapCacheSet;
1064
+
1065
+ // ../../node_modules/lodash-es/_MapCache.js
1066
+ function MapCache(entries) {
1067
+ var index = -1, length = entries == null ? 0 : entries.length;
1068
+ this.clear();
1069
+ while (++index < length) {
1070
+ var entry = entries[index];
1071
+ this.set(entry[0], entry[1]);
1072
+ }
1073
+ }
1074
+ MapCache.prototype.clear = mapCacheClear_default;
1075
+ MapCache.prototype["delete"] = mapCacheDelete_default;
1076
+ MapCache.prototype.get = mapCacheGet_default;
1077
+ MapCache.prototype.has = mapCacheHas_default;
1078
+ MapCache.prototype.set = mapCacheSet_default;
1079
+ var MapCache_default = MapCache;
1080
+
1081
+ // ../../node_modules/lodash-es/memoize.js
1082
+ var FUNC_ERROR_TEXT = "Expected a function";
1083
+ function memoize(func, resolver) {
1084
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
1085
+ throw new TypeError(FUNC_ERROR_TEXT);
1086
+ }
1087
+ var memoized = function() {
1088
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
1089
+ if (cache.has(key)) {
1090
+ return cache.get(key);
1091
+ }
1092
+ var result = func.apply(this, args);
1093
+ memoized.cache = cache.set(key, result) || cache;
1094
+ return result;
1095
+ };
1096
+ memoized.cache = new (memoize.Cache || MapCache_default)();
1097
+ return memoized;
1098
+ }
1099
+ memoize.Cache = MapCache_default;
1100
+ var memoize_default = memoize;
1101
+
1102
+ // ../../node_modules/lodash-es/_memoizeCapped.js
1103
+ var MAX_MEMOIZE_SIZE = 500;
1104
+ function memoizeCapped(func) {
1105
+ var result = memoize_default(func, function(key) {
1106
+ if (cache.size === MAX_MEMOIZE_SIZE) {
1107
+ cache.clear();
1108
+ }
1109
+ return key;
1110
+ });
1111
+ var cache = result.cache;
1112
+ return result;
1113
+ }
1114
+ var memoizeCapped_default = memoizeCapped;
1115
+
1116
+ // ../../node_modules/lodash-es/_stringToPath.js
1117
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1118
+ var reEscapeChar = /\\(\\)?/g;
1119
+ var stringToPath = memoizeCapped_default(function(string) {
1120
+ var result = [];
1121
+ if (string.charCodeAt(0) === 46) {
1122
+ result.push("");
1123
+ }
1124
+ string.replace(rePropName, function(match, number, quote, subString) {
1125
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
1126
+ });
1127
+ return result;
1128
+ });
1129
+ var stringToPath_default = stringToPath;
1130
+
1131
+ // ../../node_modules/lodash-es/_arrayMap.js
1132
+ function arrayMap(array, iteratee) {
1133
+ var index = -1, length = array == null ? 0 : array.length, result = Array(length);
1134
+ while (++index < length) {
1135
+ result[index] = iteratee(array[index], index, array);
1136
+ }
1137
+ return result;
1138
+ }
1139
+ var arrayMap_default = arrayMap;
1140
+
1141
+ // ../../node_modules/lodash-es/_baseToString.js
1142
+ var INFINITY = 1 / 0;
1143
+ var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
1144
+ var symbolToString = symbolProto ? symbolProto.toString : void 0;
1145
+ function baseToString(value) {
1146
+ if (typeof value == "string") {
1147
+ return value;
1148
+ }
1149
+ if (isArray_default(value)) {
1150
+ return arrayMap_default(value, baseToString) + "";
1151
+ }
1152
+ if (isSymbol_default(value)) {
1153
+ return symbolToString ? symbolToString.call(value) : "";
1154
+ }
1155
+ var result = value + "";
1156
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
1157
+ }
1158
+ var baseToString_default = baseToString;
1159
+
1160
+ // ../../node_modules/lodash-es/toString.js
1161
+ function toString(value) {
1162
+ return value == null ? "" : baseToString_default(value);
1163
+ }
1164
+ var toString_default = toString;
1165
+
1166
+ // ../../node_modules/lodash-es/_castPath.js
1167
+ function castPath(value, object) {
1168
+ if (isArray_default(value)) {
1169
+ return value;
1170
+ }
1171
+ return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value));
1172
+ }
1173
+ var castPath_default = castPath;
1174
+
1175
+ // ../../node_modules/lodash-es/_toKey.js
1176
+ var INFINITY2 = 1 / 0;
1177
+ function toKey(value) {
1178
+ if (typeof value == "string" || isSymbol_default(value)) {
1179
+ return value;
1180
+ }
1181
+ var result = value + "";
1182
+ return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
1183
+ }
1184
+ var toKey_default = toKey;
1185
+
1186
+ // ../../node_modules/lodash-es/_baseGet.js
1187
+ function baseGet(object, path) {
1188
+ path = castPath_default(path, object);
1189
+ var index = 0, length = path.length;
1190
+ while (object != null && index < length) {
1191
+ object = object[toKey_default(path[index++])];
1192
+ }
1193
+ return index && index == length ? object : void 0;
1194
+ }
1195
+ var baseGet_default = baseGet;
1196
+
1197
+ // ../../node_modules/lodash-es/get.js
1198
+ function get(object, path, defaultValue) {
1199
+ var result = object == null ? void 0 : baseGet_default(object, path);
1200
+ return result === void 0 ? defaultValue : result;
1201
+ }
1202
+ var get_default = get;
1203
+
1204
+ // ../../node_modules/lodash-es/_overArg.js
1205
+ function overArg(func, transform) {
1206
+ return function(arg) {
1207
+ return func(transform(arg));
1208
+ };
1209
+ }
1210
+ var overArg_default = overArg;
1211
+
1212
+ // ../../node_modules/lodash-es/_getPrototype.js
1213
+ var getPrototype = overArg_default(Object.getPrototypeOf, Object);
1214
+ var getPrototype_default = getPrototype;
1215
+
1216
+ // ../../node_modules/lodash-es/isPlainObject.js
1217
+ var objectTag = "[object Object]";
1218
+ var funcProto3 = Function.prototype;
1219
+ var objectProto6 = Object.prototype;
1220
+ var funcToString3 = funcProto3.toString;
1221
+ var hasOwnProperty5 = objectProto6.hasOwnProperty;
1222
+ var objectCtorString = funcToString3.call(Object);
1223
+ function isPlainObject(value) {
1224
+ if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag) {
1225
+ return false;
1226
+ }
1227
+ var proto = getPrototype_default(value);
1228
+ if (proto === null) {
1229
+ return true;
1230
+ }
1231
+ var Ctor = hasOwnProperty5.call(proto, "constructor") && proto.constructor;
1232
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
1233
+ }
1234
+ var isPlainObject_default = isPlainObject;
1235
+
1236
+ // ../../node_modules/lodash-es/last.js
1237
+ function last(array) {
1238
+ var length = array == null ? 0 : array.length;
1239
+ return length ? array[length - 1] : void 0;
1240
+ }
1241
+ var last_default = last;
1242
+
1243
+ // ../dataverse/src/pointer.ts
1244
+ var pointerMetaWeakMap = /* @__PURE__ */ new WeakMap();
1245
+ var cachedSubPathPointersWeakMap = /* @__PURE__ */ new WeakMap();
1246
+ var pointerMetaSymbol = Symbol("pointerMeta");
1247
+ var proxyHandler = {
1248
+ get(pointerKey, prop) {
1249
+ if (prop === pointerMetaSymbol)
1250
+ return pointerMetaWeakMap.get(pointerKey);
1251
+ let subPathPointers = cachedSubPathPointersWeakMap.get(pointerKey);
1252
+ if (!subPathPointers) {
1253
+ subPathPointers = /* @__PURE__ */ new Map();
1254
+ cachedSubPathPointersWeakMap.set(pointerKey, subPathPointers);
1255
+ }
1256
+ const existing = subPathPointers.get(prop);
1257
+ if (existing !== void 0)
1258
+ return existing;
1259
+ const meta = pointerMetaWeakMap.get(pointerKey);
1260
+ const subPointer = pointer({ root: meta.root, path: [...meta.path, prop] });
1261
+ subPathPointers.set(prop, subPointer);
1262
+ return subPointer;
1263
+ }
1264
+ };
1265
+ var getPointerMeta = (p) => {
1266
+ const meta = p[pointerMetaSymbol];
1267
+ return meta;
1268
+ };
1269
+ var getPointerParts = (p) => {
1270
+ const { root: root2, path } = getPointerMeta(p);
1271
+ return { root: root2, path };
1272
+ };
1273
+ function pointer(args) {
1274
+ const meta = {
1275
+ root: args.root,
1276
+ path: args.path ?? []
1277
+ };
1278
+ const pointerKey = {};
1279
+ pointerMetaWeakMap.set(pointerKey, meta);
1280
+ return new Proxy(pointerKey, proxyHandler);
1281
+ }
1282
+ var pointer_default = pointer;
1283
+ var isPointer = (p) => {
1284
+ return p && !!getPointerMeta(p);
1285
+ };
1286
+
1287
+ // ../dataverse/src/utils/updateDeep.ts
1288
+ function updateDeep(state2, path, reducer) {
1289
+ if (path.length === 0)
1290
+ return reducer(state2);
1291
+ return hoop(state2, path, reducer);
1292
+ }
1293
+ var hoop = (s, path, reducer) => {
1294
+ if (path.length === 0) {
1295
+ return reducer(s);
1296
+ }
1297
+ if (Array.isArray(s)) {
1298
+ let [index, ...restOfPath] = path;
1299
+ index = parseInt(String(index), 10);
1300
+ if (isNaN(index))
1301
+ index = 0;
1302
+ const oldVal = s[index];
1303
+ const newVal = hoop(oldVal, restOfPath, reducer);
1304
+ if (oldVal === newVal)
1305
+ return s;
1306
+ const newS = [...s];
1307
+ newS.splice(index, 1, newVal);
1308
+ return newS;
1309
+ } else if (typeof s === "object" && s !== null) {
1310
+ const [key, ...restOfPath] = path;
1311
+ const oldVal = s[key];
1312
+ const newVal = hoop(oldVal, restOfPath, reducer);
1313
+ if (oldVal === newVal)
1314
+ return s;
1315
+ const newS = { ...s, [key]: newVal };
1316
+ return newS;
1317
+ } else {
1318
+ const [key, ...restOfPath] = path;
1319
+ return { [key]: hoop(void 0, restOfPath, reducer) };
1320
+ }
1321
+ };
1322
+
1323
+ // ../dataverse/src/utils/Stack.ts
1324
+ var Stack = class {
1325
+ constructor() {
1326
+ this._head = void 0;
1327
+ }
1328
+ peek() {
1329
+ return this._head && this._head.data;
1330
+ }
1331
+ pop() {
1332
+ const head = this._head;
1333
+ if (!head) {
1334
+ return void 0;
1335
+ }
1336
+ this._head = head.next;
1337
+ return head.data;
1338
+ }
1339
+ push(data) {
1340
+ const node = { next: this._head, data };
1341
+ this._head = node;
1342
+ }
1343
+ };
1344
+
1345
+ // ../dataverse/src/prism/discoveryMechanism.ts
1346
+ function createMechanism() {
1347
+ const noop = () => {
1348
+ };
1349
+ const stack = new Stack();
1350
+ const noopCollector = noop;
1351
+ const pushCollector2 = (collector) => {
1352
+ stack.push(collector);
1353
+ };
1354
+ const popCollector2 = (collector) => {
1355
+ const existing = stack.peek();
1356
+ if (existing !== collector) {
1357
+ throw new Error(`Popped collector is not on top of the stack`);
1358
+ }
1359
+ stack.pop();
1360
+ };
1361
+ const startIgnoringDependencies2 = () => {
1362
+ stack.push(noopCollector);
1363
+ };
1364
+ const stopIgnoringDependencies2 = () => {
1365
+ if (stack.peek() !== noopCollector) {
1366
+ if (process.env.NODE_ENV === "development") {
1367
+ console.warn("This should never happen");
1368
+ }
1369
+ } else {
1370
+ stack.pop();
1371
+ }
1372
+ };
1373
+ const reportResolutionStart2 = (d) => {
1374
+ const possibleCollector = stack.peek();
1375
+ if (possibleCollector) {
1376
+ possibleCollector(d);
1377
+ }
1378
+ stack.push(noopCollector);
1379
+ };
1380
+ const reportResolutionEnd2 = (_d) => {
1381
+ stack.pop();
1382
+ };
1383
+ return {
1384
+ type: "Dataverse_discoveryMechanism",
1385
+ startIgnoringDependencies: startIgnoringDependencies2,
1386
+ stopIgnoringDependencies: stopIgnoringDependencies2,
1387
+ reportResolutionStart: reportResolutionStart2,
1388
+ reportResolutionEnd: reportResolutionEnd2,
1389
+ pushCollector: pushCollector2,
1390
+ popCollector: popCollector2
1391
+ };
1392
+ }
1393
+ function getSharedMechanism() {
1394
+ const varName = "__dataverse_discoveryMechanism_sharedStack";
1395
+ const root2 = typeof window !== "undefined" ? window : typeof window !== "undefined" ? window : {};
1396
+ if (root2) {
1397
+ const existingMechanism = (
1398
+ // @ts-ignore ignore
1399
+ root2[varName]
1400
+ );
1401
+ if (existingMechanism && typeof existingMechanism === "object" && existingMechanism.type === "Dataverse_discoveryMechanism") {
1402
+ return existingMechanism;
1403
+ } else {
1404
+ const mechanism = createMechanism();
1405
+ root2[varName] = mechanism;
1406
+ return mechanism;
1407
+ }
1408
+ } else {
1409
+ return createMechanism();
1410
+ }
1411
+ }
1412
+ var {
1413
+ startIgnoringDependencies,
1414
+ stopIgnoringDependencies,
1415
+ reportResolutionEnd,
1416
+ reportResolutionStart,
1417
+ pushCollector,
1418
+ popCollector
1419
+ } = getSharedMechanism();
1420
+
1421
+ // ../dataverse/src/prism/prism.ts
1422
+ var voidFn = () => {
1423
+ };
1424
+ var HotHandle = class {
1425
+ constructor(_fn, _prismInstance) {
1426
+ this._fn = _fn;
1427
+ this._prismInstance = _prismInstance;
1428
+ this._didMarkDependentsAsStale = false;
1429
+ this._isFresh = false;
1430
+ this._cacheOfDendencyValues = /* @__PURE__ */ new Map();
1431
+ /**
1432
+ * @internal
1433
+ */
1434
+ this._dependents = /* @__PURE__ */ new Set();
1435
+ /**
1436
+ * @internal
1437
+ */
1438
+ this._dependencies = /* @__PURE__ */ new Set();
1439
+ this._possiblyStaleDeps = /* @__PURE__ */ new Set();
1440
+ this._scope = new HotScope(
1441
+ this
1442
+ );
1443
+ /**
1444
+ * @internal
1445
+ */
1446
+ this._lastValue = void 0;
1447
+ /**
1448
+ * If true, the prism is stale even though its dependencies aren't
1449
+ * marked as such. This is used by `prism.source()` and `prism.state()`
1450
+ * to mark the prism as stale.
1451
+ */
1452
+ this._forciblySetToStale = false;
1453
+ this._reactToDependencyGoingStale = (which) => {
1454
+ this._possiblyStaleDeps.add(which);
1455
+ this._markAsStale();
1456
+ };
1457
+ for (const d of this._dependencies) {
1458
+ d._addDependent(this._reactToDependencyGoingStale);
1459
+ }
1460
+ startIgnoringDependencies();
1461
+ this.getValue();
1462
+ stopIgnoringDependencies();
1463
+ }
1464
+ get hasDependents() {
1465
+ return this._dependents.size > 0;
1466
+ }
1467
+ removeDependent(d) {
1468
+ this._dependents.delete(d);
1469
+ }
1470
+ addDependent(d) {
1471
+ this._dependents.add(d);
1472
+ }
1473
+ destroy() {
1474
+ for (const d of this._dependencies) {
1475
+ d._removeDependent(this._reactToDependencyGoingStale);
1476
+ }
1477
+ cleanupScopeStack(this._scope);
1478
+ }
1479
+ getValue() {
1480
+ if (!this._isFresh) {
1481
+ const newValue = this._recalculate();
1482
+ this._lastValue = newValue;
1483
+ this._isFresh = true;
1484
+ this._didMarkDependentsAsStale = false;
1485
+ this._forciblySetToStale = false;
1486
+ }
1487
+ return this._lastValue;
1488
+ }
1489
+ _recalculate() {
1490
+ let value;
1491
+ if (!this._forciblySetToStale) {
1492
+ if (this._possiblyStaleDeps.size > 0) {
1493
+ let anActuallyStaleDepWasFound = false;
1494
+ startIgnoringDependencies();
1495
+ for (const dep of this._possiblyStaleDeps) {
1496
+ if (this._cacheOfDendencyValues.get(dep) !== dep.getValue()) {
1497
+ anActuallyStaleDepWasFound = true;
1498
+ break;
1499
+ }
1500
+ }
1501
+ stopIgnoringDependencies();
1502
+ this._possiblyStaleDeps.clear();
1503
+ if (!anActuallyStaleDepWasFound) {
1504
+ return this._lastValue;
1505
+ }
1506
+ }
1507
+ }
1508
+ const newDeps = /* @__PURE__ */ new Set();
1509
+ this._cacheOfDendencyValues.clear();
1510
+ const collector = (observedDep) => {
1511
+ newDeps.add(observedDep);
1512
+ this._addDependency(observedDep);
1513
+ };
1514
+ pushCollector(collector);
1515
+ hookScopeStack.push(this._scope);
1516
+ try {
1517
+ value = this._fn();
1518
+ } catch (error) {
1519
+ console.error(error);
1520
+ } finally {
1521
+ const topOfTheStack = hookScopeStack.pop();
1522
+ if (topOfTheStack !== this._scope) {
1523
+ console.warn(
1524
+ // @todo guide the user to report the bug in an issue
1525
+ `The Prism hook stack has slipped. This is a bug.`
1526
+ );
1527
+ }
1528
+ }
1529
+ popCollector(collector);
1530
+ for (const dep of this._dependencies) {
1531
+ if (!newDeps.has(dep)) {
1532
+ this._removeDependency(dep);
1533
+ }
1534
+ }
1535
+ this._dependencies = newDeps;
1536
+ startIgnoringDependencies();
1537
+ for (const dep of newDeps) {
1538
+ this._cacheOfDendencyValues.set(dep, dep.getValue());
1539
+ }
1540
+ stopIgnoringDependencies();
1541
+ return value;
1542
+ }
1543
+ forceStale() {
1544
+ this._forciblySetToStale = true;
1545
+ this._markAsStale();
1546
+ }
1547
+ _markAsStale() {
1548
+ if (this._didMarkDependentsAsStale)
1549
+ return;
1550
+ this._didMarkDependentsAsStale = true;
1551
+ this._isFresh = false;
1552
+ for (const dependent of this._dependents) {
1553
+ dependent(this._prismInstance);
1554
+ }
1555
+ }
1556
+ /**
1557
+ * @internal
1558
+ */
1559
+ _addDependency(d) {
1560
+ if (this._dependencies.has(d))
1561
+ return;
1562
+ this._dependencies.add(d);
1563
+ d._addDependent(this._reactToDependencyGoingStale);
1564
+ }
1565
+ /**
1566
+ * @internal
1567
+ */
1568
+ _removeDependency(d) {
1569
+ if (!this._dependencies.has(d))
1570
+ return;
1571
+ this._dependencies.delete(d);
1572
+ d._removeDependent(this._reactToDependencyGoingStale);
1573
+ }
1574
+ };
1575
+ var emptyObject = {};
1576
+ var PrismInstance = class {
1577
+ constructor(_fn) {
1578
+ this._fn = _fn;
1579
+ /**
1580
+ * Whether the object is a prism.
1581
+ */
1582
+ this.isPrism = true;
1583
+ this._state = {
1584
+ hot: false,
1585
+ handle: void 0
1586
+ };
1587
+ }
1588
+ /**
1589
+ * Whether the prism is hot.
1590
+ */
1591
+ get isHot() {
1592
+ return this._state.hot;
1593
+ }
1594
+ onChange(ticker, listener, immediate = false) {
1595
+ const dependent = () => {
1596
+ ticker.onThisOrNextTick(refresh);
1597
+ };
1598
+ let lastValue = (
1599
+ // use an empty object as the initial value so that the listener is called on the first tick.
1600
+ // if we were to use, say, undefined, and this.getValue() also returned undefined, the listener
1601
+ // would never be called.
1602
+ emptyObject
1603
+ );
1604
+ const refresh = () => {
1605
+ const newValue = this.getValue();
1606
+ if (newValue === lastValue)
1607
+ return;
1608
+ lastValue = newValue;
1609
+ listener(newValue);
1610
+ };
1611
+ this._addDependent(dependent);
1612
+ if (immediate) {
1613
+ lastValue = this.getValue();
1614
+ listener(lastValue);
1615
+ }
1616
+ const unsubscribe = () => {
1617
+ this._removeDependent(dependent);
1618
+ ticker.offThisOrNextTick(refresh);
1619
+ ticker.offNextTick(refresh);
1620
+ };
1621
+ return unsubscribe;
1622
+ }
1623
+ /**
1624
+ * Calls `callback` every time the prism's state goes from `fresh-\>stale.` Returns an `unsubscribe()` function.
1625
+ */
1626
+ onStale(callback) {
1627
+ const untap = () => {
1628
+ this._removeDependent(fn);
1629
+ };
1630
+ const fn = () => callback();
1631
+ this._addDependent(fn);
1632
+ return untap;
1633
+ }
1634
+ /**
1635
+ * Keep the prism hot, even if there are no tappers (subscribers).
1636
+ */
1637
+ keepHot() {
1638
+ return this.onStale(() => {
1639
+ });
1640
+ }
1641
+ /**
1642
+ * Add a prism as a dependent of this prism.
1643
+ *
1644
+ * @param d - The prism to be made a dependent of this prism.
1645
+ *
1646
+ * @see _removeDependent
1647
+ */
1648
+ _addDependent(d) {
1649
+ if (!this._state.hot) {
1650
+ this._goHot();
1651
+ }
1652
+ this._state.handle.addDependent(d);
1653
+ }
1654
+ _goHot() {
1655
+ const hotHandle = new HotHandle(this._fn, this);
1656
+ this._state = {
1657
+ hot: true,
1658
+ handle: hotHandle
1659
+ };
1660
+ }
1661
+ /**
1662
+ * Remove a prism as a dependent of this prism.
1663
+ *
1664
+ * @param d - The prism to be removed from as a dependent of this prism.
1665
+ *
1666
+ * @see _addDependent
1667
+ */
1668
+ _removeDependent(d) {
1669
+ const state2 = this._state;
1670
+ if (!state2.hot) {
1671
+ return;
1672
+ }
1673
+ const handle = state2.handle;
1674
+ handle.removeDependent(d);
1675
+ if (!handle.hasDependents) {
1676
+ this._state = { hot: false, handle: void 0 };
1677
+ handle.destroy();
1678
+ }
1679
+ }
1680
+ /**
1681
+ * Gets the current value of the prism. If the value is stale, it causes the prism to freshen.
1682
+ */
1683
+ getValue() {
1684
+ reportResolutionStart(this);
1685
+ const state2 = this._state;
1686
+ let val;
1687
+ if (state2.hot) {
1688
+ val = state2.handle.getValue();
1689
+ } else {
1690
+ val = calculateColdPrism(this._fn);
1691
+ }
1692
+ reportResolutionEnd(this);
1693
+ return val;
1694
+ }
1695
+ };
1696
+ var HotScope = class _HotScope {
1697
+ constructor(_hotHandle) {
1698
+ this._hotHandle = _hotHandle;
1699
+ this._refs = /* @__PURE__ */ new Map();
1700
+ this.isPrismScope = true;
1701
+ // NOTE probably not a great idea to eager-allocate all of these objects/maps for every scope,
1702
+ // especially because most wouldn't get used in the majority of cases. However, back when these
1703
+ // were stored on weakmaps, they were uncomfortable to inspect in the debugger.
1704
+ this.subs = {};
1705
+ this.effects = /* @__PURE__ */ new Map();
1706
+ this.memos = /* @__PURE__ */ new Map();
1707
+ }
1708
+ ref(key, initialValue) {
1709
+ let ref2 = this._refs.get(key);
1710
+ if (ref2 !== void 0) {
1711
+ return ref2;
1712
+ } else {
1713
+ const ref3 = {
1714
+ current: initialValue
1715
+ };
1716
+ this._refs.set(key, ref3);
1717
+ return ref3;
1718
+ }
1719
+ }
1720
+ effect(key, cb, deps) {
1721
+ let effect2 = this.effects.get(key);
1722
+ if (effect2 === void 0) {
1723
+ effect2 = {
1724
+ cleanup: voidFn,
1725
+ deps: void 0
1726
+ };
1727
+ this.effects.set(key, effect2);
1728
+ }
1729
+ if (depsHaveChanged(effect2.deps, deps)) {
1730
+ effect2.cleanup();
1731
+ startIgnoringDependencies();
1732
+ effect2.cleanup = safelyRun(cb, voidFn).value;
1733
+ stopIgnoringDependencies();
1734
+ effect2.deps = deps;
1735
+ }
1736
+ }
1737
+ memo(key, fn, deps) {
1738
+ let memo2 = this.memos.get(key);
1739
+ if (memo2 === void 0) {
1740
+ memo2 = {
1741
+ cachedValue: null,
1742
+ // undefined will always indicate "deps have changed", so we set its initial value as such
1743
+ deps: void 0
1744
+ };
1745
+ this.memos.set(key, memo2);
1746
+ }
1747
+ if (depsHaveChanged(memo2.deps, deps)) {
1748
+ startIgnoringDependencies();
1749
+ memo2.cachedValue = safelyRun(fn, void 0).value;
1750
+ stopIgnoringDependencies();
1751
+ memo2.deps = deps;
1752
+ }
1753
+ return memo2.cachedValue;
1754
+ }
1755
+ state(key, initialValue) {
1756
+ const { value, setValue } = this.memo(
1757
+ "state/" + key,
1758
+ () => {
1759
+ const value2 = { current: initialValue };
1760
+ const setValue2 = (newValue) => {
1761
+ value2.current = newValue;
1762
+ this._hotHandle.forceStale();
1763
+ };
1764
+ return { value: value2, setValue: setValue2 };
1765
+ },
1766
+ []
1767
+ );
1768
+ return [value.current, setValue];
1769
+ }
1770
+ sub(key) {
1771
+ if (!this.subs[key]) {
1772
+ this.subs[key] = new _HotScope(this._hotHandle);
1773
+ }
1774
+ return this.subs[key];
1775
+ }
1776
+ cleanupEffects() {
1777
+ for (const effect2 of this.effects.values()) {
1778
+ safelyRun(effect2.cleanup, void 0);
1779
+ }
1780
+ this.effects.clear();
1781
+ }
1782
+ source(subscribe, getValue2) {
1783
+ const sourceKey = "$$source/blah";
1784
+ this.effect(
1785
+ sourceKey,
1786
+ () => {
1787
+ const unsub = subscribe(() => {
1788
+ this._hotHandle.forceStale();
1789
+ });
1790
+ return unsub;
1791
+ },
1792
+ [subscribe]
1793
+ );
1794
+ return getValue2();
1795
+ }
1796
+ };
1797
+ function cleanupScopeStack(scope2) {
1798
+ for (const sub2 of Object.values(scope2.subs)) {
1799
+ cleanupScopeStack(sub2);
1800
+ }
1801
+ scope2.cleanupEffects();
1802
+ }
1803
+ function safelyRun(fn, returnValueInCaseOfError) {
1804
+ try {
1805
+ return { value: fn(), ok: true };
1806
+ } catch (error) {
1807
+ setTimeout(function PrismReportThrow() {
1808
+ throw error;
1809
+ });
1810
+ return { value: returnValueInCaseOfError, ok: false };
1811
+ }
1812
+ }
1813
+ var hookScopeStack = new Stack();
1814
+ function ref(key, initialValue) {
1815
+ const scope2 = hookScopeStack.peek();
1816
+ if (!scope2) {
1817
+ throw new Error(`prism.ref() is called outside of a prism() call.`);
1818
+ }
1819
+ return scope2.ref(key, initialValue);
1820
+ }
1821
+ function effect(key, cb, deps) {
1822
+ const scope2 = hookScopeStack.peek();
1823
+ if (!scope2) {
1824
+ throw new Error(`prism.effect() is called outside of a prism() call.`);
1825
+ }
1826
+ return scope2.effect(key, cb, deps);
1827
+ }
1828
+ function depsHaveChanged(oldDeps, newDeps) {
1829
+ if (oldDeps === void 0 || newDeps === void 0) {
1830
+ return true;
1831
+ }
1832
+ const len = oldDeps.length;
1833
+ if (len !== newDeps.length)
1834
+ return true;
1835
+ for (let i = 0; i < len; i++) {
1836
+ if (oldDeps[i] !== newDeps[i])
1837
+ return true;
1838
+ }
1839
+ return false;
1840
+ }
1841
+ function memo(key, fn, deps) {
1842
+ const scope2 = hookScopeStack.peek();
1843
+ if (!scope2) {
1844
+ throw new Error(`prism.memo() is called outside of a prism() call.`);
1845
+ }
1846
+ return scope2.memo(key, fn, deps);
1847
+ }
1848
+ function state(key, initialValue) {
1849
+ const scope2 = hookScopeStack.peek();
1850
+ if (!scope2) {
1851
+ throw new Error(`prism.state() is called outside of a prism() call.`);
1852
+ }
1853
+ return scope2.state(key, initialValue);
1854
+ }
1855
+ function ensurePrism() {
1856
+ const scope2 = hookScopeStack.peek();
1857
+ if (!scope2) {
1858
+ throw new Error(`The parent function is called outside of a prism() call.`);
1859
+ }
1860
+ }
1861
+ function scope(key, fn) {
1862
+ const parentScope = hookScopeStack.peek();
1863
+ if (!parentScope) {
1864
+ throw new Error(`prism.scope() is called outside of a prism() call.`);
1865
+ }
1866
+ const subScope = parentScope.sub(key);
1867
+ hookScopeStack.push(subScope);
1868
+ const ret = safelyRun(fn, void 0).value;
1869
+ hookScopeStack.pop();
1870
+ return ret;
1871
+ }
1872
+ function sub(key, fn, deps) {
1873
+ return memo(key, () => prism(fn), deps).getValue();
1874
+ }
1875
+ function inPrism() {
1876
+ return !!hookScopeStack.peek();
1877
+ }
1878
+ function source(subscribe, getValue2) {
1879
+ const scope2 = hookScopeStack.peek();
1880
+ if (!scope2) {
1881
+ throw new Error(`prism.source() is called outside of a prism() call.`);
1882
+ }
1883
+ return scope2.source(subscribe, getValue2);
1884
+ }
1885
+ var prism = (fn) => {
1886
+ return new PrismInstance(fn);
1887
+ };
1888
+ var ColdScope = class _ColdScope {
1889
+ effect(key, cb, deps) {
1890
+ console.warn(`prism.effect() does not run in cold prisms`);
1891
+ }
1892
+ memo(key, fn, deps) {
1893
+ return fn();
1894
+ }
1895
+ state(key, initialValue) {
1896
+ return [initialValue, () => {
1897
+ }];
1898
+ }
1899
+ ref(key, initialValue) {
1900
+ return { current: initialValue };
1901
+ }
1902
+ sub(key) {
1903
+ return new _ColdScope();
1904
+ }
1905
+ source(subscribe, getValue2) {
1906
+ return getValue2();
1907
+ }
1908
+ };
1909
+ function calculateColdPrism(fn) {
1910
+ const scope2 = new ColdScope();
1911
+ hookScopeStack.push(scope2);
1912
+ let value;
1913
+ try {
1914
+ value = fn();
1915
+ } catch (error) {
1916
+ console.error(error);
1917
+ } finally {
1918
+ const topOfTheStack = hookScopeStack.pop();
1919
+ if (topOfTheStack !== scope2) {
1920
+ console.warn(
1921
+ // @todo guide the user to report the bug in an issue
1922
+ `The Prism hook stack has slipped. This is a bug.`
1923
+ );
1924
+ }
1925
+ }
1926
+ return value;
1927
+ }
1928
+ prism.ref = ref;
1929
+ prism.effect = effect;
1930
+ prism.memo = memo;
1931
+ prism.ensurePrism = ensurePrism;
1932
+ prism.state = state;
1933
+ prism.scope = scope;
1934
+ prism.sub = sub;
1935
+ prism.inPrism = inPrism;
1936
+ prism.source = source;
1937
+ var prism_default = prism;
1938
+
1939
+ // ../dataverse/src/Atom.ts
1940
+ var getTypeOfValue = (v) => {
1941
+ if (Array.isArray(v))
1942
+ return 1 /* Array */;
1943
+ if (isPlainObject_default(v))
1944
+ return 0 /* Dict */;
1945
+ return 2 /* Other */;
1946
+ };
1947
+ var getKeyOfValue = (v, key, vType = getTypeOfValue(v)) => {
1948
+ if (vType === 0 /* Dict */ && typeof key === "string") {
1949
+ return v[key];
1950
+ } else if (vType === 1 /* Array */ && isValidArrayIndex(key)) {
1951
+ return v[key];
1952
+ } else {
1953
+ return void 0;
1954
+ }
1955
+ };
1956
+ var isValidArrayIndex = (key) => {
1957
+ const inNumber = typeof key === "number" ? key : parseInt(key, 10);
1958
+ return !isNaN(inNumber) && inNumber >= 0 && inNumber < Infinity && (inNumber | 0) === inNumber;
1959
+ };
1960
+ var Scope = class _Scope {
1961
+ constructor(_parent, _path) {
1962
+ this._parent = _parent;
1963
+ this._path = _path;
1964
+ this.children = /* @__PURE__ */ new Map();
1965
+ this.identityChangeListeners = /* @__PURE__ */ new Set();
1966
+ }
1967
+ addIdentityChangeListener(cb) {
1968
+ this.identityChangeListeners.add(cb);
1969
+ }
1970
+ removeIdentityChangeListener(cb) {
1971
+ this.identityChangeListeners.delete(cb);
1972
+ this._checkForGC();
1973
+ }
1974
+ removeChild(key) {
1975
+ this.children.delete(key);
1976
+ this._checkForGC();
1977
+ }
1978
+ getChild(key) {
1979
+ return this.children.get(key);
1980
+ }
1981
+ getOrCreateChild(key) {
1982
+ let child = this.children.get(key);
1983
+ if (!child) {
1984
+ child = child = new _Scope(this, this._path.concat([key]));
1985
+ this.children.set(key, child);
1986
+ }
1987
+ return child;
1988
+ }
1989
+ _checkForGC() {
1990
+ if (this.identityChangeListeners.size > 0)
1991
+ return;
1992
+ if (this.children.size > 0)
1993
+ return;
1994
+ if (this._parent) {
1995
+ this._parent.removeChild(last_default(this._path));
1996
+ }
1997
+ }
1998
+ };
1999
+ var Atom = class {
2000
+ constructor(initialState) {
2001
+ /**
2002
+ * @internal
2003
+ */
2004
+ this.$$isPointerToPrismProvider = true;
2005
+ /**
2006
+ * Convenience property that gives you a pointer to the root of the atom.
2007
+ *
2008
+ * @remarks
2009
+ * Equivalent to `pointer({ root: thisAtom, path: [] })`.
2010
+ */
2011
+ this.pointer = pointer_default({ root: this, path: [] });
2012
+ this.prism = this.pointerToPrism(
2013
+ this.pointer
2014
+ );
2015
+ this._onPointerValueChange = (pointer2, cb) => {
2016
+ const { path } = getPointerParts(pointer2);
2017
+ const scope2 = this._getOrCreateScopeForPath(path);
2018
+ scope2.identityChangeListeners.add(cb);
2019
+ const unsubscribe = () => {
2020
+ scope2.identityChangeListeners.delete(cb);
2021
+ };
2022
+ return unsubscribe;
2023
+ };
2024
+ this._currentState = initialState;
2025
+ this._rootScope = new Scope(void 0, []);
2026
+ }
2027
+ /**
2028
+ * Sets the state of the atom.
2029
+ *
2030
+ * @param newState - The new state of the atom.
2031
+ */
2032
+ set(newState) {
2033
+ const oldState = this._currentState;
2034
+ this._currentState = newState;
2035
+ this._checkUpdates(this._rootScope, oldState, newState);
2036
+ }
2037
+ get() {
2038
+ return this._currentState;
2039
+ }
2040
+ /**
2041
+ * Returns the value at the given pointer
2042
+ *
2043
+ * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer
2044
+ *
2045
+ * Example
2046
+ * ```ts
2047
+ * const atom = atom({ a: { b: 1 } })
2048
+ * atom.getByPointer(atom.pointer.a.b) // 1
2049
+ * atom.getByPointer((p) => p.a.b) // 1
2050
+ * ```
2051
+ */
2052
+ getByPointer(pointerOrFn) {
2053
+ const pointer2 = isPointer(pointerOrFn) ? pointerOrFn : pointerOrFn(this.pointer);
2054
+ const path = getPointerParts(pointer2).path;
2055
+ return this._getIn(path);
2056
+ }
2057
+ /**
2058
+ * Gets the state of the atom at `path`.
2059
+ */
2060
+ _getIn(path) {
2061
+ return path.length === 0 ? this.get() : get_default(this.get(), path);
2062
+ }
2063
+ reduce(fn) {
2064
+ this.set(fn(this.get()));
2065
+ }
2066
+ /**
2067
+ * Reduces the value at the given pointer
2068
+ *
2069
+ * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer
2070
+ *
2071
+ * Example
2072
+ * ```ts
2073
+ * const atom = atom({ a: { b: 1 } })
2074
+ * atom.reduceByPointer(atom.pointer.a.b, (b) => b + 1) // atom.get().a.b === 2
2075
+ * atom.reduceByPointer((p) => p.a.b, (b) => b + 1) // atom.get().a.b === 2
2076
+ * ```
2077
+ */
2078
+ reduceByPointer(pointerOrFn, reducer) {
2079
+ const pointer2 = isPointer(pointerOrFn) ? pointerOrFn : pointerOrFn(this.pointer);
2080
+ const path = getPointerParts(pointer2).path;
2081
+ const newState = updateDeep(this.get(), path, reducer);
2082
+ this.set(newState);
2083
+ }
2084
+ /**
2085
+ * Sets the value at the given pointer
2086
+ *
2087
+ * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer
2088
+ *
2089
+ * Example
2090
+ * ```ts
2091
+ * const atom = atom({ a: { b: 1 } })
2092
+ * atom.setByPointer(atom.pointer.a.b, 2) // atom.get().a.b === 2
2093
+ * atom.setByPointer((p) => p.a.b, 2) // atom.get().a.b === 2
2094
+ * ```
2095
+ */
2096
+ setByPointer(pointerOrFn, val) {
2097
+ this.reduceByPointer(pointerOrFn, () => val);
2098
+ }
2099
+ _checkUpdates(scope2, oldState, newState) {
2100
+ if (oldState === newState)
2101
+ return;
2102
+ for (const cb of scope2.identityChangeListeners) {
2103
+ cb(newState);
2104
+ }
2105
+ if (scope2.children.size === 0)
2106
+ return;
2107
+ const oldValueType = getTypeOfValue(oldState);
2108
+ const newValueType = getTypeOfValue(newState);
2109
+ if (oldValueType === 2 /* Other */ && oldValueType === newValueType)
2110
+ return;
2111
+ for (const [childKey, childScope] of scope2.children) {
2112
+ const oldChildVal = getKeyOfValue(oldState, childKey, oldValueType);
2113
+ const newChildVal = getKeyOfValue(newState, childKey, newValueType);
2114
+ this._checkUpdates(childScope, oldChildVal, newChildVal);
2115
+ }
2116
+ }
2117
+ _getOrCreateScopeForPath(path) {
2118
+ let curScope = this._rootScope;
2119
+ for (const pathEl of path) {
2120
+ curScope = curScope.getOrCreateChild(pathEl);
2121
+ }
2122
+ return curScope;
2123
+ }
2124
+ /**
2125
+ * Returns a new prism of the value at the provided path.
2126
+ *
2127
+ * @param pointer - The path to create the prism at.
2128
+ *
2129
+ * ```ts
2130
+ * const pr = atom({ a: { b: 1 } }).pointerToPrism(atom.pointer.a.b)
2131
+ * pr.getValue() // 1
2132
+ * ```
2133
+ */
2134
+ pointerToPrism(pointer2) {
2135
+ const { path } = getPointerParts(pointer2);
2136
+ const subscribe = (listener) => this._onPointerValueChange(pointer2, listener);
2137
+ const getValue2 = () => this._getIn(path);
2138
+ return prism_default(() => {
2139
+ return prism_default.source(subscribe, getValue2);
2140
+ });
2141
+ }
2142
+ };
2143
+
2144
+ // ../../theatre/shared/src/gsap/gsapStudioRegistryRevision.ts
2145
+ var revisionAtom = new Atom(0);
2146
+ function bumpGsapStudioRegistryRevision() {
2147
+ revisionAtom.set(revisionAtom.get() + 1);
2148
+ }
2149
+ var gsapStudioRegistryRevisionPointer = revisionAtom.pointer;
2150
+
2151
+ // ../../theatre/shared/src/gsap/gsapAnimationRegistry.ts
2152
+ var DEFAULT_SHEET_INSTANCE_ID = "default";
2153
+ var REGISTRY_KEY = "__unseenco_theatre_gsap_animationRegistry__";
2154
+ function sheetObjectAddressKeyFromParts(address) {
2155
+ const sheetInstanceId = address.sheetInstanceId ?? DEFAULT_SHEET_INSTANCE_ID;
2156
+ return `${address.projectId}|${address.sheetId}|${sheetInstanceId}|${address.objectKey}`;
2157
+ }
2158
+ function sheetObjectAddressKey(sheetObject) {
2159
+ return sheetObjectAddressKeyFromParts(sheetObject.address);
2160
+ }
2161
+ function getStore2() {
2162
+ const g = globalThis;
2163
+ if (!g[REGISTRY_KEY]) {
2164
+ g[REGISTRY_KEY] = {
2165
+ bySheetAddress: /* @__PURE__ */ new Map()
2166
+ };
2167
+ }
2168
+ return g[REGISTRY_KEY];
2169
+ }
2170
+ function getSheetEntryMap(sheetKey) {
2171
+ const store = getStore2();
2172
+ let map = store.bySheetAddress.get(sheetKey);
2173
+ if (!map) {
2174
+ map = /* @__PURE__ */ new Map();
2175
+ store.bySheetAddress.set(sheetKey, map);
2176
+ }
2177
+ return map;
2178
+ }
2179
+ function registerAnimationInRegistry(entry) {
2180
+ const kind = entry.animation && isGsapTimeline(entry.animation) ? "timeline" : "tween";
2181
+ const timelineChildById = kind === "timeline" && entry.animation ? linkGsapTimelineChildAnimations(entry.animation) : void 0;
2182
+ const defaultDuration = entry.defaultDuration ?? readGsapTweenTimelineDuration(entry.animation);
2183
+ const timelineChildren = kind === "timeline" && entry.animation ? introspectGsapTimelineChildren(entry.animation) : [];
2184
+ const originalTiming = entry.originalTiming ?? (entry.animation ? buildGsapClipBaselineTiming({
2185
+ duration: defaultDuration,
2186
+ ...timelineChildren.length > 0 ? {
2187
+ timelineSpan: readGsapTweenTimelineDuration(entry.animation),
2188
+ timelineChildren
2189
+ } : {}
2190
+ }) : void 0);
2191
+ const normalized = {
2192
+ ...entry,
2193
+ kind,
2194
+ timelineChildById,
2195
+ originalTiming
2196
+ };
2197
+ if (entry.sheetObject) {
2198
+ const sheetKey = sheetObjectAddressKey(entry.sheetObject);
2199
+ getSheetEntryMap(sheetKey).set(entry.id, normalized);
2200
+ registerGsapObjectBinding(entry.sheetObject, {
2201
+ gsapAnimationId: entry.id,
2202
+ defaultDuration
2203
+ });
2204
+ }
2205
+ bumpGsapStudioRegistryRevision();
2206
+ }
2207
+ function getAnimationEntryForAddress(address, animationId) {
2208
+ const animId = animationId ?? address.objectKey;
2209
+ const sheetKey = sheetObjectAddressKeyFromParts(address);
2210
+ return getStore2().bySheetAddress.get(sheetKey)?.get(animId);
2211
+ }
2212
+ function getAnimationEntry(sheetObject, animationId) {
2213
+ return getAnimationEntryForAddress(
2214
+ sheetObject.address,
2215
+ animationId ?? sheetObject.address.objectKey
2216
+ );
2217
+ }
2218
+ function getAnimationEntryForSheetObject(sheetObject) {
2219
+ return getAnimationEntry(sheetObject);
2220
+ }
2221
+ function listAnimationEntries() {
2222
+ const entries = [];
2223
+ for (const byAnim of getStore2().bySheetAddress.values()) {
2224
+ entries.push(...byAnim.values());
2225
+ }
2226
+ return entries;
2227
+ }
38
2228
 
39
2229
  // src/config.ts
40
- var import_gsapSheetObjectKey = require("@unseenco/theatre-shared/gsap/gsapSheetObjectKey");
41
2230
  var activeConfig = {
42
2231
  namespace: "GSAP",
43
2232
  outlineNamespace: { defaultCollapsed: false }
44
2233
  };
45
- (0, import_gsapSheetObjectKey.setConfiguredGsapSheetObjectNamespace)(activeConfig.namespace);
2234
+ setConfiguredGsapSheetObjectNamespace(activeConfig.namespace);
46
2235
  function configureTheatreGsap(config) {
47
2236
  const prev = activeConfig;
48
2237
  activeConfig = {
49
2238
  namespace: config.namespace ?? prev.namespace ?? "GSAP",
50
2239
  outlineNamespace: config.outlineNamespace ?? prev.outlineNamespace
51
2240
  };
52
- (0, import_gsapSheetObjectKey.setConfiguredGsapSheetObjectNamespace)(activeConfig.namespace ?? "GSAP");
2241
+ setConfiguredGsapSheetObjectNamespace(activeConfig.namespace ?? "GSAP");
53
2242
  return {
54
2243
  reset() {
55
2244
  activeConfig = prev;
@@ -61,10 +2250,8 @@ function getTheatreGsapConfig() {
61
2250
  }
62
2251
 
63
2252
  // src/animationRegistry.ts
64
- var import_gsapAnimationRegistry = require("@unseenco/theatre-shared/gsap/gsapAnimationRegistry");
65
- var import_syncGsapClipProgress = require("@unseenco/theatre-shared/gsap/syncGsapClipProgress");
66
- function registerAnimationInRegistry(entry) {
67
- (0, import_gsapAnimationRegistry.registerAnimationInRegistry)({
2253
+ function registerAnimationInRegistry2(entry) {
2254
+ registerAnimationInRegistry({
68
2255
  ...entry,
69
2256
  animation: entry.animation,
70
2257
  defaultDuration: entry.defaultDuration ?? defaultClipDuration(entry.animation),
@@ -72,7 +2259,7 @@ function registerAnimationInRegistry(entry) {
72
2259
  });
73
2260
  }
74
2261
  function defaultClipDuration(animation) {
75
- return (0, import_syncGsapClipProgress.readGsapTweenTimelineDuration)(animation);
2262
+ return readGsapTweenTimelineDuration(animation);
76
2263
  }
77
2264
  function toPackageEntry(entry) {
78
2265
  if (!entry || !entry.animation)
@@ -86,19 +2273,19 @@ function toPackageEntry(entry) {
86
2273
  onRebuildTimeline: entry.onRebuildTimeline
87
2274
  };
88
2275
  }
89
- function getAnimationEntry(sheetObject, animationId) {
90
- return toPackageEntry((0, import_gsapAnimationRegistry.getAnimationEntry)(sheetObject, animationId));
2276
+ function getAnimationEntry2(sheetObject, animationId) {
2277
+ return toPackageEntry(getAnimationEntry(sheetObject, animationId));
91
2278
  }
92
2279
  function getAnimationEntryById(id) {
93
2280
  return toPackageEntry(
94
- (0, import_gsapAnimationRegistry.listAnimationEntries)().find((entry) => entry.id === id)
2281
+ listAnimationEntries().find((entry) => entry.id === id)
95
2282
  );
96
2283
  }
97
- function getAnimationEntryForSheetObject(sheetObject) {
98
- return toPackageEntry((0, import_gsapAnimationRegistry.getAnimationEntryForSheetObject)(sheetObject));
2284
+ function getAnimationEntryForSheetObject2(sheetObject) {
2285
+ return toPackageEntry(getAnimationEntryForSheetObject(sheetObject));
99
2286
  }
100
- function listAnimationEntries() {
101
- return (0, import_gsapAnimationRegistry.listAnimationEntries)().filter((e) => !!e.animation).map((entry) => ({
2287
+ function listAnimationEntries2() {
2288
+ return listAnimationEntries().filter((e) => !!e.animation).map((entry) => ({
102
2289
  id: entry.id,
103
2290
  label: entry.label,
104
2291
  animation: entry.animation,
@@ -106,24 +2293,28 @@ function listAnimationEntries() {
106
2293
  }));
107
2294
  }
108
2295
 
2296
+ // ../../theatre/shared/src/utils/outlineNamespaces.ts
2297
+ function formatOutlineNamespacePathKey(pathSegments) {
2298
+ return pathSegments.join(" / ");
2299
+ }
2300
+
109
2301
  // src/registerGsapAnimation.ts
110
- var import_outlineNamespaces = require("@unseenco/theatre-shared/utils/outlineNamespaces");
111
2302
  function registerGsapAnimation(animation, sheet, options) {
112
2303
  const config = getTheatreGsapConfig();
113
2304
  const namespace = options.namespace ?? config.namespace ?? "GSAP";
114
- const objectKey = (0, import_buildGsapSheetObjectKey.buildGsapSheetObjectKey)(namespace, options.label);
2305
+ const objectKey = buildGsapSheetObjectKey(namespace, options.label);
115
2306
  const id = options.id ?? objectKey;
116
2307
  animation.pause();
117
2308
  const sheetObjectPublic = sheet.object(objectKey, {}, { reconfigure: false });
118
2309
  const sheetObjectInternal = (0, import_privateAPIs.privateAPI)(sheetObjectPublic);
119
- const existing = (0, import_gsapAnimationRegistry2.getAnimationEntry)(sheetObjectInternal, id);
2310
+ const existing = getAnimationEntry(sheetObjectInternal, id);
120
2311
  if (config.outlineNamespace && !existing) {
121
2312
  (0, import_privateAPIs.privateAPI)(sheet).template.setOutlineNamespaceConfig(
122
- (0, import_outlineNamespaces.formatOutlineNamespacePathKey)([namespace]),
2313
+ formatOutlineNamespacePathKey([namespace]),
123
2314
  config.outlineNamespace
124
2315
  );
125
2316
  }
126
- registerAnimationInRegistry({
2317
+ registerAnimationInRegistry2({
127
2318
  id,
128
2319
  label: options.label,
129
2320
  animation,
@@ -135,27 +2326,5 @@ function registerGsapAnimation(animation, sheet, options) {
135
2326
  }
136
2327
 
137
2328
  // src/attachGsapSequenceBridge.ts
138
- var import_privateAPIs2 = require("@unseenco/theatre-core/privateAPIs");
139
- var import_gsapAnimationRegistry3 = require("@unseenco/theatre-shared/gsap/gsapAnimationRegistry");
140
- var import_subscribeGsapClipSyncAtPlayhead = require("@unseenco/theatre-shared/gsap/subscribeGsapClipSyncAtPlayhead");
141
- function attachGsapSequenceBridge(sheet) {
142
- const sequence = sheet.sequence;
143
- const sheetAddress = (0, import_privateAPIs2.privateAPI)(sheet).address;
144
- return (0, import_subscribeGsapClipSyncAtPlayhead.subscribeGsapClipSyncAtPlayhead)({
145
- pointer: sequence.pointer,
146
- getGsapClipTimings: () => sequence.__experimental_getGsapClips().map(({ objectKey, clip }) => ({
147
- sheetObjectAddressKey: (0, import_gsapAnimationRegistry3.sheetObjectAddressKeyFromParts)({
148
- projectId: sheetAddress.projectId,
149
- sheetId: sheetAddress.sheetId,
150
- sheetInstanceId: sheetAddress.sheetInstanceId,
151
- objectKey
152
- }),
153
- gsapAnimationId: clip.gsapAnimationId,
154
- start: clip.start,
155
- duration: clip.duration,
156
- timelineChildren: clip.timelineChildren,
157
- timelineSpan: clip.timelineSpan
158
- }))
159
- });
160
- }
2329
+ var import_theatre_core = require("@unseenco/theatre-core");
161
2330
  //# sourceMappingURL=index.js.map