eligius 1.3.0 → 1.4.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __export } from "./chunk-CTAAG5j7.js";
1
+ import { t as __export } from "./chunk-Bp6m_JJh.js";
2
2
  import $ from "jquery";
3
3
  import { isDefined } from "ts-is-present";
4
4
  import fs from "node:fs";
@@ -212,10 +212,10 @@ function isExternalProperty(value) {
212
212
  *
213
213
  * At the start of the loop, the associated {@link endForEach} operation is determined and when
214
214
  * the last iteration is completed the flow control is set to the index of that operation.
215
- *
216
- * The {@link continueForEach|continue} and {@link breakForEach|break} operations can be used to control the
215
+ *
216
+ * The {@link continueForEach|continue} and {@link breakForEach|break} operations can be used to control the
217
217
  * loop iterations.
218
- *
218
+ *
219
219
  */
220
220
  const forEach = function(operationData) {
221
221
  const { collection } = operationData;
@@ -250,6 +250,43 @@ function findEndForEachIndex(scope) {
250
250
  const forEachSystemName = "forEach";
251
251
  const endForEachSystemName = "endForEach";
252
252
 
253
+ //#endregion
254
+ //#region src/operation/helper/remove-operation-properties.ts
255
+ /**
256
+ * Removes specified properties from an operation data object.
257
+ * This is a helper function to eliminate repetitive property deletion code across operations.
258
+ *
259
+ * @template T - The type of the operation data object
260
+ * @template K - The keys to remove from the object (must be keys of T)
261
+ * @param operationData - The operation data object to mutate
262
+ * @param keys - The property keys to delete from the object
263
+ * @returns The mutated operation data object with specified properties removed (typed as Omit<T, K>)
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * interface IMyOperationData {
268
+ * selectedElement: JQuery;
269
+ * animationDuration: number;
270
+ * animationEasing: string;
271
+ * }
272
+ *
273
+ * const data: IMyOperationData = {
274
+ * selectedElement: $element,
275
+ * animationDuration: 500,
276
+ * animationEasing: 'ease-in'
277
+ * };
278
+ *
279
+ * // Remove multiple properties at once
280
+ * const result = removeProperties(data, 'animationDuration', 'animationEasing');
281
+ * // result is typed as Omit<IMyOperationData, 'animationDuration' | 'animationEasing'>
282
+ * // result = { selectedElement: $element }
283
+ * ```
284
+ */
285
+ function removeProperties(operationData, ...keys) {
286
+ for (const key of keys) delete operationData[key];
287
+ return operationData;
288
+ }
289
+
253
290
  //#endregion
254
291
  //#region src/operation/when.ts
255
292
  /**
@@ -257,17 +294,17 @@ const endForEachSystemName = "endForEach";
257
294
  * until an {@link endWhen} or {@link otherwise} operation is encountered.
258
295
  *
259
296
  * Practically, this means an `if` or `if`/`else` statement control flow implementation in a list of operations.
260
- *
297
+ *
261
298
  * The expression is passed in as a formatted string.
262
299
  * The left and right values of the expression can be defined like this:
263
- *
300
+ *
264
301
  * 'constant': for a constant string
265
302
  * 100: for a constant number
266
303
  * $operationData.foo: for an operation data value
267
304
  * $globaldata.foo: for a global data value
268
305
  * $scope.loopIndex: for a scope value
269
306
  * @foo: for a variable value
270
- *
307
+ *
271
308
  * @example
272
309
  * $scope.variables.foo=='bar'
273
310
  * @example
@@ -280,10 +317,9 @@ const endForEachSystemName = "endForEach";
280
317
  */
281
318
  const when = function(operationData) {
282
319
  const [left, operator, right] = parseExpression(operationData.expression, operationData, this);
283
- delete operationData.expression;
320
+ removeProperties(operationData, "expression");
284
321
  this.whenEvaluation = evaluations[operator](left, right);
285
322
  if (!this.whenEvaluation) this.newIndex = findNextFlowControlIndex(this);
286
- delete operationData.expression;
287
323
  return operationData;
288
324
  };
289
325
  function parseExpression(expression, operationData, operationScope) {
@@ -495,8 +531,7 @@ function dashToCamelCase(input) {
495
531
  * @param assetInfo
496
532
  */
497
533
  function generateImporterSourceCode(config, configPath, assetInfo) {
498
- const importPaths = _gatherImportPaths(config, configPath, assetInfo);
499
- return _generateSourceCode(importPaths);
534
+ return _generateSourceCode(_gatherImportPaths(config, configPath, assetInfo));
500
535
  }
501
536
  function _generateSourceCode(importPaths) {
502
537
  const result = importPaths.filter((x) => x.defaultImport).map((imp) => `import ${imp.systemName} from '${imp.path}';`).concat(importPaths.filter((x) => !x.defaultImport).map((imp) => `import {${imp.systemName}} from '${imp.path ?? "eligius"}';`));
@@ -565,13 +600,11 @@ function _gatherOperations(config) {
565
600
  }
566
601
  function _gatherControllerImportPathsFromActions(actionsConfig) {
567
602
  if (!actionsConfig) return [];
568
- const operations$1 = actionsConfig.flatMap((x) => [...x.startOperations, ...x.endOperations ?? []]);
569
- return _gatherControllerImportPaths(operations$1);
603
+ return _gatherControllerImportPaths(actionsConfig.flatMap((x) => [...x.startOperations, ...x.endOperations ?? []]));
570
604
  }
571
605
  function _gatherOperationImportPathsFromActions(actionsConfig) {
572
606
  if (!actionsConfig) return [];
573
- const operations$1 = actionsConfig.flatMap((x) => [...x.startOperations, ...x.endOperations ?? []]);
574
- return _gatherOperationImportPaths(operations$1);
607
+ return _gatherOperationImportPaths(actionsConfig.flatMap((x) => [...x.startOperations, ...x.endOperations ?? []]));
575
608
  }
576
609
  function _gatherControllerImportPaths(operationConfigs) {
577
610
  if (!operationConfigs) return [];
@@ -674,7 +707,7 @@ const addGlobalsToOperation = (operationData) => {
674
707
  prev[current] = getGlobals(current);
675
708
  return prev;
676
709
  }, {});
677
- delete operationData.globalProperties;
710
+ removeProperties(operationData, "globalProperties");
678
711
  return Object.assign(operationData, globalValues);
679
712
  };
680
713
 
@@ -689,9 +722,7 @@ const addGlobalsToOperation = (operationData) => {
689
722
  */
690
723
  const animate = (operationData) => {
691
724
  const { selectedElement, animationEasing, animationProperties, animationDuration } = operationData;
692
- delete operationData.animationEasing;
693
- delete operationData.animationProperties;
694
- delete operationData.animationDuration;
725
+ removeProperties(operationData, "animationEasing", "animationProperties", "animationDuration");
695
726
  return new Promise((resolve, reject) => {
696
727
  try {
697
728
  if (animationEasing) selectedElement.animate(animationProperties, animationDuration, animationEasing, () => {
@@ -733,10 +764,10 @@ const animateWithClass = (operationData) => {
733
764
  //#endregion
734
765
  //#region src/operation/break-for-each.ts
735
766
  /**
736
- *
767
+ *
737
768
  * This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}
738
769
  * operation. This operation immediately moves to the loop end index, effectively stopping the loop.
739
- *
770
+ *
740
771
  */
741
772
  const breakForEach = function(operationData) {
742
773
  if (this.loopIndex !== void 0 && this.loopLength !== void 0) {
@@ -766,9 +797,7 @@ function resolveEventArguments(operationData, operationScope, eventArgs) {
766
797
  */
767
798
  const broadcastEvent = function(operationData) {
768
799
  const { eventArgs, eventTopic, eventName } = operationData;
769
- delete operationData.eventArgs;
770
- delete operationData.eventTopic;
771
- delete operationData.eventName;
800
+ removeProperties(operationData, "eventArgs", "eventTopic", "eventName");
772
801
  const eventArguments = resolveEventArguments(operationData, this, eventArgs);
773
802
  if (eventTopic) this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);
774
803
  else this.eventbus.broadcast(eventName, eventArguments);
@@ -784,8 +813,7 @@ const cache = [];
784
813
  */
785
814
  function resolvePropertyValues(operationData, operationScope, newProperties) {
786
815
  const copy = newProperties !== operationData ? deepCopy(newProperties) : newProperties;
787
- const resolvePropertyChain$1 = resolveExternalPropertyChain.bind(null, operationData, operationScope);
788
- resolveNewProperties(newProperties, copy, resolvePropertyChain$1);
816
+ resolveNewProperties(newProperties, copy, resolveExternalPropertyChain.bind(null, operationData, operationScope));
789
817
  return copy;
790
818
  }
791
819
  function resolveNewProperties(properties, copy, resolvePropertyChain$1) {
@@ -826,9 +854,7 @@ const calcFunctions = {
826
854
  const calc = function(operationData) {
827
855
  operationData = resolvePropertyValues(operationData, this, operationData);
828
856
  const { left, right, operator } = operationData;
829
- delete operationData.left;
830
- delete operationData.right;
831
- delete operationData.operator;
857
+ removeProperties(operationData, "left", "right", "operator");
832
858
  operationData.calculationResult = calcFunctions[operator](+left, +right);
833
859
  return operationData;
834
860
  };
@@ -858,7 +884,7 @@ const clearOperationData = (operationData) => {
858
884
  properties.forEach((name) => {
859
885
  delete operationData[name];
860
886
  });
861
- delete operationData.properties;
887
+ removeProperties(operationData, "properties");
862
888
  return operationData;
863
889
  }
864
890
  return {};
@@ -867,11 +893,11 @@ const clearOperationData = (operationData) => {
867
893
  //#endregion
868
894
  //#region src/operation/continue-for-each.ts
869
895
  /**
870
- *
896
+ *
871
897
  * This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}
872
- * operation. This operation immediately moves to the next loop index, effectively canceling the rest
898
+ * operation. This operation immediately moves to the next loop index, effectively canceling the rest
873
899
  * of the operations in the current iteration.
874
- *
900
+ *
875
901
  */
876
902
  const continueForEach = function(operationData) {
877
903
  if (this.loopIndex !== void 0 && this.loopLength !== void 0) {
@@ -893,9 +919,7 @@ const continueForEach = function(operationData) {
893
919
  const createElement = function(operationData) {
894
920
  operationData = resolvePropertyValues(operationData, this, operationData);
895
921
  const { elementName, attributes, text } = operationData;
896
- delete operationData.elementName;
897
- delete operationData.attributes;
898
- delete operationData.text;
922
+ removeProperties(operationData, "elementName", "attributes", "text");
899
923
  const serializedAttrs = attributes ? ` ${Object.entries(attributes).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}="${value}"`).join(" ")}` : "";
900
924
  operationData.template = text ? $(`<${elementName}${serializedAttrs}>${text}</${elementName}>`) : $(`<${elementName}${serializedAttrs}/>`);
901
925
  return operationData;
@@ -904,7 +928,7 @@ const createElement = function(operationData) {
904
928
  //#endregion
905
929
  //#region src/timeline-event-names.ts
906
930
  /**
907
- * These are the event names that are being braodcast and/or handled by Eligius.
931
+ * These are the event names that are being broadcast and/or handled by Eligius.
908
932
  */
909
933
  var TimelineEventNames = class {
910
934
  /**
@@ -996,7 +1020,7 @@ var TimelineEventNames = class {
996
1020
  */
997
1021
  const customFunction = function(operationData) {
998
1022
  const { systemName } = operationData;
999
- delete operationData.systemName;
1023
+ removeProperties(operationData, "systemName");
1000
1024
  return new Promise((resolve, reject) => {
1001
1025
  const resultCallback = (func) => {
1002
1026
  const promise = func.apply(this, [operationData]);
@@ -1023,11 +1047,10 @@ const endAction = (operationData) => {
1023
1047
  return new Promise((resolve, reject) => {
1024
1048
  newOperationData = mergeOperationData(newOperationData, actionOperationData);
1025
1049
  newOperationData.actionInstance.end(newOperationData).then(() => {
1026
- const sanitizedData = Object.keys(newOperationData).filter((key) => !(key in actionOperationData)).reduce((acc, key) => {
1050
+ internalResolve(resolve, Object.keys(newOperationData).filter((key) => !(key in actionOperationData)).reduce((acc, key) => {
1027
1051
  acc[key] = newOperationData[key];
1028
1052
  return acc;
1029
- }, {});
1030
- internalResolve(resolve, sanitizedData);
1053
+ }, {}));
1031
1054
  }, reject);
1032
1055
  });
1033
1056
  };
@@ -1063,7 +1086,7 @@ const endWhen = function(operationData) {
1063
1086
  */
1064
1087
  const extendController = (operationData) => {
1065
1088
  const { controllerInstance, controllerExtension } = operationData;
1066
- delete operationData.controllerExtension;
1089
+ removeProperties(operationData, "controllerExtension");
1067
1090
  operationData.controllerInstance = Object.assign(controllerInstance, controllerExtension);
1068
1091
  return operationData;
1069
1092
  };
@@ -1075,7 +1098,7 @@ const extendController = (operationData) => {
1075
1098
  */
1076
1099
  const getAttributesFromElement = (operationData) => {
1077
1100
  const { selectedElement, attributeNames } = operationData;
1078
- delete operationData.attributeNames;
1101
+ removeProperties(operationData, "attributeNames");
1079
1102
  operationData.attributeValues = attributeNames.reduce((acc, attrName) => {
1080
1103
  if (attrName !== "value") acc[attrName] = selectedElement.attr(attrName);
1081
1104
  else acc[attrName] = selectedElement.val();
@@ -1094,7 +1117,7 @@ const getAttributesFromElement = (operationData) => {
1094
1117
  */
1095
1118
  const getControllerFromElement = (operationData) => {
1096
1119
  const { selectedElement, controllerName } = operationData;
1097
- delete operationData.controllerName;
1120
+ removeProperties(operationData, "controllerName");
1098
1121
  const controller = getElementControllers(selectedElement)?.find((ctrl) => ctrl.name === controllerName);
1099
1122
  if (!controller) console.warn(`controller for name '${controllerName}' was not found on the given element`);
1100
1123
  operationData.controllerInstance = controller;
@@ -1109,7 +1132,7 @@ const getControllerFromElement = (operationData) => {
1109
1132
  */
1110
1133
  const getControllerInstance = function(operationData) {
1111
1134
  const { systemName } = operationData;
1112
- delete operationData.systemName;
1135
+ removeProperties(operationData, "systemName");
1113
1136
  operationData.controllerInstance = void 0;
1114
1137
  const resultCallback = (instance) => {
1115
1138
  operationData.controllerInstance = instance;
@@ -1256,7 +1279,7 @@ function modifyDimensions(dimensions, modifier) {
1256
1279
  */
1257
1280
  const getElementDimensions = (operationData) => {
1258
1281
  const { selectedElement, modifier } = operationData;
1259
- delete operationData.modifier;
1282
+ removeProperties(operationData, "modifier");
1260
1283
  let dimensions = {
1261
1284
  width: selectedElement.innerWidth() ?? 0,
1262
1285
  height: selectedElement.innerHeight() ?? 0
@@ -1297,8 +1320,7 @@ const getQueryParams = (operationData) => {
1297
1320
  const searchParams = new URLSearchParams(window.location.search);
1298
1321
  const queryParams = Object.fromEntries(searchParams.entries());
1299
1322
  const { defaultValues = {} } = operationData;
1300
- delete operationData.defaultValues;
1301
- delete operationData.defaultValues;
1323
+ removeProperties(operationData, "defaultValues");
1302
1324
  operationData.queryParams = {
1303
1325
  ...defaultValues,
1304
1326
  ...queryParams
@@ -1340,8 +1362,7 @@ const addToCache = (key, value) => {
1340
1362
  */
1341
1363
  const loadJson = async (operationData) => {
1342
1364
  const { url, cache: cache$2 } = operationData;
1343
- delete operationData.url;
1344
- delete operationData.cache;
1365
+ removeProperties(operationData, "url", "cache");
1345
1366
  if (cache$2 && jsonCache[url]) {
1346
1367
  operationData.json = jsonCache[url];
1347
1368
  return operationData;
@@ -1360,8 +1381,7 @@ const loadJson = async (operationData) => {
1360
1381
  const log = function(operationData) {
1361
1382
  if ("logValue" in operationData) {
1362
1383
  console.log(operationData.logName ?? "logValue", operationData.logValue);
1363
- delete operationData.logValue;
1364
- delete operationData.logName;
1384
+ removeProperties(operationData, "logValue", "logName");
1365
1385
  } else {
1366
1386
  const globalData = getGlobals();
1367
1387
  console.group("Operation info");
@@ -1446,7 +1466,7 @@ const removeClass = (operationData) => {
1446
1466
  */
1447
1467
  const removeControllerFromElement = function(operationData) {
1448
1468
  const { selectedElement, controllerName } = operationData;
1449
- delete controllerName.controllerName;
1469
+ delete operationData.controllerName;
1450
1470
  const controllers$1 = getElementControllers(selectedElement);
1451
1471
  const controller = controllers$1?.find((ctrl) => ctrl.name === controllerName);
1452
1472
  if (controller && controllers$1) {
@@ -1491,7 +1511,7 @@ const removePropertiesFromOperationData = (operationData) => {
1491
1511
  */
1492
1512
  const reparentElement = (operationData) => {
1493
1513
  const { selectedElement, newParentSelector } = operationData;
1494
- delete operationData.newParentSelector;
1514
+ removeProperties(operationData, "newParentSelector");
1495
1515
  selectedElement.remove().appendTo(newParentSelector);
1496
1516
  return operationData;
1497
1517
  };
@@ -1504,7 +1524,7 @@ const reparentElement = (operationData) => {
1504
1524
  */
1505
1525
  const requestAction = function(operationData) {
1506
1526
  const { systemName } = operationData;
1507
- delete operationData.systemName;
1527
+ removeProperties(operationData, "systemName");
1508
1528
  const resultCallback = (action) => {
1509
1529
  operationData.actionInstance = action;
1510
1530
  };
@@ -1529,8 +1549,7 @@ function findElementBySelector(root, selector) {
1529
1549
  const selectElement = function(operationData) {
1530
1550
  operationData.selector = resolveExternalPropertyChain(operationData, this, operationData.selector);
1531
1551
  const { selector, useSelectedElementAsRoot = false } = operationData;
1532
- delete operationData.selector;
1533
- delete operationData.useSelectedElementAsRoot;
1552
+ removeProperties(operationData, "selector", "useSelectedElementAsRoot");
1534
1553
  if (!selector) throw new Error("selectElement: selector is either empty or not defined.");
1535
1554
  if (useSelectedElementAsRoot && operationData.selectedElement) {
1536
1555
  const currentRoot = operationData.selectedElement;
@@ -1560,7 +1579,7 @@ const selectElement = function(operationData) {
1560
1579
  */
1561
1580
  const setData = function(operationData) {
1562
1581
  const { properties } = operationData;
1563
- delete operationData.properties;
1582
+ removeProperties(operationData, "properties");
1564
1583
  resolveTargets(properties, operationData, this);
1565
1584
  return operationData;
1566
1585
  };
@@ -1571,12 +1590,11 @@ function resolveTargets(data, operationData, scope) {
1571
1590
  if (!isDataTarget(rootTarget)) throw new Error(`Unrecognized target: ${rootTarget}, known targets are: ${knownTargets.join(", ")}`);
1572
1591
  const property = path$1.pop() ?? "";
1573
1592
  const propertyValue = resolveExternalPropertyChain(operationData, scope, data[item]);
1574
- const targets = {
1593
+ const propertyTarget = getPropertyChainValue(path$1, {
1575
1594
  scope,
1576
1595
  operationdata: operationData,
1577
1596
  globaldata: getGlobals()
1578
- };
1579
- const propertyTarget = getPropertyChainValue(path$1, targets[rootTarget]);
1597
+ }[rootTarget]);
1580
1598
  propertyTarget[property] = propertyValue;
1581
1599
  });
1582
1600
  }
@@ -1596,7 +1614,7 @@ function isDataTarget(value) {
1596
1614
  */
1597
1615
  const setElementAttributes = (operationData) => {
1598
1616
  const { attributes, selectedElement } = operationData;
1599
- delete operationData.attributes;
1617
+ removeProperties(operationData, "attributes");
1600
1618
  selectedElement.attr(attributes);
1601
1619
  return operationData;
1602
1620
  };
@@ -1625,8 +1643,7 @@ const setElementContent = (operationData) => {
1625
1643
  selectedElement.prepend(template);
1626
1644
  break;
1627
1645
  }
1628
- delete operationData.insertionType;
1629
- delete operationData.template;
1646
+ removeProperties(operationData, "insertionType", "template");
1630
1647
  return operationData;
1631
1648
  };
1632
1649
 
@@ -1637,8 +1654,7 @@ const setElementContent = (operationData) => {
1637
1654
  */
1638
1655
  const setGlobalData = (operationData) => {
1639
1656
  const { propertyNames,...newOperationData } = operationData;
1640
- const newGlobals = Object.fromEntries(Object.entries(operationData).filter(([name, _value]) => propertyNames.includes(name)));
1641
- setGlobals(newGlobals);
1657
+ setGlobals(Object.fromEntries(Object.entries(operationData).filter(([name, _value]) => propertyNames.includes(name))));
1642
1658
  return newOperationData;
1643
1659
  };
1644
1660
 
@@ -1667,7 +1683,7 @@ const setOperationData = function(operationData) {
1667
1683
  const setStyle = function(operationData) {
1668
1684
  const properties = resolvePropertyValues(operationData, this, operationData.properties);
1669
1685
  operationData.selectedElement.css(properties);
1670
- delete operationData.properties;
1686
+ removeProperties(operationData, "properties");
1671
1687
  return operationData;
1672
1688
  };
1673
1689
 
@@ -1680,8 +1696,7 @@ const setVariable = function(operationData) {
1680
1696
  const { name, value } = operationData;
1681
1697
  if (!this.variables) this.variables = {};
1682
1698
  this.variables[name] = value;
1683
- delete operationData.name;
1684
- delete operationData.value;
1699
+ removeProperties(operationData, "name", "value");
1685
1700
  return operationData;
1686
1701
  };
1687
1702
 
@@ -2177,8 +2192,7 @@ var ActionEditor = class {
2177
2192
  if (!operation) throw new Error(`start operation not found for id ${id}`);
2178
2193
  const idx = startOperations.indexOf(operation);
2179
2194
  if (idx > -1) {
2180
- const newIdx = direction === "up" ? idx + 1 : idx - 1;
2181
- array_move(startOperations, idx, newIdx);
2195
+ array_move(startOperations, idx, direction === "up" ? idx + 1 : idx - 1);
2182
2196
  this.actionConfig = {
2183
2197
  ...this.actionConfig,
2184
2198
  startOperations
@@ -2284,8 +2298,7 @@ var EndableActionEditor = class extends ActionEditor {
2284
2298
  if (!isDefined(operation)) throw new Error(`operation not found for id ${id}`);
2285
2299
  const idx = endOperations.indexOf(operation);
2286
2300
  if (idx > -1) {
2287
- const newIdx = direction === "up" ? idx + 1 : idx - 1;
2288
- array_move(endOperations, idx, newIdx);
2301
+ array_move(endOperations, idx, direction === "up" ? idx + 1 : idx - 1);
2289
2302
  this.actionConfig = {
2290
2303
  ...this.actionConfig,
2291
2304
  endOperations
@@ -2504,9 +2517,7 @@ function animationInterval(ms, signal, callback) {
2504
2517
  };
2505
2518
  const { round } = Math;
2506
2519
  const scheduleFrame = (time) => {
2507
- const elapsed = time - start;
2508
- const roundedElapsed = round(elapsed / ms) * ms;
2509
- const delay = start + roundedElapsed + ms - performance.now();
2520
+ const delay = start + round((time - start) / ms) * ms + ms - performance.now();
2510
2521
  setTimeout(() => requestAnimationFrame(frame), delay);
2511
2522
  };
2512
2523
  scheduleFrame(start);
@@ -2721,8 +2732,7 @@ var VideoJsTimelineProvider = class {
2721
2732
  return this._player?.duration() ?? 0;
2722
2733
  }
2723
2734
  getContainer() {
2724
- const selector = this.config.timelineProviderSettings.mediaplayer?.selector ?? "";
2725
- return $(selector);
2735
+ return $(this.config.timelineProviderSettings.mediaplayer?.selector ?? "");
2726
2736
  }
2727
2737
  destroy() {
2728
2738
  this._eventHandlers.forEach((remover) => remover());
@@ -2955,6 +2965,7 @@ var ConfigurationFactory = class ConfigurationFactory {
2955
2965
  id: v4(),
2956
2966
  engine: { systemName: "EligiusEngine" },
2957
2967
  containerSelector: "[data-ct-container=true]",
2968
+ cssFiles: [],
2958
2969
  timelineProviderSettings: {},
2959
2970
  language: defaultLanguage,
2960
2971
  availableLanguages: [],
@@ -3026,10 +3037,7 @@ var ConfigurationFactory = class ConfigurationFactory {
3026
3037
  */
3027
3038
  getConfiguration(callBack) {
3028
3039
  const copy = deepCopy(this.configuration);
3029
- if (callBack) {
3030
- const newConfig = callBack.call(this, copy);
3031
- this.configuration = deepCopy(newConfig);
3032
- }
3040
+ if (callBack) this.configuration = deepCopy(callBack.call(this, copy));
3033
3041
  return copy;
3034
3042
  }
3035
3043
  /**
@@ -3323,18 +3331,18 @@ var ConfigurationFactory = class ConfigurationFactory {
3323
3331
  };
3324
3332
 
3325
3333
  //#endregion
3326
- //#region src/controllers/event-listener-controller.ts
3334
+ //#region src/controllers/dom-event-listener-controller.ts
3327
3335
  /**
3328
- * This controller attaches to the given selected element and adds an event listener for the specified event name that
3336
+ * This controller attaches to the given selected element and adds a DOM event listener for the specified event name that
3329
3337
  * executes the given actions with the given operation data.
3330
3338
  *
3331
3339
  * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
3332
3340
  * prefix the action name with `end:`.
3333
3341
  */
3334
- var EventListenerController = class {
3342
+ var DOMEventListenerController = class {
3335
3343
  operationData;
3336
3344
  actionInstanceInfos;
3337
- name = "EventListenerController";
3345
+ name = "DOMEventListenerController";
3338
3346
  constructor() {}
3339
3347
  init(operationData) {
3340
3348
  this.operationData = {
@@ -3385,6 +3393,75 @@ var EventListenerController = class {
3385
3393
  }
3386
3394
  };
3387
3395
 
3396
+ //#endregion
3397
+ //#region src/controllers/base-controller.ts
3398
+ /**
3399
+ * Abstract base class for controllers providing standardized event listener management
3400
+ *
3401
+ * Benefits:
3402
+ * - Eliminates boilerplate event listener tracking code
3403
+ * - Automatic binding of event handlers to controller instance
3404
+ * - Centralized cleanup preventing memory leaks
3405
+ * - Consistent event management pattern across all controllers
3406
+ *
3407
+ * @example
3408
+ * ```typescript
3409
+ * class MyController extends BaseController<IMyOperationData> {
3410
+ * name = 'MyController';
3411
+ *
3412
+ * init(operationData: IMyOperationData): void {
3413
+ * this.operationData = operationData;
3414
+ * }
3415
+ *
3416
+ * attach(eventbus: IEventbus): void {
3417
+ * this.addListener(eventbus, 'my-event', this.handleMyEvent);
3418
+ * // Handler automatically bound, cleanup tracked
3419
+ * }
3420
+ *
3421
+ * private handleMyEvent(): void {
3422
+ * // 'this' context preserved
3423
+ * }
3424
+ * }
3425
+ * ```
3426
+ */
3427
+ var BaseController = class {
3428
+ operationData = null;
3429
+ eventListeners = [];
3430
+ /**
3431
+ * Register event listener with automatic binding and cleanup tracking
3432
+ *
3433
+ * @param eventbus - The eventbus to register with
3434
+ * @param eventName - Name of the event to listen for
3435
+ * @param handler - Event handler function (will be bound to this controller)
3436
+ */
3437
+ addListener(eventbus$1, eventName, handler) {
3438
+ const boundHandler = handler.bind(this);
3439
+ const remover = eventbus$1.on(eventName, boundHandler);
3440
+ this.eventListeners.push(remover);
3441
+ }
3442
+ /**
3443
+ * Register multiple event listeners at once
3444
+ *
3445
+ * @param eventbus - The eventbus to register with
3446
+ * @param listeners - Array of {eventName, handler} pairs
3447
+ */
3448
+ attachMultiple(eventbus$1, listeners) {
3449
+ listeners.forEach(({ eventName, handler }) => {
3450
+ this.addListener(eventbus$1, eventName, handler);
3451
+ });
3452
+ }
3453
+ /**
3454
+ * Clean up all tracked event listeners
3455
+ * Prevents memory leaks by removing all registered handlers
3456
+ *
3457
+ * @param _eventbus - The eventbus (ignored, included for IController compatibility)
3458
+ */
3459
+ detach(_eventbus) {
3460
+ this.eventListeners.forEach((remover) => remover());
3461
+ this.eventListeners = [];
3462
+ }
3463
+ };
3464
+
3388
3465
  //#endregion
3389
3466
  //#region src/controllers/label-controller.ts
3390
3467
  /**
@@ -3393,10 +3470,8 @@ var EventListenerController = class {
3393
3470
  * The controller also listen for the `LANGUAGE_CHANGE` event and re-renders the text with the new language after such an event.
3394
3471
  *
3395
3472
  */
3396
- var LabelController = class {
3397
- listeners = [];
3473
+ var LabelController = class extends BaseController {
3398
3474
  currentLanguage = null;
3399
- operationData = null;
3400
3475
  labelData = {};
3401
3476
  name = "LabelController";
3402
3477
  requestLabelDataBound;
@@ -3417,7 +3492,7 @@ var LabelController = class {
3417
3492
  this.requestLabelDataBound = this._requestLabelData.bind(this, eventbus$1);
3418
3493
  this.requestLabelDataBound(this.operationData.labelId);
3419
3494
  this._setLabel();
3420
- this.listeners.push(eventbus$1.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
3495
+ this.addListener(eventbus$1, TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange);
3421
3496
  }
3422
3497
  _requestLabelData(eventbus$1, labelId) {
3423
3498
  eventbus$1.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [labelId, (labelCollection) => {
@@ -3432,8 +3507,8 @@ var LabelController = class {
3432
3507
  else this.operationData?.selectedElement.attr(this.operationData?.attributeName, text);
3433
3508
  }
3434
3509
  }
3435
- detach(_eventbus) {
3436
- this.listeners.forEach((func) => func());
3510
+ detach(eventbus$1) {
3511
+ super.detach(eventbus$1);
3437
3512
  this.requestLabelDataBound = void 0;
3438
3513
  }
3439
3514
  _handleLanguageChange(code) {
@@ -3456,18 +3531,15 @@ const lottie = lt.default ?? lt;
3456
3531
  * The url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json
3457
3532
  *
3458
3533
  */
3459
- var LottieController = class {
3534
+ var LottieController = class extends BaseController {
3460
3535
  name = "LottieController";
3461
3536
  currentLanguage = "nl-NL";
3462
3537
  labelData = {};
3463
- eventbusRemovers = [];
3464
3538
  animationItem = null;
3465
- operationData = null;
3466
3539
  serializedData = null;
3467
3540
  serializedIEData = null;
3468
3541
  freezePosition = -1;
3469
3542
  endPosition = -1;
3470
- constructor() {}
3471
3543
  init(operationData) {
3472
3544
  this.operationData = { ...operationData };
3473
3545
  if (operationData.url.indexOf("[") > -1) this._parseFilename(operationData.url);
@@ -3475,7 +3547,9 @@ var LottieController = class {
3475
3547
  if (this.operationData.iefallback) this.serializedIEData = JSON.stringify(this.operationData.iefallback);
3476
3548
  }
3477
3549
  _parseFilename(name) {
3478
- name.substring(name.indexOf("[") + 1, name.indexOf("]") - name.indexOf("[") - 1).split(",").forEach((setting) => {
3550
+ const startIndex = name.indexOf("[") + 1;
3551
+ const endIndex = name.indexOf("]");
3552
+ name.substring(startIndex, endIndex).split(",").forEach((setting) => {
3479
3553
  const values = setting.split("=");
3480
3554
  if (values[0] === "freeze") this.freezePosition = +values[1];
3481
3555
  else if (values[0] === "end") this.endPosition = +values[1];
@@ -3488,16 +3562,14 @@ var LottieController = class {
3488
3562
  const resultHolder = {};
3489
3563
  eventbus$1.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [resultHolder]);
3490
3564
  this.currentLanguage = resultHolder.language;
3491
- this.eventbusRemovers.push(eventbus$1.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
3565
+ this.addListener(eventbus$1, TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange);
3492
3566
  eventbus$1.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, [this.operationData.labelIds, resultHolder]);
3493
3567
  this._createTextDataLookup(resultHolder.labelCollections);
3494
3568
  }
3495
3569
  this._createAnimation();
3496
3570
  }
3497
- detach(_eventbus) {
3498
- this.eventbusRemovers.forEach((func) => {
3499
- func();
3500
- });
3571
+ detach(eventbus$1) {
3572
+ super.detach(eventbus$1);
3501
3573
  if (this.animationItem) if (this.endPosition > -1) {
3502
3574
  this.animationItem.addEventListener("complete", this._destroy.bind(this));
3503
3575
  this.animationItem.playSegments([this.freezePosition, this.endPosition], true);
@@ -3514,8 +3586,8 @@ var LottieController = class {
3514
3586
  this.animationItem?.destroy();
3515
3587
  let serialized = this._isIE() && this.serializedIEData ? this.serializedIEData : this.serializedData;
3516
3588
  const { labelIds } = this.operationData;
3517
- if (labelIds && labelIds.length) labelIds.forEach((id) => {
3518
- serialized = serialized.split(`!!${id}!!`).join(this.labelData[id][this.currentLanguage]);
3589
+ if (labelIds && labelIds.length) serialized = serialized.replace(/!!([^!]+)!!/g, (match, labelId) => {
3590
+ return this.labelData[labelId]?.[this.currentLanguage] ?? match;
3519
3591
  });
3520
3592
  const animationData = JSON.parse(serialized);
3521
3593
  const animationSettings = {
@@ -3549,7 +3621,7 @@ var LottieController = class {
3549
3621
 
3550
3622
  //#endregion
3551
3623
  //#region src/controllers/navigation-controller.ts
3552
- var NavigationController = class {
3624
+ var NavigationController = class extends BaseController {
3553
3625
  name = "NavigationController";
3554
3626
  navigation = [];
3555
3627
  navLookup = {};
@@ -3557,10 +3629,8 @@ var NavigationController = class {
3557
3629
  ctrlLookup = {};
3558
3630
  activeNavigationPoint = null;
3559
3631
  labelControllers = [];
3560
- eventhandlers = [];
3561
3632
  eventbus = null;
3562
3633
  container = null;
3563
- constructor() {}
3564
3634
  init(operationData) {
3565
3635
  this.container = operationData.selectedElement;
3566
3636
  this.navigation = this._buildNavigationData(operationData.json);
@@ -3568,10 +3638,10 @@ var NavigationController = class {
3568
3638
  attach(eventbus$1) {
3569
3639
  if (!this.container) return;
3570
3640
  this.eventbus = eventbus$1;
3571
- this.eventhandlers.push(eventbus$1.on("navigate-to-video-url", this._handleNavigateVideoUrl.bind(this)));
3572
- this.eventhandlers.push(eventbus$1.on("highlight-navigation", this._highlightMenu.bind(this)));
3573
- this.eventhandlers.push(eventbus$1.on("request-current-navigation", this._handleRequestCurrentNavigation.bind(this)));
3574
- this.eventhandlers.push(eventbus$1.on("video-complete", this._handleVideoComplete.bind(this)));
3641
+ this.addListener(eventbus$1, "navigate-to-video-url", this._handleNavigateVideoUrl);
3642
+ this.addListener(eventbus$1, "highlight-navigation", this._highlightMenu);
3643
+ this.addListener(eventbus$1, "request-current-navigation", this._handleRequestCurrentNavigation);
3644
+ this.addListener(eventbus$1, "video-complete", this._handleVideoComplete);
3575
3645
  this._buildHtml(this.container, this.navigation);
3576
3646
  this._initHistory.bind(this);
3577
3647
  }
@@ -3601,9 +3671,7 @@ var NavigationController = class {
3601
3671
  } else resultCallback(null);
3602
3672
  }
3603
3673
  detach(eventbus$1) {
3604
- this.eventhandlers.forEach((handler) => {
3605
- handler();
3606
- });
3674
+ super.detach(eventbus$1);
3607
3675
  this.labelControllers.forEach((ctrl) => {
3608
3676
  ctrl.detach(eventbus$1);
3609
3677
  });
@@ -3716,31 +3784,28 @@ var NavigationController = class {
3716
3784
  *
3717
3785
  * The current progress as a percentage is rendered in the given text element.
3718
3786
  */
3719
- var ProgressbarController = class {
3787
+ var ProgressbarController = class extends BaseController {
3720
3788
  name = "ProgressbarController";
3721
3789
  selectedElement = null;
3722
3790
  textElement = null;
3723
- eventbusRemovers = [];
3724
3791
  duration = 0;
3725
3792
  init(operationData) {
3726
3793
  this.selectedElement = operationData.selectedElement;
3727
3794
  this.textElement = operationData.textElement;
3728
3795
  }
3729
3796
  attach(eventbus$1) {
3730
- this.eventbusRemovers.push(eventbus$1.on(TimelineEventNames.TIME, this._positionUpdateHandler.bind(this)));
3797
+ this.addListener(eventbus$1, TimelineEventNames.TIME, this._positionUpdateHandler);
3731
3798
  eventbus$1.broadcast(TimelineEventNames.DURATION_REQUEST, [(duration) => this.duration = duration]);
3732
3799
  this.selectedElement?.css({ "pointer-events": "none" });
3733
3800
  const container = this.selectedElement?.parent();
3734
3801
  if (container) {
3735
3802
  const clickHandler = this._clickHandler.bind(this, eventbus$1);
3736
3803
  container.on("click", clickHandler);
3737
- this.eventbusRemovers.push(() => container.off("click", clickHandler));
3804
+ this.eventListeners.push(() => container.off("click", clickHandler));
3738
3805
  }
3739
3806
  }
3740
- detach(_eventbus) {
3741
- this.eventbusRemovers.forEach((func) => {
3742
- func();
3743
- });
3807
+ detach(eventbus$1) {
3808
+ super.detach(eventbus$1);
3744
3809
  }
3745
3810
  _positionUpdateHandler(position) {
3746
3811
  const percentage = 100 / this.duration * position;
@@ -3760,20 +3825,18 @@ var ProgressbarController = class {
3760
3825
  /**
3761
3826
  * This is a work in progress, do not use this yet please....
3762
3827
  */
3763
- var RoutingController = class {
3828
+ var RoutingController = class extends BaseController {
3764
3829
  name = "RoutingController";
3765
3830
  navLookup = {};
3766
3831
  navVidIdLookup = {};
3767
3832
  navigation = null;
3768
- eventhandlers = [];
3769
3833
  eventbus = null;
3770
- constructor() {}
3771
3834
  init(operationData) {
3772
3835
  this.navigation = this._buildNavigationData(operationData.json);
3773
3836
  }
3774
3837
  attach(eventbus$1) {
3775
- this.eventhandlers.push(eventbus$1.on("before-request-video-url", this._handleBeforeRequestVideoUrl.bind(this)));
3776
- this.eventhandlers.push(eventbus$1.on("push-history-state", this._handlePushHistoryState.bind(this)));
3838
+ this.addListener(eventbus$1, "before-request-video-url", this._handleBeforeRequestVideoUrl);
3839
+ this.addListener(eventbus$1, "push-history-state", this._handlePushHistoryState);
3777
3840
  this.eventbus = eventbus$1;
3778
3841
  window.onpopstate = this._handlePopstate.bind(this);
3779
3842
  const navId = this._getQueryVariable(0);
@@ -3798,10 +3861,9 @@ var RoutingController = class {
3798
3861
  true
3799
3862
  ]);
3800
3863
  }
3801
- detach(_eventbus) {
3802
- if (this.eventhandlers) this.eventhandlers.forEach((handler) => {
3803
- handler();
3804
- });
3864
+ detach(eventbus$1) {
3865
+ super.detach(eventbus$1);
3866
+ window.onpopstate = null;
3805
3867
  this.eventbus = null;
3806
3868
  }
3807
3869
  _handleBeforeRequestVideoUrl(_index, _requestedVideoPosition = 0, isHistoryRequest = false) {
@@ -3876,29 +3938,19 @@ var RoutingController = class {
3876
3938
 
3877
3939
  //#endregion
3878
3940
  //#region src/controllers/subtitles-controller.ts
3879
- var SubtitlesController = class {
3941
+ var SubtitlesController = class extends BaseController {
3880
3942
  actionLookup = {};
3881
3943
  currentLanguage = null;
3882
3944
  lastFunc = null;
3883
3945
  name = "SubtitlesController";
3884
3946
  subtitleDurations = null;
3885
3947
  attach(eventbus$1) {
3886
- const detachTime = eventbus$1.on(TimelineEventNames.TIME, this.onTimeHandler.bind(this));
3887
- const detachSeek = eventbus$1.on(TimelineEventNames.SEEKED, this.onSeekedHandler.bind(this));
3888
- const detachLangChange = eventbus$1.on(TimelineEventNames.LANGUAGE_CHANGE, this.languageChangeHandler.bind(this));
3889
- this.internalDetach = this.internalDetach.bind(this, [
3890
- detachTime,
3891
- detachLangChange,
3892
- detachSeek
3893
- ]);
3948
+ this.addListener(eventbus$1, TimelineEventNames.TIME, this.onTimeHandler);
3949
+ this.addListener(eventbus$1, TimelineEventNames.SEEKED, this.onSeekedHandler);
3950
+ this.addListener(eventbus$1, TimelineEventNames.LANGUAGE_CHANGE, this.languageChangeHandler);
3894
3951
  }
3895
- detach(_eventbus) {
3896
- this.internalDetach();
3897
- }
3898
- internalDetach(detachMethods) {
3899
- if (detachMethods) detachMethods.forEach((f) => {
3900
- f();
3901
- });
3952
+ detach(eventbus$1) {
3953
+ super.detach(eventbus$1);
3902
3954
  }
3903
3955
  languageChangeHandler(newLanguage) {
3904
3956
  this.currentLanguage = newLanguage;
@@ -3917,7 +3969,7 @@ var SubtitlesController = class {
3917
3969
  }
3918
3970
  onSeekedHandler(args) {
3919
3971
  const position = args[0];
3920
- const duration = this.subtitleDurations?.find((x) => x.start <= position || x.end >= position);
3972
+ const duration = this.subtitleDurations?.find((x) => x.start <= position && x.end >= position);
3921
3973
  const func = duration ? this.actionLookup[duration.start ?? -1] : void 0;
3922
3974
  if (func && this.lastFunc !== func) {
3923
3975
  this.lastFunc = func;
@@ -3954,7 +4006,7 @@ var SubtitlesController = class {
3954
4006
  //#endregion
3955
4007
  //#region src/controllers/index.ts
3956
4008
  var controllers_exports = /* @__PURE__ */ __export({
3957
- EventListenerController: () => EventListenerController,
4009
+ DOMEventListenerController: () => DOMEventListenerController,
3958
4010
  LabelController: () => LabelController,
3959
4011
  LottieController: () => LottieController,
3960
4012
  NavigationController: () => NavigationController,
@@ -4139,7 +4191,7 @@ Or, if the \`properties\` property is set only removes the properties defined by
4139
4191
  function continueForEach$1() {
4140
4192
  return { description: `
4141
4193
  This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}
4142
- operation. This operation immediately moves to the next loop index, effectively canceling the rest
4194
+ operation. This operation immediately moves to the next loop index, effectively canceling the rest
4143
4195
  of the operations in the current iteration.` };
4144
4196
  }
4145
4197
 
@@ -4238,7 +4290,7 @@ assigned to the {@link IOperationScope.currentItem |currentItem} property on the
4238
4290
  At the start of the loop, the associated {@link endForEach} operation is determined and when
4239
4291
  the last iteration is completed the flow control is set to the index of that operation.
4240
4292
 
4241
- The {@link continueForEach |continue} and {@link breakForEach |break} operations can be used to control the
4293
+ The {@link continueForEach |continue} and {@link breakForEach |break} operations can be used to control the
4242
4294
  loop iterations.`,
4243
4295
  properties: { collection: {
4244
4296
  type: "ParameterType:array|ParameterType:string",
@@ -4286,7 +4338,7 @@ function getControllerInstance$1() {
4286
4338
  It assigns this instance to the \`controllerInstance\` property on the current operation data`,
4287
4339
  properties: { systemName: {
4288
4340
  type: [
4289
- { value: "EventListenerController" },
4341
+ { value: "DOMEventListenerController" },
4290
4342
  { value: "LabelController" },
4291
4343
  { value: "LottieController" },
4292
4344
  { value: "NavigationController" },
@@ -5014,8 +5066,7 @@ var SubtitleEditor = class {
5014
5066
  * The result of the invocation `resolvePropertyChain('mySource.subSource.element.value', foo)` would then yield the value `bar`.
5015
5067
  */
5016
5068
  function resolvePropertyChain(propertyChain, sourceObject) {
5017
- const properties = propertyChain.split(".");
5018
- return getPropertyChainValue(properties, sourceObject);
5069
+ return getPropertyChainValue(propertyChain.split("."), sourceObject);
5019
5070
  }
5020
5071
 
5021
5072
  //#endregion
@@ -5040,6 +5091,7 @@ var ConfigurationResolver = class {
5040
5091
  engine: { ...configuration.engine },
5041
5092
  timelineProviderSettings: deepCopy(configuration.timelineProviderSettings),
5042
5093
  containerSelector: configuration.containerSelector,
5094
+ cssFiles: configuration.cssFiles,
5043
5095
  language: configuration.language,
5044
5096
  layoutTemplate: configuration.layoutTemplate,
5045
5097
  availableLanguages: deepCopy(configuration.availableLanguages),
@@ -5128,10 +5180,8 @@ function resolvePlaceholders(configFragment, rootConfig, importer) {
5128
5180
  function resolvePlaceholder(key, configFragment, rootConfig, importer) {
5129
5181
  const configValue = configFragment[key];
5130
5182
  if (isString(configValue)) {
5131
- if (configValue.startsWith("config:")) {
5132
- const configProperty = configValue.substring(7, configValue.length);
5133
- configFragment[key] = resolvePropertyChain(configProperty, rootConfig);
5134
- } else if (configValue.startsWith("template:")) {
5183
+ if (configValue.startsWith("config:")) configFragment[key] = resolvePropertyChain(configValue.substring(7, configValue.length), rootConfig);
5184
+ else if (configValue.startsWith("template:")) {
5135
5185
  const templateKey = configValue.substring(9, configValue.length);
5136
5186
  configFragment[key] = importer.import(templateKey)[templateKey];
5137
5187
  } else if (configValue.startsWith("json:")) {
@@ -5149,6 +5199,7 @@ function resolvePlaceholder(key, configFragment, rootConfig, importer) {
5149
5199
  */
5150
5200
  var EligiusEngine = class EligiusEngine {
5151
5201
  _timeLineActionsLookup = {};
5202
+ _timelineLookupCache = /* @__PURE__ */ new Map();
5152
5203
  _eventbusRemovers = [];
5153
5204
  _currentTimelineUri = "";
5154
5205
  _activeTimelineProvider = void 0;
@@ -5289,16 +5340,20 @@ var EligiusEngine = class EligiusEngine {
5289
5340
  _createTimelineLookup() {
5290
5341
  if (!this.configuration.timelines) return;
5291
5342
  this.configuration.timelines.forEach((timelineInfo) => {
5292
- timelineInfo.timelineActions.forEach(this._addTimelineActionStart.bind(this, timelineInfo.uri));
5293
- });
5294
- this.configuration.timelines.forEach((timelineInfo) => {
5295
- timelineInfo.timelineActions.forEach(this._addTimelineActionEnd.bind(this, timelineInfo.uri));
5343
+ this._timelineLookupCache.set(timelineInfo.uri, timelineInfo);
5344
+ timelineInfo.timelineActions.forEach((timelineAction) => {
5345
+ this._addTimelineActionStart(timelineInfo.uri, timelineAction);
5346
+ this._addTimelineActionEnd(timelineInfo.uri, timelineAction);
5347
+ });
5296
5348
  });
5297
5349
  EligiusEngine.sortTimelines(Object.values(this._timeLineActionsLookup));
5298
5350
  }
5299
5351
  static sortTimelines(timelines) {
5300
5352
  timelines.forEach((timelineActions) => {
5301
- Object.keys(timelineActions).forEach((key) => timelineActions[key] = EligiusEngine.sortActionsPerPosition(timelineActions[key]));
5353
+ Object.keys(timelineActions).forEach((key) => {
5354
+ const numericKey = Number(key);
5355
+ timelineActions[numericKey] = EligiusEngine.sortActionsPerPosition(timelineActions[numericKey]);
5356
+ });
5302
5357
  });
5303
5358
  }
5304
5359
  static sortActionsPerPosition(actions) {
@@ -5339,12 +5394,9 @@ var EligiusEngine = class EligiusEngine {
5339
5394
  if (!lookup[position]) lookup[position] = [];
5340
5395
  return lookup[position];
5341
5396
  }
5342
- async _executeActions(actions, methodName, idx = 0) {
5343
- if (actions && idx < actions.length) {
5344
- await actions[idx][methodName]();
5345
- return this._executeActions(actions, methodName, ++idx);
5346
- }
5347
- return Promise.resolve();
5397
+ async _executeActions(actions, methodName) {
5398
+ if (actions.length === 0) return;
5399
+ for (const action of actions) await action[methodName]();
5348
5400
  }
5349
5401
  _handleRequestEngineRoot(engineRootSelector, resultCallback) {
5350
5402
  resultCallback($(engineRootSelector));
@@ -5353,7 +5405,7 @@ var EligiusEngine = class EligiusEngine {
5353
5405
  if (!this._activeTimelineProvider) return;
5354
5406
  this._activeTimelineProvider.stop();
5355
5407
  await this._cleanUpTimeline();
5356
- const timelineConfig = this.configuration.timelines.find((timeline) => timeline.uri === uri);
5408
+ const timelineConfig = this._timelineLookupCache.get(uri);
5357
5409
  if (!timelineConfig || !this._activeTimelineProvider || this._currentTimelineUri === timelineConfig.uri) return;
5358
5410
  this._currentTimelineUri = timelineConfig.uri;
5359
5411
  this.eventbus.broadcast(TimelineEventNames.CURRENT_TIMELINE_CHANGE, [this._currentTimelineUri]);
@@ -5395,7 +5447,7 @@ var EligiusEngine = class EligiusEngine {
5395
5447
  _executeRelevantActions(filter, executionType) {
5396
5448
  const timelineActions = this._getTimelineActionsForCurrentTimeline();
5397
5449
  const currentActions = filter.apply(this, [timelineActions]);
5398
- return this._executeActions(currentActions, executionType, 0);
5450
+ return this._executeActions(currentActions, executionType);
5399
5451
  }
5400
5452
  _handleRequestTimelinePosition(floor, resultCallback) {
5401
5453
  resultCallback(floor(this._activeTimelineProvider?.getPosition() || -1));
@@ -5410,9 +5462,7 @@ var EligiusEngine = class EligiusEngine {
5410
5462
  resultCallback(this._currentTimelineUri);
5411
5463
  }
5412
5464
  _getTimelineActionsForUri(uri) {
5413
- return this.configuration.timelines.find((timelineInfo) => {
5414
- return timelineInfo.uri === uri;
5415
- })?.timelineActions ?? [];
5465
+ return this._timelineLookupCache.get(uri)?.timelineActions ?? [];
5416
5466
  }
5417
5467
  _onTimeHandler(floor, position) {
5418
5468
  if (!isNaN(position)) {
@@ -5433,8 +5483,8 @@ var EligiusEngine = class EligiusEngine {
5433
5483
  if (!timelineActions) return Promise.resolve();
5434
5484
  const currentActions = this._getActiveActions(timelineActions).filter((action) => !(action.duration.start <= position && action.duration.end >= position));
5435
5485
  const newActions = this._getActionsForPosition(position, timelineActions);
5436
- await this._executeActions(currentActions, "end", 0);
5437
- return this._executeActions(newActions, "start", 0);
5486
+ await this._executeActions(currentActions, "end");
5487
+ return this._executeActions(newActions, "start");
5438
5488
  }
5439
5489
  };
5440
5490
  const sortActionsHighestStartPositionFirst = (a, b) => {
@@ -5620,10 +5670,9 @@ var LanguageManager = class {
5620
5670
  resultCallback(this._labelLookup[labelId]);
5621
5671
  }
5622
5672
  _handleRequestLabelCollections(labelIds, resultCallback) {
5623
- const labelCollections = labelIds.map((labelId) => {
5673
+ resultCallback(labelIds.map((labelId) => {
5624
5674
  return this._labelLookup[labelId];
5625
- });
5626
- resultCallback(labelCollections);
5675
+ }));
5627
5676
  }
5628
5677
  _handleLanguageChange(language) {
5629
5678
  this._currentLanguage = language;
@@ -5819,5 +5868,5 @@ var EligiusResourceImporter = class {
5819
5868
  };
5820
5869
 
5821
5870
  //#endregion
5822
- export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, EventListenerController, Eventbus, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitleEditor, SubtitleImporter, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, VideoJsTimelineProvider, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, breakForEach, broadcastEvent, calc, clearElement, clearOperationData, continueForEach, createElement, customFunction, endAction, endForEach, endWhen, extendController, forEach, generateImporterSourceCode, getAttributesFromElement, getControllerFromElement, getControllerInstance, getElementDimensions, getImport, getQueryParams, invokeObjectMethod, loadJson, log, math, metadata_exports as metadata, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, requestAction, selectElement, setData, setElementAttributes, setElementContent, setGlobalData, setOperationData, setStyle, setVariable, startAction, toggleClass, toggleElement, wait, when };
5871
+ export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DOMEventListenerController, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, Eventbus, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitleEditor, SubtitleImporter, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, VideoJsTimelineProvider, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, breakForEach, broadcastEvent, calc, clearElement, clearOperationData, continueForEach, createElement, customFunction, endAction, endForEach, endWhen, extendController, forEach, generateImporterSourceCode, getAttributesFromElement, getControllerFromElement, getControllerInstance, getElementDimensions, getImport, getQueryParams, invokeObjectMethod, loadJson, log, math, metadata_exports as metadata, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, requestAction, selectElement, setData, setElementAttributes, setElementContent, setGlobalData, setOperationData, setStyle, setVariable, startAction, toggleClass, toggleElement, wait, when };
5823
5872
  //# sourceMappingURL=index.js.map