captions.js 0.4.0 → 0.4.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/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,21 +17,1784 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
31
  var index_exports = {};
22
32
  __export(index_exports, {
23
- renderCaptions: () => renderCaptions
33
+ Captions: () => Captions,
34
+ captionsjs: () => captionsjs,
35
+ default: () => index_default,
36
+ googleFontsList: () => googleFontsList,
37
+ renderCaptions: () => renderCaptions,
38
+ renderString: () => renderString,
39
+ stylePresets: () => stylePresets
24
40
  });
25
41
  module.exports = __toCommonJS(index_exports);
42
+
43
+ // src/fonts/googleFonts.config.ts
44
+ var googleFontsList = [
45
+ "Roboto",
46
+ "Open Sans",
47
+ "Lato",
48
+ "Montserrat",
49
+ "Nunito",
50
+ "Poppins",
51
+ "Ubuntu",
52
+ "PT Sans",
53
+ "Merriweather Sans",
54
+ "Lobster",
55
+ "Amatic SC",
56
+ "Pacifico",
57
+ "Raleway",
58
+ "Cinzel",
59
+ "Quicksand",
60
+ "Zilla Slab",
61
+ "Caveat",
62
+ "Crimson Pro",
63
+ "Bebas Neue",
64
+ "Comfortaa",
65
+ "Satisfy",
66
+ "Permanent Marker",
67
+ "Oswald",
68
+ "Onset",
69
+ "Bangers",
70
+ "Kanit",
71
+ "Work Sans",
72
+ "Fira Sans",
73
+ "Anton",
74
+ "Playfair Display",
75
+ "Rubik",
76
+ "Alumni Sans",
77
+ "Righteous",
78
+ "Comico",
79
+ "Excon",
80
+ "Kalam",
81
+ "Tanker",
82
+ "Arsenal",
83
+ "Balsamiq Sans",
84
+ "Bona Nova SC"
85
+ ];
86
+
87
+ // src/stylePresets/stylePresets.config.ts
88
+ var stylePresets = [
89
+ {
90
+ id: 1,
91
+ captionsSettings: {
92
+ style: {
93
+ font: {
94
+ italic: false,
95
+ fontSize: 20,
96
+ fontColor: "#ffffffFF",
97
+ underline: false,
98
+ fontFamily: "Montserrat",
99
+ fontWeight: "black",
100
+ fontCapitalize: false,
101
+ fontStrokeColor: "#000000FF",
102
+ fontStrokeWidth: 0
103
+ },
104
+ name: "Karaoke",
105
+ backgroundColor: "#E4E4E4FF",
106
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/karaoke_preview.png",
107
+ aplifiedWordColor: "#04f827FF"
108
+ },
109
+ position: "bottom",
110
+ animation: "bounce",
111
+ linesPerPage: 3
112
+ },
113
+ layoutSettings: {
114
+ aspectRatio: "9:16",
115
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
116
+ fitLayoutAspectRatio: "original"
117
+ }
118
+ },
119
+ {
120
+ id: 2,
121
+ captionsSettings: {
122
+ style: {
123
+ font: {
124
+ italic: false,
125
+ fontSize: 25,
126
+ fontColor: "#ffffffFF",
127
+ underline: false,
128
+ fontFamily: "Permanent Marker",
129
+ fontWeight: "black",
130
+ fontCapitalize: true,
131
+ fontStrokeColor: "#000000FF",
132
+ fontStrokeWidth: 0
133
+ },
134
+ name: "Beasty",
135
+ backgroundColor: "#E4E4E4FF",
136
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/beasty_preview.png",
137
+ aplifiedWordColor: "#ff0000ff"
138
+ },
139
+ position: "bottom",
140
+ animation: "pop",
141
+ linesPerPage: 1
142
+ },
143
+ layoutSettings: {
144
+ aspectRatio: "9:16",
145
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
146
+ fitLayoutAspectRatio: "original"
147
+ }
148
+ },
149
+ {
150
+ id: 3,
151
+ captionsSettings: {
152
+ style: {
153
+ font: {
154
+ italic: false,
155
+ fontSize: 23,
156
+ fontColor: "#C6C6C6FF",
157
+ underline: false,
158
+ fontFamily: "Poppins",
159
+ fontWeight: "bold",
160
+ fontCapitalize: false,
161
+ fontStrokeColor: "#000000FF",
162
+ fontStrokeWidth: 0
163
+ },
164
+ name: "Safari",
165
+ backgroundColor: "#E4E4E4FF",
166
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/safari_preview.png",
167
+ aplifiedWordColor: "#000000FF"
168
+ },
169
+ position: "bottom",
170
+ animation: "box",
171
+ linesPerPage: 1
172
+ },
173
+ layoutSettings: {
174
+ aspectRatio: "9:16",
175
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
176
+ fitLayoutAspectRatio: "original"
177
+ }
178
+ },
179
+ {
180
+ id: 4,
181
+ captionsSettings: {
182
+ style: {
183
+ font: {
184
+ italic: false,
185
+ fontSize: 24,
186
+ fontColor: "#817B81FF",
187
+ underline: false,
188
+ fontFamily: "PT Sans",
189
+ fontWeight: "black",
190
+ fontCapitalize: false,
191
+ fontStrokeColor: "#000000FF",
192
+ fontStrokeWidth: 0
193
+ },
194
+ name: "Acid",
195
+ backgroundColor: "#00000000",
196
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/aciv_preview.png",
197
+ aplifiedWordColor: "#6BF5C7FF"
198
+ },
199
+ position: "bottom",
200
+ animation: "none",
201
+ linesPerPage: 1,
202
+ positionTopOffset: 42
203
+ },
204
+ layoutSettings: {
205
+ aspectRatio: "9:16",
206
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
207
+ fitLayoutAspectRatio: "original"
208
+ }
209
+ },
210
+ {
211
+ id: 5,
212
+ captionsSettings: {
213
+ style: {
214
+ font: {
215
+ italic: false,
216
+ fontSize: 26,
217
+ fontColor: "#F43FE0FF",
218
+ underline: false,
219
+ fontFamily: "Raleway",
220
+ fontWeight: "bold",
221
+ fontCapitalize: false,
222
+ fontStrokeColor: "#000000FF",
223
+ fontStrokeWidth: 8
224
+ },
225
+ name: "Popline",
226
+ backgroundColor: "#E4E4E4FF",
227
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/popline_preview.png",
228
+ aplifiedWordColor: "#F43FE0FF"
229
+ },
230
+ position: "bottom",
231
+ animation: "none",
232
+ linesPerPage: 1
233
+ },
234
+ layoutSettings: {
235
+ aspectRatio: "9:16",
236
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
237
+ fitLayoutAspectRatio: "original"
238
+ }
239
+ },
240
+ {
241
+ id: 6,
242
+ captionsSettings: {
243
+ style: {
244
+ font: {
245
+ italic: false,
246
+ fontSize: 20,
247
+ fontColor: "#FFFFFFFF",
248
+ underline: false,
249
+ fontFamily: "Montserrat",
250
+ fontWeight: "black",
251
+ fontCapitalize: true,
252
+ fontStrokeColor: "#000000FF",
253
+ fontStrokeWidth: 0
254
+ },
255
+ name: "Desert",
256
+ backgroundColor: "#E4E4E4FF",
257
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/desert_preview.png",
258
+ aplifiedWordColor: "#8F2EEDFF"
259
+ },
260
+ position: "bottom",
261
+ animation: "bounce",
262
+ linesPerPage: 2
263
+ },
264
+ layoutSettings: {
265
+ aspectRatio: "9:16",
266
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
267
+ fitLayoutAspectRatio: "original"
268
+ }
269
+ },
270
+ {
271
+ id: 7,
272
+ captionsSettings: {
273
+ style: {
274
+ font: {
275
+ italic: false,
276
+ fontSize: 26,
277
+ fontColor: "#FFFFFFFF",
278
+ underline: false,
279
+ fontFamily: "Lato",
280
+ fontWeight: "black",
281
+ fontCapitalize: true,
282
+ fontStrokeColor: "#000000FF",
283
+ fontStrokeWidth: 0
284
+ },
285
+ name: "Hook",
286
+ backgroundColor: "#E4E4E4FF",
287
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/hook_preview.png",
288
+ aplifiedWordColor: "#8F2EEDFF"
289
+ },
290
+ position: "bottom",
291
+ animation: "underline",
292
+ linesPerPage: 2
293
+ },
294
+ layoutSettings: {
295
+ aspectRatio: "9:16",
296
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
297
+ fitLayoutAspectRatio: "original"
298
+ }
299
+ },
300
+ {
301
+ id: 8,
302
+ captionsSettings: {
303
+ style: {
304
+ font: {
305
+ italic: false,
306
+ fontSize: 20,
307
+ fontColor: "#FFFFFFFF",
308
+ underline: false,
309
+ fontFamily: "Montserrat",
310
+ fontWeight: "black",
311
+ fontCapitalize: true,
312
+ fontStrokeColor: "#000000FF",
313
+ fontStrokeWidth: 0
314
+ },
315
+ name: "Sky",
316
+ backgroundColor: "#E4E4E4FF",
317
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/sky_preview.png",
318
+ aplifiedWordColor: "#FFFFFFFF"
319
+ },
320
+ position: "bottom",
321
+ animation: "slide-left",
322
+ linesPerPage: 2
323
+ },
324
+ layoutSettings: {
325
+ aspectRatio: "9:16",
326
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
327
+ fitLayoutAspectRatio: "original"
328
+ }
329
+ },
330
+ {
331
+ id: 9,
332
+ captionsSettings: {
333
+ style: {
334
+ font: {
335
+ italic: false,
336
+ fontSize: 20,
337
+ fontColor: "#FFFFFFFF",
338
+ underline: false,
339
+ fontFamily: "Montserrat",
340
+ fontWeight: "black",
341
+ fontCapitalize: true,
342
+ fontStrokeColor: "#000000FF",
343
+ fontStrokeWidth: 0
344
+ },
345
+ name: "Flamingo",
346
+ backgroundColor: "#E4E4E4FF",
347
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/flamingo_preview.png",
348
+ aplifiedWordColor: "#ff0000ff"
349
+ },
350
+ position: "bottom",
351
+ animation: "scale",
352
+ linesPerPage: 2
353
+ },
354
+ layoutSettings: {
355
+ aspectRatio: "9:16",
356
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
357
+ fitLayoutAspectRatio: "original"
358
+ }
359
+ },
360
+ {
361
+ id: 10,
362
+ captionsSettings: {
363
+ style: {
364
+ font: {
365
+ italic: false,
366
+ fontSize: 26,
367
+ fontColor: "#8a8a8aff",
368
+ underline: false,
369
+ fontFamily: "Raleway",
370
+ fontWeight: "bold",
371
+ fontCapitalize: false,
372
+ fontStrokeColor: "#000000FF",
373
+ fontStrokeWidth: 0
374
+ },
375
+ name: "Deep Diver B&W",
376
+ backgroundColor: "#000000ff",
377
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/captions-deep-diver-b&w.png",
378
+ aplifiedWordColor: "#ffffffff"
379
+ },
380
+ position: "bottom",
381
+ animation: "box",
382
+ linesPerPage: 1
383
+ },
384
+ layoutSettings: {
385
+ aspectRatio: "9:16",
386
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
387
+ fitLayoutAspectRatio: "original"
388
+ }
389
+ },
390
+ {
391
+ id: 11,
392
+ captionsSettings: {
393
+ style: {
394
+ font: {
395
+ italic: false,
396
+ fontSize: 20,
397
+ fontColor: "#b0b0b0ff",
398
+ underline: false,
399
+ fontFamily: "Montserrat",
400
+ fontWeight: "bold",
401
+ fontCapitalize: true,
402
+ fontStrokeColor: "#000000FF",
403
+ fontStrokeWidth: 0
404
+ },
405
+ name: "New",
406
+ backgroundColor: "#E4E4E4FF",
407
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/flamingo_preview.png",
408
+ aplifiedWordColor: "#dbff00ff"
409
+ },
410
+ position: "middle",
411
+ animation: "pop",
412
+ linesPerPage: 3
413
+ },
414
+ layoutSettings: {
415
+ aspectRatio: "9:16",
416
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
417
+ fitLayoutAspectRatio: "original"
418
+ }
419
+ },
420
+ {
421
+ id: 12,
422
+ captionsSettings: {
423
+ style: {
424
+ font: {
425
+ italic: false,
426
+ fontSize: 30,
427
+ fontColor: "#ffffffFF",
428
+ underline: false,
429
+ fontFamily: "Bangers",
430
+ fontWeight: "bold",
431
+ fontCapitalize: true,
432
+ fontStrokeColor: "#000000ff",
433
+ fontStrokeWidth: 60
434
+ },
435
+ name: "Banger",
436
+ backgroundColor: "#E4E4E4FF",
437
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/beasty_preview.png",
438
+ aplifiedWordColor: "#fdfa14ff"
439
+ },
440
+ position: "bottom",
441
+ animation: "pop",
442
+ linesPerPage: 1
443
+ },
444
+ layoutSettings: {
445
+ aspectRatio: "9:16",
446
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
447
+ fitLayoutAspectRatio: "original"
448
+ }
449
+ },
450
+ {
451
+ id: 13,
452
+ captionsSettings: {
453
+ style: {
454
+ font: {
455
+ italic: false,
456
+ fontSize: 20,
457
+ fontColor: "#FFFFFFFF",
458
+ underline: false,
459
+ fontFamily: "Montserrat",
460
+ fontWeight: "black",
461
+ fontCapitalize: true,
462
+ fontStrokeColor: "#000000FF",
463
+ fontStrokeWidth: 30
464
+ },
465
+ name: "Catchy",
466
+ backgroundColor: "#E4E4E4FF",
467
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/desert_preview.png",
468
+ aplifiedWordColor: "#ff5700ff"
469
+ },
470
+ position: "bottom",
471
+ animation: "bounce",
472
+ linesPerPage: 2
473
+ },
474
+ layoutSettings: {
475
+ aspectRatio: "9:16",
476
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
477
+ fitLayoutAspectRatio: "original"
478
+ }
479
+ },
480
+ {
481
+ id: 14,
482
+ captionsSettings: {
483
+ style: {
484
+ font: {
485
+ italic: false,
486
+ fontSize: 25,
487
+ fontColor: "#ffffffFF",
488
+ underline: false,
489
+ fontFamily: "Rubik",
490
+ fontWeight: "black",
491
+ fontCapitalize: true,
492
+ fontStrokeColor: "#000000FF",
493
+ fontStrokeWidth: 40
494
+ },
495
+ name: "Karaoke 2",
496
+ backgroundColor: "#E4E4E4FF",
497
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/karaoke_preview.png",
498
+ aplifiedWordColor: "#2bf82aff"
499
+ },
500
+ position: "bottom",
501
+ animation: "bounce",
502
+ linesPerPage: 2
503
+ },
504
+ layoutSettings: {
505
+ aspectRatio: "9:16",
506
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
507
+ fitLayoutAspectRatio: "original"
508
+ }
509
+ },
510
+ {
511
+ id: 15,
512
+ captionsSettings: {
513
+ style: {
514
+ font: {
515
+ italic: false,
516
+ fontSize: 25,
517
+ fontColor: "#ffffffFF",
518
+ underline: false,
519
+ fontFamily: "Rubik",
520
+ fontWeight: "black",
521
+ fontCapitalize: true,
522
+ fontStrokeColor: "#000000FF",
523
+ fontStrokeWidth: 60
524
+ },
525
+ name: "Karaoke 3",
526
+ backgroundColor: "#E4E4E4FF",
527
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/karaoke_preview.png",
528
+ aplifiedWordColor: "#2bf82aff"
529
+ },
530
+ position: "bottom",
531
+ animation: "bounce",
532
+ linesPerPage: 2
533
+ },
534
+ layoutSettings: {
535
+ aspectRatio: "9:16",
536
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
537
+ fitLayoutAspectRatio: "original"
538
+ }
539
+ },
540
+ {
541
+ id: 16,
542
+ captionsSettings: {
543
+ style: {
544
+ font: {
545
+ italic: false,
546
+ shadow: {
547
+ fontShadowBlur: 0,
548
+ fontShadowColor: "#000000ff",
549
+ fontShadowOffsetX: 2,
550
+ fontShadowOffsetY: 2
551
+ },
552
+ fontSize: 25,
553
+ fontColor: "#ffffffFF",
554
+ underline: false,
555
+ fontFamily: "Kanit",
556
+ fontWeight: "black",
557
+ fontCapitalize: true,
558
+ fontStrokeColor: "#000000FF",
559
+ fontStrokeWidth: 40
560
+ },
561
+ name: "From",
562
+ backgroundColor: "#E4E4E4FF",
563
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/karaoke_preview.png",
564
+ aplifiedWordColor: "#ffdd03ff"
565
+ },
566
+ position: "bottom",
567
+ animation: "pop",
568
+ linesPerPage: 1
569
+ },
570
+ layoutSettings: {
571
+ aspectRatio: "9:16",
572
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
573
+ fitLayoutAspectRatio: "original"
574
+ }
575
+ },
576
+ {
577
+ id: 17,
578
+ captionsSettings: {
579
+ style: {
580
+ font: {
581
+ italic: false,
582
+ fontSize: 15,
583
+ fontColor: "#ffffffff",
584
+ underline: false,
585
+ fontFamily: "Roboto",
586
+ fontWeight: "bold",
587
+ fontCapitalize: false,
588
+ fontStrokeColor: "#000000FF",
589
+ fontStrokeWidth: 20
590
+ },
591
+ name: "Classic",
592
+ backgroundColor: "#000000ff",
593
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/safari_preview.png",
594
+ aplifiedWordColor: "#ffffffff"
595
+ },
596
+ position: "bottom",
597
+ animation: "none",
598
+ linesPerPage: 2
599
+ },
600
+ layoutSettings: {
601
+ aspectRatio: "9:16",
602
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
603
+ fitLayoutAspectRatio: "original"
604
+ }
605
+ },
606
+ {
607
+ id: 18,
608
+ captionsSettings: {
609
+ style: {
610
+ font: {
611
+ italic: false,
612
+ fontSize: 30,
613
+ fontColor: "#ffffffff",
614
+ underline: false,
615
+ fontFamily: "Roboto",
616
+ fontWeight: "medium",
617
+ fontCapitalize: false,
618
+ fontStrokeColor: "#000000FF",
619
+ fontStrokeWidth: 40
620
+ },
621
+ name: "Classic Big",
622
+ backgroundColor: "#000000ff",
623
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/safari_preview.png",
624
+ aplifiedWordColor: "#ffffffff"
625
+ },
626
+ position: "bottom",
627
+ animation: "none",
628
+ linesPerPage: 2
629
+ },
630
+ layoutSettings: {
631
+ aspectRatio: "9:16",
632
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
633
+ fitLayoutAspectRatio: "original"
634
+ }
635
+ },
636
+ {
637
+ id: 19,
638
+ captionsSettings: {
639
+ style: {
640
+ font: {
641
+ italic: false,
642
+ fontSize: 25,
643
+ fontColor: "#FFFFFFFF",
644
+ underline: false,
645
+ fontFamily: "Montserrat",
646
+ fontWeight: "black",
647
+ fontCapitalize: true,
648
+ fontStrokeColor: "#000000FF",
649
+ fontStrokeWidth: 80
650
+ },
651
+ name: "Crazy",
652
+ backgroundColor: "#E4E4E4FF",
653
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/desert_preview.png",
654
+ aplifiedWordColor: "#ebf901ff"
655
+ },
656
+ position: "bottom",
657
+ animation: "none",
658
+ linesPerPage: 2,
659
+ positionTopOffset: 0
660
+ },
661
+ layoutSettings: {
662
+ aspectRatio: "9:16",
663
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
664
+ fitLayoutAspectRatio: "original"
665
+ }
666
+ },
667
+ {
668
+ id: 20,
669
+ captionsSettings: {
670
+ style: {
671
+ font: {
672
+ italic: false,
673
+ fontSize: 30,
674
+ fontColor: "#ffffffff",
675
+ underline: false,
676
+ fontFamily: "PT Sans",
677
+ fontWeight: "black",
678
+ fontCapitalize: false,
679
+ fontStrokeColor: "#000000FF",
680
+ fontStrokeWidth: 40
681
+ },
682
+ name: "Acid 2",
683
+ backgroundColor: "#00000000",
684
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/aciv_preview.png",
685
+ aplifiedWordColor: "#6BF5C7FF"
686
+ },
687
+ position: "bottom",
688
+ animation: "none",
689
+ linesPerPage: 1,
690
+ positionTopOffset: 42
691
+ },
692
+ layoutSettings: {
693
+ aspectRatio: "9:16",
694
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
695
+ fitLayoutAspectRatio: "original"
696
+ }
697
+ },
698
+ {
699
+ id: 21,
700
+ captionsSettings: {
701
+ style: {
702
+ font: {
703
+ italic: false,
704
+ fontSize: 20,
705
+ fontColor: "#ffffffff",
706
+ underline: false,
707
+ fontFamily: "Oswald",
708
+ fontWeight: "medium",
709
+ fontCapitalize: false,
710
+ fontStrokeColor: "#000000FF",
711
+ fontStrokeWidth: 40
712
+ },
713
+ name: "Marvel",
714
+ backgroundColor: "#00000000",
715
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/aciv_preview.png",
716
+ aplifiedWordColor: "#a76dffff"
717
+ },
718
+ position: "bottom",
719
+ animation: "scale",
720
+ linesPerPage: 2,
721
+ positionTopOffset: 0
722
+ },
723
+ layoutSettings: {
724
+ aspectRatio: "9:16",
725
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
726
+ fitLayoutAspectRatio: "original"
727
+ }
728
+ },
729
+ {
730
+ id: 22,
731
+ captionsSettings: {
732
+ style: {
733
+ font: {
734
+ italic: false,
735
+ shadow: {
736
+ fontShadowBlur: 1,
737
+ fontShadowColor: "0",
738
+ fontShadowOffsetX: 2,
739
+ fontShadowOffsetY: 2
740
+ },
741
+ fontSize: 25,
742
+ fontColor: "#ffffffff",
743
+ underline: false,
744
+ fontFamily: "Pacifico",
745
+ fontWeight: "medium",
746
+ fontCapitalize: false,
747
+ fontStrokeColor: "#000000FF",
748
+ fontStrokeWidth: 0
749
+ },
750
+ name: "Lovly",
751
+ backgroundColor: "#00000000",
752
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/aciv_preview.png",
753
+ aplifiedWordColor: "#f866cfff"
754
+ },
755
+ position: "bottom",
756
+ animation: "scale",
757
+ linesPerPage: 2,
758
+ positionTopOffset: 0
759
+ },
760
+ layoutSettings: {
761
+ aspectRatio: "9:16",
762
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
763
+ fitLayoutAspectRatio: "original"
764
+ }
765
+ },
766
+ {
767
+ id: 23,
768
+ captionsSettings: {
769
+ style: {
770
+ font: {
771
+ italic: false,
772
+ shadow: {
773
+ fontShadowBlur: 0,
774
+ fontShadowColor: "#023210ff",
775
+ fontShadowOffsetX: 2,
776
+ fontShadowOffsetY: 2
777
+ },
778
+ fontSize: 25,
779
+ fontColor: "#ffffffff",
780
+ underline: false,
781
+ fontFamily: "Playfair Display",
782
+ fontWeight: "regular",
783
+ fontCapitalize: false,
784
+ fontStrokeColor: "#000000FF",
785
+ fontStrokeWidth: 0
786
+ },
787
+ name: "Old Money",
788
+ backgroundColor: "#00000000",
789
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/aciv_preview.png",
790
+ aplifiedWordColor: "#ffffffff"
791
+ },
792
+ position: "bottom",
793
+ animation: "slide-up",
794
+ linesPerPage: 3,
795
+ positionTopOffset: 0
796
+ },
797
+ layoutSettings: {
798
+ aspectRatio: "9:16",
799
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
800
+ fitLayoutAspectRatio: "original"
801
+ }
802
+ },
803
+ {
804
+ id: 24,
805
+ captionsSettings: {
806
+ style: {
807
+ font: {
808
+ italic: false,
809
+ fontSize: 14,
810
+ fontColor: "#e4e900ff",
811
+ underline: false,
812
+ fontFamily: "Lato",
813
+ fontWeight: "bold",
814
+ fontCapitalize: false,
815
+ fontStrokeColor: "#000000FF",
816
+ fontStrokeWidth: 20
817
+ },
818
+ name: "Cinema",
819
+ backgroundColor: "#000000ff",
820
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/safari_preview.png",
821
+ aplifiedWordColor: "#e4e900ff"
822
+ },
823
+ position: "bottom",
824
+ animation: "none",
825
+ linesPerPage: 2
826
+ },
827
+ layoutSettings: {
828
+ aspectRatio: "9:16",
829
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
830
+ fitLayoutAspectRatio: "original"
831
+ }
832
+ },
833
+ {
834
+ id: 25,
835
+ captionsSettings: {
836
+ style: {
837
+ font: {
838
+ italic: false,
839
+ shadow: {
840
+ fontShadowBlur: 10,
841
+ fontShadowColor: "#000000ff",
842
+ fontShadowOffsetX: 2,
843
+ fontShadowOffsetY: 2
844
+ },
845
+ fontSize: 20,
846
+ fontColor: "#FFFFFFFF",
847
+ underline: false,
848
+ fontFamily: "Raleway",
849
+ fontWeight: "black",
850
+ fontCapitalize: false,
851
+ fontStrokeColor: "#000000FF",
852
+ fontStrokeWidth: 0
853
+ },
854
+ name: "Marker",
855
+ backgroundColor: "#E4E4E4FF",
856
+ verticalCoverImg: "https://storage.googleapis.com/loomz-front-static/video-editor/img/flamingo_preview.png",
857
+ aplifiedWordColor: "#6f0eecff"
858
+ },
859
+ position: "bottom",
860
+ animation: "underline",
861
+ linesPerPage: 2
862
+ },
863
+ layoutSettings: {
864
+ aspectRatio: "9:16",
865
+ aIAutoLayout: ["fill", "fit", "split", "three", "four", "screenShare"],
866
+ fitLayoutAspectRatio: "original"
867
+ }
868
+ }
869
+ ];
870
+
871
+ // src/fonts/googleFonts.helpers.ts
872
+ var import_konva = __toESM(require("konva"));
873
+ async function loadGoogleFont2(fontFamily) {
874
+ const fontNameForUrl = fontFamily.replace(/\s+/g, "+");
875
+ const fontUrl = `https://fonts.googleapis.com/css2?family=${fontNameForUrl}:wght@400;700&display=swap`;
876
+ if (!document.querySelector(`link[href="${fontUrl}"]`)) {
877
+ const link = document.createElement("link");
878
+ link.rel = "stylesheet";
879
+ link.href = fontUrl;
880
+ document.head.appendChild(link);
881
+ }
882
+ try {
883
+ await document.fonts.load(`16px "${fontFamily}"`);
884
+ await document.fonts.ready;
885
+ } catch (err) {
886
+ console.warn(`[loadGoogleFont] failed to load font "${fontFamily}":`, err);
887
+ }
888
+ import_konva.default.stages?.forEach((stage) => stage.batchDraw());
889
+ console.log(
890
+ `[loadGoogleFont] Font "${fontFamily}" loaded and ready for Konva.`
891
+ );
892
+ }
893
+
894
+ // src/render/renderString.ts
895
+ var import_konva2 = __toESM(require("konva"));
896
+ async function renderString(canvas, text, options) {
897
+ const { preset } = options;
898
+ const width = parseInt(canvas.style.width);
899
+ const height = parseInt(canvas.style.height);
900
+ const container = document.createElement("div");
901
+ var stage = new import_konva2.default.Stage({
902
+ container,
903
+ width,
904
+ height
905
+ });
906
+ console.log("width, height", width, height);
907
+ var layer = new import_konva2.default.Layer();
908
+ stage.add(layer);
909
+ await loadGoogleFont2(
910
+ preset.captionsSettings.style.font.fontFamily
911
+ );
912
+ await new Promise((resolve) => requestAnimationFrame(resolve));
913
+ const background = new import_konva2.default.Rect({
914
+ x: 0,
915
+ y: 0,
916
+ width,
917
+ height,
918
+ fill: "black"
919
+ });
920
+ layer.add(background);
921
+ const textOptions = {
922
+ x: width / 2,
923
+ y: height / 2,
924
+ text,
925
+ fontSize: preset.captionsSettings.style.font.fontSize,
926
+ fontFamily: preset.captionsSettings.style.font.fontFamily,
927
+ fill: preset.captionsSettings.style.font.fontColor,
928
+ align: "center",
929
+ offsetX: 0,
930
+ offsetY: 0
931
+ };
932
+ console.log("textOptions", textOptions);
933
+ const konvaText = new import_konva2.default.Text(textOptions);
934
+ konvaText.offsetX(konvaText.width() / 2);
935
+ konvaText.offsetY(konvaText.height() / 2);
936
+ layer.add(konvaText);
937
+ layer.draw();
938
+ const konvaCanvas = layer.getCanvas()._canvas;
939
+ const konvaContext = konvaCanvas.getContext("2d");
940
+ if (konvaContext) {
941
+ const targetContext = canvas.getContext("2d");
942
+ if (targetContext) {
943
+ targetContext.setTransform(
944
+ import_konva2.default.pixelRatio,
945
+ 0,
946
+ 0,
947
+ import_konva2.default.pixelRatio,
948
+ 0,
949
+ 0
950
+ );
951
+ targetContext.drawImage(konvaCanvas, 0, 0, width, height);
952
+ }
953
+ }
954
+ return true;
955
+ }
956
+
957
+ // src/captions/Captions.ts
958
+ var import_konva5 = __toESM(require("konva"));
959
+
960
+ // src/canvas-captions/index.ts
961
+ var import_konva4 = __toESM(require("konva"));
962
+
963
+ // src/canvas-captions/animate.ts
964
+ var import_konva3 = __toESM(require("konva"));
965
+
966
+ // src/canvas-captions/easing.ts
967
+ var mapEaseToFn = {
968
+ ["linear" /* linear */]: linear,
969
+ ["easeInSine" /* inSine */]: easeInSine,
970
+ ["easeOutSine" /* outSine */]: easeOutSine,
971
+ ["easeInOutSine" /* inOutSine */]: easeInOutSine,
972
+ ["easeInQuad" /* inQuad */]: easeInQuad,
973
+ ["easeOutQuad" /* outQuad */]: easeOutQuad,
974
+ ["easeInOutQuad" /* inOutQuad */]: easeInOutQuad,
975
+ ["easeInCubic" /* inCubic */]: easeInCubic,
976
+ ["easeOutCubic" /* outCubic */]: easeOutCubic,
977
+ ["easeInOutCubic" /* inOutCubic */]: easeInOutCubic,
978
+ ["easeInQuart" /* inQuart */]: easeInQuart,
979
+ ["easeOutQuart" /* outQuart */]: easeOutQuart,
980
+ ["easeInOutQuart" /* inOutQuart */]: easeInOutQuart,
981
+ ["easeInQuint" /* inQuint */]: easeInQuint,
982
+ ["easeOutQuint" /* outQuint */]: easeOutQuint,
983
+ ["easeInOutQuint" /* inOutQuint */]: easeInOutQuint,
984
+ ["easeInExpo" /* inExpo */]: easeInExpo,
985
+ ["easeOutExpo" /* outExpo */]: easeOutExpo,
986
+ ["easeInOutExpo" /* inOutExpo */]: easeInOutExpo,
987
+ ["easeInCirc" /* inCirc */]: easeInCirc,
988
+ ["easeOutCirc" /* outCirc */]: easeOutCirc,
989
+ ["easeInOutCirc" /* inOutCirc */]: easeInOutCirc,
990
+ ["easeInBack" /* inBack */]: easeInBack,
991
+ ["easeOutBack" /* outBack */]: easeOutBack,
992
+ ["easeInOutBack" /* inOutBack */]: easeInOutBack,
993
+ ["easeInElastic" /* inElastic */]: easeInElastic,
994
+ ["easeOutElastic" /* outElastic */]: easeOutElastic,
995
+ ["easeInOutElastic" /* inOutElastic */]: easeInOutElastic,
996
+ ["easeInBounce" /* inBounce */]: easeInBounce,
997
+ ["easeOutBounce" /* outBounce */]: easeOutBounce,
998
+ ["easeInOutBounce" /* inOutBounce */]: easeInOutBounce
999
+ };
1000
+ function linear(x) {
1001
+ return x;
1002
+ }
1003
+ function easeInSine(x) {
1004
+ return 1 - Math.cos(x * Math.PI / 2);
1005
+ }
1006
+ function easeOutSine(x) {
1007
+ return Math.sin(x * Math.PI / 2);
1008
+ }
1009
+ function easeInOutSine(x) {
1010
+ return -(Math.cos(Math.PI * x) - 1) / 2;
1011
+ }
1012
+ function easeInQuad(x) {
1013
+ return x * x;
1014
+ }
1015
+ function easeOutQuad(x) {
1016
+ return 1 - (1 - x) * (1 - x);
1017
+ }
1018
+ function easeInOutQuad(x) {
1019
+ return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;
1020
+ }
1021
+ function easeInCubic(x) {
1022
+ return x * x * x;
1023
+ }
1024
+ function easeOutCubic(x) {
1025
+ return 1 - Math.pow(1 - x, 3);
1026
+ }
1027
+ function easeInOutCubic(x) {
1028
+ return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
1029
+ }
1030
+ function easeInQuart(x) {
1031
+ return x * x * x * x;
1032
+ }
1033
+ function easeOutQuart(x) {
1034
+ return 1 - Math.pow(1 - x, 4);
1035
+ }
1036
+ function easeInOutQuart(x) {
1037
+ return x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;
1038
+ }
1039
+ function easeInQuint(x) {
1040
+ return x * x * x * x * x;
1041
+ }
1042
+ function easeOutQuint(x) {
1043
+ return 1 - Math.pow(1 - x, 5);
1044
+ }
1045
+ function easeInOutQuint(x) {
1046
+ return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
1047
+ }
1048
+ function easeInExpo(x) {
1049
+ return x === 0 ? 0 : Math.pow(2, 10 * x - 10);
1050
+ }
1051
+ function easeOutExpo(x) {
1052
+ return x === 1 ? 1 : 1 - Math.pow(2, -10 * x);
1053
+ }
1054
+ function easeInOutExpo(x) {
1055
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math.pow(2, 20 * x - 10) / 2 : (2 - Math.pow(2, -20 * x + 10)) / 2;
1056
+ }
1057
+ function easeInCirc(x) {
1058
+ return 1 - Math.sqrt(1 - Math.pow(x, 2));
1059
+ }
1060
+ function easeOutCirc(x) {
1061
+ return Math.sqrt(1 - Math.pow(x - 1, 2));
1062
+ }
1063
+ function easeInOutCirc(x) {
1064
+ return x < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2;
1065
+ }
1066
+ function easeInBack(x) {
1067
+ const c1 = 1.70158;
1068
+ const c3 = c1 + 1;
1069
+ return c3 * x * x * x - c1 * x * x;
1070
+ }
1071
+ function easeOutBack(x) {
1072
+ const c1 = 1.70158;
1073
+ const c3 = c1 + 1;
1074
+ return 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2);
1075
+ }
1076
+ function easeInOutBack(x) {
1077
+ const c1 = 1.70158;
1078
+ const c2 = c1 * 1.525;
1079
+ return x < 0.5 ? Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
1080
+ }
1081
+ function easeInElastic(x) {
1082
+ const c4 = 2 * Math.PI / 3;
1083
+ return x === 0 ? 0 : x === 1 ? 1 : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4);
1084
+ }
1085
+ function easeOutElastic(x) {
1086
+ const c4 = 2 * Math.PI / 3;
1087
+ return x === 0 ? 0 : x === 1 ? 1 : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1;
1088
+ }
1089
+ function easeInOutElastic(x) {
1090
+ const c5 = 2 * Math.PI / 4.5;
1091
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1;
1092
+ }
1093
+ function easeInBounce(x) {
1094
+ return 1 - easeOutBounce(1 - x);
1095
+ }
1096
+ function easeOutBounce(x) {
1097
+ const n1 = 7.5625;
1098
+ const d1 = 2.75;
1099
+ if (x < 1 / d1) {
1100
+ return n1 * x * x;
1101
+ } else if (x < 2 / d1) {
1102
+ return n1 * (x -= 1.5 / d1) * x + 0.75;
1103
+ } else if (x < 2.5 / d1) {
1104
+ return n1 * (x -= 2.25 / d1) * x + 0.9375;
1105
+ } else {
1106
+ return n1 * (x -= 2.625 / d1) * x + 0.984375;
1107
+ }
1108
+ }
1109
+ function easeInOutBounce(x) {
1110
+ return x < 0.5 ? (1 - easeOutBounce(1 - 2 * x)) / 2 : (1 + easeOutBounce(2 * x - 1)) / 2;
1111
+ }
1112
+
1113
+ // src/canvas-captions/animate.ts
1114
+ var animate = (captionsSettings, progress, chunk, current) => {
1115
+ const easeFn = mapEaseToFn["easeInQuint" /* inQuint */];
1116
+ const slideOffset = 7;
1117
+ switch (captionsSettings.animation) {
1118
+ case "bounce":
1119
+ if (current) {
1120
+ current.text.offsetX(current.text.width() / 2);
1121
+ current.text.offsetY(current.text.height() / 2);
1122
+ current.text.x(current.text.x() + current.text.width() / 2);
1123
+ current.text.y(current.text.y() + current.text.height() / 2);
1124
+ current.text.scale({
1125
+ x: 1 + 0.3 * easeFn(1),
1126
+ y: 1 + 0.3 * easeFn(1)
1127
+ });
1128
+ const offsetModule = captionsSettings.style.font.fontSize * 0.3;
1129
+ const curreentChildIndex = current.text.parent?.children.indexOf(current.text) || 0;
1130
+ current.text.parent?.children.forEach((child, index) => {
1131
+ if (index !== curreentChildIndex) {
1132
+ const offset = index < curreentChildIndex ? -offsetModule : offsetModule;
1133
+ child.x(child.x() + offset * easeFn(1));
1134
+ }
1135
+ });
1136
+ }
1137
+ break;
1138
+ case "underline":
1139
+ if (current) {
1140
+ const underline = new import_konva3.default.Line({
1141
+ points: [
1142
+ current.text.x(),
1143
+ current.text.height(),
1144
+ current.text.x() + current.text.width() * easeFn(1),
1145
+ current.text.height()
1146
+ ],
1147
+ lineCap: "round",
1148
+ stroke: current.caption.highlightColor ? current.caption.highlightColor : captionsSettings.style.aplifiedWordColor,
1149
+ strokeWidth: 5
1150
+ //opacity: easeFn(current.progress),
1151
+ });
1152
+ current.text.parent?.add(underline);
1153
+ }
1154
+ break;
1155
+ case "box":
1156
+ const xOffset = 12;
1157
+ const yOffset = 5;
1158
+ const cornerRadius = 6;
1159
+ const box = new import_konva3.default.Rect({
1160
+ x: -xOffset,
1161
+ y: -yOffset - 2,
1162
+ width: chunk.width + 2 * xOffset,
1163
+ height: chunk.height + 2 * yOffset + 2,
1164
+ fill: captionsSettings.style.backgroundColor,
1165
+ cornerRadius
1166
+ });
1167
+ chunk.group.add(box);
1168
+ box.moveToBottom();
1169
+ break;
1170
+ case "box-word":
1171
+ if (current) {
1172
+ const underline = new import_konva3.default.Line({
1173
+ id: "box-word",
1174
+ points: [
1175
+ current.text.x() + 6,
1176
+ current.text.height() - current.text.height() / 2,
1177
+ current.text.x() + (current.textTrim.width() - 6) * easeFn(1),
1178
+ current.text.height() - current.text.height() / 2
1179
+ ],
1180
+ lineCap: "round",
1181
+ stroke: captionsSettings.style.backgroundColor,
1182
+ strokeWidth: current.textTrim.height() + 2
1183
+ });
1184
+ underline.zIndex(4);
1185
+ current.text?.parent?.add(underline);
1186
+ }
1187
+ break;
1188
+ case "pop":
1189
+ const scaleFactor = 0.5 + 0.5 * mapEaseToFn["easeOutBack" /* outBack */](progress);
1190
+ chunk.group.scale({
1191
+ x: scaleFactor,
1192
+ y: scaleFactor
1193
+ });
1194
+ break;
1195
+ case "scale":
1196
+ const scaleFactor2 = 0.4 + 0.6 * mapEaseToFn["linear" /* linear */](progress);
1197
+ chunk.group.scale({
1198
+ x: scaleFactor2,
1199
+ y: scaleFactor2
1200
+ });
1201
+ break;
1202
+ case "slide-down":
1203
+ chunk.group.y(
1204
+ chunk.group.y() - slideOffset + slideOffset * mapEaseToFn["linear" /* linear */](progress)
1205
+ );
1206
+ break;
1207
+ case "slide-up":
1208
+ chunk.group.y(
1209
+ chunk.group.y() + slideOffset - slideOffset * mapEaseToFn["linear" /* linear */](progress)
1210
+ );
1211
+ break;
1212
+ case "slide-left":
1213
+ chunk.group.x(
1214
+ chunk.group.x() + slideOffset - slideOffset * mapEaseToFn["linear" /* linear */](progress)
1215
+ );
1216
+ break;
1217
+ default:
1218
+ break;
1219
+ }
1220
+ };
1221
+
1222
+ // src/canvas-captions/utils.ts
1223
+ var SOCIAL_NETWORK_OFFSET = 70;
1224
+ var splitCaptionsBytotalWordsToDisplay = (captions, totalWordsToDisplay, linesPerPage) => {
1225
+ const result = [];
1226
+ let currentCaptionIndex = 0;
1227
+ let currentSymbolsLength = 0;
1228
+ let currentBlock = [];
1229
+ let currentLine = 1;
1230
+ const maxWordGapSec = 1;
1231
+ const isValidBlockGap = (currentBlock2, caption) => {
1232
+ return true;
1233
+ return currentBlock2.length > 0 && caption.startTime - currentBlock2[currentBlock2.length - 1].endTime < maxWordGapSec || currentBlock2.length === 0;
1234
+ };
1235
+ while (currentCaptionIndex < captions.length) {
1236
+ const caption = captions[currentCaptionIndex];
1237
+ if (currentSymbolsLength + caption.word.length + 1 <= totalWordsToDisplay && isValidBlockGap(currentBlock, caption)) {
1238
+ currentBlock.push(caption);
1239
+ currentSymbolsLength += caption.word.length + 1;
1240
+ currentCaptionIndex++;
1241
+ } else if (linesPerPage > currentLine && isValidBlockGap(currentBlock, caption)) {
1242
+ currentBlock.push(caption);
1243
+ currentCaptionIndex++;
1244
+ currentSymbolsLength = caption.word.length;
1245
+ currentLine++;
1246
+ } else {
1247
+ if (currentBlock.length > 0) {
1248
+ result.push(currentBlock);
1249
+ }
1250
+ currentBlock = [];
1251
+ currentBlock.push(caption);
1252
+ currentSymbolsLength = caption.word.length;
1253
+ currentCaptionIndex++;
1254
+ currentLine = 1;
1255
+ }
1256
+ }
1257
+ if (currentBlock.length > 0) {
1258
+ result.push(currentBlock);
1259
+ }
1260
+ return result;
1261
+ };
1262
+ var fontWeightToFontStyle = (fontWeight, isItalic) => {
1263
+ return (isItalic ? "italic " : "") + fontWeightToNumber(fontWeight);
1264
+ };
1265
+ var fontWeightToNumber = (fontWeight) => {
1266
+ switch (fontWeight) {
1267
+ case "thin":
1268
+ return 100;
1269
+ case "light":
1270
+ return 300;
1271
+ case "regular":
1272
+ return 400;
1273
+ case "medium":
1274
+ return 500;
1275
+ case "bold":
1276
+ return 700;
1277
+ case "black":
1278
+ return 900;
1279
+ default:
1280
+ return 400;
1281
+ }
1282
+ };
1283
+ var getFillColor = (caption, isCurrentCaption, isPastCaption, captionsSettings) => {
1284
+ if (captionsSettings.animation === "underline") {
1285
+ return captionsSettings.style.font.fontColor;
1286
+ }
1287
+ if (captionsSettings.animation === "box" && (isCurrentCaption || isPastCaption)) {
1288
+ return caption.highlightColor || captionsSettings.style.aplifiedWordColor;
1289
+ }
1290
+ if (isCurrentCaption) {
1291
+ return caption.highlightColor || captionsSettings.style.aplifiedWordColor;
1292
+ }
1293
+ return captionsSettings.style.font.fontColor;
1294
+ };
1295
+ var getCaptionsGroupY = (groupHeight, canvasWidth, canvasHeight, position, offset, toCoef) => {
1296
+ const aspectRatio = canvasWidth / canvasHeight;
1297
+ const socialOffset = aspectRatio <= 1 ? SOCIAL_NETWORK_OFFSET * toCoef : 0;
1298
+ switch (position) {
1299
+ case "top":
1300
+ return (offset + 20) * toCoef + groupHeight / 2;
1301
+ case "middle":
1302
+ return canvasHeight / 2 + offset * toCoef;
1303
+ default:
1304
+ return canvasHeight - groupHeight / 2 - (20 + offset) * toCoef - socialOffset;
1305
+ }
1306
+ };
1307
+ var alignLinesInGroup = (group, maxGroupWidth, xOffset) => {
1308
+ return group.children.map((line) => {
1309
+ const lineWords = line.children;
1310
+ const lineWordsWidth = lineWords.reduce(
1311
+ (acc, word, currentIndex) => acc + word.width() + (currentIndex > 0 ? xOffset : 0),
1312
+ 0
1313
+ );
1314
+ const lineHeight = lineWords.reduce(
1315
+ (acc, word) => Math.max(acc, word.height()),
1316
+ 0
1317
+ );
1318
+ const lineX = (maxGroupWidth - lineWordsWidth) / 2;
1319
+ line.x(lineX);
1320
+ return {
1321
+ line,
1322
+ width: lineWordsWidth,
1323
+ height: lineHeight
1324
+ };
1325
+ });
1326
+ };
1327
+ var alphabetEN = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1328
+ var alphabetRU = "\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0451\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F";
1329
+ var alphabetArabic = "\u0627 \u0628 \u062A \u062B \u062C \u062D \u062E \u062F \u0630 \u0631 \u0632 \u0633 \u0634 \u0635 \u0636 \u0637 \u0638 \u0639 \u063A \u0641 \u0642 \u0643 \u0644 \u0645 \u0646 \u0647 \u0648 \u064A";
1330
+ var getAverageSymbolsInLine = (targetWidth, textWidth, alphabetLength, captionsSettings) => {
1331
+ const offset = captionsSettings.animation === "box" || captionsSettings.animation === "bounce" ? 4 : 2;
1332
+ const avg = Math.round(targetWidth / (textWidth / alphabetLength)) - offset;
1333
+ return avg > 0 ? avg : 0;
1334
+ };
1335
+ var getAlphabet = (kind) => {
1336
+ switch (kind) {
1337
+ case "cyrillic" /* Cyrillic */:
1338
+ return alphabetRU;
1339
+ case "latin" /* Latin */:
1340
+ return alphabetEN;
1341
+ case "arabic" /* Arabic */:
1342
+ return alphabetArabic;
1343
+ default:
1344
+ return "latin" /* Latin */;
1345
+ }
1346
+ };
1347
+ var detectAlphabetKind = (text) => {
1348
+ if (isCyrillic(text)) {
1349
+ return "cyrillic" /* Cyrillic */;
1350
+ }
1351
+ if (isLatin(text)) {
1352
+ return "latin" /* Latin */;
1353
+ }
1354
+ if (isArabic(text)) {
1355
+ return "arabic" /* Arabic */;
1356
+ }
1357
+ return "latin" /* Latin */;
1358
+ };
1359
+ function isCyrillic(text) {
1360
+ return /[\u0400-\u04FF]/.test(text);
1361
+ }
1362
+ function isLatin(text) {
1363
+ return /[A-Za-z]/.test(text);
1364
+ }
1365
+ function isArabic(text) {
1366
+ return /[\u0600-\u06FF]/.test(text);
1367
+ }
1368
+
1369
+ // src/canvas-captions/index.ts
1370
+ var import_object_hash = __toESM(require("object-hash"));
1371
+ var memo = {};
1372
+ var drawDebugBoundingBox = (parent, width, height, stroke, dash = [6, 4]) => {
1373
+ const rect = new import_konva4.default.Rect({
1374
+ x: 0,
1375
+ y: 0,
1376
+ width,
1377
+ height,
1378
+ stroke,
1379
+ strokeWidth: 4,
1380
+ dash,
1381
+ listening: false
1382
+ });
1383
+ parent.add(rect);
1384
+ rect.moveToTop();
1385
+ };
1386
+ var renderFrame = (captionsSettings, layoutSettings, captions, currentTime, targetSize, layer, toCoef, debug) => {
1387
+ const [width, height] = targetSize;
1388
+ const targetFontSize = captionsSettings.style.font.fontSize * (toCoef ?? 1);
1389
+ const showDebugBoundingBoxes = Boolean(debug);
1390
+ let totalSymbolInLine = 0;
1391
+ const hash = (0, import_object_hash.default)({ captionsSettings });
1392
+ if (memo[hash]) {
1393
+ totalSymbolInLine = memo[hash];
1394
+ } else {
1395
+ const textForDetectAlphabet = captions.slice(0, 10).map((x) => x.word).join("");
1396
+ const alphabetKind = detectAlphabetKind(textForDetectAlphabet);
1397
+ const alphabet = getAlphabet(alphabetKind);
1398
+ const alphabetText = new import_konva4.default.Text({
1399
+ text: captionsSettings.style.font.fontCapitalize ? alphabet.toUpperCase() : alphabet,
1400
+ x: 0,
1401
+ y: 0,
1402
+ fontSize: targetFontSize,
1403
+ fontFamily: captionsSettings.style.font.fontFamily,
1404
+ fontStyle: fontWeightToFontStyle(
1405
+ captionsSettings.style.font.fontWeight,
1406
+ captionsSettings.style.font.italic
1407
+ ),
1408
+ stroke: captionsSettings.style.font.fontStrokeColor,
1409
+ strokeWidth: captionsSettings.style.font.fontStrokeWidth ? captionsSettings.style.font.fontStrokeWidth / 10 : 0,
1410
+ textDecoration: captionsSettings.style.font.underline ? "underline" : "",
1411
+ fill: "black"
1412
+ });
1413
+ alphabetText.fillAfterStrokeEnabled(true);
1414
+ totalSymbolInLine = getAverageSymbolsInLine(
1415
+ layer.getWidth(),
1416
+ alphabetText.getWidth(),
1417
+ alphabet.length,
1418
+ captionsSettings
1419
+ );
1420
+ memo[hash] = totalSymbolInLine;
1421
+ }
1422
+ const chunks = splitCaptionsBytotalWordsToDisplay(
1423
+ captions,
1424
+ totalSymbolInLine,
1425
+ captionsSettings.linesPerPage
1426
+ );
1427
+ const currentChunk = chunks.find(
1428
+ (chunk) => chunk[0].startTime <= currentTime && chunk[chunk.length - 1].endTime >= currentTime
1429
+ );
1430
+ const xOffset = targetFontSize * 0.1;
1431
+ const wordSpacing = xOffset + (captionsSettings.animation === "bounce" ? 8 : 0) + (captionsSettings.style.font.fontCapitalize ? 2 : 0);
1432
+ const yOffset = captionsSettings.lineSpacing ?? 4;
1433
+ if (currentChunk) {
1434
+ const group = new import_konva4.default.Group({
1435
+ drawBorder: true
1436
+ });
1437
+ let x = 0;
1438
+ let y = 0;
1439
+ let maxGroupWidth = 0;
1440
+ let groupWidth = 0;
1441
+ let groupHeight = 0;
1442
+ let line = new import_konva4.default.Group({
1443
+ drawBorder: true
1444
+ });
1445
+ let currentSymbolsLength = 0;
1446
+ let current = void 0;
1447
+ currentChunk.forEach((caption, index) => {
1448
+ const isCurrentCaption = caption.startTime <= currentTime && caption.endTime >= currentTime;
1449
+ const isPastCaption = caption.endTime < currentTime;
1450
+ const fillColor = getFillColor(
1451
+ caption,
1452
+ isCurrentCaption,
1453
+ isPastCaption,
1454
+ captionsSettings
1455
+ );
1456
+ const isLastWordInLine = currentSymbolsLength + caption.word.length + (index < currentChunk.length - 1 ? currentChunk[index + 1].word.length : 0) > totalSymbolInLine || currentChunk.length - 1 === index;
1457
+ let word = captionsSettings.style.font.fontCapitalize ? caption.word.toUpperCase() : caption.word;
1458
+ word = isLastWordInLine ? word.trim() : word;
1459
+ const createKonvaText = (word2, x2, targetFontSize2, captionsSettings2, fillColor2, trim) => {
1460
+ return new import_konva4.default.Text({
1461
+ text: trim ? word2?.trim() : word2,
1462
+ x: x2,
1463
+ y: 0,
1464
+ drawBorder: true,
1465
+ fontSize: targetFontSize2,
1466
+ fontFamily: captionsSettings2.style.font.fontFamily,
1467
+ fontStyle: fontWeightToFontStyle(
1468
+ captionsSettings2.style.font.fontWeight,
1469
+ captionsSettings2.style.font.italic
1470
+ ),
1471
+ stroke: captionsSettings2.style.font.fontStrokeColor,
1472
+ strokeWidth: captionsSettings2.style.font.fontStrokeWidth ? captionsSettings2.style.font.fontStrokeWidth / 10 : 0,
1473
+ textDecoration: captionsSettings2.style.font.underline ? "underline" : "",
1474
+ fill: fillColor2,
1475
+ shadowColor: captionsSettings2.style.font.shadow?.fontShadowColor,
1476
+ shadowBlur: captionsSettings2.style.font.shadow?.fontShadowBlur ?? 0,
1477
+ shadowOffset: captionsSettings2.style.font.shadow ? {
1478
+ x: captionsSettings2.style.font.shadow?.fontShadowOffsetX ?? 0,
1479
+ y: captionsSettings2.style.font.shadow?.fontShadowOffsetY ?? 0
1480
+ } : void 0,
1481
+ listening: false,
1482
+ perfectDrawEnabled: false
1483
+ });
1484
+ };
1485
+ const text = createKonvaText(
1486
+ word,
1487
+ x,
1488
+ targetFontSize,
1489
+ captionsSettings,
1490
+ fillColor,
1491
+ false
1492
+ );
1493
+ text.fillAfterStrokeEnabled(true);
1494
+ const textTrim = captionsSettings.animation === "box-word" ? createKonvaText(
1495
+ word,
1496
+ x,
1497
+ targetFontSize,
1498
+ captionsSettings,
1499
+ fillColor,
1500
+ true
1501
+ ) : null;
1502
+ if (isCurrentCaption) {
1503
+ current = {
1504
+ caption,
1505
+ text,
1506
+ progress: (currentTime - caption.startTime) / (caption.endTime - caption.startTime),
1507
+ textTrim
1508
+ //progress: Math.min(1, (currentTime - caption.start_time) / 0.5),
1509
+ };
1510
+ }
1511
+ x += text.width() + wordSpacing;
1512
+ groupWidth += text.width() + (isLastWordInLine ? 0 : wordSpacing);
1513
+ line.y(y);
1514
+ line.add(text);
1515
+ if (isLastWordInLine) {
1516
+ group.add(line);
1517
+ x = 0;
1518
+ const isLastLine = index + 1 === currentChunk.length;
1519
+ y += text.height() + yOffset;
1520
+ groupHeight += text.height() + (isLastLine ? 0 : yOffset);
1521
+ if (groupWidth > maxGroupWidth) {
1522
+ maxGroupWidth = groupWidth;
1523
+ }
1524
+ groupWidth = 0;
1525
+ line = new import_konva4.default.Group({
1526
+ drawBorder: true
1527
+ });
1528
+ currentSymbolsLength = 0;
1529
+ } else {
1530
+ currentSymbolsLength += caption.word.length + 1;
1531
+ }
1532
+ });
1533
+ const lineMetrics = alignLinesInGroup(group, maxGroupWidth, wordSpacing);
1534
+ const progress = Math.min(
1535
+ 1,
1536
+ (currentTime - currentChunk[0].startTime) / 0.2
1537
+ );
1538
+ group.offsetX(maxGroupWidth / 2);
1539
+ group.offsetY(groupHeight / 2);
1540
+ group.x(width / 2);
1541
+ group.y(
1542
+ getCaptionsGroupY(
1543
+ groupHeight,
1544
+ width,
1545
+ height,
1546
+ captionsSettings.position,
1547
+ captionsSettings.positionTopOffset ?? 0,
1548
+ toCoef ?? 1
1549
+ )
1550
+ );
1551
+ animate(
1552
+ captionsSettings,
1553
+ progress,
1554
+ {
1555
+ group,
1556
+ width: maxGroupWidth,
1557
+ height: groupHeight
1558
+ },
1559
+ current
1560
+ );
1561
+ if (showDebugBoundingBoxes) {
1562
+ drawDebugBoundingBox(group, maxGroupWidth, groupHeight, "#ff4081");
1563
+ lineMetrics.forEach(({ line: line2, width: width2, height: height2 }) => {
1564
+ drawDebugBoundingBox(line2, width2, height2, "#2196f3", [4, 3]);
1565
+ });
1566
+ }
1567
+ if (current?.text && captionsSettings.animation === "box-word") {
1568
+ current.text?.zIndex(10);
1569
+ }
1570
+ layer.add(group);
1571
+ }
1572
+ layer.draw();
1573
+ };
1574
+
1575
+ // src/captions/Captions.ts
1576
+ var Captions = class {
1577
+ /**
1578
+ * Create a controller bound to the provided video element and preset.
1579
+ *
1580
+ * @param options - Complete configuration for the controller.
1581
+ */
1582
+ constructor(options) {
1583
+ this.enabled = false;
1584
+ this.ownsContainer = false;
1585
+ this.stage = null;
1586
+ this.layer = null;
1587
+ this.animationFrameId = null;
1588
+ this.videoWidth = 0;
1589
+ this.videoHeight = 0;
1590
+ this.handleResize = () => {
1591
+ this.syncStageDimensions();
1592
+ };
1593
+ this.handleMetadata = () => {
1594
+ this.syncStageDimensions();
1595
+ };
1596
+ this.animationLoop = () => {
1597
+ this.updateFrame();
1598
+ this.animationFrameId = requestAnimationFrame(this.animationLoop);
1599
+ };
1600
+ if (!options.video) {
1601
+ throw new Error("captionsjs requires a video element");
1602
+ }
1603
+ this.video = options.video;
1604
+ this.providedContainer = options.container;
1605
+ this.presetState = options.preset;
1606
+ this.captionsState = options.captions ?? null;
1607
+ this.debug = options.debug ?? false;
1608
+ if (options.autoEnable ?? true) {
1609
+ this.enable();
1610
+ }
1611
+ }
1612
+ /**
1613
+ * Mount caption overlays onto the configured video if they are not active yet.
1614
+ */
1615
+ enable() {
1616
+ if (this.enabled) {
1617
+ return;
1618
+ }
1619
+ this.containerElement = this.providedContainer ?? this.createOverlay();
1620
+ this.ownsContainer = !this.providedContainer;
1621
+ this.stage = new import_konva5.default.Stage({
1622
+ container: this.containerElement
1623
+ });
1624
+ this.layer = new import_konva5.default.Layer({ listening: false });
1625
+ this.stage.add(this.layer);
1626
+ this.videoWidth = this.video.videoWidth;
1627
+ this.videoHeight = this.video.videoHeight;
1628
+ window.addEventListener("resize", this.handleResize);
1629
+ if (typeof ResizeObserver !== "undefined") {
1630
+ this.resizeObserver = new ResizeObserver(this.handleResize);
1631
+ this.resizeObserver.observe(this.video);
1632
+ }
1633
+ this.video.addEventListener("loadedmetadata", this.handleMetadata);
1634
+ this.syncStageDimensions();
1635
+ this.animationFrameId = requestAnimationFrame(this.animationLoop);
1636
+ this.enabled = true;
1637
+ void this.refreshFrame();
1638
+ }
1639
+ /**
1640
+ * Tear down overlays, observers and animation loops to free resources.
1641
+ */
1642
+ disable() {
1643
+ if (!this.enabled) {
1644
+ return;
1645
+ }
1646
+ if (this.animationFrameId !== null) {
1647
+ cancelAnimationFrame(this.animationFrameId);
1648
+ this.animationFrameId = null;
1649
+ }
1650
+ window.removeEventListener("resize", this.handleResize);
1651
+ this.video.removeEventListener("loadedmetadata", this.handleMetadata);
1652
+ this.resizeObserver?.disconnect();
1653
+ this.resizeObserver = void 0;
1654
+ if (this.ownsContainer && this.containerElement?.parentElement) {
1655
+ this.containerElement.parentElement.removeChild(this.containerElement);
1656
+ }
1657
+ this.stage?.destroy();
1658
+ this.stage = null;
1659
+ this.layer = null;
1660
+ this.containerElement = void 0;
1661
+ this.ownsContainer = false;
1662
+ this.enabled = false;
1663
+ }
1664
+ /**
1665
+ * Alias for {@link Captions.disable | disable()} to match typical imperative controller APIs.
1666
+ */
1667
+ destroy() {
1668
+ this.disable();
1669
+ }
1670
+ /**
1671
+ * Swap the active preset and re-render with updated typography/colors.
1672
+ *
1673
+ * @param nextPreset - Preset that becomes the new render baseline.
1674
+ */
1675
+ preset(nextPreset) {
1676
+ this.presetState = nextPreset;
1677
+ if (!this.enabled) {
1678
+ return;
1679
+ }
1680
+ void this.refreshFrame();
1681
+ }
1682
+ /**
1683
+ * Replace the current caption track and repaint without reloading fonts.
1684
+ *
1685
+ * @param nextCaptions - Timed words that should drive the overlay.
1686
+ */
1687
+ captions(nextCaptions) {
1688
+ this.captionsState = nextCaptions;
1689
+ if (!this.enabled) {
1690
+ return;
1691
+ }
1692
+ void this.refreshFrame(false);
1693
+ }
1694
+ /**
1695
+ * Whether the Konva overlay is currently attached to the video element.
1696
+ *
1697
+ * @returns `true` when the overlay is mounted on top of the video.
1698
+ */
1699
+ isEnabled() {
1700
+ return this.enabled;
1701
+ }
1702
+ async refreshFrame(loadFont = true) {
1703
+ if (!this.layer || !this.stage) {
1704
+ return;
1705
+ }
1706
+ if (loadFont) {
1707
+ await this.loadFontForCurrentPreset();
1708
+ }
1709
+ this.updateFrame();
1710
+ }
1711
+ async loadFontForCurrentPreset() {
1712
+ const fontFamily = this.presetState.captionsSettings.style.font.fontFamily;
1713
+ await loadGoogleFont2(fontFamily);
1714
+ }
1715
+ updateFrame() {
1716
+ if (!this.layer || !this.stage) {
1717
+ return;
1718
+ }
1719
+ if (!this.videoWidth || !this.videoHeight) {
1720
+ return;
1721
+ }
1722
+ this.layer.destroyChildren();
1723
+ renderFrame(
1724
+ this.presetState.captionsSettings,
1725
+ void 0,
1726
+ this.captionsState || [],
1727
+ this.video.currentTime,
1728
+ [this.videoWidth, this.videoHeight],
1729
+ this.layer,
1730
+ 2,
1731
+ this.debug
1732
+ );
1733
+ }
1734
+ syncStageDimensions() {
1735
+ if (!this.stage) {
1736
+ return;
1737
+ }
1738
+ const currentVideoWidth = this.video.videoWidth || this.videoWidth;
1739
+ const currentVideoHeight = this.video.videoHeight || this.videoHeight;
1740
+ if (!currentVideoWidth || !currentVideoHeight) {
1741
+ return;
1742
+ }
1743
+ this.videoWidth = currentVideoWidth;
1744
+ this.videoHeight = currentVideoHeight;
1745
+ this.stage.width(this.videoWidth);
1746
+ this.stage.height(this.videoHeight);
1747
+ const rect = this.video.getBoundingClientRect();
1748
+ const stageContainer = this.stage.container();
1749
+ const displayWidth = rect.width || stageContainer.offsetWidth || this.videoWidth;
1750
+ const displayHeight = rect.height || stageContainer.offsetHeight || this.videoHeight;
1751
+ if (displayWidth && displayHeight) {
1752
+ stageContainer.style.width = `${displayWidth}px`;
1753
+ stageContainer.style.height = `${displayHeight}px`;
1754
+ const scaleX = displayWidth / this.videoWidth;
1755
+ const scaleY = displayHeight / this.videoHeight;
1756
+ this.stage.scale({ x: scaleX, y: scaleY });
1757
+ } else {
1758
+ this.stage.scale({ x: 1, y: 1 });
1759
+ stageContainer.style.width = `${this.videoWidth}px`;
1760
+ stageContainer.style.height = `${this.videoHeight}px`;
1761
+ }
1762
+ this.stage.batchDraw();
1763
+ }
1764
+ createOverlay() {
1765
+ const container = document.createElement("div");
1766
+ container.style.position = "absolute";
1767
+ container.style.top = "0";
1768
+ container.style.left = "0";
1769
+ container.style.width = "100%";
1770
+ container.style.height = "100%";
1771
+ container.style.pointerEvents = "none";
1772
+ const parent = this.video.parentElement;
1773
+ parent?.appendChild(container);
1774
+ if (parent) {
1775
+ parent.style.position = "relative";
1776
+ }
1777
+ return container;
1778
+ }
1779
+ };
1780
+ function captionsjs(options) {
1781
+ return new Captions(options);
1782
+ }
1783
+
1784
+ // src/index.ts
26
1785
  function renderCaptions(ctx, text) {
27
- ctx.font = "24px sans-serif";
28
- ctx.fillStyle = "#17c499ff";
1786
+ ctx.font = "48px sans-serif";
1787
+ ctx.fillStyle = "red";
29
1788
  ctx.fillText(text, 150, 50);
30
1789
  return true;
31
1790
  }
1791
+ var index_default = captionsjs;
32
1792
  // Annotate the CommonJS export names for ESM import in node:
33
1793
  0 && (module.exports = {
34
- renderCaptions
1794
+ Captions,
1795
+ captionsjs,
1796
+ googleFontsList,
1797
+ renderCaptions,
1798
+ renderString,
1799
+ stylePresets
35
1800
  });