insync-stage-handler 3.1.3 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,9 +1,10 @@
1
- import { flip, prop, path, curry, map as map$1, compose, indexBy, pipe, converge, pathOr, defaultTo, of, prepend, append, flatten, join, applyTo, assoc, dissocPath, filter, propSatisfies, startsWith, pair, replace, reduce, assocPath, addIndex, lensPath, values, mergeLeft, when, test, head, either, ifElse, isNil, always, nth, unless, over, union, pluck, merge, without, propEq, apply, tap, propOr, complement, lensProp, pick, omit, mergeDeepRight, keys, has, hasPath, dissoc, isEmpty, mapObjIndexed, last, gte, is, both, anyPass, nAry } from 'ramda';
1
+ import * as R from 'ramda';
2
+ import { flip, prop, path, curry, map as map$1, compose, indexBy, pipe, converge, pathOr, defaultTo, of, prepend, append, flatten, join, applyTo, assoc, dissocPath, filter, propSatisfies, startsWith, pair, replace, reduce, assocPath, tap, propOr, always, last, gte, nth, apply, nAry, unless } from 'ramda';
2
3
  import Ajv from 'ajv';
3
4
  import { formatWithOptions, parseISO } from 'date-fns/fp';
4
5
 
5
6
  const lookup = flip(prop);
6
- const lookupPath = flip(path);
7
+ flip(path);
7
8
  const lookupAll = curry((from, ids) => map$1(lookup(from), ids));
8
9
  const lookupPathAll = curry((from, p, ids) => map$1(compose(path(p), lookup(from)), ids));
9
10
  const indexById = indexBy(prop("id"));
@@ -13,16 +14,13 @@ const listEntities = curry((entitiesContainerPath, from) => pipe(converge(lookup
13
14
  * Return the version of a stage object.
14
15
  * @param {Object} stage The stage for which to return the version.
15
16
  */
16
-
17
17
  var detectVersion = pipe(prop("version"), defaultTo(1));
18
18
 
19
19
  class ValidationError extends Error {
20
20
  setErrors(errors) {
21
21
  this.errors = errors;
22
22
  }
23
-
24
23
  }
25
-
26
24
  const formatErrorMessage = errors => {
27
25
  const header = "Validation errors occurred: \n";
28
26
  return pipe(map$1(({
@@ -30,26 +28,22 @@ const formatErrorMessage = errors => {
30
28
  message
31
29
  }) => `path: "${dataPath}", message: ${message}`), map$1(of), map$1(pipe(prepend(" - "), append("\n"))), flatten, prepend(header), join(""))(errors);
32
30
  };
33
-
34
- var createValidationError = (errors => {
31
+ var createValidationError = errors => {
35
32
  const err = new ValidationError(formatErrorMessage(errors));
36
33
  err.setErrors(errors);
37
34
  return err;
38
- });
35
+ };
39
36
 
40
37
  const ajv = new Ajv({
41
38
  $data: true,
42
39
  allErrors: true,
43
40
  logger: false
44
41
  });
45
-
46
42
  require("ajv-keywords")(ajv, "formatMinimum");
47
43
  /**
48
44
  * Creates a JSON schema validator.
49
45
  * @param {Object} obj Object containing json schema rules.
50
46
  */
51
-
52
-
53
47
  const createAJVValidator = schema => {
54
48
  const validator = ajv.compile(schema);
55
49
  return stage => {
@@ -65,11 +59,11 @@ const createAJVValidator = schema => {
65
59
  };
66
60
  };
67
61
 
68
- var $schema = "http://json-schema.org/draft-07/schema#";
69
- var id = "stage.1.schema.json";
70
- var description = "Version 1 of stage file";
71
- var type = "object";
72
- var definitions = {
62
+ var $schema$3 = "http://json-schema.org/draft-07/schema#";
63
+ var id$3 = "stage.1.schema.json";
64
+ var description$4 = "Version 1 of stage file";
65
+ var type$3 = "object";
66
+ var definitions$3 = {
73
67
  entitiesContainer: {
74
68
  type: "object",
75
69
  properties: {
@@ -617,7 +611,7 @@ var definitions = {
617
611
  ]
618
612
  }
619
613
  };
620
- var properties = {
614
+ var properties$3 = {
621
615
  menu: {
622
616
  type: "object",
623
617
  properties: {
@@ -759,25 +753,25 @@ var properties = {
759
753
  }
760
754
  }
761
755
  };
762
- var schema = {
763
- $schema: $schema,
764
- id: id,
765
- description: description,
766
- type: type,
767
- definitions: definitions,
768
- properties: properties
756
+ var schema$3 = {
757
+ $schema: $schema$3,
758
+ id: id$3,
759
+ description: description$4,
760
+ type: type$3,
761
+ definitions: definitions$3,
762
+ properties: properties$3
769
763
  };
770
764
 
771
- const jsonSchemaValidator = createAJVValidator(schema);
772
- var v1 = (stage => {
773
- return jsonSchemaValidator(stage);
774
- });
765
+ const jsonSchemaValidator$3 = createAJVValidator(schema$3);
766
+ var v1 = stage => {
767
+ return jsonSchemaValidator$3(stage);
768
+ };
775
769
 
776
- var $schema$1 = "http://json-schema.org/draft-07/schema#";
777
- var id$1 = "stage.2.schema.json";
778
- var description$1 = "Version 2 of stage file";
779
- var type$1 = "object";
780
- var definitions$1 = {
770
+ var $schema$2 = "http://json-schema.org/draft-07/schema#";
771
+ var id$2 = "stage.2.schema.json";
772
+ var description$3 = "Version 2 of stage file";
773
+ var type$2 = "object";
774
+ var definitions$2 = {
781
775
  entitiesContainer: {
782
776
  type: "object",
783
777
  properties: {
@@ -1338,7 +1332,7 @@ var definitions$1 = {
1338
1332
  ]
1339
1333
  }
1340
1334
  };
1341
- var properties$1 = {
1335
+ var properties$2 = {
1342
1336
  menu: {
1343
1337
  type: "object",
1344
1338
  properties: {
@@ -1480,25 +1474,25 @@ var properties$1 = {
1480
1474
  }
1481
1475
  }
1482
1476
  };
1483
- var schema$1 = {
1484
- $schema: $schema$1,
1485
- id: id$1,
1486
- description: description$1,
1487
- type: type$1,
1488
- definitions: definitions$1,
1489
- properties: properties$1
1477
+ var schema$2 = {
1478
+ $schema: $schema$2,
1479
+ id: id$2,
1480
+ description: description$3,
1481
+ type: type$2,
1482
+ definitions: definitions$2,
1483
+ properties: properties$2
1490
1484
  };
1491
1485
 
1492
- const jsonSchemaValidator$1 = createAJVValidator(schema$1);
1493
- var v2 = (stage => {
1494
- return jsonSchemaValidator$1(stage);
1495
- });
1486
+ const jsonSchemaValidator$2 = createAJVValidator(schema$2);
1487
+ var v2 = stage => {
1488
+ return jsonSchemaValidator$2(stage);
1489
+ };
1496
1490
 
1497
- var $schema$2 = "http://json-schema.org/draft-07/schema#";
1498
- var id$2 = "stage.3.schema.json";
1491
+ var $schema$1 = "http://json-schema.org/draft-07/schema#";
1492
+ var id$1 = "stage.3.schema.json";
1499
1493
  var description$2 = "Version 3 of stage file";
1500
- var type$2 = "object";
1501
- var definitions$2 = {
1494
+ var type$1 = "object";
1495
+ var definitions$1 = {
1502
1496
  entitiesContainer: {
1503
1497
  type: "object",
1504
1498
  properties: {
@@ -2055,7 +2049,7 @@ var definitions$2 = {
2055
2049
  ]
2056
2050
  }
2057
2051
  };
2058
- var properties$2 = {
2052
+ var properties$1 = {
2059
2053
  menu: {
2060
2054
  type: "object",
2061
2055
  properties: {
@@ -2194,25 +2188,25 @@ var properties$2 = {
2194
2188
  }
2195
2189
  }
2196
2190
  };
2197
- var schema$2 = {
2198
- $schema: $schema$2,
2199
- id: id$2,
2191
+ var schema$1 = {
2192
+ $schema: $schema$1,
2193
+ id: id$1,
2200
2194
  description: description$2,
2201
- type: type$2,
2202
- definitions: definitions$2,
2203
- properties: properties$2
2195
+ type: type$1,
2196
+ definitions: definitions$1,
2197
+ properties: properties$1
2204
2198
  };
2205
2199
 
2206
- const jsonSchemaValidator$2 = createAJVValidator(schema$2);
2207
- var v3 = (stage => {
2208
- return jsonSchemaValidator$2(stage);
2209
- });
2200
+ const jsonSchemaValidator$1 = createAJVValidator(schema$1);
2201
+ var v3$1 = stage => {
2202
+ return jsonSchemaValidator$1(stage);
2203
+ };
2210
2204
 
2211
- var $schema$3 = "http://json-schema.org/draft-07/schema#";
2212
- var id$3 = "stage.live.schema.json";
2213
- var description$3 = "Version live of stage file";
2214
- var type$3 = "object";
2215
- var definitions$3 = {
2205
+ var $schema = "http://json-schema.org/draft-07/schema#";
2206
+ var id = "stage.4.schema.json";
2207
+ var description$1 = "Version 4 of stage file - DockView layout format";
2208
+ var type = "object";
2209
+ var definitions = {
2216
2210
  entitiesContainer: {
2217
2211
  type: "object",
2218
2212
  properties: {
@@ -2241,6 +2235,17 @@ var definitions$3 = {
2241
2235
  "id"
2242
2236
  ]
2243
2237
  },
2238
+ ref: {
2239
+ type: "object",
2240
+ properties: {
2241
+ type: {
2242
+ type: "string"
2243
+ },
2244
+ id: {
2245
+ type: "string"
2246
+ }
2247
+ }
2248
+ },
2244
2249
  asset: {
2245
2250
  allOf: [
2246
2251
  {
@@ -2259,7 +2264,7 @@ var definitions$3 = {
2259
2264
  }
2260
2265
  ]
2261
2266
  },
2262
- file: {
2267
+ timing: {
2263
2268
  allOf: [
2264
2269
  {
2265
2270
  $ref: "#/definitions/entity"
@@ -2267,12 +2272,6 @@ var definitions$3 = {
2267
2272
  {
2268
2273
  type: "object",
2269
2274
  properties: {
2270
- type: {
2271
- type: "string"
2272
- },
2273
- path: {
2274
- type: "string"
2275
- },
2276
2275
  start: {
2277
2276
  format: "date-time",
2278
2277
  message: "Is not a valid date time"
@@ -2283,6 +2282,38 @@ var definitions$3 = {
2283
2282
  formatMinimum: {
2284
2283
  $data: "1/start"
2285
2284
  }
2285
+ },
2286
+ ref: {
2287
+ $ref: "#definitions/ref"
2288
+ }
2289
+ },
2290
+ required: [
2291
+ "start",
2292
+ "end",
2293
+ "ref"
2294
+ ]
2295
+ }
2296
+ ]
2297
+ },
2298
+ file: {
2299
+ allOf: [
2300
+ {
2301
+ $ref: "#/definitions/entity"
2302
+ },
2303
+ {
2304
+ type: "object",
2305
+ properties: {
2306
+ type: {
2307
+ type: "string"
2308
+ },
2309
+ path: {
2310
+ type: "string"
2311
+ },
2312
+ fps: {
2313
+ type: "number"
2314
+ },
2315
+ originalFps: {
2316
+ type: "number"
2286
2317
  }
2287
2318
  },
2288
2319
  required: [
@@ -2342,17 +2373,26 @@ var definitions$3 = {
2342
2373
  configAvailable: {
2343
2374
  type: "boolean"
2344
2375
  },
2345
- outletId: {
2346
- type: "string"
2376
+ measurements: {
2377
+ type: "array",
2378
+ items: {
2379
+ time: "string"
2380
+ }
2347
2381
  },
2348
- registered: {
2349
- type: "boolean"
2382
+ zoomSteps: {
2383
+ type: "array",
2384
+ items: {
2385
+ type: "number"
2386
+ }
2387
+ },
2388
+ activeZoomStep: {
2389
+ type: "number"
2350
2390
  }
2351
2391
  }
2352
2392
  }
2353
2393
  ]
2354
2394
  },
2355
- dataStream: {
2395
+ measurement: {
2356
2396
  allOf: [
2357
2397
  {
2358
2398
  $ref: "#/definitions/entity"
@@ -2370,33 +2410,6 @@ var definitions$3 = {
2370
2410
  }
2371
2411
  ]
2372
2412
  },
2373
- outlet: {
2374
- allOf: [
2375
- {
2376
- $ref: "#/definitions/entity"
2377
- },
2378
- {
2379
- type: "object",
2380
- properties: {
2381
- streams: {
2382
- type: "array",
2383
- items: {
2384
- type: "string"
2385
- }
2386
- },
2387
- loading: {
2388
- type: "boolean"
2389
- },
2390
- resolution: {
2391
- type: "number"
2392
- },
2393
- visible: {
2394
- type: "number"
2395
- }
2396
- }
2397
- }
2398
- ]
2399
- },
2400
2413
  annotation: {
2401
2414
  allOf: [
2402
2415
  {
@@ -2466,10 +2479,7 @@ var definitions$3 = {
2466
2479
  }
2467
2480
  }
2468
2481
  },
2469
- stream: {
2470
- type: "string"
2471
- },
2472
- outletId: {
2482
+ measurement: {
2473
2483
  type: "string"
2474
2484
  }
2475
2485
  }
@@ -2506,49 +2516,136 @@ var definitions$3 = {
2506
2516
  }
2507
2517
  ]
2508
2518
  },
2509
- layoutSection: {
2510
- allOf: [
2511
- {
2512
- $ref: "#/definitions/entity"
2519
+ dockviewLeafData: {
2520
+ type: "object",
2521
+ properties: {
2522
+ id: {
2523
+ type: "string"
2524
+ },
2525
+ views: {
2526
+ type: "array",
2527
+ items: {
2528
+ type: "string"
2529
+ }
2513
2530
  },
2531
+ activeView: {
2532
+ type: "string"
2533
+ }
2534
+ },
2535
+ required: [
2536
+ "id",
2537
+ "views"
2538
+ ]
2539
+ },
2540
+ dockviewNode: {
2541
+ oneOf: [
2514
2542
  {
2515
2543
  type: "object",
2516
2544
  properties: {
2517
2545
  type: {
2518
- type: "string"
2546
+ "const": "leaf"
2519
2547
  },
2520
- title: {
2521
- type: "string"
2548
+ size: {
2549
+ type: "number"
2522
2550
  },
2523
- isClosable: {
2524
- type: "boolean"
2551
+ data: {
2552
+ $ref: "#/definitions/dockviewLeafData"
2553
+ }
2554
+ },
2555
+ required: [
2556
+ "type",
2557
+ "data"
2558
+ ]
2559
+ },
2560
+ {
2561
+ type: "object",
2562
+ properties: {
2563
+ type: {
2564
+ "const": "branch"
2525
2565
  },
2526
- reorderEnabled: {
2527
- type: "boolean"
2566
+ size: {
2567
+ type: "number"
2528
2568
  },
2529
- content: {
2569
+ data: {
2530
2570
  type: "array",
2531
2571
  items: {
2532
- type: "string"
2572
+ $ref: "#/definitions/dockviewNode"
2533
2573
  }
2534
- },
2535
- props: {
2536
- type: "object"
2537
- },
2538
- component: {
2539
- type: "string"
2540
- },
2541
- componentState: {
2542
- type: "object"
2543
- },
2544
- width: {
2545
- type: "number"
2546
- },
2547
- height: {
2548
- type: "number"
2549
2574
  }
2550
- }
2551
- }
2575
+ },
2576
+ required: [
2577
+ "type",
2578
+ "data"
2579
+ ]
2580
+ }
2581
+ ]
2582
+ },
2583
+ dockviewPanel: {
2584
+ type: "object",
2585
+ properties: {
2586
+ id: {
2587
+ type: "string"
2588
+ },
2589
+ contentComponent: {
2590
+ type: "string"
2591
+ },
2592
+ title: {
2593
+ type: "string"
2594
+ },
2595
+ params: {
2596
+ type: "object"
2597
+ }
2598
+ },
2599
+ required: [
2600
+ "id",
2601
+ "contentComponent",
2602
+ "title",
2603
+ "params"
2604
+ ]
2605
+ },
2606
+ dockviewLayout: {
2607
+ type: "object",
2608
+ properties: {
2609
+ grid: {
2610
+ type: "object",
2611
+ properties: {
2612
+ root: {
2613
+ $ref: "#/definitions/dockviewNode"
2614
+ },
2615
+ orientation: {
2616
+ type: "string",
2617
+ "enum": [
2618
+ "HORIZONTAL",
2619
+ "VERTICAL"
2620
+ ]
2621
+ },
2622
+ width: {
2623
+ type: "number"
2624
+ },
2625
+ height: {
2626
+ type: "number"
2627
+ }
2628
+ },
2629
+ required: [
2630
+ "root",
2631
+ "orientation",
2632
+ "width",
2633
+ "height"
2634
+ ]
2635
+ },
2636
+ panels: {
2637
+ type: "object",
2638
+ additionalProperties: {
2639
+ $ref: "#/definitions/dockviewPanel"
2640
+ }
2641
+ },
2642
+ activeGroup: {
2643
+ type: "string"
2644
+ }
2645
+ },
2646
+ required: [
2647
+ "grid",
2648
+ "panels"
2552
2649
  ]
2553
2650
  },
2554
2651
  axis: {
@@ -2662,25 +2759,7 @@ var definitions$3 = {
2662
2759
  }
2663
2760
  ]
2664
2761
  },
2665
- dataStreamsContainer: {
2666
- allOf: [
2667
- {
2668
- $ref: "#/definitions/entitiesContainer"
2669
- },
2670
- {
2671
- type: "object",
2672
- properties: {
2673
- byId: {
2674
- type: "object",
2675
- additionalProperties: {
2676
- $ref: "#/definitions/dataStream"
2677
- }
2678
- }
2679
- }
2680
- }
2681
- ]
2682
- },
2683
- outletsContainer: {
2762
+ measurementsContainer: {
2684
2763
  allOf: [
2685
2764
  {
2686
2765
  $ref: "#/definitions/entitiesContainer"
@@ -2691,7 +2770,7 @@ var definitions$3 = {
2691
2770
  byId: {
2692
2771
  type: "object",
2693
2772
  additionalProperties: {
2694
- $ref: "#/definitions/outlet"
2773
+ $ref: "#/definitions/measurement"
2695
2774
  }
2696
2775
  }
2697
2776
  }
@@ -2734,24 +2813,6 @@ var definitions$3 = {
2734
2813
  }
2735
2814
  ]
2736
2815
  },
2737
- layoutSectionsContainer: {
2738
- allOf: [
2739
- {
2740
- $ref: "#/definitions/entitiesContainer"
2741
- },
2742
- {
2743
- type: "object",
2744
- properties: {
2745
- byId: {
2746
- type: "object",
2747
- additionalProperties: {
2748
- $ref: "#/definitions/layoutSection"
2749
- }
2750
- }
2751
- }
2752
- }
2753
- ]
2754
- },
2755
2816
  axesContainer: {
2756
2817
  allOf: [
2757
2818
  {
@@ -2771,7 +2832,11 @@ var definitions$3 = {
2771
2832
  ]
2772
2833
  }
2773
2834
  };
2774
- var properties$3 = {
2835
+ var properties = {
2836
+ version: {
2837
+ type: "number",
2838
+ "const": 4
2839
+ },
2775
2840
  menu: {
2776
2841
  type: "object",
2777
2842
  properties: {
@@ -2819,6 +2884,30 @@ var properties$3 = {
2819
2884
  }
2820
2885
  }
2821
2886
  },
2887
+ layout: {
2888
+ type: "object",
2889
+ properties: {
2890
+ dockviewLayout: {
2891
+ oneOf: [
2892
+ {
2893
+ $ref: "#/definitions/dockviewLayout"
2894
+ },
2895
+ {
2896
+ type: "null"
2897
+ }
2898
+ ]
2899
+ },
2900
+ focus: {
2901
+ type: "string"
2902
+ },
2903
+ dragging: {
2904
+ type: "boolean"
2905
+ },
2906
+ resizingPanels: {
2907
+ type: "boolean"
2908
+ }
2909
+ }
2910
+ },
2822
2911
  data: {
2823
2912
  type: "object",
2824
2913
  properties: {
@@ -2831,11 +2920,8 @@ var properties$3 = {
2831
2920
  dataViewers: {
2832
2921
  $ref: "#/definitions/dataViewersContainer"
2833
2922
  },
2834
- dataStreams: {
2835
- $ref: "#/definitions/dataStreamsContainer"
2836
- },
2837
- outlets: {
2838
- $ref: "#/definitions/outletsContainer"
2923
+ measurements: {
2924
+ $ref: "#/definitions/measurementsContainer"
2839
2925
  }
2840
2926
  }
2841
2927
  }
@@ -2913,78 +2999,82 @@ var properties$3 = {
2913
2999
  }
2914
3000
  }
2915
3001
  };
2916
- var schema$3 = {
2917
- $schema: $schema$3,
2918
- id: id$3,
2919
- description: description$3,
2920
- type: type$3,
2921
- definitions: definitions$3,
2922
- properties: properties$3
3002
+ var schema = {
3003
+ $schema: $schema,
3004
+ id: id,
3005
+ description: description$1,
3006
+ type: type,
3007
+ definitions: definitions,
3008
+ properties: properties
2923
3009
  };
2924
3010
 
2925
- const jsonSchemaValidator$3 = createAJVValidator(schema$3);
2926
- var live = (stage => {
2927
- return jsonSchemaValidator$3(stage);
2928
- });
3011
+ const jsonSchemaValidator = createAJVValidator(schema);
3012
+ var v4 = stage => {
3013
+ return jsonSchemaValidator(stage);
3014
+ };
2929
3015
 
2930
3016
  const map = Object.freeze({
2931
- "1": v1,
2932
- "2": v2,
2933
- "3": v3,
2934
- live
3017
+ 1: v1,
3018
+ 2: v2,
3019
+ 3: v3$1,
3020
+ 4: v4
2935
3021
  });
2936
3022
 
2937
3023
  /**
2938
3024
  * Parses validation specific options from global options.
2939
3025
  * @param {obj} options
2940
3026
  */
2941
-
2942
- const optionsParser = ({
3027
+ const optionsParser$1 = ({
2943
3028
  validationVersion = undefined
2944
3029
  }) => ({
2945
3030
  version: validationVersion
2946
3031
  });
3032
+
2947
3033
  /**
2948
3034
  * Validates a stage
2949
3035
  * @param {Object} stage
2950
3036
  * @param {number} version
2951
3037
  */
2952
3038
 
2953
- var validate = ((stage, options = {}) => {
3039
+ var validate = (stage, options = {}) => {
2954
3040
  const {
2955
3041
  version = undefined
2956
3042
  } = options;
2957
3043
  return pipe(defaultTo(detectVersion(stage)), lookup(map), applyTo(stage))(version);
2958
- });
3044
+ };
2959
3045
 
2960
- var versions = Object.freeze([1, 2, 3, "live"]);
3046
+ var versions = Object.freeze([1, 2, 3, 4]);
2961
3047
 
2962
3048
  /**
2963
3049
  * v1-to-v2.js
2964
3050
  * Upgrader for version 1 stage files to version 2.
2965
3051
  * Removes timelines axes with resources. And adds the zoomSteps for the dataviewer.
2966
3052
  */
2967
- const outletsView = listEntities(["data", "entities", "outlets"]); // This adds the zoomsteps on dataviwer based on "visible" prop on the associated outlet.
3053
+ const outletsView = listEntities(["data", "entities", "outlets"]);
2968
3054
 
2969
- const addDataViewerZoomSteps = stage => pipe(outletsView, // The association to a dataviewer is defined in the outlet id (dataviewer/<DATAVIEWER ID>),
3055
+ // This adds the zoomsteps on dataviwer based on "visible" prop on the associated outlet.
3056
+ const addDataViewerZoomSteps = stage => pipe(outletsView,
3057
+ // The association to a dataviewer is defined in the outlet id (dataviewer/<DATAVIEWER ID>),
2970
3058
  // This only takes outlets associated with a dataviewer.
2971
- filter(propSatisfies(startsWith("dataviewer/"), "id")), map$1( // This pairs the path to the associated dataviewer to its required zoomSteps.
2972
- converge(pair, [pipe(prop("id"), replace("dataviewer/", ""), id => ["data", "entities", "dataViewers", "byId", id, "zoomSteps"]), pipe(prop("visible"), visible => [visible])])), // Set the "zoomSteps" prop of the dataviewer to the visibility of the outlet.
3059
+ filter(propSatisfies(startsWith("dataviewer/"), "id")), map$1(
3060
+ // This pairs the path to the associated dataviewer to its required zoomSteps.
3061
+ converge(pair, [pipe(prop("id"), replace("dataviewer/", ""), id => ["data", "entities", "dataViewers", "byId", id, "zoomSteps"]), pipe(prop("visible"), visible => [visible])])),
3062
+ // Set the "zoomSteps" prop of the dataviewer to the visibility of the outlet.
2973
3063
  reduce((acc, [path, zoomSteps]) => assocPath(path, zoomSteps, acc), stage))(stage);
2974
-
2975
- var v1ToV2 = pipe( // Sets the version prop to "2"
2976
- assoc("version", 2), // Remove the association to resources from the timline axes.
3064
+ var v1ToV2 = pipe(
3065
+ // Sets the version prop to "2"
3066
+ assoc("version", 2),
3067
+ // Remove the association to resources from the timline axes.
2977
3068
  // In version 2 the tracks for files on the timeline are handled by the v2 consolidation strategy.
2978
- dissocPath(["timeline", "entities", "axes", "byId", "video", "resources"]), dissocPath(["timeline", "entities", "axes", "byId", "high-speed", "resources"]), // Adds the zoomsteps to the dataviewers.
3069
+ dissocPath(["timeline", "entities", "axes", "byId", "video", "resources"]), dissocPath(["timeline", "entities", "axes", "byId", "high-speed", "resources"]),
3070
+ // Adds the zoomsteps to the dataviewers.
2979
3071
  addDataViewerZoomSteps);
2980
3072
 
2981
- const NEW_TEST_REGEX = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
2982
-
2983
- const fsPath = require("path");
2984
-
2985
- const match = curry((regex, st) => st.match(regex));
2986
- const mapWithIndex = addIndex(map$1);
2987
- const axesSettings = [{
3073
+ const NEW_TEST_REGEX$1 = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
3074
+ const fsPath$1 = require("path");
3075
+ const match$1 = R.curry((regex, st) => st.match(regex));
3076
+ const mapWithIndex$1 = R.addIndex(R.map);
3077
+ const axesSettings$1 = [{
2988
3078
  id: "video",
2989
3079
  color: "#41b51b"
2990
3080
  }, {
@@ -2994,43 +3084,45 @@ const axesSettings = [{
2994
3084
  id: "comment",
2995
3085
  color: "red"
2996
3086
  }];
2997
- const tracksIdsPath = ["timeline", "entities", "tracks", "ids"];
2998
- const tracksByIdPath = ["timeline", "entities", "tracks", "byId"];
2999
- const axesIdsPath = ["timeline", "entities", "axes", "ids"];
3000
- const axesByIdPath = ["timeline", "entities", "axes", "byId"];
3001
- const resourcesIdsView = path(["resources", "entities", "resources", "ids"]);
3002
- const resourcesByIdView = path(["resources", "entities", "resources", "byId"]);
3003
- const filesIdsView = path(["files", "entities", "files", "ids"]);
3004
- const filesByIdView = path(["files", "entities", "files", "byId"]);
3005
- const commentsByIdView = path(["timeline", "entities", "comments", "byId"]);
3006
- const tracksIdsLens = lensPath(tracksIdsPath);
3007
- const tracksByIdLens = lensPath(tracksByIdPath);
3008
- const axesIdsLens = lensPath(axesIdsPath);
3009
- const axesByIdLens = lensPath(axesByIdPath);
3010
- const filesView = pipe(filesByIdView, values);
3011
- const commentsView = pipe(commentsByIdView, values);
3012
-
3013
- const highSpeedsFilesView = stage => {
3014
- const filesById = filesByIdView(stage);
3015
- const resourcesById = resourcesByIdView(stage);
3016
- return pipe( // Iterate R.over the resource ids
3017
- resourcesIdsView, // Filter out all the ids that don't start with high-speed.
3018
- filter(startsWith("high-speed:")), // Map the remaining resource ids to the files ids in the respective resource object.
3019
- lookupPathAll(resourcesById, ["files"]), // Flatten the ids so we get a single array containing all the files ids referred
3087
+ const tracksIdsPath$1 = ["timeline", "entities", "tracks", "ids"];
3088
+ const tracksByIdPath$1 = ["timeline", "entities", "tracks", "byId"];
3089
+ const axesIdsPath$1 = ["timeline", "entities", "axes", "ids"];
3090
+ const axesByIdPath$1 = ["timeline", "entities", "axes", "byId"];
3091
+ const resourcesIdsView$1 = R.pathOr([], ["resources", "entities", "resources", "ids"]);
3092
+ const resourcesByIdView$1 = R.pathOr({}, ["resources", "entities", "resources", "byId"]);
3093
+ const filesIdsView$1 = R.pathOr([], ["files", "entities", "files", "ids"]);
3094
+ const filesByIdView$1 = R.pathOr({}, ["files", "entities", "files", "byId"]);
3095
+ const commentsByIdView$1 = R.pathOr({}, ["timeline", "entities", "comments", "byId"]);
3096
+ const tracksIdsLens$1 = R.lensPath(tracksIdsPath$1);
3097
+ const tracksByIdLens$1 = R.lensPath(tracksByIdPath$1);
3098
+ const axesIdsLens$1 = R.lensPath(axesIdsPath$1);
3099
+ const axesByIdLens$1 = R.lensPath(axesByIdPath$1);
3100
+ const filesView = R.pipe(filesByIdView$1, R.values);
3101
+ const commentsView$1 = R.pipe(commentsByIdView$1, R.values);
3102
+ const highSpeedsFilesView$1 = stage => {
3103
+ const filesById = filesByIdView$1(stage);
3104
+ const resourcesById = resourcesByIdView$1(stage);
3105
+ return R.pipe(
3106
+ // Iterate R.over the resource ids
3107
+ resourcesIdsView$1,
3108
+ // Filter out all the ids that don't start with high-speed.
3109
+ R.filter(R.startsWith("high-speed:")),
3110
+ // Map the remaining resource ids to the files ids in the respective resource object.
3111
+ lookupPathAll(resourcesById, ["files"]),
3112
+ // Flatten the ids so we get a single array containing all the files ids referred
3020
3113
  // to across all high-speed resources.
3021
- flatten, // Map the file ids to file objects.
3114
+ R.flatten,
3115
+ // Map the file ids to file objects.
3022
3116
  lookupAll(filesById))(stage);
3023
3117
  };
3024
-
3025
- const videosFilesView = stage => {
3026
- const filesIds = filesIdsView(stage);
3027
- const filesById = filesByIdView(stage);
3028
- const highSpeedFiles = highSpeedsFilesView(stage);
3029
- return pipe(without(pluck("id", highSpeedFiles)), lookupAll(filesById), filter(propEq("type", "video")))(filesIds);
3118
+ const videosFilesView$1 = stage => {
3119
+ const filesIds = filesIdsView$1(stage);
3120
+ const filesById = filesByIdView$1(stage);
3121
+ const highSpeedFiles = highSpeedsFilesView$1(stage);
3122
+ return R.pipe(R.without(R.pluck("id", highSpeedFiles)), lookupAll(filesById), R.filter(R.propEq("video", "type")))(filesIds);
3030
3123
  };
3031
-
3032
- const upsertAxes = axes => curry(pipe(unless(path(axesIdsPath), assocPath(axesIdsPath, [])), unless(path(axesByIdPath), assocPath(axesIdsPath, {})), over(axesIdsLens, union(pluck("id", axes))), over(axesByIdLens, merge(indexById(axes)))));
3033
- const createTrackFromEntity = curry((axis, entity) => {
3124
+ const upsertAxes$1 = axes => R.curry(R.pipe(R.unless(R.path(axesIdsPath$1), R.assocPath(axesIdsPath$1, [])), R.unless(R.path(axesByIdPath$1), R.assocPath(axesIdsPath$1, {})), R.over(axesIdsLens$1, R.union(R.pluck("id", axes))), R.over(axesByIdLens$1, R.mergeRight(indexById(axes)))));
3125
+ const createTrackFromEntity$1 = R.curry((axis, entity) => {
3034
3126
  const {
3035
3127
  start,
3036
3128
  end,
@@ -3046,68 +3138,56 @@ const createTrackFromEntity = curry((axis, entity) => {
3046
3138
  ref: id
3047
3139
  };
3048
3140
  });
3049
- const mapEntitiesToTracks = curry((entitiesSelector, axis, stage) => map$1(createTrackFromEntity(axis), entitiesSelector(stage)));
3050
- const mapCommentsToTracks = pipe(mapEntitiesToTracks(commentsView, "comment"), map$1(mergeLeft({
3141
+ const mapEntitiesToTracks$1 = R.curry((entitiesSelector, axis, stage) => R.map(createTrackFromEntity$1(axis), entitiesSelector(stage)));
3142
+ const mapCommentsToTracks$1 = R.pipe(mapEntitiesToTracks$1(commentsView$1, "comment"), R.map(R.mergeLeft({
3051
3143
  type: "comment",
3052
3144
  label: "comment"
3053
3145
  })));
3054
-
3055
- const formatTestNo = input => {
3056
- const [// eslint-disable-next-line no-unused-vars
3057
- m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX);
3146
+ const formatTestNo$1 = input => {
3147
+ const [
3148
+ // eslint-disable-next-line no-unused-vars
3149
+ m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX$1);
3058
3150
  return `${project}_${program.padStart(2, "0")}${facility}_${category.padStart(2, "0")}_${test.padStart(3, "0")}_${experiment.padStart(3, "0")}_${measurement.padStart(2, "0")}`;
3059
3151
  };
3060
-
3061
- const extractTestNumberFromMetadata = pipe(path(["metadata", "location", "$id"]), when(test(NEW_TEST_REGEX), formatTestNo));
3062
- const extractTestNumberFromFileName = compose(head, defaultTo([undefined]), either(match(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), prop("path"));
3063
-
3064
- const extractTestNumber = (stage, track) => pipe(filesByIdView, prop(track.ref), either(extractTestNumberFromMetadata, extractTestNumberFromFileName))(stage);
3065
-
3066
- const formatter = formatWithOptions({
3152
+ const extractTestNumberFromMetadata$1 = R.pipe(R.path(["metadata", "location", "$id"]), R.when(R.test(NEW_TEST_REGEX$1), formatTestNo$1));
3153
+ const extractTestNumberFromFileName$1 = R.compose(R.head, R.defaultTo([undefined]), R.either(match$1(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match$1(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), R.prop("path"));
3154
+ const extractTestNumber$1 = (stage, track) => R.pipe(filesByIdView$1, R.prop(track.ref), R.either(extractTestNumberFromMetadata$1, extractTestNumberFromFileName$1))(stage);
3155
+ const formatter$1 = formatWithOptions({
3067
3156
  awareOfUnicodeTokens: true
3068
3157
  });
3069
-
3070
- const extractRecordingChannel = (stage, track) => pipe(filesByIdView, path([track.ref, "metadata", "recChannel"]))(stage);
3071
-
3072
- const createHighSpeedTracksLabels = stage => tracks => mapWithIndex((hs, index) => {
3073
- const recordingChannel = extractRecordingChannel(stage, hs);
3158
+ const extractRecordingChannel$1 = (stage, track) => R.pipe(filesByIdView$1, R.path([track.ref, "metadata", "recChannel"]))(stage);
3159
+ const createHighSpeedTracksLabels$1 = stage => tracks => mapWithIndex$1((hs, index) => {
3160
+ const recordingChannel = extractRecordingChannel$1(stage, hs);
3074
3161
  const no = recordingChannel || index + 1;
3075
- return assoc("label", `HS ${no}`, hs);
3162
+ return R.assoc("label", `HS ${no}`, hs);
3076
3163
  }, tracks);
3077
-
3078
- const createVideoTracksLabels = stage => tracks => mapWithIndex((vid, index) => {
3079
- const recordingChannel = extractRecordingChannel(stage, vid);
3164
+ const createVideoTracksLabels$1 = stage => tracks => mapWithIndex$1((vid, index) => {
3165
+ const recordingChannel = extractRecordingChannel$1(stage, vid);
3080
3166
  const no = recordingChannel || index + 1;
3081
- return assoc("label", `VID ${no}`, vid);
3167
+ return R.assoc("label", `VID ${no}`, vid);
3082
3168
  }, tracks);
3083
-
3084
- const extractFormat = (stage, track) => pipe(filesByIdView, path([track.ref, "path"]), p => fsPath.extname(p))(stage);
3085
-
3086
- const extractSecondFractions = isoStr => pipe(match(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), ifElse(isNil, always("000"), nth(1)))(isoStr);
3087
-
3169
+ const extractFormat$1 = (stage, track) => R.pipe(filesByIdView$1, R.path([track.ref, "path"]), p => fsPath$1.extname(p))(stage);
3170
+ const extractSecondFractions$1 = isoStr => R.pipe(match$1(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), R.ifElse(R.isNil, R.always("000"), R.nth(1)))(isoStr);
3088
3171
  const extractDate = (stage, track) => {
3089
- return pipe(filesByIdView, path([track.ref, "start"]), parseISO, formatter("dd-MM-yyyy"))(stage);
3172
+ return R.pipe(filesByIdView$1, R.path([track.ref, "start"]), parseISO, formatter$1("dd-MM-yyyy"))(stage);
3090
3173
  };
3091
-
3092
- const createTime = converge(pipe(pair, join(".")), [pipe(parseISO, formatter("HH:mm:ss")), extractSecondFractions]);
3093
-
3094
- const extractStart = (stage, track) => pipe(filesByIdView, path([track.ref, "start"]), createTime)(stage);
3095
-
3096
- const extractEnd = (stage, track) => pipe(filesByIdView, path([track.ref, "end"]), createTime)(stage);
3097
-
3098
- const createVideoMetadata = curry((type, stage, track) => ({ ...track,
3174
+ const createTime$1 = R.converge(R.pipe(R.pair, R.join(".")), [R.pipe(parseISO, formatter$1("HH:mm:ss")), extractSecondFractions$1]);
3175
+ const extractStart = (stage, track) => R.pipe(filesByIdView$1, R.path([track.ref, "start"]), createTime$1)(stage);
3176
+ const extractEnd = (stage, track) => R.pipe(filesByIdView$1, R.path([track.ref, "end"]), createTime$1)(stage);
3177
+ const createVideoMetadata$1 = R.curry((type, stage, track) => ({
3178
+ ...track,
3099
3179
  metadata: track.metadata || [[{
3100
3180
  label: "Test",
3101
- value: extractTestNumber(stage, track)
3181
+ value: extractTestNumber$1(stage, track)
3102
3182
  }], [{
3103
3183
  label: "Type",
3104
3184
  value: type
3105
3185
  }, {
3106
3186
  label: "Recording channel",
3107
- value: extractRecordingChannel(stage, track)
3187
+ value: extractRecordingChannel$1(stage, track)
3108
3188
  }, {
3109
3189
  label: "Format",
3110
- value: extractFormat(stage, track)
3190
+ value: extractFormat$1(stage, track)
3111
3191
  }], [{
3112
3192
  label: "Date",
3113
3193
  value: extractDate(stage, track)
@@ -3119,36 +3199,26 @@ const createVideoMetadata = curry((type, stage, track) => ({ ...track,
3119
3199
  value: extractEnd(stage, track)
3120
3200
  }]]
3121
3201
  }));
3122
- const createHighSpeedsMetadata = curry((stage, tracks) => map$1(createVideoMetadata("high-speed", stage), tracks));
3123
- const createVideosMetadata = curry((stage, tracks) => map$1(createVideoMetadata("video", stage), tracks));
3124
-
3125
- const createTracks = stage => converge((...args) => flatten(args), [pipe(mapEntitiesToTracks(highSpeedsFilesView, "high-speed"), createHighSpeedTracksLabels(stage), createHighSpeedsMetadata(stage)), pipe(mapEntitiesToTracks(videosFilesView, "video"), createVideoTracksLabels(stage), createVideosMetadata(stage)), mapCommentsToTracks])(stage);
3126
-
3127
- const upsertTracks = tracks => curry(pipe(unless(path(tracksIdsPath), assocPath(tracksIdsPath, [])), unless(path(tracksByIdPath), assocPath(tracksByIdPath, {})), over(tracksIdsLens, union(pluck("id", tracks))), over(tracksByIdLens, merge(indexById(tracks)))));
3128
-
3129
- const earliestTime = stage => pipe(filesView, map$1(prop("start")), map$1(Date.parse), apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
3130
-
3131
- const latestTime = stage => pipe(filesView, map$1(prop("end")), map$1(Date.parse), apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
3132
-
3133
- const setTimeLineStartEnd = stage => pipe(assocPath(["timeline", "start"], earliestTime(stage)), assocPath(["timeline", "end"], latestTime(stage)))(stage);
3134
-
3135
- const setCommentAxis = assocPath(["timeline", "commentAxis"], "comment");
3136
-
3137
- const consolidateTimeline = stage => {
3138
- return pipe(upsertAxes(axesSettings), upsertTracks(createTracks(stage)), setTimeLineStartEnd, setCommentAxis)(stage);
3202
+ const createHighSpeedsMetadata$1 = R.curry((stage, tracks) => R.map(createVideoMetadata$1("high-speed", stage), tracks));
3203
+ const createVideosMetadata$1 = R.curry((stage, tracks) => R.map(createVideoMetadata$1("video", stage), tracks));
3204
+ const createTracks$1 = stage => R.converge((...args) => R.flatten(args), [R.pipe(mapEntitiesToTracks$1(highSpeedsFilesView$1, "high-speed"), createHighSpeedTracksLabels$1(stage), createHighSpeedsMetadata$1(stage)), R.pipe(mapEntitiesToTracks$1(videosFilesView$1, "video"), createVideoTracksLabels$1(stage), createVideosMetadata$1(stage)), mapCommentsToTracks$1])(stage);
3205
+ const upsertTracks$1 = tracks => R.curry(R.pipe(R.unless(R.path(tracksIdsPath$1), R.assocPath(tracksIdsPath$1, [])), R.unless(R.path(tracksByIdPath$1), R.assocPath(tracksByIdPath$1, {})), R.over(tracksIdsLens$1, R.union(R.pluck("id", tracks))), R.over(tracksByIdLens$1, R.mergeRight(indexById(tracks)))));
3206
+ const earliestTime$1 = stage => R.pipe(filesView, R.map(R.prop("start")), R.map(Date.parse), R.apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
3207
+ const latestTime$1 = stage => R.pipe(filesView, R.map(R.prop("end")), R.map(Date.parse), R.apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
3208
+ const setTimeLineStartEnd$1 = stage => R.pipe(R.assocPath(["timeline", "start"], earliestTime$1(stage)), R.assocPath(["timeline", "end"], latestTime$1(stage)))(stage);
3209
+ const setCommentAxis$1 = R.assocPath(["timeline", "commentAxis"], "comment");
3210
+ const consolidateTimeline$1 = stage => {
3211
+ return R.pipe(upsertAxes$1(axesSettings$1), upsertTracks$1(createTracks$1(stage)), setTimeLineStartEnd$1, setCommentAxis$1)(stage);
3139
3212
  };
3140
-
3141
- const consolidate = stage => {
3142
- return consolidateTimeline(stage);
3213
+ const consolidate$1 = stage => {
3214
+ return consolidateTimeline$1(stage);
3143
3215
  };
3144
3216
 
3145
- const NEW_TEST_REGEX$1 = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
3146
-
3147
- const fsPath$1 = require("path");
3148
-
3149
- const match$1 = curry((regex, st) => st.match(regex));
3150
- const mapWithIndex$1 = addIndex(map$1);
3151
- const axesSettings$1 = [{
3217
+ const NEW_TEST_REGEX = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
3218
+ const fsPath = require("path");
3219
+ const match = R.curry((regex, st) => st.match(regex));
3220
+ const mapWithIndex = R.addIndex(R.map);
3221
+ const axesSettings = [{
3152
3222
  id: "video",
3153
3223
  color: "#41b51b"
3154
3224
  }, {
@@ -3158,55 +3228,56 @@ const axesSettings$1 = [{
3158
3228
  id: "comment",
3159
3229
  color: "red"
3160
3230
  }];
3161
- const tracksIdsPath$1 = ["timeline", "entities", "tracks", "ids"];
3162
- const tracksByIdPath$1 = ["timeline", "entities", "tracks", "byId"];
3163
- const axesIdsPath$1 = ["timeline", "entities", "axes", "ids"];
3164
- const axesByIdPath$1 = ["timeline", "entities", "axes", "byId"];
3165
- const resourcesIdsView$1 = path(["resources", "entities", "resources", "ids"]);
3166
- const resourcesByIdView$1 = path(["resources", "entities", "resources", "byId"]);
3167
- const filesIdsView$1 = path(["files", "entities", "files", "ids"]);
3168
- const filesByIdView$1 = path(["files", "entities", "files", "byId"]);
3169
- const timingByIdView = path(["timing", "entities", "timing", "byId"]);
3170
- const commentsByIdView$1 = path(["timeline", "entities", "comments", "byId"]);
3171
- const tracksIdsLens$1 = lensPath(tracksIdsPath$1);
3172
- const tracksByIdLens$1 = lensPath(tracksByIdPath$1);
3173
- const axesIdsLens$1 = lensPath(axesIdsPath$1);
3174
- const axesByIdLens$1 = lensPath(axesByIdPath$1);
3175
- const timingsView = pipe(timingByIdView, values);
3176
- const commentsView$1 = pipe(commentsByIdView$1, values);
3177
-
3178
- const highSpeedsFilesView$1 = stage => {
3179
- const filesById = filesByIdView$1(stage);
3180
- const resourcesById = resourcesByIdView$1(stage);
3181
- return pipe( // Iterate R.over the resource ids
3182
- resourcesIdsView$1, // Filter out all the ids that don't start with high-speed.
3183
- filter(startsWith("high-speed:")), // Map the remaining resource ids to the files ids in the respective resource object.
3184
- lookupPathAll(resourcesById, ["props", "files"]), // Flatten the ids so we get a single array containing all the files ids referred
3231
+ const tracksIdsPath = ["timeline", "entities", "tracks", "ids"];
3232
+ const tracksByIdPath = ["timeline", "entities", "tracks", "byId"];
3233
+ const axesIdsPath = ["timeline", "entities", "axes", "ids"];
3234
+ const axesByIdPath = ["timeline", "entities", "axes", "byId"];
3235
+ const resourcesIdsView = R.pathOr([], ["resources", "entities", "resources", "ids"]);
3236
+ const resourcesByIdView = R.pathOr({}, ["resources", "entities", "resources", "byId"]);
3237
+ const filesIdsView = R.pathOr([], ["files", "entities", "files", "ids"]);
3238
+ const filesByIdView = R.pathOr({}, ["files", "entities", "files", "byId"]);
3239
+ const timingByIdView = R.pathOr({}, ["timing", "entities", "timing", "byId"]);
3240
+ const commentsByIdView = R.pathOr({}, ["timeline", "entities", "comments", "byId"]);
3241
+ const tracksIdsLens = R.lensPath(tracksIdsPath);
3242
+ const tracksByIdLens = R.lensPath(tracksByIdPath);
3243
+ const axesIdsLens = R.lensPath(axesIdsPath);
3244
+ const axesByIdLens = R.lensPath(axesByIdPath);
3245
+ const timingsView = R.pipe(timingByIdView, R.values);
3246
+ const commentsView = R.pipe(commentsByIdView, R.values);
3247
+ const highSpeedsFilesView = stage => {
3248
+ const filesById = filesByIdView(stage);
3249
+ const resourcesById = resourcesByIdView(stage);
3250
+ return R.pipe(
3251
+ // Iterate R.over the resource ids
3252
+ resourcesIdsView,
3253
+ // Filter out all the ids that don't start with high-speed.
3254
+ R.filter(R.startsWith("high-speed:")),
3255
+ // Map the remaining resource ids to the files ids in the respective resource object.
3256
+ lookupPathAll(resourcesById, ["props", "files"]),
3257
+ // Flatten the ids so we get a single array containing all the files ids referred
3185
3258
  // to across all high-speed resources.
3186
- flatten, // Map the file ids to file objects.
3259
+ R.flatten,
3260
+ // Map the file ids to file objects.
3187
3261
  lookupAll(filesById))(stage);
3188
3262
  };
3189
-
3190
3263
  const highSpeedsTimingsView = stage => {
3191
3264
  const timings = timingsView(stage);
3192
- return pipe(highSpeedsFilesView$1, // Map the file ids to file objects.
3265
+ return R.pipe(highSpeedsFilesView,
3266
+ // Map the file ids to file objects.
3193
3267
  files => files.map(file => timings.find(timing => timing.ref.id === file.id)))(stage);
3194
3268
  };
3195
-
3196
- const videosFilesView$1 = stage => {
3197
- const filesIds = filesIdsView$1(stage);
3198
- const filesById = filesByIdView$1(stage);
3199
- const highSpeedFiles = highSpeedsFilesView$1(stage);
3200
- return pipe(without(pluck("id", highSpeedFiles)), lookupAll(filesById), filter(propEq("type", "video")))(filesIds);
3269
+ const videosFilesView = stage => {
3270
+ const filesIds = filesIdsView(stage);
3271
+ const filesById = filesByIdView(stage);
3272
+ const highSpeedFiles = highSpeedsFilesView(stage);
3273
+ return R.pipe(R.without(R.pluck("id", highSpeedFiles)), lookupAll(filesById), R.filter(R.propEq("video", "type")))(filesIds);
3201
3274
  };
3202
-
3203
3275
  const videoTimingsView = stage => {
3204
3276
  const timings = timingsView(stage);
3205
- return pipe(videosFilesView$1, files => files.map(file => timings.find(timing => timing.ref.id === file.id)))(stage);
3277
+ return R.pipe(videosFilesView, files => files.map(file => timings.find(timing => timing.ref.id === file.id)))(stage);
3206
3278
  };
3207
-
3208
- const upsertAxes$1 = axes => curry(pipe(unless(path(axesIdsPath$1), assocPath(axesIdsPath$1, [])), unless(path(axesByIdPath$1), assocPath(axesIdsPath$1, {})), over(axesIdsLens$1, union(pluck("id", axes))), over(axesByIdLens$1, merge(indexById(axes)))));
3209
- const createTrackFromEntity$1 = curry((axis, entity) => {
3279
+ const upsertAxes = axes => R.curry(R.pipe(R.unless(R.path(axesIdsPath), R.assocPath(axesIdsPath, [])), R.unless(R.path(axesByIdPath), R.assocPath(axesIdsPath, {})), R.over(axesIdsLens, R.union(R.pluck("id", axes))), R.over(axesByIdLens, R.mergeRight(indexById(axes)))));
3280
+ const createTrackFromEntity = R.curry((axis, entity) => {
3210
3281
  const {
3211
3282
  start,
3212
3283
  end,
@@ -3226,8 +3297,8 @@ const createTrackFromEntity$1 = curry((axis, entity) => {
3226
3297
  timeline: "1"
3227
3298
  };
3228
3299
  });
3229
- const mapEntitiesToTracks$1 = curry((entitiesSelector, axis, stage) => map$1(createTrackFromEntity$1(axis), entitiesSelector(stage)));
3230
- const createTrackFromTiming = curry((axis, timing) => {
3300
+ const mapEntitiesToTracks = R.curry((entitiesSelector, axis, stage) => R.map(createTrackFromEntity(axis), entitiesSelector(stage)));
3301
+ const createTrackFromTiming = R.curry((axis, timing) => {
3231
3302
  const {
3232
3303
  start,
3233
3304
  end,
@@ -3250,62 +3321,54 @@ const createTrackFromTiming = curry((axis, timing) => {
3250
3321
  timeline: "1"
3251
3322
  };
3252
3323
  });
3253
- const mapTimingsToTracks = curry((entitiesSelector, axis, stage) => map$1(createTrackFromTiming(axis), entitiesSelector(stage)));
3254
- const mapCommentsToTracks$1 = pipe(mapEntitiesToTracks$1(commentsView$1, "comment"), map$1(mergeLeft({
3324
+ const mapTimingsToTracks = R.curry((entitiesSelector, axis, stage) => R.map(createTrackFromTiming(axis), entitiesSelector(stage)));
3325
+ const mapCommentsToTracks = R.pipe(mapEntitiesToTracks(commentsView, "comment"), R.map(R.mergeLeft({
3255
3326
  type: "comment",
3256
3327
  label: "comment"
3257
3328
  })));
3258
-
3259
- const formatTestNo$1 = input => {
3260
- const [// eslint-disable-next-line no-unused-vars
3261
- m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX$1);
3329
+ const formatTestNo = input => {
3330
+ const [
3331
+ // eslint-disable-next-line no-unused-vars
3332
+ m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX);
3262
3333
  return `${project}_${program.padStart(2, "0")}${facility}_${category.padStart(2, "0")}_${test.padStart(3, "0")}_${experiment.padStart(3, "0")}_${measurement.padStart(2, "0")}`;
3263
3334
  };
3264
-
3265
- const extractTestNumberFromMetadata$1 = pipe(path(["metadata", "location", "$id"]), when(test(NEW_TEST_REGEX$1), formatTestNo$1));
3266
- const extractTestNumberFromFileName$1 = compose(head, defaultTo([undefined]), either(match$1(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match$1(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), prop("path"));
3267
-
3268
- const extractTestNumber$1 = (stage, track) => pipe(filesByIdView$1, prop(track.ref.id), either(extractTestNumberFromMetadata$1, extractTestNumberFromFileName$1))(stage);
3269
-
3270
- const formatter$1 = formatWithOptions({
3335
+ const extractTestNumberFromMetadata = R.pipe(R.path(["metadata", "location", "$id"]), R.when(R.test(NEW_TEST_REGEX), formatTestNo));
3336
+ const extractTestNumberFromFileName = R.compose(R.head, R.defaultTo([undefined]), R.either(match(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), R.prop("path"));
3337
+ const extractTestNumber = (stage, track) => R.pipe(filesByIdView, R.prop(track.ref.id), R.either(extractTestNumberFromMetadata, extractTestNumberFromFileName))(stage);
3338
+ const formatter = formatWithOptions({
3271
3339
  awareOfUnicodeTokens: true
3272
3340
  });
3273
-
3274
- const extractRecordingChannel$1 = (stage, track) => pipe(filesByIdView$1, path([track.ref.id, "metadata", "recChannel"]))(stage);
3275
-
3276
- const createHighSpeedTracksLabels$1 = stage => tracks => mapWithIndex$1((hs, index) => {
3277
- const recordingChannel = extractRecordingChannel$1(stage, hs);
3341
+ const extractRecordingChannel = (stage, track) => R.pipe(filesByIdView, R.path([track.ref.id, "metadata", "recChannel"]))(stage);
3342
+ const createHighSpeedTracksLabels = stage => tracks => mapWithIndex((hs, index) => {
3343
+ const recordingChannel = extractRecordingChannel(stage, hs);
3278
3344
  const no = recordingChannel || index + 1;
3279
- return assoc("label", `HS ${no}`, hs);
3345
+ return R.assoc("label", `HS ${no}`, hs);
3280
3346
  }, tracks);
3281
-
3282
- const createVideoTracksLabels$1 = stage => tracks => mapWithIndex$1((vid, index) => {
3283
- const recordingChannel = extractRecordingChannel$1(stage, vid);
3347
+ const createVideoTracksLabels = stage => tracks => mapWithIndex((vid, index) => {
3348
+ const recordingChannel = extractRecordingChannel(stage, vid);
3284
3349
  const no = recordingChannel || index + 1;
3285
- return assoc("label", `VID ${no}`, vid);
3350
+ return R.assoc("label", `VID ${no}`, vid);
3286
3351
  }, tracks);
3287
-
3288
- const extractFormat$1 = (stage, track) => pipe(filesByIdView$1, path([track.ref.id, "path"]), p => fsPath$1.extname(p))(stage);
3289
-
3290
- const extractSecondFractions$1 = isoStr => pipe(match$1(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), ifElse(isNil, always("000"), nth(1)))(isoStr);
3291
-
3292
- const extractDateFromTrack = pipe(prop("start"), parseISO, formatter$1("dd-MM-yyyy"));
3293
- const createTime$1 = converge(pipe(pair, join(".")), [pipe(parseISO, formatter$1("HH:mm:ss")), extractSecondFractions$1]);
3294
- const extractStartFromTrack = pipe(prop("start"), createTime$1);
3295
- const extractEndFromTrack = pipe(prop("end"), createTime$1);
3296
- const createVideoMetadata$1 = curry((type, stage, track) => ({ ...track,
3352
+ const extractFormat = (stage, track) => R.pipe(filesByIdView, R.path([track.ref.id, "path"]), p => fsPath.extname(p))(stage);
3353
+ const extractSecondFractions = isoStr => R.pipe(match(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), R.ifElse(R.isNil, R.always("000"), R.nth(1)))(isoStr);
3354
+ const extractDateFromTrack = R.pipe(R.prop("start"), parseISO, formatter("dd-MM-yyyy"));
3355
+ const createTime = R.converge(R.pipe(R.pair, R.join(".")), [R.pipe(parseISO, formatter("HH:mm:ss")), extractSecondFractions]);
3356
+ const extractStartFromTrack = R.pipe(R.prop("start"), createTime);
3357
+ const extractEndFromTrack = R.pipe(R.prop("end"), createTime);
3358
+ const createVideoMetadata = R.curry((type, stage, track) => ({
3359
+ ...track,
3297
3360
  metadata: [[{
3298
3361
  label: "Test",
3299
- value: extractTestNumber$1(stage, track)
3362
+ value: extractTestNumber(stage, track)
3300
3363
  }], [{
3301
3364
  label: "Type",
3302
3365
  value: type
3303
3366
  }, {
3304
3367
  label: "Recording channel",
3305
- value: extractRecordingChannel$1(stage, track)
3368
+ value: extractRecordingChannel(stage, track)
3306
3369
  }, {
3307
3370
  label: "Format",
3308
- value: extractFormat$1(stage, track)
3371
+ value: extractFormat(stage, track)
3309
3372
  }], [{
3310
3373
  label: "Date",
3311
3374
  value: extractDateFromTrack(track)
@@ -3317,41 +3380,33 @@ const createVideoMetadata$1 = curry((type, stage, track) => ({ ...track,
3317
3380
  value: extractEndFromTrack(track)
3318
3381
  }]]
3319
3382
  }));
3320
- const createHighSpeedsMetadata$1 = curry((stage, tracks) => map$1(createVideoMetadata$1("high-speed", stage), tracks));
3321
- const createVideosMetadata$1 = curry((stage, tracks) => map$1(createVideoMetadata$1("video", stage), tracks));
3322
-
3323
- const createTracks$1 = stage => converge((...args) => flatten(args), [pipe(mapTimingsToTracks(highSpeedsTimingsView, "high-speed"), createHighSpeedTracksLabels$1(stage), createHighSpeedsMetadata$1(stage)), pipe(mapTimingsToTracks(videoTimingsView, "video"), createVideoTracksLabels$1(stage), createVideosMetadata$1(stage)), mapCommentsToTracks$1])(stage);
3324
-
3325
- const upsertTracks$1 = tracks => stage => {
3383
+ const createHighSpeedsMetadata = R.curry((stage, tracks) => R.map(createVideoMetadata("high-speed", stage), tracks));
3384
+ const createVideosMetadata = R.curry((stage, tracks) => R.map(createVideoMetadata("video", stage), tracks));
3385
+ const createTracks = stage => R.converge((...args) => R.flatten(args), [R.pipe(mapTimingsToTracks(highSpeedsTimingsView, "high-speed"), createHighSpeedTracksLabels(stage), createHighSpeedsMetadata(stage)), R.pipe(mapTimingsToTracks(videoTimingsView, "video"), createVideoTracksLabels(stage), createVideosMetadata(stage)), mapCommentsToTracks])(stage);
3386
+ const upsertTracks = tracks => stage => {
3326
3387
  const indexedById = indexById(tracks);
3327
- return pipe(unless(path(tracksIdsPath$1), assocPath(tracksIdsPath$1, [])), unless(path(tracksByIdPath$1), assocPath(tracksByIdPath$1, {})), over(tracksIdsLens$1, union(pluck("id", tracks))), over(tracksByIdLens$1, mergeLeft(indexedById)))(stage);
3388
+ return R.pipe(R.unless(R.path(tracksIdsPath), R.assocPath(tracksIdsPath, [])), R.unless(R.path(tracksByIdPath), R.assocPath(tracksByIdPath, {})), R.over(tracksIdsLens, R.union(R.pluck("id", tracks))), R.over(tracksByIdLens, R.mergeLeft(indexedById)))(stage);
3328
3389
  };
3329
-
3330
- const earliestTime$1 = stage => pipe(timingsView, map$1(prop("start")), map$1(Date.parse), apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
3331
-
3332
- const latestTime$1 = stage => pipe(timingsView, map$1(prop("end")), map$1(Date.parse), apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
3333
-
3334
- const setTimeLineStartEnd$1 = stage => pipe(assocPath(["timeline", "start"], earliestTime$1(stage)), assocPath(["timeline", "end"], latestTime$1(stage)))(stage);
3335
-
3336
- const setCommentAxis$1 = assocPath(["timeline", "commentAxis"], "comment");
3337
-
3338
- const consolidateTimeline$1 = stage => {
3339
- return pipe(upsertAxes$1(axesSettings$1), upsertTracks$1(createTracks$1(stage)), setTimeLineStartEnd$1, setCommentAxis$1)(stage);
3390
+ const earliestTime = stage => R.pipe(timingsView, R.map(R.prop("start")), R.map(Date.parse), R.apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
3391
+ const latestTime = stage => R.pipe(timingsView, R.map(R.prop("end")), R.map(Date.parse), R.apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
3392
+ const setTimeLineStartEnd = stage => R.pipe(R.assocPath(["timeline", "start"], earliestTime(stage)), R.assocPath(["timeline", "end"], latestTime(stage)))(stage);
3393
+ const setCommentAxis = R.assocPath(["timeline", "commentAxis"], "comment");
3394
+ const consolidateTimeline = stage => {
3395
+ return R.pipe(upsertAxes(axesSettings), upsertTracks(createTracks(stage)), setTimeLineStartEnd, setCommentAxis)(stage);
3340
3396
  };
3341
-
3342
- var v3$1 = pipe(tap(s => {
3397
+ var v3 = pipe(tap(s => {
3343
3398
  console.log("consolidating v3 stage!", s);
3344
- }), consolidateTimeline$1);
3399
+ }), consolidateTimeline);
3345
3400
 
3346
3401
  var _consolidators = Object.freeze({
3347
- 2: consolidate,
3348
- 3: v3$1
3402
+ 2: consolidate$1,
3403
+ 3: v3,
3404
+ 4: v3
3349
3405
  });
3350
3406
 
3351
3407
  const _consolidate = consolidators => stage => {
3352
3408
  const version = detectVersion(stage);
3353
3409
  const consolidator = propOr(always(stage), version, consolidators);
3354
-
3355
3410
  try {
3356
3411
  return {
3357
3412
  stage: consolidator(stage)
@@ -3362,101 +3417,95 @@ const _consolidate = consolidators => stage => {
3362
3417
  };
3363
3418
  }
3364
3419
  };
3365
- var consolidate$1 = _consolidate(_consolidators);
3420
+ var consolidate = _consolidate(_consolidators);
3366
3421
 
3367
- const upgradeResources = over(lensPath(["resources", "entities", "resources", "byId"]), map$1(({
3422
+ const upgradeResources = R.over(R.lensPath(["resources", "entities", "resources", "byId"]), R.map(({
3368
3423
  files,
3369
3424
  ...resource
3370
- }) => ({ ...resource,
3425
+ }) => ({
3426
+ ...resource,
3371
3427
  props: {
3372
3428
  files
3373
3429
  }
3374
3430
  })));
3375
- const createTimingSlice = pipe(assocPath(["timing", "entities", "timing"], {
3431
+ const createTimingSlice = R.pipe(R.assocPath(["timing", "entities", "timing"], {
3376
3432
  ids: [],
3377
3433
  byId: {}
3378
- }), assocPath(["timing", "entities", "offset"], {
3434
+ }), R.assocPath(["timing", "entities", "offset"], {
3379
3435
  ids: [],
3380
3436
  byId: {}
3381
3437
  }));
3382
-
3383
3438
  const createFilesTimings = s => {
3384
- const timings = pipe(path(["files", "entities", "files"]), over(lensProp("byId"), map$1(pipe(pick(["id", "start", "end"]), timing => assoc("ref", {
3439
+ const timings = R.pipe(R.path(["files", "entities", "files"]), R.over(R.lensProp("byId"), R.map(R.pipe(R.pick(["id", "start", "end"]), timing => R.assoc("ref", {
3385
3440
  id: timing.id,
3386
3441
  type: "file"
3387
3442
  }, timing)))))(s);
3388
- return pipe(over(lensPath(["files", "entities", "files", "byId"]), map$1(omit(["start", "end"]))), over(lensPath(["timing", "entities", "timing"]), mergeDeepRight(timings)), over(lensPath(["timing", "entities", "timing"]), entities => assoc("ids", keys(entities.byId), entities)))(s);
3443
+ return R.pipe(R.over(R.lensPath(["files", "entities", "files", "byId"]), R.map(R.omit(["start", "end"]))), R.over(R.lensPath(["timing", "entities", "timing"]), R.mergeDeepRight(timings)), R.over(R.lensPath(["timing", "entities", "timing"]), entities => R.assoc("ids", R.keys(entities.byId), entities)))(s);
3389
3444
  };
3390
-
3391
- const createComments = unless(pipe(path(["timeline", "entities", "comments"]), complement(isNil)), assocPath(["timeline", "entities", "comments"], {
3445
+ const createComments = R.unless(R.pipe(R.path(["timeline", "entities", "comments"]), R.complement(R.isNil)), R.assocPath(["timeline", "entities", "comments"], {
3392
3446
  ids: [],
3393
3447
  byId: {}
3394
3448
  }));
3395
-
3396
3449
  const createCommentsTimings = s => {
3397
- const timings = pipe(path(["timeline", "entities", "comments"]), over(lensProp("byId"), map$1(pipe(pick(["id", "start", "end"]), timing => assoc("ref", {
3450
+ const timings = R.pipe(R.path(["timeline", "entities", "comments"]), R.over(R.lensProp("byId"), R.map(R.pipe(R.pick(["id", "start", "end"]), timing => R.assoc("ref", {
3398
3451
  id: timing.id,
3399
3452
  type: "comment"
3400
3453
  }, timing)))))(s);
3401
- return pipe(over(lensPath(["timeline", "entities", "comments", "byId"]), map$1(omit(["start", "end"]))), over(lensPath(["timing", "entities", "timing"]), mergeDeepRight(timings)), over(lensPath(["timing", "entities", "timing"]), entities => assoc("ids", keys(entities.byId), entities)))(s);
3454
+ return R.pipe(R.over(R.lensPath(["timeline", "entities", "comments", "byId"]), R.map(R.omit(["start", "end"]))), R.over(R.lensPath(["timing", "entities", "timing"]), R.mergeDeepRight(timings)), R.over(R.lensPath(["timing", "entities", "timing"]), entities => R.assoc("ids", R.keys(entities.byId), entities)))(s);
3402
3455
  };
3403
-
3404
- const removeOutlets = s => {
3405
- const outlets = path(["data", "entities", "outlets"], s);
3406
-
3456
+ const removeOutlets$1 = s => {
3457
+ const outlets = R.path(["data", "entities", "outlets"], s);
3407
3458
  if (outlets) {
3408
- return pipe(dissocPath(["data", "entities", "outlets"]), over(lensPath(["data", "entities", "dataViewers", "byId"]), map$1(({
3459
+ return R.pipe(R.dissocPath(["data", "entities", "outlets"]), R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.map(({
3409
3460
  outletId,
3410
3461
  ...dataViewer
3411
3462
  }) => {
3412
- const outlet = path(["byId", outletId], outlets) || {
3463
+ const outlet = R.path(["byId", outletId], outlets) || {
3413
3464
  streams: []
3414
3465
  };
3415
- return { ...dataViewer,
3466
+ return {
3467
+ ...dataViewer,
3416
3468
  streams: outlet.streams
3417
3469
  };
3418
3470
  })))(s);
3419
3471
  }
3420
-
3421
3472
  return s;
3422
3473
  };
3423
-
3424
3474
  const createSliceEntities = entityName => slice => {
3425
- const result = pipe(unless(has("entities"), assoc("entities", {})), unless(hasPath(["entities", entityName]), assocPath(["entities", entityName], {
3475
+ const result = R.pipe(R.unless(R.has("entities"), R.assoc("entities", {})), R.unless(R.hasPath(["entities", entityName]), R.assocPath(["entities", entityName], {
3426
3476
  ids: [],
3427
3477
  byId: {}
3428
3478
  })))(slice);
3429
3479
  return result;
3430
3480
  };
3431
-
3432
3481
  const createTimelineSlice = s => {
3433
- return pipe(over(lensProp("timeline"), pipe(createSliceEntities("axes"), createSliceEntities("groups"), createSliceEntities("timeline"), createSliceEntities("tracks"))))(s);
3482
+ return R.pipe(R.over(R.lensProp("timeline"), R.pipe(createSliceEntities("axes"), createSliceEntities("groups"), createSliceEntities("timeline"), createSliceEntities("tracks"))))(s);
3434
3483
  };
3435
-
3436
3484
  const createTimelineGroups = s => {
3437
- const groups = pipe(path(["timeline", "entities", "axes"]), over(lensProp("byId"), map$1(dissoc("resources"))))(s);
3438
- return pipe(dissocPath(["timeline", "entities", "axes"]), assocPath(["timeline", "entities", "groups"], groups))(s);
3485
+ const groups = R.pipe(R.path(["timeline", "entities", "axes"]), R.over(R.lensProp("byId"), R.map(R.dissoc("resources"))))(s);
3486
+ return R.pipe(R.dissocPath(["timeline", "entities", "axes"]), R.assocPath(["timeline", "entities", "groups"], groups))(s);
3439
3487
  };
3440
-
3441
- const createTimeline = s => pipe(assocPath(["timeline", "entities", "timeline", "byId", "1"], {
3488
+ const createTimeline = s => R.pipe(R.assocPath(["timeline", "entities", "timeline", "byId", "1"], {
3442
3489
  id: "1",
3443
3490
  groupOrder: ["video", "high-speed", "comment"],
3444
3491
  actions: {
3445
3492
  copyLink: true,
3446
3493
  addComment: true
3447
3494
  },
3448
- start: path(["timeline", "start"], s),
3449
- end: path(["timeline", "end"], s)
3450
- }), dissocPath(["timeline", "start"]), dissocPath(["timeline", "end"]), assocPath(["timeline", "entities", "timeline", "ids"], ["1"]), over(lensPath(["timeline", "entities", "tracks", "byId"]), map$1(pipe(assoc("timeline", "1")))), assocPath(["timeline", "masterTimeline"], "1"))(s);
3451
-
3452
- const fixTracks = s => pipe(over(lensPath(["timeline", "entities", "tracks", "byId"]), map$1(({
3495
+ start: R.path(["timeline", "start"], s),
3496
+ end: R.path(["timeline", "end"], s)
3497
+ }), R.dissocPath(["timeline", "start"]), R.dissocPath(["timeline", "end"]), R.assocPath(["timeline", "entities", "timeline", "ids"], ["1"]), R.over(R.lensPath(["timeline", "entities", "tracks", "byId"]), R.map(R.pipe(R.assoc("timeline", "1")))), R.assocPath(["timeline", "masterTimeline"], "1"))(s);
3498
+ const fixTracks = s => R.pipe(R.over(R.lensPath(["timeline", "entities", "tracks", "byId"]),
3499
+ // eslint-disable-next-line no-unused-vars
3500
+ R.map(({
3453
3501
  axisRef,
3454
3502
  type,
3455
3503
  ref,
3456
3504
  start,
3457
3505
  end,
3458
3506
  ...track
3459
- }) => ({ ...track,
3507
+ }) => ({
3508
+ ...track,
3460
3509
  group: axisRef,
3461
3510
  ref: {
3462
3511
  type: type === "video" || type === "image" ? "file" : type,
@@ -3465,16 +3514,15 @@ const fixTracks = s => pipe(over(lensPath(["timeline", "entities", "tracks", "by
3465
3514
  editable: type === "comment",
3466
3515
  timeline: "1"
3467
3516
  }))))(s);
3468
-
3469
- const dataStreamsToMeasurements = s => {
3470
- const streamsSlice = path(["data", "entities", "dataStreams"], s);
3471
-
3472
- if (!isEmpty(streamsSlice) && !isNil(streamsSlice)) {
3473
- const measurementsSlice = pipe(over(lensProp("byId"), pipe(map$1(measurement => ({ ...measurement,
3517
+ const dataStreamsToMeasurements$1 = s => {
3518
+ const streamsSlice = R.path(["data", "entities", "dataStreams"], s);
3519
+ if (!R.isEmpty(streamsSlice) && !R.isNil(streamsSlice)) {
3520
+ const measurementsSlice = R.pipe(R.over(R.lensProp("byId"), R.pipe(R.map(measurement => ({
3521
+ ...measurement,
3474
3522
  legacy: true,
3475
3523
  name: measurement.id
3476
3524
  })))))(streamsSlice);
3477
- return pipe(dissocPath(["data", "entities", "dataStreams"]), assocPath(["data", "entities", "measurements"], measurementsSlice), over(lensPath(["data", "entities", "dataViewers", "byId"]), map$1(({
3525
+ return R.pipe(R.dissocPath(["data", "entities", "dataStreams"]), R.assocPath(["data", "entities", "measurements"], measurementsSlice), R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.map(({
3478
3526
  streams = [],
3479
3527
  ...dataViewer
3480
3528
  }) => ({
@@ -3482,69 +3530,234 @@ const dataStreamsToMeasurements = s => {
3482
3530
  ...dataViewer
3483
3531
  }))))(s);
3484
3532
  }
3485
-
3486
3533
  return s;
3487
3534
  };
3488
-
3489
- const translateComponent = component => {
3535
+ const translateComponent$1 = component => {
3490
3536
  switch (component) {
3491
3537
  case "DataViewerComponent":
3492
3538
  return "DataViewerPanel";
3493
-
3494
3539
  case "VideoComponent":
3495
3540
  return "VideoPanel";
3496
-
3497
3541
  case "PlaylistComponent":
3498
3542
  return "PlaylistPanel";
3499
-
3500
3543
  default:
3501
3544
  return component;
3502
3545
  }
3503
3546
  };
3504
-
3505
- const fixPanels = s => {
3506
- if (hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
3507
- return pipe(over(lensPath(["layout", "entities", "layoutSections", "byId"]), unless(isNil, map$1(when(has("component"), over(lensProp("component"), translateComponent))))))(s);
3547
+ const fixPanels$1 = s => {
3548
+ if (R.hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
3549
+ return R.pipe(R.over(R.lensPath(["layout", "entities", "layoutSections", "byId"]), R.unless(R.isNil, R.map(R.when(R.has("component"), R.over(R.lensProp("component"), translateComponent$1))))))(s);
3508
3550
  }
3509
-
3510
3551
  return s;
3511
3552
  };
3512
-
3513
- const scaleZoomSteps = stage => {
3553
+ const scaleZoomSteps$1 = stage => {
3514
3554
  const {
3515
3555
  measurementScale
3516
3556
  } = stage.data;
3517
- return over(lensPath(["data", "entities", "dataViewers", "byId"]), unless(isNil, mapObjIndexed(({
3557
+ return R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.unless(R.isNil, R.mapObjIndexed(({
3518
3558
  zoomSteps = [],
3519
3559
  ...rest
3520
- }) => ({ ...rest,
3560
+ }) => ({
3561
+ ...rest,
3521
3562
  zoomSteps: rest.zoomStepsIsScaled ? zoomSteps : zoomSteps.map(step => step * Math.sqrt(measurementScale))
3522
3563
  }))))(stage);
3523
3564
  };
3524
-
3525
- const updateVersion = assoc("version", 3);
3526
- var v2ToV3 = pipe(tap(stage => {
3565
+ const updateVersion$2 = R.assoc("version", 3);
3566
+ var v2ToV3$1 = R.pipe(R.tap(stage => {
3527
3567
  console.log("upgrading ", stage, " from 2 to 3");
3528
- }), consolidate$1, unless(prop("error"), pipe(prop("stage"), removeOutlets, scaleZoomSteps, dataStreamsToMeasurements, createTimingSlice, createTimelineSlice, createFilesTimings, createComments, createCommentsTimings, createTimelineGroups, createTimeline, fixTracks, updateVersion, fixPanels, upgradeResources)));
3568
+ }), consolidate, R.unless(R.prop("error"), R.pipe(R.prop("stage"), removeOutlets$1, scaleZoomSteps$1, dataStreamsToMeasurements$1, createTimingSlice, createTimelineSlice, createFilesTimings, createComments, createCommentsTimings, createTimelineGroups, createTimeline, fixTracks, updateVersion$2, fixPanels$1, upgradeResources)));
3529
3569
 
3530
- var upgraders = (() => [[2, v1ToV2], [3, v2ToV3]]);
3570
+ /**
3571
+ * v3-to-v4 Stage Upgrader
3572
+ *
3573
+ * Converts Golden Layout (v3) to DockView layout (v4).
3574
+ *
3575
+ * Key changes:
3576
+ * - Converts layout.entities.layoutSections (flat structure) to layout.dockviewLayout (hierarchical tree)
3577
+ * - Maps component names: DataViewerComponent → DataViewerPanel, VideoComponent → VideoPanel, etc.
3578
+ * - Converts row/column/stack structure to branch/leaf DockView nodes
3579
+ * - Updates version to 4
3580
+ */
3531
3581
 
3532
- const resolveFrom = stage => detectVersion(stage);
3582
+ const DOCKVIEW_HORIZONTAL = "HORIZONTAL";
3583
+ const DOCKVIEW_VERTICAL = "VERTICAL";
3584
+ const LEGACY_COMPONENT_TO_DOCKVIEW = {
3585
+ DataViewerComponent: "DataViewerPanel",
3586
+ VideoComponent: "VideoPanel",
3587
+ PlaylistComponent: "PlaylistPanel"
3588
+ };
3589
+ const mapLegacyComponentToDockview = component => {
3590
+ return LEGACY_COMPONENT_TO_DOCKVIEW[component] || component;
3591
+ };
3592
+ const getSectionId = value => {
3593
+ if (Array.isArray(value)) {
3594
+ return value[0];
3595
+ }
3596
+ return value || "";
3597
+ };
3598
+ const getSection = (sections, value) => sections[getSectionId(value)];
3599
+ const isComponentSection = section => {
3600
+ return Boolean(section) && !["row", "column", "stack"].includes((section === null || section === void 0 ? void 0 : section.type) || "");
3601
+ };
3602
+ const getRootSection = (content, sections) => {
3603
+ const rootId = getSectionId(content && content[0]);
3604
+ return rootId ? sections[rootId] : undefined;
3605
+ };
3606
+ const getOrientationForSection = section => {
3607
+ return (section === null || section === void 0 ? void 0 : section.type) === "row" ? DOCKVIEW_HORIZONTAL : DOCKVIEW_VERTICAL;
3608
+ };
3609
+ const getChildSize = (parent, child) => {
3610
+ if (!parent || !child) {
3611
+ return undefined;
3612
+ }
3613
+ return parent.type === "row" ? child.width : child.height;
3614
+ };
3615
+ const flattenDirectionalChildren = (section, sections) => {
3616
+ const content = (section === null || section === void 0 ? void 0 : section.content) || [];
3617
+ return content.flatMap(childValue => {
3618
+ const child = getSection(sections, childValue);
3619
+ if ((child === null || child === void 0 ? void 0 : child.type) === section.type) {
3620
+ return flattenDirectionalChildren(child, sections);
3621
+ }
3622
+ return [childValue];
3623
+ });
3624
+ };
3625
+ const createDockviewPanelState = section => {
3626
+ var _section$props, _section$props2;
3627
+ return {
3628
+ id: section.id,
3629
+ contentComponent: mapLegacyComponentToDockview(section.component || ""),
3630
+ title: ((_section$props = section.props) === null || _section$props === void 0 ? void 0 : _section$props.title) || section.title || section.id,
3631
+ params: {
3632
+ ...section.props,
3633
+ wrapMode: section.wrapMode || ((_section$props2 = section.props) === null || _section$props2 === void 0 ? void 0 : _section$props2.wrapMode) || "over"
3634
+ }
3635
+ };
3636
+ };
3637
+ const createDockviewGroupId = section => {
3638
+ if (section.type === "stack") {
3639
+ return section.id;
3640
+ }
3641
+ return `${section.id}__group`;
3642
+ };
3643
+ const createDockviewLeaf = (section, sections) => {
3644
+ const childValues = section.type === "stack" ? section.content || [] : [section.id];
3645
+ const panelIds = childValues.map(getSectionId).filter(panelId => Boolean(sections[panelId]));
3646
+ const activeIndex = Math.max(0, Math.min(section.activeItemIndex || 0, Math.max(panelIds.length - 1, 0)));
3647
+ return {
3648
+ type: "leaf",
3649
+ data: {
3650
+ id: createDockviewGroupId(section),
3651
+ views: panelIds,
3652
+ activeView: panelIds[activeIndex]
3653
+ }
3654
+ };
3655
+ };
3656
+ const createDockviewGridNode = (section, sections) => {
3657
+ if (!section) {
3658
+ return null;
3659
+ }
3660
+ if (section.type === "stack" || isComponentSection(section)) {
3661
+ return createDockviewLeaf(section, sections);
3662
+ }
3663
+ const childValues = flattenDirectionalChildren(section, sections);
3664
+ const children = childValues.map(childValue => {
3665
+ const childSection = getSection(sections, childValue);
3666
+ const node = createDockviewGridNode(childSection, sections);
3667
+ if (!node) {
3668
+ return null;
3669
+ }
3670
+ return {
3671
+ ...node,
3672
+ size: getChildSize(section, childSection)
3673
+ };
3674
+ }).filter(n => n !== null);
3675
+ if (children.length === 0) {
3676
+ return null;
3677
+ }
3678
+ if (children.length === 1) {
3679
+ return children[0];
3680
+ }
3681
+ return {
3682
+ type: "branch",
3683
+ data: children
3684
+ };
3685
+ };
3686
+ const filterLayoutSectionsByAssets = (sectionsById, assetsById) => {
3687
+ return R.pipe(R.map(section => {
3688
+ const assetId = R.path(["props", "assetId"], section);
3689
+ if (assetId && !assetsById[assetId]) {
3690
+ return null;
3691
+ }
3692
+ return section;
3693
+ }), R.filter(R.identity))(sectionsById);
3694
+ };
3695
+ const createPanelsById = sections => {
3696
+ return R.pipe(R.values, R.filter(isComponentSection), R.reduce((acc, section) => {
3697
+ return {
3698
+ ...acc,
3699
+ [section.id]: createDockviewPanelState(section)
3700
+ };
3701
+ }, {}))(sections);
3702
+ };
3703
+ const convertLegacyLayoutToDockview = stage => {
3704
+ var _rootSection$content;
3705
+ const content = R.path(["layout", "content"], stage);
3706
+ const rawSections = R.pathOr({}, ["layout", "entities", "layoutSections", "byId"], stage);
3707
+ const assetsById = R.pathOr({}, ["assets", "entities", "assets", "byId"], stage);
3708
+ const sections = filterLayoutSectionsByAssets(rawSections, assetsById);
3709
+ const rootSection = getRootSection(content, sections);
3710
+ const rootNode = createDockviewGridNode(rootSection, sections);
3711
+ if (!rootSection || !rootNode) {
3712
+ return null;
3713
+ }
3714
+ return {
3715
+ grid: {
3716
+ root: rootNode,
3717
+ height: 100,
3718
+ width: 100,
3719
+ orientation: getOrientationForSection(rootSection)
3720
+ },
3721
+ panels: createPanelsById(sections),
3722
+ activeGroup: createDockviewGroupId(rootSection.type === "stack" ? rootSection : getSection(sections, (_rootSection$content = rootSection.content) === null || _rootSection$content === void 0 ? void 0 : _rootSection$content[0]) || rootSection)
3723
+ };
3724
+ };
3725
+ const upgradeToDockviewLayout = stage => {
3726
+ // If already has dockviewLayout, skip conversion
3727
+ if (R.hasPath(["layout", "dockviewLayout"], stage)) {
3728
+ return stage;
3729
+ }
3533
3730
 
3534
- const resolveTo = to => defaultTo(last(versions))(to);
3731
+ // If no legacy layout sections, nothing to convert
3732
+ if (!R.hasPath(["layout", "entities", "layoutSections"], stage)) {
3733
+ return stage;
3734
+ }
3735
+ const dockviewLayout = convertLegacyLayoutToDockview(stage);
3535
3736
 
3536
- const versionsCorrect = (from, to) => gte(to, from);
3737
+ // Remove legacy layout structure, keep other layout state
3738
+ return R.pipe(R.dissocPath(["layout", "entities"]), R.dissocPath(["layout", "content"]), R.assocPath(["layout", "dockviewLayout"], dockviewLayout),
3739
+ // Preserve these layout state properties if they exist
3740
+ R.when(R.hasPath(["layout", "focus"]), R.identity), R.when(R.hasPath(["layout", "dragging"]), R.identity), R.when(R.hasPath(["layout", "resizingPanels"]), R.identity))(stage);
3741
+ };
3742
+ const updateVersion$1 = R.assoc("version", 4);
3743
+ var v3ToV4 = R.pipe(R.tap(stage => {
3744
+ console.log("upgrading ", stage, " from 3 to 4");
3745
+ }), upgradeToDockviewLayout, updateVersion$1);
3537
3746
 
3538
- const upgradePipe = (from, to, stage) => pipe(filter(([v]) => v > from && v <= to), map$1(nth(1)), prepend(always(stage)), apply(pipe), applyTo(stage))(upgraders());
3747
+ var upgraders = () => [[2, v1ToV2], [3, v2ToV3$1], [4, v3ToV4]];
3539
3748
 
3540
- const optionsParser$1 = ({
3749
+ const resolveFrom = stage => detectVersion(stage);
3750
+ const resolveTo = to => defaultTo(last(versions))(to);
3751
+ const versionsCorrect = (from, to) => gte(to, from);
3752
+ const upgradePipe = (from, to, stage) => pipe(filter(([v]) => v > from && v <= to), map$1(nth(1)), prepend(always(stage)), apply(pipe), applyTo(stage))(upgraders());
3753
+ const optionsParser = ({
3541
3754
  upgradeFrom: from = undefined,
3542
3755
  upgradeTo: to = undefined
3543
3756
  }) => ({
3544
3757
  from,
3545
3758
  to
3546
3759
  });
3547
- var upgrade = ((stage, options = {}) => {
3760
+ var upgrade = (stage, options = {}) => {
3548
3761
  const {
3549
3762
  to = undefined
3550
3763
  } = options;
@@ -3553,18 +3766,16 @@ var upgrade = ((stage, options = {}) => {
3553
3766
  let upgraded = stage;
3554
3767
  let error;
3555
3768
  console.log(`upgrading from ${resolvedFrom} to ${resolvedTo}.`);
3556
-
3557
3769
  if (versionsCorrect(resolvedFrom, resolvedTo)) {
3558
3770
  upgraded = upgradePipe(resolvedFrom, resolvedTo, stage);
3559
3771
  } else {
3560
3772
  error = new Error(`Incorrect version: from: ${resolvedFrom} > to: ${resolvedTo}`);
3561
3773
  }
3562
-
3563
3774
  return {
3564
3775
  stage: upgraded,
3565
3776
  error
3566
3777
  };
3567
- });
3778
+ };
3568
3779
 
3569
3780
  var timezoneData = {
3570
3781
  version: "2018g",
@@ -3577,19 +3788,15 @@ const {
3577
3788
  setTimeZone,
3578
3789
  populateTimeZones
3579
3790
  } = require("timezone-support/dist/lookup-convert");
3580
-
3581
3791
  const {
3582
3792
  formatZonedTime
3583
3793
  } = require("timezone-support/dist/parse-format");
3584
-
3585
3794
  populateTimeZones(timezoneData);
3586
3795
  const dateWithoutTimeZoneExp = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})((\.)([0-9]{0,}))?$/;
3587
3796
  const dateWithWrongSeconds = /^([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:)([0-9]{3,})((\.[0-9]+)?((Z|(\+|-)([0-9]{2}:[0-9]{2}|[0-9]+))))$/;
3588
3797
  const amsterdam = findTimeZone("Europe/Amsterdam");
3589
-
3590
3798
  const fixDateWithoutTimezone = d => {
3591
3799
  const matches = dateWithoutTimeZoneExp.exec(d);
3592
-
3593
3800
  if (matches) {
3594
3801
  const timeObj = {
3595
3802
  year: matches[1],
@@ -3606,89 +3813,79 @@ const fixDateWithoutTimezone = d => {
3606
3813
  const formattedTimezone = formatZonedTime(withTimezone, "Z");
3607
3814
  return `${formattedDate}T${formattedTime}${milliseconds || ""}${formattedTimezone}`;
3608
3815
  }
3609
-
3610
3816
  return d;
3611
3817
  };
3612
-
3613
3818
  const fixDateWithWrongSeconds = d => {
3614
3819
  const matches = dateWithWrongSeconds.exec(d);
3615
-
3616
3820
  if (matches) {
3617
3821
  const [, rest, seconds, timezone] = matches;
3618
3822
  const newDate = `${rest}${seconds.substring(seconds.length - 2)}${timezone}`;
3619
3823
  return newDate;
3620
3824
  }
3621
-
3622
3825
  return d;
3623
3826
  };
3624
-
3625
- const isIncorrectTime = input => both(is(String), pipe(anyPass([test(dateWithoutTimeZoneExp), test(dateWithWrongSeconds)])))(input);
3626
-
3627
- const fixDates = obj => pipe(map$1(ifElse(isIncorrectTime, pipe(tap(x => `${x} is incorrect date`), fixDateWithoutTimezone, fixDateWithWrongSeconds), when(is(Object), c => fixDates(c)))))(obj);
3827
+ const isIncorrectTime = input => R.both(R.is(String), R.pipe(R.anyPass([R.test(dateWithoutTimeZoneExp), R.test(dateWithWrongSeconds)])))(input);
3828
+ const fixDates = obj => R.pipe(R.map(R.ifElse(isIncorrectTime, R.pipe(R.tap(x => `${x} is incorrect date`), fixDateWithoutTimezone, fixDateWithWrongSeconds), R.when(R.is(Object), c => fixDates(c)))))(obj);
3628
3829
 
3629
3830
  const fixDatesWithOptions = (options, stage) => ({
3630
3831
  stage: fixDates(stage)
3631
3832
  });
3632
-
3633
3833
  const validateWithOptions = (options, stage) => {
3634
- const validated = validate(stage, optionsParser(options));
3834
+ const validated = validate(stage, optionsParser$1(options));
3635
3835
  return validated;
3636
3836
  };
3637
-
3638
- const upgradeWithOptions = (options, stage) => upgrade(stage, optionsParser$1(options));
3639
-
3640
- const consolidateWithOptions = (options, stage) => consolidate$1(stage);
3641
-
3642
- var steps = (() => [fixDatesWithOptions, validateWithOptions, consolidateWithOptions, upgradeWithOptions]);
3837
+ const upgradeWithOptions = (options, stage) => upgrade(stage, optionsParser(options));
3838
+ const consolidateWithOptions = (options, stage) => consolidate(stage);
3839
+ var steps = () => [fixDatesWithOptions, validateWithOptions, consolidateWithOptions, upgradeWithOptions];
3643
3840
 
3644
3841
  const hasError = prop("error");
3645
3842
  const doStep = curry((options, step, response) => {
3646
3843
  const normalizedStep = curry(nAry(2, step));
3647
3844
  return pipe(defaultTo({}), unless(hasError, pipe(prop("stage"), normalizedStep(options))))(response);
3648
3845
  });
3649
- const handler = curry((steps, options, stage) => pipe(defaultTo([]), map$1(doStep(options)), // Map all the steps to a doStep wrapper so they can be piped.
3846
+ const handler = curry((steps, options, stage) => pipe(defaultTo([]), map$1(doStep(options)),
3847
+ // Map all the steps to a doStep wrapper so they can be piped.
3650
3848
  prepend(always({
3651
3849
  stage
3652
- })), apply(pipe), // Create a pipe of all the steps.
3850
+ })), apply(pipe),
3851
+ // Create a pipe of all the steps.
3653
3852
  applyTo(stage) // Pipe the stage through the steps.
3654
3853
  )(steps));
3655
- var handlerFactory = ((steps, options) => handler(steps, options));
3854
+ var handlerFactory = (steps, options) => handler(steps, options);
3656
3855
 
3657
- var defaultOptions = (() => Object.freeze({
3856
+ var defaultOptions = () => Object.freeze({
3658
3857
  upgradeFrom: undefined,
3659
3858
  upgradeTo: undefined,
3660
3859
  validateVersion: undefined
3661
- }));
3662
-
3663
- const removeOutlets$1 = s => {
3664
- const outlets = path(["data", "entities", "outlets"], s);
3860
+ });
3665
3861
 
3862
+ const removeOutlets = s => {
3863
+ const outlets = R.path(["data", "entities", "outlets"], s);
3666
3864
  if (outlets) {
3667
- return pipe(dissocPath(["data", "entities", "outlets"]), over(lensPath(["data", "entities", "dataViewers", "byId"]), map$1(({
3865
+ return R.pipe(R.dissocPath(["data", "entities", "outlets"]), R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.map(({
3668
3866
  outletId,
3669
3867
  ...dataViewer
3670
3868
  }) => {
3671
- const outlet = path(["byId", outletId], outlets) || {
3869
+ const outlet = R.path(["byId", outletId], outlets) || {
3672
3870
  streams: []
3673
3871
  };
3674
- return { ...dataViewer,
3872
+ return {
3873
+ ...dataViewer,
3675
3874
  streams: outlet.streams
3676
3875
  };
3677
3876
  })))(s);
3678
3877
  }
3679
-
3680
3878
  return s;
3681
3879
  };
3682
-
3683
- const dataStreamsToMeasurements$1 = s => {
3684
- const streamsSlice = path(["data", "entities", "dataStreams"], s);
3685
-
3686
- if (!isEmpty(streamsSlice) && !isNil(streamsSlice)) {
3687
- const measurementsSlice = pipe(over(lensProp("byId"), pipe(map$1(measurement => ({ ...measurement,
3880
+ const dataStreamsToMeasurements = s => {
3881
+ const streamsSlice = R.path(["data", "entities", "dataStreams"], s);
3882
+ if (!R.isEmpty(streamsSlice) && !R.isNil(streamsSlice)) {
3883
+ const measurementsSlice = R.pipe(R.over(R.lensProp("byId"), R.pipe(R.map(measurement => ({
3884
+ ...measurement,
3688
3885
  legacy: true,
3689
3886
  name: measurement.id
3690
3887
  })))))(streamsSlice);
3691
- return pipe(dissocPath(["data", "entities", "dataStreams"]), assocPath(["data", "entities", "measurements"], measurementsSlice), over(lensPath(["data", "entities", "dataViewers", "byId"]), map$1(({
3888
+ return R.pipe(R.dissocPath(["data", "entities", "dataStreams"]), R.assocPath(["data", "entities", "measurements"], measurementsSlice), R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.map(({
3692
3889
  streams = [],
3693
3890
  ...dataViewer
3694
3891
  }) => ({
@@ -3696,64 +3893,56 @@ const dataStreamsToMeasurements$1 = s => {
3696
3893
  ...dataViewer
3697
3894
  }))))(s);
3698
3895
  }
3699
-
3700
3896
  return s;
3701
3897
  };
3702
-
3703
- const translateComponent$1 = component => {
3898
+ const translateComponent = component => {
3704
3899
  switch (component) {
3705
3900
  case "DataViewerComponent":
3706
3901
  return "DataViewerPanel";
3707
-
3708
3902
  case "VideoComponent":
3709
3903
  return "VideoPanel";
3710
-
3711
3904
  case "PlaylistComponent":
3712
3905
  return "PlaylistPanel";
3713
-
3714
3906
  default:
3715
3907
  return component;
3716
3908
  }
3717
3909
  };
3718
-
3719
- const fixPanels$1 = s => {
3720
- if (hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
3721
- return pipe(over(lensPath(["layout", "entities", "layoutSections", "byId"]), unless(isNil, map$1(when(has("component"), over(lensProp("component"), translateComponent$1))))))(s);
3910
+ const fixPanels = s => {
3911
+ if (R.hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
3912
+ return R.pipe(R.over(R.lensPath(["layout", "entities", "layoutSections", "byId"]), R.unless(R.isNil, R.map(R.when(R.has("component"), R.over(R.lensProp("component"), translateComponent))))))(s);
3722
3913
  }
3723
-
3724
3914
  return s;
3725
3915
  };
3726
-
3727
- const scaleZoomSteps$1 = stage => settings => {
3916
+ const scaleZoomSteps = stage => settings => {
3728
3917
  const {
3729
3918
  measurementScale
3730
3919
  } = stage.data;
3731
- return over(lensPath(["data", "entities", "dataViewers", "byId"]), unless(isNil, mapObjIndexed(({
3920
+ return R.over(R.lensPath(["data", "entities", "dataViewers", "byId"]), R.unless(R.isNil, R.mapObjIndexed(({
3732
3921
  zoomSteps = [],
3733
3922
  ...rest
3734
- }) => ({ ...rest,
3923
+ }) => ({
3924
+ ...rest,
3735
3925
  zoomSteps: rest.zoomStepsIsScaled ? zoomSteps : zoomSteps.map(step => step * Math.sqrt(measurementScale))
3736
3926
  }))))(settings);
3737
3927
  };
3738
-
3739
- const removeTimeline = dissoc("timeline");
3740
- const updateVersion$1 = assoc("version", 3);
3741
- var v2ToV3$1 = curry((stage, settings) => {
3742
- return pipe(tap(s => {
3928
+ const removeTimeline = R.dissoc("timeline");
3929
+ const updateVersion = R.assoc("version", 3);
3930
+ var v2ToV3 = R.curry((stage, settings) => {
3931
+ return R.pipe(R.tap(s => {
3743
3932
  console.log("upgrading settings", s, " from 2 to 3");
3744
- }), pipe(removeOutlets$1, dataStreamsToMeasurements$1, updateVersion$1, scaleZoomSteps$1(stage), fixPanels$1, removeTimeline))(settings);
3933
+ }), R.pipe(removeOutlets, dataStreamsToMeasurements, updateVersion, scaleZoomSteps(stage), fixPanels, removeTimeline))(settings);
3745
3934
  });
3746
3935
 
3747
- var settingsUpgrader = curry((stage, settings) => {
3748
- return pipe(unless(propEq("version", 3), v2ToV3$1(stage)))(settings);
3936
+ var settingsUpgrader = R.curry((stage, settings) => {
3937
+ return R.pipe(R.unless(R.propEq(3, "version"), v2ToV3(stage)))(settings);
3749
3938
  });
3750
3939
 
3751
- const settingsCleaner = pipe(dissocPath(["timer", "wantedTime"]));
3752
- var settingsHandler = ((stage, settings) => pipe(settingsUpgrader(stage), settingsCleaner)(settings));
3940
+ const settingsCleaner = R.pipe(R.dissocPath(["timer", "wantedTime"]));
3941
+ var settingsHandler = (stage, settings) => R.pipe(settingsUpgrader(stage), settingsCleaner)(settings);
3753
3942
 
3754
3943
  var name = "insync-stage-handler";
3755
- var version = "3.1.2";
3756
- var description$4 = "Handles stages files. This consists of validating, upgrading and consolodating them.";
3944
+ var version = "4.0.0-beta.1";
3945
+ var description = "Handles stages files. This consists of validating, upgrading and consolodating them.";
3757
3946
  var author = "David Ammeraal (Noterik B.V.)";
3758
3947
  var license = "MIT";
3759
3948
  var main = "dist/library.js";
@@ -3774,39 +3963,52 @@ var scripts = {
3774
3963
  "lint:fix": "yarn lint --fix"
3775
3964
  };
3776
3965
  var devDependencies = {
3777
- "@babel/core": "^7.10.5",
3778
- "@babel/preset-env": "^7.10.4",
3779
- "@rollup/plugin-babel": "^5.1.0",
3966
+ "@babel/core": "^7.29.7",
3967
+ "@babel/eslint-parser": "^7.25.0",
3968
+ "@babel/preset-env": "^7.29.7",
3969
+ "@eslint/js": "^10.0.1",
3970
+ "@rollup/plugin-babel": "^5.3.1",
3780
3971
  "@rollup/plugin-json": "^4.1.0",
3781
- "@rollup/plugin-node-resolve": "^8.4.0",
3782
- "babel-eslint": "^10.1.0",
3783
- "babel-jest": "^26.2.0",
3784
- "babel-plugin-module-resolver": "^4.0.0",
3785
- eslint: "6.8.0",
3786
- "eslint-config-airbnb-base": "14.2.0",
3787
- "eslint-config-prettier": "^6.11.0",
3788
- "eslint-import-resolver-babel-module": "^5.1.2",
3789
- "eslint-plugin-import": "2.21.2",
3790
- "eslint-plugin-jest": "^23.19.0",
3791
- "eslint-plugin-prettier": "^3.1.4",
3792
- jest: "^24.8.0",
3793
- prettier: "^2.0.5",
3794
- rollup: "^2.23.0",
3795
- "rollup-plugin-eslint": "^7.0.0"
3972
+ "@rollup/plugin-node-resolve": "^16.0.3",
3973
+ "babel-jest": "^30.0.0",
3974
+ "babel-plugin-module-resolver": "^4.1.0",
3975
+ eslint: "^10.0.0",
3976
+ "eslint-config-airbnb-base": "^15.0.0",
3977
+ "eslint-config-prettier": "^10.0.0",
3978
+ "eslint-import-resolver-babel-module": "^5.3.2",
3979
+ "eslint-plugin-import": "^2.32.0",
3980
+ "eslint-plugin-jest": "^29.0.0",
3981
+ "eslint-plugin-prettier": "^5.2.0",
3982
+ globals: "^17.6.0",
3983
+ jest: "^30.0.0",
3984
+ prettier: "^2.8.8",
3985
+ rollup: "^2.80.0"
3796
3986
  };
3797
3987
  var dependencies = {
3798
- ajv: "^6.9.1",
3988
+ ajv: "^6.15.0",
3799
3989
  "ajv-keywords": "^3.5.2",
3800
- "core-js": "^3.6.5",
3801
- "date-fns": "^2.15.0",
3990
+ "core-js": "^3.49.0",
3991
+ "date-fns": "^4.1.0",
3802
3992
  "object-hash": "^1.3.1",
3803
- ramda: "^0.26.1",
3993
+ ramda: "^0.32.0",
3804
3994
  "timezone-support": "^1.8.1"
3805
3995
  };
3996
+ var resolutions = {
3997
+ minimist: "^1.2.8",
3998
+ "ansi-regex": "^5.0.1",
3999
+ "brace-expansion": "^2.0.1",
4000
+ minimatch: "^3.1.4",
4001
+ "path-parse": "^1.0.7",
4002
+ json5: "^2.2.3",
4003
+ picomatch: "^2.3.1",
4004
+ lodash: "^4.17.21",
4005
+ "js-yaml": "^4.1.0",
4006
+ debug: "^4.3.5"
4007
+ };
3806
4008
  var pkg = {
3807
4009
  name: name,
3808
4010
  version: version,
3809
- description: description$4,
4011
+ description: description,
3810
4012
  author: author,
3811
4013
  license: license,
3812
4014
  main: main,
@@ -3815,7 +4017,8 @@ var pkg = {
3815
4017
  files: files,
3816
4018
  scripts: scripts,
3817
4019
  devDependencies: devDependencies,
3818
- dependencies: dependencies
4020
+ dependencies: dependencies,
4021
+ resolutions: resolutions
3819
4022
  };
3820
4023
 
3821
4024
  console.log("inSync StageHandler version", pkg.version);