@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.js +2410 -29
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +2403 -28
- package/dist/index.mjs.map +4 -4
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/registerGsapAnimation.ts", "../src/config.ts", "../src/animationRegistry.ts", "../src/attachGsapSequenceBridge.ts"],
|
|
4
|
-
"sourcesContent": ["export {registerGsapAnimation} from './registerGsapAnimation'\r\nexport type {\r\n RegisterGsapAnimationOptions,\r\n RegisterGsapAnimationResult,\r\n} from './registerGsapAnimation'\r\nexport {attachGsapSequenceBridge} from './attachGsapSequenceBridge'\r\nexport {configureTheatreGsap, getTheatreGsapConfig} from './config'\r\nexport type {TheatreGsapConfig} from './config'\r\nexport {\r\n getAnimationEntry,\r\n getAnimationEntryById,\r\n getAnimationEntryForSheetObject,\r\n listAnimationEntries,\r\n} from './animationRegistry'\r\nexport type {GsapAnimationRegistryEntry} from './animationRegistry'\r\n", "import type {ISheet, ISheetObject} from '@unseenco/theatre-core'\r\nimport type {GsapTweenLike} from './gsapTypes'\r\nimport {privateAPI} from '@unseenco/theatre-core/privateAPIs'\r\nimport {buildGsapSheetObjectKey} from '@unseenco/theatre-shared/gsap/buildGsapSheetObjectKey'\r\nimport {getAnimationEntry} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport {getTheatreGsapConfig} from './config'\r\nimport {registerAnimationInRegistry} from './animationRegistry'\r\nimport {formatOutlineNamespacePathKey} from '@unseenco/theatre-shared/utils/outlineNamespaces'\r\n\r\nexport type RegisterGsapAnimationOptions = {\r\n /** Theatre object label (shown after the `GSAP/` namespace). */\r\n label: string\r\n /** Override namespace from {@link configureTheatreGsap}. */\r\n namespace?: string\r\n /**\r\n * Stable id for this animation on the sheet object. When omitted, defaults to\r\n * the sanitised sheet object key (e.g. `GSAP / Panel show`).\r\n * Re-registering with the same id updates the registry entry in place.\r\n */\r\n id?: string\r\n /** Clip length when adding to the sequence (defaults to tween duration). */\r\n defaultDuration?: number\r\n /** Rebuild the timeline when native child timing edits fail. */\r\n onRebuildTimeline?: () => GsapTweenLike\r\n}\r\n\r\nexport type RegisterGsapAnimationResult = {\r\n id: string\r\n sheetObject: ISheetObject<{}>\r\n}\r\n\r\n/**\r\n * Registers a GSAP tween for Theatre sequence bridging and creates an outline\r\n * proxy object under `GSAP/<label>` (namespace configurable).\r\n *\r\n * The animation is paused immediately so Theatre can drive progress.\r\n */\r\nexport function registerGsapAnimation(\r\n animation: GsapTweenLike,\r\n sheet: ISheet,\r\n options: RegisterGsapAnimationOptions,\r\n): RegisterGsapAnimationResult {\r\n const config = getTheatreGsapConfig()\r\n const namespace = options.namespace ?? config.namespace ?? 'GSAP'\r\n const objectKey = buildGsapSheetObjectKey(namespace, options.label)\r\n const id = options.id ?? objectKey\r\n\r\n animation.pause()\r\n\r\n const sheetObjectPublic = sheet.object(objectKey, {}, {reconfigure: false})\r\n const sheetObjectInternal = privateAPI(sheetObjectPublic)\r\n\r\n const existing = getAnimationEntry(sheetObjectInternal, id)\r\n\r\n if (config.outlineNamespace && !existing) {\r\n privateAPI(sheet).template.setOutlineNamespaceConfig(\r\n formatOutlineNamespacePathKey([namespace]),\r\n config.outlineNamespace,\r\n )\r\n }\r\n\r\n registerAnimationInRegistry({\r\n id,\r\n label: options.label,\r\n animation,\r\n sheetObject: sheetObjectInternal,\r\n defaultDuration: options.defaultDuration,\r\n onRebuildTimeline: options.onRebuildTimeline,\r\n })\r\n\r\n return {id, sheetObject: sheetObjectPublic}\r\n}\r\n", "import type {OutlineNamespaceConfig} from '@unseenco/theatre-shared/utils/outlineNamespaces'\r\nimport {setConfiguredGsapSheetObjectNamespace} from '@unseenco/theatre-shared/gsap/gsapSheetObjectKey'\r\n\r\nexport type TheatreGsapConfig = {\r\n /** Outline namespace segment for GSAP proxy objects (default `GSAP`). */\r\n namespace?: string\r\n /** Applied to each sheet when the first GSAP object is registered on it. */\r\n outlineNamespace?: OutlineNamespaceConfig\r\n}\r\n\r\nlet activeConfig: TheatreGsapConfig = {\r\n namespace: 'GSAP',\r\n outlineNamespace: {defaultCollapsed: false},\r\n}\r\n\r\nsetConfiguredGsapSheetObjectNamespace(activeConfig.namespace!)\r\n\r\nexport function configureTheatreGsap(config: TheatreGsapConfig): {\r\n reset: () => void\r\n} {\r\n const prev = activeConfig\r\n activeConfig = {\r\n namespace: config.namespace ?? prev.namespace ?? 'GSAP',\r\n outlineNamespace: config.outlineNamespace ?? prev.outlineNamespace,\r\n }\r\n setConfiguredGsapSheetObjectNamespace(activeConfig.namespace ?? 'GSAP')\r\n return {\r\n reset() {\r\n activeConfig = prev\r\n },\r\n }\r\n}\r\n\r\nexport function getTheatreGsapConfig(): TheatreGsapConfig {\r\n return activeConfig\r\n}\r\n", "import type SheetObject from '@unseenco/theatre-core/sheetObjects/SheetObject'\r\nimport type {GsapTweenLike} from './gsapTypes'\r\nimport {\r\n clearAnimationRegistryForTests as clearSharedAnimationRegistryForTests,\r\n getAnimationEntry as getSharedAnimationEntry,\r\n getAnimationEntryForSheetObject as getSharedAnimationEntryForSheetObject,\r\n listAnimationEntries as listSharedAnimationEntries,\r\n registerAnimationInRegistry as registerSharedAnimationInRegistry,\r\n} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport {readGsapTweenTimelineDuration} from '@unseenco/theatre-shared/gsap/syncGsapClipProgress'\r\n\r\nexport type GsapAnimationRegistryEntry = {\r\n id: string\r\n label: string\r\n animation: GsapTweenLike\r\n sheetObject?: SheetObject\r\n defaultDuration?: number\r\n onRebuildTimeline?: () => GsapTweenLike\r\n}\r\n\r\nexport function registerAnimationInRegistry(\r\n entry: GsapAnimationRegistryEntry,\r\n): void {\r\n registerSharedAnimationInRegistry({\r\n ...entry,\r\n animation: entry.animation,\r\n defaultDuration:\r\n entry.defaultDuration ??\r\n defaultClipDuration(entry.animation as GsapTweenLike),\r\n onRebuildTimeline: entry.onRebuildTimeline,\r\n })\r\n}\r\n\r\nfunction defaultClipDuration(animation: GsapTweenLike): number {\r\n return readGsapTweenTimelineDuration(animation)\r\n}\r\n\r\nfunction toPackageEntry(\r\n entry: ReturnType<typeof getSharedAnimationEntryForSheetObject>,\r\n): GsapAnimationRegistryEntry | undefined {\r\n if (!entry || !entry.animation) return undefined\r\n return {\r\n id: entry.id,\r\n label: entry.label,\r\n animation: entry.animation as GsapTweenLike,\r\n sheetObject: entry.sheetObject,\r\n defaultDuration: entry.defaultDuration,\r\n onRebuildTimeline: entry.onRebuildTimeline as\r\n | (() => GsapTweenLike)\r\n | undefined,\r\n }\r\n}\r\n\r\nexport function getAnimationEntry(\r\n sheetObject: SheetObject,\r\n animationId?: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(getSharedAnimationEntry(sheetObject, animationId))\r\n}\r\n\r\nexport function getAnimationEntryById(\r\n id: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(\r\n listSharedAnimationEntries().find((entry) => entry.id === id),\r\n )\r\n}\r\n\r\nexport function getAnimationEntryForSheetObject(\r\n sheetObject: SheetObject,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(getSharedAnimationEntryForSheetObject(sheetObject))\r\n}\r\n\r\nexport function listAnimationEntries(): GsapAnimationRegistryEntry[] {\r\n return listSharedAnimationEntries()\r\n .filter((e): e is typeof e & {animation: GsapTweenLike} => !!e.animation)\r\n .map((entry) => ({\r\n id: entry.id,\r\n label: entry.label,\r\n animation: entry.animation as GsapTweenLike,\r\n sheetObject: entry.sheetObject,\r\n }))\r\n}\r\n\r\nexport function clearAnimationRegistryForTests(): void {\r\n clearSharedAnimationRegistryForTests()\r\n}\r\n", "import type {ISheet} from '@unseenco/theatre-core'\r\nimport {privateAPI} from '@unseenco/theatre-core/privateAPIs'\r\nimport {sheetObjectAddressKeyFromParts} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport type {ObjectAddressKey} from '@unseenco/theatre-shared/utils/ids'\r\nimport {subscribeGsapClipSyncAtPlayhead} from '@unseenco/theatre-shared/gsap/subscribeGsapClipSyncAtPlayhead'\r\n\r\n/**\r\n * Drives registered GSAP animations from the sheet sequence playhead.\r\n *\r\n * @returns Disposer \u2014 call to detach the bridge.\r\n */\r\nexport function attachGsapSequenceBridge(sheet: ISheet): () => void {\r\n const sequence = sheet.sequence\r\n const sheetAddress = privateAPI(sheet).address\r\n\r\n return subscribeGsapClipSyncAtPlayhead({\r\n pointer: sequence.pointer,\r\n getGsapClipTimings: () =>\r\n sequence.__experimental_getGsapClips().map(({objectKey, clip}) => ({\r\n sheetObjectAddressKey: sheetObjectAddressKeyFromParts({\r\n projectId: sheetAddress.projectId,\r\n sheetId: sheetAddress.sheetId,\r\n sheetInstanceId: sheetAddress.sheetInstanceId,\r\n objectKey: objectKey as ObjectAddressKey,\r\n }),\r\n gsapAnimationId: clip.gsapAnimationId,\r\n start: clip.start,\r\n duration: clip.duration,\r\n timelineChildren: clip.timelineChildren,\r\n timelineSpan: clip.timelineSpan,\r\n })),\r\n })\r\n}\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,yBAAyB;AACzB,qCAAsC;AACtC,IAAAA,gCAAgC;;;ACHhC,gCAAoD;AASpD,IAAI,eAAkC;AAAA,EACpC,WAAW;AAAA,EACX,kBAAkB,EAAC,kBAAkB,MAAK;AAC5C;AAAA,IAEA,iEAAsC,aAAa,SAAU;AAEtD,SAAS,qBAAqB,QAEnC;AACA,QAAM,OAAO;AACb,iBAAe;AAAA,IACb,WAAW,OAAO,aAAa,KAAK,aAAa;AAAA,IAC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ACf,kBAAkB,KAAK;AAAA,MACvB,cAAc,KAAK;AAAA,IACrB,EAAE;AAAA,EACN,CAAC;AACH;",
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../src/index.ts", "../src/registerGsapAnimation.ts", "../../../theatre/shared/src/utils/errors.ts", "../../../theatre/shared/src/_logger/logger.ts", "../../../theatre/shared/src/logger.ts", "../../../theatre/shared/src/globalVariableNames.ts", "../../../theatre/shared/src/notify.ts", "../../../theatre/shared/src/utils/slashedPaths.ts", "../../../theatre/shared/src/gsap/buildGsapSheetObjectKey.ts", "../../../theatre/shared/src/gsap/introspectGsapTimelineChildren.ts", "../../../theatre/shared/src/gsap/gsapSheetObjectKey.ts", "../../../theatre/shared/src/sequence/trackData.ts", "../../../theatre/shared/src/gsap/applyTimelineChildTiming.ts", "../../../theatre/shared/src/gsap/syncGsapClipProgress.ts", "../../../theatre/shared/src/gsap/gsapClipBaseline.ts", "../../../theatre/shared/src/gsap/gsapObjectBinding.ts", "../../../node_modules/lodash-es/isArray.js", "../../../node_modules/lodash-es/_freeGlobal.js", "../../../node_modules/lodash-es/_root.js", "../../../node_modules/lodash-es/_Symbol.js", "../../../node_modules/lodash-es/_getRawTag.js", "../../../node_modules/lodash-es/_objectToString.js", "../../../node_modules/lodash-es/_baseGetTag.js", "../../../node_modules/lodash-es/isObjectLike.js", "../../../node_modules/lodash-es/isSymbol.js", "../../../node_modules/lodash-es/_isKey.js", "../../../node_modules/lodash-es/isObject.js", "../../../node_modules/lodash-es/isFunction.js", "../../../node_modules/lodash-es/_coreJsData.js", "../../../node_modules/lodash-es/_isMasked.js", "../../../node_modules/lodash-es/_toSource.js", "../../../node_modules/lodash-es/_baseIsNative.js", "../../../node_modules/lodash-es/_getValue.js", "../../../node_modules/lodash-es/_getNative.js", "../../../node_modules/lodash-es/_nativeCreate.js", "../../../node_modules/lodash-es/_hashClear.js", "../../../node_modules/lodash-es/_hashDelete.js", "../../../node_modules/lodash-es/_hashGet.js", "../../../node_modules/lodash-es/_hashHas.js", "../../../node_modules/lodash-es/_hashSet.js", "../../../node_modules/lodash-es/_Hash.js", "../../../node_modules/lodash-es/_listCacheClear.js", "../../../node_modules/lodash-es/eq.js", "../../../node_modules/lodash-es/_assocIndexOf.js", "../../../node_modules/lodash-es/_listCacheDelete.js", "../../../node_modules/lodash-es/_listCacheGet.js", "../../../node_modules/lodash-es/_listCacheHas.js", "../../../node_modules/lodash-es/_listCacheSet.js", "../../../node_modules/lodash-es/_ListCache.js", "../../../node_modules/lodash-es/_Map.js", "../../../node_modules/lodash-es/_mapCacheClear.js", "../../../node_modules/lodash-es/_isKeyable.js", "../../../node_modules/lodash-es/_getMapData.js", "../../../node_modules/lodash-es/_mapCacheDelete.js", "../../../node_modules/lodash-es/_mapCacheGet.js", "../../../node_modules/lodash-es/_mapCacheHas.js", "../../../node_modules/lodash-es/_mapCacheSet.js", "../../../node_modules/lodash-es/_MapCache.js", "../../../node_modules/lodash-es/memoize.js", "../../../node_modules/lodash-es/_memoizeCapped.js", "../../../node_modules/lodash-es/_stringToPath.js", "../../../node_modules/lodash-es/_arrayMap.js", "../../../node_modules/lodash-es/_baseToString.js", "../../../node_modules/lodash-es/toString.js", "../../../node_modules/lodash-es/_castPath.js", "../../../node_modules/lodash-es/_toKey.js", "../../../node_modules/lodash-es/_baseGet.js", "../../../node_modules/lodash-es/get.js", "../../../node_modules/lodash-es/_overArg.js", "../../../node_modules/lodash-es/_getPrototype.js", "../../../node_modules/lodash-es/isPlainObject.js", "../../../node_modules/lodash-es/last.js", "../../dataverse/src/pointer.ts", "../../dataverse/src/utils/updateDeep.ts", "../../dataverse/src/utils/Stack.ts", "../../dataverse/src/prism/Interface.ts", "../../dataverse/src/prism/discoveryMechanism.ts", "../../dataverse/src/prism/prism.ts", "../../dataverse/src/Atom.ts", "../../dataverse/src/pointerToPrism.ts", "../../dataverse/src/val.ts", "../../../theatre/shared/src/gsap/gsapStudioRegistryRevision.ts", "../../../theatre/shared/src/gsap/gsapAnimationRegistry.ts", "../src/config.ts", "../src/animationRegistry.ts", "../../../theatre/shared/src/utils/outlineNamespaces.ts", "../src/attachGsapSequenceBridge.ts", "../../../theatre/shared/src/gsap/syncGsapClipsAtSequencePosition.ts", "../../../theatre/shared/src/gsap/subscribeGsapClipSyncAtPlayhead.ts"],
|
|
4
|
+
"sourcesContent": ["export {registerGsapAnimation} from './registerGsapAnimation'\r\nexport type {\r\n RegisterGsapAnimationOptions,\r\n RegisterGsapAnimationResult,\r\n} from './registerGsapAnimation'\r\nexport {attachGsapSequenceBridge} from './attachGsapSequenceBridge'\r\nexport {configureTheatreGsap, getTheatreGsapConfig} from './config'\r\nexport type {TheatreGsapConfig} from './config'\r\nexport {\r\n getAnimationEntry,\r\n getAnimationEntryById,\r\n getAnimationEntryForSheetObject,\r\n listAnimationEntries,\r\n} from './animationRegistry'\r\nexport type {GsapAnimationRegistryEntry} from './animationRegistry'\r\n", "import type {ISheet, ISheetObject} from '@unseenco/theatre-core'\r\nimport type {GsapTweenLike} from './gsapTypes'\r\nimport {privateAPI} from '@unseenco/theatre-core/privateAPIs'\r\nimport {buildGsapSheetObjectKey} from '@unseenco/theatre-shared/gsap/buildGsapSheetObjectKey'\r\nimport {getAnimationEntry} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport {getTheatreGsapConfig} from './config'\r\nimport {registerAnimationInRegistry} from './animationRegistry'\r\nimport {formatOutlineNamespacePathKey} from '@unseenco/theatre-shared/utils/outlineNamespaces'\r\n\r\nexport type RegisterGsapAnimationOptions = {\r\n /** Theatre object label (shown after the `GSAP/` namespace). */\r\n label: string\r\n /** Override namespace from {@link configureTheatreGsap}. */\r\n namespace?: string\r\n /**\r\n * Stable id for this animation on the sheet object. When omitted, defaults to\r\n * the sanitised sheet object key (e.g. `GSAP / Panel show`).\r\n * Re-registering with the same id updates the registry entry in place.\r\n */\r\n id?: string\r\n /** Clip length when adding to the sequence (defaults to tween duration). */\r\n defaultDuration?: number\r\n /** Rebuild the timeline when native child timing edits fail. */\r\n onRebuildTimeline?: () => GsapTweenLike\r\n}\r\n\r\nexport type RegisterGsapAnimationResult = {\r\n id: string\r\n sheetObject: ISheetObject<{}>\r\n}\r\n\r\n/**\r\n * Registers a GSAP tween for Theatre sequence bridging and creates an outline\r\n * proxy object under `GSAP/<label>` (namespace configurable).\r\n *\r\n * The animation is paused immediately so Theatre can drive progress.\r\n */\r\nexport function registerGsapAnimation(\r\n animation: GsapTweenLike,\r\n sheet: ISheet,\r\n options: RegisterGsapAnimationOptions,\r\n): RegisterGsapAnimationResult {\r\n const config = getTheatreGsapConfig()\r\n const namespace = options.namespace ?? config.namespace ?? 'GSAP'\r\n const objectKey = buildGsapSheetObjectKey(namespace, options.label)\r\n const id = options.id ?? objectKey\r\n\r\n animation.pause()\r\n\r\n const sheetObjectPublic = sheet.object(objectKey, {}, {reconfigure: false})\r\n const sheetObjectInternal = privateAPI(sheetObjectPublic)\r\n\r\n const existing = getAnimationEntry(sheetObjectInternal, id)\r\n\r\n if (config.outlineNamespace && !existing) {\r\n privateAPI(sheet).template.setOutlineNamespaceConfig(\r\n formatOutlineNamespacePathKey([namespace]),\r\n config.outlineNamespace,\r\n )\r\n }\r\n\r\n registerAnimationInRegistry({\r\n id,\r\n label: options.label,\r\n animation,\r\n sheetObject: sheetObjectInternal,\r\n defaultDuration: options.defaultDuration,\r\n onRebuildTimeline: options.onRebuildTimeline,\r\n })\r\n\r\n return {id, sheetObject: sheetObjectPublic}\r\n}\r\n", "/**\r\n * All errors thrown to end-users should be an instance of this class.\r\n */\r\nexport class TheatreError extends Error {}\r\n\r\n/**\r\n * If an end-user provided an invalid argument to a public API, the error thrown\r\n * should be an instance of this class.\r\n */\r\nexport class InvalidArgumentError extends TheatreError {}\r\n", "/** @public configuration type */\r\nexport interface ITheatreLogger {\r\n error(level: ITheatreLogMeta, message: string, args?: Loggable): void\r\n warn(level: ITheatreLogMeta, message: string, args?: Loggable): void\r\n debug(level: ITheatreLogMeta, message: string, args?: Loggable): void\r\n trace(level: ITheatreLogMeta, message: string, args?: Loggable): void\r\n}\r\n\r\ntype ITheatreLogMeta = Readonly<{\r\n audience: 'public' | 'dev' | 'internal'\r\n category: 'general' | 'todo' | 'troubleshooting'\r\n level: TheatreLoggerLevel\r\n}>\r\n\r\n/** @public configuration type */\r\nexport interface ITheatreConsoleLogger {\r\n /** ERROR level logs */\r\n error(message: string, ...args: any[]): void\r\n /** WARN level logs */\r\n warn(message: string, ...args: any[]): void\r\n /** DEBUG level logs */\r\n info(message: string, ...args: any[]): void\r\n /** TRACE level logs */\r\n debug(message: string, ...args: any[]): void\r\n}\r\n\r\n/**\r\n * \"Downgraded\" {@link ILogger} for passing down to utility functions.\r\n *\r\n * A util logger is usually back by some specific {@link _Audience}.\r\n */\r\nexport interface IUtilLogger {\r\n /** Usually equivalent to `console.error`. */\r\n error(message: string, args?: object): void\r\n /** Usually equivalent to `console.warn`. */\r\n warn(message: string, args?: object): void\r\n /** Usually equivalent to `console.info`. */\r\n debug(message: string, args?: object): void\r\n /** Usually equivalent to `console.debug`. */\r\n trace(message: string, args?: object): void\r\n named(name: string, key?: string): IUtilLogger\r\n}\r\n\r\ntype Loggable = Record<string, any>\r\ntype LogFn = (message: string, args?: Loggable) => void\r\n/**\r\n * Allow for the arguments to only be computed if the level is included.\r\n * If the level is not included, then the fn will still be passed to the filtered\r\n * function.\r\n */\r\ntype LazyLogFn = (message: string, args: () => Loggable) => void\r\n\r\nfunction lazy(f: LogFn): LazyLogFn {\r\n return function lazyLogIncluded(m, lazyArg) {\r\n return f(m, lazyArg())\r\n }\r\n}\r\n\r\nexport type _LogFns = Readonly<\r\n {\r\n [P in keyof typeof LEVELS]: LogFn\r\n }\r\n>\r\n\r\nexport type _LazyLogFns = Readonly<\r\n {\r\n [P in keyof typeof LEVELS]: LazyLogFn\r\n }\r\n>\r\n\r\n/** Internal library logger\r\n * TODO document these fns\r\n */\r\nexport interface ILogger extends _LogFns {\r\n named(name: string, key?: string | number): ILogger\r\n lazy: _LazyLogFns\r\n readonly utilFor: {\r\n internal(): IUtilLogger\r\n dev(): IUtilLogger\r\n public(): IUtilLogger\r\n }\r\n}\r\n\r\nexport type ITheatreLoggerConfig =\r\n | /** default {@link console} */\r\n 'console'\r\n | {\r\n type: 'console'\r\n /** default `true` */\r\n style?: boolean\r\n /** default {@link console} */\r\n console?: ITheatreConsoleLogger\r\n }\r\n | {\r\n type: 'named'\r\n named(names: string[]): ITheatreLogger\r\n }\r\n | {\r\n type: 'keyed'\r\n keyed(\r\n nameAndKeys: {\r\n name: string\r\n key?: string | number\r\n }[],\r\n ): ITheatreLogger\r\n }\r\n\r\nexport type ITheatreLogSource = {names: {name: string; key?: number | string}[]}\r\n\r\nexport type ITheatreLogIncludes = {\r\n /**\r\n * General information max level.\r\n * e.g. `Project imported might be corrupted`\r\n */\r\n min?: TheatreLoggerLevel\r\n /**\r\n * Include logs meant for developers using Theatre.js\r\n * e.g. `Created new project 'Abc' with options {...}`\r\n *\r\n * defaults to `true` if `internal: true` or defaults to `false`.\r\n */\r\n dev?: boolean\r\n /**\r\n * Include logs meant for internal development of Theatre.js\r\n * e.g. `Migrated project 'Abc' { duration_ms: 34, from_version: 1, to_version: 3, imported_settings: false }`\r\n *\r\n * defaults to `false`\r\n */\r\n internal?: boolean\r\n}\r\n\r\nexport type ITheatreLoggingConfig = ITheatreLogIncludes & {\r\n include?: (source: ITheatreLogSource) => ITheatreLogIncludes\r\n consoleStyle?: boolean\r\n}\r\n\r\n/** @internal */\r\nenum _Category {\r\n GENERAL = 1 << 0,\r\n TODO = 1 << 1,\r\n TROUBLESHOOTING = 1 << 2,\r\n}\r\n\r\n/** @internal */\r\nenum _Audience {\r\n /** Logs for developers of Theatre.js */\r\n INTERNAL = 1 << 3,\r\n /** Logs for developers using Theatre.js */\r\n DEV = 1 << 4,\r\n /** Logs for users of the app using Theatre.js */\r\n PUBLIC = 1 << 5,\r\n}\r\n\r\nexport enum TheatreLoggerLevel {\r\n TRACE = 1 << 6,\r\n DEBUG = 1 << 7,\r\n WARN = 1 << 8,\r\n ERROR = 1 << 9,\r\n}\r\n\r\n/**\r\n * @internal Theatre.js internal \"dev\" levels are odd numbers\r\n *\r\n * You can check if a level is odd quickly by doing `level & 1 === 1`\r\n */\r\nexport enum _LoggerLevel {\r\n /** The highest logging level number. */\r\n ERROR_PUBLIC = TheatreLoggerLevel.ERROR |\r\n _Audience.PUBLIC |\r\n _Category.GENERAL,\r\n ERROR_DEV = TheatreLoggerLevel.ERROR | _Audience.DEV | _Category.GENERAL,\r\n /** @internal this was an unexpected event */\r\n _HMM = TheatreLoggerLevel.ERROR |\r\n _Audience.INTERNAL |\r\n _Category.TROUBLESHOOTING,\r\n _TODO = TheatreLoggerLevel.ERROR | _Audience.INTERNAL | _Category.TODO,\r\n _ERROR = TheatreLoggerLevel.ERROR | _Audience.INTERNAL | _Category.GENERAL,\r\n WARN_PUBLIC = TheatreLoggerLevel.WARN | _Audience.PUBLIC | _Category.GENERAL,\r\n WARN_DEV = TheatreLoggerLevel.WARN | _Audience.DEV | _Category.GENERAL,\r\n /** @internal surface this in this moment, but it probably shouldn't be left in the code after debugging. */\r\n _KAPOW = TheatreLoggerLevel.WARN |\r\n _Audience.INTERNAL |\r\n _Category.TROUBLESHOOTING,\r\n _WARN = TheatreLoggerLevel.WARN | _Audience.INTERNAL | _Category.GENERAL,\r\n DEBUG_DEV = TheatreLoggerLevel.DEBUG | _Audience.DEV | _Category.GENERAL,\r\n /** @internal debug logs for implementation details */\r\n _DEBUG = TheatreLoggerLevel.DEBUG | _Audience.INTERNAL | _Category.GENERAL,\r\n /** trace logs like when the project is saved */\r\n TRACE_DEV = TheatreLoggerLevel.TRACE | _Audience.DEV | _Category.GENERAL,\r\n /**\r\n * The lowest logging level number.\r\n * @internal trace logs for implementation details\r\n */\r\n _TRACE = TheatreLoggerLevel.TRACE | _Audience.INTERNAL | _Category.GENERAL,\r\n}\r\n\r\nconst LEVELS = {\r\n _hmm: getLogMeta(_LoggerLevel._HMM),\r\n _todo: getLogMeta(_LoggerLevel._TODO),\r\n _error: getLogMeta(_LoggerLevel._ERROR),\r\n errorDev: getLogMeta(_LoggerLevel.ERROR_DEV),\r\n errorPublic: getLogMeta(_LoggerLevel.ERROR_PUBLIC),\r\n _kapow: getLogMeta(_LoggerLevel._KAPOW),\r\n _warn: getLogMeta(_LoggerLevel._WARN),\r\n warnDev: getLogMeta(_LoggerLevel.WARN_DEV),\r\n warnPublic: getLogMeta(_LoggerLevel.WARN_PUBLIC),\r\n _debug: getLogMeta(_LoggerLevel._DEBUG),\r\n debugDev: getLogMeta(_LoggerLevel.DEBUG_DEV),\r\n _trace: getLogMeta(_LoggerLevel._TRACE),\r\n traceDev: getLogMeta(_LoggerLevel.TRACE_DEV),\r\n}\r\n\r\nfunction getLogMeta(level: _LoggerLevel): ITheatreLogMeta {\r\n return Object.freeze({\r\n audience: hasFlag(level, _Audience.INTERNAL)\r\n ? 'internal'\r\n : hasFlag(level, _Audience.DEV)\r\n ? 'dev'\r\n : 'public',\r\n category: hasFlag(level, _Category.TROUBLESHOOTING)\r\n ? 'troubleshooting'\r\n : hasFlag(level, _Category.TODO)\r\n ? 'todo'\r\n : 'general',\r\n level:\r\n // I think this is equivalent... but I'm not using it until we have tests.\r\n // this code won't really impact performance much anyway, since it's just computed once\r\n // up front.\r\n // level &\r\n // (TheatreLoggerLevel.TRACE |\r\n // TheatreLoggerLevel.DEBUG |\r\n // TheatreLoggerLevel.WARN |\r\n // TheatreLoggerLevel.ERROR),\r\n hasFlag(level, TheatreLoggerLevel.ERROR)\r\n ? TheatreLoggerLevel.ERROR\r\n : hasFlag(level, TheatreLoggerLevel.WARN)\r\n ? TheatreLoggerLevel.WARN\r\n : hasFlag(level, TheatreLoggerLevel.DEBUG)\r\n ? TheatreLoggerLevel.DEBUG\r\n : // no other option\r\n TheatreLoggerLevel.TRACE,\r\n })\r\n}\r\n\r\n/**\r\n * This is a helper function to determine whether the logger level has a bit flag set.\r\n *\r\n * Flags are interesting, because they give us an opportunity to very easily set up filtering\r\n * based on category and level. This is not available from public api, yet, but it's a good\r\n * start.\r\n */\r\nfunction hasFlag(level: _LoggerLevel, flag: number): boolean {\r\n return (level & flag) === flag\r\n}\r\n\r\n/**\r\n * @internal\r\n *\r\n * You'd think max, means number \"max\", but since we use this system of bit flags,\r\n * we actually need to go the other way, with comparisons being math less than.\r\n *\r\n * NOTE: Keep this in the same file as {@link _Audience} to ensure basic compilers\r\n * can inline the enum values.\r\n */\r\nfunction shouldLog(\r\n includes: Required<ITheatreLogIncludes>,\r\n level: _LoggerLevel,\r\n) {\r\n return (\r\n ((level & _Audience.PUBLIC) === _Audience.PUBLIC\r\n ? true\r\n : (level & _Audience.DEV) === _Audience.DEV\r\n ? includes.dev\r\n : (level & _Audience.INTERNAL) === _Audience.INTERNAL\r\n ? includes.internal\r\n : false) && includes.min <= level\r\n )\r\n}\r\n\r\nexport {shouldLog as _loggerShouldLog}\r\n\r\ntype InternalLoggerStyleRef = {\r\n italic?: RegExp\r\n bold?: RegExp\r\n color?: (name: string) => string\r\n collapseOnRE: RegExp\r\n cssMemo: Map<string, string>\r\n css(this: InternalLoggerStyleRef, name: string): string\r\n collapsed(this: InternalLoggerStyleRef, name: string): string\r\n}\r\n\r\ntype InternalLoggerRef = {\r\n loggingConsoleStyle: boolean\r\n loggerConsoleStyle: boolean\r\n includes: Required<ITheatreLogIncludes>\r\n filtered: (\r\n this: ITheatreLogSource,\r\n level: _LoggerLevel,\r\n message: string,\r\n args?: Loggable | (() => Loggable),\r\n ) => void\r\n include: (obj: ITheatreLogSource) => ITheatreLogIncludes\r\n create: (obj: ITheatreLogSource) => ILogger\r\n creatExt: (obj: ITheatreLogSource) => ITheatreLogger\r\n style: InternalLoggerStyleRef\r\n named(\r\n this: InternalLoggerRef,\r\n parent: ITheatreLogSource,\r\n name: string,\r\n key?: number | string,\r\n ): ILogger\r\n}\r\n\r\nconst DEFAULTS: InternalLoggerRef = {\r\n loggingConsoleStyle: true,\r\n loggerConsoleStyle: true,\r\n includes: Object.freeze({\r\n internal: false,\r\n dev: false,\r\n min: TheatreLoggerLevel.WARN,\r\n }),\r\n filtered: function defaultFiltered() {},\r\n include: function defaultInclude() {\r\n return {}\r\n },\r\n create: null!,\r\n creatExt: null!,\r\n named(this: InternalLoggerRef, parent, name, key) {\r\n return this.create({\r\n names: [...parent.names, {name, key}],\r\n })\r\n },\r\n style: {\r\n bold: undefined, // /Service$/\r\n italic: undefined, // /Model$/\r\n cssMemo: new Map<string, string>([\r\n // handle empty names so we don't have to check for\r\n // name.length > 0 during this.css('')\r\n ['', ''],\r\n // bring a specific override\r\n // [\"Marker\", \"color:#aea9ff;font-size:0.75em;text-transform:uppercase\"]\r\n ]),\r\n collapseOnRE: /[a-z- ]+/g,\r\n color: undefined,\r\n // create collapsed name\r\n // insert collapsed name into cssMemo with original's style\r\n collapsed(this, name) {\r\n if (name.length < 5) return name\r\n const collapsed = name.replace(this.collapseOnRE, '')\r\n if (!this.cssMemo.has(collapsed)) {\r\n this.cssMemo.set(collapsed, this.css(name))\r\n }\r\n return collapsed\r\n },\r\n css(this, name): string {\r\n const found = this.cssMemo.get(name)\r\n if (found) return found\r\n let css = `color:${\r\n this.color?.(name) ??\r\n `hsl(${\r\n (name.charCodeAt(0) + name.charCodeAt(name.length - 1)) % 360\r\n }, 100%, 60%)`\r\n }`\r\n if (this.bold?.test(name)) {\r\n css += ';font-weight:600'\r\n }\r\n if (this.italic?.test(name)) {\r\n css += ';font-style:italic'\r\n }\r\n this.cssMemo.set(name, css)\r\n return css\r\n },\r\n },\r\n}\r\n\r\n/** @internal */\r\nexport type ITheatreInternalLogger = {\r\n configureLogger(config: ITheatreLoggerConfig): void\r\n configureLogging(config: ITheatreLoggingConfig): void\r\n getLogger(): ILogger\r\n}\r\n\r\nexport type ITheatreInternalLoggerOptions = {\r\n _error?: (message: string, args?: object) => void\r\n _debug?: (message: string, args?: object) => void\r\n}\r\n\r\nexport function createTheatreInternalLogger(\r\n useConsole: ITheatreConsoleLogger = console,\r\n // Not yet, used, but good pattern to have in case we want to log something\r\n // or report something interesting.\r\n _options: ITheatreInternalLoggerOptions = {},\r\n): ITheatreInternalLogger {\r\n const ref: InternalLoggerRef = {...DEFAULTS, includes: {...DEFAULTS.includes}}\r\n const createConsole = {\r\n styled: createConsoleLoggerStyled.bind(ref, useConsole),\r\n noStyle: createConsoleLoggerNoStyle.bind(ref, useConsole),\r\n }\r\n const createExtBound = createExtLogger.bind(ref)\r\n function getConCreate() {\r\n return ref.loggingConsoleStyle && ref.loggerConsoleStyle\r\n ? createConsole.styled\r\n : createConsole.noStyle\r\n }\r\n ref.create = getConCreate()\r\n\r\n return {\r\n configureLogger(config) {\r\n if (config === 'console') {\r\n ref.loggerConsoleStyle = DEFAULTS.loggerConsoleStyle\r\n ref.create = getConCreate()\r\n } else if (config.type === 'console') {\r\n ref.loggerConsoleStyle = config.style ?? DEFAULTS.loggerConsoleStyle\r\n ref.create = getConCreate()\r\n } else if (config.type === 'keyed') {\r\n ref.creatExt = (source) => config.keyed(source.names)\r\n ref.create = createExtBound\r\n } else if (config.type === 'named') {\r\n ref.creatExt = configNamedToKeyed.bind(null, config.named)\r\n ref.create = createExtBound\r\n }\r\n },\r\n configureLogging(config) {\r\n ref.includes.dev = config.dev ?? DEFAULTS.includes.dev\r\n ref.includes.internal = config.internal ?? DEFAULTS.includes.internal\r\n ref.includes.min = config.min ?? DEFAULTS.includes.min\r\n ref.include = config.include ?? DEFAULTS.include\r\n ref.loggingConsoleStyle =\r\n config.consoleStyle ?? DEFAULTS.loggingConsoleStyle\r\n ref.create = getConCreate()\r\n },\r\n getLogger() {\r\n return ref.create({names: []})\r\n },\r\n }\r\n}\r\n\r\n/** used by `configureLogger` for `'named'` */\r\nfunction configNamedToKeyed(\r\n namedFn: (names: string[]) => ITheatreLogger,\r\n source: ITheatreLogSource,\r\n): ITheatreLogger {\r\n const names: string[] = []\r\n for (let {name, key} of source.names) {\r\n names.push(key == null ? name : `${name} (${key})`)\r\n }\r\n return namedFn(names)\r\n}\r\n\r\nfunction createExtLogger(\r\n this: InternalLoggerRef,\r\n source: ITheatreLogSource,\r\n): ILogger {\r\n const includes = {...this.includes, ...this.include(source)}\r\n const f = this.filtered\r\n const named = this.named.bind(this, source)\r\n const ext = this.creatExt(source)\r\n\r\n const _HMM = shouldLog(includes, _LoggerLevel._HMM)\r\n const _TODO = shouldLog(includes, _LoggerLevel._TODO)\r\n const _ERROR = shouldLog(includes, _LoggerLevel._ERROR)\r\n const ERROR_DEV = shouldLog(includes, _LoggerLevel.ERROR_DEV)\r\n const ERROR_PUBLIC = shouldLog(includes, _LoggerLevel.ERROR_PUBLIC)\r\n const _WARN = shouldLog(includes, _LoggerLevel._WARN)\r\n const _KAPOW = shouldLog(includes, _LoggerLevel._KAPOW)\r\n const WARN_DEV = shouldLog(includes, _LoggerLevel.WARN_DEV)\r\n const WARN_PUBLIC = shouldLog(includes, _LoggerLevel.WARN_PUBLIC)\r\n const _DEBUG = shouldLog(includes, _LoggerLevel._DEBUG)\r\n const DEBUG_DEV = shouldLog(includes, _LoggerLevel.DEBUG_DEV)\r\n const _TRACE = shouldLog(includes, _LoggerLevel._TRACE)\r\n const TRACE_DEV = shouldLog(includes, _LoggerLevel.TRACE_DEV)\r\n const _hmm = _HMM\r\n ? ext.error.bind(ext, LEVELS._hmm)\r\n : f.bind(source, _LoggerLevel._HMM)\r\n const _todo = _TODO\r\n ? ext.error.bind(ext, LEVELS._todo)\r\n : f.bind(source, _LoggerLevel._TODO)\r\n const _error = _ERROR\r\n ? ext.error.bind(ext, LEVELS._error)\r\n : f.bind(source, _LoggerLevel._ERROR)\r\n const errorDev = ERROR_DEV\r\n ? ext.error.bind(ext, LEVELS.errorDev)\r\n : f.bind(source, _LoggerLevel.ERROR_DEV)\r\n const errorPublic = ERROR_PUBLIC\r\n ? ext.error.bind(ext, LEVELS.errorPublic)\r\n : f.bind(source, _LoggerLevel.ERROR_PUBLIC)\r\n const _kapow = _KAPOW\r\n ? ext.warn.bind(ext, LEVELS._kapow)\r\n : f.bind(source, _LoggerLevel._KAPOW)\r\n const _warn = _WARN\r\n ? ext.warn.bind(ext, LEVELS._warn)\r\n : f.bind(source, _LoggerLevel._WARN)\r\n const warnDev = WARN_DEV\r\n ? ext.warn.bind(ext, LEVELS.warnDev)\r\n : f.bind(source, _LoggerLevel.WARN_DEV)\r\n const warnPublic = WARN_PUBLIC\r\n ? ext.warn.bind(ext, LEVELS.warnPublic)\r\n : f.bind(source, _LoggerLevel.WARN_DEV)\r\n const _debug = _DEBUG\r\n ? ext.debug.bind(ext, LEVELS._debug)\r\n : f.bind(source, _LoggerLevel._DEBUG)\r\n const debugDev = DEBUG_DEV\r\n ? ext.debug.bind(ext, LEVELS.debugDev)\r\n : f.bind(source, _LoggerLevel.DEBUG_DEV)\r\n const _trace = _TRACE\r\n ? ext.trace.bind(ext, LEVELS._trace)\r\n : f.bind(source, _LoggerLevel._TRACE)\r\n const traceDev = TRACE_DEV\r\n ? ext.trace.bind(ext, LEVELS.traceDev)\r\n : f.bind(source, _LoggerLevel.TRACE_DEV)\r\n const logger: ILogger = {\r\n _hmm,\r\n _todo,\r\n _error,\r\n errorDev,\r\n errorPublic,\r\n _kapow,\r\n _warn,\r\n warnDev,\r\n warnPublic,\r\n _debug,\r\n debugDev,\r\n _trace,\r\n traceDev,\r\n lazy: {\r\n _hmm: _HMM ? lazy(_hmm) : _hmm,\r\n _todo: _TODO ? lazy(_todo) : _todo,\r\n _error: _ERROR ? lazy(_error) : _error,\r\n errorDev: ERROR_DEV ? lazy(errorDev) : errorDev,\r\n errorPublic: ERROR_PUBLIC ? lazy(errorPublic) : errorPublic,\r\n _kapow: _KAPOW ? lazy(_kapow) : _kapow,\r\n _warn: _WARN ? lazy(_warn) : _warn,\r\n warnDev: WARN_DEV ? lazy(warnDev) : warnDev,\r\n warnPublic: WARN_PUBLIC ? lazy(warnPublic) : warnPublic,\r\n _debug: _DEBUG ? lazy(_debug) : _debug,\r\n debugDev: DEBUG_DEV ? lazy(debugDev) : debugDev,\r\n _trace: _TRACE ? lazy(_trace) : _trace,\r\n traceDev: TRACE_DEV ? lazy(traceDev) : traceDev,\r\n },\r\n //\r\n named,\r\n utilFor: {\r\n internal() {\r\n return {\r\n debug: logger._debug,\r\n error: logger._error,\r\n warn: logger._warn,\r\n trace: logger._trace,\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.internal()\r\n },\r\n }\r\n },\r\n dev() {\r\n return {\r\n debug: logger.debugDev,\r\n error: logger.errorDev,\r\n warn: logger.warnDev,\r\n trace: logger.traceDev,\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.dev()\r\n },\r\n }\r\n },\r\n public() {\r\n return {\r\n error: logger.errorPublic,\r\n warn: logger.warnPublic,\r\n debug(message, obj) {\r\n logger._warn(`(public \"debug\" filtered out) ${message}`, obj)\r\n },\r\n trace(message, obj) {\r\n logger._warn(`(public \"trace\" filtered out) ${message}`, obj)\r\n },\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.public()\r\n },\r\n }\r\n },\r\n },\r\n }\r\n\r\n return logger\r\n}\r\n\r\nfunction createConsoleLoggerStyled(\r\n this: InternalLoggerRef,\r\n con: ITheatreConsoleLogger,\r\n source: ITheatreLogSource,\r\n): ILogger {\r\n const includes = {...this.includes, ...this.include(source)}\r\n\r\n const styleArgs: any[] = []\r\n let prefix = ''\r\n for (let i = 0; i < source.names.length; i++) {\r\n const {name, key} = source.names[i]\r\n prefix += ` %c${name}`\r\n styleArgs.push(this.style.css(name))\r\n if (key != null) {\r\n const keyStr = `%c#${key}`\r\n prefix += keyStr\r\n styleArgs.push(this.style.css(keyStr))\r\n }\r\n }\r\n\r\n const f = this.filtered\r\n const named = this.named.bind(this, source)\r\n const prefixArr = [prefix, ...styleArgs]\r\n return _createConsoleLogger(\r\n f,\r\n source,\r\n includes,\r\n con,\r\n prefixArr,\r\n styledKapowPrefix(prefixArr),\r\n named,\r\n )\r\n}\r\n\r\nfunction styledKapowPrefix(args: ReadonlyArray<string>): ReadonlyArray<string> {\r\n const start = args.slice(0)\r\n for (let i = 1; i < start.length; i++)\r\n // add big font to all part styles\r\n start[i] += ';background-color:#e0005a;padding:2px;color:white'\r\n return start\r\n}\r\n\r\nfunction createConsoleLoggerNoStyle(\r\n this: InternalLoggerRef,\r\n con: ITheatreConsoleLogger,\r\n source: ITheatreLogSource,\r\n): ILogger {\r\n const includes = {...this.includes, ...this.include(source)}\r\n\r\n let prefix = ''\r\n for (let i = 0; i < source.names.length; i++) {\r\n const {name, key} = source.names[i]\r\n prefix += ` ${name}`\r\n if (key != null) {\r\n prefix += `#${key}`\r\n }\r\n }\r\n\r\n const f = this.filtered\r\n const named = this.named.bind(this, source)\r\n const prefixArr = [prefix]\r\n return _createConsoleLogger(\r\n f,\r\n source,\r\n includes,\r\n con,\r\n prefixArr,\r\n prefixArr,\r\n named,\r\n )\r\n}\r\n\r\n/** Used by {@link createConsoleLoggerNoStyle} and {@link createConsoleLoggerStyled} */\r\nfunction _createConsoleLogger(\r\n f: (\r\n this: ITheatreLogSource,\r\n level: _LoggerLevel,\r\n message: string,\r\n args?: object | undefined,\r\n ) => void,\r\n source: ITheatreLogSource,\r\n includes: {min: TheatreLoggerLevel; dev: boolean; internal: boolean},\r\n con: ITheatreConsoleLogger,\r\n prefix: ReadonlyArray<any>,\r\n kapowPrefix: ReadonlyArray<any>,\r\n named: (name: string, key?: string | number | undefined) => ILogger,\r\n) {\r\n const _HMM = shouldLog(includes, _LoggerLevel._HMM)\r\n const _TODO = shouldLog(includes, _LoggerLevel._TODO)\r\n const _ERROR = shouldLog(includes, _LoggerLevel._ERROR)\r\n const ERROR_DEV = shouldLog(includes, _LoggerLevel.ERROR_DEV)\r\n const ERROR_PUBLIC = shouldLog(includes, _LoggerLevel.ERROR_PUBLIC)\r\n const _WARN = shouldLog(includes, _LoggerLevel._WARN)\r\n const _KAPOW = shouldLog(includes, _LoggerLevel._KAPOW)\r\n const WARN_DEV = shouldLog(includes, _LoggerLevel.WARN_DEV)\r\n const WARN_PUBLIC = shouldLog(includes, _LoggerLevel.WARN_PUBLIC)\r\n const _DEBUG = shouldLog(includes, _LoggerLevel._DEBUG)\r\n const DEBUG_DEV = shouldLog(includes, _LoggerLevel.DEBUG_DEV)\r\n const _TRACE = shouldLog(includes, _LoggerLevel._TRACE)\r\n const TRACE_DEV = shouldLog(includes, _LoggerLevel.TRACE_DEV)\r\n const _hmm = _HMM\r\n ? con.error.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._HMM)\r\n const _todo = _TODO\r\n ? con.error.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._TODO)\r\n const _error = _ERROR\r\n ? con.error.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._ERROR)\r\n const errorDev = ERROR_DEV\r\n ? con.error.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.ERROR_DEV)\r\n const errorPublic = ERROR_PUBLIC\r\n ? con.error.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.ERROR_PUBLIC)\r\n const _kapow = _KAPOW\r\n ? con.warn.bind(con, ...kapowPrefix)\r\n : f.bind(source, _LoggerLevel._KAPOW)\r\n const _warn = _WARN\r\n ? con.warn.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._WARN)\r\n const warnDev = WARN_DEV\r\n ? con.warn.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.WARN_DEV)\r\n const warnPublic = WARN_PUBLIC\r\n ? con.warn.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.WARN_DEV)\r\n const _debug = _DEBUG\r\n ? con.info.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._DEBUG)\r\n const debugDev = DEBUG_DEV\r\n ? con.info.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.DEBUG_DEV)\r\n const _trace = _TRACE\r\n ? con.debug.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel._TRACE)\r\n const traceDev = TRACE_DEV\r\n ? con.debug.bind(con, ...prefix)\r\n : f.bind(source, _LoggerLevel.TRACE_DEV)\r\n const logger: ILogger = {\r\n _hmm,\r\n _todo,\r\n _error,\r\n errorDev,\r\n errorPublic,\r\n _kapow,\r\n _warn,\r\n warnDev,\r\n warnPublic,\r\n _debug,\r\n debugDev,\r\n _trace,\r\n traceDev,\r\n lazy: {\r\n _hmm: _HMM ? lazy(_hmm) : _hmm,\r\n _todo: _TODO ? lazy(_todo) : _todo,\r\n _error: _ERROR ? lazy(_error) : _error,\r\n errorDev: ERROR_DEV ? lazy(errorDev) : errorDev,\r\n errorPublic: ERROR_PUBLIC ? lazy(errorPublic) : errorPublic,\r\n _kapow: _KAPOW ? lazy(_kapow) : _kapow,\r\n _warn: _WARN ? lazy(_warn) : _warn,\r\n warnDev: WARN_DEV ? lazy(warnDev) : warnDev,\r\n warnPublic: WARN_PUBLIC ? lazy(warnPublic) : warnPublic,\r\n _debug: _DEBUG ? lazy(_debug) : _debug,\r\n debugDev: DEBUG_DEV ? lazy(debugDev) : debugDev,\r\n _trace: _TRACE ? lazy(_trace) : _trace,\r\n traceDev: TRACE_DEV ? lazy(traceDev) : traceDev,\r\n },\r\n //\r\n named,\r\n utilFor: {\r\n internal() {\r\n return {\r\n debug: logger._debug,\r\n error: logger._error,\r\n warn: logger._warn,\r\n trace: logger._trace,\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.internal()\r\n },\r\n }\r\n },\r\n dev() {\r\n return {\r\n debug: logger.debugDev,\r\n error: logger.errorDev,\r\n warn: logger.warnDev,\r\n trace: logger.traceDev,\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.dev()\r\n },\r\n }\r\n },\r\n public() {\r\n return {\r\n error: logger.errorPublic,\r\n warn: logger.warnPublic,\r\n debug(message, obj) {\r\n logger._warn(`(public \"debug\" filtered out) ${message}`, obj)\r\n },\r\n trace(message, obj) {\r\n logger._warn(`(public \"trace\" filtered out) ${message}`, obj)\r\n },\r\n named(name, key) {\r\n return logger.named(name, key).utilFor.public()\r\n },\r\n }\r\n },\r\n },\r\n }\r\n\r\n return logger\r\n}\r\n", "export type {\r\n ILogger,\r\n IUtilLogger,\r\n ITheatreConsoleLogger,\r\n ITheatreLogIncludes,\r\n ITheatreLogSource,\r\n ITheatreLoggerConfig,\r\n ITheatreLoggingConfig,\r\n ITheatreInternalLogger,\r\n} from './_logger/logger'\r\nimport {createTheatreInternalLogger, TheatreLoggerLevel} from './_logger/logger'\r\nimport type {IUtilLogger} from './_logger/logger'\r\nexport {TheatreLoggerLevel, createTheatreInternalLogger} from './_logger/logger'\r\n\r\n/**\r\n * Common object interface for the context to pass in to utility functions.\r\n *\r\n * Prefer to pass this into utility function rather than an {@link IUtilLogger}.\r\n */\r\nexport interface IUtilContext {\r\n readonly logger: IUtilLogger\r\n}\r\n\r\nconst internal = createTheatreInternalLogger(console, {\r\n _debug: function () {},\r\n _error: function () {},\r\n})\r\n\r\ninternal.configureLogging({\r\n dev: true,\r\n min: TheatreLoggerLevel.TRACE,\r\n})\r\n\r\nexport default internal\r\n .getLogger()\r\n .named('Theatre.js (default logger)')\r\n .utilFor.dev()\r\n", "/**\r\n * The names of the global variables that the core or studio bundle\r\n * use to store their references.\r\n */\r\nexport const studioBundle = '__TheatreJS_StudioBundle'\r\nexport const coreBundle = '__TheatreJS_CoreBundle'\r\nexport const notifications = '__TheatreJS_Notifications'\r\n", "import logger from './logger'\r\nimport * as globalVariableNames from './globalVariableNames'\r\n\r\nexport type Notification = {title: string; message: string}\r\nexport type NotificationType = 'info' | 'success' | 'warning' | 'error'\r\nexport type Notify = (\r\n /**\r\n * The title of the notification.\r\n */\r\n title: string,\r\n /**\r\n * The message of the notification.\r\n */\r\n message: string,\r\n /**\r\n * An array of doc pages to link to.\r\n */\r\n docs?: {url: string; title: string}[],\r\n /**\r\n * Whether duplicate notifications should be allowed.\r\n */\r\n allowDuplicates?: boolean,\r\n) => void\r\nexport type Notifiers = {\r\n /**\r\n * Show a success notification.\r\n */\r\n success: Notify\r\n /**\r\n * Show a warning notification.\r\n *\r\n * Say what happened in the title.\r\n * In the message, start with 1) a reassurance, then 2) explain why it happened, and 3) what the user can do about it.\r\n */\r\n warning: Notify\r\n /**\r\n * Show an info notification.\r\n */\r\n info: Notify\r\n /**\r\n * Show an error notification.\r\n */\r\n error: Notify\r\n}\r\n\r\nconst createHandler =\r\n (type: NotificationType): Notify =>\r\n (...args) => {\r\n switch (type) {\r\n case 'success': {\r\n logger.debug(args.slice(0, 2).join('\\n'))\r\n break\r\n }\r\n case 'info': {\r\n logger.debug(args.slice(0, 2).join('\\n'))\r\n break\r\n }\r\n case 'warning': {\r\n logger.warn(args.slice(0, 2).join('\\n'))\r\n break\r\n }\r\n case 'error': {\r\n // don't log errors, they're already logged by the browser\r\n }\r\n }\r\n\r\n return typeof window !== 'undefined'\r\n ? // @ts-ignore\r\n window[globalVariableNames.notifications]?.notify[type](...args)\r\n : undefined\r\n }\r\n\r\n/** User-facing notification helpers (success, warning, info, error) used by Theatre.js runtimes. */\r\nexport const notify: Notifiers = {\r\n warning: createHandler('warning'),\r\n success: createHandler('success'),\r\n info: createHandler('info'),\r\n error: createHandler('error'),\r\n}\r\n\r\nif (typeof window !== 'undefined') {\r\n window.addEventListener('error', (e) => {\r\n notify.error(\r\n `An error occurred`,\r\n `<pre>${e.message}</pre>\\n\\nSee **console** for details.`,\r\n )\r\n })\r\n\r\n window.addEventListener('unhandledrejection', (e) => {\r\n notify.error(\r\n `An error occurred`,\r\n `<pre>${e.reason}</pre>\\n\\nSee **console** for details.`,\r\n )\r\n })\r\n}\r\n", "import {InvalidArgumentError} from './errors'\r\nimport {notify} from '@unseenco/theatre-shared/notify'\r\n\r\n/**\r\n * Make the given string's \"path\" slashes normalized with preceding and trailing spaces.\r\n *\r\n * - It removes starting and trailing slashes: `/foo/bar/` becomes `foo / bar`\r\n * - It adds wraps each slash with a single space, so that `foo/bar` becomes `foo / bar`\r\n *\r\n */\r\nconst normalizeSlashedPath = (p: string): string =>\r\n p\r\n // remove starting slashes\r\n .replace(/^[\\s\\/]*/, '')\r\n // remove ending slashes\r\n .replace(/[\\s\\/]*$/, '')\r\n // make middle slashes consistent\r\n .replace(/\\s*\\/\\s*/g, ' / ')\r\n\r\nconst getValidationErrorsOfSlashedPath = (p: string): void | string => {\r\n if (typeof p !== 'string') return `it is not a string. (it is a ${typeof p})`\r\n\r\n const components = p.split(/\\//)\r\n if (components.length === 0) return `it is empty.`\r\n\r\n for (let i = 0; i < components.length; i++) {\r\n const component = components[i].trim()\r\n if (component.length === 0) return `the component #${i + 1} is empty.`\r\n if (component.length > 64)\r\n return `the component '${component}' must have 64 characters or less.`\r\n }\r\n}\r\n\r\n/**\r\n * Sanitizes a `path` and warns the user if the input doesn't match the sanitized output.\r\n *\r\n * See {@link normalizeSlashedPath} for examples of how we do sanitization.\r\n */\r\nexport function validateAndSanitiseSlashedPathOrThrow(\r\n unsanitisedPath: string,\r\n fnName: string,\r\n) {\r\n const sanitisedPath = normalizeSlashedPath(unsanitisedPath)\r\n if (process.env.NODE_ENV !== 'development') {\r\n return sanitisedPath\r\n }\r\n const validation = getValidationErrorsOfSlashedPath(sanitisedPath)\r\n if (validation) {\r\n throw new InvalidArgumentError(\r\n `The path in ${fnName}(${\r\n typeof unsanitisedPath === 'string' ? `\"${unsanitisedPath}\"` : ''\r\n }) is invalid because ${validation}`,\r\n )\r\n }\r\n if (unsanitisedPath !== sanitisedPath) {\r\n notify.warning(\r\n 'Invalid path provided to object',\r\n `The path in \\`${fnName}(\"${unsanitisedPath}\")\\` was sanitized to \\`\"${sanitisedPath}\"\\`.\\n\\n` +\r\n 'Please replace the path with the sanitized one, otherwise it will likely break in the future.',\r\n [\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/manual/objects#creating-sheet-objects',\r\n title: 'Sheet Objects',\r\n },\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/api/core#sheet.object',\r\n title: 'API',\r\n },\r\n ],\r\n )\r\n }\r\n return sanitisedPath\r\n}\r\n", "import {validateAndSanitiseSlashedPathOrThrow} from '@unseenco/theatre-shared/utils/slashedPaths'\r\n\r\n/**\r\n * Theatre sheet object key for a GSAP outline proxy (`Namespace / label`),\r\n * matching {@link ISheet.object} sanitisation.\r\n */\r\nexport function buildGsapSheetObjectKey(namespace: string, label: string): string {\r\n return validateAndSanitiseSlashedPathOrThrow(\r\n `${namespace} / ${label}`,\r\n 'buildGsapSheetObjectKey',\r\n )\r\n}\r\n", "import type {GsapTimelineChildClip} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\n\r\nexport function isGsapTimeline(animation: unknown): boolean {\r\n const root = animation as {\r\n getChildren?: (\r\n nested: boolean,\r\n tweens: boolean,\r\n timelines: boolean,\r\n ) => unknown[]\r\n }\r\n const children = root.getChildren?.(false, true, false)\r\n return Array.isArray(children) && children.length > 0\r\n}\r\n\r\nfunction childLabel(child: unknown, index: number): string {\r\n const tween = child as {vars?: {id?: string}}\r\n const id = tween.vars?.id\r\n if (typeof id === 'string' && id.length > 0) return id\r\n return `Tween ${index + 1}`\r\n}\r\n\r\nfunction readChildLocalTiming(child: unknown): {\r\n localStart: number\r\n localDuration: number\r\n} {\r\n const tween = child as {\r\n startTime?: () => number\r\n duration?: () => number\r\n endTime?: () => number\r\n }\r\n const localStart =\r\n typeof tween.startTime === 'function' ? tween.startTime() : 0\r\n let localDuration =\r\n typeof tween.duration === 'function' ? tween.duration() : 0\r\n if (localDuration <= 0 && typeof tween.endTime === 'function') {\r\n localDuration = Math.max(tween.endTime() - localStart, 0.01)\r\n }\r\n return {\r\n localStart: Math.max(localStart, 0),\r\n localDuration: Math.max(localDuration, 0.01),\r\n }\r\n}\r\n\r\n/** Snapshots direct child tweens of a GSAP timeline (one nesting level). */\r\nexport function introspectGsapTimelineChildren(\r\n animation: unknown,\r\n): GsapTimelineChildClip[] {\r\n if (!isGsapTimeline(animation)) return []\r\n const root = animation as {\r\n getChildren: (\r\n nested: boolean,\r\n tweens: boolean,\r\n timelines: boolean,\r\n ) => unknown[]\r\n }\r\n const raw = root.getChildren(false, true, false)\r\n return raw.map((child, index) => {\r\n const {localStart, localDuration} = readChildLocalTiming(child)\r\n return {\r\n childId: `child_${index}`,\r\n label: childLabel(child, index),\r\n localStart,\r\n localDuration,\r\n }\r\n })\r\n}\r\n\r\n/** Rebuilds runtime childId \u2192 tween map aligned with introspected ids. */\r\nexport function linkGsapTimelineChildAnimations(\r\n animation: unknown,\r\n): Map<string, unknown> {\r\n const map = new Map<string, unknown>()\r\n if (!isGsapTimeline(animation)) return map\r\n const root = animation as {\r\n getChildren: (\r\n nested: boolean,\r\n tweens: boolean,\r\n timelines: boolean,\r\n ) => unknown[]\r\n }\r\n const raw = root.getChildren(false, true, false)\r\n raw.forEach((child, index) => {\r\n map.set(`child_${index}`, child)\r\n })\r\n return map\r\n}\r\n", "const GSAP_NAMESPACE_STORE_KEY = '__unseenco_theatre_gsap_configuredNamespace__'\r\n\r\n/** Default GSAP outline namespace segment (first path component). */\r\nexport const DEFAULT_GSAP_SHEET_OBJECT_NAMESPACE = 'GSAP'\r\n\r\nexport function setConfiguredGsapSheetObjectNamespace(namespace: string): void {\r\n const g = globalThis as typeof globalThis & {\r\n [GSAP_NAMESPACE_STORE_KEY]?: string\r\n }\r\n g[GSAP_NAMESPACE_STORE_KEY] = namespace.trim()\r\n}\r\n\r\nexport function getConfiguredGsapSheetObjectNamespace(): string {\r\n const g = globalThis as typeof globalThis & {\r\n [GSAP_NAMESPACE_STORE_KEY]?: string\r\n }\r\n return g[GSAP_NAMESPACE_STORE_KEY] ?? DEFAULT_GSAP_SHEET_OBJECT_NAMESPACE\r\n}\r\n\r\n/** First segment of a Theatre slashed object key (`foo / bar` \u2192 `foo`). */\r\nexport function firstSlashedPathSegment(objectKey: string): string {\r\n return objectKey.split(/\\s*\\/\\s*/g)[0]?.trim() ?? objectKey.trim()\r\n}\r\n\r\n/**\r\n * Whether a sheet object key belongs to the configured GSAP proxy namespace.\r\n * Keys are sanitised by Theatre as `Namespace / label`, not `Namespace/label`.\r\n */\r\nexport function isGsapSheetObjectKey(objectKey: string): boolean {\r\n const namespace = getConfiguredGsapSheetObjectNamespace()\r\n return firstSlashedPathSegment(objectKey) === namespace\r\n}\r\n", "import type {\r\n BasicKeyframedTrack,\r\n GsapClipTrack,\r\n TrackData,\r\n} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\n\r\nexport {\r\n DEFAULT_GSAP_SHEET_OBJECT_NAMESPACE,\r\n getConfiguredGsapSheetObjectNamespace,\r\n isGsapSheetObjectKey,\r\n setConfiguredGsapSheetObjectNamespace,\r\n} from '@unseenco/theatre-shared/gsap/gsapSheetObjectKey'\r\n\r\nexport function isBasicKeyframedTrack(\r\n track: TrackData,\r\n): track is BasicKeyframedTrack {\r\n return track.type === 'BasicKeyframedTrack'\r\n}\r\n\r\nexport function isGsapClipTrack(track: TrackData): track is GsapClipTrack {\r\n return track.type === 'GsapClipTrack'\r\n}\r\n\r\n/** Sequence time where the clip bar ends (inclusive). */\r\nexport function gsapClipEndTime(\r\n clip: Pick<GsapClipTrack, 'start' | 'duration'>,\r\n): number {\r\n return clip.start + clip.duration\r\n}\r\n\r\nexport function maxGsapClipEndTime(\r\n clips: ReadonlyArray<Pick<GsapClipTrack, 'start' | 'duration'>>,\r\n): number {\r\n let max = 0\r\n for (const clip of clips) {\r\n max = Math.max(max, gsapClipEndTime(clip))\r\n }\r\n return max\r\n}\r\n\r\nexport function gsapClipLocalProgress(\r\n sequencePosition: number,\r\n clip: Pick<GsapClipTrack, 'start' | 'duration'>,\r\n): number {\r\n if (clip.duration <= 0) return 0\r\n const raw = (sequencePosition - clip.start) / clip.duration\r\n if (raw <= 0) return 0\r\n if (raw >= 1) return 1\r\n return raw\r\n}\r\n\r\n/**\r\n * Progress for driving a GSAP tween from sequence time.\r\n *\r\n * - Before clip start: `0` (hold at tween start)\r\n * - Inside clip: local linear progress\r\n * - At or after clip end (including playhead jumps): `1` (completed)\r\n */\r\nexport function gsapClipSyncProgress(\r\n sequencePosition: number,\r\n clip: Pick<GsapClipTrack, 'start' | 'duration'>,\r\n): number {\r\n if (clip.duration <= 0) return 0\r\n if (sequencePosition < clip.start) return 0\r\n const clipEnd = gsapClipEndTime(clip)\r\n if (sequencePosition >= clipEnd - 1e-5) return 1\r\n const raw = (sequencePosition - clip.start) / clip.duration\r\n if (raw <= 0) return 0\r\n if (raw >= 1) return 1\r\n return raw\r\n}\r\n", "import type {GsapTimelineChildClip} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\nimport {readGsapTweenTimelineDuration} from './syncGsapClipProgress'\r\n\r\nexport function applyTimelineChildTimingToGsap(\r\n rootAnimation: unknown,\r\n timelineChildren: ReadonlyArray<GsapTimelineChildClip>,\r\n childById: ReadonlyMap<string, unknown> | undefined,\r\n onRebuild?: () => unknown,\r\n): boolean {\r\n if (!timelineChildren.length) return true\r\n let ok = applyTimelineChildTimingToGsapInner(\r\n rootAnimation,\r\n timelineChildren,\r\n childById,\r\n )\r\n if (!ok && onRebuild) {\r\n const rebuilt = onRebuild()\r\n if (rebuilt) {\r\n ok = applyTimelineChildTimingToGsapInner(\r\n rebuilt,\r\n timelineChildren,\r\n childById,\r\n )\r\n }\r\n }\r\n return ok\r\n}\r\n\r\nfunction applyTimelineChildTimingToGsapInner(\r\n rootAnimation: unknown,\r\n timelineChildren: ReadonlyArray<GsapTimelineChildClip>,\r\n childById: ReadonlyMap<string, unknown> | undefined,\r\n): boolean {\r\n if (!childById || timelineChildren.length === 0) return true\r\n let ok = true\r\n for (const childState of timelineChildren) {\r\n const tween = childById.get(childState.childId)\r\n if (!tween) continue\r\n try {\r\n const t = tween as {\r\n startTime?: (time: number) => unknown\r\n duration?: (dur: number) => unknown\r\n }\r\n if (typeof t.startTime === 'function') {\r\n t.startTime(childState.localStart)\r\n }\r\n if (typeof t.duration === 'function') {\r\n t.duration(childState.localDuration)\r\n }\r\n } catch {\r\n ok = false\r\n }\r\n }\r\n return ok\r\n}\r\n\r\n/** Updates parent clip duration on the sequence to match GSAP timeline span. */\r\nexport function sequenceDurationForTimelineSpan(\r\n timelineSpanSeconds: number,\r\n currentClipDuration: number,\r\n): number {\r\n const span = Math.max(timelineSpanSeconds, 0.01)\r\n return Math.max(currentClipDuration, span)\r\n}\r\n\r\nexport function readTimelineSpanSeconds(\r\n rootAnimation: unknown,\r\n fallback: number,\r\n): number {\r\n const total = readGsapTweenTimelineDuration(rootAnimation)\r\n return total > 0 ? total : fallback\r\n}\r\n", "import type {GsapTimelineChildClip} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\nimport {gsapClipSyncProgress} from '@unseenco/theatre-shared/sequence/trackData'\r\nimport {applyTimelineChildTimingToGsap} from './applyTimelineChildTiming'\r\nimport {getAnimationEntryBySheetAddressKey} from './gsapAnimationRegistry'\r\nimport type {GsapAnimationRegistryEntry} from './gsapAnimationRegistry'\r\n\r\nexport type GsapClipTiming = {\r\n /** From {@link sheetObjectAddressKey} / {@link sheetObjectAddressKeyFromParts}. */\r\n sheetObjectAddressKey: string\r\n gsapAnimationId: string\r\n start: number\r\n duration: number\r\n timelineChildren?: ReadonlyArray<GsapTimelineChildClip>\r\n timelineSpan?: number\r\n}\r\n\r\ntype EnrichedClip = GsapClipTiming & {\r\n entry: GsapAnimationRegistryEntry\r\n targetKey: unknown\r\n}\r\n\r\nfunction getGsapAnimationTargetKey(\r\n animation: unknown,\r\n fallbackAnimationId: string,\r\n): unknown {\r\n const tween = animation as {targets?: () => unknown[]}\r\n const targets = tween.targets?.()\r\n if (targets && targets.length > 0) {\r\n return targets[0]\r\n }\r\n return fallbackAnimationId\r\n}\r\n\r\n/** Updates registered GSAP tween progress for each clip at `sequencePosition`. */\r\nexport function syncRegisteredGsapAnimationsForClips(\r\n sequencePosition: number,\r\n clips: ReadonlyArray<GsapClipTiming>,\r\n): void {\r\n const enriched: EnrichedClip[] = []\r\n for (const clip of clips) {\r\n const entry = getAnimationEntryBySheetAddressKey(\r\n clip.sheetObjectAddressKey,\r\n clip.gsapAnimationId,\r\n )\r\n if (!entry?.animation) continue\r\n enriched.push({\r\n ...clip,\r\n entry,\r\n targetKey: getGsapAnimationTargetKey(\r\n entry.animation,\r\n clip.gsapAnimationId,\r\n ),\r\n })\r\n }\r\n\r\n const byTarget = new Map<unknown, EnrichedClip[]>()\r\n for (const item of enriched) {\r\n const list = byTarget.get(item.targetKey) ?? []\r\n list.push(item)\r\n byTarget.set(item.targetKey, list)\r\n }\r\n\r\n for (const group of byTarget.values()) {\r\n const sorted = [...group].sort((a, b) => a.start - b.start)\r\n // Same-target clips often animate the same properties. Apply every clip's\r\n // progress in timeline order so a playhead jump cannot leave an earlier\r\n // tween at a stale partial progress that overrides a later clip.\r\n for (const clip of sorted) {\r\n const progress = gsapClipSyncProgress(sequencePosition, clip)\r\n const entry = clip.entry\r\n const animation = entry.animation as {\r\n progress?: (progress: number, suppressEvents?: boolean) => number\r\n time?: (time: number, suppressEvents?: boolean) => number\r\n }\r\n if (\r\n entry.kind === 'timeline' &&\r\n clip.timelineChildren &&\r\n clip.timelineChildren.length > 0\r\n ) {\r\n applyTimelineChildTimingToGsap(\r\n entry.animation,\r\n clip.timelineChildren,\r\n entry.timelineChildById,\r\n entry.onRebuildTimeline,\r\n )\r\n const span =\r\n clip.timelineSpan ?? readGsapTweenTimelineDuration(entry.animation)\r\n const t = progress * Math.max(span, 0.01)\r\n if (typeof animation.time === 'function') {\r\n animation.time(t, true)\r\n } else {\r\n animation.progress?.(progress, true)\r\n }\r\n } else {\r\n animation.progress?.(progress, true)\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function readGsapTweenTimelineDuration(animation: unknown): number {\r\n const tween = animation as {\r\n duration: () => number\r\n totalDuration?: () => number\r\n }\r\n const total = tween.totalDuration?.()\r\n if (typeof total === 'number' && total > 0) return total\r\n const d = tween.duration()\r\n return d > 0 ? d : 1\r\n}\r\n", "import type {\r\n GsapClipBaselineTiming,\r\n GsapClipTrack,\r\n GsapTimelineChildClip,\r\n} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\nimport type {GsapAnimationRegistryEntry} from './gsapAnimationRegistry'\r\nimport {introspectGsapTimelineChildren} from './introspectGsapTimelineChildren'\r\nimport {readGsapTweenTimelineDuration} from './syncGsapClipProgress'\r\n\r\nfunction cloneTimelineChildren(\r\n children: GsapTimelineChildClip[],\r\n): GsapTimelineChildClip[] {\r\n return children.map((c) => ({...c}))\r\n}\r\n\r\nexport function buildGsapClipBaselineTiming(p: {\r\n duration: number\r\n timelineSpan?: number\r\n timelineChildren?: GsapTimelineChildClip[]\r\n}): GsapClipBaselineTiming {\r\n const duration = Math.max(p.duration, 0.01)\r\n const baseline: GsapClipBaselineTiming = {duration}\r\n if (p.timelineChildren && p.timelineChildren.length > 0) {\r\n baseline.timelineSpan = p.timelineSpan ?? duration\r\n baseline.timelineChildren = cloneTimelineChildren(p.timelineChildren)\r\n }\r\n return baseline\r\n}\r\n\r\nexport function baselineTimingFromRegistryEntry(\r\n entry: GsapAnimationRegistryEntry,\r\n): GsapClipBaselineTiming | undefined {\r\n if (entry.originalTiming) {\r\n return {\r\n duration: entry.originalTiming.duration,\r\n timelineSpan: entry.originalTiming.timelineSpan,\r\n timelineChildren: entry.originalTiming.timelineChildren\r\n ? cloneTimelineChildren(entry.originalTiming.timelineChildren)\r\n : undefined,\r\n }\r\n }\r\n if (!entry.animation) return undefined\r\n const duration =\r\n entry.defaultDuration ?? readGsapTweenTimelineDuration(entry.animation)\r\n const timelineChildren = introspectGsapTimelineChildren(entry.animation)\r\n if (timelineChildren.length > 0) {\r\n return buildGsapClipBaselineTiming({\r\n duration,\r\n timelineSpan: readGsapTweenTimelineDuration(entry.animation),\r\n timelineChildren,\r\n })\r\n }\r\n return buildGsapClipBaselineTiming({duration})\r\n}\r\n\r\nexport function resolveGsapClipBaselineTiming(\r\n track: GsapClipTrack,\r\n entry?: GsapAnimationRegistryEntry,\r\n): GsapClipBaselineTiming | undefined {\r\n if (track.baselineTiming) {\r\n return buildGsapClipBaselineTiming(track.baselineTiming)\r\n }\r\n if (entry) {\r\n return baselineTimingFromRegistryEntry(entry)\r\n }\r\n return undefined\r\n}\r\n\r\n/** Restores sequence clip timing from baseline; does not change {@link GsapClipTrack.start}. */\r\nexport function applyGsapClipBaselineToTrack(\r\n track: GsapClipTrack,\r\n baseline: GsapClipBaselineTiming,\r\n): void {\r\n track.duration = Math.max(baseline.duration, 0.01)\r\n if (baseline.timelineChildren && baseline.timelineChildren.length > 0) {\r\n track.timelineChildren = cloneTimelineChildren(baseline.timelineChildren)\r\n track.timelineSpan = Math.max(\r\n baseline.timelineSpan ?? baseline.duration,\r\n 0.01,\r\n )\r\n } else {\r\n delete track.timelineChildren\r\n delete track.timelineSpan\r\n }\r\n}\r\n\r\nfunction baselineDurationSeconds(duration: number): number {\r\n return Math.max(duration, 0.01)\r\n}\r\n\r\nfunction baselineTimelineSpanSeconds(baseline: GsapClipBaselineTiming): number {\r\n return Math.max(baseline.timelineSpan ?? baseline.duration, 0.01)\r\n}\r\n\r\nfunction trackTimelineSpanSeconds(track: GsapClipTrack): number {\r\n return Math.max(track.timelineSpan ?? track.duration, 0.01)\r\n}\r\n\r\nfunction timelineChildTimingMatches(\r\n trackChild: GsapTimelineChildClip,\r\n baselineChild: GsapTimelineChildClip,\r\n): boolean {\r\n return (\r\n trackChild.localStart === baselineChild.localStart &&\r\n trackChild.localDuration === baselineChild.localDuration\r\n )\r\n}\r\n\r\n/** True when clip duration / timeline span / child local timing differs from baseline. */\r\nexport function gsapClipTimingDeviatesFromBaseline(\r\n track: GsapClipTrack,\r\n baseline: GsapClipBaselineTiming,\r\n): boolean {\r\n if (\r\n track.duration !== baselineDurationSeconds(baseline.duration)\r\n ) {\r\n return true\r\n }\r\n\r\n const baselineChildren = baseline.timelineChildren\r\n const hasBaselineTimeline =\r\n baselineChildren !== undefined && baselineChildren.length > 0\r\n const trackChildren = track.timelineChildren\r\n const hasTrackTimeline =\r\n trackChildren !== undefined && trackChildren.length > 0\r\n\r\n if (hasBaselineTimeline !== hasTrackTimeline) {\r\n return true\r\n }\r\n\r\n if (!hasBaselineTimeline) {\r\n return false\r\n }\r\n\r\n if (trackTimelineSpanSeconds(track) !== baselineTimelineSpanSeconds(baseline)) {\r\n return true\r\n }\r\n\r\n for (const baselineChild of baselineChildren!) {\r\n const trackChild = trackChildren!.find(\r\n (c) => c.childId === baselineChild.childId,\r\n )\r\n if (!trackChild || !timelineChildTimingMatches(trackChild, baselineChild)) {\r\n return true\r\n }\r\n }\r\n\r\n return false\r\n}\r\n\r\n/** True when the given child's local timing differs from baseline for that child. */\r\nexport function gsapTimelineChildTimingDeviatesFromBaseline(\r\n track: GsapClipTrack,\r\n childId: string,\r\n baseline: GsapClipBaselineTiming,\r\n): boolean {\r\n const baselineChild = baseline.timelineChildren?.find(\r\n (c) => c.childId === childId,\r\n )\r\n const trackChild = track.timelineChildren?.find((c) => c.childId === childId)\r\n if (!baselineChild || !trackChild) {\r\n return false\r\n }\r\n return !timelineChildTimingMatches(trackChild, baselineChild)\r\n}\r\n\r\nexport function gsapClipDeviatesFromBaseline(\r\n track: GsapClipTrack,\r\n entry?: GsapAnimationRegistryEntry,\r\n): boolean {\r\n const baseline = resolveGsapClipBaselineTiming(track, entry)\r\n if (!baseline) return false\r\n return gsapClipTimingDeviatesFromBaseline(track, baseline)\r\n}\r\n\r\nexport function gsapTimelineChildDeviatesFromBaseline(\r\n track: GsapClipTrack,\r\n childId: string,\r\n entry?: GsapAnimationRegistryEntry,\r\n): boolean {\r\n const baseline = resolveGsapClipBaselineTiming(track, entry)\r\n if (!baseline) return false\r\n return gsapTimelineChildTimingDeviatesFromBaseline(track, childId, baseline)\r\n}\r\n\r\nexport function applyGsapTimelineChildBaselineToTrack(\r\n track: GsapClipTrack,\r\n childId: string,\r\n baseline: GsapClipBaselineTiming,\r\n): boolean {\r\n const baselineChild = baseline.timelineChildren?.find(\r\n (c) => c.childId === childId,\r\n )\r\n if (!baselineChild || !track.timelineChildren?.length) return false\r\n const child = track.timelineChildren.find((c) => c.childId === childId)\r\n if (!child) return false\r\n child.localStart = baselineChild.localStart\r\n child.localDuration = baselineChild.localDuration\r\n return true\r\n}\r\n", "import type SheetObject from '@unseenco/theatre-core/sheetObjects/SheetObject'\r\n\r\nexport type GsapObjectBinding = {\r\n gsapAnimationId: string\r\n defaultDuration: number\r\n}\r\n\r\nconst STORE_KEY = '__unseenco_theatre_gsap_objectBindings__'\r\n\r\nfunction addressKey(sheetObject: SheetObject): string {\r\n const a = sheetObject.address\r\n return `${a.projectId}|${a.sheetId}|${a.sheetInstanceId}|${a.objectKey}`\r\n}\r\n\r\nfunction getStore(): Map<string, GsapObjectBinding> {\r\n const g = globalThis as typeof globalThis & {\r\n [STORE_KEY]?: Map<string, GsapObjectBinding>\r\n }\r\n if (!g[STORE_KEY]) {\r\n g[STORE_KEY] = new Map()\r\n }\r\n return g[STORE_KEY]!\r\n}\r\n\r\nexport function registerGsapObjectBinding(\r\n sheetObject: SheetObject,\r\n binding: GsapObjectBinding,\r\n): void {\r\n getStore().set(addressKey(sheetObject), binding)\r\n}\r\n\r\nexport function getGsapObjectBinding(\r\n sheetObject: SheetObject,\r\n): GsapObjectBinding | undefined {\r\n return getStore().get(addressKey(sheetObject))\r\n}\r\n\r\nexport function clearGsapObjectBindingsForTests(): void {\r\n getStore().clear()\r\n}\r\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n", "import isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nexport default isKey;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nexport default memoize;\n", "import memoize from './memoize.js';\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nexport default memoizeCapped;\n", "import memoizeCapped from './_memoizeCapped.js';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nexport default stringToPath;\n", "/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n", "import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n", "import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n", "import isArray from './isArray.js';\nimport isKey from './_isKey.js';\nimport stringToPath from './_stringToPath.js';\nimport toString from './toString.js';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nexport default castPath;\n", "import isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default toKey;\n", "import castPath from './_castPath.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nexport default baseGet;\n", "import baseGet from './_baseGet.js';\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nexport default get;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n", "import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n", "/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nexport default last;\n", "import type {$IntentionalAny} from './types'\r\n\r\ntype PathToProp = Array<string | number>\r\n\r\nexport type PointerMeta = {\r\n root: {}\r\n path: (string | number)[]\r\n}\r\n\r\n/** We are using an empty object as a WeakMap key for storing pointer meta data */\r\ntype WeakPointerKey = {}\r\n\r\nexport type UnindexableTypesForPointer =\r\n | number\r\n | string\r\n | boolean\r\n | null\r\n | void\r\n | undefined\r\n | Function // eslint-disable-line @typescript-eslint/ban-types\r\n\r\nexport type UnindexablePointer = {\r\n [K in $IntentionalAny]: Pointer<undefined>\r\n}\r\n\r\nconst pointerMetaWeakMap = new WeakMap<WeakPointerKey, PointerMeta>()\r\nconst cachedSubPathPointersWeakMap = new WeakMap<\r\n WeakPointerKey,\r\n Map<string | number, Pointer<unknown>>\r\n>()\r\n\r\n/**\r\n * A wrapper type for the type a `Pointer` points to.\r\n */\r\nexport type PointerType<O> = {\r\n /**\r\n * Only accessible via the type system.\r\n * This is a helper for getting the underlying pointer type\r\n * via the type space.\r\n */\r\n $$__pointer_type: O\r\n}\r\n\r\n/**\r\n * The type of {@link Atom} pointers. See {@link pointer|pointer()} for an\r\n * explanation of pointers.\r\n *\r\n * @see Atom\r\n *\r\n * @remarks\r\n * The Pointer type is quite tricky because it doesn't play well with `any` and other inexact types.\r\n * Here is an example that one would expect to work, but currently doesn't:\r\n * ```ts\r\n * declare function expectAnyPointer(pointer: Pointer<any>): void\r\n *\r\n * expectAnyPointer(null as Pointer<{}>) // this shows as a type error because Pointer<{}> is not assignable to Pointer<any>, even though it should\r\n * ```\r\n *\r\n * The current solution is to just avoid using `any` with pointer-related code (or type-test it well).\r\n * But if you enjoy solving typescript puzzles, consider fixing this :)\r\n * Potentially, [TypeScript variance annotations in 4.7+](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#optional-variance-annotations-for-type-parameters)\r\n * might be able to help us.\r\n */\r\nexport type Pointer<O> = PointerType<O> &\r\n // `Exclude<O, undefined>` will remove `undefined` from the first type\r\n // `undefined extends O ? undefined : never` will give us `undefined` if `O` is `... | undefined`\r\n PointerInner<Exclude<O, undefined>, undefined extends O ? undefined : never>\r\n\r\n// By separating the `O` (non-undefined) from the `undefined` or `never`, we\r\n// can properly use `O extends ...` to determine the kind of potential value\r\n// without actually discarding optionality information.\r\ntype PointerInner<O, Optional> = O extends UnindexableTypesForPointer\r\n ? UnindexablePointer\r\n : unknown extends O\r\n ? UnindexablePointer\r\n : O extends (infer T)[]\r\n ? Pointer<T>[]\r\n : O extends {}\r\n ? {\r\n [K in keyof O]-?: Pointer<O[K] | Optional>\r\n }\r\n : UnindexablePointer\r\n\r\nconst pointerMetaSymbol = Symbol('pointerMeta')\r\n\r\nconst proxyHandler = {\r\n get(\r\n pointerKey: WeakPointerKey,\r\n prop: string | typeof pointerMetaSymbol,\r\n ): $IntentionalAny {\r\n if (prop === pointerMetaSymbol) return pointerMetaWeakMap.get(pointerKey)!\r\n\r\n let subPathPointers = cachedSubPathPointersWeakMap.get(pointerKey)\r\n if (!subPathPointers) {\r\n subPathPointers = new Map()\r\n cachedSubPathPointersWeakMap.set(pointerKey, subPathPointers)\r\n }\r\n\r\n const existing = subPathPointers.get(prop)\r\n if (existing !== undefined) return existing\r\n\r\n const meta = pointerMetaWeakMap.get(pointerKey)!\r\n\r\n const subPointer = pointer({root: meta.root, path: [...meta.path, prop]})\r\n subPathPointers.set(prop, subPointer)\r\n return subPointer\r\n },\r\n}\r\n\r\n/**\r\n * Returns the metadata associated with the pointer. Usually the root object and\r\n * the path.\r\n *\r\n * @param p - The pointer.\r\n */\r\nexport const getPointerMeta = <_>(p: PointerType<_>): PointerMeta => {\r\n // @ts-ignore @todo\r\n const meta: PointerMeta = p[\r\n pointerMetaSymbol as unknown as $IntentionalAny\r\n ] as $IntentionalAny\r\n return meta\r\n}\r\n\r\n/**\r\n * Returns the root object and the path of the pointer.\r\n *\r\n * @example\r\n * ```ts\r\n * const {root, path} = getPointerParts(pointer)\r\n * ```\r\n *\r\n * @param p - The pointer.\r\n *\r\n * @returns An object with two properties: `root`-the root object or the pointer, and `path`-the path of the pointer. `path` is an array of the property-chain.\r\n */\r\nexport const getPointerParts = <_>(\r\n p: Pointer<_>,\r\n): {root: {}; path: PathToProp} => {\r\n const {root, path} = getPointerMeta(p)\r\n return {root, path}\r\n}\r\n\r\n/**\r\n * Creates a pointer to a (nested) property of an {@link Atom}.\r\n *\r\n * @remarks\r\n * Pointers are used to make prisms of properties or nested properties of\r\n * {@link Atom|Atoms}.\r\n *\r\n * Pointers also allow easy construction of new pointers pointing to nested members\r\n * of the root object, by simply using property chaining. E.g. `somePointer.a.b` will\r\n * create a new pointer that has `'a'` and `'b'` added to the path of `somePointer`.\r\n *\r\n * @example\r\n * ```ts\r\n * // Here, sum is a prism that updates whenever the a or b prop of someAtom does.\r\n * const sum = prism(() => {\r\n * return val(pointer({root: someAtom, path: ['a']})) + val(pointer({root: someAtom, path: ['b']}));\r\n * });\r\n *\r\n * // Note, atoms have a convenience Atom.pointer property that points to the root,\r\n * // which you would normally use in this situation.\r\n * const sum = prism(() => {\r\n * return val(someAtom.pointer.a) + val(someAtom.pointer.b);\r\n * });\r\n * ```\r\n *\r\n * @param args - The pointer parameters.\r\n *\r\n * @typeParam O - The type of the value being pointed to.\r\n */\r\nfunction pointer<O>(args: {root: {}; path?: Array<string | number>}) {\r\n const meta: PointerMeta = {\r\n root: args.root as $IntentionalAny,\r\n path: args.path ?? [],\r\n }\r\n const pointerKey: WeakPointerKey = {}\r\n pointerMetaWeakMap.set(pointerKey, meta)\r\n return new Proxy(pointerKey, proxyHandler) as Pointer<O>\r\n}\r\n\r\nexport default pointer\r\n\r\n/**\r\n * Returns whether `p` is a pointer.\r\n */\r\nexport const isPointer = (p: $IntentionalAny): p is Pointer<unknown> => {\r\n return p && !!getPointerMeta(p)\r\n}\r\n", "import type {$FixMe, $IntentionalAny} from '../types'\r\n\r\nexport default function updateDeep<S>(\r\n state: S,\r\n path: (string | number | undefined)[],\r\n reducer: (...args: $IntentionalAny[]) => $IntentionalAny,\r\n): S {\r\n if (path.length === 0) return reducer(state)\r\n return hoop(state, path as $IntentionalAny, reducer)\r\n}\r\n\r\nconst hoop = (\r\n s: $FixMe,\r\n path: (string | number)[],\r\n reducer: $FixMe,\r\n): $FixMe => {\r\n if (path.length === 0) {\r\n return reducer(s)\r\n }\r\n if (Array.isArray(s)) {\r\n let [index, ...restOfPath] = path\r\n index = parseInt(String(index), 10)\r\n if (isNaN(index)) index = 0\r\n const oldVal = s[index]\r\n const newVal = hoop(oldVal, restOfPath, reducer)\r\n if (oldVal === newVal) return s\r\n const newS = [...s]\r\n newS.splice(index, 1, newVal)\r\n return newS\r\n } else if (typeof s === 'object' && s !== null) {\r\n const [key, ...restOfPath] = path\r\n const oldVal = s[key]\r\n const newVal = hoop(oldVal, restOfPath, reducer)\r\n if (oldVal === newVal) return s\r\n const newS = {...s, [key]: newVal}\r\n return newS\r\n } else {\r\n const [key, ...restOfPath] = path\r\n\r\n return {[key]: hoop(undefined, restOfPath, reducer)}\r\n }\r\n}\r\n", "interface Node<Data> {\r\n next: undefined | Node<Data>\r\n data: Data\r\n}\r\n\r\n/**\r\n * Just a simple LinkedList\r\n */\r\nexport default class Stack<Data> {\r\n _head: undefined | Node<Data>\r\n\r\n constructor() {\r\n this._head = undefined\r\n }\r\n\r\n peek() {\r\n return this._head && this._head.data\r\n }\r\n\r\n pop() {\r\n const head = this._head\r\n if (!head) {\r\n return undefined\r\n }\r\n this._head = head.next\r\n return head.data\r\n }\r\n\r\n push(data: Data) {\r\n const node = {next: this._head, data}\r\n this._head = node\r\n }\r\n}\r\n", "import type Ticker from '../Ticker'\r\nimport type {$IntentionalAny, VoidFn} from '../types'\r\n\r\ntype IDependent = (msgComingFrom: Prism<$IntentionalAny>) => void\r\n\r\n/**\r\n * Common interface for prisms.\r\n */\r\nexport interface Prism<V> {\r\n /**\r\n * Whether the object is a prism.\r\n */\r\n isPrism: true\r\n\r\n /**\r\n * Whether the prism is hot.\r\n */\r\n isHot: boolean\r\n\r\n /**\r\n * Calls `listener` with a fresh value every time the prism _has_ a new value, throttled by Ticker.\r\n */\r\n onChange(\r\n ticker: Ticker,\r\n listener: (v: V) => void,\r\n immediate?: boolean,\r\n ): VoidFn\r\n\r\n onStale(cb: () => void): VoidFn\r\n\r\n /**\r\n * Keep the prism hot, even if there are no tappers (subscribers).\r\n */\r\n keepHot(): VoidFn\r\n\r\n /**\r\n * Add a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be made a dependent of this prism.\r\n *\r\n * @see _removeDependent\r\n *\r\n * @internal\r\n */\r\n _addDependent(d: IDependent): void\r\n\r\n /**\r\n * Remove a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be removed from as a dependent of this prism.\r\n *\r\n * @see _addDependent\r\n * @internal\r\n */\r\n _removeDependent(d: IDependent): void\r\n\r\n /**\r\n * Gets the current value of the prism. If the value is stale, it causes the prism to freshen.\r\n */\r\n getValue(): V\r\n}\r\n\r\n/**\r\n * Returns whether `d` is a prism.\r\n */\r\nexport function isPrism(d: any): d is Prism<unknown> {\r\n return !!(d && d.isPrism && d.isPrism === true)\r\n}\r\n", "import type {$IntentionalAny} from '../types'\r\nimport Stack from '../utils/Stack'\r\nimport type {Prism} from './Interface'\r\n\r\nfunction createMechanism() {\r\n const noop = () => {}\r\n\r\n const stack = new Stack<Collector>()\r\n const noopCollector: Collector = noop\r\n\r\n type Collector = (d: Prism<$IntentionalAny>) => void\r\n\r\n const pushCollector = (collector: Collector): void => {\r\n stack.push(collector)\r\n }\r\n\r\n const popCollector = (collector: Collector): void => {\r\n const existing = stack.peek()\r\n if (existing !== collector) {\r\n throw new Error(`Popped collector is not on top of the stack`)\r\n }\r\n stack.pop()\r\n }\r\n\r\n const startIgnoringDependencies = () => {\r\n stack.push(noopCollector)\r\n }\r\n\r\n const stopIgnoringDependencies = () => {\r\n if (stack.peek() !== noopCollector) {\r\n if (process.env.NODE_ENV === 'development') {\r\n console.warn('This should never happen')\r\n }\r\n } else {\r\n stack.pop()\r\n }\r\n }\r\n\r\n const reportResolutionStart = (d: Prism<$IntentionalAny>) => {\r\n const possibleCollector = stack.peek()\r\n if (possibleCollector) {\r\n possibleCollector(d)\r\n }\r\n\r\n stack.push(noopCollector)\r\n }\r\n\r\n const reportResolutionEnd = (_d: Prism<$IntentionalAny>) => {\r\n stack.pop()\r\n }\r\n\r\n return {\r\n type: 'Dataverse_discoveryMechanism' as 'Dataverse_discoveryMechanism',\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n reportResolutionStart,\r\n reportResolutionEnd,\r\n pushCollector,\r\n popCollector,\r\n }\r\n}\r\n\r\nfunction getSharedMechanism(): ReturnType<typeof createMechanism> {\r\n const varName = '__dataverse_discoveryMechanism_sharedStack'\r\n const root =\r\n typeof window !== 'undefined'\r\n ? window\r\n : typeof global !== 'undefined'\r\n ? global\r\n : {}\r\n if (root) {\r\n const existingMechanism: ReturnType<typeof createMechanism> | undefined =\r\n // @ts-ignore ignore\r\n root[varName]\r\n if (\r\n existingMechanism &&\r\n typeof existingMechanism === 'object' &&\r\n existingMechanism.type === 'Dataverse_discoveryMechanism'\r\n ) {\r\n return existingMechanism\r\n } else {\r\n const mechanism = createMechanism()\r\n // @ts-ignore ignore\r\n root[varName] = mechanism\r\n return mechanism\r\n }\r\n } else {\r\n return createMechanism()\r\n }\r\n}\r\n\r\nexport const {\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n reportResolutionEnd,\r\n reportResolutionStart,\r\n pushCollector,\r\n popCollector,\r\n} = getSharedMechanism()\r\n", "import type Ticker from '../Ticker'\r\nimport type {$IntentionalAny, VoidFn} from '../types'\r\nimport Stack from '../utils/Stack'\r\nimport type {Prism} from './Interface'\r\nimport {isPrism} from './Interface'\r\nimport {\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n pushCollector,\r\n popCollector,\r\n reportResolutionStart,\r\n reportResolutionEnd,\r\n} from './discoveryMechanism'\r\n\r\ntype IDependent = (msgComingFrom: Prism<$IntentionalAny>) => void\r\n\r\nconst voidFn = () => {}\r\n\r\nclass HotHandle<V> {\r\n private _didMarkDependentsAsStale: boolean = false\r\n private _isFresh: boolean = false\r\n protected _cacheOfDendencyValues: Map<Prism<unknown>, unknown> = new Map()\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _dependents: Set<IDependent> = new Set()\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _dependencies: Set<Prism<$IntentionalAny>> = new Set()\r\n\r\n protected _possiblyStaleDeps = new Set<Prism<unknown>>()\r\n\r\n private _scope: HotScope = new HotScope(\r\n this as $IntentionalAny as HotHandle<unknown>,\r\n )\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _lastValue: undefined | V = undefined\r\n\r\n /**\r\n * If true, the prism is stale even though its dependencies aren't\r\n * marked as such. This is used by `prism.source()` and `prism.state()`\r\n * to mark the prism as stale.\r\n */\r\n private _forciblySetToStale: boolean = false\r\n\r\n constructor(\r\n private readonly _fn: () => V,\r\n private readonly _prismInstance: PrismInstance<V>,\r\n ) {\r\n for (const d of this._dependencies) {\r\n d._addDependent(this._reactToDependencyGoingStale)\r\n }\r\n\r\n startIgnoringDependencies()\r\n this.getValue()\r\n stopIgnoringDependencies()\r\n }\r\n\r\n get hasDependents(): boolean {\r\n return this._dependents.size > 0\r\n }\r\n removeDependent(d: IDependent) {\r\n this._dependents.delete(d)\r\n }\r\n addDependent(d: IDependent) {\r\n this._dependents.add(d)\r\n }\r\n\r\n destroy() {\r\n for (const d of this._dependencies) {\r\n d._removeDependent(this._reactToDependencyGoingStale)\r\n }\r\n cleanupScopeStack(this._scope)\r\n }\r\n\r\n getValue(): V {\r\n if (!this._isFresh) {\r\n const newValue = this._recalculate()\r\n this._lastValue = newValue\r\n this._isFresh = true\r\n this._didMarkDependentsAsStale = false\r\n this._forciblySetToStale = false\r\n }\r\n return this._lastValue!\r\n }\r\n\r\n _recalculate() {\r\n let value: V\r\n\r\n if (!this._forciblySetToStale) {\r\n if (this._possiblyStaleDeps.size > 0) {\r\n let anActuallyStaleDepWasFound = false\r\n startIgnoringDependencies()\r\n for (const dep of this._possiblyStaleDeps) {\r\n if (this._cacheOfDendencyValues.get(dep) !== dep.getValue()) {\r\n anActuallyStaleDepWasFound = true\r\n break\r\n }\r\n }\r\n stopIgnoringDependencies()\r\n this._possiblyStaleDeps.clear()\r\n if (!anActuallyStaleDepWasFound) {\r\n return this._lastValue!\r\n }\r\n }\r\n }\r\n\r\n const newDeps: Set<Prism<unknown>> = new Set()\r\n this._cacheOfDendencyValues.clear()\r\n\r\n const collector = (observedDep: Prism<unknown>): void => {\r\n newDeps.add(observedDep)\r\n this._addDependency(observedDep)\r\n }\r\n\r\n pushCollector(collector)\r\n\r\n hookScopeStack.push(this._scope)\r\n try {\r\n value = this._fn()\r\n } catch (error) {\r\n console.error(error)\r\n } finally {\r\n const topOfTheStack = hookScopeStack.pop()\r\n if (topOfTheStack !== this._scope) {\r\n console.warn(\r\n // @todo guide the user to report the bug in an issue\r\n `The Prism hook stack has slipped. This is a bug.`,\r\n )\r\n }\r\n }\r\n\r\n popCollector(collector)\r\n\r\n for (const dep of this._dependencies) {\r\n if (!newDeps.has(dep)) {\r\n this._removeDependency(dep)\r\n }\r\n }\r\n\r\n this._dependencies = newDeps\r\n\r\n startIgnoringDependencies()\r\n for (const dep of newDeps) {\r\n this._cacheOfDendencyValues.set(dep, dep.getValue())\r\n }\r\n stopIgnoringDependencies()\r\n\r\n return value!\r\n }\r\n\r\n forceStale() {\r\n this._forciblySetToStale = true\r\n this._markAsStale()\r\n }\r\n\r\n protected _reactToDependencyGoingStale = (which: Prism<$IntentionalAny>) => {\r\n this._possiblyStaleDeps.add(which)\r\n\r\n this._markAsStale()\r\n }\r\n\r\n private _markAsStale() {\r\n if (this._didMarkDependentsAsStale) return\r\n\r\n this._didMarkDependentsAsStale = true\r\n this._isFresh = false\r\n\r\n for (const dependent of this._dependents) {\r\n dependent(this._prismInstance)\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _addDependency(d: Prism<$IntentionalAny>) {\r\n if (this._dependencies.has(d)) return\r\n this._dependencies.add(d)\r\n d._addDependent(this._reactToDependencyGoingStale)\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _removeDependency(d: Prism<$IntentionalAny>) {\r\n if (!this._dependencies.has(d)) return\r\n this._dependencies.delete(d)\r\n d._removeDependent(this._reactToDependencyGoingStale)\r\n }\r\n}\r\n\r\nconst emptyObject = {}\r\n\r\nclass PrismInstance<V> implements Prism<V> {\r\n /**\r\n * Whether the object is a prism.\r\n */\r\n readonly isPrism: true = true\r\n\r\n private _state:\r\n | {hot: false; handle: undefined}\r\n | {hot: true; handle: HotHandle<V>} = {\r\n hot: false,\r\n handle: undefined,\r\n }\r\n\r\n constructor(private readonly _fn: () => V) {}\r\n\r\n /**\r\n * Whether the prism is hot.\r\n */\r\n get isHot(): boolean {\r\n return this._state.hot\r\n }\r\n\r\n onChange(\r\n ticker: Ticker,\r\n listener: (v: V) => void,\r\n immediate: boolean = false,\r\n ): VoidFn {\r\n // the prism will call this function every time it goes from fresh to stale\r\n const dependent = () => {\r\n // schedule the listener to be called on the next tick, unless\r\n // we're already on a tick, in which case it'll be called on the current tick.\r\n ticker.onThisOrNextTick(refresh)\r\n }\r\n\r\n // let's cache the last value so we don't call the listener if the value hasn't changed\r\n let lastValue: V | typeof emptyObject =\r\n // use an empty object as the initial value so that the listener is called on the first tick.\r\n // if we were to use, say, undefined, and this.getValue() also returned undefined, the listener\r\n // would never be called.\r\n emptyObject\r\n\r\n // this function will be _scheduled_ to be called on the currently running, or next tick,\r\n // after the prism has gone from fresh to stale.\r\n const refresh = () => {\r\n const newValue = this.getValue()\r\n // if the value hasn't changed, don't call the listener\r\n if (newValue === lastValue) return\r\n\r\n // the value has changed - cache it\r\n lastValue = newValue\r\n\r\n // and let the listener know\r\n listener(newValue)\r\n }\r\n\r\n // add the dependent to the prism's list of dependents (which will make it go hot)\r\n this._addDependent(dependent)\r\n\r\n // if the caller wants the listener to be called immediately, call it now\r\n if (immediate) {\r\n lastValue = this.getValue()\r\n listener(lastValue as $IntentionalAny as V)\r\n }\r\n\r\n // the unsubscribe function\r\n const unsubscribe = () => {\r\n // remove the dependent from the prism's list of dependents (and if it was the last dependent, the prism will go cold)\r\n this._removeDependent(dependent)\r\n // in case we're scheduled for a tick, cancel that\r\n ticker.offThisOrNextTick(refresh)\r\n ticker.offNextTick(refresh)\r\n }\r\n\r\n return unsubscribe\r\n }\r\n\r\n /**\r\n * Calls `callback` every time the prism's state goes from `fresh-\\>stale.` Returns an `unsubscribe()` function.\r\n */\r\n onStale(callback: () => void): VoidFn {\r\n const untap = () => {\r\n this._removeDependent(fn)\r\n }\r\n const fn = () => callback()\r\n this._addDependent(fn)\r\n return untap\r\n }\r\n\r\n /**\r\n * Keep the prism hot, even if there are no tappers (subscribers).\r\n */\r\n keepHot() {\r\n return this.onStale(() => {})\r\n }\r\n\r\n /**\r\n * Add a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be made a dependent of this prism.\r\n *\r\n * @see _removeDependent\r\n */\r\n _addDependent(d: IDependent) {\r\n if (!this._state.hot) {\r\n this._goHot()\r\n }\r\n this._state.handle!.addDependent(d)\r\n }\r\n\r\n private _goHot() {\r\n const hotHandle = new HotHandle(this._fn, this)\r\n this._state = {\r\n hot: true,\r\n handle: hotHandle,\r\n }\r\n }\r\n\r\n /**\r\n * Remove a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be removed from as a dependent of this prism.\r\n *\r\n * @see _addDependent\r\n */\r\n _removeDependent(d: IDependent) {\r\n const state = this._state\r\n if (!state.hot) {\r\n return\r\n }\r\n const handle = state.handle\r\n handle.removeDependent(d)\r\n if (!handle.hasDependents) {\r\n this._state = {hot: false, handle: undefined}\r\n handle.destroy()\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current value of the prism. If the value is stale, it causes the prism to freshen.\r\n */\r\n getValue(): V {\r\n /**\r\n * TODO We should prevent (or warn about) a common mistake users make, which is reading the value of\r\n * a prism in the body of a react component (e.g. `der.getValue()` (often via `val()`) instead of `useVal()`\r\n * or `uesPrism()`).\r\n *\r\n * Although that's the most common example of this mistake, you can also find it outside of react components.\r\n * Basically the user runs `der.getValue()` assuming the read is detected by a wrapping prism when it's not.\r\n *\r\n * Sometiems the prism isn't even hot when the user assumes it is.\r\n *\r\n * We can fix this type of mistake by:\r\n * 1. Warning the user when they call `getValue()` on a cold prism.\r\n * 2. Warning the user about calling `getValue()` on a hot-but-stale prism\r\n * if `getValue()` isn't called by a known mechanism like a `PrismEmitter`.\r\n *\r\n * Design constraints:\r\n * - This fix should not have a perf-penalty in production. Perhaps use a global flag + `process.env.NODE_ENV !== 'production'`\r\n * to enable it.\r\n * - In the case of `onStale()`, we don't control when the user calls\r\n * `getValue()` (as opposed to `onChange()` which calls `getValue()` directly).\r\n * Perhaps we can disable the check in that case.\r\n * - Probably the best place to add this check is right here in this method plus some changes to `reportResulutionStart()`,\r\n * which would have to be changed to let the caller know if there is an actual collector (a prism)\r\n * present in its stack.\r\n */\r\n reportResolutionStart(this)\r\n\r\n const state = this._state\r\n\r\n let val: V\r\n if (state.hot) {\r\n val = state.handle.getValue()\r\n } else {\r\n val = calculateColdPrism(this._fn)\r\n }\r\n\r\n reportResolutionEnd(this)\r\n return val\r\n }\r\n}\r\n\r\ninterface PrismScope {\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n ): T\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void]\r\n ref<T>(key: string, initialValue: T): IRef<T>\r\n sub(key: string): PrismScope\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V\r\n}\r\n\r\nclass HotScope implements PrismScope {\r\n constructor(private readonly _hotHandle: HotHandle<unknown>) {}\r\n\r\n protected readonly _refs: Map<string, IRef<unknown>> = new Map()\r\n ref<T>(key: string, initialValue: T): IRef<T> {\r\n let ref = this._refs.get(key)\r\n if (ref !== undefined) {\r\n return ref as $IntentionalAny as IRef<T>\r\n } else {\r\n const ref = {\r\n current: initialValue,\r\n }\r\n this._refs.set(key, ref)\r\n return ref\r\n }\r\n }\r\n isPrismScope = true\r\n\r\n // NOTE probably not a great idea to eager-allocate all of these objects/maps for every scope,\r\n // especially because most wouldn't get used in the majority of cases. However, back when these\r\n // were stored on weakmaps, they were uncomfortable to inspect in the debugger.\r\n readonly subs: Record<string, HotScope> = {}\r\n readonly effects: Map<string, IEffect> = new Map()\r\n\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n let effect = this.effects.get(key)\r\n if (effect === undefined) {\r\n effect = {\r\n cleanup: voidFn,\r\n deps: undefined,\r\n }\r\n this.effects.set(key, effect)\r\n }\r\n\r\n if (depsHaveChanged(effect.deps, deps)) {\r\n effect.cleanup()\r\n\r\n startIgnoringDependencies()\r\n effect.cleanup = safelyRun(cb, voidFn).value\r\n stopIgnoringDependencies()\r\n effect.deps = deps\r\n }\r\n /**\r\n * TODO: we should cleanup dangling effects too.\r\n * Example:\r\n * ```ts\r\n * let i = 0\r\n * prism(() => {\r\n * if (i === 0) prism.effect(\"this effect will only run once\", () => {}, [])\r\n * i++\r\n * })\r\n * ```\r\n */\r\n }\r\n\r\n readonly memos: Map<string, IMemo> = new Map()\r\n\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n ): T {\r\n let memo = this.memos.get(key)\r\n if (memo === undefined) {\r\n memo = {\r\n cachedValue: null,\r\n // undefined will always indicate \"deps have changed\", so we set its initial value as such\r\n deps: undefined,\r\n }\r\n this.memos.set(key, memo)\r\n }\r\n\r\n if (depsHaveChanged(memo.deps, deps)) {\r\n startIgnoringDependencies()\r\n\r\n memo.cachedValue = safelyRun(fn, undefined).value\r\n stopIgnoringDependencies()\r\n memo.deps = deps\r\n }\r\n\r\n return memo.cachedValue as $IntentionalAny as T\r\n }\r\n\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n const {value, setValue} = this.memo(\r\n 'state/' + key,\r\n () => {\r\n const value = {current: initialValue}\r\n const setValue = (newValue: T) => {\r\n value.current = newValue\r\n this._hotHandle.forceStale()\r\n }\r\n return {value, setValue}\r\n },\r\n [],\r\n )\r\n\r\n return [value.current, setValue]\r\n }\r\n\r\n sub(key: string): HotScope {\r\n if (!this.subs[key]) {\r\n this.subs[key] = new HotScope(this._hotHandle)\r\n }\r\n return this.subs[key]\r\n }\r\n\r\n cleanupEffects() {\r\n for (const effect of this.effects.values()) {\r\n safelyRun(effect.cleanup, undefined)\r\n }\r\n this.effects.clear()\r\n }\r\n\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V {\r\n const sourceKey = '$$source/blah'\r\n this.effect(\r\n sourceKey,\r\n () => {\r\n const unsub = subscribe(() => {\r\n this._hotHandle.forceStale()\r\n })\r\n return unsub\r\n },\r\n [subscribe],\r\n )\r\n return getValue()\r\n }\r\n}\r\n\r\nfunction cleanupScopeStack(scope: HotScope) {\r\n for (const sub of Object.values(scope.subs)) {\r\n cleanupScopeStack(sub)\r\n }\r\n scope.cleanupEffects()\r\n}\r\n\r\nfunction safelyRun<T, U>(\r\n fn: () => T,\r\n returnValueInCaseOfError: U,\r\n): {ok: true; value: T} | {ok: false; value: U} {\r\n try {\r\n return {value: fn(), ok: true}\r\n } catch (error) {\r\n // Naming this function can allow the error reporter additional context to the user on where this error came from\r\n setTimeout(function PrismReportThrow() {\r\n // ensure that the error gets reported, but does not crash the current execution scope\r\n throw error\r\n })\r\n return {value: returnValueInCaseOfError, ok: false}\r\n }\r\n}\r\n\r\nconst hookScopeStack = new Stack<PrismScope>()\r\n\r\ntype IRef<T> = {\r\n current: T\r\n}\r\n\r\ntype IEffect = {\r\n deps: undefined | unknown[]\r\n cleanup: VoidFn\r\n}\r\n\r\ntype IMemo = {\r\n deps: undefined | unknown[] | ReadonlyArray<unknown>\r\n cachedValue: unknown\r\n}\r\n\r\n/**\r\n * Just like React's `useRef()`, `prism.ref()` allows us to create a prism that holds a reference to some value.\r\n * The only difference is that `prism.ref()` requires a key to be passed into it, whlie `useRef()` doesn't.\r\n * This means that we can call `prism.ref()` in any order, and we can call it multiple times with the same key.\r\n * @param key - The key for the ref. Should be unique inside of the prism.\r\n * @param initialValue - The initial value for the ref.\r\n * @returns `{current: V}` - The ref object.\r\n *\r\n * Note that the ref object will always return its initial value if the prism is cold. It'll only record\r\n * its current value if the prism is hot (and will forget again if the prism goes cold again).\r\n *\r\n * @example\r\n * ```ts\r\n * const pr = prism(() => {\r\n * const ref1 = prism.ref(\"ref1\", 0)\r\n * console.log(ref1.current) // will print 0, and if the prism is hot, it'll print the current value\r\n * ref1.current++ // changing the current value of the ref\r\n * })\r\n * ```\r\n */\r\nfunction ref<T>(key: string, initialValue: T): IRef<T> {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.ref() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.ref(key, initialValue)\r\n}\r\n\r\n/**\r\n * An effect hook, similar to React's `useEffect()`, but is not sensitive to call order by using `key`.\r\n *\r\n * @param key - the key for the effect. Should be uniqe inside of the prism.\r\n * @param cb - the callback function. Requires returning a cleanup function.\r\n * @param deps - the dependency array\r\n */\r\nfunction effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.effect() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.effect(key, cb, deps)\r\n}\r\n\r\nfunction depsHaveChanged(\r\n oldDeps: undefined | unknown[] | ReadonlyArray<unknown>,\r\n newDeps: undefined | unknown[] | ReadonlyArray<unknown>,\r\n): boolean {\r\n if (oldDeps === undefined || newDeps === undefined) {\r\n return true\r\n }\r\n\r\n const len = oldDeps.length\r\n if (len !== newDeps.length) return true\r\n\r\n for (let i = 0; i < len; i++) {\r\n if (oldDeps[i] !== newDeps[i]) return true\r\n }\r\n\r\n return false\r\n}\r\n\r\n/**\r\n * `prism.memo()` works just like React's `useMemo()` hook. It's a way to cache the result of a function call.\r\n * The only difference is that `prism.memo()` requires a key to be passed into it, whlie `useMemo()` doesn't.\r\n * This means that we can call `prism.memo()` in any order, and we can call it multiple times with the same key.\r\n *\r\n * @param key - The key for the memo. Should be unique inside of the prism\r\n * @param fn - The function to memoize\r\n * @param deps - The dependency array. Provide `[]` if you want to the value to be memoized only once and never re-calculated.\r\n * @returns The result of the function call\r\n *\r\n * @example\r\n * ```ts\r\n * const pr = prism(() => {\r\n * const memoizedReturnValueOfExpensiveFn = prism.memo(\"memo1\", expensiveFn, [])\r\n * })\r\n * ```\r\n */\r\nfunction memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n): T {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.memo() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.memo(key, fn, deps)\r\n}\r\n\r\n/**\r\n * A state hook, similar to react's `useState()`.\r\n *\r\n * @param key - the key for the state\r\n * @param initialValue - the initial value\r\n * @returns [currentState, setState]\r\n *\r\n * @example\r\n * ```ts\r\n * import {prism} from 'dataverse'\r\n *\r\n * // This prism holds the current mouse position and updates when the mouse moves\r\n * const mousePositionD = prism(() => {\r\n * const [pos, setPos] = prism.state<[x: number, y: number]>('pos', [0, 0])\r\n *\r\n * prism.effect(\r\n * 'setupListeners',\r\n * () => {\r\n * const handleMouseMove = (e: MouseEvent) => {\r\n * setPos([e.screenX, e.screenY])\r\n * }\r\n * document.addEventListener('mousemove', handleMouseMove)\r\n *\r\n * return () => {\r\n * document.removeEventListener('mousemove', handleMouseMove)\r\n * }\r\n * },\r\n * [],\r\n * )\r\n *\r\n * return pos\r\n * })\r\n * ```\r\n */\r\nfunction state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.state() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.state(key, initialValue)\r\n}\r\n\r\n/**\r\n * This is useful to make sure your code is running inside a `prism()` call.\r\n *\r\n * @example\r\n * ```ts\r\n * import {prism} from '@unseenco/theatre-dataverse'\r\n *\r\n * function onlyUsefulInAPrism() {\r\n * prism.ensurePrism()\r\n * }\r\n *\r\n * prism(() => {\r\n * onlyUsefulInAPrism() // will run fine\r\n * })\r\n *\r\n * setTimeout(() => {\r\n * onlyUsefulInAPrism() // throws an error\r\n * console.log('This will never get logged')\r\n * }, 0)\r\n * ```\r\n */\r\nfunction ensurePrism(): void {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`The parent function is called outside of a prism() call.`)\r\n }\r\n}\r\n\r\nfunction scope<T>(key: string, fn: () => T): T {\r\n const parentScope = hookScopeStack.peek()\r\n if (!parentScope) {\r\n throw new Error(`prism.scope() is called outside of a prism() call.`)\r\n }\r\n const subScope = parentScope.sub(key)\r\n hookScopeStack.push(subScope)\r\n const ret = safelyRun(fn, undefined).value\r\n hookScopeStack.pop()\r\n return ret as $IntentionalAny as T\r\n}\r\n\r\n/**\r\n * Just an alias for `prism.memo(key, () => prism(fn), deps).getValue()`. It creates a new prism, memoizes it, and returns the value.\r\n * `prism.sub()` is useful when you want to divide your prism into smaller prisms, each of which\r\n * would _only_ recalculate when _certain_ dependencies change. In other words, it's an optimization tool.\r\n *\r\n * @param key - The key for the memo. Should be unique inside of the prism\r\n * @param fn - The function to run inside the prism\r\n * @param deps - The dependency array. Provide `[]` if you want to the value to be memoized only once and never re-calculated.\r\n * @returns The value of the inner prism\r\n */\r\nfunction sub<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[],\r\n): T {\r\n return memo(key, () => prism(fn), deps).getValue()\r\n}\r\n\r\n/**\r\n * @returns true if the current function is running inside a `prism()` call.\r\n */\r\nfunction inPrism(): boolean {\r\n return !!hookScopeStack.peek()\r\n}\r\n\r\nconst possiblePrismToValue = <P extends Prism<$IntentionalAny> | unknown>(\r\n input: P,\r\n): P extends Prism<infer T> ? T : P => {\r\n if (isPrism(input)) {\r\n return input.getValue() as $IntentionalAny\r\n } else {\r\n return input as $IntentionalAny\r\n }\r\n}\r\n\r\n/**\r\n * `prism.source()` allow a prism to react to changes in some external source (other than other prisms).\r\n * For example, `Atom.pointerToPrism()` uses `prism.source()` to create a prism that reacts to changes in the atom's value.\r\n \r\n * @param subscribe - The prism will call this function as soon as the prism goes hot. This function should return an unsubscribe function function which the prism will call when it goes cold.\r\n * @param getValue - A function that returns the current value of the external source.\r\n * @returns The current value of the source\r\n * \r\n * Example:\r\n * ```ts\r\n * function prismFromInputElement(input: HTMLInputElement): Prism<string> {\r\n * function listen(cb: (value: string) => void) {\r\n * const listener = () => {\r\n * cb(input.value)\r\n * }\r\n * input.addEventListener('input', listener)\r\n * return () => {\r\n * input.removeEventListener('input', listener)\r\n * }\r\n * }\r\n * \r\n * function get() {\r\n * return input.value\r\n * }\r\n * return prism(() => prism.source(listen, get))\r\n * }\r\n * ```\r\n */\r\nfunction source<V>(\r\n subscribe: (fn: (val: V) => void) => VoidFn,\r\n getValue: () => V,\r\n): V {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.source() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.source(subscribe, getValue)\r\n}\r\n\r\ntype IPrismFn = {\r\n <T>(fn: () => T): Prism<T>\r\n ref: typeof ref\r\n effect: typeof effect\r\n memo: typeof memo\r\n ensurePrism: typeof ensurePrism\r\n state: typeof state\r\n scope: typeof scope\r\n sub: typeof sub\r\n inPrism: typeof inPrism\r\n source: typeof source\r\n}\r\n\r\n/**\r\n * Creates a prism from the passed function that adds all prisms referenced\r\n * in it as dependencies, and reruns the function when these change.\r\n *\r\n * @param fn - The function to rerun when the prisms referenced in it change.\r\n */\r\nconst prism: IPrismFn = (fn) => {\r\n return new PrismInstance(fn)\r\n}\r\n\r\nclass ColdScope implements PrismScope {\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n console.warn(`prism.effect() does not run in cold prisms`)\r\n }\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: any[] | readonly any[] | undefined,\r\n ): T {\r\n return fn()\r\n }\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n return [initialValue, () => {}]\r\n }\r\n ref<T>(key: string, initialValue: T): IRef<T> {\r\n return {current: initialValue}\r\n }\r\n sub(key: string): ColdScope {\r\n return new ColdScope()\r\n }\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V {\r\n return getValue()\r\n }\r\n}\r\n\r\nfunction calculateColdPrism<V>(fn: () => V): V {\r\n const scope = new ColdScope()\r\n hookScopeStack.push(scope)\r\n let value: V\r\n try {\r\n value = fn()\r\n } catch (error) {\r\n console.error(error)\r\n } finally {\r\n const topOfTheStack = hookScopeStack.pop()\r\n if (topOfTheStack !== scope) {\r\n console.warn(\r\n // @todo guide the user to report the bug in an issue\r\n `The Prism hook stack has slipped. This is a bug.`,\r\n )\r\n }\r\n }\r\n return value!\r\n}\r\n\r\nprism.ref = ref\r\nprism.effect = effect\r\nprism.memo = memo\r\nprism.ensurePrism = ensurePrism\r\nprism.state = state\r\nprism.scope = scope\r\nprism.sub = sub\r\nprism.inPrism = inPrism\r\nprism.source = source\r\n\r\nexport default prism\r\n", "import get from 'lodash-es/get'\r\nimport isPlainObject from 'lodash-es/isPlainObject'\r\nimport last from 'lodash-es/last'\r\nimport type {Prism} from './prism/Interface'\r\nimport type {Pointer} from './pointer'\r\nimport {getPointerParts} from './pointer'\r\nimport {isPointer} from './pointer'\r\nimport pointer from './pointer'\r\nimport type {$FixMe, $IntentionalAny} from './types'\r\nimport updateDeep from './utils/updateDeep'\r\nimport prism from './prism/prism'\r\nimport type {PointerToPrismProvider} from './pointerToPrism'\r\n\r\ntype Listener = (newVal: unknown) => void\r\n\r\nenum ValueTypes {\r\n Dict,\r\n Array,\r\n Other,\r\n}\r\n\r\nconst getTypeOfValue = (v: unknown): ValueTypes => {\r\n if (Array.isArray(v)) return ValueTypes.Array\r\n if (isPlainObject(v)) return ValueTypes.Dict\r\n return ValueTypes.Other\r\n}\r\n\r\nconst getKeyOfValue = (\r\n v: unknown,\r\n key: string | number,\r\n vType: ValueTypes = getTypeOfValue(v),\r\n): unknown => {\r\n if (vType === ValueTypes.Dict && typeof key === 'string') {\r\n return (v as $IntentionalAny)[key]\r\n } else if (vType === ValueTypes.Array && isValidArrayIndex(key)) {\r\n return (v as $IntentionalAny)[key]\r\n } else {\r\n return undefined\r\n }\r\n}\r\n\r\nconst isValidArrayIndex = (key: string | number): boolean => {\r\n const inNumber = typeof key === 'number' ? key : parseInt(key, 10)\r\n return (\r\n !isNaN(inNumber) &&\r\n inNumber >= 0 &&\r\n inNumber < Infinity &&\r\n (inNumber | 0) === inNumber\r\n )\r\n}\r\n\r\nclass Scope {\r\n children: Map<string | number, Scope> = new Map()\r\n identityChangeListeners: Set<Listener> = new Set()\r\n constructor(\r\n readonly _parent: undefined | Scope,\r\n readonly _path: (string | number)[],\r\n ) {}\r\n\r\n addIdentityChangeListener(cb: Listener) {\r\n this.identityChangeListeners.add(cb)\r\n }\r\n\r\n removeIdentityChangeListener(cb: Listener) {\r\n this.identityChangeListeners.delete(cb)\r\n this._checkForGC()\r\n }\r\n\r\n removeChild(key: string | number) {\r\n this.children.delete(key)\r\n this._checkForGC()\r\n }\r\n\r\n getChild(key: string | number) {\r\n return this.children.get(key)\r\n }\r\n\r\n getOrCreateChild(key: string | number) {\r\n let child = this.children.get(key)\r\n if (!child) {\r\n child = child = new Scope(this, this._path.concat([key]))\r\n this.children.set(key, child)\r\n }\r\n return child\r\n }\r\n\r\n _checkForGC() {\r\n if (this.identityChangeListeners.size > 0) return\r\n if (this.children.size > 0) return\r\n\r\n if (this._parent) {\r\n this._parent.removeChild(last(this._path) as string | number)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Wraps an object whose (sub)properties can be individually tracked.\r\n */\r\nexport default class Atom<State> implements PointerToPrismProvider {\r\n private _currentState: State\r\n /**\r\n * @internal\r\n */\r\n readonly $$isPointerToPrismProvider = true\r\n private readonly _rootScope: Scope\r\n /**\r\n * Convenience property that gives you a pointer to the root of the atom.\r\n *\r\n * @remarks\r\n * Equivalent to `pointer({ root: thisAtom, path: [] })`.\r\n */\r\n readonly pointer: Pointer<State> = pointer({root: this as $FixMe, path: []})\r\n\r\n readonly prism: Prism<State> = this.pointerToPrism(\r\n this.pointer,\r\n ) as $IntentionalAny\r\n\r\n constructor(initialState: State) {\r\n this._currentState = initialState\r\n this._rootScope = new Scope(undefined, [])\r\n }\r\n\r\n /**\r\n * Sets the state of the atom.\r\n *\r\n * @param newState - The new state of the atom.\r\n */\r\n set(newState: State) {\r\n const oldState = this._currentState\r\n this._currentState = newState\r\n\r\n this._checkUpdates(this._rootScope, oldState, newState)\r\n }\r\n\r\n get(): State {\r\n return this._currentState\r\n }\r\n\r\n /**\r\n * Returns the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.getByPointer(atom.pointer.a.b) // 1\r\n * atom.getByPointer((p) => p.a.b) // 1\r\n * ```\r\n */\r\n getByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n ): S {\r\n const pointer = isPointer(pointerOrFn)\r\n ? pointerOrFn\r\n : (pointerOrFn as $IntentionalAny)(this.pointer)\r\n\r\n const path = getPointerParts(pointer).path\r\n return this._getIn(path) as S\r\n }\r\n\r\n /**\r\n * Gets the state of the atom at `path`.\r\n */\r\n private _getIn(path: (string | number)[]): unknown {\r\n return path.length === 0 ? this.get() : get(this.get(), path)\r\n }\r\n\r\n reduce(fn: (state: State) => State) {\r\n this.set(fn(this.get()))\r\n }\r\n\r\n /**\r\n * Reduces the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.reduceByPointer(atom.pointer.a.b, (b) => b + 1) // atom.get().a.b === 2\r\n * atom.reduceByPointer((p) => p.a.b, (b) => b + 1) // atom.get().a.b === 2\r\n * ```\r\n */\r\n reduceByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n reducer: (s: S) => S,\r\n ) {\r\n const pointer = isPointer(pointerOrFn)\r\n ? pointerOrFn\r\n : (pointerOrFn as $IntentionalAny)(this.pointer)\r\n\r\n const path = getPointerParts(pointer).path\r\n const newState = updateDeep(this.get(), path, reducer)\r\n this.set(newState)\r\n }\r\n\r\n /**\r\n * Sets the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.setByPointer(atom.pointer.a.b, 2) // atom.get().a.b === 2\r\n * atom.setByPointer((p) => p.a.b, 2) // atom.get().a.b === 2\r\n * ```\r\n */\r\n setByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n val: S,\r\n ) {\r\n this.reduceByPointer(pointerOrFn, () => val)\r\n }\r\n\r\n private _checkUpdates(scope: Scope, oldState: unknown, newState: unknown) {\r\n if (oldState === newState) return\r\n for (const cb of scope.identityChangeListeners) {\r\n cb(newState)\r\n }\r\n\r\n if (scope.children.size === 0) return\r\n\r\n // @todo we can probably skip checking value types\r\n const oldValueType = getTypeOfValue(oldState)\r\n const newValueType = getTypeOfValue(newState)\r\n\r\n if (oldValueType === ValueTypes.Other && oldValueType === newValueType)\r\n return\r\n\r\n for (const [childKey, childScope] of scope.children) {\r\n const oldChildVal = getKeyOfValue(oldState, childKey, oldValueType)\r\n const newChildVal = getKeyOfValue(newState, childKey, newValueType)\r\n this._checkUpdates(childScope, oldChildVal, newChildVal)\r\n }\r\n }\r\n\r\n private _getOrCreateScopeForPath(path: (string | number)[]): Scope {\r\n let curScope = this._rootScope\r\n for (const pathEl of path) {\r\n curScope = curScope.getOrCreateChild(pathEl)\r\n }\r\n return curScope\r\n }\r\n\r\n private _onPointerValueChange = <P>(\r\n pointer: Pointer<P>,\r\n cb: (v: P) => void,\r\n ): (() => void) => {\r\n const {path} = getPointerParts(pointer)\r\n const scope = this._getOrCreateScopeForPath(path)\r\n scope.identityChangeListeners.add(cb as $IntentionalAny)\r\n const unsubscribe = () => {\r\n scope.identityChangeListeners.delete(cb as $IntentionalAny)\r\n }\r\n return unsubscribe\r\n }\r\n\r\n /**\r\n * Returns a new prism of the value at the provided path.\r\n *\r\n * @param pointer - The path to create the prism at.\r\n *\r\n * ```ts\r\n * const pr = atom({ a: { b: 1 } }).pointerToPrism(atom.pointer.a.b)\r\n * pr.getValue() // 1\r\n * ```\r\n */\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P> {\r\n const {path} = getPointerParts(pointer)\r\n const subscribe = (listener: (val: unknown) => void) =>\r\n this._onPointerValueChange(pointer, listener)\r\n\r\n const getValue = () => this._getIn(path)\r\n\r\n return prism(() => {\r\n return prism.source(subscribe, getValue)\r\n }) as Prism<P>\r\n }\r\n}\r\n", "import type {Prism} from './prism/Interface'\r\nimport type {Pointer, PointerType} from './pointer'\r\nimport {getPointerMeta} from './pointer'\r\nimport type {$IntentionalAny} from './types'\r\n\r\nconst identifyPrismWeakMap = new WeakMap<{}, Prism<unknown>>()\r\n\r\n/**\r\n * Interface for objects that can provide a prism at a certain path.\r\n */\r\nexport interface PointerToPrismProvider {\r\n /**\r\n * @internal\r\n * Future: We could consider using a `Symbol.for(\"dataverse/PointerToPrismProvider\")` as a key here, similar to\r\n * how {@link Iterable} works for `of`.\r\n */\r\n readonly $$isPointerToPrismProvider: true\r\n /**\r\n * Returns a prism of the value at the provided pointer.\r\n */\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P>\r\n}\r\n\r\nexport function isPointerToPrismProvider(\r\n val: unknown,\r\n): val is PointerToPrismProvider {\r\n return (\r\n typeof val === 'object' &&\r\n val !== null &&\r\n (val as $IntentionalAny)['$$isPointerToPrismProvider'] === true\r\n )\r\n}\r\n\r\n/**\r\n * Returns a prism of the value at the provided pointer. Prisms are\r\n * cached per pointer.\r\n *\r\n * @param pointer - The pointer to return the prism at.\r\n */\r\n\r\nexport const pointerToPrism = <P extends PointerType<$IntentionalAny>>(\r\n pointer: P,\r\n): Prism<P extends PointerType<infer T> ? T : void> => {\r\n const meta = getPointerMeta(pointer)\r\n\r\n let prismInstance = identifyPrismWeakMap.get(meta)\r\n if (!prismInstance) {\r\n const root = meta.root\r\n if (!isPointerToPrismProvider(root)) {\r\n throw new Error(\r\n `Cannot run pointerToPrism() on a pointer whose root is not an PointerToPrismProvider`,\r\n )\r\n }\r\n prismInstance = root.pointerToPrism(pointer as $IntentionalAny)\r\n identifyPrismWeakMap.set(meta, prismInstance)\r\n }\r\n return prismInstance as $IntentionalAny\r\n}\r\n", "import type {Prism} from './prism/Interface'\r\nimport {isPrism} from './prism/Interface'\r\nimport type {PointerType} from './pointer'\r\nimport {isPointer} from './pointer'\r\nimport type {$IntentionalAny} from './types'\r\nimport {pointerToPrism} from './pointerToPrism'\r\n\r\n/**\r\n * Convenience function that returns a plain value from its argument, whether it\r\n * is a pointer, a prism or a plain value itself.\r\n *\r\n * @remarks\r\n * For pointers, the value is returned by first creating a prism, so it is\r\n * reactive e.g. when used in a `prism`.\r\n *\r\n * @param input - The argument to return a value from.\r\n */\r\n\r\nexport const val = <\r\n P extends\r\n | PointerType<$IntentionalAny>\r\n | Prism<$IntentionalAny>\r\n | undefined\r\n | null,\r\n>(\r\n input: P,\r\n): P extends PointerType<infer T>\r\n ? T\r\n : P extends Prism<infer T>\r\n ? T\r\n : P extends undefined | null\r\n ? P\r\n : unknown => {\r\n if (isPointer(input)) {\r\n return pointerToPrism(input).getValue() as $IntentionalAny\r\n } else if (isPrism(input)) {\r\n return input.getValue() as $IntentionalAny\r\n } else {\r\n return input as $IntentionalAny\r\n }\r\n}\r\n", "import {Atom} from '@unseenco/theatre-dataverse'\r\n\r\nconst revisionAtom = new Atom(0)\r\n\r\n/** Bumped when GSAP animations register so Studio UI can refresh menus. */\r\nexport function bumpGsapStudioRegistryRevision(): void {\r\n revisionAtom.set(revisionAtom.get() + 1)\r\n}\r\n\r\nexport const gsapStudioRegistryRevisionPointer = revisionAtom.pointer\r\n", "import type {GsapClipBaselineTiming} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\nimport type SheetObject from '@unseenco/theatre-core/sheetObjects/SheetObject'\r\nimport type {\r\n ObjectAddressKey,\r\n ProjectId,\r\n SheetId,\r\n SheetInstanceId,\r\n} from '@unseenco/theatre-shared/utils/ids'\r\n\r\nconst DEFAULT_SHEET_INSTANCE_ID = 'default' as SheetInstanceId\r\nimport {buildGsapClipBaselineTiming} from './gsapClipBaseline'\r\nimport {registerGsapObjectBinding} from './gsapObjectBinding'\r\nimport {bumpGsapStudioRegistryRevision} from './gsapStudioRegistryRevision'\r\nimport {\r\n introspectGsapTimelineChildren,\r\n isGsapTimeline,\r\n linkGsapTimelineChildAnimations,\r\n} from './introspectGsapTimelineChildren'\r\nimport {readGsapTweenTimelineDuration} from './syncGsapClipProgress'\r\n\r\nconst REGISTRY_KEY = '__unseenco_theatre_gsap_animationRegistry__'\r\n\r\nexport type GsapAnimationRegistryEntry = {\r\n id: string\r\n label: string\r\n /** Runtime tween; typed in `@unseenco/theatre-gsap`. */\r\n animation?: unknown\r\n sheetObject?: SheetObject\r\n defaultDuration?: number\r\n kind?: 'tween' | 'timeline'\r\n timelineChildById?: Map<string, unknown>\r\n onRebuildTimeline?: () => unknown\r\n /** Introspected timing at registration; fallback when clip has no baselineTiming. */\r\n originalTiming?: GsapClipBaselineTiming\r\n}\r\n\r\ntype RegistryStore = {\r\n bySheetAddress: Map<string, Map<string, GsapAnimationRegistryEntry>>\r\n}\r\n\r\nexport type SheetObjectAddressKeyParts = {\r\n projectId: ProjectId\r\n sheetId: SheetId\r\n objectKey: ObjectAddressKey\r\n sheetInstanceId?: SheetInstanceId\r\n}\r\n\r\nexport function sheetObjectAddressKeyFromParts(\r\n address: SheetObjectAddressKeyParts,\r\n): string {\r\n const sheetInstanceId = address.sheetInstanceId ?? DEFAULT_SHEET_INSTANCE_ID\r\n return `${address.projectId}|${address.sheetId}|${sheetInstanceId}|${address.objectKey}`\r\n}\r\n\r\nexport function sheetObjectAddressKey(sheetObject: SheetObject): string {\r\n return sheetObjectAddressKeyFromParts(sheetObject.address)\r\n}\r\n\r\nfunction getStore(): RegistryStore {\r\n const g = globalThis as typeof globalThis & {\r\n [REGISTRY_KEY]?: RegistryStore\r\n }\r\n if (!g[REGISTRY_KEY]) {\r\n g[REGISTRY_KEY] = {\r\n bySheetAddress: new Map(),\r\n }\r\n }\r\n return g[REGISTRY_KEY]!\r\n}\r\n\r\nfunction getSheetEntryMap(\r\n sheetKey: string,\r\n): Map<string, GsapAnimationRegistryEntry> {\r\n const store = getStore()\r\n let map = store.bySheetAddress.get(sheetKey)\r\n if (!map) {\r\n map = new Map()\r\n store.bySheetAddress.set(sheetKey, map)\r\n }\r\n return map\r\n}\r\n\r\nexport function registerAnimationInRegistry(\r\n entry: GsapAnimationRegistryEntry,\r\n): void {\r\n const kind =\r\n entry.animation && isGsapTimeline(entry.animation) ? 'timeline' : 'tween'\r\n const timelineChildById =\r\n kind === 'timeline' && entry.animation\r\n ? linkGsapTimelineChildAnimations(entry.animation)\r\n : undefined\r\n const defaultDuration =\r\n entry.defaultDuration ?? readGsapTweenTimelineDuration(entry.animation)\r\n const timelineChildren =\r\n kind === 'timeline' && entry.animation\r\n ? introspectGsapTimelineChildren(entry.animation)\r\n : []\r\n const originalTiming =\r\n entry.originalTiming ??\r\n (entry.animation\r\n ? buildGsapClipBaselineTiming({\r\n duration: defaultDuration,\r\n ...(timelineChildren.length > 0\r\n ? {\r\n timelineSpan: readGsapTweenTimelineDuration(entry.animation),\r\n timelineChildren,\r\n }\r\n : {}),\r\n })\r\n : undefined)\r\n const normalized: GsapAnimationRegistryEntry = {\r\n ...entry,\r\n kind,\r\n timelineChildById,\r\n originalTiming,\r\n }\r\n\r\n if (entry.sheetObject) {\r\n const sheetKey = sheetObjectAddressKey(entry.sheetObject)\r\n getSheetEntryMap(sheetKey).set(entry.id, normalized)\r\n registerGsapObjectBinding(entry.sheetObject, {\r\n gsapAnimationId: entry.id,\r\n defaultDuration,\r\n })\r\n }\r\n\r\n bumpGsapStudioRegistryRevision()\r\n}\r\n\r\nexport function getAnimationEntryForAddress(\r\n address: SheetObjectAddressKeyParts,\r\n animationId?: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n const animId = animationId ?? address.objectKey\r\n const sheetKey = sheetObjectAddressKeyFromParts(address)\r\n return getStore().bySheetAddress.get(sheetKey)?.get(animId)\r\n}\r\n\r\nexport function getAnimationEntry(\r\n sheetObject: SheetObject,\r\n animationId?: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return getAnimationEntryForAddress(\r\n sheetObject.address,\r\n animationId ?? sheetObject.address.objectKey,\r\n )\r\n}\r\n\r\n/** Default registry entry for a GSAP sheet object (id defaults to `objectKey`). */\r\nexport function getAnimationEntryForSheetObject(\r\n sheetObject: SheetObject,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return getAnimationEntry(sheetObject)\r\n}\r\n\r\nexport function getAnimationEntryBySheetAddressKey(\r\n sheetObjectAddressKey: string,\r\n animationId: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return getStore().bySheetAddress.get(sheetObjectAddressKey)?.get(animationId)\r\n}\r\n\r\n/** @internal Prefer sheet-scoped lookup; scans all sheets when id alone is known. */\r\nexport function getAnimationEntryById(\r\n id: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n for (const byAnim of getStore().bySheetAddress.values()) {\r\n const entry = byAnim.get(id)\r\n if (entry) return entry\r\n }\r\n return undefined\r\n}\r\n\r\nexport function listAnimationEntries(): GsapAnimationRegistryEntry[] {\r\n const entries: GsapAnimationRegistryEntry[] = []\r\n for (const byAnim of getStore().bySheetAddress.values()) {\r\n entries.push(...byAnim.values())\r\n }\r\n return entries\r\n}\r\n\r\nexport function clearAnimationRegistryForTests(): void {\r\n getStore().bySheetAddress.clear()\r\n}\r\n", "import type {OutlineNamespaceConfig} from '@unseenco/theatre-shared/utils/outlineNamespaces'\r\nimport {setConfiguredGsapSheetObjectNamespace} from '@unseenco/theatre-shared/gsap/gsapSheetObjectKey'\r\n\r\nexport type TheatreGsapConfig = {\r\n /** Outline namespace segment for GSAP proxy objects (default `GSAP`). */\r\n namespace?: string\r\n /** Applied to each sheet when the first GSAP object is registered on it. */\r\n outlineNamespace?: OutlineNamespaceConfig\r\n}\r\n\r\nlet activeConfig: TheatreGsapConfig = {\r\n namespace: 'GSAP',\r\n outlineNamespace: {defaultCollapsed: false},\r\n}\r\n\r\nsetConfiguredGsapSheetObjectNamespace(activeConfig.namespace!)\r\n\r\nexport function configureTheatreGsap(config: TheatreGsapConfig): {\r\n reset: () => void\r\n} {\r\n const prev = activeConfig\r\n activeConfig = {\r\n namespace: config.namespace ?? prev.namespace ?? 'GSAP',\r\n outlineNamespace: config.outlineNamespace ?? prev.outlineNamespace,\r\n }\r\n setConfiguredGsapSheetObjectNamespace(activeConfig.namespace ?? 'GSAP')\r\n return {\r\n reset() {\r\n activeConfig = prev\r\n },\r\n }\r\n}\r\n\r\nexport function getTheatreGsapConfig(): TheatreGsapConfig {\r\n return activeConfig\r\n}\r\n", "import type SheetObject from '@unseenco/theatre-core/sheetObjects/SheetObject'\r\nimport type {GsapTweenLike} from './gsapTypes'\r\nimport {\r\n clearAnimationRegistryForTests as clearSharedAnimationRegistryForTests,\r\n getAnimationEntry as getSharedAnimationEntry,\r\n getAnimationEntryForSheetObject as getSharedAnimationEntryForSheetObject,\r\n listAnimationEntries as listSharedAnimationEntries,\r\n registerAnimationInRegistry as registerSharedAnimationInRegistry,\r\n} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport {readGsapTweenTimelineDuration} from '@unseenco/theatre-shared/gsap/syncGsapClipProgress'\r\n\r\nexport type GsapAnimationRegistryEntry = {\r\n id: string\r\n label: string\r\n animation: GsapTweenLike\r\n sheetObject?: SheetObject\r\n defaultDuration?: number\r\n onRebuildTimeline?: () => GsapTweenLike\r\n}\r\n\r\nexport function registerAnimationInRegistry(\r\n entry: GsapAnimationRegistryEntry,\r\n): void {\r\n registerSharedAnimationInRegistry({\r\n ...entry,\r\n animation: entry.animation,\r\n defaultDuration:\r\n entry.defaultDuration ??\r\n defaultClipDuration(entry.animation as GsapTweenLike),\r\n onRebuildTimeline: entry.onRebuildTimeline,\r\n })\r\n}\r\n\r\nfunction defaultClipDuration(animation: GsapTweenLike): number {\r\n return readGsapTweenTimelineDuration(animation)\r\n}\r\n\r\nfunction toPackageEntry(\r\n entry: ReturnType<typeof getSharedAnimationEntryForSheetObject>,\r\n): GsapAnimationRegistryEntry | undefined {\r\n if (!entry || !entry.animation) return undefined\r\n return {\r\n id: entry.id,\r\n label: entry.label,\r\n animation: entry.animation as GsapTweenLike,\r\n sheetObject: entry.sheetObject,\r\n defaultDuration: entry.defaultDuration,\r\n onRebuildTimeline: entry.onRebuildTimeline as\r\n | (() => GsapTweenLike)\r\n | undefined,\r\n }\r\n}\r\n\r\nexport function getAnimationEntry(\r\n sheetObject: SheetObject,\r\n animationId?: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(getSharedAnimationEntry(sheetObject, animationId))\r\n}\r\n\r\nexport function getAnimationEntryById(\r\n id: string,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(\r\n listSharedAnimationEntries().find((entry) => entry.id === id),\r\n )\r\n}\r\n\r\nexport function getAnimationEntryForSheetObject(\r\n sheetObject: SheetObject,\r\n): GsapAnimationRegistryEntry | undefined {\r\n return toPackageEntry(getSharedAnimationEntryForSheetObject(sheetObject))\r\n}\r\n\r\nexport function listAnimationEntries(): GsapAnimationRegistryEntry[] {\r\n return listSharedAnimationEntries()\r\n .filter((e): e is typeof e & {animation: GsapTweenLike} => !!e.animation)\r\n .map((entry) => ({\r\n id: entry.id,\r\n label: entry.label,\r\n animation: entry.animation as GsapTweenLike,\r\n sheetObject: entry.sheetObject,\r\n }))\r\n}\r\n\r\nexport function clearAnimationRegistryForTests(): void {\r\n clearSharedAnimationRegistryForTests()\r\n}\r\n", "import {validateAndSanitiseSlashedPathOrThrow} from '@unseenco/theatre-shared/utils/slashedPaths'\r\nimport type {SheetId} from '@unseenco/theatre-shared/utils/ids'\r\n\r\nexport type OutlineNamespaceConfig = {\r\n defaultCollapsed?: boolean\r\n collapsed?: boolean\r\n}\r\n\r\nexport function formatOutlineNamespacePathKey(pathSegments: string[]): string {\r\n return pathSegments.join(' / ')\r\n}\r\n\r\nexport function parseOutlineNamespacePath(\r\n namespacePath: string,\r\n fnName: string,\r\n): string[] {\r\n return validateAndSanitiseSlashedPathOrThrow(namespacePath, fnName).split(\r\n /\\s*\\/\\s*/g,\r\n )\r\n}\r\n\r\nexport function getOutlineNamespaceItemKey(\r\n sheetId: SheetId,\r\n pathSegments: string[],\r\n): string {\r\n return `namespace:${sheetId}:${pathSegments.join('/')}`\r\n}\r\n", "import type {ISheet} from '@unseenco/theatre-core'\r\nimport {privateAPI} from '@unseenco/theatre-core/privateAPIs'\r\nimport {sheetObjectAddressKeyFromParts} from '@unseenco/theatre-shared/gsap/gsapAnimationRegistry'\r\nimport type {ObjectAddressKey} from '@unseenco/theatre-shared/utils/ids'\r\nimport {subscribeGsapClipSyncAtPlayhead} from '@unseenco/theatre-shared/gsap/subscribeGsapClipSyncAtPlayhead'\r\n\r\n/**\r\n * Drives registered GSAP animations from the sheet sequence playhead.\r\n *\r\n * @returns Disposer \u2014 call to detach the bridge.\r\n */\r\nexport function attachGsapSequenceBridge(sheet: ISheet): () => void {\r\n const sequence = sheet.sequence\r\n const sheetAddress = privateAPI(sheet).address\r\n\r\n return subscribeGsapClipSyncAtPlayhead({\r\n pointer: sequence.pointer,\r\n getGsapClipTimings: () =>\r\n sequence.__experimental_getGsapClips().map(({objectKey, clip}) => ({\r\n sheetObjectAddressKey: sheetObjectAddressKeyFromParts({\r\n projectId: sheetAddress.projectId,\r\n sheetId: sheetAddress.sheetId,\r\n sheetInstanceId: sheetAddress.sheetInstanceId,\r\n objectKey: objectKey as ObjectAddressKey,\r\n }),\r\n gsapAnimationId: clip.gsapAnimationId,\r\n start: clip.start,\r\n duration: clip.duration,\r\n timelineChildren: clip.timelineChildren,\r\n timelineSpan: clip.timelineSpan,\r\n })),\r\n })\r\n}\r\n", "import type {GsapTimelineChildClip} from '@unseenco/theatre-core/projects/store/types/SheetState_Historic'\r\nimport type {GsapClipTiming} from './syncGsapClipProgress'\r\nimport {syncRegisteredGsapAnimationsForClips} from './syncGsapClipProgress'\r\n\r\nexport type GsapClipTimingSource = {\r\n sheetObjectAddressKey: string\r\n gsapAnimationId: string\r\n start: number\r\n duration: number\r\n timelineChildren?: ReadonlyArray<GsapTimelineChildClip>\r\n timelineSpan?: number\r\n}\r\n\r\n/** Drives registered GSAP tweens from sequence playhead + clip list. */\r\nexport function syncGsapClipsAtSequencePosition(\r\n position: number,\r\n clips: ReadonlyArray<GsapClipTimingSource>,\r\n): void {\r\n syncRegisteredGsapAnimationsForClips(\r\n position,\r\n clips as ReadonlyArray<GsapClipTiming>,\r\n )\r\n}\r\n", "import type {Pointer} from '@unseenco/theatre-dataverse'\r\nimport {pointerToPrism, prism, val} from '@unseenco/theatre-dataverse'\r\nimport type {GsapClipTimingSource} from './syncGsapClipsAtSequencePosition'\r\nimport {syncGsapClipsAtSequencePosition} from './syncGsapClipsAtSequencePosition'\r\n\r\nexport type GsapClipSyncSequenceSource = {\r\n readonly pointer: {readonly position: Pointer<number>}\r\n getGsapClipTimings(): ReadonlyArray<GsapClipTimingSource>\r\n}\r\n\r\n/**\r\n * Keeps registered GSAP tweens aligned with the sequence playhead and clip list.\r\n * Uses `onStale` so scrub clicks apply synchronously (not only on the next tick).\r\n */\r\nexport function subscribeGsapClipSyncAtPlayhead(\r\n source: GsapClipSyncSequenceSource,\r\n): () => void {\r\n const positionPointer = source.pointer.position\r\n const positionPrism = pointerToPrism(positionPointer)\r\n\r\n const clipsPrism = prism(() => source.getGsapClipTimings())\r\n\r\n const syncNow = () => {\r\n const clips = clipsPrism.getValue()\r\n if (clips.length === 0) return\r\n syncGsapClipsAtSequencePosition(val(positionPointer), clips)\r\n }\r\n\r\n const untapPosition = positionPrism.onStale(syncNow)\r\n const untapClips = clipsPrism.onStale(syncNow)\r\n\r\n syncNow()\r\n\r\n return () => {\r\n untapPosition()\r\n untapClips()\r\n }\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA;AAAA,yCAAAC;AAAA,EAAA;AAAA,8BAAAC;AAAA,EAAA;AAAA;AAAA;;;ACEA,yBAAyB;;;ACClB,IAAM,eAAN,cAA2B,MAAM;AAAC;AAMlC,IAAM,uBAAN,cAAmC,aAAa;AAAC;;;AC2CxD,SAAS,KAAK,GAAqB;AACjC,SAAO,SAAS,gBAAgB,GAAG,SAAS;AAC1C,WAAO,EAAE,GAAG,QAAQ,CAAC;AAAA,EACvB;AACF;AA4IA,IAAM,SAAS;AAAA,EACb,MAAM,WAAW,cAAiB;AAAA,EAClC,OAAO,WAAW,eAAkB;AAAA,EACpC,QAAQ,WAAW,gBAAmB;AAAA,EACtC,UAAU,WAAW,mBAAsB;AAAA,EAC3C,aAAa,WAAW,sBAAyB;AAAA,EACjD,QAAQ,WAAW,gBAAmB;AAAA,EACtC,OAAO,WAAW,eAAkB;AAAA,EACpC,SAAS,WAAW,kBAAqB;AAAA,EACzC,YAAY,WAAW,qBAAwB;AAAA,EAC/C,QAAQ,WAAW,gBAAmB;AAAA,EACtC,UAAU,WAAW,mBAAsB;AAAA,EAC3C,QAAQ,WAAW,eAAmB;AAAA,EACtC,UAAU,WAAW,kBAAsB;AAC7C;AAEA,SAAS,WAAW,OAAsC;AACxD,SAAO,OAAO,OAAO;AAAA,IACnB,UAAU,QAAQ,OAAO,gBAAkB,IACvC,aACA,QAAQ,OAAO,YAAa,IAC5B,QACA;AAAA,IACJ,UAAU,QAAQ,OAAO,uBAAyB,IAC9C,oBACA,QAAQ,OAAO,YAAc,IAC7B,SACA;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AS,yBAAyB,OAA2B;AAClE,QAAM,WAAW,MAAM;AACvB,QAAM,mBAAe,gCAAW,KAAK,EAAE;AAEvC,SAAO,gCAAgC;AAAA,IACrC,SAAS,SAAS;AAAA,IAClB,oBAAoB,MAClB,SAAS,4BAA4B,EAAE,IAAI,CAAC,EAAC,WAAW,KAAI,OAAO;AAAA,MACjE,uBAAuB,+BAA+B;AAAA,QACpD,WAAW,aAAa;AAAA,QACxB,SAAS,aAAa;AAAA,QACtB,iBAAiB,aAAa;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,MACD,iBAAiB,KAAK;AAAA,MACtB,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,MACf,kBAAkB,KAAK;AAAA,MACvB,cAAc,KAAK;AAAA,IACrB,EAAE;AAAA,EACN,CAAC;AACH;",
|
|
6
|
+
"names": ["getAnimationEntry", "getAnimationEntryForSheetObject", "listAnimationEntries", "ref", "source", "root", "Symbol", "objectProto", "nativeObjectToString", "symToStringTag", "funcProto", "objectProto", "funcToString", "hasOwnProperty", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "HASH_UNDEFINED", "Map", "INFINITY", "funcProto", "objectProto", "funcToString", "hasOwnProperty", "root", "state", "pushCollector", "popCollector", "startIgnoringDependencies", "stopIgnoringDependencies", "reportResolutionStart", "reportResolutionEnd", "root", "state", "val", "ref", "effect", "memo", "value", "setValue", "getValue", "scope", "sub", "getValue", "scope", "pointer", "scope", "val", "getValue", "val", "pointer", "root", "getStore", "sheetObjectAddressKey", "getStore", "registerAnimationInRegistry", "getAnimationEntry", "getAnimationEntryForSheetObject", "listAnimationEntries", "registerAnimationInRegistry", "import_privateAPIs", "source"]
|
|
7
7
|
}
|