eligius 1.1.2 → 1.1.4
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/README.md +3 -1
- package/dist/action/action.d.ts +17 -17
- package/dist/action/endable-action.d.ts +9 -9
- package/dist/action/index.d.ts +3 -3
- package/dist/action/timeline-action.d.ts +14 -14
- package/dist/action/types.d.ts +17 -17
- package/dist/build/generate-importer-source-code.d.ts +15 -15
- package/dist/build/index.d.ts +1 -1
- package/dist/configuration/api/action-creator-factory.d.ts +31 -31
- package/dist/configuration/api/action-editor.d.ts +44 -44
- package/dist/configuration/api/configuration-factory.d.ts +135 -134
- package/dist/configuration/api/index.d.ts +7 -7
- package/dist/configuration/api/label-editor.d.ts +11 -11
- package/dist/configuration/api/name-providers.d.ts +13 -13
- package/dist/configuration/api/subtitle-converter.d.ts +11 -11
- package/dist/configuration/api/subtitle-editor.d.ts +24 -14
- package/dist/configuration/api/timeline-provider-settings-editor.d.ts +22 -22
- package/dist/configuration/configuration-resolver.d.ts +18 -18
- package/dist/configuration/types.d.ts +102 -102
- package/dist/controllers/event-listener-controller.d.ts +36 -35
- package/dist/controllers/index.d.ts +7 -7
- package/dist/controllers/label-controller.d.ts +31 -30
- package/dist/controllers/lottie-controller.d.ts +47 -46
- package/dist/controllers/metadata/event-listener-controller.d.ts +4 -4
- package/dist/controllers/metadata/index.d.ts +7 -7
- package/dist/controllers/metadata/label-controller.d.ts +4 -4
- package/dist/controllers/metadata/lottie-controller.d.ts +4 -4
- package/dist/controllers/metadata/navigation-controller.d.ts +4 -4
- package/dist/controllers/metadata/progressbar-controller.d.ts +4 -4
- package/dist/controllers/metadata/routing-controller.d.ts +4 -4
- package/dist/controllers/metadata/subtitles-controller.d.ts +4 -4
- package/dist/controllers/metadata/types.d.ts +6 -6
- package/dist/controllers/navigation-controller.d.ts +39 -38
- package/dist/controllers/progressbar-controller.d.ts +26 -25
- package/dist/controllers/routing-controller.d.ts +27 -27
- package/dist/controllers/subtitles-controller.d.ts +27 -25
- package/dist/controllers/types.d.ts +8 -8
- package/dist/diagnostics/{devtool-event-lister.d.ts → devtool-event-listener.d.ts} +7 -7
- package/dist/diagnostics/diagnostics.d.ts +5 -5
- package/dist/diagnostics/index.d.ts +3 -3
- package/dist/diagnostics/types.d.ts +28 -28
- package/dist/eligius-engine.d.ts +88 -88
- package/dist/eligius-flow-controller.d.ts +8 -8
- package/dist/engine-factory.d.ts +38 -38
- package/dist/eventbus/actionregistry-eventbus-listener.d.ts +11 -11
- package/dist/eventbus/eventbus.d.ts +18 -18
- package/dist/eventbus/index.d.ts +4 -4
- package/dist/eventbus/request-video-uri-interceptor.d.ts +6 -6
- package/dist/eventbus/types.d.ts +18 -18
- package/dist/importer/eligius-resource-importer.d.ts +9 -9
- package/dist/importer/index.d.ts +1 -1
- package/dist/index.cjs +6417 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.cjs.min.js +8 -0
- package/dist/index.cjs.min.js.map +7 -0
- package/dist/index.d.ts +22 -22
- package/dist/index.esm.js +8 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +7 -8
- package/dist/language-manager.d.ts +24 -24
- package/dist/operation/add-class.d.ts +14 -13
- package/dist/operation/add-controller-to-element.d.ts +15 -14
- package/dist/operation/add-globals-to-operation.d.ts +12 -12
- package/dist/operation/animate-with-class.d.ts +17 -16
- package/dist/operation/animate.d.ts +17 -16
- package/dist/operation/broadcast-event.d.ts +13 -13
- package/dist/operation/calc.d.ts +14 -14
- package/dist/operation/clear-element.d.ts +11 -10
- package/dist/operation/clear-operation-data.d.ts +10 -10
- package/dist/operation/create-element.d.ts +18 -17
- package/dist/operation/custom-function.d.ts +12 -12
- package/dist/operation/end-action.d.ts +17 -17
- package/dist/operation/{end-loop.d.ts → end-for-each.d.ts} +8 -8
- package/dist/operation/end-when.d.ts +8 -8
- package/dist/operation/extend-controller.d.ts +10 -10
- package/dist/operation/{start-loop.d.ts → for-each.d.ts} +19 -17
- package/dist/operation/get-attributes-from-element.d.ts +21 -20
- package/dist/operation/get-controller-from-element.d.ts +16 -15
- package/dist/operation/get-controller-instance.d.ts +17 -17
- package/dist/operation/get-element-dimensions.d.ts +30 -29
- package/dist/operation/get-import.d.ts +13 -13
- package/dist/operation/get-query-params.d.ts +28 -28
- package/dist/operation/helper/attach-controller-to-element.d.ts +3 -2
- package/dist/operation/helper/deep-copy.d.ts +1 -1
- package/dist/operation/helper/find-matching-operation-index.d.ts +35 -35
- package/dist/operation/helper/get-element-data.d.ts +7 -6
- package/dist/operation/helper/get-property-chain-value.d.ts +24 -24
- package/dist/operation/helper/globals.d.ts +4 -4
- package/dist/operation/helper/internal-resolve.d.ts +2 -2
- package/dist/operation/helper/merge-operation-data.d.ts +2 -2
- package/dist/operation/helper/modify-dimensions.d.ts +20 -20
- package/dist/operation/helper/remove-event-data-from-operation-data.d.ts +2 -2
- package/dist/operation/helper/remove-global.d.ts +1 -1
- package/dist/operation/helper/resolve-event-arguments.d.ts +2 -2
- package/dist/operation/helper/resolve-external-property-chain.d.ts +14 -14
- package/dist/operation/helper/resolve-property-chain.d.ts +23 -23
- package/dist/operation/helper/resolve-property-values.d.ts +11 -11
- package/dist/operation/helper/set-global.d.ts +1 -1
- package/dist/operation/index.d.ts +46 -46
- package/dist/operation/invoke-object-method.d.ts +28 -28
- package/dist/operation/load-json.d.ts +28 -28
- package/dist/operation/log.d.ts +8 -8
- package/dist/operation/math.d.ts +12 -12
- package/dist/operation/metadata/add-class.d.ts +4 -4
- package/dist/operation/metadata/add-controller-to-element.d.ts +4 -4
- package/dist/operation/metadata/add-globals-to-operation.d.ts +4 -4
- package/dist/operation/metadata/animate-with-class.d.ts +4 -4
- package/dist/operation/metadata/animate.d.ts +4 -4
- package/dist/operation/metadata/broadcast-event.d.ts +4 -4
- package/dist/operation/metadata/calc.d.ts +4 -4
- package/dist/operation/metadata/clear-element.d.ts +4 -4
- package/dist/operation/metadata/clear-operation-data.d.ts +4 -4
- package/dist/operation/metadata/create-element.d.ts +4 -4
- package/dist/operation/metadata/custom-function.d.ts +4 -4
- package/dist/operation/metadata/end-action.d.ts +4 -4
- package/dist/operation/metadata/end-for-each.d.ts +3 -0
- package/dist/operation/metadata/end-when.d.ts +3 -3
- package/dist/operation/metadata/extend-controller.d.ts +4 -4
- package/dist/operation/metadata/for-each.d.ts +4 -0
- package/dist/operation/metadata/get-attributes-from-element.d.ts +4 -4
- package/dist/operation/metadata/get-controller-from-element.d.ts +4 -4
- package/dist/operation/metadata/get-controller-instance.d.ts +4 -4
- package/dist/operation/metadata/get-element-dimensions.d.ts +4 -4
- package/dist/operation/metadata/get-import.d.ts +4 -4
- package/dist/operation/metadata/get-query-params.d.ts +4 -4
- package/dist/operation/metadata/index.d.ts +45 -45
- package/dist/operation/metadata/invoke-object-method.d.ts +4 -4
- package/dist/operation/metadata/load-json.d.ts +4 -4
- package/dist/operation/metadata/log.d.ts +3 -3
- package/dist/operation/metadata/math.d.ts +4 -4
- package/dist/operation/metadata/otherwise.d.ts +3 -3
- package/dist/operation/metadata/remove-class.d.ts +4 -4
- package/dist/operation/metadata/remove-controller-from-element.d.ts +4 -4
- package/dist/operation/metadata/remove-element.d.ts +4 -4
- package/dist/operation/metadata/remove-properties-from-operation-data.d.ts +4 -4
- package/dist/operation/metadata/reparent-element.d.ts +4 -4
- package/dist/operation/metadata/request-action.d.ts +4 -4
- package/dist/operation/metadata/resize-action.d.ts +4 -4
- package/dist/operation/metadata/select-element.d.ts +4 -4
- package/dist/operation/metadata/set-data.d.ts +4 -4
- package/dist/operation/metadata/set-element-attributes.d.ts +4 -4
- package/dist/operation/metadata/set-element-content.d.ts +4 -4
- package/dist/operation/metadata/set-global-data.d.ts +4 -4
- package/dist/operation/metadata/set-operation-data.d.ts +4 -4
- package/dist/operation/metadata/set-style.d.ts +4 -4
- package/dist/operation/metadata/start-action.d.ts +4 -4
- package/dist/operation/metadata/toggle-class.d.ts +4 -4
- package/dist/operation/metadata/toggle-element.d.ts +4 -4
- package/dist/operation/metadata/types.d.ts +29 -29
- package/dist/operation/metadata/wait.d.ts +4 -4
- package/dist/operation/metadata/when.d.ts +4 -4
- package/dist/operation/otherwise.d.ts +9 -9
- package/dist/operation/remove-class.d.ts +14 -13
- package/dist/operation/remove-controller-from-element.d.ts +14 -13
- package/dist/operation/remove-element.d.ts +13 -12
- package/dist/operation/remove-properties-from-operation-data.d.ts +12 -12
- package/dist/operation/reparent-element.d.ts +15 -14
- package/dist/operation/request-action.d.ts +14 -14
- package/dist/operation/resize-action.d.ts +12 -12
- package/dist/operation/select-element.d.ts +19 -18
- package/dist/operation/set-data.d.ts +21 -21
- package/dist/operation/set-element-attributes.d.ts +14 -13
- package/dist/operation/set-element-content.d.ts +21 -20
- package/dist/operation/set-global-data.d.ts +11 -11
- package/dist/operation/set-operation-data.d.ts +13 -13
- package/dist/operation/set-style.d.ts +15 -14
- package/dist/operation/start-action.d.ts +17 -17
- package/dist/operation/toggle-class.d.ts +23 -22
- package/dist/operation/toggle-element.d.ts +19 -18
- package/dist/operation/types.d.ts +55 -55
- package/dist/operation/wait.d.ts +14 -14
- package/dist/operation/when.d.ts +21 -18
- package/dist/test/integration/create-language-selector.spec.d.ts +1 -0
- package/dist/test/integration/end-in-correct-order.spec.d.ts +1 -0
- package/dist/test/integration/for-each-loop.spec.d.ts +1 -0
- package/dist/test/integration/re-use-image-action.spec.d.ts +1 -0
- package/dist/test/integration/when-construction.spec.d.ts +1 -0
- package/dist/test/unit/action/action.spec.d.ts +1 -0
- package/dist/test/unit/build/generate-importer-source-code.spec.d.ts +1 -0
- package/dist/test/unit/chrono-trigger-engine.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/configuration-factory.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/endable-action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/name-providers.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/subtitle-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/timeline-action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/timeline-provider-settings-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/configuration-resolver.spec.d.ts +1 -0
- package/dist/test/unit/controllers/EventListenerController.spec.d.ts +1 -0
- package/dist/test/unit/controllers/LabelController.spec.d.ts +1 -0
- package/dist/test/unit/engine-factory.spec.d.ts +1 -0
- package/dist/test/unit/eventbus/eventbus.spec.d.ts +1 -0
- package/dist/test/unit/importer/eligius-resource-importer.spec.d.ts +1 -0
- package/dist/test/unit/language-manager.spec.d.ts +1 -0
- package/dist/test/unit/operation/_operation-metadata.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-controller-to-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-globals-to-operation.spec.d.ts +1 -0
- package/dist/test/unit/operation/animate-with-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/animate.spec.d.ts +1 -0
- package/dist/test/unit/operation/broadcast-event.spec.d.ts +1 -0
- package/dist/test/unit/operation/calc.spec.d.ts +1 -0
- package/dist/test/unit/operation/clear-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/clear-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/create-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/custom-function.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-for-each.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-when.spec.d.ts +1 -0
- package/dist/test/unit/operation/extend-controller.spec.d.ts +1 -0
- package/dist/test/unit/operation/for-each.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-attributes-from-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-controller-from-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-controller-instance.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-element-dimensions.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-query-params.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/attach-controller-to-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/get-element-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/get-property-chain-value.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/globals.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/internal-resolve.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/merge-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/modify-dimensions.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/remove-event-data-from-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/remove-global.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-event-arguments.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-external-property-chain.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-property-values.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/set-global.spec.d.ts +1 -0
- package/dist/test/unit/operation/invoke-object-method.spec.d.ts +1 -0
- package/dist/test/unit/operation/load-json.spec.d.ts +1 -0
- package/dist/test/unit/operation/log.spec.d.ts +1 -0
- package/dist/test/unit/operation/math.spec.d.ts +1 -0
- package/dist/test/unit/operation/otherwise.spec.d.ts +1 -0
- package/dist/test/unit/operation/remove-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/remove-properties-from-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/reparent-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/request-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/resize-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/select-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-element-attributes.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-element-content.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-global-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-style.spec.d.ts +1 -0
- package/dist/test/unit/operation/start-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/toggle-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/toggle-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/wait.spec.d.ts +1 -0
- package/dist/test/unit/operation/when.spec.d.ts +1 -0
- package/dist/test/unit/timelineproviders/request-animation-frame-timeline-provider.spec.d.ts +1 -0
- package/dist/test/unit/util/prepare-value-for-serialization.spec.d.ts +1 -0
- package/dist/timeline-event-names.d.ts +81 -81
- package/dist/timelineproviders/index.d.ts +2 -1
- package/dist/timelineproviders/request-animation-frame-timeline-provider.d.ts +40 -40
- package/dist/timelineproviders/types.d.ts +21 -20
- package/dist/timelineproviders/{media-element-timeline-provider.d.ts → video-js-timeline-provider.d.ts} +39 -42
- package/dist/tools/doc-tools/generate-readmes.d.ts +1 -1
- package/dist/tools/schema-tools/generate-operation-schemas.d.ts +1 -1
- package/dist/tools/schema-tools/html-tag-names.d.ts +1 -1
- package/dist/types.d.ts +103 -102
- package/dist/util/animation-interval.d.ts +1 -1
- package/dist/util/apply-operation.d.ts +3 -3
- package/dist/util/camel-case-to-dash.d.ts +1 -1
- package/dist/util/dash-to-camel-case.d.ts +1 -1
- package/dist/util/guards/is-function.d.ts +1 -1
- package/dist/util/guards/is-object.d.ts +1 -1
- package/dist/util/guards/is-promise.d.ts +1 -1
- package/dist/util/guards/is-string.d.ts +1 -1
- package/dist/util/prepare-value-for-serialization.d.ts +1 -1
- package/package.json +60 -68
- package/dist/eligius.cjs.development.js +0 -7462
- package/dist/eligius.cjs.development.js.map +0 -1
- package/dist/eligius.cjs.production.min.js +0 -2
- package/dist/eligius.cjs.production.min.js.map +0 -1
- package/dist/eligius.esm.js +0 -7364
- package/dist/eligius.esm.js.map +0 -1
- package/dist/operation/metadata/end-loop.d.ts +0 -3
- package/dist/operation/metadata/start-loop.d.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export * from './action';
|
|
2
|
-
export * from './action/types';
|
|
3
|
-
export * from './build';
|
|
4
|
-
export * from './configuration/api';
|
|
5
|
-
export { ConfigurationResolver } from './configuration/configuration-resolver';
|
|
6
|
-
export * from './configuration/types';
|
|
7
|
-
export * from './controllers';
|
|
8
|
-
export * from './controllers/types';
|
|
9
|
-
export * from './diagnostics';
|
|
10
|
-
export { EligiusEngine } from './eligius-engine';
|
|
11
|
-
export { EngineFactory } from './engine-factory';
|
|
12
|
-
export * from './eventbus';
|
|
13
|
-
export * from './eventbus/types';
|
|
14
|
-
export { EligiusResourceImporter } from './importer';
|
|
15
|
-
export { LanguageManager } from './language-manager';
|
|
16
|
-
export * from './operation';
|
|
17
|
-
export * as metadata from './operation/metadata';
|
|
18
|
-
export * from './operation/types';
|
|
19
|
-
export { TimelineEventNames } from './timeline-event-names';
|
|
20
|
-
export * from './timelineproviders';
|
|
21
|
-
export * from './timelineproviders/types';
|
|
22
|
-
export * from './types';
|
|
1
|
+
export * from './action';
|
|
2
|
+
export * from './action/types';
|
|
3
|
+
export * from './build';
|
|
4
|
+
export * from './configuration/api';
|
|
5
|
+
export { ConfigurationResolver } from './configuration/configuration-resolver';
|
|
6
|
+
export * from './configuration/types';
|
|
7
|
+
export * from './controllers';
|
|
8
|
+
export * from './controllers/types';
|
|
9
|
+
export * from './diagnostics';
|
|
10
|
+
export { EligiusEngine } from './eligius-engine';
|
|
11
|
+
export { EngineFactory } from './engine-factory';
|
|
12
|
+
export * from './eventbus';
|
|
13
|
+
export * from './eventbus/types';
|
|
14
|
+
export { EligiusResourceImporter } from './importer';
|
|
15
|
+
export { LanguageManager } from './language-manager';
|
|
16
|
+
export * from './operation';
|
|
17
|
+
export * as metadata from './operation/metadata';
|
|
18
|
+
export * from './operation/types';
|
|
19
|
+
export { TimelineEventNames } from './timeline-event-names';
|
|
20
|
+
export * from './timelineproviders';
|
|
21
|
+
export * from './timelineproviders/types';
|
|
22
|
+
export * from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var ii=Object.create;var Ge=Object.defineProperty;var oi=Object.getOwnPropertyDescriptor;var ai=Object.getOwnPropertyNames;var si=Object.getPrototypeOf,li=Object.prototype.hasOwnProperty;var ge=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),X=(n,e)=>{for(var t in e)Ge(n,t,{get:e[t],enumerable:!0})},ci=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ai(e))!li.call(n,i)&&i!==t&&Ge(n,i,{get:()=>e[i],enumerable:!(r=oi(e,i))||r.enumerable});return n};var ve=(n,e,t)=>(t=n!=null?ii(si(n)):{},ci(e||!n||!n.__esModule?Ge(t,"default",{value:n,enumerable:!0}):t,n));var Ie=ge(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.hasValueAtKey=C.hasPresentKey=C.isFilled=C.isDefined=C.isPresent=void 0;function mi(n){return n!=null}C.isPresent=mi;function di(n){return n!==void 0}C.isDefined=di;function fi(n){return n!==null}C.isFilled=fi;function hi(n){return function(e){return e[n]!==void 0&&e[n]!==null}}C.hasPresentKey=hi;function gi(n,e){return function(t){return t[n]===e}}C.hasValueAtKey=gi});var $r=ge((hd,qr)=>{"use strict";var it=typeof navigator<"u"&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function ot(n,e,t,r){n.addEventListener?n.addEventListener(e,t,r):n.attachEvent&&n.attachEvent("on".concat(e),function(){t(window.event)})}function kr(n,e){for(var t=e.slice(0,e.length-1),r=0;r<t.length;r++)t[r]=n[t[r].toLowerCase()];return t}function Mr(n){for(var e=(n=(n=typeof n!="string"?"":n).replace(/\s/g,"")).split(","),t=e.lastIndexOf("");0<=t;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function Yo(n,e){for(var t=n.length<e.length?e:n,r=n.length<e.length?n:e,i=!0,o=0;o<t.length;o++)~r.indexOf(t[o])||(i=!1);return i}for(J={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":it?173:189,"=":it?61:187,";":it?59:186,"'":222,"[":219,"]":221,"\\":220},D={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},$e={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},y={16:!1,18:!1,17:!1,91:!1},v={},le=1;le<20;le++)J["f".concat(le)]=111+le;var J,D,$e,y,v,le,d=[],Sr=!1,Fr="all",Ur=[],pe=function(n){return J[n.toLowerCase()]||D[n.toLowerCase()]||n.toUpperCase().charCodeAt(0)},Xo=function(n){return Object.keys(J).find(function(e){return J[e]===n})},Zo=function(n){return Object.keys(D).find(function(e){return D[e]===n})};function jr(n){Fr=n||"all"}function ce(){return Fr||"all"}function ea(){return d.slice(0)}function ta(){return d.map(function(n){return Xo(n)||Zo(n)||String.fromCharCode(n)})}function na(){var n=[];return Object.keys(v).forEach(function(e){v[e].forEach(function(t){var r=t.key;n.push({scope:t.scope,shortcut:t.shortcut,mods:t.mods,keys:r.split("+").map(function(i){return pe(i)})})})}),n}function ra(e){var e=e.target||e.srcElement,t=e.tagName;return!!(!e.isContentEditable&&(t!=="INPUT"&&t!=="TEXTAREA"&&t!=="SELECT"||e.readOnly))}function ia(n){return typeof n=="string"&&(n=pe(n)),!!~d.indexOf(n)}function oa(n,e){var t,r,i;for(i in n=n||ce(),v)if(Object.prototype.hasOwnProperty.call(v,i))for(t=v[i],r=0;r<t.length;)t[r].scope===n?t.splice(r,1):r++;ce()===n&&jr(e||"all")}function aa(n){var e=n.keyCode||n.which||n.charCode,t=d.indexOf(e);if(t<0||d.splice(t,1),n.key&&n.key.toLowerCase()=="meta"&&d.splice(0,d.length),(e=e!==93&&e!==224?e:91)in y)for(var r in y[e]=!1,D)D[r]===e&&(w[r]=!1)}function sa(n){if(n===void 0)Object.keys(v).forEach(function(a){return delete v[a]});else if(Array.isArray(n))n.forEach(function(a){a.key&&at(a)});else if(typeof n=="object")n.key&&at(n);else if(typeof n=="string"){for(var e=arguments.length,t=Array(1<e?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];var i=t[0],o=t[1];typeof i=="function"&&(o=i,i=""),at({key:n,scope:i,method:o,splitKey:"+"})}}var at=function(n){var e=n.scope,t=n.method,r=n.splitKey,i=r===void 0?"+":r;Mr(n.key).forEach(function(s){var a,s=s.split(i),c=s.length,p=s[c-1],p=p==="*"?"*":pe(p);v[p]&&(e=e||ce(),a=1<c?kr(D,s):[],v[p]=v[p].filter(function(u){return!((!t||u.method===t)&&u.scope===e&&Yo(u.mods,a))}))})};function wr(n,e,t,r){var i;if(e.element===r&&(e.scope===t||e.scope==="all")){for(var o in i=0<e.mods.length,y)Object.prototype.hasOwnProperty.call(y,o)&&(!y[o]&&~e.mods.indexOf(+o)||y[o]&&!~e.mods.indexOf(+o))&&(i=!1);(e.mods.length!==0||y[16]||y[18]||y[17]||y[91])&&!i&&e.shortcut!=="*"||(e.keys=[],e.keys=e.keys.concat(d),e.method(n,e)===!1&&(n.preventDefault?n.preventDefault():n.returnValue=!1,n.stopPropagation&&n.stopPropagation(),n.cancelBubble)&&(n.cancelBubble=!0))}}function Lr(n,e){var t=v["*"],r=n.keyCode||n.which||n.charCode;if(w.filter.call(this,n)){if(~d.indexOf(r=r!==93&&r!==224?r:91)||r===229||d.push(r),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(_){var x=$e[_];n[_]&&!~d.indexOf(x)?d.push(x):!n[_]&&~d.indexOf(x)?d.splice(d.indexOf(x),1):_!=="metaKey"||!n[_]||d.length!==3||n.ctrlKey||n.shiftKey||n.altKey||(d=d.slice(d.indexOf(x)))}),r in y){for(var i in y[r]=!0,D)D[i]===r&&(w[i]=!0);if(!t)return}for(var o in y)Object.prototype.hasOwnProperty.call(y,o)&&(y[o]=n[$e[o]]);n.getModifierState&&(!n.altKey||n.ctrlKey)&&n.getModifierState("AltGraph")&&(~d.indexOf(17)||d.push(17),~d.indexOf(18)||d.push(18),y[17]=!0,y[18]=!0);var a=ce();if(t)for(var s=0;s<t.length;s++)t[s].scope===a&&(n.type==="keydown"&&t[s].keydown||n.type==="keyup"&&t[s].keyup)&&wr(n,t[s],a,e);if(r in v){for(var c=0;c<v[r].length;c++)if((n.type==="keydown"&&v[r][c].keydown||n.type==="keyup"&&v[r][c].keyup)&&v[r][c].key){for(var p=v[r][c],u=p.key.split(p.splitKey),m=[],E=0;E<u.length;E++)m.push(pe(u[E]));m.sort().join("")===d.sort().join("")&&wr(n,p,a,e)}}}}function la(n){return!!~Ur.indexOf(n)}function w(n,e,t){d=[];var r=Mr(n),i=[],o="all",a=document,s=0,c=!1,p=!0,u="+",m=!1;for(t===void 0&&typeof e=="function"&&(t=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(o=e.scope),e.element&&(a=e.element),e.keyup&&(c=e.keyup),e.keydown!==void 0&&(p=e.keydown),e.capture!==void 0&&(m=e.capture),typeof e.splitKey=="string")&&(u=e.splitKey),typeof e=="string"&&(o=e);s<r.length;s++)i=[],1<(n=r[s].split(u)).length&&(i=kr(D,n)),(n=(n=n[n.length-1])==="*"?"*":pe(n))in v||(v[n]=[]),v[n].push({keyup:c,keydown:p,scope:o,mods:i,shortcut:r[s],method:t,key:r[s],splitKey:u,element:a});a!==void 0&&!la(a)&&window&&(Ur.push(a),ot(a,"keydown",function(E){Lr(E,a)},m),Sr||(Sr=!0,ot(window,"focus",function(){d=[]},m)),ot(a,"keyup",function(E){Lr(E,a),aa(E)},m))}function ca(n){var e=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(v).forEach(function(t){v[t].filter(function(r){return r.scope===e&&r.shortcut===n}).forEach(function(r){r&&r.method&&r.method()})})}var qe,Nr,st={getPressedKeyString:ta,setScope:jr,getScope:ce,deleteScope:oa,getPressedKeyCodes:ea,getAllKeyCodes:na,isPressed:ia,filter:ra,trigger:ca,unbind:sa,keyMap:J,modifier:D,modifierMap:$e};for(qe in st)Object.prototype.hasOwnProperty.call(st,qe)&&(w[qe]=st[qe]);typeof window<"u"&&(Nr=window.hotkeys,w.noConflict=function(n){return n&&window.hotkeys===w&&(window.hotkeys=Nr),w},window.hotkeys=w),qr.exports=w});var Xr=ge((gd,Yr)=>{"use strict";var lt=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function ct(n,e,t,r){n.addEventListener?n.addEventListener(e,t,r):n.attachEvent&&n.attachEvent("on".concat(e),function(){t(window.event)})}function Vr(n,e){for(var t=e.slice(0,e.length-1),r=0;r<t.length;r++)t[r]=n[t[r].toLowerCase()];return t}function zr(n){typeof n!="string"&&(n=""),n=n.replace(/\s/g,"");for(var e=n.split(","),t=e.lastIndexOf("");t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function pa(n,e){for(var t=n.length>=e.length?n:e,r=n.length>=e.length?e:n,i=!0,o=0;o<t.length;o++)r.indexOf(t[o])===-1&&(i=!1);return i}var me={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":lt?173:189,"=":lt?61:187,";":lt?59:186,"'":222,"[":219,"]":221,"\\":220},R={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},mt={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},b={16:!1,18:!1,17:!1,91:!1},I={};for(ue=1;ue<20;ue++)me["f".concat(ue)]=111+ue;var ue,f=[],Qr=!1,Jr="all",Wr=[],fe=function(e){return me[e.toLowerCase()]||R[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)},ua=function(e){return Object.keys(me).find(function(t){return me[t]===e})},ma=function(e){return Object.keys(R).find(function(t){return R[t]===e})};function Br(n){Jr=n||"all"}function de(){return Jr||"all"}function da(){return f.slice(0)}function fa(){return f.map(function(n){return ua(n)||ma(n)||String.fromCharCode(n)})}function ha(){var n=[];return Object.keys(I).forEach(function(e){I[e].forEach(function(t){var r=t.key,i=t.scope,o=t.mods,a=t.shortcut;n.push({scope:i,shortcut:a,mods:o,keys:r.split("+").map(function(s){return fe(s)})})})}),n}function ga(n){var e=n.target||n.srcElement,t=e.tagName,r=!0;return(e.isContentEditable||(t==="INPUT"||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(r=!1),r}function va(n){return typeof n=="string"&&(n=fe(n)),f.indexOf(n)!==-1}function Ia(n,e){var t,r;n||(n=de());for(var i in I)if(Object.prototype.hasOwnProperty.call(I,i))for(t=I[i],r=0;r<t.length;)t[r].scope===n?t.splice(r,1):r++;de()===n&&Br(e||"all")}function Ea(n){var e=n.keyCode||n.which||n.charCode,t=f.indexOf(e);if(t>=0&&f.splice(t,1),n.key&&n.key.toLowerCase()==="meta"&&f.splice(0,f.length),(e===93||e===224)&&(e=91),e in b){b[e]=!1;for(var r in R)R[r]===e&&(L[r]=!1)}}function ya(n){if(typeof n>"u")Object.keys(I).forEach(function(a){return delete I[a]});else if(Array.isArray(n))n.forEach(function(a){a.key&&pt(a)});else if(typeof n=="object")n.key&&pt(n);else if(typeof n=="string"){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];var i=t[0],o=t[1];typeof i=="function"&&(o=i,i=""),pt({key:n,scope:i,method:o,splitKey:"+"})}}var pt=function(e){var t=e.key,r=e.scope,i=e.method,o=e.splitKey,a=o===void 0?"+":o,s=zr(t);s.forEach(function(c){var p=c.split(a),u=p.length,m=p[u-1],E=m==="*"?"*":fe(m);if(I[E]){r||(r=de());var _=u>1?Vr(R,p):[];I[E]=I[E].filter(function(x){var F=i?x.method===i:!0;return!(F&&x.scope===r&&pa(x.mods,_))})}})};function Kr(n,e,t,r){if(e.element===r){var i;if(e.scope===t||e.scope==="all"){i=e.mods.length>0;for(var o in b)Object.prototype.hasOwnProperty.call(b,o)&&(!b[o]&&e.mods.indexOf(+o)>-1||b[o]&&e.mods.indexOf(+o)===-1)&&(i=!1);(e.mods.length===0&&!b[16]&&!b[18]&&!b[17]&&!b[91]||i||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(f),e.method(n,e)===!1&&(n.preventDefault?n.preventDefault():n.returnValue=!1,n.stopPropagation&&n.stopPropagation(),n.cancelBubble&&(n.cancelBubble=!0)))}}}function Gr(n,e){var t=I["*"],r=n.keyCode||n.which||n.charCode;if(L.filter.call(this,n)){if((r===93||r===224)&&(r=91),f.indexOf(r)===-1&&r!==229&&f.push(r),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(x){var F=mt[x];n[x]&&f.indexOf(F)===-1?f.push(F):!n[x]&&f.indexOf(F)>-1?f.splice(f.indexOf(F),1):x==="metaKey"&&n[x]&&f.length===3&&(n.ctrlKey||n.shiftKey||n.altKey||(f=f.slice(f.indexOf(F))))}),r in b){b[r]=!0;for(var i in R)R[i]===r&&(L[i]=!0);if(!t)return}for(var o in b)Object.prototype.hasOwnProperty.call(b,o)&&(b[o]=n[mt[o]]);n.getModifierState&&!(n.altKey&&!n.ctrlKey)&&n.getModifierState("AltGraph")&&(f.indexOf(17)===-1&&f.push(17),f.indexOf(18)===-1&&f.push(18),b[17]=!0,b[18]=!0);var a=de();if(t)for(var s=0;s<t.length;s++)t[s].scope===a&&(n.type==="keydown"&&t[s].keydown||n.type==="keyup"&&t[s].keyup)&&Kr(n,t[s],a,e);if(r in I){for(var c=0;c<I[r].length;c++)if((n.type==="keydown"&&I[r][c].keydown||n.type==="keyup"&&I[r][c].keyup)&&I[r][c].key){for(var p=I[r][c],u=p.splitKey,m=p.key.split(u),E=[],_=0;_<m.length;_++)E.push(fe(m[_]));E.sort().join("")===f.sort().join("")&&Kr(n,p,a,e)}}}}function ba(n){return Wr.indexOf(n)>-1}function L(n,e,t){f=[];var r=zr(n),i=[],o="all",a=document,s=0,c=!1,p=!0,u="+",m=!1;for(t===void 0&&typeof e=="function"&&(t=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(o=e.scope),e.element&&(a=e.element),e.keyup&&(c=e.keyup),e.keydown!==void 0&&(p=e.keydown),e.capture!==void 0&&(m=e.capture),typeof e.splitKey=="string"&&(u=e.splitKey)),typeof e=="string"&&(o=e);s<r.length;s++)n=r[s].split(u),i=[],n.length>1&&(i=Vr(R,n)),n=n[n.length-1],n=n==="*"?"*":fe(n),n in I||(I[n]=[]),I[n].push({keyup:c,keydown:p,scope:o,mods:i,shortcut:r[s],method:t,key:r[s],splitKey:u,element:a});typeof a<"u"&&!ba(a)&&window&&(Wr.push(a),ct(a,"keydown",function(E){Gr(E,a)},m),Qr||(Qr=!0,ct(window,"focus",function(){f=[]},m)),ct(a,"keyup",function(E){Gr(E,a),Ea(E)},m))}function Ta(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(I).forEach(function(t){var r=I[t].filter(function(i){return i.scope===e&&i.shortcut===n});r.forEach(function(i){i&&i.method&&i.method()})})}var ut={getPressedKeyString:fa,setScope:Br,getScope:de,deleteScope:Ia,getPressedKeyCodes:da,getAllKeyCodes:ha,isPressed:va,filter:ga,trigger:Ta,unbind:ya,keyMap:me,modifier:R,modifierMap:mt};for(Qe in ut)Object.prototype.hasOwnProperty.call(ut,Qe)&&(L[Qe]=ut[Qe]);var Qe;typeof window<"u"&&(Hr=window.hotkeys,L.noConflict=function(n){return n&&window.hotkeys===L&&(window.hotkeys=Hr),L},window.hotkeys=L);var Hr;Yr.exports=L});var Zr=ge((vd,dt)=>{process.env.NODE_ENV==="production"?dt.exports=$r():dt.exports=Xr()});import pi from"jquery";function $(n){return typeof n=="function"}function Q(n){return n!==null&&typeof n=="object"}function K(n){if(Array.isArray(n))return n.map(K);if(n instanceof pi)return"jQuery object";if(Q(n)){if(n.constructor.toString().substring(0,5)==="class"||!n.constructor.toString().startsWith("function Object()")){let e=n.constructor.toString();return e.substring(0,e.indexOf("{")+1)}return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,K(t)]))}else if($(n)){let e=n.toString();return e.indexOf("{")>-1?e.substring(0,e.indexOf("{")+1):e}return n}var Z=class{constructor(e){this.agent=e}handleEvent(e,t,r){let i={eventName:e,eventTopic:t,args:K(r)};try{this.agent.postMessage("eligius-diagnostics-event",i)}catch(o){console.error("postmessage failed"),console.error(o),console.log("message",i)}}};var h=class{static send(e,t){console.log(e,t)}};var He="__ELIGIUS_DEV_TOOLS__";function U(n){return n.systemName===this.self?(this.counter=this.counter+1,!1):n.systemName===this.matchingName&&this.counter===0?!0:(n.systemName===this.matchingName&&this.counter>0&&(this.counter=this.counter-1),!1)}var vt=function(n){let{collection:e}=n;if(e!==null&&!Array.isArray(e))throw new Error("Expected collection to be array type, string value was probably not resolved correctly");return this.loopIndex===void 0&&(this.loopEndIndex=ui(this),e?.length?(this.loopIndex=0,this.loopLength=e.length-1,this.loopStartIndex=this.currentIndex):(this.newIndex=this.loopEndIndex,delete this.loopIndex,delete this.loopLength,delete this.loopStartIndex,delete this.loopEndIndex)),e?.length&&this.loopIndex!==void 0&&(this.currentItem=e[this.loopIndex]),n};function ui(n){let e=n.currentIndex+1,r=n.operations.slice(e).findIndex(U.bind({counter:0,self:Ve,matchingName:ze}));return r>-1?r+e:n.operations.length}var Ve="forEach",ze="endForEach";var It=ve(Ie()),vi=typeof structuredClone<"u"?structuredClone:n=>JSON.parse(JSON.stringify(n));function g(n){return(0,It.isDefined)(n)?vi(n):n}function S(n){return typeof n=="string"}function N(n,e){let t=e,r=null;return n.forEach((i,o)=>{if(!t)throw new Error(`Property chain '${n.join(".")}' cannot be resolved.`);if(o===n.length-1){let a=i.split("+");a.length>1&&(i=a[0],r=a[1])}t=t[i]}),r?`${t}${r}`:t}var Je={};function Ii(n,e){let t=e?n[e]:n;return t&&t!==n?g(t):t}function Ei(n,e){Object.entries(e).forEach(([t,r])=>n[t]=r)}function yi(n){Object.keys(n).forEach(t=>delete n[t])}var k=Ii.bind(null,Je),Et=Ei.bind(null,Je),Wa=yi.bind(null,Je);function A(n,e,t){if(S(t)){let r=t.split(".");switch(r.shift()?.toLowerCase()){case"operationdata":return N(r,n);case"globaldata":return N(r,k());case"context":return N(r,e)}}return t}var yt=function(n){let[e,t,r]=bi(n.expression,n,this);return this.whenEvaluation=Ti[t](e,r),this.whenEvaluation||(this.newIndex=Oi(this)),delete n.expression,n};function bi(n,e,t){let[r,i]=n.split(/!=|==|>=|<=|>|</),o=n.substring(r.length,n.length-i.length),a=+r,s=+i;return[isNaN(a)?A(e,t,r):a,o,isNaN(s)?A(e,t,i):s]}var Ti={"==":(n,e)=>n===e,"!=":(n,e)=>n!==e,">=":(n,e)=>n>=e,"<=":(n,e)=>n<=e,">":(n,e)=>n>e,"<":(n,e)=>n<e};function Oi(n){let e=n.currentIndex+1,t=n.operations.slice(e),r=t.findIndex(U.bind({counter:0,self:Ee,matchingName:xi}));if(r>-1)return r+e;let i=t.findIndex(U.bind({counter:0,self:Ee,matchingName:We}));return i>-1?i+e:n.operations.length}var Ee="when",xi="otherwise",We="endWhen";function bt(n){return typeof n=="object"&&typeof n.then=="function"}var j=class{constructor(e,t,r){this.name=e;this.startOperations=t;this.eventbus=r;this.id="";this._contextStack=[]}start(e){h.active&&h.send("eligius-diagnostics-action",`${this.name??"Action"} begins executing start operations`),this._initializeContextStack();let t=new Promise((r,i)=>{this.executeOperation(this.startOperations,0,r,i,e)}).catch(r=>{throw h.active&&h.send("eligius-diagnostics-action-error",{name:this.name,error:r}),console.error(`Error in action start '${this.name}'`),console.error(r),r});return h.active?t.then(r=>(h.send("eligius-diagnostics-action",`${this.name??"Action"} finished executing start operations`),r)):t}_initializeContextStack(){this._contextStack=[{currentIndex:-1,eventbus:this.eventbus,operations:this.startOperations}]}_pushContext(e){let t={get currentIndex(){return e.currentIndex},set currentIndex(r){e.currentIndex=r},get eventbus(){return e.eventbus},get operations(){return e.operations},parent:e};return this._contextStack.push(t),t}_popContext(){this._contextStack.pop()}executeOperation(e,t,r,i,o={}){let a=this._contextStack[this._contextStack.length-1];if(a.newIndex!==void 0&&(t=a.newIndex,delete a.newIndex),a.currentIndex=t,t<e.length){let s=e[t],c=g(s.operationData??{}),p=Object.assign(o,c);s.systemName===Ee?a=this._pushContext(a):s.systemName===Ve&&a.owner!==s&&(a=this._pushContext(a),a.owner=s),h.active&&h.send("eligius-diagnostics-operation",{systemName:s.systemName,operationData:p,context:{...a,eventbus:void 0}});let u=s.instance.call(a,p);(s.systemName===We||s.systemName===ze&&a.newIndex===void 0)&&this._popContext(),bt(u)?u.then(m=>this.executeOperation(e,++t,r,i,m)).catch(m=>{i(m)}):this.executeOperation(e,++t,r,i,u)}else r(o)}};var q=class extends j{constructor(t,r,i,o){super(t,r,o);this.endOperations=i}end(t){if(h.active&&h.send("eligius-diagnostics-action",`${this.name??"Action"} begins executing end operations`),!this.endOperations.length)return Promise.resolve(t??{});this._initializeContextStack();let r=new Promise((i,o)=>{this.executeOperation(this.endOperations,0,i,o,t)}).catch(i=>{throw h.active&&h.send("eligius-diagnostics-action-error",{name:this.name,error:i}),console.error(`Error in action end '${this.name}'`),i});return h.active?r.then(i=>(h.send("eligius-diagnostics-action",`${this.name??"Action"} finished executing start operations`),i)):r}};var ee=class extends q{constructor(t,r,i,o,a){super(t,r,i,a);this.duration=o;this._active=!1}get active(){return this._active}start(t){return this.active?Promise.resolve({}):(this._active=!!this.endOperations.length,super.start(t))}end(t){return super.end(t).then(r=>(this._active=!1,r))}};import Ci from"fs";import Tt from"path";function Be(n){return n.replace(/-([a-z])/g,e=>e[1].toUpperCase())}function _i(n,e,t){let r=Di(n,e,t);return Ai(r)}function Ai(n){let e=n.filter(t=>t.defaultImport).map(t=>`import ${t.systemName} from '${t.path}';`).concat(n.filter(t=>!t.defaultImport).map(t=>`import {${t.systemName}} from '${t.path??"eligius"}';`));return e.push("import { ISimpleResourceImporter } from 'eligius';"),e.push(""),e.push("const imports: Record<string, any> = {"),e.push(...n.map(t=>`${t.systemName}: { '${t.systemName}': ${t.systemName} },`)),e.push("};"),e.push(""),e.push("class EligiusResourceImporter implements ISimpleResourceImporter {"),e.push("import(name: string): Record<string, any> {"),e.push("if (imports.hasOwnProperty(name)) { return imports[name]; }"),e.push("throw Error(`Unknown systemName: ${name}`);"),e.push("}}"),e.push(""),e.push("export default EligiusResourceImporter;"),e.join(`
|
|
2
|
+
`)}function Di(n,e,t){return[...Li(n),...t.flatMap(r=>Pi(e,r.path,r.extension)),...Ri(n),...Si(n),...wi(n)]}function Pi(n,e,t){return Ci.readdirSync(Tt.join(n,e)).map(i=>({systemName:`${Be(Tt.basename(i,t))}`,path:`./${e}/${i}`,defaultImport:!0}))}function Ri(n){let e=[];return e.push(...ye(n.initActions)),e.push(...ye(n.actions)),e.push(...ye(n.timelines.flatMap(t=>t.timelineActions))),e.push(...ye(n.eventActions)),e=xt(e),e}function Si(n){return n.timelineProviderSettings?Object.values(n.timelineProviderSettings).map(e=>({systemName:e.systemName})):[]}function wi(n){if(n.engine){let{systemName:e}=n.engine;return[{systemName:e}]}return[]}function Li(n){let e=Ot(n.initActions.concat(n.actions).concat(n.eventActions??[]));if(n.timelines){let t=n.timelines.flatMap(r=>r.timelineActions);e=e.concat(Ot(t))}return xt(e)}function ye(n){if(!n)return[];let e=n.flatMap(t=>[...t.startOperations,...t.endOperations??[]]);return Ni(e)}function Ot(n){if(!n)return[];let e=n.flatMap(t=>[...t.startOperations,...t.endOperations??[]]);return ki(e)}function Ni(n){return n?n.filter(e=>e.operationData?.hasOwnProperty("systemName")?e.operationData.systemName.endsWith("Controller"):!1).map(e=>{let{systemName:t}=e.operationData??{};return{systemName:t}}):[]}function ki(n){return n?n.map(e=>{let{systemName:t}=e;return{systemName:t}}):[]}function xt(n){let e={};return n.filter(t=>e[t.systemName]?!1:(e[t.systemName]=!0,!0))}import{v4 as Ze}from"uuid";var O={};X(O,{addClass:()=>Ct,addControllerToElement:()=>At,animate:()=>Dt,animateWithClass:()=>Pt,broadcastEvent:()=>wt,calc:()=>Lt,clearElement:()=>Nt,clearOperationData:()=>kt,createElement:()=>Ft,customFunction:()=>Ut,endAction:()=>jt,endForEach:()=>qt,endWhen:()=>$t,extendController:()=>Qt,forEach:()=>vt,getAttributesFromElement:()=>Kt,getControllerFromElement:()=>Gt,getControllerInstance:()=>Ht,getElementDimensions:()=>zt,getImport:()=>Jt,getQueryParams:()=>Wt,invokeObjectMethod:()=>Bt,loadJSON:()=>Yt,log:()=>Xt,math:()=>Zt,otherwise:()=>en,removeClass:()=>tn,removeControllerFromElement:()=>nn,removeElement:()=>rn,removePropertiesFromOperationData:()=>on,reparentElement:()=>an,requestAction:()=>sn,resizeAction:()=>ln,selectElement:()=>pn,setData:()=>un,setElementAttributes:()=>dn,setElementContent:()=>fn,setGlobalData:()=>hn,setOperationData:()=>gn,setStyle:()=>vn,startAction:()=>In,toggleClass:()=>En,toggleElement:()=>yn,wait:()=>bn,when:()=>yt});var Ct=function(n){let{selectedElement:e,className:t}=n;return e.addClass(t),n};var be="eligiusEngineControllers";function Mi(n,e){return e.data(n)}var G=Mi.bind(null,be);function _t(n,e){n.data(be)||n.data(be,[]);let t=G(n);t&&t.push(e)}function M(n,e){return{...n,...e}}function T(n,e,t){n(t?M(e,t):e)}var At=function(n){let{selectedElement:e,controllerInstance:t}=n;_t(e,t),t.init(n);let r=t.attach(this.eventbus);return r?new Promise((i,o)=>{r.then(a=>{T(i,n,a)},o)}):n};var Dt=function(n){let{animationEasing:e,selectedElement:t,animationProperties:r,animationDuration:i}=n;return new Promise((a,s)=>{try{e?t.animate(r,i,e,()=>{T(a,{},n)}):t.animate(r,i,()=>{T(a,{},n)})}catch(c){s(c)}})};var Pt=function(n){let{selectedElement:e,className:t,removeClass:r}=n;r=r!==void 0?r:!0;let i=new Promise((o,a)=>{try{e.one("webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationEnd",()=>{r&&e.removeClass(t),T(o,{},n)})}catch(s){a(s)}});return e.addClass(t),i};function Rt(n){delete n.eventName,delete n.eventTopic,delete n.eventArgs}function St(n,e,t){if(!t)return;let r=A.bind(null,n,e);return t.map(r)}var wt=function(n){let{eventArgs:e,eventTopic:t,eventName:r}=n,i=St(n,this,e);return t?this.eventbus.broadcastForTopic(r,t,i):this.eventbus.broadcast(r,i),Rt(n),n};import Fi from"jquery";var Te=[];function P(n,e,t){let r=t!==n?g(t):t,i=A.bind(null,n,e);return Ye(t,r,i),r}function Ye(n,e,t){if(!(Te.indexOf(n)>-1)){Te.push(n);try{Object.entries(n).forEach(([r,i])=>{i instanceof Fi||(S(i)?e[r]=t(i):Array.isArray(i)?i.forEach((o,a,s)=>{S(o)?s[a]=t(o):Ye(o,o,t)}):Q(i)?Ye(i,i,t):e[r]=i)})}finally{let r=Te.indexOf(n);Te.splice(r,1)}}}var Ui={"+":(n,e)=>n+e,"-":(n,e)=>n-e,"*":(n,e)=>n*e,"/":(n,e)=>n/e,"%":(n,e)=>n%e,"**":(n,e)=>n**e},Lt=function(n){n=P(n,this,n);let{left:e,right:t,operator:r}=n;return n.calculationResult=Ui[r](+e,+t),n};var Nt=function(n){let{selectedElement:e}=n;return e.empty(),n};var kt=function(n){let{properties:e}=n;return e?(e.forEach(t=>{delete n[t]}),delete n.properties,n):{}};import Mt from"jquery";var Ft=function(n){n=P(n,this,n);let{elementName:e,attributes:t,text:r}=n,i=t?` ${Object.entries(t).filter(([a,s])=>!!s).map(([a,s])=>`${a}="${s}"`).join(" ")}`:"",o=r?Mt(`<${e}${i}>${r}</${e}>`):Mt(`<${e}${i}/>`);return n.template=o,n};var l=class{static{this.PLAY_TOGGLE_REQUEST="timeline-play-toggle-request"}static{this.PLAY_REQUEST="timeline-play-request"}static{this.STOP_REQUEST="timeline-stop-request"}static{this.PAUSE_REQUEST="timeline-pause-request"}static{this.SEEK_REQUEST="timeline-seek-request"}static{this.RESIZE_REQUEST="timeline-resize-request"}static{this.CONTAINER_REQUEST="timeline-container-request"}static{this.DURATION_REQUEST="timeline-duration-request"}static{this.REQUEST_CURRENT_TIMELINE="timeline-request-current-timeline"}static{this.DURATION="timeline-duration"}static{this.TIME="timeline-time"}static{this.SEEKED="timeline-seeked"}static{this.COMPLETE="timeline-complete"}static{this.RESTART="timeline-restart"}static{this.PLAY="timeline-play"}static{this.STOP="timeline-stop"}static{this.PAUSE="timeline-pause"}static{this.SEEK="timeline-seek"}static{this.RESIZE="timeline-resize"}static{this.CURRENT_TIMELINE_CHANGE="timeline-current-timeline-change"}static{this.FIRST_FRAME="timeline-firstframe"}static{this.REQUEST_INSTANCE="request-instance"}static{this.REQUEST_ACTION="request-action"}static{this.REQUEST_FUNCTION="request-function"}static{this.REQUEST_TIMELINE_URI="request-timeline-uri"}static{this.BEFORE_REQUEST_TIMELINE_URI="before-request-timeline-uri"}static{this.REQUEST_ENGINE_ROOT="request-engine-root"}static{this.REQUEST_CURRENT_TIMELINE_POSITION="request-current-timeline-position"}static{this.REQUEST_TIMELINE_CLEANUP="request-timeline-cleanup"}static{this.REQUEST_LABEL_COLLECTION="request-label-collection"}static{this.REQUEST_LABEL_COLLECTIONS="request-label-collections"}static{this.REQUEST_CURRENT_LANGUAGE="request-current-language"}static{this.LANGUAGE_CHANGE="language-change"}};var Ut=function(n){let{systemName:e}=n;return new Promise((t,r)=>{let i=o=>{let a=o.apply(this,[n]);a?a.then(()=>{T(t,{},n)},r):T(t,{},n)};this.eventbus.broadcast(l.REQUEST_FUNCTION,[e,i])})};var jt=function(n){let{actionInstance:e,actionOperationData:t}=n;return delete n.actionOperationData,new Promise((r,i)=>{n=M(n,t),e.end(n).then(()=>{Object.keys(t).forEach(o=>{delete n[o]}),T(r,n)},i)})};var qt=function(n){return this.loopIndex!==void 0&&this.loopLength!==void 0&&this.loopIndex<this.loopLength&&(this.loopIndex=this.loopIndex+1,this.newIndex=this.loopStartIndex,delete this.currentItem),n};var $t=function(n){return delete this.whenEvaluation,n};var Qt=function(n){let{controllerInstance:e,controllerExtension:t}=n;return n.controllerInstance=Object.assign(e,t),n};var Kt=function(n){let{selectedElement:e,attributeNames:t}=n;return n.attributeValues=t.reduce((r,i)=>(i!=="value"?r[i]=e?.attr(i):r[i]=e?.val(),r),{}),n};var Gt=function(n){let{selectedElement:e,controllerName:t}=n,i=G(e)?.find(o=>o.name===t);return i||console.warn(`controller for name '${t}' was not found on the given element`),n.controllerInstance=i,n};var Ht=function(n){let{systemName:e}=n;n.controllerInstance=void 0;let t=r=>{n.controllerInstance=r};return this.eventbus.broadcast(l.REQUEST_INSTANCE,[e,t]),n};function ji(n,e){let t={...e},r=n.substring(0,1),i=n.substring(n.indexOf("[")+1,n.indexOf("]")-(n.indexOf("[")-1)),o=i.split("=")[1].split("-");if(o.filter(Boolean).length!==2)throw new Error(`Badly formatted modifier, expect two ratios: ${i}`);return r==="h"?t.height=t.width/+o[0]*+o[1]:r==="w"&&(t.width=t.height/+o[1]*+o[0]),t}function qi(n){let e=1,t=n.substring(n.length-e,n.length);t!=="h"&&t!=="w"&&t!=="%"&&(t=null);let r=t==="%";return r&&(t=n.substring(n.length-e,n.length-(e+1)),t!=="h"&&t!=="w"&&(t=null)),[t,e,r]}function $i(n,e,t,r,i){let o={...n};switch(e){case"+":switch(t){case"h":o.height+=i;break;case"w":o.width+=r;break;default:o.height+=i,o.width+=r}break;case"-":switch(t){case"h":o.height-=i;break;case"w":o.width-=r;break;default:o.height-=i,o.width-=r}break;case"/":switch(t){case"h":o.height/=i;break;case"w":o.width/=r;break;default:o.height/=i,o.width/=r}break;case"*":switch(t){case"h":o.height*=i;break;case"w":o.width*=r;break;default:o.height*=i,o.width*=r}break;default:console.error(`Unknown operator found: ${e}`)}return o}function Vt(n,e){let t={...n},r=null;e.indexOf("|")>-1&&([e,r]=e.split("|"));let i=e.substring(0,1),[o,a,s]=qi(e),c=parseInt(o!==null?e.substring(1,e.length-(a-1)):e.substring(1),10),p=c,u=c;s&&(p=t.width/100*c,u=t.height/100*c);let m=$i(t,i,o,p,u);return r?ji(r,m):m}var zt=function(n){let{selectedElement:e,modifier:t}=n,r={width:e.innerWidth()??0,height:e.innerHeight()??0};return r.height===0&&(r.height=r.width),t&&(r=Vt(r,t)),n.dimensions=r,n};var Jt=function(n){let{systemName:e}=n,t=r=>{n.importedInstance=r};return this.eventbus.broadcast(l.REQUEST_FUNCTION,[e,t]),delete n.systemName,n};var Wt=function(n){let e=new URLSearchParams(window.location.search),t=Object.fromEntries(e.entries()),{defaultValues:r={}}=n;return delete n.defaultValues,n.queryParams={...r,...t},n};var Bt=function(n){let{methodName:e,methodArguments:t}=n;return delete n.methodName,delete n.methodArguments,n.methodResult=n.instance[e].apply(n.instance,t??[]),n};var Xe={};var Qi=(n,e)=>{Xe[n]=e},Yt=async function(n){let{url:e,cache:t}=n;if(t&&Xe[e])return n.json=Xe[e],n;let i=await(await fetch(e)).json(),o=n.json=i;return t&&Qi(e,o),n};var Xt=function(n){let e=k();return console.group("Operation info"),console.log("context",this),console.log("operationData",n),console.log("globalData",e),console.groupEnd(),n};var Zt=function(n){n=P(n,this,n),n.args=Ki(n.args);let{args:e,functionName:t}=n;return n.mathResult=Math[t].apply(null,e),n};function Ki(n){return n.map(e=>Gi(e)?Math[e]:e)}function Gi(n){return S(n)&&n in Math&&!$(Math[n])}var en=function(n){return this.whenEvaluation&&(this.newIndex=Hi(this)),n};function Hi(n){let e=n.currentIndex+1,r=n.operations.slice(e).findIndex(U.bind({counter:0,self:"when",matchingName:"endWhen"}));return r>-1?r+e:n.operations.length}var tn=function(n){let{selectedElement:e,className:t}=n;return e.removeClass(t),n};var nn=function(n){let{selectedElement:e,controllerName:t}=n,r=G(e),i=r?.find(o=>o.name===t);if(i&&r){let o=r.indexOf(i);r.splice(o,1),i.detach(this.eventbus)}else console.warn(`controller for name '${t}' was not found on the given element`);return n};var rn=function(n){let{selectedElement:e}=n;return e.remove(),n};var on=function(n){let{propertyNames:e}=n;return e.indexOf("propertyNames")<0&&e.push("propertyNames"),Object.fromEntries(Object.entries(n).filter(([t,r])=>!e.includes(t)))};var an=function(n){let{selectedElement:e,newParentSelector:t}=n;return e.remove().appendTo(t),n};var sn=function(n){let{systemName:e}=n,t=r=>{n.actionInstance=r};return this.eventbus.broadcast(l.REQUEST_ACTION,[e,t]),n};var ln=function(n){let{actionInstance:e,actionOperationData:t}=n;return n=M(n,t),e.resize?e.resize(n):n};function cn(n,e){let t=n.find(e);return t.length||console.warn(`selector '${e}' wasn't found!`),t}var pn=function(n){n.selector=A(n,this,n.selector);let{selector:e,useSelectedElementAsRoot:t=!1}=n;if(!e)throw new Error("selectElement: selector is either empty or not defined.");if(t&&n.selectedElement){let i=n.selectedElement;return n.selectedElement=cn(i,e),n}let r=i=>{n.selectedElement=cn(i,e)};return this.eventbus.broadcast(l.REQUEST_ENGINE_ROOT,[r]),n};var un=function(n){let{properties:e}=n;return delete n.properties,Vi(e,n,this),n};function Vi(n,e,t){return Object.keys(n).forEach(i=>{let o=i.split("."),a=o.shift()?.toLowerCase()??"";if(!zi(a))throw new Error(`Unrecognized target: ${a}, known targets are: ${mn.join(", ")}`);let s=o.pop()??"",c=A(e,t,n[i]),p={context:t,operationdata:e,globaldata:k()},u=N(o,p[a]);u[s]=c})}var mn=["context","operationdata","globaldata"];function zi(n){return mn.includes(n)}var dn=function(n){let{attributes:e,selectedElement:t}=n;return t.attr(e),n};var fn=function(n){let{insertionType:e="overwrite",selectedElement:t,template:r}=n;switch(!0){case e==="overwrite":t.html(r);break;case e==="append":t.append(r);break;case e==="prepend":t.prepend(r);break}return delete n.insertionType,n};var hn=function(n){let{properties:e}=n,t=Object.fromEntries(Object.entries(n).filter(([r,i])=>e.includes(r)));return Et(t),delete n.properties,n};var gn=function(n){let{override:e=!1,properties:t}=n;delete n.properties,delete n.override;let r=P(n,this,t);return e?r:{...n,...r}};var vn=function(n){let e=P(n,this,n.properties);return n.selectedElement.css(e),n};var In=function(n){let{actionInstance:e,actionOperationData:t}=n;return delete n.actionOperationData,new Promise((r,i)=>{n=M(n,t),e.start(n).then(()=>{Object.keys(t).forEach(o=>{delete n[o]}),T(r,n)},i)})};var En=function(n){let{selectedElement:e,className:t}=n;return e.toggleClass(t),n};var yn=function(e){return e.selectedElement.toggle(),e};var bn=function(n){let{milliseconds:e}=n;return new Promise(t=>{setTimeout(()=>{T(t,n)},e)})};var Oe=class{constructor(e){this.configurationfactory=e}createAction(e){let t=new te(e,this);return this.configurationfactory.addAction(t.actionConfig),t}createInitAction(e){let t=new te(e,this);return this.configurationfactory.addInitAction(t.actionConfig),t}createEventAction(e){let t=new xe(e,this);return this.configurationfactory.addEventAction(t.actionConfig),t}createTimelineAction(e,t){let r=new et(t,this);return this.configurationfactory.addTimelineAction(e,r.actionConfig),r}end(){return this.configurationfactory}},xe=class{constructor(e,t){this.factory=t;this.actionConfig={name:"",id:Ze(),startOperations:[]},e?.length&&(this.actionConfig.name=e)}getId(){return this.actionConfig.id}setName(e){return this.actionConfig.name=e,this}getConfiguration(e){let t=g(this.actionConfig),r=e.call(this,t);return r&&(this.actionConfig=r),this}addStartOperationByType(e,t){let r=Object.entries(O).find(([,i])=>i===e);if(r)return this.addStartOperation(r[0],t);throw new Error(`Operation class not found: ${e.toString()}`)}addStartOperation(e,t){if(!O[e])throw Error(`Unknown operation: ${e}`);let{startOperations:r}=this.actionConfig;return r.push({id:Ze(),systemName:e,operationData:t}),this}next(){return this.factory}},te=class extends xe{constructor(e,t){super(e,t),this.actionConfig.endOperations=[]}addEndOperationByType(e,t){let r=Object.entries(O).find(([,i])=>i===e);if(r)return this.addEndOperation(r[0],t);throw new Error(`Operation class not found: ${e.toString()}`)}addEndOperation(e,t){if(!O[e])throw Error(`Unknown operation: ${e}`);let{endOperations:r}=this.actionConfig;return r||(r=this.actionConfig.endOperations=[]),r.push({id:Ze(),systemName:e,operationData:t}),this}},et=class extends te{addDuration(e,t){return this.actionConfig.duration={start:e},t&&(this.actionConfig.duration.end=t),this}};var ne=ve(Ie());import{v4 as Tn}from"uuid";function On(n,e,t){t>=n.length?t=0:t<0&&(t=n.length-1),n.splice(t,0,n.splice(e,1)[0])}var re=class{constructor(e,t){this.actionConfig=e;this.configurationFactory=t}updateConfiguration(){this.actionConfig={...this.actionConfig}}getConfiguration(e){let t=g(this.actionConfig),r=e.call(this,t);return r&&(this.actionConfig=r),this}setName(e){return this.actionConfig={...this.actionConfig,name:e},this}getName(){return this.actionConfig.name}addStartOperationByType(e,t){let r=Object.entries(O).find(([,i])=>i===e);if(r)return this.addStartOperation(r[0],t);throw new Error(`Operation class not found: ${e.toString()}`)}addStartOperation(e,t,r){if(!O[e])throw Error(`Unknown operation: ${e}`);let i=this.actionConfig.startOperations?this.actionConfig.startOperations.slice():[],o={id:r??Tn(),systemName:e,operationData:t};return i.push(o),this.actionConfig={...this.actionConfig,startOperations:i},new V(o,this)}editStartOperation(e){let{startOperations:t}=this.actionConfig,r=t.find(i=>i.id===e);if((0,ne.isDefined)(r))return new V(r,this);throw new Error(`start operation not found for id ${e}`)}removeStartOperation(e){let t=this.actionConfig.startOperations?this.actionConfig.startOperations.slice():[],r=t.find(o=>o.id===e);if(!r)throw new Error(`start operation not found for id ${e}`);let i=t.indexOf(r);return i>-1&&(t.splice(i,1),this.actionConfig={...this.actionConfig,startOperations:t}),this}moveStartOperation(e,t){let r=this.actionConfig.startOperations?this.actionConfig.startOperations.slice():[],i=r.find(a=>a.id===e);if(!i)throw new Error(`start operation not found for id ${e}`);let o=r.indexOf(i);if(o>-1){let a=t==="up"?o+1:o-1;On(r,o,a),this.actionConfig={...this.actionConfig,startOperations:r}}return this}next(){return this.configurationFactory}},H=class extends re{addEndOperationByType(e,t){let r=Object.entries(O).find(([,i])=>i===e);if(r)return this.addEndOperation(r[0],t);throw new Error(`Operation class not found: ${e.toString()}`)}addEndOperation(e,t){if(!O[e])throw Error(`Unknown operation: ${e}`);let r=this.actionConfig.endOperations?this.actionConfig.endOperations.slice():[],i={id:Tn(),systemName:e,operationData:t};return r.push(i),this.actionConfig.endOperations=r,new V(i,this)}editEndOperation(e){let{endOperations:t}=this.actionConfig,r=t.find(i=>i.id===e);if((0,ne.isDefined)(r))return new V(r,this);throw new Error(`operation not found for id ${e}`)}removeEndOperation(e){let t=this.actionConfig.endOperations?this.actionConfig.endOperations.slice():[],r=t.find(o=>o.id===e);if(!(0,ne.isDefined)(r))throw new Error(`operation not found for id ${e}`);let i=t.indexOf(r);return i>-1&&(t.splice(i,1),this.actionConfig={...this.actionConfig,endOperations:t}),this}moveEndOperation(e,t){let r=this.actionConfig.endOperations?this.actionConfig.endOperations.slice():[],i=r.find(a=>a.id===e);if(!(0,ne.isDefined)(i))throw new Error(`operation not found for id ${e}`);let o=r.indexOf(i);if(o>-1){let a=t==="up"?o+1:o-1;On(r,o,a),this.actionConfig={...this.actionConfig,endOperations:r}}return this}},Ce=class extends H{setDuration(e,t){if(t!=null&&e>t)throw Error("start position cannot be higher than end position");let r={start:e};return t&&(r.end=t),this.actionConfig={...this.actionConfig,duration:r},this}},V=class{constructor(e,t){this.operationConfig=e;this.actionEditor=t}getConfiguration(e){let t=g(this.operationConfig),r=e.call(this,t);return r&&(this.operationConfig=r),this}getSystemName(){return this.operationConfig.systemName}setSystemName(e){if(!O[e])throw Error(`Unknown operation: ${e}`);return this.operationConfig.systemName=e,this.actionEditor.updateConfiguration(),this}setOperationData(e){return this.operationConfig.operationData=e,this.actionEditor.updateConfiguration(),this}setOperationDataItem(e,t){let{operationData:r={}}=this.operationConfig;return r[e]=t,this.setOperationData(r)}getOperationDataKeys(){let{operationData:e}=this.operationConfig;return e?Object.keys(e):[]}getOperationDataValue(e){let{operationData:t}=this.operationConfig;return t?.[e]}next(){return this.actionEditor}};import{v4 as Se}from"uuid";var _e=class{constructor(e,t){this.factory=e;this.languageLabel=t}_internalGetLabel(e){return this.languageLabel.labels.find(t=>t.languageCode===e)}setLabel(e,t){let r=this._internalGetLabel(e);if(r)r.label;else throw new Error(`No label found for language code '${e}'`);return this}removeLabel(e){let t=this.languageLabel.labels.findIndex(r=>r.languageCode===e);if(t>-1)this.languageLabel.labels.splice(t,1);else throw new Error(`No label found for language code '${e}'`);return this}end(){return this.factory}};import{v4 as Bi}from"uuid";var ie={};X(ie,{RequestAnimationFrameTimelineProvider:()=>Ae,VideoJsTimelineProvider:()=>De});import Ji from"jquery";function xn(n,e,t){let r=document?.timeline?.currentTime,i=r?Number(r):performance.now();function o(s){e.aborted||(t(s),a(s))}function a(s){let c=s-i,p=Math.round(c/n)*n,m=i+p+n-performance.now();setTimeout(()=>requestAnimationFrame(o),m)}a(i)}var Ae=class{constructor(e){this._currentPosition=0;this._updateBound=this._update.bind(this);this._firstFramePending=!0;this._tickInterval=1e3;this.loop=!1;this._playState="stopped";this._playlist=this._extractPlaylist(e),this._currentPlaylistItem=this._playlist[0]}get playState(){return this._playState}_extractPlaylist(e){return e.timelines.filter(r=>r.type==="animation")}onTime(e){this._onTime=e}onComplete(e){this._onComplete=e}onRestart(e){this._onRestart=e}onFirstFrame(e){this._onFirstFrame=e}playlistItem(e){if(e===null||!e.length||this._playlist.length===0)return;let t=this._playlist.find(r=>r.uri===e);if(!t)throw new Error(`Unknown playlist uri: ${e}`);this._currentPlaylistItem=t}_update(e){if(this.playState==="running"){if(this._currentPosition++,this._currentPosition>this._currentPlaylistItem.duration)if(this.loop)this._resetToStartPosition(),this._onRestart?.(),this._callbackPosition();else{this.stop(),this._onComplete?.();return}this._callbackPosition()}}_callbackPosition(){this._onTime?.(this._currentPosition)}start(){if(this.playState==="running"){this._currentPosition==0&&this._callbackPosition();return}this._playState="running",this._abortController?.abort(),this._abortController=new AbortController,this._firstFramePending&&(this._firstFramePending=!1,this._onFirstFrame?.()),this._currentPosition==0&&this._callbackPosition(),xn(this._tickInterval,this._abortController.signal,this._updateBound)}_resetToStartPosition(){this._currentPosition=0}getContainer(){return this._containerElement}_stopAnimationInterval(e=!0){this._abortController?.abort(),this._abortController=void 0,e&&this._resetToStartPosition()}init(){if(this._currentPlaylistItem=this._playlist[0],this._containerElement=Ji(this._currentPlaylistItem.selector),!this._containerElement.length)throw new Error(`timeline selector '${this._currentPlaylistItem.selector}' not found`);return Promise.resolve()}destroy(){this.stop(),this._containerElement=void 0}stop(){this._stopAnimationInterval(),this._playState="stopped"}pause(){this._stopAnimationInterval(!1),this._playState="stopped"}seek(e){return e<0||e>this._currentPlaylistItem.duration?Promise.resolve(this._currentPosition):(this._currentPosition=e,Promise.resolve(e))}getPosition(){return this._currentPosition}getDuration(){return this._currentPlaylistItem.duration}};import Cn from"jquery";import{v4 as Wi}from"uuid";import _n from"video.js";var De=class{constructor(e){this.config=e;this._videoElementId=Wi();this._eventHandlers=[];this._playState="stopped";this.loop=!1;this._urls=[]}get playState(){return this._playState}init(){_n.log.level("all");let e=this.config.timelineProviderSettings.mediaplayer?.selector??"";this._urls=this._extractUrls(this.config),this._addVideoElements(e,this._urls);let t=this;return new Promise(i=>{setTimeout(()=>{this._player=_n(this._videoElementId,{controls:!1,controlBar:!1,liveui:!1,autoplay:!1,preload:"auto",loop:this.loop,src:this._urls[0]},function(){this.one("firstplay",()=>t._onFirstFrame?.()),this.one("canplay",()=>i()),t._addPlayerListener(this,"ended",t._handleEnded.bind(t)),t._addPlayerListener(this,"timeupdate",t._handleTimeUpdate.bind(t)),this.load()})},0)})}_addPlayerListener(e,t,r){e.on(t,r),this._eventHandlers.push(()=>e.off(t,r))}_handleEnded(){this._player?.loop?this._onRestart?.():this._onComplete?.()}_handleTimeUpdate(){if(this._player){let e=this._player.currentTime();e!==void 0&&this._onTime?.(e)}}start(){this._player?.play()}stop(){this._player?.pause(),this._player?.currentTime(0)}pause(){this._player?.pause()}seek(e){return new Promise(t=>{this._player.one("seeked",()=>{t(this._player?.currentTime()??0)}),this._player?.currentTime(e)})}playlistItem(e){this._urls.includes(e)&&this._player?.selectSource([e])}getPosition(){return this._player?.currentTime()??0}getDuration(){return this._player?.duration()??0}getContainer(){let e=this.config.timelineProviderSettings.mediaplayer?.selector??"";return Cn(e)}destroy(){this._eventHandlers.forEach(e=>e()),this._eventHandlers.length=0}onTime(e){this._onTime=e}onComplete(e){this._onComplete=e}onRestart(e){this._onRestart=e}onFirstFrame(e){this._onFirstFrame=e}_extractUrls(e){return e.timelines.filter(r=>r.type==="mediaplayer").map(r=>r.uri)}_addVideoElements(e,t){let r=[`<video id=${this._videoElementId}>`];t.forEach(i=>{r.push(`<source src='${i}' type='${this._extractFileType(i)}'/>`)}),r.push("</video>"),Cn(e).append(r.join(""))}_extractFileType(e){let t=e.lastIndexOf(".");return`video/${e.substring(t+1)}`}};var Pe=class{constructor(e,t){this.providersSettings=e;this.configurationFactory=t}addProvider(e){if(this.providersSettings[e])throw new Error(`Settings for a '${e}' provider already exist`);let t={id:Bi(),poster:void 0,selector:void 0,systemName:"",vendor:""};return this.providersSettings[e]=t,new Re(t,this,this.configurationFactory)}editProvider(e){if(!this.providersSettings[e])throw new Error(`No settings for a '${e}' provider exist yet`);return new Re(this.providersSettings[e],this,this.configurationFactory)}next(){return this.configurationFactory}},Re=class{constructor(e,t,r){this.providerSettings=e;this.providersSettingsEditor=t;this.configurationFactory=r}setVendor(e){return this.providerSettings.vendor=e,this}setSelector(e){return this.providerSettings.selector=e,this}setSystemName(e){if(!ie[e])throw new Error(`Unknown timeline provider system name: ${e}`);return this.providerSettings.systemName=e,this}next(){return this.providersSettingsEditor}end(){return this.configurationFactory}};var An=class n{constructor(e){this.configuration=e||{},this.actionCreatorFactory=new Oe(this)}static extend(e,t,r){return e[t]=r.bind(e),e}static extendMultiple(e,t){return Object.entries(t).forEach(([r,i])=>n.extend(e,r,i)),e}init(e){return this.configuration={id:Se(),engine:{systemName:"EligiusEngine"},containerSelector:"[data-ct-container=true]",timelineProviderSettings:{},language:e,availableLanguages:[],layoutTemplate:"",initActions:[],actions:[],timelines:[],labels:[]},this}setEngine(e){return this.configuration.engine.systemName=e,this}setLayoutTemplate(e){return this.configuration.layoutTemplate=e,this}setDefaultLanguage(e){return this.configuration.language=e,this}setContainerSelector(e){return this.configuration.containerSelector=e,this}editTimelineProviderSettings(){return new Pe(this.configuration.timelineProviderSettings||{},this)}getConfiguration(e){let t=g(this.configuration);if(e){let r=e.call(this,t);this.configuration=g(r)}return t}addLanguage(e,t){let r=this._initializeCollection(this.configuration,"availableLanguages");if(r.find(o=>o.languageCode===e))throw new Error(`Language code '${e}' already exists`);return r.push({id:Se(),languageCode:e,label:t}),this}_internalAddAction(e,t){this._initializeCollection(this.configuration,e)?.push(t)}_initializeCollection(e,t){return e[t]||(e[t]=[]),e[t]}addAction(e){this._internalAddAction("actions",e)}addInitAction(e){this._internalAddAction("initActions",e)}addEventAction(e){this._internalAddAction("eventActions",e)}addTimelineAction(e,t){let r=this.getTimeline(e);if(r)this._initializeCollection(r,"timelineActions").push(t);else throw Error(`No timeline found for uri '${e}'`)}createAction(e){return this.actionCreatorFactory.createAction(e)}createInitAction(e){return this.actionCreatorFactory.createInitAction(e)}createEventAction(e){return this.actionCreatorFactory.createEventAction(e)}createTimelineAction(e,t){return this.actionCreatorFactory.createTimelineAction(e,t)}addTimeline(e,t,r,i,o){let a=this._initializeCollection(this.configuration,"timelines");if(this.getTimeline(e))throw Error(`timeline for uri ${e} already exists`);let c={id:Se(),type:t,uri:e,duration:r,loop:i,selector:o,timelineActions:[]};return a.push(c),this}getTimeline(e){return this.configuration.timelines.find(t=>t.uri===e)}removeTimeline(e){let t=this.getTimeline(e);if(t){let r=this.configuration.timelines.indexOf(t);r>-1&&this.configuration.timelines.splice(r,1)}return this}_initializeLabel(e,t){let r=t.find(i=>i.id===e);return r||(t.push({id:e,labels:[]}),r=t[t.length-1]),r}_getLabelTranslation(e,t){let r=e.find(i=>i.languageCode===t);return r||(r={id:Se(),languageCode:t,label:""},e.push(r)),r}editLabel(e){let t=this.configuration.labels?.find(r=>r.id===e);if(t)return new _e(this,t);throw new Error(`Language label with id '${e}' not found`)}addLabel(e,t,r){let i=this._initializeCollection(this.configuration,"labels"),o=this._initializeLabel(e,i),a=this._getLabelTranslation(o.labels,t);return a.label=r,this}addLabels(e,t){return Object.entries(t).forEach(([r,i])=>this.addLabel(e,r,i)),this}removeLabel(e){let t=this.configuration.labels.findIndex(r=>r.id===e);if(t>-1)this.configuration.labels.splice(t,1);else throw new Error(`Label with id '${e}' not found!`);return this}editAction(e){let t=this.configuration.actions.find(r=>r.id===e);if(t)return new H(t,this);throw new Error(`Action not found for id ${e}`)}editEventAction(e){let t=this.configuration.eventActions?.find(r=>r.id===e);if(t)return new re(t,this);throw new Error(`Event action not found for id ${e}`)}editInitAction(e){let t=this.configuration.initActions.find(r=>r.id===e);if(t)return new H(t,this);throw new Error(`Init action not found for id ${e}`)}editTimelineAction(e,t){let r=this.getTimeline(e);if(!r)throw new Error(`Timeline not found for id ${t}`);let i=r.timelineActions.find(o=>o.id===t);if(i)return new Ce(i,this);throw new Error(`Timeline action not found for id ${t}`)}};var oe={};X(oe,{EventListenerController:()=>we,LabelController:()=>Le,LottieController:()=>Ne,NavigationController:()=>ke,ProgressbarController:()=>Me,RoutingController:()=>Fe,SubtitlesController:()=>Ue});var we=class{constructor(){this.name="EventListenerController"}init(e){this.operationData={selectedElement:e.selectedElement,eventName:e.eventName,actions:e.actions.slice(),actionOperationData:g(e.actionOperationData)}}attach(e){if(!this.operationData)return;let{selectedElement:t,actions:r,eventName:i}=this.operationData;if(!this.actionInstanceInfos){this.actionInstanceInfos=[];let o=a=>s=>{this.actionInstanceInfos?.push({start:a,action:s})};r.forEach(a=>{let[s,c]=this._isStartAction(a);e.broadcast(l.REQUEST_ACTION,[c,o(s)])}),t.on(i,this._eventHandler.bind(this))}}_isStartAction(e){return e.substring(0,4)==="end:"?[!1,e.substring(4)]:[!0,e]}_eventHandler(e){if(!this.operationData||!this.actionInstanceInfos)return;let t=this.operationData.actionOperationData?g(this.operationData.actionOperationData):{};e.target&&(t.eventTarget=e.target),this._executeAction(this.actionInstanceInfos,t,0)}async _executeAction(e,t,r){if(r<e.length){let i=e[r],{action:o}=i,s=await(i.start?o.start.bind(o):o.end.bind(o))(t);this._executeAction(e,Object.assign(t,s),++r)}}detach(e){this.operationData?.selectedElement.off(this.operationData.eventName)}};var Le=class{constructor(){this.listeners=[];this.currentLanguage=null;this.operationData=null;this.labelData={};this.name="LabelController"}init(e){this.operationData=Object.assign({},e)}setLabelId(e){this.requestLabelDataBound&&(this.requestLabelDataBound(e),this._setLabel())}attach(e){this.operationData&&(e.broadcast(l.REQUEST_CURRENT_LANGUAGE,[t=>{this.currentLanguage=t}]),this.requestLabelDataBound=this._requestLabelData.bind(this,e),this.requestLabelDataBound(this.operationData.labelId),this._setLabel(),this.listeners.push(e.on(l.LANGUAGE_CHANGE,this._handleLanguageChange.bind(this))))}_requestLabelData(e,t){e.broadcast(l.REQUEST_LABEL_COLLECTION,[t,r=>{if(r)this._createTextDataLookup(r);else throw new Error(`Label id '${t}' does not exist!`)}])}_setLabel(){if(this.currentLanguage){let e=this.labelData[this.currentLanguage];this.operationData?.attributeName?this.operationData?.selectedElement.attr(this.operationData?.attributeName,e):this.operationData?.selectedElement.html(e)}}detach(e){this.listeners.forEach(t=>t()),this.requestLabelDataBound=void 0}_handleLanguageChange(e){this.currentLanguage=e,this._setLabel()}_createTextDataLookup(e){e.forEach(t=>{this.labelData[t.languageCode]=t.label})}};import Yi from"lottie-web";var Ne=class{constructor(){this.name="LottieController";this.currentLanguage="nl-NL";this.labelData={};this.eventbusRemovers=[];this.animationItem=null;this.operationData=null;this.serializedData=null;this.serializedIEData=null;this.freezePosition=-1;this.endPosition=-1}init(e){this.operationData={...e},e.url.indexOf("[")>-1&&this._parseFilename(e.url),this.serializedData=this.operationData.json?JSON.stringify(this.operationData.json):JSON.stringify(this.operationData.animationData),this.operationData.iefallback&&(this.serializedIEData=JSON.stringify(this.operationData.iefallback))}_parseFilename(e){e.substring(e.indexOf("[")+1,e.indexOf("]")-e.indexOf("[")-1).split(",").forEach(i=>{let o=i.split("=");o[0]==="freeze"?this.freezePosition=+o[1]:o[0]==="end"&&(this.endPosition=+o[1])})}attach(e){if(!this.operationData)return;let{labelIds:t}=this.operationData;if(t&&t.length){let r={};e.broadcast(l.REQUEST_CURRENT_LANGUAGE,[r]),this.currentLanguage=r.language,this.eventbusRemovers.push(e.on(l.LANGUAGE_CHANGE,this._handleLanguageChange.bind(this))),e.broadcast(l.REQUEST_LABEL_COLLECTIONS,[this.operationData.labelIds,r]),this._createTextDataLookup(r.labelCollections)}this._createAnimation()}detach(e){this.eventbusRemovers.forEach(t=>{t()}),this.animationItem&&(this.endPosition>-1?(this.animationItem.addEventListener("complete",this._destroy.bind(this)),this.animationItem.playSegments([this.freezePosition,this.endPosition],!0)):this.animationItem.destroy())}_destroy(){this.animationItem&&(this.animationItem.destroy(),this.animationItem=null)}_createAnimation(){if(!this.operationData||!this.serializedData)return;this.animationItem?.destroy();let e=this._isIE()&&this.serializedIEData?this.serializedIEData:this.serializedData,{labelIds:t}=this.operationData;t&&t.length&&t.forEach(o=>{e=e.split(`!!${o}!!`).join(this.labelData[o][this.currentLanguage])});let r=JSON.parse(e),i={autoplay:this.operationData.autoplay,container:this.operationData.selectedElement[0],loop:this.operationData.loop,rendererSettings:this.operationData.renderer,animationData:r};this.animationItem=Yi.loadAnimation(i),this.endPosition<0&&(this.endPosition=this.animationItem.timeCompleted),this.freezePosition>-1&&this.animationItem.playSegments([0,this.freezePosition],!0),this.operationData.viewBox&&this.operationData.selectedElement.find("svg").attr("viewBox",this.operationData.viewBox)}_createTextDataLookup(e){e.forEach((t,r)=>{t.forEach(i=>{this.operationData&&(this.labelData[this.operationData.labelIds[r]][i.code]=i.label)})})}_handleLanguageChange(e){this.currentLanguage=e,this._createAnimation()}_isIE(){let e=!!window.document.documentMode;return!e&&!!window.StyleMedia||e}};import z from"jquery";var ke=class{constructor(){this.name="NavigationController";this.navigation=[];this.navLookup={};this.navVidIdLookup={};this.ctrlLookup={};this.activeNavigationPoint=null;this.labelControllers=[];this.eventhandlers=[];this.eventbus=null;this.container=null}init(e){this.container=e.selectedElement,this.navigation=this._buildNavigationData(e.json)}attach(e){this.container&&(this.eventbus=e,this.eventhandlers.push(e.on("navigate-to-video-url",this._handleNavigateVideoUrl.bind(this))),this.eventhandlers.push(e.on("highlight-navigation",this._highlightMenu.bind(this))),this.eventhandlers.push(e.on("request-current-navigation",this._handleRequestCurrentNavigation.bind(this))),this.eventhandlers.push(e.on("video-complete",this._handleVideoComplete.bind(this))),this._buildHtml(this.container,this.navigation),this._initHistory.bind(this))}_initHistory(){this.activeNavigationPoint=this.navVidIdLookup[0];let e=this._getQueryVariable(0),t=0;e&&(t=this.navLookup[e].videoUrlIndex),this._highlightMenu(t)}_getQueryVariable(e){let t=window.location.href,r=t.indexOf("#");if(r>-1){let i=t.substring(r+2);if(i)return i.split("/")[e]}return null}_handleRequestCurrentNavigation(e){if(this.activeNavigationPoint){let t=this.ctrlLookup[this.activeNavigationPoint.labelId];e({navigationData:this.activeNavigationPoint,title:t.labelData[t.currentLanguage||""]})}else e(null)}detach(e){this.eventhandlers.forEach(t=>{t()}),this.labelControllers.forEach(t=>{t.detach(e)}),this.labelControllers.length=0,this.eventbus=null,this.container=null,window.onpopstate=null}_pushCurrentState(e=-1){if(!this.activeNavigationPoint)return;let t=this.ctrlLookup[this.activeNavigationPoint.labelId];if(!t)return;let r={navigationData:this.activeNavigationPoint,title:t.labelData[t.currentLanguage||""],position:-1};e>-1&&(r.position=e),this.eventbus?.broadcast("push-history-state",[r])}_buildHtml(e,t){let r=z("<ul/>");t.forEach(this._addNavElement.bind(this,r)),e.append(r)}_addNavElement(e,t){if(t.visible){let r=z("<li/>"),i=z(`<a href='javascript:;' id='nav_${t.videoUrlIndex}'/>`);if(r.append(i),this._addLabel(i,t.labelId),this._addClickHandler(i,t.videoUrlIndex),t.children){let o=z("<ul/>");t.children.forEach(this._addNavElement.bind(this,o)),r.append(o)}e.append(r)}}_addClickHandler(e,t){e.mouseup(this._menuMouseupHandler.bind(this,t))}_menuMouseupHandler(e){let t=this.navVidIdLookup[e];t&&(this.eventbus?.broadcast("request-video-url",[t.videoUrlIndex]),this._handleNavigateVideoUrl(t.videoUrlIndex))}_handleNavigateVideoUrl(e,t=0){this._highlightMenu(e),this.eventbus?.broadcast("request-video-url",[e,t]),this.activeNavigationPoint=this.navVidIdLookup[e],this._pushCurrentState(t)}_highlightMenu(e){let t=z(`#nav_${e}`);t.length&&(z(".current-menu-item").removeClass("current-menu-item"),t.addClass("current-menu-item"))}_handleVideoComplete(e){let t=this.navVidIdLookup[e];t.autoNext?this.eventbus?.broadcast("request-video-url",[t.next.videoUrlIndex]):this.eventbus?.broadcast("request-video-cleanup")}_addLabel(e,t){let r={selectedElement:e,labelId:t},i=o=>{o.init(r),o.attach(this.eventbus),this.labelControllers.push(o),this.ctrlLookup[t]=o};this.eventbus?.broadcast("request-instance",["LabelController",i])}_buildNavigationData(e){let t=[];return e.navigationData.forEach((r,i)=>{this.navLookup[r.id]=r,this.navVidIdLookup[r.videoUrlIndex]=r,r.previous=e.navigationData[i-1]}),e.navigationData.forEach((r,i)=>{r.nextId?(r.next=this.navLookup[r.nextId],delete r.nextId):r.next=e.navigationData[i+1]}),e.roots.forEach(r=>{let i=this.navLookup[r];i.children&&(i.children=i.children.map(o=>this.navLookup[o])),t.push(i)}),t}};var Me=class{constructor(){this.name="ProgressbarController";this.selectedElement=null;this.textElement=null;this.eventbusRemovers=[];this.duration=0}init(e){this.selectedElement=e.selectedElement,this.textElement=e.textElement}attach(e){this.eventbusRemovers.push(e.on(l.TIME,this._positionUpdateHandler.bind(this))),e.broadcast(l.DURATION_REQUEST,[r=>this.duration=r]),this.selectedElement?.css({"pointer-events":"none"});let t=this.selectedElement?.parent();if(t){let r=this._clickHandler.bind(this,e);t.on("click",r),this.eventbusRemovers.push(()=>t.off("click",r))}}detach(e){this.eventbusRemovers.forEach(t=>{t()})}_positionUpdateHandler(e){let t=100/this.duration*e;this.selectedElement?.css("width",`${t}%`),this.textElement?.text(`${Math.floor(t)}%`)}_clickHandler(e,t){let i=t.target.getBoundingClientRect(),o=t.clientX-i.left,a=100/i.width*o;e.broadcast(l.SEEK_REQUEST,[Math.round(this.duration/100*a)])}};var Fe=class{constructor(){this.name="RoutingController";this.navLookup={};this.navVidIdLookup={};this.navigation=null;this.eventhandlers=[];this.eventbus=null}init(e){this.navigation=this._buildNavigationData(e.json)}attach(e){this.eventhandlers.push(e.on("before-request-video-url",this._handleBeforeRequestVideoUrl.bind(this))),this.eventhandlers.push(e.on("push-history-state",this._handlePushHistoryState.bind(this))),this.eventbus=e,window.onpopstate=this._handlePopstate.bind(this);let t=this._getQueryVariable(0);if(t){let r=this.navLookup[t],i=+this._getQueryVariable(1);this.eventbus.broadcast("request-video-url",[r.videoUrlIndex,i,!0])}else window.history.pushState({navigationId:this.navigation[0].id},"",`#/${this.navigation[0].id}`)}_handlePopstate(e){let t=e.state?e.state.navigationId:this.navigation[0].id,r=e.state?.position??0,i=this.navLookup[t];this.eventbus?.broadcast("highlight-navigation",[i.videoUrlIndex]),this.eventbus?.broadcast("request-video-url",[i.videoUrlIndex,r,!0])}detach(e){this.eventhandlers&&this.eventhandlers.forEach(t=>{t()}),this.eventbus=null}_handleBeforeRequestVideoUrl(e,t=0,r=!1){if(r=r!==void 0?r:!1,!r){let i=o=>{this._pushState(o)};this.eventbus?.broadcast("request-current-navigation",[i])}}_getQueryVariable(e){let t=window.location.href,r=t.indexOf("#");if(r>-1){let i=t.substring(r+2);if(i)return i.split("/")[e]}return""}_handlePushHistoryState(e){this._pushState(e)}_pushState(e){if(e&&e.navigationData&&e.navigationData.visible){let t=e.position!==void 0?e.position:-1;if(t<0){let i=o=>{t=o>3?o-3:0};this.eventbus?.broadcast("request-current-video-position",[i])}let r=window.history.state;r&&r.navigationId!==e.navigationData.id?window.history.pushState({navigationId:e.navigationData.id,position:t},e.title,`#/${e.navigationData.id}/${t}`):r&&r.navigationId===e.navigationData.id?window.history.replaceState({navigationId:r.navigationId,position:t},e.title,`#/${r.navigationId}/${t}`):window.history.pushState({navigationId:e.navigationData.id,position:t},e.title,`#/${e.navigationData.id}/${t}`),window.document.title=e.title}}_buildNavigationData(e){let t=[];return e.navigationData.forEach((r,i)=>{this.navLookup[r.id]=r,this.navVidIdLookup[r.videoUrlIndex]=r,r.previous=e.navigationData[i-1]}),e.navigationData.forEach((r,i)=>{r.nextId?(r.next=this.navLookup[r.nextId],delete r.nextId):r.next=e.navigationData[i+1]}),e.roots.forEach(r=>{let i=this.navLookup[r];i.children&&(i.children=i.children.map(o=>this.navLookup[o])),t.push(i)}),t}};var Ue=class{constructor(){this.actionLookup={};this.currentLanguage=null;this.lastFunc=null;this.name="SubtitlesController";this.subtitleDurations=null}attach(e){let t=e.on(l.TIME,this.onTimeHandler.bind(this)),r=e.on(l.SEEKED,this.onSeekedHandler.bind(this)),i=e.on(l.LANGUAGE_CHANGE,this.languageChangeHandler.bind(this));this.internalDetach=this.internalDetach.bind(this,[t,i,r])}detach(e){this.internalDetach()}internalDetach(e){e&&e.forEach(t=>{t()})}languageChangeHandler(e){this.currentLanguage=e,this.lastFunc&&this.lastFunc()}removeTitle(e){e?.empty(),this.lastFunc=null}onTimeHandler(e){let t=this.actionLookup[e];t&&this.lastFunc!==t&&(this.lastFunc=t,t())}onSeekedHandler(e){let t=e[0],r=this.subtitleDurations?.find(o=>o.start<=t||o.end>=t),i=r?this.actionLookup[r.start??-1]:void 0;i&&this.lastFunc!==i?(this.lastFunc=i,i()):i||this.removeTitle()}setTitle(e,t){this.currentLanguage&&e.html(t[this.currentLanguage])}createActionLookup(e,t){let r=e.subtitleData,i=r[0].titles,o={};for(let a=0,s=i.length;a<s;a++){let c={};for(let p=0,u=r.length;p<u;p++){let m=r[p];c[m.languageCode]=m.titles[a].text}o[i[a].duration.start]=this.setTitle.bind(this,t,c),o[i[a].duration.end]=this.removeTitle.bind(this,t)}return o}init(e){let t=e.selectedElement;this.removeTitle=this.removeTitle.bind(this,t),this.currentLanguage=e.language,this.actionLookup=this.createActionLookup(e,t),this.subtitleDurations=e.subtitleData?.[0].titles.map(r=>r.duration)}};var je={};X(je,{addClass:()=>Dn,addControllerToElement:()=>Pn,animate:()=>Rn,animateWithClass:()=>Sn,broadcastEvent:()=>wn,calc:()=>Ln,clearElement:()=>Nn,clearOperationData:()=>kn,createElement:()=>Mn,customFunction:()=>Fn,endAction:()=>Un,endForEach:()=>jn,endWhen:()=>qn,extendController:()=>$n,forEach:()=>Qn,getAttributesFromElement:()=>Kn,getControllerFromElement:()=>Gn,getControllerInstance:()=>Hn,getElementDimensions:()=>Vn,getImport:()=>zn,getQueryParams:()=>Jn,invokeObjectMethod:()=>Wn,loadJSON:()=>Bn,log:()=>Yn,math:()=>Xn,otherwise:()=>Zn,removeClass:()=>er,removeControllerFromElement:()=>tr,removeElement:()=>nr,removePropertiesFromOperationData:()=>rr,reparentElement:()=>ir,requestAction:()=>or,resizeAction:()=>ar,selectElement:()=>sr,setData:()=>lr,setElementAttributes:()=>cr,setElementContent:()=>pr,setGlobalData:()=>ur,setOperationData:()=>mr,setStyle:()=>dr,startAction:()=>fr,toggleClass:()=>hr,toggleElement:()=>gr,wait:()=>vr,when:()=>Ir});function Xi(){return{description:"Add a class to the selected element.",dependentProperties:["selectedElement"],properties:{className:{type:"ParameterType:className",required:!0}}}}var Dn=Xi;function Zi(){return{description:"Adds the current controller to the selected element(s)",dependentProperties:["selectedElement","controllerInstance"]}}var Pn=Zi;function eo(){return{description:"Animates the selected element with the given animation settings.",dependentProperties:["selectedElement"],properties:{animationEasing:"ParameterType:boolean",animationProperties:{type:"ParameterType:object",required:!0},animationDuration:{type:"ParameterType:number",required:!0}}}}var Rn=eo;function to(){return{description:"Animates the selected element by adding the given animation class.",dependentProperties:["selectedElement"],properties:{className:{type:"ParameterType:className",required:!0},removeClass:"ParameterType:boolean"}}}var Sn=to;function no(){return{description:"Broadcasts an eventbus event with the given type, topic and optional arguments",properties:{eventArgs:"ParameterType:array",eventTopic:"ParameterType:eventTopic",eventName:{type:"ParameterType:eventName",required:!0}}}}var wn=no;function ro(){return{description:"Calculates the given left and right hand sides using the specified operator",properties:{left:{type:"ParameterType:number",description:"The left operand",required:!0},right:{type:"ParameterType:number",description:"The right operand",required:!0},operator:[{value:"+",description:"Adds the left and right operands"},{value:"-",description:"Subtracts the left and right operands"},{value:"*",description:"Multiplies the left and right operands"},{value:"/",description:"Divides the left and right operands"},{value:"%",description:"Returns the remainder left over after the left number is divided into a number of integer portions equal to the right number"},{value:"**",description:"Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times."}]},outputProperties:{calculationResult:"ParameterType:number"}}}var Ln=ro;function io(){return{description:"clears the given element",dependentProperties:["selectedElement"]}}var Nn=io;function oo(){return{description:"clears the current operation data",properties:{properties:"ParameterType:array"}}}var kn=oo;function ao(){return{description:"Creates an HTML element with the given name and optionally adds the given attributes",properties:{elementName:{type:"ParameterType:htmlElementName",required:!0},attributes:"ParameterType:object",text:"ParameterType:string"},outputProperties:{template:"ParameterType:object"}}}var Mn=ao;function so(){return{description:"Executes the specified custom function",properties:{systemName:{type:"ParameterType:systemName",required:!0}}}}var Fn=so;function lo(){return{description:"Ends the current action",dependentProperties:["actionInstance"],properties:{actionOperationData:"ParameterType:object"}}}var Un=lo;function co(){return{description:"Ends the current loop"}}var jn=co;function po(){return{description:"Ends the current when block"}}var qn=po;function uo(){return{description:"Extends the current controller",dependentProperties:["controllerInstance"],properties:{controllerExtension:"ParameterType:object"}}}var $n=uo;function mo(){return{description:"Starts a loop over the given collection",properties:{collection:{type:"ParameterType:array",required:!0}}}}var Qn=mo;function fo(){return{description:"Retrieves the values for the specified attribute names from the given selected element.",dependentProperties:["selectedElement"],properties:{attributeNames:{type:"ParameterType:array",itemType:"ParameterType:string",required:!0}},outputProperties:{attributeValues:"ParameterType:object"}}}var Kn=fo;function ho(){return{description:"Retrieves the specified controller from the current element",dependentProperties:["selectedElement"],properties:{controllerName:{type:"ParameterType:controllerName",required:!0}},outputProperties:{controllerInstance:"ParameterType:object"}}}var Gn=ho;function go(){return{description:"Retrieves an instance of the specified controller",properties:{systemName:{type:"ParameterType:controllerName",required:!0}},outputProperties:{controllerInstance:"ParameterType:object"}}}var Hn=go;function vo(){return{description:"Calculates the dimensions for the current element",dependentProperties:["selectedElement"],properties:{modifier:"ParameterType:dimensionsModifier"},outputProperties:{dimensions:"ParameterType:dimensions"}}}var Vn=vo;function Io(){return{description:"Retrieves a javascript import specified by the given system name",properties:{systemName:{type:"ParameterType:systemName",required:!0}},outputProperties:{importedInstance:"ParameterType:object"}}}var zn=Io;function Eo(){return{description:"Retrieves the current query parameters from the browser's address bar",outputProperties:{queryParams:"ParameterType:object"}}}var Jn=Eo;function yo(){return{description:"Invokes the specified method on the given object with the optional specified arguments",properties:{instance:{type:"ParameterType:object",required:!0},methodName:{type:"ParameterType:string",required:!0},methodArguments:"ParameterType:array"},outputProperties:{methodResult:"ParameterType:object"}}}var Wn=yo;function bo(){return{description:"Load JSON from the given url",properties:{url:{type:"ParameterType:url",required:!0},cache:"ParameterType:boolean"},outputProperties:{json:"ParameterType:object"}}}var Bn=bo;function To(){return{description:"Logs the current context and operation data to the console"}}var Yn=To;function Oo(){return{description:"This operation performs the given math function of the specified arguments.",properties:{args:{type:"ParameterType:array",required:!0},functionName:xo(),mathResult:"ParameterType:number"}}}function xo(){return Object.getOwnPropertyNames(Math).filter(n=>$(Math[n])).map(n=>({value:n}))}var Xn=Oo;function Co(){return{description:"Inverts the control flow for `when` logic"}}var Zn=Co;function _o(){return{description:"Removes the specified class from the selected element",dependentProperties:["selectedElement"],properties:{className:{type:"ParameterType:className",required:!0}}}}var er=_o;function Ao(){return{description:"Removes the specified controller from the selected element",dependentProperties:["selectedElement"],properties:{controllerName:{type:"ParameterType:controllerName",required:!0}}}}var tr=Ao;function Do(){return{description:"Removes the selected element from the DOM",dependentProperties:["selectedElement"]}}var nr=Do;function Po(){return{description:"Removes the specified properties from the current operation data",properties:{propertyNames:"ParameterType:array"}}}var rr=Po;function Ro(){return{description:"Moves the selected element to the new location described by the given selector",dependentProperties:["selectedElement"],properties:{newParentSelector:{type:"ParameterType:selector",required:!0}}}}var ir=Ro;function So(){return{description:"Retrieves an instance of the specified action",properties:{systemName:{type:"ParameterType:actionName",required:!0}},outputProperties:{actionInstance:"ParameterType:object"}}}var or=So;function wo(){return{description:"Triggers a resize on the current action",dependentProperties:["actionInstance"],properties:{actionOperationData:"ParameterType:object"}}}var ar=wo;function Lo(){return{description:"Selects an element using the given selector",properties:{selector:{type:"ParameterType:selector",required:!0},useSelectedElementAsRoot:"ParameterType:boolean"},outputProperties:{selectedElement:"ParameterType:jQuery"}}}var sr=Lo;function No(){return{description:"Copies the specified values to the specified targets",properties:{properties:{type:"ParameterType:object",required:!0}}}}var lr=No;function ko(){return{description:"Sets the given attributes on the selected element",dependentProperties:["selectedElement"],properties:{attributes:{type:"ParameterType:object",required:!0}}}}var cr=ko;function Mo(){return{description:"Sets the given HTML content in the selected element",dependentProperties:["selectedElement","template"],properties:{insertionType:[{value:"overwrite",description:"the contents of the selected element are replaced by the given template",default:!0},{value:"append",description:"the new content will be inserted after the current content"},{value:"prepend",description:"the new content will be inserted before the current content"}]}}}var pr=Mo;function Fo(){return{description:"Copies the specified values from the operationData to the global data",properties:{properties:{type:"ParameterType:array",required:!0}}}}var ur=Fo;function Uo(){return{description:"Sets the given properties on the current operation data",properties:{properties:{type:"ParameterType:object",required:!0},override:"ParameterType:boolean"}}}var mr=Uo;function jo(){return{description:"Sets the given style properties on the selected element",properties:{properties:{type:"ParameterType:object",required:!0},selectedElement:"ParameterType:jQuery"}}}var dr=jo;function qo(){return{description:"Starts the selected action",dependentProperties:["actionInstance"],properties:{actionOperationData:"ParameterType:object"}}}var fr=qo;function $o(){return{description:"Toggles the given class on the selected element",dependentProperties:["selectedElement"],properties:{className:{type:"ParameterType:className",required:!0}}}}var hr=$o;function Qo(){return{description:"Toggles the selected element",dependentProperties:["selectedElement"]}}var gr=Qo;function Ko(){return{description:"Waits the given amount of milliseconds before the action continues",properties:{milliseconds:{type:"ParameterType:number",required:!0}}}}var vr=Ko;function Go(){return{description:"Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true",properties:{expression:{type:"ParameterType:expression",required:!0}}}}var Ir=Go;var Er=class{getOperationNames(){return Object.keys(O)}},yr=class{getControllerNames(){return Object.keys(oe)}},br=class{getOperationMetadata(e){let t=je[e];if(!t)throw new Error(`Could not find metadata for operation called ${e}`);return t()}},Tr=class{getEventNames(){return Object.values(l)}};var Or=class{importSubtitles(e){let t=[],r=[];for(let o=0,a=e.length;o<a;o++){let s=this.stripNewlineChars(e[o].toString());this.isValidLine(s)&&r.push(s)}for(r[0]===""&&r.splice(0,1);r[r.length-1]==="";)r.pop();let i=null;return r.forEach(o=>{o.length===0||!i?(i={text:""},o.length&&(i.duration=this.convertDuration(o)),t.push(i)):i.hasOwnProperty("duration")?i.text+=o:i.duration=this.convertDuration(o)}),t}stripNewlineChars(e){let t="";for(let r=0,i=e.length;r<i;r++)e.charCodeAt(r)!==13&&e.charCodeAt(r)!==0&&(t+=e.charAt(r));return t}isValidLine(e){return!e.startsWith("@")&&!e.startsWith("<begin subtitles>")&&!e.startsWith("<end subtitles>")}convertDuration(e){let t=e.split(" ");return{start:this.convertTimeToSeconds(t[0]),end:this.convertTimeToSeconds(t[1])}}convertTimeToSeconds(e){let t=e.split(":");return parseInt(t[0],10)*3600+parseInt(t[1],10)*60+parseInt(t[2],10)}};import{v4 as xr}from"uuid";var Cr=class{constructor(e=[]){this.collection=e}_getLanguage(e){return this.collection.find(t=>t.languageCode===e)}addLanguage(e){if(this._getLanguage(e))throw new Error(`Language ${e} already exists.`);let r=this.collection.length?{...this.collection[0],languageCode:e,titles:this.collection[0].titles.map(i=>({id:xr(),duration:{...i.duration},text:""}))}:{languageCode:e,titles:[]};return this.collection.push(r),this}addSubtitle(e,t){let r=this._getLanguage(e);if(!r)throw new Error(`Language ${e} does not exist.`);return r.titles.push(t),this}addSubtitles(e,t){return Object.entries(t).forEach(([r,i])=>this.addSubtitle(r,{id:xr(),duration:{...e},text:i})),this}setSubtitle(e,t){let r=this._getLanguage(e);if(!r)throw new Error(`Language ${e} does not exist.`);let i=r.titles.findIndex(o=>o.id===t.id);if(i<0)throw new Error(`Subtitle with id '${t.id}' was not found in language with code ${e}.`);return r.titles[i]={...t,duration:{...t.duration}},this}export(){return this.collection}};var tt=ve(Ie());function _r(n,e){let t=n.split(".");return N(t,e)}var ae=class{constructor(e,t){this.importer=e;this.eventbus=t}process(e,t){if(nt(e,e,this.importer),!(0,tt.isDefined)(e.timelineProviderSettings))throw new Error("Configuration incomplete: it needs to have at least one timeline provider setting");let r={id:e.id,engine:{...e.engine},timelineProviderSettings:g(e.timelineProviderSettings),containerSelector:e.containerSelector,language:e.language,layoutTemplate:e.layoutTemplate,availableLanguages:g(e.availableLanguages),actions:Ar(e.actions,this.importer,this.eventbus),initActions:Ar(e.initActions,this.importer,this.eventbus),labels:g(e.labels),timelineFlow:g(e.timelineFlow),timelines:Vo(e.timelines,this.importer,this.eventbus)},i=[];return e.eventActions?.length&&t&&(i=Ho(e.eventActions,t,this.importer,this.eventbus)),[r.actions.concat(i).reduce((a,s)=>({...a,[s.name]:s}),{}),r]}};function Ho(n,e,t,r){return n.map(o=>Pr(o,t)).map((o,a)=>{let{eventName:s,eventTopic:c}=n[a],p=new j(o.name,o.startOperations,r);return e.registerAction(p,s,c),p})}function Vo(n,e,t){let r=zo.bind(null,e,t);return n.map(i=>({...i,timelineActions:i.timelineActions.map(r)}))}function Dr(n,e){return{id:e.id,systemName:e.systemName,operationData:g(e.operationData)??{},instance:n.import(e.systemName)[e.systemName]}}function Pr(n,e){let t=Dr.bind(null,e);return{id:n.id,name:n.name,startOperations:n.startOperations.map(t)}}function Rr(n,e){let t=Dr.bind(null,e);return{...Pr(n,e),endOperations:n.endOperations.map(t)}}function zo(n,e,t){let r=Rr(t,n),i={end:t.duration.end??-1,start:t.duration.start},{id:o,name:a,endOperations:s,startOperations:c}=r,p=new ee(a,c,s,i,e);return p.id=o,p}function Ar(n,e,t){return n.map(i=>Rr(i,e)).map(i=>{let{name:o,endOperations:a,startOperations:s}=i,c=new q(o,s,a,t);return c.id=i.id,c})}function nt(n,e,t){(0,tt.isDefined)(n)&&(Array.isArray(n)?n.forEach(r=>{nt(r,e,t)}):Object.keys(n).forEach(r=>{Jo(r,n,e,t)}))}function Jo(n,e,t,r){let i=e[n];if(S(i)){if(i.startsWith("config:")){let o=i.substring(7,i.length);e[n]=_r(o,t)}else if(i.startsWith("template:")){let o=i.substring(9,i.length),a=r.import(o)[o];e[n]=a}else if(i.startsWith("json:")){let o=i.substring(5,i.length),a=r.import(o)[o];e[n]=a}}else Q(i)&&nt(i,t,r)}import rt from"jquery";var se=class n{constructor(e,t,r,i){this.configuration=e;this.eventbus=t;this.timelineProviders=r;this.languageManager=i;this._timeLineActionsLookup={};this._eventbusRemovers=[];this._currentTimelineUri="";this._activeTimelineProvider=void 0;this._lastPosition=-1}init(){this._createLayoutTemplate(),this._addEventbusListeners();let{timelines:e}=this.configuration;return this._currentTimelineUri=e?.[0].uri??"",this._createTimelineLookup(),this._initializeTimelineProvider()}_createLayoutTemplate(){let{containerSelector:e}=this.configuration,t=rt(e);if(!t||!t.length)throw new Error(`Container selector not found: ${e}`);let{layoutTemplate:r}=this.configuration;r&&r.length?t.html(r):console.warn("layoutTemplate is empty, unable to create layout")}async _initializeTimelineProvider(){if(!this.configuration.timelines?.length)throw new Error("No timelines present");let e=this.configuration.timelines[0],t=this.timelineProviders[e.type];if(!t)throw new Error(`No timeline provider configured for type ${e.type}`);if(this._activeTimelineProvider?.destroy(),this._activeTimelineProvider=t.provider,!this._activeTimelineProvider)throw new Error("NO ACTIVE TIMELINE PROVIDER");return this._activeTimelineProvider.onTime(this._onTimeHandler.bind(this,Math.floor)),this._activeTimelineProvider.onComplete(this._onCompleteCallback.bind(this)),this._activeTimelineProvider.onFirstFrame(this._onFirstFrameCallback.bind(this)),this._activeTimelineProvider.onRestart(this._onRestartCallback.bind(this)),await this._activeTimelineProvider.init(),await this._executeActions(this.configuration.initActions,"start"),this._activeTimelineProvider}_onCompleteCallback(){this.eventbus.broadcast(l.COMPLETE)}_onFirstFrameCallback(){this.eventbus.broadcast(l.FIRST_FRAME),this.eventbus.broadcast(l.DURATION,[this._activeTimelineProvider?.getDuration])}_onRestartCallback(){this.eventbus.broadcast(l.RESTART)}async _cleanUp(){await this._cleanUpTimeline(),await this._executeActions([...this.configuration.initActions].reverse(),"end")}async destroy(){await this._cleanUp(),this.languageManager.destroy(),this._activeTimelineProvider=void 0,this._eventbusRemovers.forEach(r=>r()),this.timelineProviders&&Object.values(this.timelineProviders).forEach(r=>r.provider.destroy());let{containerSelector:e}=this.configuration;rt(e).empty()}_addEventListener(e,t,r){this._eventbusRemovers.push(this.eventbus.on(e,t,r))}_addEventbusListeners(){this._addEventListener(l.REQUEST_ENGINE_ROOT,this._handleRequestEngineRoot.bind(this,this.configuration.containerSelector)),this._addEventListener(l.REQUEST_TIMELINE_URI,this._handleRequestTimelineUri.bind(this)),this._addEventListener(l.REQUEST_CURRENT_TIMELINE_POSITION,this._handleRequestTimelinePosition.bind(this,Math.floor)),this._addEventListener(l.REQUEST_TIMELINE_CLEANUP,this._handleTimelineComplete.bind(this)),this._addEventListener(l.REQUEST_CURRENT_TIMELINE,this._requestCurrentTimeline.bind(this)),this._addEventListener(l.PLAY_TOGGLE_REQUEST,this._toggleplay.bind(this)),this._addEventListener(l.PLAY_REQUEST,this._playRequest.bind(this)),this._addEventListener(l.STOP_REQUEST,this._stopRequest.bind(this)),this._addEventListener(l.PAUSE_REQUEST,this._pauseRequest.bind(this)),this._addEventListener(l.CONTAINER_REQUEST,this.containerRequest.bind(this)),this._addEventListener(l.DURATION_REQUEST,this.durationRequest.bind(this)),this._addEventListener(l.SEEK_REQUEST,this.seekRequest.bind(this))}async seekRequest(e){if(!this._activeTimelineProvider)return;let t=Math.floor(e),r=this._activeTimelineProvider.getDuration(),i=this._activeTimelineProvider.getPosition();t<0||t>r||(this.eventbus.broadcast(l.SEEK,[t,i,r]),await this._activeTimelineProvider.seek(t),await this._executeSeekActions(t),this.eventbus.broadcast(l.SEEKED,[this._activeTimelineProvider.getPosition(),r]),this.eventbus.broadcast(l.TIME,[this._activeTimelineProvider.getPosition()]),this._activeTimelineProvider?.playState==="running"&&this._activeTimelineProvider?.start())}durationRequest(e){e(this._activeTimelineProvider?.getDuration())}containerRequest(e){e(this._activeTimelineProvider?.getContainer())}_pauseRequest(){this._activeTimelineProvider&&(this._activeTimelineProvider.pause(),this.eventbus.broadcast(l.PAUSE))}_stopRequest(){this._activeTimelineProvider&&(this._activeTimelineProvider.stop(),this.eventbus.broadcast(l.STOP))}_playRequest(){this._activeTimelineProvider&&(this._activeTimelineProvider.start(),this.eventbus.broadcast(l.PLAY))}_toggleplay(){this._activeTimelineProvider&&(this._activeTimelineProvider.playState==="running"?this._activeTimelineProvider.pause():this._activeTimelineProvider.start())}_createTimelineLookup(){this.configuration.timelines&&(this.configuration.timelines.forEach(e=>{e.timelineActions.forEach(this._addTimelineActionStart.bind(this,e.uri))}),this.configuration.timelines.forEach(e=>{e.timelineActions.forEach(this._addTimelineActionEnd.bind(this,e.uri))}),n.sortTimelines(Object.values(this._timeLineActionsLookup)))}static sortTimelines(e){e.forEach(t=>{Object.keys(t).forEach(r=>t[r]=n.sortActionsPerPosition(t[r]))})}static sortActionsPerPosition(e){let[t,r]=e.reduce((i,o)=>(o.isStart?i[0].push(o):i[1].push(o),i),[[],[]]);return[...r.sort(Bo),...t]}_addTimelineActionStart(e,t){let r=t.duration.start,i=this._initializeTimelinePosition(this._initializeUriLookup(this._timeLineActionsLookup,e),r),o=t.start.bind(t);t.id?.length&&(o.id=t.id),o.isStart=!0,i.push(o)}_addTimelineActionEnd(e,t){let r=t.duration.end;if(r<0&&(r=t.duration.end=1/0),isFinite(r)){let i=this._initializeTimelinePosition(this._timeLineActionsLookup[e],r),o=t.end.bind(t);t.id?.length&&(o.id=t.id,o.startPosition=t.duration.start),o.isStart=!1,i.push(o)}}_initializeUriLookup(e,t){return e[t]||(e[t]={}),e[t]}_initializeTimelinePosition(e,t){return e[t]||(e[t]=[]),e[t]}async _executeActions(e,t,r=0){return e&&r<e.length?(await e[r][t](),this._executeActions(e,t,++r)):Promise.resolve()}_handleRequestEngineRoot(e,t){t(rt(e))}async _handleRequestTimelineUri(e,t=0){if(!this._activeTimelineProvider)return;this._activeTimelineProvider.stop(),await this._cleanUpTimeline();let r=this.configuration.timelines.find(o=>o.uri===e);if(!r||!this._activeTimelineProvider||this._currentTimelineUri===r.uri)return;this._currentTimelineUri=r.uri,this.eventbus.broadcast(l.CURRENT_TIMELINE_CHANGE,[this._currentTimelineUri]);let i=this.timelineProviders[r.type];this._activeTimelineProvider!==i.provider&&(this._activeTimelineProvider.destroy(),this._activeTimelineProvider=i.provider),this._activeTimelineProvider.loop=r.loop,!this._activeTimelineProvider.loop&&t>0&&this.eventbus.once(l.FIRST_FRAME,async()=>{if(!this._activeTimelineProvider)return;this._activeTimelineProvider.pause(),this.eventbus.broadcast(l.DURATION,[this._activeTimelineProvider.getDuration()]),await this._executeStartActions();let o=await this._activeTimelineProvider.seek(t);this.seekRequest(o)}),this._activeTimelineProvider.playlistItem(e)}_cleanUpTimeline(){return this._executeRelevantActions(this._getActiveActions,"end")}_executeStartActions(){return this._executeRelevantActions(this._getActionsForPosition.bind(this,0),"start")}_getActionsForPosition(e,t){return t.filter(r=>!r.active&&r.duration.start<=e&&r.duration.end>=e)}_getActiveActions(e){return e.filter(r=>r.active).sort(Wo)}_executeRelevantActions(e,t){let r=this._getTimelineActionsForCurrentTimeline(),i=e.apply(this,[r]);return this._executeActions(i,t,0)}_handleRequestTimelinePosition(e,t){t(e(this._activeTimelineProvider?.getPosition()||-1))}_handleTimelineComplete(){this._cleanUpTimeline()}_getTimelineActionsForCurrentTimeline(){return this._getTimelineActionsForUri(this._currentTimelineUri)}_requestCurrentTimeline(e){e(this._currentTimelineUri)}_getTimelineActionsForUri(e){return this.configuration.timelines.find(r=>r.uri===e)?.timelineActions??[]}_onTimeHandler(e,t){if(!isNaN(t)){let r=e(t);this._lastPosition!==r&&(this._executeActionsForPosition(r),this.eventbus.broadcast(l.TIME,[r]))}}_executeActionsForPosition(e){this._lastPosition=e;let t=this._timeLineActionsLookup[this._currentTimelineUri];t&&t[e]?.forEach(i=>i())}async _executeSeekActions(e){let t=this._getTimelineActionsForCurrentTimeline();if(!t)return Promise.resolve();let r=this._getActiveActions(t).filter(a=>!(a.duration.start<=e&&a.duration.end>=e)),i=this._getActionsForPosition(e,t);return await this._executeActions(r,"end",0),this._executeActions(i,"start",0)}},Wo=(n,e)=>e.duration.start<n.duration.start?-1:e.duration.start>n.duration.start?1:0,Bo=(n,e)=>e.startPosition===void 0||n.startPosition===void 0?0:e.startPosition<n.startPosition?-1:e.startPosition>n.startPosition?1:0;var ht=ve(Zr());import xa from"jquery";var ft={};X(ft,{ActionRegistryEventbusListener:()=>W,Eventbus:()=>B,RequestVideoUriInterceptor:()=>Y});var W=class{constructor(){this._actionRegistry=new Map}registerAction(e,t,r){r&&r.length&&(t=`${t}:${r}`),this._actionRegistry.has(t)||this._actionRegistry.set(t,[]),this._actionRegistry.get(t)?.push(e)}handleEvent(e,t,r){t&&(e=`${e}:${t}`);let i=this._actionRegistry.get(e);if(i){let o={eventArgs:r};i.forEach(a=>{a.start(o)})}}};var B=class{constructor(){this.eventHandlers=new Map;this.eventInterceptors=new Map;this.eventListeners=[];this.clear()}clear(){this.eventHandlers=new Map,this.eventListeners=[],this.eventInterceptors=new Map}_getEventInterceptors(e,t){return t&&(e=`${e}:${t}`),this.eventInterceptors.has(e)||this.eventInterceptors.set(e,[]),this.eventInterceptors.get(e)}_getEventHandlers(e,t){return t&&(e=`${e}:${t}`),this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e)}on(e,t,r){return this._getEventHandlers(e,r).push(t),()=>{this.off(e,t,r)}}once(e,t,r){let i=(...o)=>{t(...o),this.off(e,i,r)};return this.on(e,i,r),()=>{this.off(e,i,r)}}off(e,t,r){let i=this._getEventHandlers(e,r);if(i){let o=i.indexOf(t);o>-1&&i.splice(o,1)}}broadcast(e,t){this._callHandlers(e,void 0,t)}broadcastForTopic(e,t,r){this._callHandlers(e,t,r)}registerEventlistener(e){return this.eventListeners.push(e),()=>{let t=this.eventListeners.indexOf(e);t>-1&&this.eventListeners.splice(t,1)}}registerInterceptor(e,t,r){let i=this._getEventInterceptors(e,r);return i.push(t),()=>{let o=i.indexOf(t);o>-1&&i.splice(o,1)}}_callHandlers(e,t,r=[]){let i=this._getEventHandlers(e,t);i&&(this._getEventInterceptors(e,t).forEach(a=>{r=a.intercept(r)}),this.eventListeners.forEach(a=>{a.handleEvent(e,t,r)}),r?.length?i.forEach(a=>a(...r)):i.forEach(a=>a()))}};var Y=class{constructor(e){this.eventbus=e}intercept(e){return this.eventbus.broadcast(l.BEFORE_REQUEST_TIMELINE_URI,e.slice()),e}};import Oa from"jquery";function ei(n,e){let t=k();t[n]=e}var he=class{constructor(e,t,r){this._currentLanguage=e;this._eventbus=r;this._eventbusRemovers=[];if(!e)throw new Error("language ctor arg cannot have zero length");ei("defaultLanguage",e),this._setRootElementLang(e),this._labelLookup=this._createLabelLookup(t),this._addEventbusListeners(r)}destroy(){this._eventbusRemovers.forEach(e=>e())}_addEventbusListeners(e){this._eventbusRemovers.push(e.on(l.REQUEST_LABEL_COLLECTION,this._handleRequestLabelCollection.bind(this))),this._eventbusRemovers.push(e.on(l.REQUEST_LABEL_COLLECTIONS,this._handleRequestLabelCollections.bind(this))),this._eventbusRemovers.push(e.on(l.REQUEST_CURRENT_LANGUAGE,this._handleRequestCurrentLanguage.bind(this))),this._eventbusRemovers.push(e.on(l.LANGUAGE_CHANGE,this._handleLanguageChange.bind(this)))}_handleRequestCurrentLanguage(e){e(this._currentLanguage)}_handleRequestLabelCollection(e,t){t(this._labelLookup[e])}_handleRequestLabelCollections(e,t){let r=e.map(i=>this._labelLookup[i]);t(r)}_handleLanguageChange(e){e&&e.length?(this._currentLanguage=e,this._setRootElementLang(this._currentLanguage)):console.error("Language cannot be changed to null or empty string")}_setRootElementLang(e){let t=r=>{let i=this._extractLanguageFromCulture(e);Oa(r).attr("lang",i)};this._eventbus.broadcast(l.REQUEST_ENGINE_ROOT,[t])}_extractLanguageFromCulture(e){return e.indexOf("-")>-1?e.split("-").shift():e}_createLabelLookup(e){return e.reduce((t,r)=>(t[r.id]=r.labels,t),{})}};var gt=class{constructor(e,t,r){this._actionsLookup={};this._eventRemovers=[];this._resizeTimeout=-1;this._importer=e,this._eventbus=r?.eventbus??new B,h.active=r?.devtools??!1,h.active&&this._initializeDevtools(this._eventbus),this._eventRemovers.push(this._eventbus.on(l.REQUEST_INSTANCE,this._requestInstanceHandler.bind(this))),this._eventRemovers.push(this._eventbus.on(l.REQUEST_ACTION,this._requestActionHandler.bind(this))),this._eventRemovers.push(this._eventbus.on(l.REQUEST_FUNCTION,this._requestFunctionHandler.bind(this)));let i=this._handleSpacePress.bind(this);(0,ht.default)("space",i),this._eventRemovers.push(()=>ht.default.unbind("space",i));let o=this._resizeHandler.bind(this),a=xa(t);a.on("resize",o),this._eventRemovers.push(()=>a.off("resize",o))}_handleSpacePress(e,t){return e.preventDefault(),this._eventbus.broadcast(l.PLAY_TOGGLE_REQUEST),!1}_initializeDevtools(e){let t=window[He];if(t){let{agent:r}=t;this._eventRemovers.push(e.registerEventlistener(new Z(r))),this._eventRemovers.push(r.subscribe(i=>{if(i.type==="playcontrol")switch(i.data.kind){case"play":this._eventbus.broadcast(l.PLAY_REQUEST);break;case"stop":this._eventbus.broadcast(l.STOP_REQUEST);break;case"pause":this._eventbus.broadcast(l.PAUSE_REQUEST);break;case"seek":this._eventbus.broadcast(l.SEEK_REQUEST,[i.data.args]);break}})),h.send=(i,o)=>{let a=K(o);try{r.postMessage(i,a)}catch(s){console.error("postmessage failed"),console.error(s),console.log("message",a)}},h.send("eligius-diagnostics-factory","Diagnostics initialized")}else console.warn(`${He} property not found on window, please install the Eligius Devtools extension.`)}destroy(){this._eventRemovers.forEach(e=>e())}_resizeHandler(){this._resizeTimeout&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=-1),this._resizeTimeout=setTimeout(()=>{this._eventbus.broadcast(l.RESIZE)},200)}_importSystemEntryWithEventbusDependency(e){let t=this._importSystemEntry(e);return new t(this._eventbus)}_importSystemEntry(e){return this._importer.import(e)[e]}_requestInstanceHandler(e,t){t(this._importSystemEntryWithEventbusDependency(e))}_requestFunctionHandler(e,t){t(this._importSystemEntry(e))}_requestActionHandler(e,t){let r=this._actionsLookup[e];r?t(r):(console.error(`Unknown action: ${e}`),t(null))}createEngine(e,t){let{systemName:r}=e.engine,i=this._importSystemEntry(r),o;e.eventActions?.length&&(o=new W,this._eventRemovers.push(this._eventbus.registerEventlistener(o))),this._eventRemovers.push(this._eventbus.registerInterceptor(l.REQUEST_TIMELINE_URI,new Y(this._eventbus))),t=t||new ae(this._importer,this._eventbus);let[a,s]=t.process(e,o);this._actionsLookup=a;let c=this._createTimelineProviders(s),{language:p,labels:u}=e,m=new he(p,u,this._eventbus);return new i(s,this._eventbus,c,m)}_createTimelineProviders(e){let{timelineProviderSettings:t}=e;return Object.entries(t).reduce((i,[o,a])=>{if(!a)return i;let s=this._importSystemEntry(a.systemName);return i[o]={id:a.id,vendor:a.vendor,provider:new s(e)},i},{})}};var ti=O,ni=oe,ri=ie,Ca=ft,Ke=class{constructor(){this.engines=new Map;this.engines.set("EligiusEngine",se)}getOperationNames(){return Object.keys(ti)}getControllerNames(){return Object.keys(ni)}getProviderNames(){return Object.keys(ri)}import(e){let t=ti[e]??ni[e]??ri[e]??Ca[e]??this.engines.get(e);return{[e]:t}}};export{j as Action,xe as ActionCreator,Oe as ActionCreatorFactory,re as ActionEditor,W as ActionRegistryEventbusListener,An as ConfigurationFactory,ae as ConfigurationResolver,yr as ControllerNamesProvider,He as DEV_TOOLS_KEY,Z as DevToolEventListener,h as Diagnostics,se as EligiusEngine,Ke as EligiusResourceImporter,q as EndableAction,te as EndableActionCreator,H as EndableActionEditor,gt as EngineFactory,we as EventListenerController,B as Eventbus,Le as LabelController,he as LanguageManager,Ne as LottieController,ke as NavigationController,V as OperationEditor,br as OperationMetadataProvider,Er as OperationNamesProvider,Me as ProgressbarController,Ae as RequestAnimationFrameTimelineProvider,Y as RequestVideoUriInterceptor,Fe as RoutingController,Cr as SubtitleEditor,Or as SubtitleImporter,Ue as SubtitlesController,Tr as TimeLineEventNamesProvider,ee as TimelineAction,et as TimelineActionCreator,Ce as TimelineActionEditor,l as TimelineEventNames,Re as TimelineProviderSettingsEditor,Pe as TimelineProvidersSettingsEditor,De as VideoJsTimelineProvider,Ct as addClass,At as addControllerToElement,Dt as animate,Pt as animateWithClass,wt as broadcastEvent,Lt as calc,Nt as clearElement,kt as clearOperationData,Ft as createElement,Ut as customFunction,jt as endAction,qt as endForEach,$t as endWhen,Qt as extendController,vt as forEach,_i as generateImporterSourceCode,Kt as getAttributesFromElement,Gt as getControllerFromElement,Ht as getControllerInstance,zt as getElementDimensions,Jt as getImport,Wt as getQueryParams,Bt as invokeObjectMethod,Yt as loadJSON,Xt as log,Zt as math,je as metadata,en as otherwise,tn as removeClass,nn as removeControllerFromElement,rn as removeElement,on as removePropertiesFromOperationData,an as reparentElement,sn as requestAction,ln as resizeAction,pn as selectElement,un as setData,dn as setElementAttributes,fn as setElementContent,hn as setGlobalData,gn as setOperationData,vn as setStyle,In as startAction,En as toggleClass,yn as toggleElement,bn as wait,yt as when};
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
hotkeys-js/dist/hotkeys.common.min.js:
|
|
6
|
+
(*! hotkeys-js v3.12.0 | MIT © 2023 kenny wong <wowohoo@qq.com> https://jaywcjlove.github.io/hotkeys-js *)
|
|
7
|
+
*/
|
|
8
|
+
//# sourceMappingURL=index.esm.js.map
|