eligius 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configuration-api.d.mts +107 -101
- package/dist/configuration-api.mjs +6 -6
- package/dist/configuration-api.mjs.map +1 -1
- package/dist/{engine-factory-39T5FByM.mjs → engine-factory-65BHSli8.mjs} +201 -230
- package/dist/engine-factory-65BHSli8.mjs.map +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/lint.d.mts +104 -100
- package/dist/lint.mjs +56 -26
- package/dist/lint.mjs.map +1 -1
- package/dist/{locale-manager-CJy3musb.d.mts → locale-manager-DY4_d4Zv.d.mts} +120 -135
- package/dist/metadata.d.mts +101 -101
- package/dist/metadata.mjs +5 -72
- package/dist/metadata.mjs.map +1 -1
- package/dist/{rolldown-runtime-CGzGPw9x.mjs → rolldown-runtime-DTOZ5ltL.mjs} +4 -4
- package/dist/runtime.d.mts +21 -2
- package/dist/runtime.mjs +1 -1
- package/jsonschema/eligius-configuration.json +3 -0
- package/jsonschema/operations/math.json +6 -27
- package/package.json +25 -15
- package/dist/engine-factory-39T5FByM.mjs.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["operationMetadata","uuidv4","uuidv4","uuidv4","operationMetadata","controllerMetadata","uuidv4","uuidv4","ops","ctrls","prvdrs","evtb"],"sources":["../src/operation/index.ts","../src/configuration/api/operation-lookup.ts","../src/configuration/api/sync-in-place.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/configuration/api/timeline-provider-settings-editor.ts","../src/util/merge-if-missing.ts","../src/configuration/api/configuration-factory.ts","../src/configuration/api/name-providers.ts","../src/configuration/api/subtitle-converter.ts","../src/configuration/api/subtitle-editor.ts","../src/controllers/index.ts","../src/eventbus/index.ts","../src/timelineproviders/index.ts","../src/importer/eligius-resource-importer.ts"],"sourcesContent":["export type {IAddClassOperationData} from '@operation/add-class.ts';\nexport {addClass} from '@operation/add-class.ts';\nexport type {IAddControllerToElementOperationData} from '@operation/add-controller-to-element.ts';\nexport {addControllerToElement} from '@operation/add-controller-to-element.ts';\nexport {addGlobalsToOperation} from '@operation/add-globals-to-operation.ts';\nexport type {IAnimateOperationData} from '@operation/animate.ts';\nexport {animate} from '@operation/animate.ts';\nexport type {IAnimateWithClassOperationData} from '@operation/animate-with-class.ts';\nexport {animateWithClass} from '@operation/animate-with-class.ts';\nexport type {IAnnounceToScreenReaderOperationData} from '@operation/announce-to-screen-reader.ts';\nexport {announceToScreenReader} from '@operation/announce-to-screen-reader.ts';\nexport {breakForEach} from '@operation/break-for-each.ts';\nexport type {IBroadcastEventOperationData} from '@operation/broadcast-event.ts';\nexport {broadcastEvent} from '@operation/broadcast-event.ts';\nexport type {ICalcOperationData} from '@operation/calc.ts';\nexport {calc} from '@operation/calc.ts';\nexport type {IClearElementOperationData} from '@operation/clear-element.ts';\nexport {clearElement} from '@operation/clear-element.ts';\nexport type {IClearOperationDataOperationData} from '@operation/clear-operation-data.ts';\nexport {clearOperationData} from '@operation/clear-operation-data.ts';\nexport type {\n IClearStorageOperationData,\n StorageType,\n} from '@operation/clear-storage.ts';\nexport {clearStorage} from '@operation/clear-storage.ts';\nexport type {ICompareDateOperationData} from '@operation/compare-date.ts';\nexport {compareDate} from '@operation/compare-date.ts';\nexport type {IConcatenateStringsOperationData} from '@operation/concatenate-strings.ts';\nexport {concatenateStrings} from '@operation/concatenate-strings.ts';\nexport {continueForEach} from '@operation/continue-for-each.ts';\nexport type {ICreateElementOperationData} from '@operation/create-element.ts';\nexport {createElement} from '@operation/create-element.ts';\nexport type {ICustomFunctionOperationData} from '@operation/custom-function.ts';\nexport {customFunction} from '@operation/custom-function.ts';\nexport type {IEndActionOperationData} from '@operation/end-action.ts';\nexport {endAction} from '@operation/end-action.ts';\nexport {endForEach} from '@operation/end-for-each.ts';\nexport {endWhen} from '@operation/end-when.ts';\nexport type {IExtendControllerOperationData} from '@operation/extend-controller.ts';\nexport {extendController} from '@operation/extend-controller.ts';\nexport type {IFilterArrayOperationData} from '@operation/filter-array.ts';\nexport {filterArray} from '@operation/filter-array.ts';\nexport type {IFindInArrayOperationData} from '@operation/find-in-array.ts';\nexport {findInArray} from '@operation/find-in-array.ts';\nexport type {IForEachOperationData} from '@operation/for-each.ts';\nexport {forEach} from '@operation/for-each.ts';\nexport type {IFormatDateOperationData} from '@operation/format-date.ts';\nexport {formatDate} from '@operation/format-date.ts';\nexport type {IFormatTextOperationData} from '@operation/format-text.ts';\nexport {formatText} from '@operation/format-text.ts';\nexport type {IGetAttributesFromElementOperationData} from '@operation/get-attributes-from-element.ts';\nexport {getAttributesFromElement} from '@operation/get-attributes-from-element.ts';\nexport type {IGetControllerFromElementOperationData} from '@operation/get-controller-from-element.ts';\nexport {getControllerFromElement} from '@operation/get-controller-from-element.ts';\nexport type {IGetControllerInstanceOperationData} from '@operation/get-controller-instance.ts';\nexport {getControllerInstance} from '@operation/get-controller-instance.ts';\nexport type {IGetCurrentTimeOperationData} from '@operation/get-current-time.ts';\nexport {getCurrentTime} from '@operation/get-current-time.ts';\nexport type {IGetElementDimensionsOperationData} from '@operation/get-element-dimensions.ts';\nexport {getElementDimensions} from '@operation/get-element-dimensions.ts';\nexport type {IGetFocusedElementOperationData} from '@operation/get-focused-element.ts';\nexport {getFocusedElement} from '@operation/get-focused-element.ts';\nexport type {IGetFormDataOperationData} from '@operation/get-form-data.ts';\nexport {getFormData} from '@operation/get-form-data.ts';\nexport type {IGetImportOperationData} from '@operation/get-import.ts';\nexport {getImport} from '@operation/get-import.ts';\nexport type {IGetQueryParamsOperationData} from '@operation/get-query-params.ts';\nexport {getQueryParams} from '@operation/get-query-params.ts';\nexport type {IGetScrollPositionOperationData} from '@operation/get-scroll-position.ts';\nexport {getScrollPosition} from '@operation/get-scroll-position.ts';\nexport type {IGetTextContentOperationData} from '@operation/get-text-content.ts';\nexport {getTextContent} from '@operation/get-text-content.ts';\nexport type {IHttpDeleteOperationData} from '@operation/http-delete.ts';\nexport {httpDelete} from '@operation/http-delete.ts';\nexport type {IHttpPostOperationData} from '@operation/http-post.ts';\nexport {httpPost} from '@operation/http-post.ts';\nexport type {IHttpPutOperationData} from '@operation/http-put.ts';\nexport {httpPut} from '@operation/http-put.ts';\nexport type {IInvokeObjectMethodOperationData} from '@operation/invoke-object-method.ts';\nexport {invokeObjectMethod} from '@operation/invoke-object-method.ts';\nexport type {IIsElementInViewportOperationData} from '@operation/is-element-in-viewport.ts';\nexport {isElementInViewport} from '@operation/is-element-in-viewport.ts';\nexport type {ILoadFromStorageOperationData} from '@operation/load-from-storage.ts';\nexport {loadFromStorage} from '@operation/load-from-storage.ts';\nexport type {ILoadJSONOperationData} from '@operation/load-json.ts';\nexport {loadJson} from '@operation/load-json.ts';\nexport type {ILogOperationData} from '@operation/log.ts';\nexport {log} from '@operation/log.ts';\nexport type {IMapArrayOperationData} from '@operation/map-array.ts';\nexport {mapArray} from '@operation/map-array.ts';\nexport type {IMathOperationData} from '@operation/math.ts';\nexport {math} from '@operation/math.ts';\nexport {otherwise} from '@operation/otherwise.ts';\nexport type {IRemoveClassOperationData} from '@operation/remove-class.ts';\nexport {removeClass} from '@operation/remove-class.ts';\nexport type {IRemoveControllerFromElementOperationData} from '@operation/remove-controller-from-element.ts';\nexport {removeControllerFromElement} from '@operation/remove-controller-from-element.ts';\nexport type {IRemoveElementOperationData} from '@operation/remove-element.ts';\nexport {removeElement} from '@operation/remove-element.ts';\nexport type {IRemovePropertiesFromOperationDataOperationData} from '@operation/remove-properties-from-operation-data.ts';\nexport {removePropertiesFromOperationData} from '@operation/remove-properties-from-operation-data.ts';\nexport type {IReparentElementOperationData} from '@operation/reparent-element.ts';\nexport {reparentElement} from '@operation/reparent-element.ts';\nexport type {IReplaceStringOperationData} from '@operation/replace-string.ts';\nexport {replaceString} from '@operation/replace-string.ts';\nexport type {IReplaceTextOperationData} from '@operation/replace-text.ts';\nexport {replaceText} from '@operation/replace-text.ts';\nexport type {IRequestActionOperationData} from '@operation/request-action.ts';\nexport {requestAction} from '@operation/request-action.ts';\nexport type {ISaveToStorageOperationData} from '@operation/save-to-storage.ts';\nexport {saveToStorage} from '@operation/save-to-storage.ts';\nexport type {IScrollToElementOperationData} from '@operation/scroll-to-element.ts';\nexport {scrollToElement} from '@operation/scroll-to-element.ts';\nexport type {IScrollToPositionOperationData} from '@operation/scroll-to-position.ts';\nexport {scrollToPosition} from '@operation/scroll-to-position.ts';\nexport type {ISelectElementOperationData} from '@operation/select-element.ts';\nexport {selectElement} from '@operation/select-element.ts';\nexport type {ISetDataOperationData} from '@operation/set-data.ts';\nexport {setData} from '@operation/set-data.ts';\nexport type {ISetElementAttributesOperationData} from '@operation/set-element-attributes.ts';\nexport {setElementAttributes} from '@operation/set-element-attributes.ts';\nexport type {ISetElementContentOperationData} from '@operation/set-element-content.ts';\nexport {setElementContent} from '@operation/set-element-content.ts';\nexport type {ISetFocusOperationData} from '@operation/set-focus.ts';\nexport {setFocus} from '@operation/set-focus.ts';\nexport type {ISetFormValueOperationData} from '@operation/set-form-value.ts';\nexport {setFormValue} from '@operation/set-form-value.ts';\nexport type {ISetGlobalDataOperationData} from '@operation/set-global-data.ts';\nexport {setGlobalData} from '@operation/set-global-data.ts';\nexport type {ISetOperationData} from '@operation/set-operation-data.ts';\nexport {setOperationData} from '@operation/set-operation-data.ts';\nexport type {ISetStyleOperationData} from '@operation/set-style.ts';\nexport {setStyle} from '@operation/set-style.ts';\nexport type {ISetVariableOperationData} from '@operation/set-variable.ts';\nexport {setVariable} from '@operation/set-variable.ts';\nexport type {ISortArrayOperationData} from '@operation/sort-array.ts';\nexport {sortArray} from '@operation/sort-array.ts';\nexport type {ISplitStringOperationData} from '@operation/split-string.ts';\nexport {splitString} from '@operation/split-string.ts';\nexport type {IStartActionOperationData} from '@operation/start-action.ts';\nexport {startAction} from '@operation/start-action.ts';\nexport type {ISubstringTextOperationData} from '@operation/substring-text.ts';\nexport {substringText} from '@operation/substring-text.ts';\nexport type {IToggleClassOperationData} from '@operation/toggle-class.ts';\nexport {toggleClass} from '@operation/toggle-class.ts';\nexport type {IToggleElementOperationData} from '@operation/toggle-element.ts';\nexport {toggleElement} from '@operation/toggle-element.ts';\nexport type {IToggleFormElementOperationData} from '@operation/toggle-form-element.ts';\nexport {toggleFormElement} from '@operation/toggle-form-element.ts';\nexport type * from '@operation/types.ts';\nexport type {IValidateFormOperationData} from '@operation/validate-form.ts';\nexport {validateForm} from '@operation/validate-form.ts';\nexport type {IWaitOperationData} from '@operation/wait.ts';\nexport {wait} from '@operation/wait.ts';\nexport type {IWhenOperationData} from '@operation/when.ts';\nexport {when} from '@operation/when.ts';\n","import type {\n ExtractOperationDataType,\n GetOperationByName,\n TOperationName,\n} from '@configuration/types.ts';\nimport * as operationMetadata from '@operation/metadata/index.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\n\n/**\n * An operation system name the fluent API accepts: a built-in operation name\n * (offered by autocompletion), or the name of a custom operation that was\n * passed to the `ConfigurationFactory` in its `customOperations` option.\n * Custom names are checked when the operation is added, not by the compiler.\n */\nexport type TFluentOperationName = TOperationName | (string & {});\n\n/**\n * The operation data the fluent API accepts for the operation `N`: the typed,\n * partial operation data of a built-in operation, or any operation data for a\n * custom operation.\n */\nexport type TFluentOperationData<N extends string> = N extends TOperationName\n ? Partial<ExtractOperationDataType<GetOperationByName<N>>>\n : TOperationData;\n\n/**\n * Operation names are validated against the generated operation metadata, not\n * against the operation implementations. The metadata is plain data, so the\n * fluent configuration API can be loaded in a DOM-less context (Node build\n * tools such as the Eligian compiler), where importing the implementations\n * would evaluate jQuery and throw.\n *\n * @param name the operation system name to check\n * @returns `true` when `name` is a built-in operation\n */\nexport function isKnownOperationName(name: string): name is TOperationName {\n return Object.hasOwn(operationMetadata, name);\n}\n\n/**\n * Throws when the given name is neither the system name of a built-in\n * operation nor one of the given custom operation names.\n *\n * @param name the operation system name to check\n * @param customOperationNames the custom operation names that are accepted as\n * well (the `ConfigurationFactory`'s `customOperations` option)\n * @throws Error when no operation with the given name exists. The message\n * suggests the closest built-in and custom names, and explains how to declare\n * a custom operation.\n */\nexport function assertKnownOperationName(\n name: string,\n customOperationNames?: ReadonlySet<string>\n): void {\n if (isKnownOperationName(name) || customOperationNames?.has(name)) {\n return;\n }\n\n const knownNames = [\n ...Object.keys(operationMetadata),\n ...(customOperationNames ?? []),\n ];\n const didYouMean = formatDidYouMean(\n findClosestNames(String(name), knownNames)\n );\n const hint =\n \"To add a custom operation, declare its name in the ConfigurationFactory options: new ConfigurationFactory(undefined, {customOperations: ['myOperation']}).\";\n throw Error(\n `Unknown operation: ${name}. ${didYouMean ? `${didYouMean} ` : ''}${hint}`\n );\n}\n\n/**\n * Maps operation functions to their system names, for the `...ByType` methods\n * of the fluent API. The map is filled by `register-operation-types.ts`, which\n * the browser entry point (`eligius`) loads. The DOM-free entry point\n * (`eligius/configuration-api`) does not load the operation implementations,\n * so the map stays empty there.\n *\n * The lookup is by function identity, not by `Function.name`, so it keeps\n * working when a minifier renames the operation functions.\n */\nconst operationNamesByType = new Map<unknown, TOperationName>();\n\n/**\n * Registers operation implementations by their system names, so that the\n * `...ByType` methods of the fluent API can map a function back to its name.\n *\n * @param operations a record of operation system names to operation functions\n */\nexport function registerOperationTypes(\n operations: Readonly<Record<string, unknown>>\n): void {\n for (const [name, operation] of Object.entries(operations)) {\n if (typeof operation === 'function' && isKnownOperationName(name)) {\n operationNamesByType.set(operation, name);\n }\n }\n}\n\n/**\n * Returns the system name of the given operation function.\n *\n * @param operationType the operation function\n * @param methodName the fluent API method that asks, used in the error message\n * @param nameBasedMethodName the method that takes a system name instead\n * @returns the system name of the operation\n * @throws Error when the operation function is not known\n */\nexport function getOperationNameByType(\n operationType: unknown,\n methodName: string,\n nameBasedMethodName: string\n): TOperationName {\n const name = operationNamesByType.get(operationType);\n if (name) {\n return name;\n }\n\n if (operationNamesByType.size === 0) {\n throw new Error(\n `${methodName}: the operation implementations are not loaded, so an operation function cannot be mapped to its name. ` +\n `Import the fluent API from the main 'eligius' entry, or call ${nameBasedMethodName}('<operationName>', ...) with the operation's system name.`\n );\n }\n\n throw new Error(`Operation class not found: ${String(operationType)}`);\n}\n","/**\n * Keys that are never copied into the target. Assigning `__proto__` through the\n * inherited accessor would replace a prototype (or, when the existing value is\n * read through it, write onto `Object.prototype`), and `constructor` and\n * `prototype` are the other two entry points of prototype pollution.\n */\nconst UNSAFE_KEYS: ReadonlySet<string> = new Set([\n '__proto__',\n 'constructor',\n 'prototype',\n]);\n\n/**\n * Makes `target` structurally equal to `source` while keeping the identity of\n * the objects and arrays inside `target` wherever possible.\n *\n * The fluent configuration API hands out editors that hold references to\n * objects inside the factory's configuration (an action, an operation, the\n * timeline provider settings). Replacing those objects with copies would\n * detach the editors, so updates are applied in place instead:\n *\n * - Plain objects are updated key by key; keys missing from `source` are removed.\n * - Array entries are matched by their string `id` when both sides have one,\n * otherwise by position. Matched entries are synced recursively and reused.\n * - Everything else is assigned from `source`.\n * - The keys `__proto__`, `constructor` and `prototype` are skipped at every\n * nesting level, also inside values that are inserted as they are, so data\n * from `JSON.parse` cannot pollute `Object.prototype`.\n *\n * `source` should be a value the caller owns (for example a deep copy), because\n * unmatched values from it are inserted into `target` as they are (after their\n * unsafe keys have been removed).\n *\n * @param target - The object to update in place\n * @param source - The desired state\n */\nexport function syncInPlace<T extends object>(target: T, source: T): void {\n if (target === source) {\n return;\n }\n removeUnsafeKeys(source, new WeakSet());\n if (Array.isArray(target) && Array.isArray(source)) {\n syncArray(target, source);\n return;\n }\n syncObject(\n target as Record<string, unknown>,\n source as Record<string, unknown>\n );\n}\n\n/**\n * Deletes the unsafe own keys from every plain object and array reachable from\n * `value`. Deleting an own `__proto__` data property is safe, it does not go\n * through the inherited accessor.\n */\nfunction removeUnsafeKeys(value: unknown, seen: WeakSet<object>): void {\n if (value === null || typeof value !== 'object' || seen.has(value)) {\n return;\n }\n seen.add(value);\n if (Array.isArray(value)) {\n for (const item of value) {\n removeUnsafeKeys(item, seen);\n }\n return;\n }\n if (!isPlainObject(value)) {\n return;\n }\n for (const key of Object.keys(value)) {\n if (UNSAFE_KEYS.has(key)) {\n delete value[key];\n } else {\n removeUnsafeKeys(value[key], seen);\n }\n }\n}\n\nfunction syncObject(\n target: Record<string, unknown>,\n source: Record<string, unknown>\n): void {\n for (const key of Object.keys(target)) {\n if (!Object.hasOwn(source, key)) {\n delete target[key];\n }\n }\n for (const key of Object.keys(source)) {\n if (UNSAFE_KEYS.has(key)) {\n continue;\n }\n // Only own values are synced into, never an inherited one\n const existing = Object.hasOwn(target, key) ? target[key] : undefined;\n target[key] = syncValue(existing, source[key]);\n }\n}\n\nfunction syncArray(target: unknown[], source: unknown[]): void {\n const byId = new Map<string, unknown>();\n for (const item of target) {\n const id = idOf(item);\n if (id !== undefined) {\n byId.set(id, item);\n }\n }\n\n const next = source.map((item, index) => {\n const id = idOf(item);\n const match = id !== undefined ? byId.get(id) : target[index];\n if (id !== undefined && match !== undefined) {\n byId.delete(id);\n }\n return syncValue(match, item);\n });\n\n target.length = 0;\n target.push(...next);\n}\n\nfunction syncValue(existing: unknown, incoming: unknown): unknown {\n if (Array.isArray(existing) && Array.isArray(incoming)) {\n syncArray(existing, incoming);\n return existing;\n }\n if (isPlainObject(existing) && isPlainObject(incoming)) {\n // Do not merge two different identified entities into one object\n const existingId = idOf(existing);\n const incomingId = idOf(incoming);\n if (existingId !== incomingId) {\n return incoming;\n }\n syncObject(existing, incoming);\n return existing;\n }\n return incoming;\n}\n\nfunction idOf(value: unknown): string | undefined {\n if (isPlainObject(value) && typeof value.id === 'string') {\n return value.id;\n }\n return undefined;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n // Object.prototype itself has a null prototype, but must never be written to\n if (value === Object.prototype) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n ExtractOperationDataType,\n IActionConfiguration,\n IEndableActionConfiguration,\n IEventActionConfiguration,\n ITimelineActionConfiguration,\n TOperationType,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {v4 as uuidv4} from 'uuid';\nimport {\n assertKnownOperationName,\n getOperationNameByType,\n type TFluentOperationData,\n type TFluentOperationName,\n} from './operation-lookup.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\n/**\n *\n * Container factory capable of creating the different kinds of actions.\n * For each type of action a dedicated factory will be returned.\n *\n */\nexport class ActionCreatorFactory {\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\n\n /**\n *\n * Starts the creation of an action in the `actions` list with the specified name\n *\n * @param name\n * @returns\n */\n createAction(name: string): EndableActionCreator {\n const creator = new EndableActionCreator(name, this);\n this.configurationfactory.addAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `initActions` list with the specified name\n *\n * @param name\n * @returns\n */\n createInitAction(name: string): EndableActionCreator {\n const creator = new EndableActionCreator(name, this);\n this.configurationfactory.addInitAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `eventActions` list with the specified name\n *\n * @param name\n * @param eventName the event that starts the action. Without it the action can\n * only be started by name (for example by a `DOMEventListenerController` or\n * `KeyboardController`).\n * @param eventTopic optional topic of the event\n * @returns\n */\n createEventAction(\n name: string,\n eventName?: string,\n eventTopic?: string\n ): ActionCreator {\n const creator = new ActionCreator(name, this);\n const config: Partial<IEventActionConfiguration> = creator.actionConfig;\n if (eventName !== undefined) {\n config.eventName = eventName;\n }\n if (eventTopic !== undefined) {\n config.eventTopic = eventTopic;\n }\n this.configurationfactory.addEventAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `timelineActions` list with the specified name and uri\n *\n * @param uri\n * @param name\n * @returns\n */\n createTimelineAction(uri: string, name: string): TimelineActionCreator {\n const creator = new TimelineActionCreator(name, this);\n this.configurationfactory.addTimelineAction(uri, creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Returns the fluent scope back to the `Configurationfactory`\n *\n * @returns\n */\n end() {\n return this.configurationfactory;\n }\n}\n\n/**\n *\n * A factory that assists in creating an action\n *\n */\nexport class ActionCreator<\n T extends IActionConfiguration = IActionConfiguration,\n> {\n actionConfig: T;\n\n /**\n *\n * Initializes an action configuration with the given name\n *\n * @param name\n * @param factory\n */\n constructor(\n name: string | undefined,\n private readonly factory: ActionCreatorFactory\n ) {\n this.actionConfig = {\n name: name ?? '',\n id: uuidv4(),\n startOperations: [],\n } as unknown as T;\n }\n\n /**\n *\n * The unique id of the action\n *\n * @returns\n */\n getId() {\n return this.actionConfig.id;\n }\n\n /**\n *\n * Sets the name of the action\n *\n * @param name\n * @returns\n * @throws Error when the action is in `actions` or `eventActions` and another\n * action in those lists already has the name\n */\n setName(name: string) {\n // Optional calls: a creator may be constructed with a stand-in factory\n this.factory.end?.()?.assertUniqueActionName?.(name, this.actionConfig);\n this.actionConfig.name = name;\n return this;\n }\n\n /**\n *\n * Passes a copy of the internal state of the `ActionCreator` to the given callback.\n * When the callback returns a configuration, it replaces the action configuration\n * in the `ConfigurationFactory`.\n *\n * @param callBack\n * @returns\n */\n getConfiguration(callBack: (config: T) => T) {\n const copy = deepCopy(this.actionConfig);\n const newConfig = callBack.call(this, copy);\n if (newConfig) {\n syncInPlace(this.actionConfig, deepCopy(newConfig));\n }\n return this;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addStartOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(operationClass: T, operationData: Dt) {\n return this.addStartOperation(\n getOperationNameByType(\n operationClass,\n 'addStartOperationByType',\n 'addStartOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addStartOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this._customOperationNames());\n\n const {startOperations} = this.actionConfig;\n startOperations.push({\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n });\n return this;\n }\n\n /**\n *\n * Returns the fluent scope back to the `ActionCreatorFactory`\n *\n * @returns\n */\n next() {\n return this.factory;\n }\n\n /**\n * The custom operation names of the `ConfigurationFactory`. Optional calls:\n * a creator may be constructed with a stand-in factory.\n */\n protected _customOperationNames(): ReadonlySet<string> | undefined {\n return this.factory.end?.()?.customOperationNames;\n }\n}\n\n/**\n *\n * A factory that assists in creating an endable action\n *\n */\nexport class EndableActionCreator<\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\n> extends ActionCreator<T> {\n constructor(name: string | undefined, factory: ActionCreatorFactory) {\n super(name, factory);\n this.actionConfig.endOperations = [];\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addEndOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(operationClass: T, operationData: Dt) {\n return this.addEndOperation(\n getOperationNameByType(\n operationClass,\n 'addEndOperationByType',\n 'addEndOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addEndOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this._customOperationNames());\n\n let {endOperations} = this.actionConfig;\n if (!endOperations) {\n endOperations = this.actionConfig.endOperations = [];\n }\n endOperations.push({\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n });\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in creating a timeline action\n *\n */\nexport class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {\n /**\n *\n * Sets the duration specified by the given start and optional end positions\n *\n * @param start\n * @param end\n * @returns\n * @throws Error when `end` is given and lower than `start`\n */\n addDuration(start: number, end?: number) {\n if (end !== undefined && start > end) {\n throw new Error(\n `addDuration: start (${start}) cannot be higher than end (${end})`\n );\n }\n this.actionConfig.duration = {\n start: start,\n };\n if (end !== undefined) {\n this.actionConfig.duration.end = end;\n }\n return this;\n }\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n ExtractOperationDataType,\n IActionConfiguration,\n IEndableActionConfiguration,\n IOperationConfiguration,\n ITimelineActionConfiguration,\n TOperationName,\n TOperationType,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport type * as operations from '@operation/index.ts';\nimport type {TOperation, TOperationData} from '@operation/types.ts';\nimport {isDefined} from 'ts-is-present';\nimport {v4 as uuidv4} from 'uuid';\nimport type {IDuration} from '../../types.ts';\nimport {\n assertKnownOperationName,\n getOperationNameByType,\n type TFluentOperationData,\n type TFluentOperationName,\n} from './operation-lookup.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\nfunction array_move(arr: any[], old_index: number, new_index: number) {\n if (new_index >= arr.length) {\n new_index = 0;\n } else if (new_index < 0) {\n new_index = arr.length - 1;\n }\n arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\n}\n\n/**\n *\n * A factory that assists in editing an action.\n *\n * The editor works directly on the action configuration that the `ConfigurationFactory` holds,\n * so every edit is reflected in the factory's configuration.\n *\n */\nexport class ActionEditor<\n T extends IActionConfiguration = IActionConfiguration,\n> {\n constructor(\n protected actionConfig: T,\n protected readonly configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Called by the `OperationEditor` after it has changed an operation.\n * Operations are edited in place, so there is nothing left to synchronize.\n */\n updateConfiguration() {}\n\n /**\n *\n * Passes a copy of the current action configuration to the given callback.\n * When the callback returns a configuration, it replaces the action configuration\n * in the factory.\n *\n * @param callBack\n * @returns\n */\n getConfiguration(callBack: (config: T) => T | undefined) {\n const copy = deepCopy(this.actionConfig);\n const newConfig = callBack.call(this, copy);\n if (newConfig) {\n syncInPlace(this.actionConfig, deepCopy(newConfig));\n }\n return this;\n }\n\n /**\n *\n * Sets the action name\n *\n * @param name\n * @returns\n * @throws Error when the action is in `actions` or `eventActions` and another\n * action in those lists already has the name\n */\n setName(name: string) {\n // Optional call: an editor may be constructed with a stand-in factory\n this.configurationFactory.assertUniqueActionName?.(name, this.actionConfig);\n this.actionConfig.name = name;\n return this;\n }\n\n /**\n *\n * Gets the action name\n *\n * @returns\n */\n getName() {\n return this.actionConfig.name;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addStartOperationByType<T extends TOperation<TOperationData>>(\n operationClass: T,\n operationData: Partial<ExtractOperationDataType<T>>\n ): OperationEditor<this, T> {\n return this.addStartOperation(\n getOperationNameByType(\n operationClass,\n 'addStartOperationByType',\n 'addStartOperation'\n ),\n operationData\n ) as OperationEditor<this, T>;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @param id\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addStartOperation<\n N extends TFluentOperationName,\n D extends TFluentOperationData<N>,\n >(\n systemName: N,\n operationData: D,\n id: string = uuidv4()\n ): OperationEditor<this, TOperation<TOperationData>> {\n assertKnownOperationName(systemName, this.getCustomOperationNames());\n\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n\n const newConfig = {\n id,\n systemName: systemName,\n operationData: deepCopy(operationData) as TOperationData,\n } as IOperationConfiguration<TOperationData>;\n\n startOperations.push(newConfig);\n\n this.actionConfig.startOperations = startOperations;\n\n return new OperationEditor<this, TOperation<TOperationData>>(\n newConfig,\n this\n );\n }\n\n /**\n *\n * Starts an editor for the start operation associated with the given id\n *\n * @param id\n * @returns\n */\n editStartOperation(id: string) {\n const {startOperations} = this.actionConfig;\n const operation = startOperations.find(o => o.id === id);\n\n if (isDefined(operation)) {\n return new OperationEditor<ActionEditor<T>, TOperation<TOperationData>>(\n operation,\n this\n );\n }\n\n throw new Error(`start operation not found for id ${id}`);\n }\n\n /**\n *\n * Removes the start operation associated with the given id\n *\n * @param id\n * @returns\n */\n removeStartOperation(id: string) {\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n const operation = startOperations.find(o => o.id === id);\n\n if (!operation) {\n throw new Error(`start operation not found for id ${id}`);\n }\n\n const idx = startOperations.indexOf(operation);\n\n if (idx > -1) {\n startOperations.splice(idx, 1);\n this.actionConfig.startOperations = startOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Moves the start operation associated with the given id in the given direction\n *\n * @param id\n * @param direction\n * @returns\n */\n moveStartOperation(id: string, direction: 'up' | 'down') {\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n const operation = startOperations.find(o => o.id === id);\n\n if (!operation) {\n throw new Error(`start operation not found for id ${id}`);\n }\n\n const idx = startOperations.indexOf(operation);\n\n if (idx > -1) {\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\n array_move(startOperations, idx, newIdx);\n this.actionConfig.startOperations = startOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Return the fluent scopt to the `ConfigurationFactory`\n *\n * @returns\n */\n next() {\n return this.configurationFactory;\n }\n\n /**\n * Returns the custom operation names that the `ConfigurationFactory` accepts\n * besides the built-in operations (its `customOperations` option).\n *\n * @returns the custom operation names, or `undefined` when the editor has no factory\n */\n getCustomOperationNames(): ReadonlySet<string> | undefined {\n // Optional chaining: an editor may be constructed with a stand-in factory\n return this.configurationFactory?.customOperationNames;\n }\n}\n\n/**\n *\n * A factory that assists in editing an endable action\n *\n */\nexport class EndableActionEditor<\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\n> extends ActionEditor<T> {\n /**\n *\n * Adds the operation data for a end operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addEndOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(\n operationClass: T,\n operationData: Dt\n ): OperationEditor<this, TOperationType> {\n return this.addEndOperation(\n getOperationNameByType(\n operationClass,\n 'addEndOperationByType',\n 'addEndOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addEndOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this.getCustomOperationNames());\n\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n\n const newConfig = {\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n };\n\n endOperations.push(newConfig);\n\n this.actionConfig.endOperations = endOperations;\n\n return new OperationEditor<this, (typeof operations)[TOperationName]>(\n newConfig,\n this\n );\n }\n\n /**\n *\n * Starts an editor for the end operation associated with the given id\n *\n * @param id\n * @returns\n */\n editEndOperation(id: string) {\n const {endOperations} = this.actionConfig;\n const operationConfig = endOperations.find(o => o.id === id);\n\n if (isDefined(operationConfig)) {\n return new OperationEditor<this>(operationConfig, this);\n }\n\n throw new Error(`operation not found for id ${id}`);\n }\n\n /**\n *\n * Removes the end operation associated with the given id\n *\n * @param id\n * @returns\n */\n removeEndOperation(id: string) {\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n const operation = endOperations.find(o => o.id === id);\n\n if (!isDefined(operation)) {\n throw new Error(`operation not found for id ${id}`);\n }\n\n const idx = endOperations.indexOf(operation);\n\n if (idx > -1) {\n endOperations.splice(idx, 1);\n this.actionConfig.endOperations = endOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Moves the end operation associated with the given id in the specified direction\n *\n * @param id\n * @param direction\n * @returns\n */\n moveEndOperation(id: string, direction: 'up' | 'down') {\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n const operation = endOperations.find(o => o.id === id);\n\n if (!isDefined(operation)) {\n throw new Error(`operation not found for id ${id}`);\n }\n\n const idx = endOperations.indexOf(operation);\n\n if (idx > -1) {\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\n array_move(endOperations, idx, newIdx);\n this.actionConfig.endOperations = endOperations;\n }\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in editing a timeline action\n *\n */\nexport class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {\n /**\n *\n * Sets the duration specified by the given start and optional end positions\n *\n * @param start\n * @param end\n * @returns\n */\n setDuration(start: number, end?: number) {\n if (end !== undefined && start > end) {\n throw Error('start position cannot be higher than end position');\n }\n\n const duration: IDuration = {\n start,\n };\n\n if (end !== undefined) {\n duration.end = end;\n }\n\n this.actionConfig.duration = duration;\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in editing an operation\n *\n */\nexport class OperationEditor<\n T extends ActionEditor,\n O extends TOperationType = TOperation<TOperationData>,\n> {\n constructor(\n private operationConfig: IOperationConfiguration<\n ExtractOperationDataType<O>\n >,\n private actionEditor: T\n ) {}\n\n /**\n *\n * Invokes the given callback with a copy of the internal state of the factory\n *\n * @param callBack\n * @returns\n */\n getConfiguration(\n callBack: (\n config: IOperationConfiguration<ExtractOperationDataType<O>>\n ) => IOperationConfiguration<ExtractOperationDataType<O>>\n ) {\n const copy = deepCopy(this.operationConfig);\n const newConfig = callBack.call(this, copy);\n\n if (newConfig) {\n syncInPlace(this.operationConfig, deepCopy(newConfig));\n }\n\n return this;\n }\n\n /**\n *\n * Gets the system name\n *\n * @returns\n */\n getSystemName() {\n return this.operationConfig.systemName;\n }\n\n /**\n *\n * Sets the system name\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n setSystemName(systemName: TFluentOperationName) {\n assertKnownOperationName(\n systemName,\n this.actionEditor.getCustomOperationNames?.()\n );\n\n this.operationConfig.systemName = systemName;\n this.actionEditor.updateConfiguration();\n return this;\n }\n\n /**\n *\n * Sets the operation data. The operation data is copied, so later changes to\n * the given object do not affect the configuration.\n *\n * @param operationData\n * @returns\n */\n setOperationData(operationData: ExtractOperationDataType<O>) {\n this.operationConfig.operationData = deepCopy(operationData);\n this.actionEditor.updateConfiguration();\n return this;\n }\n\n /**\n *\n * Sets the value on the current `operationData` with the given key\n *\n * @param key\n * @param value\n * @returns\n */\n setOperationDataItem(\n key: keyof ExtractOperationDataType<O>,\n value: ExtractOperationDataType<O>[keyof ExtractOperationDataType<O>]\n ) {\n // Copy on write, the current object may still be referenced elsewhere\n return this.setOperationData({\n ...(this.operationConfig.operationData ?? {}),\n [key]: value,\n } as ExtractOperationDataType<O>);\n }\n\n /**\n *\n * returns all of the defined property names on the current `operationData`\n *\n * @returns\n */\n getOperationDataKeys(): Array<keyof ExtractOperationDataType<O>> {\n const {operationData} = this.operationConfig;\n return (operationData ? Object.keys(operationData) : []) as Array<\n keyof ExtractOperationDataType<O>\n >;\n }\n\n /**\n *\n * Gets the value of the given key on the current `operationData`\n *\n * @param key\n * @returns\n */\n getOperationDataValue(key: keyof ExtractOperationDataType<O>) {\n const {operationData} = this.operationConfig;\n return operationData?.[key];\n }\n\n /**\n *\n * Returns the fluent scope back to the action editor\n *\n * @returns\n */\n next() {\n return this.actionEditor;\n }\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n IContainerProviderConfig,\n IPlaylistConfig,\n IPositionSourceConfig,\n ITimelineProviderSettings,\n TTimelineProviderSettings,\n} from '@configuration/types.ts';\nimport type {TimelineTypes} from '../../types.ts';\n\n/**\n * Default position source system names for convenience methods.\n */\nconst DEFAULT_POSITION_SOURCES: Record<string, string> = {\n raf: 'RafPositionSource',\n scroll: 'ScrollPositionSource',\n video: 'VideoPositionSource',\n};\n\n/**\n * Default container provider system name.\n */\nconst DEFAULT_CONTAINER_PROVIDER = 'DomContainerProvider';\n\n/**\n * Default playlist system name.\n */\nconst DEFAULT_PLAYLIST = 'SimplePlaylist';\n\nexport class TimelineProvidersSettingsEditor {\n constructor(\n private providersSettings: TTimelineProviderSettings,\n private configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Adds a new provider for the specified timeline type.\n *\n * @param timelineType - The timeline type (e.g., 'animation', 'mediaplayer')\n * @param positionSourceSystemName - System name of the position source class (default: 'RafPositionSource')\n * @returns A TimelineProviderSettingsEditor for further configuration\n */\n addProvider(\n timelineType: TimelineTypes,\n positionSourceSystemName = 'RafPositionSource'\n ) {\n if (this.providersSettings[timelineType]) {\n throw new Error(\n `Settings for a '${timelineType}' provider already exist`\n );\n }\n\n const settings: ITimelineProviderSettings = {\n positionSource: {systemName: positionSourceSystemName},\n };\n this.providersSettings[timelineType] = settings;\n return new TimelineProviderSettingsEditor(\n settings,\n this,\n this.configurationFactory\n );\n }\n\n editProvider(timelineType: TimelineTypes) {\n if (!this.providersSettings[timelineType]) {\n throw new Error(`No settings for a '${timelineType}' provider exist yet`);\n }\n\n return new TimelineProviderSettingsEditor(\n this.providersSettings[timelineType] as ITimelineProviderSettings,\n this,\n this.configurationFactory\n );\n }\n\n next() {\n return this.configurationFactory;\n }\n}\n\nexport class TimelineProviderSettingsEditor {\n constructor(\n private providerSettings: ITimelineProviderSettings,\n private providersSettingsEditor: TimelineProvidersSettingsEditor,\n private configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Sets the position source configuration with full config object.\n * @param config - Position source configuration with systemName and options\n */\n setPositionSource(config: IPositionSourceConfig) {\n this.providerSettings.positionSource = config;\n return this;\n }\n\n /**\n * Sets the position source by system name with optional configuration.\n * @param systemName - The position source class name (e.g., 'RafPositionSource')\n * @param options - Additional options passed to the position source constructor\n */\n setPositionSourceByName(\n systemName: string,\n options?: Record<string, unknown>\n ) {\n this.providerSettings.positionSource = {\n systemName,\n ...options,\n };\n return this;\n }\n\n /**\n * Convenience method to set position source using shorthand type names.\n * @param type - Shorthand type ('raf', 'scroll', 'video')\n * @param options - Type-specific options (`sources` and `poster` for video)\n * @deprecated Use setPositionSourceByName for explicit control\n */\n setPositionSourceType(\n type: 'raf' | 'scroll' | 'video',\n options?: {\n selector?: string;\n tickInterval?: number;\n poster?: string;\n sources?: Array<{src: string; type: string}>;\n }\n ) {\n const systemName = DEFAULT_POSITION_SOURCES[type];\n if (!systemName) {\n throw new Error(`Unknown position source type: ${type}`);\n }\n\n this.providerSettings.positionSource = {\n systemName,\n ...options,\n };\n return this;\n }\n\n /**\n * Sets the container provider configuration by selector.\n * Uses DomContainerProvider by default.\n * @param selector - CSS selector for the container element\n */\n setContainer(selector: string) {\n this.providerSettings.container = {\n systemName: DEFAULT_CONTAINER_PROVIDER,\n selector,\n };\n return this;\n }\n\n /**\n * Sets the container provider configuration with full config object.\n * @param config - Container provider configuration with systemName\n */\n setContainerConfig(config: IContainerProviderConfig) {\n this.providerSettings.container = config;\n return this;\n }\n\n /**\n * Sets the container provider by system name with options.\n * @param systemName - The container provider class name\n * @param options - Additional options passed to the container provider constructor\n */\n setContainerByName(systemName: string, options: Record<string, unknown>) {\n this.providerSettings.container = {\n systemName,\n ...options,\n } as IContainerProviderConfig;\n return this;\n }\n\n /**\n * Sets the playlist configuration.\n * Uses SimplePlaylist by default.\n * @param items - Array of playlist items\n * @param identifierKey - Key used to identify items (default: 'uri')\n */\n setPlaylist<T>(items: readonly T[], identifierKey = 'uri') {\n this.providerSettings.playlist = {\n systemName: DEFAULT_PLAYLIST,\n items,\n identifierKey,\n } as IPlaylistConfig;\n return this;\n }\n\n /**\n * Sets the playlist configuration with full config object.\n * @param config - Playlist configuration with systemName\n */\n setPlaylistConfig(config: IPlaylistConfig) {\n this.providerSettings.playlist = config;\n return this;\n }\n\n /**\n * Sets the playlist by system name with options.\n * @param systemName - The playlist class name\n * @param options - Additional options including items and identifierKey\n */\n setPlaylistByName(\n systemName: string,\n options: {items: unknown[]; identifierKey: string; [key: string]: unknown}\n ) {\n this.providerSettings.playlist = {\n systemName,\n ...options,\n } as IPlaylistConfig;\n return this;\n }\n\n next() {\n return this.providersSettingsEditor;\n }\n\n end() {\n return this.configurationFactory;\n }\n}\n","/**\n *\n * Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.\n *\n * This function is pure, so it returns a new instance that reflects the merging of the two objects.\n *\n * The merge is shallow.\n *\n * @param target\n * @param source\n * @returns\n */\nexport const mergeIfMissing = <\n Src extends Record<PropertyKey, any>,\n Trg extends Partial<Src> & Record<PropertyKey, any>,\n>(\n target: Src,\n source: Trg\n): Src & Trg =>\n Object.entries(source).reduce(\n (acc, [key, value]) => (key in acc ? acc : {...acc, [key]: value}),\n target\n );\n","import {ActionCreatorFactory} from '@configuration/api/action-creator-factory.ts';\nimport {\n ActionEditor,\n EndableActionEditor,\n TimelineActionEditor,\n} from '@configuration/api/action-editor.ts';\nimport {TimelineProvidersSettingsEditor} from '@configuration/api/timeline-provider-settings-editor.ts';\nimport type {\n IActionConfiguration,\n IContainerProviderConfig,\n IEngineConfiguration,\n IPositionSourceConfig,\n ITimelineActionConfiguration,\n ITimelineConfiguration,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {mergeIfMissing} from '@util/merge-if-missing.ts';\nimport {v4 as uuidv4} from 'uuid';\nimport type {KeysOfType, TimelineTypes, TLanguageCode} from '../../types.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\n/** */\nexport type TEngineConfigurationLists = KeysOfType<IEngineConfiguration, any[]>;\n\n/**\n * Action names must be unique across these lists.\n */\nconst UNIQUE_NAME_LISTS: TEngineConfigurationLists[] = [\n 'actions',\n 'eventActions',\n];\n\n/**\n * Options for the {@link ConfigurationFactory} constructor.\n */\nexport interface IConfigurationFactoryOptions {\n /**\n * The system names of custom operations that the name based methods\n * (`addStartOperation`, `addEndOperation`, `setSystemName`) accept besides\n * the built-in operations. Only names are needed, so this works in the\n * DOM-free `eligius/configuration-api` entry as well.\n *\n * The implementations are registered with the engine separately, for\n * example `new EligiusResourceImporter({operations: {trackEvent}})`. Custom\n * operations have no generated metadata, so their operation data is not\n * typed or schema-validated.\n */\n customOperations?: readonly string[];\n}\n\nfunction toCustomOperationNames(\n customOperations: readonly string[] | undefined\n): ReadonlySet<string> {\n if (customOperations === undefined) {\n return new Set();\n }\n if (!Array.isArray(customOperations)) {\n throw new Error(\n 'ConfigurationFactory: options.customOperations must be an array of operation names.'\n );\n }\n for (const [index, name] of customOperations.entries()) {\n if (typeof name !== 'string' || !name.length) {\n throw new Error(\n `ConfigurationFactory: options.customOperations[${index}] must be a non-empty string.`\n );\n }\n }\n return new Set(customOperations);\n}\n\ntype ConfigurationFactoryExtension<NewFactory extends ConfigurationFactory> = (\n this: NewFactory,\n ...rest: any[]\n) => void;\n\n/**\n * This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.\n *\n * @example Building a configuration using the factory\n * To initialize a basic configuration to start off of:\n * ```ts\n * const factory = new ConfigurationFactory()\n * .init(\"en-US\") // Define the default language\n * .addLanguage(\"en-US\", \"English\") // Add English as a supported language\n * .addLanguage(\"nl-NL\", \"Nederlands\") // Add Dutch as a supported language\n * .setLayoutTemplate(\"<div class=\\\"main.container\\\"></div>\") // Add the main container for the presentation\n * .setContainerSelector(\"#ct-container\") // Selector for the element in the body that will contain the presentation\n * .addTimeline( // Add a first timeline\n * 'timeline-1', // Give it a name\n * \"animation\", // This is RAF based timeline\n * 200, // The duration of the timeline in seconds\n * false, // The presentation does NOT play in a loop\n * \".timeline-container\" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered\n * )\n * .editTimelineProviderSettings() // Add a timeline provider\n * .addProvider(\"animation\", \"RafPositionSource\") // Timelines of type 'animation' get their time from requestAnimationFrame\n * .setContainer(\".timeline-container\") // The element the timeline renders into\n * .end(); // This finally returns the ConfigurationFactory instance\n * ```\n *\n * Then to add an init action:\n * ```ts\n * factory\n * .createInitAction(\"GetUserName\")\n * .addStartOperationByType(getQueryParams, {\n * defaultValues: { username: \"guest\" },\n * })\n * .addStartOperationByType(setGlobalData, { properties: [\"queryParams\"] });\n * ```\n *\n * After that, add a timeline action:\n * ```ts\n * factory.createTimelineAction(\"timeline-1\", \"AddIntroContainer\")\n * .addDuration(0, 10)\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\n * .addStartOperationByType(setElementContent, {\n * template: '<div class=\"intro-text\"></div>',\n * })\n * .addEndOperationByType(selectElement, { selector: \".intro-text\" })\n * .addEndOperationByType(removeElement, {});\n * ```\n *\n * It also possible to extend the factory with specialized creation methods for the particular\n * configuration you are building:\n * ```ts\n * function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {\n * this.createInitAction(actionName)\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\n * .addStartOperationByType(createElement, { elementName: 'img', attributes: {src: imageSrc, id: imageId} })\n * .addStartOperationByType(setElementContent, { insertionType: \"append\" })\n * .addEndOperationByType(selectElement, { selector: `#${imageId}` })\n * .addEndOperationByType(removeElement, {});\n * }\n *\n * const customFactory = ConfigurationFactory.extend(factory, \"addImage\", addImage);\n *\n * customFactory.addImage(\"MyImageActionName\", \"my-image.png\", \"my-image-id\");\n * ```\n *\n * Finally, retrieve the configuration and save it:\n * ```ts\n * import fs from \"node:fs\";\n *\n * const configuration = customFactory.getConfiguration();\n *\n * fs.writeFileSync(\"/my/path/configuration.json\", JSON.stringify(configuration), {encoding:'utf-8'})\n * ```\n *\n * In plain Node (build tools, code generators) import the factory from `eligius/configuration-api`.\n * That entry does not load jQuery or the other DOM dependencies. It supports every method except the\n * `...ByType` ones, which need the operation implementations; use the name based methods there:\n * ```ts\n * import {ConfigurationFactory} from 'eligius/configuration-api';\n *\n * factory.createAction('MyAction').addStartOperation('selectElement', {selector: '#app'});\n * ```\n *\n * The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply\n * pass the JSON configuration to the `ConfigurationFactory`'s constructor:\n * ```ts\n * import myConfiguration from './my-configuration.json';\n *\n * const factory = new ConfigurationFactory(myConfiguration);\n *\n * factory.editInitAction(\"existingActionName\")\n * .removeEndOperation(\"475fd0ab-5755-4e60-8f7c-e1988a109678\");\n * ```\n */\nexport class ConfigurationFactory {\n actionCreatorFactory: ActionCreatorFactory;\n\n /**\n * The custom operation names this factory accepts besides the built-in\n * operations, from the `customOperations` option.\n */\n readonly customOperationNames: ReadonlySet<string>;\n\n /**\n * Constructs a new `ConfigurationFactory`\n * @param configuration an optional existing configuration that will be used as a starting point\n * @param options optional settings, see {@link IConfigurationFactoryOptions}\n * @throws Error when `options.customOperations` is not an array of non-empty strings\n *\n * @example Accepting a custom operation\n * ```ts\n * const factory = new ConfigurationFactory(undefined, {customOperations: ['trackEvent']});\n * factory.createAction('Track').addStartOperation('trackEvent', {category: 'intro'});\n * ```\n */\n constructor(\n public configuration: IEngineConfiguration = {} as any,\n options: IConfigurationFactoryOptions = {}\n ) {\n this.customOperationNames = toCustomOperationNames(\n options?.customOperations\n );\n this.actionCreatorFactory = new ActionCreatorFactory(this);\n }\n\n /**\n * Add specialized method to a factory\n *\n * @param factory\n * @param extensionMethodName\n * @param extensionMethod\n * @returns\n */\n static extend<\n T extends ConfigurationFactory,\n K extends PropertyKey,\n C extends (this: T & {[P in K]: C}, ...args: any[]) => any,\n >(factory: T, extensionMethodName: K, extensionMethod: C): T & {[P in K]: C} {\n return Object.defineProperty<T & {[P in K]: C}>(\n factory as any,\n extensionMethodName,\n {\n value: function (this: T & {[P in K]: C}, ...args: Parameters<C>) {\n return extensionMethod.apply(this, args);\n },\n writable: true,\n configurable: true,\n }\n );\n }\n\n /**\n * Add specialized methods to a factory\n *\n * @param factory\n * @param extensions\n * @returns\n */\n static extendMultiple<\n T extends ConfigurationFactory,\n C extends ConfigurationFactoryExtension<T>,\n D extends {[name: string]: C},\n >(factory: T, extensions: D) {\n return Object.entries(extensions).reduce<T & typeof extensions>(\n (acc, [name, method]) =>\n ConfigurationFactory.extend(acc, name, method) as T & typeof extensions,\n factory as T & typeof extensions\n );\n }\n\n /**\n * Initialize the configuration with a minimal shape.\n *\n * It assigns an ID, sets the engine to `EligiusEngine`, default the containerSelector `[data-ct-container=true]`\n * and initializes all of the list properties with empty arrays.\n * @param defaultLanguage\n * @returns\n */\n init(defaultLanguage: TLanguageCode) {\n const newConfiguration: IEngineConfiguration = {\n id: uuidv4(),\n engine: {\n systemName: 'EligiusEngine',\n },\n containerSelector: '[data-ct-container=true]',\n cssFiles: [],\n timelineProviderSettings: {},\n language: defaultLanguage,\n availableLanguages: [],\n layoutTemplate: '',\n initActions: [],\n actions: [],\n timelines: [],\n };\n\n this.configuration = mergeIfMissing(this.configuration, newConfiguration);\n\n return this;\n }\n\n /**\n * Assigns the engine system name\n * @param systemName\n * @returns\n */\n setEngine(systemName: string) {\n this.configuration.engine.systemName = systemName;\n return this;\n }\n\n /**\n * Assigns a string representation of the HTML layout template for the engine.\n *\n * @param layoutTemplate\n * @returns\n */\n setLayoutTemplate(layoutTemplate: string) {\n this.configuration.layoutTemplate = layoutTemplate;\n return this;\n }\n\n /**\n *\n * Assigns the default language\n *\n * @param defaultLanguage\n * @returns\n */\n setDefaultLanguage(defaultLanguage: TLanguageCode) {\n this.configuration.language = defaultLanguage;\n return this;\n }\n\n /**\n *\n * Assign the css selector that specifies the DOM location where the engine renders its output\n *\n * @param selector\n * @returns\n */\n setContainerSelector(selector: string) {\n this.configuration.containerSelector = selector;\n return this;\n }\n\n /**\n *\n * Starts an editing process for the timeline provider settings.\n *\n * @returns\n */\n editTimelineProviderSettings() {\n this.configuration.timelineProviderSettings ??= {};\n return new TimelineProvidersSettingsEditor(\n this.configuration.timelineProviderSettings,\n this\n );\n }\n\n /**\n *\n * Return a copy of the current state of the configuration\n *\n * @param callBack the callback receives a copy of the configuration and can return a changed version. The changes are applied to the factory's configuration in place, so editors that are still open keep working.\n * @returns\n */\n getConfiguration(\n callBack?: (copy: IEngineConfiguration) => IEngineConfiguration\n ) {\n const copy = deepCopy<IEngineConfiguration>(this.configuration);\n if (callBack) {\n const newConfig = callBack.call(this, copy);\n // Update the existing configuration in place, so editors that hold\n // objects inside it stay attached to the factory.\n syncInPlace(\n this.configuration,\n deepCopy<IEngineConfiguration>(newConfig)\n );\n }\n return copy;\n }\n\n /**\n *\n * Adds a language to the `availableLanguages` list.\n * The label represents the name of the language.\n *\n * An error is thrown if a language with the given language code already exists\n *\n * @example\n * factory.addLanguage('en-GB', 'English');\n *\n * @param languageCode The given alnguage code\n * @param languageLabel The human readable name of the language\n * @returns\n */\n addLanguage(languageCode: TLanguageCode, languageLabel: string) {\n const languages = this._initializeCollection(\n this.configuration,\n 'availableLanguages'\n );\n const existing = languages.find(lang => lang.languageCode === languageCode);\n\n if (existing) {\n throw new Error(`Language code '${languageCode}' already exists`);\n }\n\n languages.push({\n id: uuidv4(),\n languageCode: languageCode,\n label: languageLabel,\n });\n return this;\n }\n\n private _internalAddAction(\n collectionName: TEngineConfigurationLists,\n action: IActionConfiguration\n ) {\n if (UNIQUE_NAME_LISTS.includes(collectionName)) {\n this._assertActionNameFree(action.name, action);\n }\n const actions = this._initializeCollection(\n this.configuration,\n collectionName\n );\n actions?.push(action as any);\n }\n\n /**\n * Throws when the given action is in `actions` or `eventActions` and another\n * action in those lists already has the given name. Action names must be\n * unique across those two lists, the rule the `ConfigurationResolver`\n * enforces, so the fluent API reports a duplicate where it is made instead of\n * when the engine is created. Init actions and timeline actions are not\n * checked.\n *\n * Called by the action creators and editors before they rename an action.\n *\n * @param name the new action name\n * @param action the action that gets the name\n * @throws Error when the name is already taken\n */\n assertUniqueActionName(name: string, action: IActionConfiguration): void {\n const isChecked = UNIQUE_NAME_LISTS.some(listName =>\n (\n this.configuration[listName] as IActionConfiguration[] | undefined\n )?.includes(action)\n );\n if (isChecked) {\n this._assertActionNameFree(name, action);\n }\n }\n\n private _assertActionNameFree(name: string, action: IActionConfiguration) {\n // Empty names are not checked, so an action can be created first and named later\n if (!name) {\n return;\n }\n const taken = UNIQUE_NAME_LISTS.some(listName =>\n (\n this.configuration[listName] as IActionConfiguration[] | undefined\n )?.some(other => other !== action && other.name === name)\n );\n if (taken) {\n throw new Error(\n `Action name '${name}' already exists in actions or eventActions. Action names must be unique across actions and eventActions.`\n );\n }\n }\n\n private _initializeCollection<T, K extends keyof T>(\n parent: T,\n name: K\n ): T[K] {\n if (!parent[name]) {\n (parent[name] as any) = [];\n }\n return parent[name] as T[K];\n }\n\n /**\n *\n * Adds the specified action to the `actions` list.\n *\n * @param action\n */\n addAction(action: IActionConfiguration) {\n this._internalAddAction('actions', action);\n }\n\n /**\n *\n * Adds the specified action to the `initActions` list\n *\n * @param action\n */\n addInitAction(action: IActionConfiguration) {\n this._internalAddAction('initActions', action);\n }\n\n /**\n *\n * Adds the specified action to the `eventActions` list\n *\n * @param action\n */\n addEventAction(action: IActionConfiguration) {\n this._internalAddAction('eventActions', action);\n }\n\n /**\n *\n * Adds the given actions to `timelineActions` list that is associated with the specified uri\n *\n * @param uri\n * @param action\n */\n addTimelineAction(uri: string, action: ITimelineActionConfiguration) {\n const timeline = this.getTimeline(uri);\n if (timeline) {\n const timelineActions = this._initializeCollection(\n timeline,\n 'timelineActions'\n );\n timelineActions.push(action);\n } else {\n throw Error(`No timeline found for uri '${uri}'`);\n }\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `actions` list\n *\n * @param name\n * @returns\n */\n createAction(name: string) {\n return this.actionCreatorFactory.createAction(name);\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `initActions` list\n *\n * @param name\n * @returns\n */\n createInitAction(name: string) {\n return this.actionCreatorFactory.createInitAction(name);\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `eventActions` list\n *\n * @param name\n * @param eventName the event that starts the action. Without it the action can\n * only be started by name (for example by a `DOMEventListenerController` or\n * `KeyboardController`).\n * @param eventTopic optional topic of the event\n * @returns\n *\n * @example\n * ```ts\n * factory\n * .createEventAction('OnLanguageChange', 'language-change')\n * .addStartOperation('log', {});\n * ```\n */\n createEventAction(name: string, eventName?: string, eventTopic?: string) {\n return this.actionCreatorFactory.createEventAction(\n name,\n eventName,\n eventTopic\n );\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `timelineActions` list that is associated with the specified uri\n *\n * @param uri\n * @param name\n * @returns\n */\n createTimelineAction(uri: string, name: string) {\n return this.actionCreatorFactory.createTimelineAction(uri, name);\n }\n\n /**\n * Add a timeline with the given data\n *\n * @param uri identifier for the timeline\n * @param type animation or mediaplayer\n * @param duration the duration of the timeline in seconds\n * @param isLooped True if the timeline should automatically restart at the end\n * @param selector css selector for the container where the timeline will be rendered\n * @returns\n */\n addTimeline(\n uri: string,\n type: TimelineTypes,\n duration: number,\n isLooped: boolean,\n selector: string\n ) {\n const timelines = this._initializeCollection(\n this.configuration,\n 'timelines'\n );\n const timeline = this.getTimeline(uri);\n if (timeline) {\n throw Error(`timeline for uri ${uri} already exists`);\n }\n const timelineConfig: ITimelineConfiguration = {\n id: uuidv4(),\n type: type,\n uri: uri,\n duration: duration,\n loop: isLooped,\n selector: selector,\n timelineActions: [],\n };\n timelines.push(timelineConfig);\n return this;\n }\n\n /**\n * Gives the timeline its own position source settings, merged over the\n * settings of its type in `timelineProviderSettings` (see\n * `ITimelineConfiguration.positionSource`).\n *\n * @param uri - URI of the timeline\n * @param positionSource - The override. Leave out `systemName` to change\n * single settings of the type's position source, or name another class to\n * replace it for this timeline. `undefined` removes the override.\n * @returns The factory\n * @throws Error when no timeline has the URI\n *\n * @example\n * ```ts\n * factory\n * .addTimeline('intro', 'animation', 10, false, '#intro')\n * .addTimeline('chapter-1', 'animation', 60, false, '#chapter-1')\n * .setTimelinePositionSource('chapter-1', {\n * systemName: 'ScrollPositionSource',\n * selector: '#chapter-1',\n * });\n * ```\n */\n setTimelinePositionSource(\n uri: string,\n positionSource: Partial<IPositionSourceConfig> | undefined\n ) {\n const timeline = this._requireTimeline(uri, 'setTimelinePositionSource');\n if (positionSource === undefined) {\n delete timeline.positionSource;\n } else {\n timeline.positionSource = deepCopy(positionSource);\n }\n return this;\n }\n\n /**\n * Gives the timeline its own container provider settings, merged over the\n * `container` settings of its type in `timelineProviderSettings` (see\n * `ITimelineConfiguration.containerProvider`).\n *\n * @param uri - URI of the timeline\n * @param containerProvider - The override, for example\n * `{selector: '#chapter-1'}`. `undefined` removes the override.\n * @returns The factory\n * @throws Error when no timeline has the URI\n */\n setTimelineContainerProvider(\n uri: string,\n containerProvider: Partial<IContainerProviderConfig> | undefined\n ) {\n const timeline = this._requireTimeline(uri, 'setTimelineContainerProvider');\n if (containerProvider === undefined) {\n delete timeline.containerProvider;\n } else {\n timeline.containerProvider = deepCopy(containerProvider);\n }\n return this;\n }\n\n private _requireTimeline(uri: string, methodName: string) {\n const timeline = this.configuration.timelines\n ? this.getTimeline(uri)\n : undefined;\n if (!timeline) {\n throw new Error(\n `ConfigurationFactory.${methodName}: no timeline found for uri '${uri}'`\n );\n }\n return timeline;\n }\n\n /**\n *\n * Gets the timeline associated with the specified uri\n *\n * @param uri\n * @returns\n */\n getTimeline(uri: string) {\n return this.configuration.timelines.find(t => t.uri === uri);\n }\n\n /**\n *\n * Removes the timeline associated with the specified uri\n *\n * @param uri\n * @returns\n */\n removeTimeline(uri: string) {\n const timelineConfig = this.getTimeline(uri);\n if (timelineConfig) {\n const idx = this.configuration.timelines.indexOf(timelineConfig);\n if (idx > -1) {\n this.configuration.timelines.splice(idx, 1);\n }\n }\n return this;\n }\n\n /**\n *\n * Starts an editor for the action from the `actions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editAction(id: string) {\n const actionConfig = this.configuration.actions.find(a => a.id === id);\n if (actionConfig) {\n return new EndableActionEditor(actionConfig, this);\n }\n throw new Error(`Action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `eventActions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editEventAction(id: string) {\n const actionConfig = this.configuration.eventActions?.find(\n a => a.id === id\n );\n if (actionConfig) {\n return new ActionEditor(actionConfig, this);\n }\n throw new Error(`Event action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `initActions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editInitAction(id: string) {\n const actionConfig = this.configuration.initActions.find(a => a.id === id);\n if (actionConfig) {\n return new EndableActionEditor(actionConfig, this);\n }\n throw new Error(`Init action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `timelineActions` list associated with the given uri and id\n *\n * @param uri\n * @param id\n * @returns\n */\n editTimelineAction(uri: string, id: string) {\n const timeline = this.getTimeline(uri);\n if (!timeline) {\n throw new Error(`No timeline found for uri '${uri}'`);\n }\n const actionConfig = timeline.timelineActions.find(a => a.id === id);\n if (actionConfig) {\n return new TimelineActionEditor(actionConfig, this);\n }\n throw new Error(\n `Timeline action not found for id '${id}' in timeline '${uri}'`\n );\n }\n}\n","import type {TControllerName, TOperationName} from '@configuration/types.ts';\nimport * as controllerMetadata from '@controllers/metadata/index.ts';\nimport * as operationMetadata from '@operation/metadata/index.ts';\nimport type {IOperationMetadata} from '@operation/metadata/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\n\n// The providers read the generated metadata instead of the operation and\n// controller implementations, so they work in a DOM-less context. The metadata\n// has one entry per operation and per controller.\n\n/**\n *\n * Provider for all the available operation names\n *\n */\nexport class OperationNamesProvider {\n getOperationNames(): TOperationName[] {\n return Object.keys(operationMetadata) as TOperationName[];\n }\n}\n\n/**\n *\n * Provider for all the available controller names\n *\n */\nexport class ControllerNamesProvider {\n getControllerNames(): TControllerName[] {\n return Object.keys(controllerMetadata) as TControllerName[];\n }\n}\n\n/**\n *\n * Provider that can retrieve the metadata associated with a given operation name\n *\n */\nexport class OperationMetadataProvider {\n getOperationMetadata(operationName: TOperationName) {\n const getMetadata = (\n operationMetadata as Record<\n TOperationName,\n () => IOperationMetadata<TOperationData>\n >\n )[operationName];\n if (!getMetadata) {\n throw new Error(\n `Could not find metadata for operation called ${operationName}`\n );\n }\n return getMetadata();\n }\n}\n","import {v4 as uuidv4} from 'uuid';\nimport type {IStrictDuration, ISubtitle} from '../../types.ts';\n\n/**\n * This class converts an AVID subtitle file to an `ISubtitle` array.\n *\n * Every subtitle gets a unique `id`. The lines of a multi-line caption are\n * joined with a newline (`\\n`), never with HTML.\n */\nexport class SubtitleImporter {\n importSubtitles(rawLines: string[]): ISubtitle[] {\n const result: ISubtitle[] = [];\n const lines: string[] = [];\n for (let i: number = 0, l: number = rawLines.length; i < l; i++) {\n const rawLine: string = this.stripNewlineChars(rawLines[i].toString());\n if (this.isValidLine(rawLine)) {\n lines.push(rawLine);\n }\n }\n\n // A caption is a duration line followed by its text lines, blank lines\n // separate the captions.\n let duration: IStrictDuration | undefined;\n let textLines: string[] = [];\n const flush = () => {\n if (duration) {\n result.push({id: uuidv4(), duration, text: textLines.join('\\n')});\n }\n duration = undefined;\n textLines = [];\n };\n lines.forEach((line: string) => {\n if (line.length === 0) {\n flush();\n } else if (!duration) {\n duration = this.convertDuration(line);\n } else {\n textLines.push(line);\n }\n });\n flush();\n\n return result;\n }\n\n stripNewlineChars(str: string): string {\n let res: string = '';\n for (let i: number = 0, l: number = str.length; i < l; i++) {\n if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {\n res += str.charAt(i);\n }\n }\n return res;\n }\n\n isValidLine(line: string): boolean {\n return (\n !line.startsWith('@') &&\n !line.startsWith('<begin subtitles>') &&\n !line.startsWith('<end subtitles>')\n );\n }\n\n convertDuration(time: string): IStrictDuration {\n const times: string[] = time.split(' ');\n return {\n start: this.convertTimeToSeconds(times[0]),\n end: this.convertTimeToSeconds(times[1]),\n };\n }\n\n convertTimeToSeconds(time: string): number {\n const parts: string[] = time.split(':');\n return (\n parseInt(parts[0], 10) * 3600 +\n parseInt(parts[1], 10) * 60 +\n parseInt(parts[2], 10)\n );\n }\n}\n","import {v4 as uuidv4} from 'uuid';\nimport type {\n IStrictDuration,\n ISubtitle,\n ISubtitleCollection,\n TLanguageCode,\n} from '../../types.ts';\n\n/**\n * Used to edit and add to an {@link ISubtitleCollection}.\n */\nexport class SubtitleEditor {\n constructor(private collection: ISubtitleCollection[] = []) {}\n\n private _getLanguage(languageCode: string) {\n return this.collection.find(x => x.languageCode === languageCode);\n }\n\n /**\n * Adds a new {@link ISubtitleCollection} for the given `languageCode`.\n *\n * If collections already exist for existing language codes then a duplicate\n * of these collections is created with the same duration info but all of the\n * text is left empty.\n *\n * @param languageCode\n * @returns\n */\n addLanguage(languageCode: TLanguageCode) {\n const language = this._getLanguage(languageCode);\n if (language) {\n throw new Error(`Language ${languageCode} already exists.`);\n }\n const newLanguage: ISubtitleCollection = this.collection.length\n ? {\n ...this.collection[0],\n languageCode,\n titles: this.collection[0].titles.map(x => ({\n id: uuidv4(),\n duration: {...x.duration},\n text: '',\n })),\n }\n : {\n languageCode,\n titles: [],\n };\n this.collection.push(newLanguage);\n return this;\n }\n\n /**\n *\n * Add a single subtitle line that is associated with the given `languageCode`\n *\n * @param languageCode\n * @param subtitle\n * @returns\n */\n addSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\n const language = this._getLanguage(languageCode);\n if (!language) {\n throw new Error(`Language ${languageCode} does not exist.`);\n }\n language.titles.push(subtitle);\n return this;\n }\n\n addSubtitles(\n duration: IStrictDuration,\n subtitles: Record<TLanguageCode, string>\n ) {\n Object.entries(subtitles).forEach(([languageCode, subtitle]) =>\n this.addSubtitle(languageCode as TLanguageCode, {\n id: uuidv4(),\n duration: {...duration},\n text: subtitle,\n })\n );\n return this;\n }\n\n setSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\n const language = this._getLanguage(languageCode);\n if (!language) {\n throw new Error(`Language ${languageCode} does not exist.`);\n }\n\n const titleIdx = language.titles.findIndex(x => x.id === subtitle.id);\n if (titleIdx < 0) {\n throw new Error(\n `Subtitle with id '${subtitle.id}' was not found in language with code ${languageCode}.`\n );\n }\n\n language.titles[titleIdx] = {\n ...subtitle,\n duration: {...subtitle.duration},\n };\n return this;\n }\n\n export() {\n return this.collection;\n }\n}\n","export type {IDOMEventListenerControllerOperationData} from '@controllers/dom-event-listener-controller.ts';\nexport {DOMEventListenerController} from '@controllers/dom-event-listener-controller.ts';\nexport type {\n IKeyboardControllerOperationData,\n TKeyboardControllerScope,\n} from '@controllers/keyboard-controller.ts';\nexport {KeyboardController} from '@controllers/keyboard-controller.ts';\nexport type {ILabelControllerMetadata} from '@controllers/label-controller.ts';\nexport {LabelController} from '@controllers/label-controller.ts';\nexport type {ILottieControllerMetadata} from '@controllers/lottie-controller.ts';\nexport {LottieController} from '@controllers/lottie-controller.ts';\nexport type {\n IMutationEventPayload,\n IMutationObserverControllerMetadata,\n} from '@controllers/mutation-observer-controller.ts';\nexport {MutationObserverController} from '@controllers/mutation-observer-controller.ts';\nexport type {INavigationControllerOperationData} from '@controllers/navigation-controller.ts';\nexport {NavigationController} from '@controllers/navigation-controller.ts';\nexport type {IProgressbarControllerOperationData} from '@controllers/progressbar-controller.ts';\nexport {ProgressbarController} from '@controllers/progressbar-controller.ts';\nexport type {IRoutingControllerOperationData} from '@controllers/routing-controller.ts';\nexport {RoutingController} from '@controllers/routing-controller.ts';\nexport type {ISubtitlesControllerOperationData} from '@controllers/subtitles-controller.ts';\nexport {SubtitlesController} from '@controllers/subtitles-controller.ts';\n","export {ActionRegistryEventbusListener} from '@eventbus/actionregistry-eventbus-listener.ts';\nexport {Eventbus} from '@eventbus/eventbus.ts';\nexport * from '@eventbus/events/index.ts';\nexport type {IEventMetadata} from '@eventbus/events/metadata/types.ts';\nexport {RequestVideoUriInterceptor} from '@eventbus/request-video-uri-interceptor.ts';\nexport * from '@eventbus/types.ts';\n","// =============================================================================\n// DECOMPOSED INTERFACES (new architecture)\n// =============================================================================\n\nexport type {\n IContainerProvider,\n IPlaylist,\n IPositionSource,\n ISeekable,\n TBoundary,\n TSourceState,\n} from '@timelineproviders/types.ts';\n\nexport {isSeekable} from '@timelineproviders/types.ts';\n\n// =============================================================================\n// DECOMPOSED POSITION SOURCES (new architecture)\n// =============================================================================\n\nexport {BasePositionSource} from '@timelineproviders/position-sources/base-position-source.ts';\nexport type {\n KeyboardStepSourceConfig,\n TVerticalMode,\n} from '@timelineproviders/position-sources/keyboard-step-source.ts';\nexport {KeyboardStepSource} from '@timelineproviders/position-sources/keyboard-step-source.ts';\nexport type {RafPositionSourceConfig} from '@timelineproviders/position-sources/raf-position-source.ts';\nexport {RafPositionSource} from '@timelineproviders/position-sources/raf-position-source.ts';\nexport type {ScrollPositionSourceConfig} from '@timelineproviders/position-sources/scroll-position-source.ts';\nexport {ScrollPositionSource} from '@timelineproviders/position-sources/scroll-position-source.ts';\nexport type {\n VideoPositionSourceConfig,\n VideoSource,\n} from '@timelineproviders/position-sources/video-position-source.ts';\nexport {VideoPositionSource} from '@timelineproviders/position-sources/video-position-source.ts';\n\n// =============================================================================\n// DECOMPOSED CONTAINER PROVIDERS (new architecture)\n// =============================================================================\n\nexport type {DomContainerProviderConfig} from '@timelineproviders/container-providers/dom-container-provider.ts';\nexport {DomContainerProvider} from '@timelineproviders/container-providers/dom-container-provider.ts';\n\n// =============================================================================\n// DECOMPOSED PLAYLIST (new architecture)\n// =============================================================================\n\nexport type {SimplePlaylistConfig} from '@timelineproviders/playlist/simple-playlist.ts';\nexport {SimplePlaylist} from '@timelineproviders/playlist/simple-playlist.ts';\n","import * as ctrls from '@controllers/index.ts';\nimport * as evtb from '@eventbus/index.ts';\nimport * as ops from '@operation/index.ts';\nimport type {TOperation} from '@operation/types.ts';\nimport * as prvdrs from '@timelineproviders/index.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\nimport {EligiusEngine} from '../eligius-engine.ts';\nimport type {\n IEligiusResourceRegistrations,\n IResourceImporter,\n TRegisteredResourceKind,\n} from '../types.ts';\nimport {checkShape, describeKind} from './registration-shape.ts';\n\nconst operations: Record<string, TOperation<any>> = ops as any;\nconst controllers: Record<string, any> = ctrls;\nconst providers: Record<string, any> = prvdrs;\nconst eventbus: Record<string, any> = evtb;\n\ninterface IRegisteredResource {\n kind: TRegisteredResourceKind;\n value: unknown;\n}\n\nconst REGISTRATION_KINDS: ReadonlyArray<\n readonly [\n Exclude<keyof IEligiusResourceRegistrations, 'override'>,\n TRegisteredResourceKind,\n ]\n> = [\n ['operations', 'operation'],\n ['functions', 'function'],\n ['controllers', 'controller'],\n ['templates', 'template'],\n ['json', 'json'],\n];\n\n/**\n * The default resource importer. It provides every operation, controller,\n * timeline provider and eventbus export of Eligius, plus the `EligiusEngine`\n * class.\n *\n * Custom operations, functions, controllers, templates and JSON can be\n * registered by passing an {@link IEligiusResourceRegistrations} map to the\n * constructor. Registered operations and controllers are listed by\n * {@link getOperationNames} and {@link getControllerNames}, so the\n * configuration resolver accepts them and includes them in its \"did you mean\"\n * hints. Registered functions serve `customFunction`, and registered\n * templates and JSON serve the `template:` and `json:` placeholders;\n * `getImport` can retrieve any registered resource.\n *\n * For resources that cannot be registered this way (custom position sources,\n * container providers or playlists), pass a custom {@link IResourceImporter}\n * to the `EngineFactory`, for example one that delegates to this importer for\n * the other names.\n *\n * @example\n * ```ts\n * const importer = new EligiusResourceImporter({\n * operations: {logMessage: data => {console.log(data.message); return data;}},\n * functions: {greet: () => alert('Hello')},\n * });\n * const factory = new EngineFactory(importer, window);\n * ```\n */\nexport class EligiusResourceImporter implements IResourceImporter {\n engines = new Map();\n private readonly _registered = new Map<string, IRegisteredResource>();\n\n /**\n * @param registrations - Optional custom resources, see\n * {@link IEligiusResourceRegistrations}\n * @throws Error when a registered value has the wrong shape for its kind\n * (for example a class registered as an operation), when a name is\n * registered in more than one map, or when a name clashes with a built-in\n * name and `override` is not `true`. The message names the map and the\n * name.\n */\n constructor(registrations: IEligiusResourceRegistrations = {}) {\n this.engines.set('EligiusEngine', EligiusEngine);\n this._register(registrations);\n }\n\n /**\n * @returns The names of the built-in and the registered operations\n */\n getOperationNames(): string[] {\n return this._listNames(Object.keys(operations), 'operation');\n }\n\n /**\n * @returns The names of the built-in and the registered controllers\n */\n getControllerNames(): string[] {\n return this._listNames(Object.keys(controllers), 'controller');\n }\n\n /**\n * @returns The names of the built-in timeline provider exports\n */\n getProviderNames(): string[] {\n return this._listNames(Object.keys(providers));\n }\n\n /**\n * @returns The names of the registered functions (for `customFunction`)\n */\n getFunctionNames(): string[] {\n return this._listNames([], 'function');\n }\n\n /**\n * Returns the named resource as `{[name]: value}`.\n *\n * Registered resources are found by their own name only; a name inherited\n * from `Object.prototype` (such as `toString`) is never served.\n *\n * @param name - The system name of an operation, controller, timeline\n * provider, eventbus export, engine, or a registered function, template or\n * JSON value\n * @returns A record with `name` as its only key\n * @throws Error naming the unknown name, with the closest known names when\n * there are any, when `name` is not provided by this importer.\n *\n * @example\n * ```ts\n * const {selectElement} = new EligiusResourceImporter().import('selectElement');\n * ```\n */\n import(name: string): Record<string, any> {\n // Built-in names are only registered when `override` allowed it, so the\n // registered entry wins for those.\n const registered = this._registered.get(name);\n const value = registered\n ? registered.value\n : (ownValue(operations, name) ??\n ownValue(controllers, name) ??\n ownValue(providers, name) ??\n ownValue(eventbus, name) ??\n this.engines.get(name));\n\n if (value === undefined) {\n throw new Error(this._createUnknownNameMessage(name));\n }\n\n return {[name]: value};\n }\n\n private _register(registrations: IEligiusResourceRegistrations) {\n if (registrations === null || typeof registrations !== 'object') {\n throw new Error(\n `EligiusResourceImporter: the registrations must be an object, got ${describeKind(registrations)}.`\n );\n }\n const override = registrations.override === true;\n\n for (const [mapName, kind] of REGISTRATION_KINDS) {\n const map = registrations[mapName];\n if (map === undefined) {\n continue;\n }\n if (map === null || typeof map !== 'object' || Array.isArray(map)) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName} must be an object of names to values, got ${describeKind(map)}.`\n );\n }\n\n for (const name of Object.keys(map)) {\n const value = (map as Record<string, unknown>)[name];\n const shapeError = checkShape(kind, value);\n if (shapeError) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName}.${name} ${shapeError}`\n );\n }\n\n const earlier = this._registered.get(name);\n if (earlier) {\n throw new Error(\n `EligiusResourceImporter: '${name}' is registered more than once (as a ${earlier.kind} and as a ${kind}). Every registered name must be unique, rename one of them.`\n );\n }\n\n const builtIn = describeBuiltIn(name, this.engines);\n if (builtIn && !override) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName}.${name} shadows the built-in ${builtIn} '${name}'. Rename it, or pass override: true to replace the built-in.`\n );\n }\n\n this._registered.set(name, {kind, value});\n }\n }\n }\n\n /**\n * Returns the given built-in names, without the ones a registration of a\n * different kind replaced, followed by the registered names of `kind`.\n */\n private _listNames(\n builtInNames: string[],\n kind?: TRegisteredResourceKind\n ): string[] {\n const names = builtInNames.filter(name => {\n const registered = this._registered.get(name);\n return !registered || registered.kind === kind;\n });\n for (const [name, registered] of this._registered) {\n if (registered.kind === kind && !names.includes(name)) {\n names.push(name);\n }\n }\n return names;\n }\n\n private _createUnknownNameMessage(name: string) {\n const message = `EligiusResourceImporter: unknown system name '${name}'.`;\n const knownNames = [\n ...new Set([\n ...Object.keys(operations),\n ...Object.keys(controllers),\n ...Object.keys(providers),\n ...Object.keys(eventbus),\n ...this.engines.keys(),\n ...this._registered.keys(),\n ]),\n ];\n const didYouMean = formatDidYouMean(\n findClosestNames(String(name), knownNames)\n );\n if (didYouMean) {\n return `${message} ${didYouMean}`;\n }\n return `${message} Check the spelling, or register it in the EligiusResourceImporter constructor.`;\n }\n}\n\nfunction ownValue(source: Record<string, any>, name: string) {\n return Object.hasOwn(source, name) ? source[name] : undefined;\n}\n\nfunction describeBuiltIn(\n name: string,\n engines: Map<string, unknown>\n): string | undefined {\n if (Object.hasOwn(operations, name)) {\n return 'operation';\n }\n if (Object.hasOwn(controllers, name)) {\n return 'controller';\n }\n if (Object.hasOwn(providers, name)) {\n return 'timeline provider export';\n }\n if (Object.hasOwn(eventbus, name)) {\n return 'eventbus export';\n }\n if (engines.has(name)) {\n return 'engine';\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoCA,SAAgB,qBAAqB,MAAsC;CACzE,OAAO,OAAO,OAAOA,oBAAmB,IAAI;AAC9C;;;;;;;;;;;;AAaA,SAAgB,yBACd,MACA,sBACM;CACN,IAAI,qBAAqB,IAAI,KAAK,sBAAsB,IAAI,IAAI,GAC9D;CAGF,MAAM,aAAa,CACjB,GAAG,OAAO,KAAKA,kBAAiB,GAChC,GAAI,wBAAwB,CAAC,CAC/B;CACA,MAAM,aAAa,iBACjB,iBAAiB,OAAO,IAAI,GAAG,UAAU,CAC3C;CAGA,MAAM,MACJ,sBAAsB,KAAK,IAAI,aAAa,GAAG,WAAW,KAAK,8JACjE;AACF;;;;;;;;;;;AAYA,MAAM,uCAAuB,IAAI,I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,SACoB;CACpB,IAAI,OAAO,OAAO,YAAY,IAAI,GAChC,OAAO;CAET,IAAI,OAAO,OAAO,aAAa,IAAI,GACjC,OAAO;CAET,IAAI,OAAO,OAAO,WAAW,IAAI,GAC/B,OAAO;CAET,IAAI,OAAO,OAAO,UAAU,IAAI,GAC9B,OAAO;CAET,IAAI,QAAQ,IAAI,IAAI,GAClB,OAAO;AAGX"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["operationMetadata","uuidv4","uuidv4","uuidv4","operationMetadata","controllerMetadata","uuidv4","uuidv4","ops","ctrls","prvdrs","evtb"],"sources":["../src/operation/index.ts","../src/configuration/api/operation-lookup.ts","../src/configuration/api/sync-in-place.ts","../src/configuration/api/action-creator-factory.ts","../src/configuration/api/action-editor.ts","../src/configuration/api/timeline-provider-settings-editor.ts","../src/util/merge-if-missing.ts","../src/configuration/api/configuration-factory.ts","../src/configuration/api/name-providers.ts","../src/configuration/api/subtitle-converter.ts","../src/configuration/api/subtitle-editor.ts","../src/controllers/index.ts","../src/eventbus/index.ts","../src/timelineproviders/index.ts","../src/importer/eligius-resource-importer.ts"],"sourcesContent":["export type {IAddClassOperationData} from '@operation/add-class.ts';\nexport {addClass} from '@operation/add-class.ts';\nexport type {IAddControllerToElementOperationData} from '@operation/add-controller-to-element.ts';\nexport {addControllerToElement} from '@operation/add-controller-to-element.ts';\nexport {addGlobalsToOperation} from '@operation/add-globals-to-operation.ts';\nexport type {IAnimateOperationData} from '@operation/animate.ts';\nexport {animate} from '@operation/animate.ts';\nexport type {IAnimateWithClassOperationData} from '@operation/animate-with-class.ts';\nexport {animateWithClass} from '@operation/animate-with-class.ts';\nexport type {IAnnounceToScreenReaderOperationData} from '@operation/announce-to-screen-reader.ts';\nexport {announceToScreenReader} from '@operation/announce-to-screen-reader.ts';\nexport {breakForEach} from '@operation/break-for-each.ts';\nexport type {IBroadcastEventOperationData} from '@operation/broadcast-event.ts';\nexport {broadcastEvent} from '@operation/broadcast-event.ts';\nexport type {ICalcOperationData} from '@operation/calc.ts';\nexport {calc} from '@operation/calc.ts';\nexport type {IClearElementOperationData} from '@operation/clear-element.ts';\nexport {clearElement} from '@operation/clear-element.ts';\nexport type {IClearOperationDataOperationData} from '@operation/clear-operation-data.ts';\nexport {clearOperationData} from '@operation/clear-operation-data.ts';\nexport type {\n IClearStorageOperationData,\n StorageType,\n} from '@operation/clear-storage.ts';\nexport {clearStorage} from '@operation/clear-storage.ts';\nexport type {ICompareDateOperationData} from '@operation/compare-date.ts';\nexport {compareDate} from '@operation/compare-date.ts';\nexport type {IConcatenateStringsOperationData} from '@operation/concatenate-strings.ts';\nexport {concatenateStrings} from '@operation/concatenate-strings.ts';\nexport {continueForEach} from '@operation/continue-for-each.ts';\nexport type {ICreateElementOperationData} from '@operation/create-element.ts';\nexport {createElement} from '@operation/create-element.ts';\nexport type {ICustomFunctionOperationData} from '@operation/custom-function.ts';\nexport {customFunction} from '@operation/custom-function.ts';\nexport type {IEndActionOperationData} from '@operation/end-action.ts';\nexport {endAction} from '@operation/end-action.ts';\nexport {endForEach} from '@operation/end-for-each.ts';\nexport {endWhen} from '@operation/end-when.ts';\nexport type {IExtendControllerOperationData} from '@operation/extend-controller.ts';\nexport {extendController} from '@operation/extend-controller.ts';\nexport type {IFilterArrayOperationData} from '@operation/filter-array.ts';\nexport {filterArray} from '@operation/filter-array.ts';\nexport type {IFindInArrayOperationData} from '@operation/find-in-array.ts';\nexport {findInArray} from '@operation/find-in-array.ts';\nexport type {IForEachOperationData} from '@operation/for-each.ts';\nexport {forEach} from '@operation/for-each.ts';\nexport type {IFormatDateOperationData} from '@operation/format-date.ts';\nexport {formatDate} from '@operation/format-date.ts';\nexport type {IFormatTextOperationData} from '@operation/format-text.ts';\nexport {formatText} from '@operation/format-text.ts';\nexport type {IGetAttributesFromElementOperationData} from '@operation/get-attributes-from-element.ts';\nexport {getAttributesFromElement} from '@operation/get-attributes-from-element.ts';\nexport type {IGetControllerFromElementOperationData} from '@operation/get-controller-from-element.ts';\nexport {getControllerFromElement} from '@operation/get-controller-from-element.ts';\nexport type {IGetControllerInstanceOperationData} from '@operation/get-controller-instance.ts';\nexport {getControllerInstance} from '@operation/get-controller-instance.ts';\nexport type {IGetCurrentTimeOperationData} from '@operation/get-current-time.ts';\nexport {getCurrentTime} from '@operation/get-current-time.ts';\nexport type {IGetElementDimensionsOperationData} from '@operation/get-element-dimensions.ts';\nexport {getElementDimensions} from '@operation/get-element-dimensions.ts';\nexport type {IGetFocusedElementOperationData} from '@operation/get-focused-element.ts';\nexport {getFocusedElement} from '@operation/get-focused-element.ts';\nexport type {IGetFormDataOperationData} from '@operation/get-form-data.ts';\nexport {getFormData} from '@operation/get-form-data.ts';\nexport type {IGetImportOperationData} from '@operation/get-import.ts';\nexport {getImport} from '@operation/get-import.ts';\nexport type {IGetQueryParamsOperationData} from '@operation/get-query-params.ts';\nexport {getQueryParams} from '@operation/get-query-params.ts';\nexport type {IGetScrollPositionOperationData} from '@operation/get-scroll-position.ts';\nexport {getScrollPosition} from '@operation/get-scroll-position.ts';\nexport type {IGetTextContentOperationData} from '@operation/get-text-content.ts';\nexport {getTextContent} from '@operation/get-text-content.ts';\nexport type {IHttpDeleteOperationData} from '@operation/http-delete.ts';\nexport {httpDelete} from '@operation/http-delete.ts';\nexport type {IHttpPostOperationData} from '@operation/http-post.ts';\nexport {httpPost} from '@operation/http-post.ts';\nexport type {IHttpPutOperationData} from '@operation/http-put.ts';\nexport {httpPut} from '@operation/http-put.ts';\nexport type {IInvokeObjectMethodOperationData} from '@operation/invoke-object-method.ts';\nexport {invokeObjectMethod} from '@operation/invoke-object-method.ts';\nexport type {IIsElementInViewportOperationData} from '@operation/is-element-in-viewport.ts';\nexport {isElementInViewport} from '@operation/is-element-in-viewport.ts';\nexport type {ILoadFromStorageOperationData} from '@operation/load-from-storage.ts';\nexport {loadFromStorage} from '@operation/load-from-storage.ts';\nexport type {ILoadJSONOperationData} from '@operation/load-json.ts';\nexport {loadJson} from '@operation/load-json.ts';\nexport type {ILogOperationData} from '@operation/log.ts';\nexport {log} from '@operation/log.ts';\nexport type {IMapArrayOperationData} from '@operation/map-array.ts';\nexport {mapArray} from '@operation/map-array.ts';\nexport type {IMathOperationData} from '@operation/math.ts';\nexport {math} from '@operation/math.ts';\nexport {otherwise} from '@operation/otherwise.ts';\nexport type {IRemoveClassOperationData} from '@operation/remove-class.ts';\nexport {removeClass} from '@operation/remove-class.ts';\nexport type {IRemoveControllerFromElementOperationData} from '@operation/remove-controller-from-element.ts';\nexport {removeControllerFromElement} from '@operation/remove-controller-from-element.ts';\nexport type {IRemoveElementOperationData} from '@operation/remove-element.ts';\nexport {removeElement} from '@operation/remove-element.ts';\nexport type {IRemovePropertiesFromOperationDataOperationData} from '@operation/remove-properties-from-operation-data.ts';\nexport {removePropertiesFromOperationData} from '@operation/remove-properties-from-operation-data.ts';\nexport type {IReparentElementOperationData} from '@operation/reparent-element.ts';\nexport {reparentElement} from '@operation/reparent-element.ts';\nexport type {IReplaceStringOperationData} from '@operation/replace-string.ts';\nexport {replaceString} from '@operation/replace-string.ts';\nexport type {IReplaceTextOperationData} from '@operation/replace-text.ts';\nexport {replaceText} from '@operation/replace-text.ts';\nexport type {IRequestActionOperationData} from '@operation/request-action.ts';\nexport {requestAction} from '@operation/request-action.ts';\nexport type {ISaveToStorageOperationData} from '@operation/save-to-storage.ts';\nexport {saveToStorage} from '@operation/save-to-storage.ts';\nexport type {IScrollToElementOperationData} from '@operation/scroll-to-element.ts';\nexport {scrollToElement} from '@operation/scroll-to-element.ts';\nexport type {IScrollToPositionOperationData} from '@operation/scroll-to-position.ts';\nexport {scrollToPosition} from '@operation/scroll-to-position.ts';\nexport type {ISelectElementOperationData} from '@operation/select-element.ts';\nexport {selectElement} from '@operation/select-element.ts';\nexport type {ISetDataOperationData} from '@operation/set-data.ts';\nexport {setData} from '@operation/set-data.ts';\nexport type {ISetElementAttributesOperationData} from '@operation/set-element-attributes.ts';\nexport {setElementAttributes} from '@operation/set-element-attributes.ts';\nexport type {ISetElementContentOperationData} from '@operation/set-element-content.ts';\nexport {setElementContent} from '@operation/set-element-content.ts';\nexport type {ISetFocusOperationData} from '@operation/set-focus.ts';\nexport {setFocus} from '@operation/set-focus.ts';\nexport type {ISetFormValueOperationData} from '@operation/set-form-value.ts';\nexport {setFormValue} from '@operation/set-form-value.ts';\nexport type {ISetGlobalDataOperationData} from '@operation/set-global-data.ts';\nexport {setGlobalData} from '@operation/set-global-data.ts';\nexport type {ISetOperationData} from '@operation/set-operation-data.ts';\nexport {setOperationData} from '@operation/set-operation-data.ts';\nexport type {ISetStyleOperationData} from '@operation/set-style.ts';\nexport {setStyle} from '@operation/set-style.ts';\nexport type {ISetVariableOperationData} from '@operation/set-variable.ts';\nexport {setVariable} from '@operation/set-variable.ts';\nexport type {ISortArrayOperationData} from '@operation/sort-array.ts';\nexport {sortArray} from '@operation/sort-array.ts';\nexport type {ISplitStringOperationData} from '@operation/split-string.ts';\nexport {splitString} from '@operation/split-string.ts';\nexport type {IStartActionOperationData} from '@operation/start-action.ts';\nexport {startAction} from '@operation/start-action.ts';\nexport type {ISubstringTextOperationData} from '@operation/substring-text.ts';\nexport {substringText} from '@operation/substring-text.ts';\nexport type {IToggleClassOperationData} from '@operation/toggle-class.ts';\nexport {toggleClass} from '@operation/toggle-class.ts';\nexport type {IToggleElementOperationData} from '@operation/toggle-element.ts';\nexport {toggleElement} from '@operation/toggle-element.ts';\nexport type {IToggleFormElementOperationData} from '@operation/toggle-form-element.ts';\nexport {toggleFormElement} from '@operation/toggle-form-element.ts';\nexport type * from '@operation/types.ts';\nexport type {IValidateFormOperationData} from '@operation/validate-form.ts';\nexport {validateForm} from '@operation/validate-form.ts';\nexport type {IWaitOperationData} from '@operation/wait.ts';\nexport {wait} from '@operation/wait.ts';\nexport type {IWhenOperationData} from '@operation/when.ts';\nexport {when} from '@operation/when.ts';\n","import type {\n ExtractOperationDataType,\n GetOperationByName,\n TOperationName,\n} from '@configuration/types.ts';\nimport * as operationMetadata from '@operation/metadata/index.ts';\nimport type {TOperationData} from '@operation/types.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\n\n/**\n * An operation system name the fluent API accepts: a built-in operation name\n * (offered by autocompletion), or the name of a custom operation that was\n * passed to the `ConfigurationFactory` in its `customOperations` option.\n * Custom names are checked when the operation is added, not by the compiler.\n */\nexport type TFluentOperationName = TOperationName | (string & {});\n\n/**\n * The operation data the fluent API accepts for the operation `N`: the typed,\n * partial operation data of a built-in operation, or any operation data for a\n * custom operation.\n */\nexport type TFluentOperationData<N extends string> = N extends TOperationName\n ? Partial<ExtractOperationDataType<GetOperationByName<N>>>\n : TOperationData;\n\n/**\n * Operation names are validated against the generated operation metadata, not\n * against the operation implementations. The metadata is plain data, so the\n * fluent configuration API can be loaded in a DOM-less context (Node build\n * tools such as the Eligian compiler), where importing the implementations\n * would evaluate jQuery and throw.\n *\n * @param name the operation system name to check\n * @returns `true` when `name` is a built-in operation\n */\nexport function isKnownOperationName(name: string): name is TOperationName {\n return Object.hasOwn(operationMetadata, name);\n}\n\n/**\n * Throws when the given name is neither the system name of a built-in\n * operation nor one of the given custom operation names.\n *\n * @param name the operation system name to check\n * @param customOperationNames the custom operation names that are accepted as\n * well (the `ConfigurationFactory`'s `customOperations` option)\n * @throws Error when no operation with the given name exists. The message\n * suggests the closest built-in and custom names, and explains how to declare\n * a custom operation.\n */\nexport function assertKnownOperationName(\n name: string,\n customOperationNames?: ReadonlySet<string>\n): void {\n if (isKnownOperationName(name) || customOperationNames?.has(name)) {\n return;\n }\n\n const knownNames = [\n ...Object.keys(operationMetadata),\n ...(customOperationNames ?? []),\n ];\n const didYouMean = formatDidYouMean(\n findClosestNames(String(name), knownNames)\n );\n const hint =\n \"To add a custom operation, declare its name in the ConfigurationFactory options: new ConfigurationFactory(undefined, {customOperations: ['myOperation']}).\";\n throw Error(\n `Unknown operation: ${name}. ${didYouMean ? `${didYouMean} ` : ''}${hint}`\n );\n}\n\n/**\n * Maps operation functions to their system names, for the `...ByType` methods\n * of the fluent API. The map is filled by `register-operation-types.ts`, which\n * the browser entry point (`eligius`) loads. The DOM-free entry point\n * (`eligius/configuration-api`) does not load the operation implementations,\n * so the map stays empty there.\n *\n * The lookup is by function identity, not by `Function.name`, so it keeps\n * working when a minifier renames the operation functions.\n */\nconst operationNamesByType = new Map<unknown, TOperationName>();\n\n/**\n * Registers operation implementations by their system names, so that the\n * `...ByType` methods of the fluent API can map a function back to its name.\n *\n * @param operations a record of operation system names to operation functions\n */\nexport function registerOperationTypes(\n operations: Readonly<Record<string, unknown>>\n): void {\n for (const [name, operation] of Object.entries(operations)) {\n if (typeof operation === 'function' && isKnownOperationName(name)) {\n operationNamesByType.set(operation, name);\n }\n }\n}\n\n/**\n * Returns the system name of the given operation function.\n *\n * @param operationType the operation function\n * @param methodName the fluent API method that asks, used in the error message\n * @param nameBasedMethodName the method that takes a system name instead\n * @returns the system name of the operation\n * @throws Error when the operation function is not known\n */\nexport function getOperationNameByType(\n operationType: unknown,\n methodName: string,\n nameBasedMethodName: string\n): TOperationName {\n const name = operationNamesByType.get(operationType);\n if (name) {\n return name;\n }\n\n if (operationNamesByType.size === 0) {\n throw new Error(\n `${methodName}: the operation implementations are not loaded, so an operation function cannot be mapped to its name. ` +\n `Import the fluent API from the main 'eligius' entry, or call ${nameBasedMethodName}('<operationName>', ...) with the operation's system name.`\n );\n }\n\n throw new Error(`Operation class not found: ${String(operationType)}`);\n}\n","/**\n * Keys that are never copied into the target. Assigning `__proto__` through the\n * inherited accessor would replace a prototype (or, when the existing value is\n * read through it, write onto `Object.prototype`), and `constructor` and\n * `prototype` are the other two entry points of prototype pollution.\n */\nconst UNSAFE_KEYS: ReadonlySet<string> = new Set([\n '__proto__',\n 'constructor',\n 'prototype',\n]);\n\n/**\n * Makes `target` structurally equal to `source` while keeping the identity of\n * the objects and arrays inside `target` wherever possible.\n *\n * The fluent configuration API hands out editors that hold references to\n * objects inside the factory's configuration (an action, an operation, the\n * timeline provider settings). Replacing those objects with copies would\n * detach the editors, so updates are applied in place instead:\n *\n * - Plain objects are updated key by key; keys missing from `source` are removed.\n * - Array entries are matched by their string `id` when both sides have one,\n * otherwise by position. Matched entries are synced recursively and reused.\n * - Everything else is assigned from `source`.\n * - The keys `__proto__`, `constructor` and `prototype` are skipped at every\n * nesting level, also inside values that are inserted as they are, so data\n * from `JSON.parse` cannot pollute `Object.prototype`.\n *\n * `source` should be a value the caller owns (for example a deep copy), because\n * unmatched values from it are inserted into `target` as they are (after their\n * unsafe keys have been removed).\n *\n * @param target - The object to update in place\n * @param source - The desired state\n */\nexport function syncInPlace<T extends object>(target: T, source: T): void {\n if (target === source) {\n return;\n }\n removeUnsafeKeys(source, new WeakSet());\n if (Array.isArray(target) && Array.isArray(source)) {\n syncArray(target, source);\n return;\n }\n syncObject(\n target as Record<string, unknown>,\n source as Record<string, unknown>\n );\n}\n\n/**\n * Deletes the unsafe own keys from every plain object and array reachable from\n * `value`. Deleting an own `__proto__` data property is safe, it does not go\n * through the inherited accessor.\n */\nfunction removeUnsafeKeys(value: unknown, seen: WeakSet<object>): void {\n if (value === null || typeof value !== 'object' || seen.has(value)) {\n return;\n }\n seen.add(value);\n if (Array.isArray(value)) {\n for (const item of value) {\n removeUnsafeKeys(item, seen);\n }\n return;\n }\n if (!isPlainObject(value)) {\n return;\n }\n for (const key of Object.keys(value)) {\n if (UNSAFE_KEYS.has(key)) {\n delete value[key];\n } else {\n removeUnsafeKeys(value[key], seen);\n }\n }\n}\n\nfunction syncObject(\n target: Record<string, unknown>,\n source: Record<string, unknown>\n): void {\n for (const key of Object.keys(target)) {\n if (!Object.hasOwn(source, key)) {\n delete target[key];\n }\n }\n for (const key of Object.keys(source)) {\n if (UNSAFE_KEYS.has(key)) {\n continue;\n }\n // Only own values are synced into, never an inherited one\n const existing = Object.hasOwn(target, key) ? target[key] : undefined;\n target[key] = syncValue(existing, source[key]);\n }\n}\n\nfunction syncArray(target: unknown[], source: unknown[]): void {\n const byId = new Map<string, unknown>();\n for (const item of target) {\n const id = idOf(item);\n if (id !== undefined) {\n byId.set(id, item);\n }\n }\n\n const next = source.map((item, index) => {\n const id = idOf(item);\n const match = id !== undefined ? byId.get(id) : target[index];\n if (id !== undefined && match !== undefined) {\n byId.delete(id);\n }\n return syncValue(match, item);\n });\n\n target.length = 0;\n target.push(...next);\n}\n\nfunction syncValue(existing: unknown, incoming: unknown): unknown {\n if (Array.isArray(existing) && Array.isArray(incoming)) {\n syncArray(existing, incoming);\n return existing;\n }\n if (isPlainObject(existing) && isPlainObject(incoming)) {\n // Do not merge two different identified entities into one object\n const existingId = idOf(existing);\n const incomingId = idOf(incoming);\n if (existingId !== incomingId) {\n return incoming;\n }\n syncObject(existing, incoming);\n return existing;\n }\n return incoming;\n}\n\nfunction idOf(value: unknown): string | undefined {\n if (isPlainObject(value) && typeof value.id === 'string') {\n return value.id;\n }\n return undefined;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n // Object.prototype itself has a null prototype, but must never be written to\n if (value === Object.prototype) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n ExtractOperationDataType,\n IActionConfiguration,\n IEndableActionConfiguration,\n IEventActionConfiguration,\n ITimelineActionConfiguration,\n TOperationType,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {v4 as uuidv4} from 'uuid';\nimport {\n assertKnownOperationName,\n getOperationNameByType,\n type TFluentOperationData,\n type TFluentOperationName,\n} from './operation-lookup.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\n/**\n *\n * Container factory capable of creating the different kinds of actions.\n * For each type of action a dedicated factory will be returned.\n *\n */\nexport class ActionCreatorFactory {\n constructor(private readonly configurationfactory: ConfigurationFactory) {}\n\n /**\n *\n * Starts the creation of an action in the `actions` list with the specified name\n *\n * @param name\n * @returns\n */\n createAction(name: string): EndableActionCreator {\n const creator = new EndableActionCreator(name, this);\n this.configurationfactory.addAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `initActions` list with the specified name\n *\n * @param name\n * @returns\n */\n createInitAction(name: string): EndableActionCreator {\n const creator = new EndableActionCreator(name, this);\n this.configurationfactory.addInitAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `eventActions` list with the specified name\n *\n * @param name\n * @param eventName the event that starts the action. Without it the action can\n * only be started by name (for example by a `DOMEventListenerController` or\n * `KeyboardController`).\n * @param eventTopic optional topic of the event\n * @returns\n */\n createEventAction(\n name: string,\n eventName?: string,\n eventTopic?: string\n ): ActionCreator {\n const creator = new ActionCreator(name, this);\n const config: Partial<IEventActionConfiguration> = creator.actionConfig;\n if (eventName !== undefined) {\n config.eventName = eventName;\n }\n if (eventTopic !== undefined) {\n config.eventTopic = eventTopic;\n }\n this.configurationfactory.addEventAction(creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Starts the creation of an action in the `timelineActions` list with the specified name and uri\n *\n * @param uri\n * @param name\n * @returns\n */\n createTimelineAction(uri: string, name: string): TimelineActionCreator {\n const creator = new TimelineActionCreator(name, this);\n this.configurationfactory.addTimelineAction(uri, creator.actionConfig);\n return creator;\n }\n\n /**\n *\n * Returns the fluent scope back to the `Configurationfactory`\n *\n * @returns\n */\n end() {\n return this.configurationfactory;\n }\n}\n\n/**\n *\n * A factory that assists in creating an action\n *\n */\nexport class ActionCreator<\n T extends IActionConfiguration = IActionConfiguration,\n> {\n actionConfig: T;\n\n /**\n *\n * Initializes an action configuration with the given name\n *\n * @param name\n * @param factory\n */\n constructor(\n name: string | undefined,\n private readonly factory: ActionCreatorFactory\n ) {\n this.actionConfig = {\n name: name ?? '',\n id: uuidv4(),\n startOperations: [],\n } as unknown as T;\n }\n\n /**\n *\n * The unique id of the action\n *\n * @returns\n */\n getId() {\n return this.actionConfig.id;\n }\n\n /**\n *\n * Sets the name of the action\n *\n * @param name\n * @returns\n * @throws Error when the action is in `actions` or `eventActions` and another\n * action in those lists already has the name\n */\n setName(name: string) {\n // Optional calls: a creator may be constructed with a stand-in factory\n this.factory.end?.()?.assertUniqueActionName?.(name, this.actionConfig);\n this.actionConfig.name = name;\n return this;\n }\n\n /**\n *\n * Passes a copy of the internal state of the `ActionCreator` to the given callback.\n * When the callback returns a configuration, it replaces the action configuration\n * in the `ConfigurationFactory`.\n *\n * @param callBack\n * @returns\n */\n getConfiguration(callBack: (config: T) => T) {\n const copy = deepCopy(this.actionConfig);\n const newConfig = callBack.call(this, copy);\n if (newConfig) {\n syncInPlace(this.actionConfig, deepCopy(newConfig));\n }\n return this;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addStartOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(operationClass: T, operationData: Dt) {\n return this.addStartOperation(\n getOperationNameByType(\n operationClass,\n 'addStartOperationByType',\n 'addStartOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addStartOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this._customOperationNames());\n\n const {startOperations} = this.actionConfig;\n startOperations.push({\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n });\n return this;\n }\n\n /**\n *\n * Returns the fluent scope back to the `ActionCreatorFactory`\n *\n * @returns\n */\n next() {\n return this.factory;\n }\n\n /**\n * The custom operation names of the `ConfigurationFactory`. Optional calls:\n * a creator may be constructed with a stand-in factory.\n */\n protected _customOperationNames(): ReadonlySet<string> | undefined {\n return this.factory.end?.()?.customOperationNames;\n }\n}\n\n/**\n *\n * A factory that assists in creating an endable action\n *\n */\nexport class EndableActionCreator<\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\n> extends ActionCreator<T> {\n constructor(name: string | undefined, factory: ActionCreatorFactory) {\n super(name, factory);\n this.actionConfig.endOperations = [];\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addEndOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(operationClass: T, operationData: Dt) {\n return this.addEndOperation(\n getOperationNameByType(\n operationClass,\n 'addEndOperationByType',\n 'addEndOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addEndOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this._customOperationNames());\n\n let {endOperations} = this.actionConfig;\n if (!endOperations) {\n endOperations = this.actionConfig.endOperations = [];\n }\n endOperations.push({\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n });\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in creating a timeline action\n *\n */\nexport class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {\n /**\n *\n * Sets the duration specified by the given start and optional end positions\n *\n * @param start\n * @param end\n * @returns\n * @throws Error when `end` is given and lower than `start`\n */\n addDuration(start: number, end?: number) {\n if (end !== undefined && start > end) {\n throw new Error(\n `addDuration: start (${start}) cannot be higher than end (${end})`\n );\n }\n this.actionConfig.duration = {\n start: start,\n };\n if (end !== undefined) {\n this.actionConfig.duration.end = end;\n }\n return this;\n }\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n ExtractOperationDataType,\n IActionConfiguration,\n IEndableActionConfiguration,\n IOperationConfiguration,\n ITimelineActionConfiguration,\n TOperationName,\n TOperationType,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport type * as operations from '@operation/index.ts';\nimport type {TOperation, TOperationData} from '@operation/types.ts';\nimport {isDefined} from 'ts-is-present';\nimport {v4 as uuidv4} from 'uuid';\nimport type {IDuration} from '../../types.ts';\nimport {\n assertKnownOperationName,\n getOperationNameByType,\n type TFluentOperationData,\n type TFluentOperationName,\n} from './operation-lookup.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\nfunction array_move(arr: any[], old_index: number, new_index: number) {\n if (new_index >= arr.length) {\n new_index = 0;\n } else if (new_index < 0) {\n new_index = arr.length - 1;\n }\n arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\n}\n\n/**\n *\n * A factory that assists in editing an action.\n *\n * The editor works directly on the action configuration that the `ConfigurationFactory` holds,\n * so every edit is reflected in the factory's configuration.\n *\n */\nexport class ActionEditor<\n T extends IActionConfiguration = IActionConfiguration,\n> {\n constructor(\n protected actionConfig: T,\n protected readonly configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Called by the `OperationEditor` after it has changed an operation.\n * Operations are edited in place, so there is nothing left to synchronize.\n */\n updateConfiguration() {}\n\n /**\n *\n * Passes a copy of the current action configuration to the given callback.\n * When the callback returns a configuration, it replaces the action configuration\n * in the factory.\n *\n * @param callBack\n * @returns\n */\n getConfiguration(callBack: (config: T) => T | undefined) {\n const copy = deepCopy(this.actionConfig);\n const newConfig = callBack.call(this, copy);\n if (newConfig) {\n syncInPlace(this.actionConfig, deepCopy(newConfig));\n }\n return this;\n }\n\n /**\n *\n * Sets the action name\n *\n * @param name\n * @returns\n * @throws Error when the action is in `actions` or `eventActions` and another\n * action in those lists already has the name\n */\n setName(name: string) {\n // Optional call: an editor may be constructed with a stand-in factory\n this.configurationFactory.assertUniqueActionName?.(name, this.actionConfig);\n this.actionConfig.name = name;\n return this;\n }\n\n /**\n *\n * Gets the action name\n *\n * @returns\n */\n getName() {\n return this.actionConfig.name;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addStartOperationByType<T extends TOperation<TOperationData>>(\n operationClass: T,\n operationData: Partial<ExtractOperationDataType<T>>\n ): OperationEditor<this, T> {\n return this.addStartOperation(\n getOperationNameByType(\n operationClass,\n 'addStartOperationByType',\n 'addStartOperation'\n ),\n operationData\n ) as OperationEditor<this, T>;\n }\n\n /**\n *\n * Adds the operation data for a start operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @param id\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addStartOperation<\n N extends TFluentOperationName,\n D extends TFluentOperationData<N>,\n >(\n systemName: N,\n operationData: D,\n id: string = uuidv4()\n ): OperationEditor<this, TOperation<TOperationData>> {\n assertKnownOperationName(systemName, this.getCustomOperationNames());\n\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n\n const newConfig = {\n id,\n systemName: systemName,\n operationData: deepCopy(operationData) as TOperationData,\n } as IOperationConfiguration<TOperationData>;\n\n startOperations.push(newConfig);\n\n this.actionConfig.startOperations = startOperations;\n\n return new OperationEditor<this, TOperation<TOperationData>>(\n newConfig,\n this\n );\n }\n\n /**\n *\n * Starts an editor for the start operation associated with the given id\n *\n * @param id\n * @returns\n */\n editStartOperation(id: string) {\n const {startOperations} = this.actionConfig;\n const operation = startOperations.find(o => o.id === id);\n\n if (isDefined(operation)) {\n return new OperationEditor<ActionEditor<T>, TOperation<TOperationData>>(\n operation,\n this\n );\n }\n\n throw new Error(`start operation not found for id ${id}`);\n }\n\n /**\n *\n * Removes the start operation associated with the given id\n *\n * @param id\n * @returns\n */\n removeStartOperation(id: string) {\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n const operation = startOperations.find(o => o.id === id);\n\n if (!operation) {\n throw new Error(`start operation not found for id ${id}`);\n }\n\n const idx = startOperations.indexOf(operation);\n\n if (idx > -1) {\n startOperations.splice(idx, 1);\n this.actionConfig.startOperations = startOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Moves the start operation associated with the given id in the given direction\n *\n * @param id\n * @param direction\n * @returns\n */\n moveStartOperation(id: string, direction: 'up' | 'down') {\n const startOperations = this.actionConfig.startOperations\n ? this.actionConfig.startOperations.slice()\n : [];\n const operation = startOperations.find(o => o.id === id);\n\n if (!operation) {\n throw new Error(`start operation not found for id ${id}`);\n }\n\n const idx = startOperations.indexOf(operation);\n\n if (idx > -1) {\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\n array_move(startOperations, idx, newIdx);\n this.actionConfig.startOperations = startOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Return the fluent scopt to the `ConfigurationFactory`\n *\n * @returns\n */\n next() {\n return this.configurationFactory;\n }\n\n /**\n * Returns the custom operation names that the `ConfigurationFactory` accepts\n * besides the built-in operations (its `customOperations` option).\n *\n * @returns the custom operation names, or `undefined` when the editor has no factory\n */\n getCustomOperationNames(): ReadonlySet<string> | undefined {\n // Optional chaining: an editor may be constructed with a stand-in factory\n return this.configurationFactory?.customOperationNames;\n }\n}\n\n/**\n *\n * A factory that assists in editing an endable action\n *\n */\nexport class EndableActionEditor<\n T extends IEndableActionConfiguration = IEndableActionConfiguration,\n> extends ActionEditor<T> {\n /**\n *\n * Adds the operation data for a end operation specified by the given type\n *\n * @param operationClass\n * @param operationData\n * @returns\n * @throws Error when the function is not an operation, or when the operation\n * implementations are not loaded (the DOM-free `eligius/configuration-api` entry)\n */\n addEndOperationByType<\n T extends TOperationType,\n Dt extends Partial<ExtractOperationDataType<T>>,\n >(\n operationClass: T,\n operationData: Dt\n ): OperationEditor<this, TOperationType> {\n return this.addEndOperation(\n getOperationNameByType(\n operationClass,\n 'addEndOperationByType',\n 'addEndOperation'\n ),\n operationData\n );\n }\n\n /**\n *\n * Adds the operation data for an end operation specified by the given system name.\n * The operation data is copied, so later changes to the given object do not\n * affect the configuration.\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @param operationData\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n addEndOperation<\n T extends TFluentOperationName,\n O extends TFluentOperationData<T>,\n >(systemName: T, operationData: O) {\n assertKnownOperationName(systemName, this.getCustomOperationNames());\n\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n\n const newConfig = {\n id: uuidv4(),\n systemName: systemName,\n operationData: deepCopy(operationData),\n };\n\n endOperations.push(newConfig);\n\n this.actionConfig.endOperations = endOperations;\n\n return new OperationEditor<this, (typeof operations)[TOperationName]>(\n newConfig,\n this\n );\n }\n\n /**\n *\n * Starts an editor for the end operation associated with the given id\n *\n * @param id\n * @returns\n */\n editEndOperation(id: string) {\n const {endOperations} = this.actionConfig;\n const operationConfig = endOperations.find(o => o.id === id);\n\n if (isDefined(operationConfig)) {\n return new OperationEditor<this>(operationConfig, this);\n }\n\n throw new Error(`operation not found for id ${id}`);\n }\n\n /**\n *\n * Removes the end operation associated with the given id\n *\n * @param id\n * @returns\n */\n removeEndOperation(id: string) {\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n const operation = endOperations.find(o => o.id === id);\n\n if (!isDefined(operation)) {\n throw new Error(`operation not found for id ${id}`);\n }\n\n const idx = endOperations.indexOf(operation);\n\n if (idx > -1) {\n endOperations.splice(idx, 1);\n this.actionConfig.endOperations = endOperations;\n }\n\n return this;\n }\n\n /**\n *\n * Moves the end operation associated with the given id in the specified direction\n *\n * @param id\n * @param direction\n * @returns\n */\n moveEndOperation(id: string, direction: 'up' | 'down') {\n const endOperations = this.actionConfig.endOperations\n ? this.actionConfig.endOperations.slice()\n : [];\n const operation = endOperations.find(o => o.id === id);\n\n if (!isDefined(operation)) {\n throw new Error(`operation not found for id ${id}`);\n }\n\n const idx = endOperations.indexOf(operation);\n\n if (idx > -1) {\n const newIdx = direction === 'up' ? idx + 1 : idx - 1;\n array_move(endOperations, idx, newIdx);\n this.actionConfig.endOperations = endOperations;\n }\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in editing a timeline action\n *\n */\nexport class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {\n /**\n *\n * Sets the duration specified by the given start and optional end positions\n *\n * @param start\n * @param end\n * @returns\n */\n setDuration(start: number, end?: number) {\n if (end !== undefined && start > end) {\n throw Error('start position cannot be higher than end position');\n }\n\n const duration: IDuration = {\n start,\n };\n\n if (end !== undefined) {\n duration.end = end;\n }\n\n this.actionConfig.duration = duration;\n return this;\n }\n}\n\n/**\n *\n * A factory that assists in editing an operation\n *\n */\nexport class OperationEditor<\n T extends ActionEditor,\n O extends TOperationType = TOperation<TOperationData>,\n> {\n constructor(\n private operationConfig: IOperationConfiguration<\n ExtractOperationDataType<O>\n >,\n private actionEditor: T\n ) {}\n\n /**\n *\n * Invokes the given callback with a copy of the internal state of the factory\n *\n * @param callBack\n * @returns\n */\n getConfiguration(\n callBack: (\n config: IOperationConfiguration<ExtractOperationDataType<O>>\n ) => IOperationConfiguration<ExtractOperationDataType<O>>\n ) {\n const copy = deepCopy(this.operationConfig);\n const newConfig = callBack.call(this, copy);\n\n if (newConfig) {\n syncInPlace(this.operationConfig, deepCopy(newConfig));\n }\n\n return this;\n }\n\n /**\n *\n * Gets the system name\n *\n * @returns\n */\n getSystemName() {\n return this.operationConfig.systemName;\n }\n\n /**\n *\n * Sets the system name\n *\n * @param systemName a built-in operation name, or a name from the factory's\n * `customOperations` option\n * @returns\n * @throws Error when `systemName` is neither a built-in nor a declared custom operation\n */\n setSystemName(systemName: TFluentOperationName) {\n assertKnownOperationName(\n systemName,\n this.actionEditor.getCustomOperationNames?.()\n );\n\n this.operationConfig.systemName = systemName;\n this.actionEditor.updateConfiguration();\n return this;\n }\n\n /**\n *\n * Sets the operation data. The operation data is copied, so later changes to\n * the given object do not affect the configuration.\n *\n * @param operationData\n * @returns\n */\n setOperationData(operationData: ExtractOperationDataType<O>) {\n this.operationConfig.operationData = deepCopy(operationData);\n this.actionEditor.updateConfiguration();\n return this;\n }\n\n /**\n *\n * Sets the value on the current `operationData` with the given key\n *\n * @param key\n * @param value\n * @returns\n */\n setOperationDataItem(\n key: keyof ExtractOperationDataType<O>,\n value: ExtractOperationDataType<O>[keyof ExtractOperationDataType<O>]\n ) {\n // Copy on write, the current object may still be referenced elsewhere\n return this.setOperationData({\n ...this.operationConfig.operationData,\n [key]: value,\n } as ExtractOperationDataType<O>);\n }\n\n /**\n *\n * returns all of the defined property names on the current `operationData`\n *\n * @returns\n */\n getOperationDataKeys(): Array<keyof ExtractOperationDataType<O>> {\n const {operationData} = this.operationConfig;\n return (operationData ? Object.keys(operationData) : []) as Array<\n keyof ExtractOperationDataType<O>\n >;\n }\n\n /**\n *\n * Gets the value of the given key on the current `operationData`\n *\n * @param key\n * @returns\n */\n getOperationDataValue(key: keyof ExtractOperationDataType<O>) {\n const {operationData} = this.operationConfig;\n return operationData?.[key];\n }\n\n /**\n *\n * Returns the fluent scope back to the action editor\n *\n * @returns\n */\n next() {\n return this.actionEditor;\n }\n}\n","import type {ConfigurationFactory} from '@configuration/api/configuration-factory.ts';\nimport type {\n IContainerProviderConfig,\n IPlaylistConfig,\n IPositionSourceConfig,\n ITimelineProviderSettings,\n TTimelineProviderSettings,\n} from '@configuration/types.ts';\nimport type {TimelineTypes} from '../../types.ts';\n\n/**\n * Default position source system names for convenience methods.\n */\nconst DEFAULT_POSITION_SOURCES: Record<string, string> = {\n raf: 'RafPositionSource',\n scroll: 'ScrollPositionSource',\n video: 'VideoPositionSource',\n};\n\n/**\n * Default container provider system name.\n */\nconst DEFAULT_CONTAINER_PROVIDER = 'DomContainerProvider';\n\n/**\n * Default playlist system name.\n */\nconst DEFAULT_PLAYLIST = 'SimplePlaylist';\n\nexport class TimelineProvidersSettingsEditor {\n constructor(\n private providersSettings: TTimelineProviderSettings,\n private configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Adds a new provider for the specified timeline type.\n *\n * @param timelineType - The timeline type (e.g., 'animation', 'mediaplayer')\n * @param positionSourceSystemName - System name of the position source class (default: 'RafPositionSource')\n * @returns A TimelineProviderSettingsEditor for further configuration\n */\n addProvider(\n timelineType: TimelineTypes,\n positionSourceSystemName = 'RafPositionSource'\n ) {\n if (this.providersSettings[timelineType]) {\n throw new Error(\n `Settings for a '${timelineType}' provider already exist`\n );\n }\n\n const settings: ITimelineProviderSettings = {\n positionSource: {systemName: positionSourceSystemName},\n };\n this.providersSettings[timelineType] = settings;\n return new TimelineProviderSettingsEditor(\n settings,\n this,\n this.configurationFactory\n );\n }\n\n editProvider(timelineType: TimelineTypes) {\n if (!this.providersSettings[timelineType]) {\n throw new Error(`No settings for a '${timelineType}' provider exist yet`);\n }\n\n return new TimelineProviderSettingsEditor(\n this.providersSettings[timelineType] as ITimelineProviderSettings,\n this,\n this.configurationFactory\n );\n }\n\n next() {\n return this.configurationFactory;\n }\n}\n\nexport class TimelineProviderSettingsEditor {\n constructor(\n private providerSettings: ITimelineProviderSettings,\n private providersSettingsEditor: TimelineProvidersSettingsEditor,\n private configurationFactory: ConfigurationFactory\n ) {}\n\n /**\n * Sets the position source configuration with full config object.\n * @param config - Position source configuration with systemName and options\n */\n setPositionSource(config: IPositionSourceConfig) {\n this.providerSettings.positionSource = config;\n return this;\n }\n\n /**\n * Sets the position source by system name with optional configuration.\n * @param systemName - The position source class name (e.g., 'RafPositionSource')\n * @param options - Additional options passed to the position source constructor\n */\n setPositionSourceByName(\n systemName: string,\n options?: Record<string, unknown>\n ) {\n this.providerSettings.positionSource = {\n systemName,\n ...options,\n };\n return this;\n }\n\n /**\n * Convenience method to set position source using shorthand type names.\n * @param type - Shorthand type ('raf', 'scroll', 'video')\n * @param options - Type-specific options (`sources` and `poster` for video)\n * @deprecated Use setPositionSourceByName for explicit control\n */\n setPositionSourceType(\n type: 'raf' | 'scroll' | 'video',\n options?: {\n selector?: string;\n tickInterval?: number;\n poster?: string;\n sources?: Array<{src: string; type: string}>;\n }\n ) {\n const systemName = DEFAULT_POSITION_SOURCES[type];\n if (!systemName) {\n throw new Error(`Unknown position source type: ${type}`);\n }\n\n this.providerSettings.positionSource = {\n systemName,\n ...options,\n };\n return this;\n }\n\n /**\n * Sets the container provider configuration by selector.\n * Uses DomContainerProvider by default.\n * @param selector - CSS selector for the container element\n */\n setContainer(selector: string) {\n this.providerSettings.container = {\n systemName: DEFAULT_CONTAINER_PROVIDER,\n selector,\n };\n return this;\n }\n\n /**\n * Sets the container provider configuration with full config object.\n * @param config - Container provider configuration with systemName\n */\n setContainerConfig(config: IContainerProviderConfig) {\n this.providerSettings.container = config;\n return this;\n }\n\n /**\n * Sets the container provider by system name with options.\n * @param systemName - The container provider class name\n * @param options - Additional options passed to the container provider constructor\n */\n setContainerByName(systemName: string, options: Record<string, unknown>) {\n this.providerSettings.container = {\n systemName,\n ...options,\n } as IContainerProviderConfig;\n return this;\n }\n\n /**\n * Sets the playlist configuration.\n * Uses SimplePlaylist by default.\n * @param items - Array of playlist items\n * @param identifierKey - Key used to identify items (default: 'uri')\n */\n setPlaylist<T>(items: readonly T[], identifierKey = 'uri') {\n this.providerSettings.playlist = {\n systemName: DEFAULT_PLAYLIST,\n items,\n identifierKey,\n } as IPlaylistConfig;\n return this;\n }\n\n /**\n * Sets the playlist configuration with full config object.\n * @param config - Playlist configuration with systemName\n */\n setPlaylistConfig(config: IPlaylistConfig) {\n this.providerSettings.playlist = config;\n return this;\n }\n\n /**\n * Sets the playlist by system name with options.\n * @param systemName - The playlist class name\n * @param options - Additional options including items and identifierKey\n */\n setPlaylistByName(\n systemName: string,\n options: {items: unknown[]; identifierKey: string; [key: string]: unknown}\n ) {\n this.providerSettings.playlist = {\n systemName,\n ...options,\n } as IPlaylistConfig;\n return this;\n }\n\n next() {\n return this.providersSettingsEditor;\n }\n\n end() {\n return this.configurationFactory;\n }\n}\n","/**\n *\n * Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.\n *\n * This function is pure, so it returns a new instance that reflects the merging of the two objects.\n *\n * The merge is shallow.\n *\n * @param target\n * @param source\n * @returns\n */\nexport const mergeIfMissing = <\n Src extends Record<PropertyKey, any>,\n Trg extends Partial<Src> & Record<PropertyKey, any>,\n>(\n target: Src,\n source: Trg\n): Src & Trg =>\n Object.entries(source).reduce(\n (acc, [key, value]) => (key in acc ? acc : {...acc, [key]: value}),\n target\n );\n","import {ActionCreatorFactory} from '@configuration/api/action-creator-factory.ts';\nimport {\n ActionEditor,\n EndableActionEditor,\n TimelineActionEditor,\n} from '@configuration/api/action-editor.ts';\nimport {TimelineProvidersSettingsEditor} from '@configuration/api/timeline-provider-settings-editor.ts';\nimport type {\n IActionConfiguration,\n IContainerProviderConfig,\n IEngineConfiguration,\n IPositionSourceConfig,\n ITimelineActionConfiguration,\n ITimelineConfiguration,\n} from '@configuration/types.ts';\nimport {deepCopy} from '@operation/helper/deep-copy.ts';\nimport {mergeIfMissing} from '@util/merge-if-missing.ts';\nimport {v4 as uuidv4} from 'uuid';\nimport type {KeysOfType, TimelineTypes, TLanguageCode} from '../../types.ts';\nimport {syncInPlace} from './sync-in-place.ts';\n\n/** */\nexport type TEngineConfigurationLists = KeysOfType<IEngineConfiguration, any[]>;\n\n/**\n * Action names must be unique across these lists.\n */\nconst UNIQUE_NAME_LISTS: TEngineConfigurationLists[] = [\n 'actions',\n 'eventActions',\n];\n\n/**\n * Options for the {@link ConfigurationFactory} constructor.\n */\nexport interface IConfigurationFactoryOptions {\n /**\n * The system names of custom operations that the name based methods\n * (`addStartOperation`, `addEndOperation`, `setSystemName`) accept besides\n * the built-in operations. Only names are needed, so this works in the\n * DOM-free `eligius/configuration-api` entry as well.\n *\n * The implementations are registered with the engine separately, for\n * example `new EligiusResourceImporter({operations: {trackEvent}})`. Custom\n * operations have no generated metadata, so their operation data is not\n * typed or schema-validated.\n */\n customOperations?: readonly string[];\n}\n\nfunction toCustomOperationNames(\n customOperations: readonly string[] | undefined\n): ReadonlySet<string> {\n if (customOperations === undefined) {\n return new Set();\n }\n if (!Array.isArray(customOperations)) {\n throw new Error(\n 'ConfigurationFactory: options.customOperations must be an array of operation names.'\n );\n }\n for (const [index, name] of customOperations.entries()) {\n if (typeof name !== 'string' || !name.length) {\n throw new Error(\n `ConfigurationFactory: options.customOperations[${index}] must be a non-empty string.`\n );\n }\n }\n return new Set(customOperations);\n}\n\ntype ConfigurationFactoryExtension<NewFactory extends ConfigurationFactory> = (\n this: NewFactory,\n ...rest: any[]\n) => void;\n\n/**\n * This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.\n *\n * @example Building a configuration using the factory\n * To initialize a basic configuration to start off of:\n * ```ts\n * const factory = new ConfigurationFactory()\n * .init(\"en-US\") // Define the default language\n * .addLanguage(\"en-US\", \"English\") // Add English as a supported language\n * .addLanguage(\"nl-NL\", \"Nederlands\") // Add Dutch as a supported language\n * .setLayoutTemplate(\"<div class=\\\"main.container\\\"></div>\") // Add the main container for the presentation\n * .setContainerSelector(\"#ct-container\") // Selector for the element in the body that will contain the presentation\n * .addTimeline( // Add a first timeline\n * 'timeline-1', // Give it a name\n * \"animation\", // This is RAF based timeline\n * 200, // The duration of the timeline in seconds\n * false, // The presentation does NOT play in a loop\n * \".timeline-container\" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered\n * )\n * .editTimelineProviderSettings() // Add a timeline provider\n * .addProvider(\"animation\", \"RafPositionSource\") // Timelines of type 'animation' get their time from requestAnimationFrame\n * .setContainer(\".timeline-container\") // The element the timeline renders into\n * .end(); // This finally returns the ConfigurationFactory instance\n * ```\n *\n * Then to add an init action:\n * ```ts\n * factory\n * .createInitAction(\"GetUserName\")\n * .addStartOperationByType(getQueryParams, {\n * defaultValues: { username: \"guest\" },\n * })\n * .addStartOperationByType(setGlobalData, { properties: [\"queryParams\"] });\n * ```\n *\n * After that, add a timeline action:\n * ```ts\n * factory.createTimelineAction(\"timeline-1\", \"AddIntroContainer\")\n * .addDuration(0, 10)\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\n * .addStartOperationByType(setElementContent, {\n * template: '<div class=\"intro-text\"></div>',\n * })\n * .addEndOperationByType(selectElement, { selector: \".intro-text\" })\n * .addEndOperationByType(removeElement, {});\n * ```\n *\n * It also possible to extend the factory with specialized creation methods for the particular\n * configuration you are building:\n * ```ts\n * function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {\n * this.createInitAction(actionName)\n * .addStartOperationByType(selectElement, { selector: \".timeline-container\" })\n * .addStartOperationByType(createElement, { elementName: 'img', attributes: {src: imageSrc, id: imageId} })\n * .addStartOperationByType(setElementContent, { insertionType: \"append\" })\n * .addEndOperationByType(selectElement, { selector: `#${imageId}` })\n * .addEndOperationByType(removeElement, {});\n * }\n *\n * const customFactory = ConfigurationFactory.extend(factory, \"addImage\", addImage);\n *\n * customFactory.addImage(\"MyImageActionName\", \"my-image.png\", \"my-image-id\");\n * ```\n *\n * Finally, retrieve the configuration and save it:\n * ```ts\n * import fs from \"node:fs\";\n *\n * const configuration = customFactory.getConfiguration();\n *\n * fs.writeFileSync(\"/my/path/configuration.json\", JSON.stringify(configuration), {encoding:'utf-8'})\n * ```\n *\n * In plain Node (build tools, code generators) import the factory from `eligius/configuration-api`.\n * That entry does not load jQuery or the other DOM dependencies. It supports every method except the\n * `...ByType` ones, which need the operation implementations; use the name based methods there:\n * ```ts\n * import {ConfigurationFactory} from 'eligius/configuration-api';\n *\n * factory.createAction('MyAction').addStartOperation('selectElement', {selector: '#app'});\n * ```\n *\n * The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply\n * pass the JSON configuration to the `ConfigurationFactory`'s constructor:\n * ```ts\n * import myConfiguration from './my-configuration.json';\n *\n * const factory = new ConfigurationFactory(myConfiguration);\n *\n * factory.editInitAction(\"existingActionName\")\n * .removeEndOperation(\"475fd0ab-5755-4e60-8f7c-e1988a109678\");\n * ```\n */\nexport class ConfigurationFactory {\n actionCreatorFactory: ActionCreatorFactory;\n\n /**\n * The custom operation names this factory accepts besides the built-in\n * operations, from the `customOperations` option.\n */\n readonly customOperationNames: ReadonlySet<string>;\n\n /**\n * Constructs a new `ConfigurationFactory`\n * @param configuration an optional existing configuration that will be used as a starting point\n * @param options optional settings, see {@link IConfigurationFactoryOptions}\n * @throws Error when `options.customOperations` is not an array of non-empty strings\n *\n * @example Accepting a custom operation\n * ```ts\n * const factory = new ConfigurationFactory(undefined, {customOperations: ['trackEvent']});\n * factory.createAction('Track').addStartOperation('trackEvent', {category: 'intro'});\n * ```\n */\n constructor(\n public configuration: IEngineConfiguration = {} as any,\n options: IConfigurationFactoryOptions = {}\n ) {\n this.customOperationNames = toCustomOperationNames(\n options?.customOperations\n );\n this.actionCreatorFactory = new ActionCreatorFactory(this);\n }\n\n /**\n * Add specialized method to a factory\n *\n * @param factory\n * @param extensionMethodName\n * @param extensionMethod\n * @returns\n */\n static extend<\n T extends ConfigurationFactory,\n K extends PropertyKey,\n C extends (this: T & {[P in K]: C}, ...args: any[]) => any,\n >(factory: T, extensionMethodName: K, extensionMethod: C): T & {[P in K]: C} {\n return Object.defineProperty<T & {[P in K]: C}>(\n factory as any,\n extensionMethodName,\n {\n value: function (this: T & {[P in K]: C}, ...args: Parameters<C>) {\n return extensionMethod.apply(this, args);\n },\n writable: true,\n configurable: true,\n }\n );\n }\n\n /**\n * Add specialized methods to a factory\n *\n * @param factory\n * @param extensions\n * @returns\n */\n static extendMultiple<\n T extends ConfigurationFactory,\n C extends ConfigurationFactoryExtension<T>,\n D extends {[name: string]: C},\n >(factory: T, extensions: D) {\n return Object.entries(extensions).reduce<T & typeof extensions>(\n (acc, [name, method]) =>\n ConfigurationFactory.extend(acc, name, method) as T & typeof extensions,\n factory as T & typeof extensions\n );\n }\n\n /**\n * Initialize the configuration with a minimal shape.\n *\n * It assigns an ID, sets the engine to `EligiusEngine`, default the containerSelector `[data-ct-container=true]`\n * and initializes all of the list properties with empty arrays.\n * @param defaultLanguage\n * @returns\n */\n init(defaultLanguage: TLanguageCode) {\n const newConfiguration: IEngineConfiguration = {\n id: uuidv4(),\n engine: {\n systemName: 'EligiusEngine',\n },\n containerSelector: '[data-ct-container=true]',\n cssFiles: [],\n timelineProviderSettings: {},\n language: defaultLanguage,\n availableLanguages: [],\n layoutTemplate: '',\n initActions: [],\n actions: [],\n timelines: [],\n };\n\n this.configuration = mergeIfMissing(this.configuration, newConfiguration);\n\n return this;\n }\n\n /**\n * Assigns the engine system name\n * @param systemName\n * @returns\n */\n setEngine(systemName: string) {\n this.configuration.engine.systemName = systemName;\n return this;\n }\n\n /**\n * Assigns a string representation of the HTML layout template for the engine.\n *\n * @param layoutTemplate\n * @returns\n */\n setLayoutTemplate(layoutTemplate: string) {\n this.configuration.layoutTemplate = layoutTemplate;\n return this;\n }\n\n /**\n *\n * Assigns the default language\n *\n * @param defaultLanguage\n * @returns\n */\n setDefaultLanguage(defaultLanguage: TLanguageCode) {\n this.configuration.language = defaultLanguage;\n return this;\n }\n\n /**\n *\n * Assign the css selector that specifies the DOM location where the engine renders its output\n *\n * @param selector\n * @returns\n */\n setContainerSelector(selector: string) {\n this.configuration.containerSelector = selector;\n return this;\n }\n\n /**\n *\n * Starts an editing process for the timeline provider settings.\n *\n * @returns\n */\n editTimelineProviderSettings() {\n this.configuration.timelineProviderSettings ??= {};\n return new TimelineProvidersSettingsEditor(\n this.configuration.timelineProviderSettings,\n this\n );\n }\n\n /**\n *\n * Return a copy of the current state of the configuration\n *\n * @param callBack the callback receives a copy of the configuration and can return a changed version. The changes are applied to the factory's configuration in place, so editors that are still open keep working.\n * @returns\n */\n getConfiguration(\n callBack?: (copy: IEngineConfiguration) => IEngineConfiguration\n ) {\n const copy = deepCopy<IEngineConfiguration>(this.configuration);\n if (callBack) {\n const newConfig = callBack.call(this, copy);\n // Update the existing configuration in place, so editors that hold\n // objects inside it stay attached to the factory.\n syncInPlace(\n this.configuration,\n deepCopy<IEngineConfiguration>(newConfig)\n );\n }\n return copy;\n }\n\n /**\n *\n * Adds a language to the `availableLanguages` list.\n * The label represents the name of the language.\n *\n * An error is thrown if a language with the given language code already exists\n *\n * @example\n * factory.addLanguage('en-GB', 'English');\n *\n * @param languageCode The given alnguage code\n * @param languageLabel The human readable name of the language\n * @returns\n */\n addLanguage(languageCode: TLanguageCode, languageLabel: string) {\n const languages = this._initializeCollection(\n this.configuration,\n 'availableLanguages'\n );\n const existing = languages.find(lang => lang.languageCode === languageCode);\n\n if (existing) {\n throw new Error(`Language code '${languageCode}' already exists`);\n }\n\n languages.push({\n id: uuidv4(),\n languageCode: languageCode,\n label: languageLabel,\n });\n return this;\n }\n\n private _internalAddAction(\n collectionName: TEngineConfigurationLists,\n action: IActionConfiguration\n ) {\n if (UNIQUE_NAME_LISTS.includes(collectionName)) {\n this._assertActionNameFree(action.name, action);\n }\n const actions = this._initializeCollection(\n this.configuration,\n collectionName\n );\n actions?.push(action as any);\n }\n\n /**\n * Throws when the given action is in `actions` or `eventActions` and another\n * action in those lists already has the given name. Action names must be\n * unique across those two lists, the rule the `ConfigurationResolver`\n * enforces, so the fluent API reports a duplicate where it is made instead of\n * when the engine is created. Init actions and timeline actions are not\n * checked.\n *\n * Called by the action creators and editors before they rename an action.\n *\n * @param name the new action name\n * @param action the action that gets the name\n * @throws Error when the name is already taken\n */\n assertUniqueActionName(name: string, action: IActionConfiguration): void {\n const isChecked = UNIQUE_NAME_LISTS.some(listName =>\n (\n this.configuration[listName] as IActionConfiguration[] | undefined\n )?.includes(action)\n );\n if (isChecked) {\n this._assertActionNameFree(name, action);\n }\n }\n\n private _assertActionNameFree(name: string, action: IActionConfiguration) {\n // Empty names are not checked, so an action can be created first and named later\n if (!name) {\n return;\n }\n const taken = UNIQUE_NAME_LISTS.some(listName =>\n (\n this.configuration[listName] as IActionConfiguration[] | undefined\n )?.some(other => other !== action && other.name === name)\n );\n if (taken) {\n throw new Error(\n `Action name '${name}' already exists in actions or eventActions. Action names must be unique across actions and eventActions.`\n );\n }\n }\n\n private _initializeCollection<T, K extends keyof T>(\n parent: T,\n name: K\n ): T[K] {\n if (!parent[name]) {\n (parent[name] as any) = [];\n }\n return parent[name] as T[K];\n }\n\n /**\n *\n * Adds the specified action to the `actions` list.\n *\n * @param action\n */\n addAction(action: IActionConfiguration) {\n this._internalAddAction('actions', action);\n }\n\n /**\n *\n * Adds the specified action to the `initActions` list\n *\n * @param action\n */\n addInitAction(action: IActionConfiguration) {\n this._internalAddAction('initActions', action);\n }\n\n /**\n *\n * Adds the specified action to the `eventActions` list\n *\n * @param action\n */\n addEventAction(action: IActionConfiguration) {\n this._internalAddAction('eventActions', action);\n }\n\n /**\n *\n * Adds the given actions to `timelineActions` list that is associated with the specified uri\n *\n * @param uri\n * @param action\n */\n addTimelineAction(uri: string, action: ITimelineActionConfiguration) {\n const timeline = this.getTimeline(uri);\n if (timeline) {\n const timelineActions = this._initializeCollection(\n timeline,\n 'timelineActions'\n );\n timelineActions.push(action);\n } else {\n throw Error(`No timeline found for uri '${uri}'`);\n }\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `actions` list\n *\n * @param name\n * @returns\n */\n createAction(name: string) {\n return this.actionCreatorFactory.createAction(name);\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `initActions` list\n *\n * @param name\n * @returns\n */\n createInitAction(name: string) {\n return this.actionCreatorFactory.createInitAction(name);\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `eventActions` list\n *\n * @param name\n * @param eventName the event that starts the action. Without it the action can\n * only be started by name (for example by a `DOMEventListenerController` or\n * `KeyboardController`).\n * @param eventTopic optional topic of the event\n * @returns\n *\n * @example\n * ```ts\n * factory\n * .createEventAction('OnLanguageChange', 'language-change')\n * .addStartOperation('log', {});\n * ```\n */\n createEventAction(name: string, eventName?: string, eventTopic?: string) {\n return this.actionCreatorFactory.createEventAction(\n name,\n eventName,\n eventTopic\n );\n }\n\n /**\n *\n * Starts the creation of a new action with the specified name that gets added to the `timelineActions` list that is associated with the specified uri\n *\n * @param uri\n * @param name\n * @returns\n */\n createTimelineAction(uri: string, name: string) {\n return this.actionCreatorFactory.createTimelineAction(uri, name);\n }\n\n /**\n * Add a timeline with the given data\n *\n * @param uri identifier for the timeline\n * @param type animation or mediaplayer\n * @param duration the duration of the timeline in seconds\n * @param isLooped True if the timeline should automatically restart at the end\n * @param selector css selector for the container where the timeline will be rendered\n * @returns\n */\n addTimeline(\n uri: string,\n type: TimelineTypes,\n duration: number,\n isLooped: boolean,\n selector: string\n ) {\n const timelines = this._initializeCollection(\n this.configuration,\n 'timelines'\n );\n const timeline = this.getTimeline(uri);\n if (timeline) {\n throw Error(`timeline for uri ${uri} already exists`);\n }\n const timelineConfig: ITimelineConfiguration = {\n id: uuidv4(),\n type: type,\n uri: uri,\n duration: duration,\n loop: isLooped,\n selector: selector,\n timelineActions: [],\n };\n timelines.push(timelineConfig);\n return this;\n }\n\n /**\n * Gives the timeline its own position source settings, merged over the\n * settings of its type in `timelineProviderSettings` (see\n * `ITimelineConfiguration.positionSource`).\n *\n * @param uri - URI of the timeline\n * @param positionSource - The override. Leave out `systemName` to change\n * single settings of the type's position source, or name another class to\n * replace it for this timeline. `undefined` removes the override.\n * @returns The factory\n * @throws Error when no timeline has the URI\n *\n * @example\n * ```ts\n * factory\n * .addTimeline('intro', 'animation', 10, false, '#intro')\n * .addTimeline('chapter-1', 'animation', 60, false, '#chapter-1')\n * .setTimelinePositionSource('chapter-1', {\n * systemName: 'ScrollPositionSource',\n * selector: '#chapter-1',\n * });\n * ```\n */\n setTimelinePositionSource(\n uri: string,\n positionSource: Partial<IPositionSourceConfig> | undefined\n ) {\n const timeline = this._requireTimeline(uri, 'setTimelinePositionSource');\n if (positionSource === undefined) {\n delete timeline.positionSource;\n } else {\n timeline.positionSource = deepCopy(positionSource);\n }\n return this;\n }\n\n /**\n * Gives the timeline its own container provider settings, merged over the\n * `container` settings of its type in `timelineProviderSettings` (see\n * `ITimelineConfiguration.containerProvider`).\n *\n * @param uri - URI of the timeline\n * @param containerProvider - The override, for example\n * `{selector: '#chapter-1'}`. `undefined` removes the override.\n * @returns The factory\n * @throws Error when no timeline has the URI\n */\n setTimelineContainerProvider(\n uri: string,\n containerProvider: Partial<IContainerProviderConfig> | undefined\n ) {\n const timeline = this._requireTimeline(uri, 'setTimelineContainerProvider');\n if (containerProvider === undefined) {\n delete timeline.containerProvider;\n } else {\n timeline.containerProvider = deepCopy(containerProvider);\n }\n return this;\n }\n\n private _requireTimeline(uri: string, methodName: string) {\n const timeline = this.configuration.timelines\n ? this.getTimeline(uri)\n : undefined;\n if (!timeline) {\n throw new Error(\n `ConfigurationFactory.${methodName}: no timeline found for uri '${uri}'`\n );\n }\n return timeline;\n }\n\n /**\n *\n * Gets the timeline associated with the specified uri\n *\n * @param uri\n * @returns\n */\n getTimeline(uri: string) {\n return this.configuration.timelines.find(t => t.uri === uri);\n }\n\n /**\n *\n * Removes the timeline associated with the specified uri\n *\n * @param uri\n * @returns\n */\n removeTimeline(uri: string) {\n const timelineConfig = this.getTimeline(uri);\n if (timelineConfig) {\n const idx = this.configuration.timelines.indexOf(timelineConfig);\n if (idx > -1) {\n this.configuration.timelines.splice(idx, 1);\n }\n }\n return this;\n }\n\n /**\n *\n * Starts an editor for the action from the `actions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editAction(id: string) {\n const actionConfig = this.configuration.actions.find(a => a.id === id);\n if (actionConfig) {\n return new EndableActionEditor(actionConfig, this);\n }\n throw new Error(`Action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `eventActions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editEventAction(id: string) {\n const actionConfig = this.configuration.eventActions?.find(\n a => a.id === id\n );\n if (actionConfig) {\n return new ActionEditor(actionConfig, this);\n }\n throw new Error(`Event action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `initActions` list associated with the given id\n *\n * @param id\n * @returns\n */\n editInitAction(id: string) {\n const actionConfig = this.configuration.initActions.find(a => a.id === id);\n if (actionConfig) {\n return new EndableActionEditor(actionConfig, this);\n }\n throw new Error(`Init action not found for id ${id}`);\n }\n\n /**\n *\n * Starts an editor for the action from the `timelineActions` list associated with the given uri and id\n *\n * @param uri\n * @param id\n * @returns\n */\n editTimelineAction(uri: string, id: string) {\n const timeline = this.getTimeline(uri);\n if (!timeline) {\n throw new Error(`No timeline found for uri '${uri}'`);\n }\n const actionConfig = timeline.timelineActions.find(a => a.id === id);\n if (actionConfig) {\n return new TimelineActionEditor(actionConfig, this);\n }\n throw new Error(\n `Timeline action not found for id '${id}' in timeline '${uri}'`\n );\n }\n}\n","import type {TControllerName, TOperationName} from '@configuration/types.ts';\nimport * as controllerMetadata from '@controllers/metadata/index.ts';\nimport * as operationMetadata from '@operation/metadata/index.ts';\nimport type {IOperationMetadata} from '@operation/metadata/types.ts';\nimport type {TOperationData} from '@operation/types.ts';\n\n// The providers read the generated metadata instead of the operation and\n// controller implementations, so they work in a DOM-less context. The metadata\n// has one entry per operation and per controller.\n\n/**\n *\n * Provider for all the available operation names\n *\n */\nexport class OperationNamesProvider {\n getOperationNames(): TOperationName[] {\n return Object.keys(operationMetadata) as TOperationName[];\n }\n}\n\n/**\n *\n * Provider for all the available controller names\n *\n */\nexport class ControllerNamesProvider {\n getControllerNames(): TControllerName[] {\n return Object.keys(controllerMetadata) as TControllerName[];\n }\n}\n\n/**\n *\n * Provider that can retrieve the metadata associated with a given operation name\n *\n */\nexport class OperationMetadataProvider {\n getOperationMetadata(operationName: TOperationName) {\n const getMetadata = (\n operationMetadata as Record<\n TOperationName,\n () => IOperationMetadata<TOperationData>\n >\n )[operationName];\n if (!getMetadata) {\n throw new Error(\n `Could not find metadata for operation called ${operationName}`\n );\n }\n return getMetadata();\n }\n}\n","import {v4 as uuidv4} from 'uuid';\nimport type {IStrictDuration, ISubtitle} from '../../types.ts';\n\n/**\n * This class converts an AVID subtitle file to an `ISubtitle` array.\n *\n * Every subtitle gets a unique `id`. The lines of a multi-line caption are\n * joined with a newline (`\\n`), never with HTML.\n */\nexport class SubtitleImporter {\n importSubtitles(rawLines: string[]): ISubtitle[] {\n const result: ISubtitle[] = [];\n const lines: string[] = [];\n for (let i: number = 0, l: number = rawLines.length; i < l; i++) {\n const rawLine: string = this.stripNewlineChars(rawLines[i].toString());\n if (this.isValidLine(rawLine)) {\n lines.push(rawLine);\n }\n }\n\n // A caption is a duration line followed by its text lines, blank lines\n // separate the captions.\n let duration: IStrictDuration | undefined;\n let textLines: string[] = [];\n const flush = () => {\n if (duration) {\n result.push({id: uuidv4(), duration, text: textLines.join('\\n')});\n }\n duration = undefined;\n textLines = [];\n };\n lines.forEach((line: string) => {\n if (line.length === 0) {\n flush();\n } else if (!duration) {\n duration = this.convertDuration(line);\n } else {\n textLines.push(line);\n }\n });\n flush();\n\n return result;\n }\n\n stripNewlineChars(str: string): string {\n let res: string = '';\n for (let i: number = 0, l: number = str.length; i < l; i++) {\n if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {\n res += str.charAt(i);\n }\n }\n return res;\n }\n\n isValidLine(line: string): boolean {\n return (\n !line.startsWith('@') &&\n !line.startsWith('<begin subtitles>') &&\n !line.startsWith('<end subtitles>')\n );\n }\n\n convertDuration(time: string): IStrictDuration {\n const times: string[] = time.split(' ');\n return {\n start: this.convertTimeToSeconds(times[0]),\n end: this.convertTimeToSeconds(times[1]),\n };\n }\n\n convertTimeToSeconds(time: string): number {\n const parts: string[] = time.split(':');\n return (\n parseInt(parts[0], 10) * 3600 +\n parseInt(parts[1], 10) * 60 +\n parseInt(parts[2], 10)\n );\n }\n}\n","import {v4 as uuidv4} from 'uuid';\nimport type {\n IStrictDuration,\n ISubtitle,\n ISubtitleCollection,\n TLanguageCode,\n} from '../../types.ts';\n\n/**\n * Used to edit and add to an {@link ISubtitleCollection}.\n */\nexport class SubtitleEditor {\n constructor(private collection: ISubtitleCollection[] = []) {}\n\n private _getLanguage(languageCode: string) {\n return this.collection.find(x => x.languageCode === languageCode);\n }\n\n /**\n * Adds a new {@link ISubtitleCollection} for the given `languageCode`.\n *\n * If collections already exist for existing language codes then a duplicate\n * of these collections is created with the same duration info but all of the\n * text is left empty.\n *\n * @param languageCode\n * @returns\n */\n addLanguage(languageCode: TLanguageCode) {\n const language = this._getLanguage(languageCode);\n if (language) {\n throw new Error(`Language ${languageCode} already exists.`);\n }\n const newLanguage: ISubtitleCollection = this.collection.length\n ? {\n ...this.collection[0],\n languageCode,\n titles: this.collection[0].titles.map(x => ({\n id: uuidv4(),\n duration: {...x.duration},\n text: '',\n })),\n }\n : {\n languageCode,\n titles: [],\n };\n this.collection.push(newLanguage);\n return this;\n }\n\n /**\n *\n * Add a single subtitle line that is associated with the given `languageCode`\n *\n * @param languageCode\n * @param subtitle\n * @returns\n */\n addSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\n const language = this._getLanguage(languageCode);\n if (!language) {\n throw new Error(`Language ${languageCode} does not exist.`);\n }\n language.titles.push(subtitle);\n return this;\n }\n\n addSubtitles(\n duration: IStrictDuration,\n subtitles: Record<TLanguageCode, string>\n ) {\n Object.entries(subtitles).forEach(([languageCode, subtitle]) =>\n this.addSubtitle(languageCode as TLanguageCode, {\n id: uuidv4(),\n duration: {...duration},\n text: subtitle,\n })\n );\n return this;\n }\n\n setSubtitle(languageCode: TLanguageCode, subtitle: ISubtitle) {\n const language = this._getLanguage(languageCode);\n if (!language) {\n throw new Error(`Language ${languageCode} does not exist.`);\n }\n\n const titleIdx = language.titles.findIndex(x => x.id === subtitle.id);\n if (titleIdx < 0) {\n throw new Error(\n `Subtitle with id '${subtitle.id}' was not found in language with code ${languageCode}.`\n );\n }\n\n language.titles[titleIdx] = {\n ...subtitle,\n duration: {...subtitle.duration},\n };\n return this;\n }\n\n export() {\n return this.collection;\n }\n}\n","export type {IDOMEventListenerControllerOperationData} from '@controllers/dom-event-listener-controller.ts';\nexport {DOMEventListenerController} from '@controllers/dom-event-listener-controller.ts';\nexport type {\n IKeyboardControllerOperationData,\n TKeyboardControllerScope,\n} from '@controllers/keyboard-controller.ts';\nexport {KeyboardController} from '@controllers/keyboard-controller.ts';\nexport type {ILabelControllerMetadata} from '@controllers/label-controller.ts';\nexport {LabelController} from '@controllers/label-controller.ts';\nexport type {ILottieControllerMetadata} from '@controllers/lottie-controller.ts';\nexport {LottieController} from '@controllers/lottie-controller.ts';\nexport type {\n IMutationEventPayload,\n IMutationObserverControllerMetadata,\n} from '@controllers/mutation-observer-controller.ts';\nexport {MutationObserverController} from '@controllers/mutation-observer-controller.ts';\nexport type {INavigationControllerOperationData} from '@controllers/navigation-controller.ts';\nexport {NavigationController} from '@controllers/navigation-controller.ts';\nexport type {IProgressbarControllerOperationData} from '@controllers/progressbar-controller.ts';\nexport {ProgressbarController} from '@controllers/progressbar-controller.ts';\nexport type {IRoutingControllerOperationData} from '@controllers/routing-controller.ts';\nexport {RoutingController} from '@controllers/routing-controller.ts';\nexport type {ISubtitlesControllerOperationData} from '@controllers/subtitles-controller.ts';\nexport {SubtitlesController} from '@controllers/subtitles-controller.ts';\n","export {ActionRegistryEventbusListener} from '@eventbus/actionregistry-eventbus-listener.ts';\nexport {Eventbus} from '@eventbus/eventbus.ts';\nexport * from '@eventbus/events/index.ts';\nexport type {IEventMetadata} from '@eventbus/events/metadata/types.ts';\nexport {RequestVideoUriInterceptor} from '@eventbus/request-video-uri-interceptor.ts';\nexport * from '@eventbus/types.ts';\n","// =============================================================================\n// DECOMPOSED INTERFACES (new architecture)\n// =============================================================================\n\nexport type {\n IContainerProvider,\n IPlaylist,\n IPositionSource,\n ISeekable,\n TBoundary,\n TSourceState,\n} from '@timelineproviders/types.ts';\n\nexport {isSeekable} from '@timelineproviders/types.ts';\n\n// =============================================================================\n// DECOMPOSED POSITION SOURCES (new architecture)\n// =============================================================================\n\nexport {BasePositionSource} from '@timelineproviders/position-sources/base-position-source.ts';\nexport type {\n KeyboardStepSourceConfig,\n TVerticalMode,\n} from '@timelineproviders/position-sources/keyboard-step-source.ts';\nexport {KeyboardStepSource} from '@timelineproviders/position-sources/keyboard-step-source.ts';\nexport type {RafPositionSourceConfig} from '@timelineproviders/position-sources/raf-position-source.ts';\nexport {RafPositionSource} from '@timelineproviders/position-sources/raf-position-source.ts';\nexport type {ScrollPositionSourceConfig} from '@timelineproviders/position-sources/scroll-position-source.ts';\nexport {ScrollPositionSource} from '@timelineproviders/position-sources/scroll-position-source.ts';\nexport type {\n VideoPositionSourceConfig,\n VideoSource,\n} from '@timelineproviders/position-sources/video-position-source.ts';\nexport {VideoPositionSource} from '@timelineproviders/position-sources/video-position-source.ts';\n\n// =============================================================================\n// DECOMPOSED CONTAINER PROVIDERS (new architecture)\n// =============================================================================\n\nexport type {DomContainerProviderConfig} from '@timelineproviders/container-providers/dom-container-provider.ts';\nexport {DomContainerProvider} from '@timelineproviders/container-providers/dom-container-provider.ts';\n\n// =============================================================================\n// DECOMPOSED PLAYLIST (new architecture)\n// =============================================================================\n\nexport type {SimplePlaylistConfig} from '@timelineproviders/playlist/simple-playlist.ts';\nexport {SimplePlaylist} from '@timelineproviders/playlist/simple-playlist.ts';\n","import * as ctrls from '@controllers/index.ts';\nimport * as evtb from '@eventbus/index.ts';\nimport * as ops from '@operation/index.ts';\nimport type {TOperation} from '@operation/types.ts';\nimport * as prvdrs from '@timelineproviders/index.ts';\nimport {findClosestNames, formatDidYouMean} from '@util/find-closest-names.ts';\nimport {EligiusEngine} from '../eligius-engine.ts';\nimport type {\n IEligiusResourceRegistrations,\n IResourceImporter,\n TRegisteredResourceKind,\n} from '../types.ts';\nimport {checkShape, describeKind} from './registration-shape.ts';\n\nconst operations: Record<string, TOperation<any>> = ops as any;\nconst controllers: Record<string, any> = ctrls;\nconst providers: Record<string, any> = prvdrs;\nconst eventbus: Record<string, any> = evtb;\n\ninterface IRegisteredResource {\n kind: TRegisteredResourceKind;\n value: unknown;\n}\n\nconst REGISTRATION_KINDS: ReadonlyArray<\n readonly [\n Exclude<keyof IEligiusResourceRegistrations, 'override'>,\n TRegisteredResourceKind,\n ]\n> = [\n ['operations', 'operation'],\n ['functions', 'function'],\n ['controllers', 'controller'],\n ['templates', 'template'],\n ['json', 'json'],\n];\n\n/**\n * The default resource importer. It provides every operation, controller,\n * timeline provider and eventbus export of Eligius, plus the `EligiusEngine`\n * class.\n *\n * Custom operations, functions, controllers, templates and JSON can be\n * registered by passing an {@link IEligiusResourceRegistrations} map to the\n * constructor. Registered operations and controllers are listed by\n * {@link getOperationNames} and {@link getControllerNames}, so the\n * configuration resolver accepts them and includes them in its \"did you mean\"\n * hints. Registered functions serve `customFunction`, and registered\n * templates and JSON serve the `template:` and `json:` placeholders;\n * `getImport` can retrieve any registered resource.\n *\n * For resources that cannot be registered this way (custom position sources,\n * container providers or playlists), pass a custom {@link IResourceImporter}\n * to the `EngineFactory`, for example one that delegates to this importer for\n * the other names.\n *\n * @example\n * ```ts\n * const importer = new EligiusResourceImporter({\n * operations: {logMessage: data => {console.log(data.message); return data;}},\n * functions: {greet: () => alert('Hello')},\n * });\n * const factory = new EngineFactory(importer, window);\n * ```\n */\nexport class EligiusResourceImporter implements IResourceImporter {\n engines = new Map();\n private readonly _registered = new Map<string, IRegisteredResource>();\n\n /**\n * @param registrations - Optional custom resources, see\n * {@link IEligiusResourceRegistrations}\n * @throws Error when a registered value has the wrong shape for its kind\n * (for example a class registered as an operation), when a name is\n * registered in more than one map, or when a name clashes with a built-in\n * name and `override` is not `true`. The message names the map and the\n * name.\n */\n constructor(registrations: IEligiusResourceRegistrations = {}) {\n this.engines.set('EligiusEngine', EligiusEngine);\n this._register(registrations);\n }\n\n /**\n * @returns The names of the built-in and the registered operations\n */\n getOperationNames(): string[] {\n return this._listNames(Object.keys(operations), 'operation');\n }\n\n /**\n * @returns The names of the built-in and the registered controllers\n */\n getControllerNames(): string[] {\n return this._listNames(Object.keys(controllers), 'controller');\n }\n\n /**\n * @returns The names of the built-in timeline provider exports\n */\n getProviderNames(): string[] {\n return this._listNames(Object.keys(providers));\n }\n\n /**\n * @returns The names of the registered functions (for `customFunction`)\n */\n getFunctionNames(): string[] {\n return this._listNames([], 'function');\n }\n\n /**\n * Returns the named resource as `{[name]: value}`.\n *\n * Registered resources are found by their own name only; a name inherited\n * from `Object.prototype` (such as `toString`) is never served.\n *\n * @param name - The system name of an operation, controller, timeline\n * provider, eventbus export, engine, or a registered function, template or\n * JSON value\n * @returns A record with `name` as its only key\n * @throws Error naming the unknown name, with the closest known names when\n * there are any, when `name` is not provided by this importer.\n *\n * @example\n * ```ts\n * const {selectElement} = new EligiusResourceImporter().import('selectElement');\n * ```\n */\n import(name: string): Record<string, any> {\n // Built-in names are only registered when `override` allowed it, so the\n // registered entry wins for those.\n const registered = this._registered.get(name);\n const value = registered\n ? registered.value\n : (ownValue(operations, name) ??\n ownValue(controllers, name) ??\n ownValue(providers, name) ??\n ownValue(eventbus, name) ??\n this.engines.get(name));\n\n if (value === undefined) {\n throw new Error(this._createUnknownNameMessage(name));\n }\n\n return {[name]: value};\n }\n\n private _register(registrations: IEligiusResourceRegistrations) {\n if (registrations === null || typeof registrations !== 'object') {\n throw new Error(\n `EligiusResourceImporter: the registrations must be an object, got ${describeKind(registrations)}.`\n );\n }\n const override = registrations.override === true;\n\n for (const [mapName, kind] of REGISTRATION_KINDS) {\n const map = registrations[mapName];\n if (map === undefined) {\n continue;\n }\n if (map === null || typeof map !== 'object' || Array.isArray(map)) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName} must be an object of names to values, got ${describeKind(map)}.`\n );\n }\n\n for (const name of Object.keys(map)) {\n const value = (map as Record<string, unknown>)[name];\n const shapeError = checkShape(kind, value);\n if (shapeError) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName}.${name} ${shapeError}`\n );\n }\n\n const earlier = this._registered.get(name);\n if (earlier) {\n throw new Error(\n `EligiusResourceImporter: '${name}' is registered more than once (as a ${earlier.kind} and as a ${kind}). Every registered name must be unique, rename one of them.`\n );\n }\n\n const builtIn = describeBuiltIn(name, this.engines);\n if (builtIn && !override) {\n throw new Error(\n `EligiusResourceImporter: registrations.${mapName}.${name} shadows the built-in ${builtIn} '${name}'. Rename it, or pass override: true to replace the built-in.`\n );\n }\n\n this._registered.set(name, {kind, value});\n }\n }\n }\n\n /**\n * Returns the given built-in names, without the ones a registration of a\n * different kind replaced, followed by the registered names of `kind`.\n */\n private _listNames(\n builtInNames: string[],\n kind?: TRegisteredResourceKind\n ): string[] {\n const names = builtInNames.filter(name => {\n const registered = this._registered.get(name);\n return !registered || registered.kind === kind;\n });\n for (const [name, registered] of this._registered) {\n if (registered.kind === kind && !names.includes(name)) {\n names.push(name);\n }\n }\n return names;\n }\n\n private _createUnknownNameMessage(name: string) {\n const message = `EligiusResourceImporter: unknown system name '${name}'.`;\n const knownNames = [\n ...new Set([\n ...Object.keys(operations),\n ...Object.keys(controllers),\n ...Object.keys(providers),\n ...Object.keys(eventbus),\n ...this.engines.keys(),\n ...this._registered.keys(),\n ]),\n ];\n const didYouMean = formatDidYouMean(\n findClosestNames(String(name), knownNames)\n );\n if (didYouMean) {\n return `${message} ${didYouMean}`;\n }\n return `${message} Check the spelling, or register it in the EligiusResourceImporter constructor.`;\n }\n}\n\nfunction ownValue(source: Record<string, any>, name: string) {\n return Object.hasOwn(source, name) ? source[name] : undefined;\n}\n\nfunction describeBuiltIn(\n name: string,\n engines: Map<string, unknown>\n): string | undefined {\n if (Object.hasOwn(operations, name)) {\n return 'operation';\n }\n if (Object.hasOwn(controllers, name)) {\n return 'controller';\n }\n if (Object.hasOwn(providers, name)) {\n return 'timeline provider export';\n }\n if (Object.hasOwn(eventbus, name)) {\n return 'eventbus export';\n }\n if (engines.has(name)) {\n return 'engine';\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoCA,SAAgB,qBAAqB,MAAsC;CACzE,OAAO,OAAO,OAAOA,oBAAmB,IAAI;AAC9C;;;;;;;;;;;;AAaA,SAAgB,yBACd,MACA,sBACM;CACN,IAAI,qBAAqB,IAAI,KAAK,sBAAsB,IAAI,IAAI,GAC9D;CAGF,MAAM,aAAa,CACjB,GAAG,OAAO,KAAKA,kBAAiB,GAChC,GAAI,wBAAwB,CAAC,CAC/B;CACA,MAAM,aAAa,iBACjB,iBAAiB,OAAO,IAAI,GAAG,UAAU,CAC3C;CAGA,MAAM,MACJ,sBAAsB,KAAK,IAAI,aAAa,GAAG,WAAW,KAAK,8JACjE;AACF;;;;;;;;;;;AAYA,MAAM,uCAAuB,IAAI,IAA6B;;;;;;;;;;AA2B9D,SAAgB,uBACd,eACA,YACA,qBACgB;CAChB,MAAM,OAAO,qBAAqB,IAAI,aAAa;CACnD,IAAI,MACF,OAAO;CAGT,IAAI,qBAAqB,SAAS,GAChC,MAAM,IAAI,MACR,GAAG,WAAW,sKACoD,oBAAoB,2DACxF;CAGF,MAAM,IAAI,MAAM,8BAA8B,OAAO,aAAa,GAAG;AACvE;;;;;;;;;AC1HA,MAAM,8BAAmC,IAAI,IAAI;CAC/C;CACA;CACA;AACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA0BD,SAAgB,YAA8B,QAAW,QAAiB;CACxE,IAAI,WAAW,QACb;CAEF,iBAAiB,wBAAQ,IAAI,QAAQ,CAAC;CACtC,IAAI,MAAM,QAAQ,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG;EAClD,UAAU,QAAQ,MAAM;EACxB;CACF;CACA,WACE,Q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