@unseenco/theatre-gsap 0.4.0 → 0.4.2

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