vidply 1.0.28 → 1.0.30

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.
Files changed (75) hide show
  1. package/dist/dev/vidply.HLSRenderer-UMPUDSYL.js +266 -0
  2. package/dist/dev/vidply.HLSRenderer-UMPUDSYL.js.map +7 -0
  3. package/dist/dev/vidply.HTML5Renderer-FXBZQL6Y.js +12 -0
  4. package/dist/dev/vidply.HTML5Renderer-FXBZQL6Y.js.map +7 -0
  5. package/dist/dev/{vidply.TranscriptManager-QSF2PWUN.js → vidply.TranscriptManager-T677KF4N.js} +4 -5
  6. package/dist/dev/{vidply.TranscriptManager-QSF2PWUN.js.map → vidply.TranscriptManager-T677KF4N.js.map} +2 -2
  7. package/dist/dev/{vidply.chunk-SRM7VNHG.js → vidply.chunk-GS2JX5RQ.js} +136 -95
  8. package/dist/dev/vidply.chunk-GS2JX5RQ.js.map +7 -0
  9. package/dist/dev/vidply.chunk-W2LSBD6Y.js +251 -0
  10. package/dist/dev/vidply.chunk-W2LSBD6Y.js.map +7 -0
  11. package/dist/dev/vidply.esm.js +1880 -258
  12. package/dist/dev/vidply.esm.js.map +4 -4
  13. package/dist/legacy/vidply.js +2056 -365
  14. package/dist/legacy/vidply.js.map +4 -4
  15. package/dist/legacy/vidply.min.js +1 -1
  16. package/dist/legacy/vidply.min.meta.json +111 -25
  17. package/dist/prod/vidply.HLSRenderer-3CG7BZKA.min.js +6 -0
  18. package/dist/prod/vidply.HTML5Renderer-KKW3OLHM.min.js +6 -0
  19. package/dist/prod/vidply.TranscriptManager-WFZSW6NR.min.js +6 -0
  20. package/dist/prod/vidply.chunk-34RH2THY.min.js +6 -0
  21. package/dist/prod/vidply.chunk-LGTJRPUL.min.js +6 -0
  22. package/dist/prod/vidply.esm.min.js +8 -8
  23. package/dist/vidply.css +20 -1
  24. package/dist/vidply.esm.min.meta.json +120 -34
  25. package/dist/vidply.min.css +1 -1
  26. package/package.json +2 -2
  27. package/src/controls/ControlBar.js +182 -10
  28. package/src/controls/TranscriptManager.js +7 -7
  29. package/src/core/AudioDescriptionManager.js +701 -0
  30. package/src/core/Player.js +203 -256
  31. package/src/core/SignLanguageManager.js +1134 -0
  32. package/src/renderers/HTML5Renderer.js +7 -0
  33. package/src/styles/vidply.css +20 -1
  34. package/src/utils/DOMUtils.js +153 -114
  35. package/src/utils/MenuFactory.js +374 -0
  36. package/src/utils/VideoFrameCapture.js +110 -0
  37. package/dist/dev/vidply.TranscriptManager-GZKY44ON.js +0 -1744
  38. package/dist/dev/vidply.TranscriptManager-GZKY44ON.js.map +0 -7
  39. package/dist/dev/vidply.TranscriptManager-UTJBQC5B.js +0 -1744
  40. package/dist/dev/vidply.TranscriptManager-UTJBQC5B.js.map +0 -7
  41. package/dist/dev/vidply.chunk-5663PYKK.js +0 -1631
  42. package/dist/dev/vidply.chunk-5663PYKK.js.map +0 -7
  43. package/dist/dev/vidply.chunk-SRM7VNHG.js.map +0 -7
  44. package/dist/dev/vidply.chunk-UH5MTGKF.js +0 -1630
  45. package/dist/dev/vidply.chunk-UH5MTGKF.js.map +0 -7
  46. package/dist/dev/vidply.de-RXAJM5QE.js +0 -181
  47. package/dist/dev/vidply.de-RXAJM5QE.js.map +0 -7
  48. package/dist/dev/vidply.de-THBIMP4S.js +0 -180
  49. package/dist/dev/vidply.de-THBIMP4S.js.map +0 -7
  50. package/dist/dev/vidply.es-6VWDNNNL.js +0 -180
  51. package/dist/dev/vidply.es-6VWDNNNL.js.map +0 -7
  52. package/dist/dev/vidply.es-SADVLJTQ.js +0 -181
  53. package/dist/dev/vidply.es-SADVLJTQ.js.map +0 -7
  54. package/dist/dev/vidply.fr-V3VAYBBT.js +0 -181
  55. package/dist/dev/vidply.fr-V3VAYBBT.js.map +0 -7
  56. package/dist/dev/vidply.fr-WHTWCHWT.js +0 -180
  57. package/dist/dev/vidply.fr-WHTWCHWT.js.map +0 -7
  58. package/dist/dev/vidply.ja-BFQNPOFI.js +0 -180
  59. package/dist/dev/vidply.ja-BFQNPOFI.js.map +0 -7
  60. package/dist/dev/vidply.ja-KL2TLZGJ.js +0 -181
  61. package/dist/dev/vidply.ja-KL2TLZGJ.js.map +0 -7
  62. package/dist/prod/vidply.TranscriptManager-DZ2WZU3K.min.js +0 -6
  63. package/dist/prod/vidply.TranscriptManager-E5QHGFIR.min.js +0 -6
  64. package/dist/prod/vidply.TranscriptManager-UZ6DUFB6.min.js +0 -6
  65. package/dist/prod/vidply.chunk-5DWTMWEO.min.js +0 -6
  66. package/dist/prod/vidply.chunk-IBNYTGGM.min.js +0 -6
  67. package/dist/prod/vidply.chunk-MBUR3U5L.min.js +0 -6
  68. package/dist/prod/vidply.de-HGJBCLLE.min.js +0 -6
  69. package/dist/prod/vidply.de-SWFW4HYT.min.js +0 -6
  70. package/dist/prod/vidply.es-7BJ2DJAY.min.js +0 -6
  71. package/dist/prod/vidply.es-CZEBXCZN.min.js +0 -6
  72. package/dist/prod/vidply.fr-DPVR5DFY.min.js +0 -6
  73. package/dist/prod/vidply.fr-HFOL7MWA.min.js +0 -6
  74. package/dist/prod/vidply.ja-PEBVWKVH.min.js +0 -6
  75. package/dist/prod/vidply.ja-QTVU5C25.min.js +0 -6
@@ -1,181 +0,0 @@
1
- /*!
2
- * Universal, Accessible Video Player
3
- * (c) 2025 Matthias Peltzer
4
- * Released under GPL-2.0-or-later License
5
- */
6
-
7
- // src/i18n/languages/ja.js
8
- var ja = {
9
- player: {
10
- label: "ビデオプレーヤー",
11
- play: "再生",
12
- pause: "一時停止",
13
- stop: "停止",
14
- restart: "最初から再生",
15
- rewind: "巻き戻し",
16
- forward: "早送り",
17
- rewindSeconds: "{seconds}秒戻す",
18
- forwardSeconds: "{seconds}秒進める",
19
- previous: "前のトラック",
20
- next: "次のトラック",
21
- playlist: "プレイリストの切り替え",
22
- volume: "音量",
23
- mute: "ミュート",
24
- unmute: "ミュート解除",
25
- fullscreen: "全画面表示",
26
- exitFullscreen: "全画面表示を終了",
27
- captions: "字幕",
28
- chapters: "チャプター",
29
- quality: "画質",
30
- captionStyling: "字幕スタイル",
31
- transcript: "文字起こし切り替え",
32
- audioDescription: "音声解説",
33
- signLanguage: "手話動画",
34
- settings: "設定",
35
- speed: "再生速度",
36
- pip: "ピクチャーインピクチャー",
37
- currentTime: "現在の時間",
38
- duration: "再生時間",
39
- progress: "進行状況",
40
- seekForward: "{seconds}秒進める",
41
- seekBackward: "{seconds}秒戻す",
42
- volumeUp: "音量を上げる",
43
- volumeDown: "音量を下げる",
44
- loading: "読み込み中...",
45
- loadingChapters: "チャプター読み込み中...",
46
- error: "読み込みエラー",
47
- buffering: "バッファリング中...",
48
- signLanguageVideo: "手話動画",
49
- closeSignLanguage: "手話動画を閉じる",
50
- signLanguageSettings: "手話設定",
51
- noChapters: "チャプターがありません",
52
- noCaptions: "字幕がありません",
53
- auto: "自動",
54
- autoQuality: "自動(画質選択不可)",
55
- noQuality: "画質選択不可",
56
- signLanguageDragResize: "手話動画 - キーボードでドラッグするにはDキーを、サイズ変更するにはRキーを押してください",
57
- signLanguageDragActive: "手話動画 - ドラッグモードが有効です。矢印キーで移動、Escapeで終了します。",
58
- signLanguageResizeActive: "手話動画 - サイズ変更モードが有効です。左右の矢印キーでサイズ変更、Escapeで終了します。",
59
- enableSignDragMode: "ドラッグモードを有効にする。ショートカット:Dキー",
60
- disableSignDragMode: "ドラッグモードを無効にする。ショートカット:Dキー",
61
- enableSignDragModeAria: "矢印キーでキーボードドラッグモードを有効にする。ショートカット:Dキー",
62
- disableSignDragModeAria: "矢印キーでキーボードドラッグモードを無効にする。ショートカット:Dキー",
63
- enableSignResizeMode: "サイズ変更モードを有効にする。ショートカット:Rキー",
64
- disableSignResizeMode: "サイズ変更モードを無効にする。ショートカット:Rキー",
65
- enableSignResizeModeAria: "矢印キーでキーボードサイズ変更モードを有効にする。ショートカット:Rキー",
66
- disableSignResizeModeAria: "矢印キーでキーボードサイズ変更モードを無効にする。ショートカット:Rキー",
67
- resizeHandle: "{direction}コーナーのサイズ変更",
68
- moreOptions: "その他のオプション",
69
- noMoreOptions: "追加のオプションはありません"
70
- },
71
- captions: {
72
- off: "オフ",
73
- select: "字幕を選択",
74
- fontSize: "フォントサイズ",
75
- fontFamily: "フォント",
76
- color: "テキストの色",
77
- backgroundColor: "背景色",
78
- opacity: "不透明度"
79
- },
80
- fontSizes: {
81
- small: "小",
82
- normal: "標準",
83
- large: "大",
84
- xlarge: "特大"
85
- },
86
- fontFamilies: {
87
- sansSerif: "サンセリフ",
88
- serif: "セリフ",
89
- monospace: "等幅"
90
- },
91
- styleLabels: {
92
- textColor: "テキストの色",
93
- background: "背景",
94
- font: "フォント",
95
- fontSize: "フォントサイズ",
96
- opacity: "不透明度"
97
- },
98
- audioDescription: {
99
- enable: "音声解説を有効にする",
100
- disable: "音声解説を無効にする"
101
- },
102
- signLanguage: {
103
- show: "手話動画を表示",
104
- hide: "手話動画を非表示"
105
- },
106
- transcript: {
107
- title: "文字起こし",
108
- close: "文字起こしを閉じる",
109
- loading: "文字起こしを読み込み中...",
110
- noTranscript: "このビデオの文字起こしはありません。",
111
- settings: "文字起こし設定。Enterキーでメニューを開く、またはDキーでドラッグモードを有効にする",
112
- keyboardDragMode: "矢印キーでキーボードドラッグモードを切り替え。ショートカット:Dキー",
113
- keyboardDragActive: "⌨️ キーボードドラッグモード有効(矢印キーで移動、Shift+矢印キーで大きく移動、DまたはESCで終了)",
114
- dragResizePrompt: "Dキーで移動、Rキーでサイズ変更。Homeで位置をリセット、Escで閉じます。",
115
- dragModeEnabled: "キーボードドラッグモードを有効にしました。矢印キーで移動、Shift+矢印キーで大きく移動できます。終了するには D または Esc を押します。",
116
- dragModeDisabled: "キーボードドラッグモードを無効にしました。",
117
- enableDragMode: "ドラッグモードを有効にする。ショートカット:Dキー",
118
- disableDragMode: "ドラッグモードを無効にする。ショートカット:Dキー",
119
- enableDragModeAria: "矢印キーでキーボードドラッグモードを有効にする。ショートカット:Dキー",
120
- disableDragModeAria: "矢印キーでキーボードドラッグモードを無効にする。ショートカット:Dキー",
121
- resizeWindow: "ウィンドウのサイズ変更",
122
- disableResizeWindow: "サイズ変更モードを無効にする",
123
- enableResizeMode: "サイズ変更モードを有効にする。ショートカット:Rキー",
124
- disableResizeMode: "サイズ変更モードを無効にする。ショートカット:Rキー",
125
- enableResizeModeAria: "矢印キーでキーボードサイズ変更モードを有効にする。ショートカット:Rキー",
126
- disableResizeModeAria: "矢印キーでキーボードサイズ変更モードを無効にする。ショートカット:Rキー",
127
- resizeModeHint: "リサイズハンドルが有効になりました。辺や角をドラッグして調整します。Esc または R で終了します。",
128
- resizeModeEnabled: "サイズ変更モードを有効にしました。辺や角をドラッグして調整します。Esc または R で終了します。",
129
- resizeModeDisabled: "サイズ変更モードを無効にしました。",
130
- positionReset: "文字起こしの位置をリセットしました。",
131
- styleTranscript: "文字起こしスタイル設定を開く",
132
- closeMenu: "メニューを閉じる",
133
- styleTitle: "文字起こしスタイル",
134
- autoscroll: "自動スクロール",
135
- settingsMenu: "文字起こしダイアログ設定",
136
- showTimestamps: "タイムスタンプを表示",
137
- hideTimestamps: "タイムスタンプを非表示",
138
- showTimestampsAria: "文字起こしにタイムスタンプを表示",
139
- hideTimestampsAria: "文字起こしのタイムスタンプを非表示"
140
- },
141
- settings: {
142
- title: "設定",
143
- quality: "画質",
144
- speed: "速度",
145
- captions: "字幕",
146
- language: "言語",
147
- reset: "リセット",
148
- close: "閉じる"
149
- },
150
- speeds: {
151
- normal: "通常"
152
- },
153
- time: {
154
- display: "時間表示",
155
- durationPrefix: "再生時間: ",
156
- of: "/",
157
- hour: "{count}時間",
158
- hours: "{count}時間",
159
- minute: "{count}分",
160
- minutes: "{count}分",
161
- second: "{count}秒",
162
- seconds: "{count}秒"
163
- },
164
- playlist: {
165
- title: "プレイリスト",
166
- trackOf: "トラック {current}/{total}",
167
- nowPlaying: "再生中: トラック {current}/{total}. {title}{artist}",
168
- by: " - ",
169
- untitled: "タイトルなし",
170
- trackUntitled: "トラック {number}",
171
- currentlyPlaying: "再生中",
172
- notPlaying: "停止中",
173
- pressEnterPlay: "Enterキーで再生",
174
- pressEnterRestart: "Enterキーで最初から再生",
175
- keyboardInstructions: "プレイリストナビゲーション:上下の矢印キーでトラック間を移動します。Page UpまたはPage Downで5トラックをスキップします。Homeで最初のトラックへ、Endで最後のトラックへ移動します。EnterまたはSpaceで選択したトラックを再生します。"
176
- }
177
- };
178
- export {
179
- ja
180
- };
181
- //# sourceMappingURL=vidply.ja-KL2TLZGJ.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/i18n/languages/ja.js"],
4
- "sourcesContent": ["/**\r\n * Japanese translations for VidPly\r\n */\r\n\r\nexport const ja = {\r\n player: {\r\n label: 'ビデオプレーヤー',\r\n play: '再生',\r\n pause: '一時停止',\r\n stop: '停止',\r\n restart: '最初から再生',\r\n rewind: '巻き戻し',\r\n forward: '早送り',\r\n rewindSeconds: '{seconds}秒戻す',\r\n forwardSeconds: '{seconds}秒進める',\r\n previous: '前のトラック',\r\n next: '次のトラック',\r\n playlist: 'プレイリストの切り替え',\r\n volume: '音量',\r\n mute: 'ミュート',\r\n unmute: 'ミュート解除',\r\n fullscreen: '全画面表示',\r\n exitFullscreen: '全画面表示を終了',\r\n captions: '字幕',\r\n chapters: 'チャプター',\r\n quality: '画質',\r\n captionStyling: '字幕スタイル',\r\n transcript: '文字起こし切り替え',\r\n audioDescription: '音声解説',\r\n signLanguage: '手話動画',\r\n settings: '設定',\r\n speed: '再生速度',\r\n pip: 'ピクチャーインピクチャー',\r\n currentTime: '現在の時間',\r\n duration: '再生時間',\r\n progress: '進行状況',\r\n seekForward: '{seconds}秒進める',\r\n seekBackward: '{seconds}秒戻す',\r\n volumeUp: '音量を上げる',\r\n volumeDown: '音量を下げる',\r\n loading: '読み込み中...',\r\n loadingChapters: 'チャプター読み込み中...',\r\n error: '読み込みエラー',\r\n buffering: 'バッファリング中...',\r\n signLanguageVideo: '手話動画',\r\n closeSignLanguage: '手話動画を閉じる',\r\n signLanguageSettings: '手話設定',\r\n noChapters: 'チャプターがありません',\r\n noCaptions: '字幕がありません',\r\n auto: '自動',\r\n autoQuality: '自動(画質選択不可)',\r\n noQuality: '画質選択不可',\r\n signLanguageDragResize: '手話動画 - キーボードでドラッグするにはDキーを、サイズ変更するにはRキーを押してください',\r\n signLanguageDragActive: '手話動画 - ドラッグモードが有効です。矢印キーで移動、Escapeで終了します。',\r\n signLanguageResizeActive: '手話動画 - サイズ変更モードが有効です。左右の矢印キーでサイズ変更、Escapeで終了します。',\r\n enableSignDragMode: 'ドラッグモードを有効にする。ショートカット:Dキー',\r\n disableSignDragMode: 'ドラッグモードを無効にする。ショートカット:Dキー',\r\n enableSignDragModeAria: '矢印キーでキーボードドラッグモードを有効にする。ショートカット:Dキー',\r\n disableSignDragModeAria: '矢印キーでキーボードドラッグモードを無効にする。ショートカット:Dキー',\r\n enableSignResizeMode: 'サイズ変更モードを有効にする。ショートカット:Rキー',\r\n disableSignResizeMode: 'サイズ変更モードを無効にする。ショートカット:Rキー',\r\n enableSignResizeModeAria: '矢印キーでキーボードサイズ変更モードを有効にする。ショートカット:Rキー',\r\n disableSignResizeModeAria: '矢印キーでキーボードサイズ変更モードを無効にする。ショートカット:Rキー',\r\n resizeHandle: '{direction}コーナーのサイズ変更',\r\n moreOptions: 'その他のオプション',\r\n noMoreOptions: '追加のオプションはありません'\r\n },\r\n captions: {\r\n off: 'オフ',\r\n select: '字幕を選択',\r\n fontSize: 'フォントサイズ',\r\n fontFamily: 'フォント',\r\n color: 'テキストの色',\r\n backgroundColor: '背景色',\r\n opacity: '不透明度'\r\n },\r\n fontSizes: {\r\n small: '小',\r\n normal: '標準',\r\n large: '大',\r\n xlarge: '特大'\r\n },\r\n fontFamilies: {\r\n sansSerif: 'サンセリフ',\r\n serif: 'セリフ',\r\n monospace: '等幅'\r\n },\r\n styleLabels: {\r\n textColor: 'テキストの色',\r\n background: '背景',\r\n font: 'フォント',\r\n fontSize: 'フォントサイズ',\r\n opacity: '不透明度'\r\n },\r\n audioDescription: {\r\n enable: '音声解説を有効にする',\r\n disable: '音声解説を無効にする'\r\n },\r\n signLanguage: {\r\n show: '手話動画を表示',\r\n hide: '手話動画を非表示'\r\n },\r\n transcript: {\r\n title: '文字起こし',\r\n close: '文字起こしを閉じる',\r\n loading: '文字起こしを読み込み中...',\r\n noTranscript: 'このビデオの文字起こしはありません。',\r\n settings: '文字起こし設定。Enterキーでメニューを開く、またはDキーでドラッグモードを有効にする',\r\n keyboardDragMode: '矢印キーでキーボードドラッグモードを切り替え。ショートカット:Dキー',\r\n keyboardDragActive: '⌨️ キーボードドラッグモード有効(矢印キーで移動、Shift+矢印キーで大きく移動、DまたはESCで終了)',\r\n dragResizePrompt: 'Dキーで移動、Rキーでサイズ変更。Homeで位置をリセット、Escで閉じます。',\r\n dragModeEnabled: 'キーボードドラッグモードを有効にしました。矢印キーで移動、Shift+矢印キーで大きく移動できます。終了するには D または Esc を押します。',\r\n dragModeDisabled: 'キーボードドラッグモードを無効にしました。',\r\n enableDragMode: 'ドラッグモードを有効にする。ショートカット:Dキー',\r\n disableDragMode: 'ドラッグモードを無効にする。ショートカット:Dキー',\r\n enableDragModeAria: '矢印キーでキーボードドラッグモードを有効にする。ショートカット:Dキー',\r\n disableDragModeAria: '矢印キーでキーボードドラッグモードを無効にする。ショートカット:Dキー',\r\n resizeWindow: 'ウィンドウのサイズ変更',\r\n disableResizeWindow: 'サイズ変更モードを無効にする',\r\n enableResizeMode: 'サイズ変更モードを有効にする。ショートカット:Rキー',\r\n disableResizeMode: 'サイズ変更モードを無効にする。ショートカット:Rキー',\r\n enableResizeModeAria: '矢印キーでキーボードサイズ変更モードを有効にする。ショートカット:Rキー',\r\n disableResizeModeAria: '矢印キーでキーボードサイズ変更モードを無効にする。ショートカット:Rキー',\r\n resizeModeHint: 'リサイズハンドルが有効になりました。辺や角をドラッグして調整します。Esc または R で終了します。',\r\n resizeModeEnabled: 'サイズ変更モードを有効にしました。辺や角をドラッグして調整します。Esc または R で終了します。',\r\n resizeModeDisabled: 'サイズ変更モードを無効にしました。',\r\n positionReset: '文字起こしの位置をリセットしました。',\r\n styleTranscript: '文字起こしスタイル設定を開く',\r\n closeMenu: 'メニューを閉じる',\r\n styleTitle: '文字起こしスタイル',\r\n autoscroll: '自動スクロール',\r\n settingsMenu: '文字起こしダイアログ設定',\r\n showTimestamps: 'タイムスタンプを表示',\r\n hideTimestamps: 'タイムスタンプを非表示',\r\n showTimestampsAria: '文字起こしにタイムスタンプを表示',\r\n hideTimestampsAria: '文字起こしのタイムスタンプを非表示'\r\n },\r\n settings: {\r\n title: '設定',\r\n quality: '画質',\r\n speed: '速度',\r\n captions: '字幕',\r\n language: '言語',\r\n reset: 'リセット',\r\n close: '閉じる'\r\n },\r\n speeds: {\r\n normal: '通常'\r\n },\r\n time: {\r\n display: '時間表示',\r\n durationPrefix: '再生時間: ',\r\n of: '/',\r\n hour: '{count}時間',\r\n hours: '{count}時間',\r\n minute: '{count}分',\r\n minutes: '{count}分',\r\n second: '{count}秒',\r\n seconds: '{count}秒'\r\n },\r\n playlist: {\r\n title: 'プレイリスト',\r\n trackOf: 'トラック {current}/{total}',\r\n nowPlaying: '再生中: トラック {current}/{total}. {title}{artist}',\r\n by: ' - ',\r\n untitled: 'タイトルなし',\r\n trackUntitled: 'トラック {number}',\r\n currentlyPlaying: '再生中',\r\n notPlaying: '停止中',\r\n pressEnterPlay: 'Enterキーで再生',\r\n pressEnterRestart: 'Enterキーで最初から再生',\r\n keyboardInstructions: 'プレイリストナビゲーション:上下の矢印キーでトラック間を移動します。Page UpまたはPage Downで5トラックをスキップします。Homeで最初のトラックへ、Endで最後のトラックへ移動します。EnterまたはSpaceで選択したトラックを再生します。'\r\n }\r\n};\r\n\r\n"],
5
- "mappings": ";;;;;;;AAIO,IAAM,KAAK;AAAA,EAChB,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,UAAU;AAAA,IACV,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,IACb,UAAU;AAAA,IACV,UAAU;AAAA,IACV,aAAa;AAAA,IACb,cAAc;AAAA,IACd,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW;AAAA,IACX,wBAAwB;AAAA,IACxB,wBAAwB;AAAA,IACxB,0BAA0B;AAAA,IAC1B,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,wBAAwB;AAAA,IACxB,yBAAyB;AAAA,IACzB,sBAAsB;AAAA,IACtB,uBAAuB;AAAA,IACvB,0BAA0B;AAAA,IAC1B,2BAA2B;AAAA,IAC3B,cAAc;AAAA,IACd,aAAa;AAAA,IACb,eAAe;AAAA,EACjB;AAAA,EACA,UAAU;AAAA,IACR,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,EACX;AAAA,EACA,kBAAkB;AAAA,IAChB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,YAAY;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA,IACT,cAAc;AAAA,IACd,UAAU;AAAA,IACV,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,cAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,sBAAsB;AAAA,IACtB,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,EACtB;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,sBAAsB;AAAA,EACxB;AACF;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- /*!
2
- * Universal, Accessible Video Player
3
- * (c) 2025 Matthias Peltzer
4
- * Released under GPL-2.0-or-later License
5
- */
6
- import{a as l,b as r,c as M,d as b,f as v,h as C,i as P,j as f,k as w,m as S,n as z}from"./vidply.chunk-5DWTMWEO.min.js";var W=class{constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new C("vidply"),this.draggableResizable=null,this.settingsMenuVisible=!1,this.settingsMenu=null,this.settingsButton=null,this.settingsMenuJustOpened=!1,this.resizeOptionButton=null,this.resizeOptionText=null,this.dragOptionButton=null,this.dragOptionText=null,this.resizeModeIndicator=null,this.resizeModeIndicatorTimeout=null,this.transcriptResizeHandles=[],this.liveRegion=null,this.styleDialog=null,this.styleDialogVisible=!1,this.styleDialogJustOpened=!1,this.languageSelector=null,this.languageLabel=null,this.currentTranscriptLanguage=null,this.availableTranscriptLanguages=[],this.languageSelectorHandler=null;let i=this.storage.getTranscriptPreferences();this.autoscrollEnabled=i?.autoscroll!==void 0?i.autoscroll:!0,this.showTimestamps=i?.showTimestamps!==void 0?i.showTimestamps:!1,this.transcriptStyle={fontSize:i?.fontSize||this.player.options.transcriptFontSize||"100%",fontFamily:i?.fontFamily||this.player.options.transcriptFontFamily||"sans-serif",color:i?.color||this.player.options.transcriptColor||"#ffffff",backgroundColor:i?.backgroundColor||this.player.options.transcriptBackgroundColor||"#1e1e1e",opacity:i?.opacity??this.player.options.transcriptOpacity??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null},this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),100))})}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.transcriptWindow){this.transcriptWindow.style.display="flex",this.isVisible=!0,this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),v(this.settingsButton,{delay:150});return}this.createTranscriptWindow(),this.loadTranscriptData(),this.transcriptWindow&&(this.transcriptWindow.style.display="flex",(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),0),v(this.settingsButton,{delay:150})),this.isVisible=!0}hideTranscript({focusButton:t=!1}={}){if(this.transcriptWindow&&(this.transcriptWindow.style.display="none",this.isVisible=!1),this.draggableResizable&&this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.hideResizeModeIndicator(),this.announceLive(""),this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),t){let i=this.player.controlBar?.controls?.transcript;i&&typeof i.focus=="function"&&i.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":r.t("transcript.ariaLabel"),tabindex:"-1"}}),this.transcriptHeader=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});let t=r.t("transcript.settingsMenu");this.settingsButton=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":t,"aria-expanded":"false"}}),this.settingsButton.appendChild(b("settings")),l.attachTooltip(this.settingsButton,t,this.player.options.classPrefix),this.handlers.settingsClick=d=>{d.preventDefault(),d.stopPropagation(),this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=d=>{d.key==="d"||d.key==="D"?(d.preventDefault(),d.stopPropagation(),this.toggleKeyboardDragMode()):d.key==="r"||d.key==="R"?(d.preventDefault(),d.stopPropagation(),this.toggleResizeMode()):d.key==="Escape"&&this.settingsMenuVisible&&(d.preventDefault(),d.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);let i=l.createElement("h3",{textContent:`${r.t("transcript.title")}. ${r.t("transcript.dragResizePrompt")}`}),e=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,a=l.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:e}});this.autoscrollCheckbox=l.createElement("input",{attributes:{id:e,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);let n=l.createElement("span",{textContent:r.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});a.appendChild(this.autoscrollCheckbox),a.appendChild(n),this.autoscrollCheckbox.addEventListener("change",d=>{this.autoscrollEnabled=d.target.checked,this.saveAutoscrollPreference()}),this.transcriptHeader.appendChild(i),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(a);let c=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:p,select:o}=S({classPrefix:this.player.options.classPrefix,labelClass:`${this.player.options.classPrefix}-transcript-language-label`,selectClass:`${this.player.options.classPrefix}-transcript-language-select`,labelText:"settings.language",selectId:c,hidden:!1});this.languageLabel=p,this.languageSelector=o;let s=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});s.appendChild(this.languageLabel),s.appendChild(this.languageSelector),this.languageSelectorWrapper=s,z(s),this.headerLeft.appendChild(s);let h=r.t("transcript.close"),u=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":h}});u.appendChild(b("close")),l.attachTooltip(u,h,this.player.options.classPrefix),u.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(u),this.transcriptContent=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=l.createElement("div",{className:"vidply-sr-only",attributes:{"aria-live":"polite","aria-atomic":"true"}}),this.transcriptWindow.appendChild(this.liveRegion),this.player.container.appendChild(this.transcriptWindow),this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript(),this.handlers.documentClick=d=>{this.settingsMenuJustOpened||this.styleDialogJustOpened||this.settingsButton&&this.settingsButton.contains(d.target)||this.settingsMenu&&this.settingsMenu.contains(d.target)||(this.settingsMenuVisible&&this.hideSettingsMenu(),this.styleDialogVisible&&this.styleDialog&&!this.styleDialog.contains(d.target)&&this.hideStyleDialog())},this.documentClickHandlerAdded=!1;let y;this.handlers.resize=()=>{y&&this.clearManagedTimeout(y),y=this.setManagedTimeout(()=>{(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize)}createResizeHandles(){if(!this.transcriptWindow)return;let t=["n","s","e","w","ne","nw","se","sw"];this.transcriptResizeHandles=t.map(i=>{let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${i}`,attributes:{"data-direction":i,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return e.style.display="none",this.transcriptWindow.appendChild(e),e})}positionTranscript(){if(!this.transcriptWindow||!this.player.videoWrapper||!this.isVisible||this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;let t=window.innerWidth<768,i=this.player.videoWrapper.getBoundingClientRect(),e=this.player.state.fullscreen;if(t&&!e)this.transcriptWindow.style.position="relative",this.transcriptWindow.style.left="0",this.transcriptWindow.style.right="0",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.width="100%",this.transcriptWindow.style.maxWidth="100%",this.transcriptWindow.style.maxHeight="400px",this.transcriptWindow.style.height="auto",this.transcriptWindow.style.borderRadius="0",this.transcriptWindow.style.transform="none",this.transcriptWindow.style.border="none",this.transcriptWindow.style.borderTop="1px solid var(--vidply-border-light)",this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptWindow.style.boxShadow="none",this.transcriptHeader&&(this.transcriptHeader.style.cursor="default"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow);else if(e){this.transcriptWindow.style.position="fixed",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right="20px",this.transcriptWindow.style.bottom="80px",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.maxHeight="calc(100vh - 180px)",this.transcriptWindow.style.height="auto";let a=260,n=Math.max(a,window.innerWidth-40),c=parseFloat(this.transcriptWindow.style.width)||400,p=Math.max(a,Math.min(c,n));this.transcriptWindow.style.width=`${p}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}else{let a=parseFloat(this.transcriptWindow.style.width)||400,n=20,c=260,p=this.player.container.getBoundingClientRect();window.getComputedStyle(this.player.container).position==="static"&&(this.player.container.style.position="relative");let s=i.right-p.left+n,h=window.innerWidth-i.right-n,u=Math.max(c,Math.min(a,h)),y=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${s}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${y}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${u}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}}getAvailableTranscriptLanguages(){let t=this.player.textTracks,i=new Map;return t.forEach(e=>{(e.kind==="captions"||e.kind==="subtitles")&&e.language&&(i.has(e.language)||i.set(e.language,{language:e.language,label:e.label||e.language,track:e}))}),Array.from(i.values())}updateLanguageSelector(){if(this.languageSelector){if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),this.languageSelector.innerHTML="",this.availableTranscriptLanguages.length<2){this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none");return}if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach((t,i)=>{let e=l.createElement("option",{textContent:t.label,attributes:{value:t.language,lang:t.language}});this.languageSelector.appendChild(e)}),this.currentTranscriptLanguage)this.languageSelector.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){let t=this.player.textTracks.find(i=>(i.kind==="captions"||i.kind==="subtitles")&&i.mode==="showing");this.currentTranscriptLanguage=t?t.language:this.availableTranscriptLanguages[0].language,this.languageSelector.value=this.currentTranscriptLanguage}this.languageSelectorHandler&&this.languageSelector.removeEventListener("change",this.languageSelectorHandler),this.languageSelectorHandler=t=>{this.currentTranscriptLanguage=t.target.value,this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)},this.languageSelector.addEventListener("change",this.languageSelectorHandler)}}loadTranscriptData(){this.transcriptEntries=[],this.transcriptContent.innerHTML="";let t=this.player.textTracks,i=null;this.currentTranscriptLanguage&&(i=t.find(s=>(s.kind==="captions"||s.kind==="subtitles")&&s.language===this.currentTranscriptLanguage)),i||(i=t.find(s=>s.kind==="captions"||s.kind==="subtitles"),i&&(this.currentTranscriptLanguage=i.language));let e=null;this.currentTranscriptLanguage&&(e=t.find(s=>s.kind==="descriptions"&&s.language===this.currentTranscriptLanguage)),e||(e=t.find(s=>s.kind==="descriptions"));let a=t.find(s=>s.kind==="metadata"),n=e&&this.player.state.audioDescriptionEnabled;if(!i&&!n&&!a){this.showNoTranscriptMessage();return}let c=[i,e,a].filter(Boolean);if(c.forEach(s=>{s.mode==="disabled"&&(s.mode="hidden")}),c.some(s=>!s.cues||s.cues.length===0)){let s=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:r.t("transcript.loading")});this.transcriptContent.appendChild(s);let h=0,u=()=>{h++,h>=c.length&&this.loadTranscriptData()};c.forEach(y=>{y.addEventListener("load",u,{once:!0})}),this.setManagedTimeout(()=>{this.loadTranscriptData()},500);return}let o=[];i&&i.cues&&Array.from(i.cues).forEach(s=>{o.push({cue:s,type:"caption"})}),e&&e.cues&&this.player.state.audioDescriptionEnabled&&Array.from(e.cues).forEach(s=>{o.push({cue:s,type:"description"})}),a&&a.cues&&(this.metadataCues=Array.from(a.cues),this.setupMetadataHandling()),o.sort((s,h)=>s.cue.startTime-h.cue.startTime),o.forEach((s,h)=>{let u=this.createTranscriptEntry(s.cue,h,s.type);this.transcriptEntries.push({element:u,cue:s.cue,type:s.type,startTime:s.cue.startTime,endTime:s.cue.endTime}),this.transcriptContent.appendChild(u)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector()}setupMetadataHandlingOnLoad(){let t=()=>{let e=this.player.textTracks.find(a=>a.kind==="metadata");if(e){if(e.mode==="disabled"&&(e.mode="hidden"),this.metadataCueChangeHandler&&e.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{let a=Array.from(e.activeCues||[]);a.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",a.map(n=>({start:n.startTime,end:n.endTime,text:n.text}))),a.forEach(n=>{this.handleMetadataCue(n)})},e.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug){let a=e.cues?e.cues.length:0;console.log("[VidPly Metadata] Track enabled,",a,"cues available")}}else this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){!this.metadataCues||this.metadataCues.length===0||this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){let i=t.text.trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:i}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:i,cue:t}),i.includes("PAUSE")&&(this.player.state.paused||(this.player.options.debug&&console.log("[VidPly Metadata] Pausing video at",t.startTime),this.player.pause()),this.player.emit("metadata:pause",{time:t.startTime,text:i}));let e=i.match(/FOCUS:([\w#-]+)/);if(e){let n=e[1],c=document.querySelector(n);c?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",n),this.setManagedTimeout(()=>{c.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",n),this.player.emit("metadata:focus",{time:t.startTime,target:n,element:c,text:i})}let a=i.match(/#[\w-]+/g);a&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",a),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:a,text:i}))}createTranscriptEntry(t,i,e="caption"){let a=this.stripVTTFormatting(t.text),n=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${e}`,attributes:{tabindex:"0","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":e}}),c=l.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:M.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),p=l.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:a});n.appendChild(c),n.appendChild(p);let o=()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()};return n.addEventListener("click",o),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),o())}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:r.t("transcript.noTranscript")});this.transcriptContent.appendChild(t)}updateActiveEntry(){if(!this.isVisible||this.transcriptEntries.length===0)return;let t=this.player.state.currentTime,i=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);i&&i!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),i.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(i.element),this.currentActiveEntry=i):!i&&this.currentActiveEntry&&(this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),this.currentActiveEntry=null)}scrollToEntry(t){if(!this.transcriptContent||!this.autoscrollEnabled)return;let i=this.transcriptContent.getBoundingClientRect(),e=t.getBoundingClientRect();if(e.top<i.top||e.bottom>i.bottom){let a=t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2;this.transcriptContent.scrollTo({top:a,behavior:"smooth"})}}saveAutoscrollPreference(){let t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;let t=window.innerWidth<768,i=this.player.state.fullscreen;if(t&&!i){this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null);return}this.draggableResizable||(this.draggableResizable=new P(this.transcriptWindow,{dragHandle:this.transcriptHeader,resizeHandles:this.transcriptResizeHandles,constrainToViewport:!0,classPrefix:`${this.player.options.classPrefix}-transcript`,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:10,keyboardStepLarge:50,minWidth:300,minHeight:200,maxWidth:()=>Math.max(320,window.innerWidth-40),maxHeight:()=>Math.max(200,window.innerHeight-120),pointerResizeIndicatorText:r.t("transcript.resizeModeHint"),onPointerResizeToggle:e=>{this.transcriptResizeHandles.forEach(a=>{a.style.display=e?"block":"none"}),this.onPointerResizeModeChange(e)},onDragStart:e=>{let a=[`.${this.player.options.classPrefix}-transcript-close`,`.${this.player.options.classPrefix}-transcript-settings`,`.${this.player.options.classPrefix}-transcript-language-select`,`.${this.player.options.classPrefix}-transcript-language-label`,`.${this.player.options.classPrefix}-transcript-settings-menu`,`.${this.player.options.classPrefix}-transcript-style-dialog`];for(let n of a)if(e.target.closest(n))return!1;return!0}}),this.customKeyHandler=e=>{let a=e.key.toLowerCase(),n=e.defaultPrevented;if(!(this.settingsMenuVisible||this.styleDialogVisible)){if(a==="home"){e.preventDefault(),e.stopPropagation(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(r.t("transcript.positionReset")));return}if(a==="r"){if(n)return;e.preventDefault(),e.stopPropagation(),this.toggleResizeMode()&&this.transcriptWindow.focus({preventScroll:!0});return}if(a==="escape"){if(this.draggableResizable&&this.draggableResizable.pointerResizeMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disablePointerResizeMode();return}if(this.draggableResizable&&this.draggableResizable.keyboardDragMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),this.announceLive(r.t("transcript.dragModeDisabled"));return}e.preventDefault(),e.stopPropagation(),this.hideTranscript({focusButton:!0});return}}},this.transcriptWindow.addEventListener("keydown",this.customKeyHandler))}toggleKeyboardDragMode(){if(this.draggableResizable){let t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();let i=this.draggableResizable.keyboardDragMode;!t&&i&&this.enableMoveMode(),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){if(this.settingsMenuJustOpened=!0,setTimeout(()=>{this.settingsMenuJustOpened=!1},350),this.documentClickHandlerAdded||setTimeout(()=>{document.addEventListener("click",this.handlers.documentClick),this.documentClickHandlerAdded=!0},300),this.settingsMenu){this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.attachSettingsMenuKeyboardNavigation(),this.positionSettingsMenuImmediate(),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50);return}this.settingsMenu=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-settings-menu`,attributes:{role:"menu"}});let t=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"move",label:"transcript.enableDragMode",hasTextClass:!0,onClick:()=>{this.toggleKeyboardDragMode(),this.hideSettingsMenu()}});t.setAttribute("role","switch"),t.setAttribute("aria-checked","false");let i=t.querySelector(`.${this.player.options.classPrefix}-tooltip`);i&&i.remove();let e=t.querySelector(`.${this.player.options.classPrefix}-button-text`);e&&e.remove(),this.dragOptionButton=t,this.dragOptionText=t.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateDragOptionState();let a=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"settings",label:"transcript.styleTranscript",onClick:g=>{g.preventDefault(),g.stopPropagation(),this.hideSettingsMenu(),setTimeout(()=>{this.showStyleDialog()},50)}}),n=a.querySelector(`.${this.player.options.classPrefix}-tooltip`);n&&n.remove();let c=a.querySelector(`.${this.player.options.classPrefix}-button-text`);c&&c.remove();let p=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"resize",label:"transcript.enableResizeMode",hasTextClass:!0,onClick:g=>{g.preventDefault(),g.stopPropagation(),this.toggleResizeMode({focus:!1})?(this.hideSettingsMenu({focusButton:!1}),setTimeout(()=>{this.transcriptWindow&&this.transcriptWindow.focus({preventScroll:!0})},20)):this.hideSettingsMenu({focusButton:!0})}});p.setAttribute("role","switch"),p.setAttribute("aria-checked","false");let o=p.querySelector(`.${this.player.options.classPrefix}-tooltip`);o&&o.remove();let s=p.querySelector(`.${this.player.options.classPrefix}-button-text`);s&&s.remove(),this.resizeOptionButton=p,this.resizeOptionText=p.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateResizeOptionState();let h=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});h.setAttribute("role","switch"),h.setAttribute("aria-checked",this.showTimestamps?"true":"false");let u=h.querySelector(`.${this.player.options.classPrefix}-tooltip`);u&&u.remove();let y=h.querySelector(`.${this.player.options.classPrefix}-button-text`);y&&y.remove(),this.showTimestampsButton=h,this.showTimestampsText=h.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateShowTimestampsState();let d=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"close",label:"transcript.closeMenu",onClick:()=>{this.hideSettingsMenu()}}),x=d.querySelector(`.${this.player.options.classPrefix}-tooltip`);x&&x.remove();let T=d.querySelector(`.${this.player.options.classPrefix}-button-text`);T&&T.remove(),this.settingsMenu.appendChild(t),this.settingsMenu.appendChild(p),this.settingsMenu.appendChild(a),this.settingsMenu.appendChild(h),this.settingsMenu.appendChild(d),this.settingsMenu.style.visibility="hidden",this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.parentNode?this.settingsButton.insertAdjacentElement("afterend",this.settingsMenu):this.headerLeft?this.headerLeft.appendChild(this.settingsMenu):this.transcriptHeader?this.transcriptHeader.appendChild(this.settingsMenu):this.transcriptWindow.appendChild(this.settingsMenu),this.positionSettingsMenuImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this.settingsMenuKeyHandler=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0})),this.settingsMenuVisible=!0,this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50)}positionSettingsMenuImmediate(){if(!this.settingsMenu||!this.settingsButton)return;let t=this.settingsButton.parentElement;if(!t)return;let i=this.settingsButton.getBoundingClientRect(),e=t.getBoundingClientRect(),a=this.settingsMenu.getBoundingClientRect(),n=window.innerHeight,c=i.left-e.left,p=i.bottom-e.top,o=i.top-e.top,s=n-i.bottom,h=i.top,u=p+4;s<a.height+20&&h>s?(u=o-a.height-4,this.settingsMenu.classList.add("vidply-menu-above")):this.settingsMenu.classList.remove("vidply-menu-above"),this.settingsMenu.style.top=`${u}px`,this.settingsMenu.style.left=`${c}px`,this.settingsMenu.style.right="auto",this.settingsMenu.style.bottom="auto"}positionSettingsMenu(){!this.settingsMenu||!this.settingsButton||requestAnimationFrame(()=>{setTimeout(()=>{this.positionSettingsMenuImmediate()},10)})}attachSettingsMenuKeyboardNavigation(){if(!this.settingsMenu)return;this.settingsMenuKeyHandler&&this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0);let t=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0}));this.settingsMenuKeyHandler=t}hideSettingsMenu({focusButton:t=!0}={}){this.settingsMenu&&(this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this.settingsMenuJustOpened=!1,this.settingsMenuKeyHandler&&(this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0),this.settingsMenuKeyHandler=null),this.settingsButton&&(this.settingsButton.setAttribute("aria-expanded","false"),t&&this.settingsButton.focus({preventScroll:!0})))}enableMoveMode(){this.hideResizeModeIndicator(),this.transcriptWindow.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`);let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-move-tooltip`,textContent:"Drag with mouse or press D for keyboard drag mode"});this.transcriptHeader.appendChild(t),setTimeout(()=>{this.transcriptWindow.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`),t.parentNode&&t.remove()},2e3)}toggleResizeMode({focus:t=!0}={}){return this.draggableResizable?this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0):!1}updateDragOptionState(){if(!this.dragOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.keyboardDragMode),i=t?r.t("transcript.disableDragMode"):r.t("transcript.enableDragMode"),e=t?r.t("transcript.disableDragModeAria"):r.t("transcript.enableDragModeAria");this.dragOptionButton.setAttribute("aria-checked",t?"true":"false"),this.dragOptionButton.setAttribute("aria-label",e),this.dragOptionText&&(this.dragOptionText.textContent=i)}updateResizeOptionState(){if(!this.resizeOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.pointerResizeMode),i=t?r.t("transcript.disableResizeMode"):r.t("transcript.enableResizeMode"),e=t?r.t("transcript.disableResizeModeAria"):r.t("transcript.enableResizeModeAria");this.resizeOptionButton.setAttribute("aria-checked",t?"true":"false"),this.resizeOptionButton.setAttribute("aria-label",e),this.resizeOptionText&&(this.resizeOptionText.textContent=i)}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;let t=this.showTimestamps?r.t("transcript.hideTimestamps"):r.t("transcript.showTimestamps"),i=this.showTimestamps?r.t("transcript.hideTimestampsAria"):r.t("transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",i),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){if(!this.transcriptContent)return;this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(i=>{i.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){let t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){if(!this.transcriptHeader)return;this.hideResizeModeIndicator();let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-tooltip`,textContent:r.t("transcript.resizeModeHint")||"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit."});this.transcriptHeader.appendChild(t),this.resizeModeIndicator=t,this.resizeModeIndicatorTimeout=this.setManagedTimeout(()=>{this.hideResizeModeIndicator()},3e3)}hideResizeModeIndicator(){this.resizeModeIndicatorTimeout&&(this.clearManagedTimeout(this.resizeModeIndicatorTimeout),this.resizeModeIndicatorTimeout=null),this.resizeModeIndicator&&this.resizeModeIndicator.parentNode&&this.resizeModeIndicator.remove(),this.resizeModeIndicator=null}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this.showResizeModeIndicator(),this.announceLive(r.t("transcript.resizeModeEnabled"))):(this.hideResizeModeIndicator(),this.announceLive(r.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.styleDialog){this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let o=this.styleDialog.querySelector("select, input");o&&o.focus({preventScroll:!0})},0);return}this.styleDialog=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});let t=l.createElement("h4",{textContent:r.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});this.styleDialog.appendChild(t);let i=this.createStyleSelectControl(r.t("captions.fontSize"),"fontSize",[{label:r.t("fontSizes.small"),value:"90%"},{label:r.t("fontSizes.normal"),value:"100%"},{label:r.t("fontSizes.large"),value:"110%"},{label:r.t("fontSizes.xlarge"),value:"120%"}]);this.styleDialog.appendChild(i);let e=this.createStyleSelectControl(r.t("captions.fontFamily"),"fontFamily",[{label:r.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:r.t("fontFamilies.serif"),value:"serif"},{label:r.t("fontFamilies.monospace"),value:"monospace"}]);this.styleDialog.appendChild(e);let a=this.createStyleColorControl(r.t("captions.color"),"color");this.styleDialog.appendChild(a);let n=this.createStyleColorControl(r.t("captions.backgroundColor"),"backgroundColor");this.styleDialog.appendChild(n);let c=this.createStyleOpacityControl(r.t("captions.opacity"),"opacity");this.styleDialog.appendChild(c);let p=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:r.t("settings.close"),attributes:{type:"button"}});p.addEventListener("click",()=>this.hideStyleDialog()),this.styleDialog.appendChild(p),this.handlers.styleDialogKeydown=o=>{if(this.styleDialogVisible){if(o.key==="Escape"){o.preventDefault(),o.stopPropagation(),this.hideStyleDialog();return}if(o.key==="Tab"){let s=this.styleDialog.querySelectorAll("select, input, button"),h=s[0],u=s[s.length-1];o.shiftKey&&document.activeElement===h?(o.preventDefault(),u.focus({preventScroll:!0})):!o.shiftKey&&document.activeElement===u&&(o.preventDefault(),h.focus({preventScroll:!0}))}}},document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.headerLeft?this.headerLeft.appendChild(this.styleDialog):this.transcriptHeader.appendChild(this.styleDialog),this.applyTranscriptStyles(),this.styleDialogVisible=!0,this.styleDialog.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let o=this.styleDialog.querySelector("select, input");o&&o.focus({preventScroll:!0})},0)}hideStyleDialog(){this.styleDialog&&(this.styleDialog.style.display="none",this.styleDialogVisible=!1,this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.settingsButton&&this.settingsButton.focus({preventScroll:!0}))}createStyleSelectControl(t,i,e){let a=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),n=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,c=l.createElement("label",{textContent:t,attributes:{for:n}});a.appendChild(c);let p=l.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:n}});return e.forEach(o=>{let s=l.createElement("option",{textContent:o.label,attributes:{value:o.value}});this.transcriptStyle[i]===o.value&&(s.selected=!0),p.appendChild(s)}),p.addEventListener("change",o=>{this.transcriptStyle[i]=o.target.value,this.applyTranscriptStyles(),this.savePreferences()}),a.appendChild(p),a}createStyleColorControl(t,i){let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=l.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=l.createElement("input",{attributes:{id:a,type:"color",value:this.transcriptStyle[i]},className:`${this.player.options.classPrefix}-transcript-style-color`});return c.addEventListener("input",p=>{this.transcriptStyle[i]=p.target.value,this.applyTranscriptStyles(),this.savePreferences()}),e.appendChild(c),e}createStyleOpacityControl(t,i){let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=l.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=l.createElement("span",{textContent:Math.round(this.transcriptStyle[i]*100)+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),p=l.createElement("input",{attributes:{id:a,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[i])},className:`${this.player.options.classPrefix}-transcript-style-range`});p.addEventListener("input",s=>{let h=parseFloat(s.target.value);this.transcriptStyle[i]=h,c.textContent=Math.round(h*100)+"%",this.applyTranscriptStyles(),this.savePreferences()});let o=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return o.appendChild(p),o.appendChild(c),e.appendChild(n),e.appendChild(o),e}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){if(!this.transcriptWindow)return;this.transcriptWindow.style.backgroundColor=this.transcriptStyle.backgroundColor,this.transcriptWindow.style.opacity=String(this.transcriptStyle.opacity),this.transcriptContent&&(this.transcriptContent.style.fontSize=this.transcriptStyle.fontSize,this.transcriptContent.style.fontFamily=this.transcriptStyle.fontFamily,this.transcriptContent.style.color=this.transcriptStyle.color),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-text`).forEach(e=>{e.style.fontSize=this.transcriptStyle.fontSize,e.style.fontFamily=this.transcriptStyle.fontFamily,e.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(e=>{e.style.fontFamily=this.transcriptStyle.fontFamily})}setManagedTimeout(t,i){let e=setTimeout(()=>{this.timeouts.delete(e),t()},i);return this.timeouts.add(e),e}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.draggableResizable.destroy(),this.draggableResizable=null),this.transcriptWindow&&this.customKeyHandler&&(this.transcriptWindow.removeEventListener("keydown",this.customKeyHandler),this.customKeyHandler=null),this.handlers.timeupdate&&this.player.off("timeupdate",this.handlers.timeupdate),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.settingsButton&&(this.handlers.settingsClick&&this.settingsButton.removeEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown&&this.settingsButton.removeEventListener("keydown",this.handlers.settingsKeydown)),this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.handlers.documentClick&&document.removeEventListener("click",this.handlers.documentClick),this.handlers.resize&&window.removeEventListener("resize",this.handlers.resize),this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts.clear(),this.handlers=null,this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.settingsMenu=null,this.styleDialog=null,this.transcriptResizeHandles=[],this.resizeOptionButton=null,this.resizeOptionText=null,this.liveRegion=null}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{W as TranscriptManager};
@@ -1,6 +0,0 @@
1
- /*!
2
- * Universal, Accessible Video Player
3
- * (c) 2025 Matthias Peltzer
4
- * Released under GPL-2.0-or-later License
5
- */
6
- import{a as o,b as l,c as M,d as b,f as v,h as C,i as P,j as f,k as w,m as S,n as z}from"./vidply.chunk-IBNYTGGM.min.js";var W=class{constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new C("vidply"),this.draggableResizable=null,this.settingsMenuVisible=!1,this.settingsMenu=null,this.settingsButton=null,this.settingsMenuJustOpened=!1,this.resizeOptionButton=null,this.resizeOptionText=null,this.dragOptionButton=null,this.dragOptionText=null,this.resizeModeIndicator=null,this.resizeModeIndicatorTimeout=null,this.transcriptResizeHandles=[],this.liveRegion=null,this.styleDialog=null,this.styleDialogVisible=!1,this.styleDialogJustOpened=!1,this.languageSelector=null,this.languageLabel=null,this.currentTranscriptLanguage=null,this.availableTranscriptLanguages=[],this.languageSelectorHandler=null;let i=this.storage.getTranscriptPreferences();this.autoscrollEnabled=i?.autoscroll!==void 0?i.autoscroll:!0,this.showTimestamps=i?.showTimestamps!==void 0?i.showTimestamps:!1,this.transcriptStyle={fontSize:i?.fontSize||this.player.options.transcriptFontSize||"100%",fontFamily:i?.fontFamily||this.player.options.transcriptFontFamily||"sans-serif",color:i?.color||this.player.options.transcriptColor||"#ffffff",backgroundColor:i?.backgroundColor||this.player.options.transcriptBackgroundColor||"#1e1e1e",opacity:i?.opacity??this.player.options.transcriptOpacity??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null},this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),100))})}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.transcriptWindow){this.transcriptWindow.style.display="flex",this.isVisible=!0,this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),v(this.settingsButton,{delay:150});return}this.createTranscriptWindow(),this.loadTranscriptData(),this.transcriptWindow&&(this.transcriptWindow.style.display="flex",(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),0),v(this.settingsButton,{delay:150})),this.isVisible=!0}hideTranscript({focusButton:t=!1}={}){if(this.transcriptWindow&&(this.transcriptWindow.style.display="none",this.isVisible=!1),this.draggableResizable&&this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.hideResizeModeIndicator(),this.announceLive(""),this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),t){let i=this.player.controlBar?.controls?.transcript;i&&typeof i.focus=="function"&&i.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":"Video Transcript",tabindex:"-1"}}),this.transcriptHeader=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});let t=l.t("transcript.settingsMenu");this.settingsButton=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":t,"aria-expanded":"false"}}),this.settingsButton.appendChild(b("settings")),o.attachTooltip(this.settingsButton,t,this.player.options.classPrefix),this.handlers.settingsClick=d=>{d.preventDefault(),d.stopPropagation(),this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=d=>{d.key==="d"||d.key==="D"?(d.preventDefault(),d.stopPropagation(),this.toggleKeyboardDragMode()):d.key==="r"||d.key==="R"?(d.preventDefault(),d.stopPropagation(),this.toggleResizeMode()):d.key==="Escape"&&this.settingsMenuVisible&&(d.preventDefault(),d.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);let i=o.createElement("h3",{textContent:`${l.t("transcript.title")}. ${l.t("transcript.dragResizePrompt")}`}),e=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,a=o.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:e}});this.autoscrollCheckbox=o.createElement("input",{attributes:{id:e,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);let n=o.createElement("span",{textContent:l.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});a.appendChild(this.autoscrollCheckbox),a.appendChild(n),this.autoscrollCheckbox.addEventListener("change",d=>{this.autoscrollEnabled=d.target.checked,this.saveAutoscrollPreference()}),this.transcriptHeader.appendChild(i),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(a);let c=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:p,select:r}=S({classPrefix:this.player.options.classPrefix,labelClass:`${this.player.options.classPrefix}-transcript-language-label`,selectClass:`${this.player.options.classPrefix}-transcript-language-select`,labelText:"settings.language",selectId:c,hidden:!1});this.languageLabel=p,this.languageSelector=r;let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});s.appendChild(this.languageLabel),s.appendChild(this.languageSelector),this.languageSelectorWrapper=s,z(s),this.headerLeft.appendChild(s);let h=l.t("transcript.close"),u=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":h}});u.appendChild(b("close")),o.attachTooltip(u,h,this.player.options.classPrefix),u.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(u),this.transcriptContent=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=o.createElement("div",{className:"vidply-sr-only",attributes:{"aria-live":"polite","aria-atomic":"true"}}),this.transcriptWindow.appendChild(this.liveRegion),this.player.container.appendChild(this.transcriptWindow),this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript(),this.handlers.documentClick=d=>{this.settingsMenuJustOpened||this.styleDialogJustOpened||this.settingsButton&&this.settingsButton.contains(d.target)||this.settingsMenu&&this.settingsMenu.contains(d.target)||(this.settingsMenuVisible&&this.hideSettingsMenu(),this.styleDialogVisible&&this.styleDialog&&!this.styleDialog.contains(d.target)&&this.hideStyleDialog())},this.documentClickHandlerAdded=!1;let y;this.handlers.resize=()=>{y&&this.clearManagedTimeout(y),y=this.setManagedTimeout(()=>{(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize)}createResizeHandles(){if(!this.transcriptWindow)return;let t=["n","s","e","w","ne","nw","se","sw"];this.transcriptResizeHandles=t.map(i=>{let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${i}`,attributes:{"data-direction":i,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return e.style.display="none",this.transcriptWindow.appendChild(e),e})}positionTranscript(){if(!this.transcriptWindow||!this.player.videoWrapper||!this.isVisible||this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;let t=window.innerWidth<768,i=this.player.videoWrapper.getBoundingClientRect(),e=this.player.state.fullscreen;if(t&&!e)this.transcriptWindow.style.position="relative",this.transcriptWindow.style.left="0",this.transcriptWindow.style.right="0",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.width="100%",this.transcriptWindow.style.maxWidth="100%",this.transcriptWindow.style.maxHeight="400px",this.transcriptWindow.style.height="auto",this.transcriptWindow.style.borderRadius="0",this.transcriptWindow.style.transform="none",this.transcriptWindow.style.border="none",this.transcriptWindow.style.borderTop="1px solid var(--vidply-border-light)",this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptWindow.style.boxShadow="none",this.transcriptHeader&&(this.transcriptHeader.style.cursor="default"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow);else if(e){this.transcriptWindow.style.position="fixed",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right="20px",this.transcriptWindow.style.bottom="80px",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.maxHeight="calc(100vh - 180px)",this.transcriptWindow.style.height="auto";let a=260,n=Math.max(a,window.innerWidth-40),c=parseFloat(this.transcriptWindow.style.width)||400,p=Math.max(a,Math.min(c,n));this.transcriptWindow.style.width=`${p}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}else{let a=parseFloat(this.transcriptWindow.style.width)||400,n=20,c=260,p=this.player.container.getBoundingClientRect();window.getComputedStyle(this.player.container).position==="static"&&(this.player.container.style.position="relative");let s=i.right-p.left+n,h=window.innerWidth-i.right-n,u=Math.max(c,Math.min(a,h)),y=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${s}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${y}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${u}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}}getAvailableTranscriptLanguages(){let t=this.player.textTracks,i=new Map;return t.forEach(e=>{(e.kind==="captions"||e.kind==="subtitles")&&e.language&&(i.has(e.language)||i.set(e.language,{language:e.language,label:e.label||e.language,track:e}))}),Array.from(i.values())}updateLanguageSelector(){if(this.languageSelector){if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),this.languageSelector.innerHTML="",this.availableTranscriptLanguages.length<2){this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none");return}if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach((t,i)=>{let e=o.createElement("option",{textContent:t.label,attributes:{value:t.language,lang:t.language}});this.languageSelector.appendChild(e)}),this.currentTranscriptLanguage)this.languageSelector.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){let t=this.player.textTracks.find(i=>(i.kind==="captions"||i.kind==="subtitles")&&i.mode==="showing");this.currentTranscriptLanguage=t?t.language:this.availableTranscriptLanguages[0].language,this.languageSelector.value=this.currentTranscriptLanguage}this.languageSelectorHandler&&this.languageSelector.removeEventListener("change",this.languageSelectorHandler),this.languageSelectorHandler=t=>{this.currentTranscriptLanguage=t.target.value,this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)},this.languageSelector.addEventListener("change",this.languageSelectorHandler)}}loadTranscriptData(){this.transcriptEntries=[],this.transcriptContent.innerHTML="";let t=this.player.textTracks,i=null;this.currentTranscriptLanguage&&(i=t.find(s=>(s.kind==="captions"||s.kind==="subtitles")&&s.language===this.currentTranscriptLanguage)),i||(i=t.find(s=>s.kind==="captions"||s.kind==="subtitles"),i&&(this.currentTranscriptLanguage=i.language));let e=null;this.currentTranscriptLanguage&&(e=t.find(s=>s.kind==="descriptions"&&s.language===this.currentTranscriptLanguage)),e||(e=t.find(s=>s.kind==="descriptions"));let a=t.find(s=>s.kind==="metadata"),n=e&&this.player.state.audioDescriptionEnabled;if(!i&&!n&&!a){this.showNoTranscriptMessage();return}let c=[i,e,a].filter(Boolean);if(c.forEach(s=>{s.mode==="disabled"&&(s.mode="hidden")}),c.some(s=>!s.cues||s.cues.length===0)){let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:l.t("transcript.loading")});this.transcriptContent.appendChild(s);let h=0,u=()=>{h++,h>=c.length&&this.loadTranscriptData()};c.forEach(y=>{y.addEventListener("load",u,{once:!0})}),this.setManagedTimeout(()=>{this.loadTranscriptData()},500);return}let r=[];i&&i.cues&&Array.from(i.cues).forEach(s=>{r.push({cue:s,type:"caption"})}),e&&e.cues&&this.player.state.audioDescriptionEnabled&&Array.from(e.cues).forEach(s=>{r.push({cue:s,type:"description"})}),a&&a.cues&&(this.metadataCues=Array.from(a.cues),this.setupMetadataHandling()),r.sort((s,h)=>s.cue.startTime-h.cue.startTime),r.forEach((s,h)=>{let u=this.createTranscriptEntry(s.cue,h,s.type);this.transcriptEntries.push({element:u,cue:s.cue,type:s.type,startTime:s.cue.startTime,endTime:s.cue.endTime}),this.transcriptContent.appendChild(u)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector()}setupMetadataHandlingOnLoad(){let t=()=>{let e=this.player.textTracks.find(a=>a.kind==="metadata");if(e){if(e.mode==="disabled"&&(e.mode="hidden"),this.metadataCueChangeHandler&&e.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{let a=Array.from(e.activeCues||[]);a.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",a.map(n=>({start:n.startTime,end:n.endTime,text:n.text}))),a.forEach(n=>{this.handleMetadataCue(n)})},e.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug){let a=e.cues?e.cues.length:0;console.log("[VidPly Metadata] Track enabled,",a,"cues available")}}else this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){!this.metadataCues||this.metadataCues.length===0||this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){let i=t.text.trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:i}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:i,cue:t}),i.includes("PAUSE")&&(this.player.state.paused||(this.player.options.debug&&console.log("[VidPly Metadata] Pausing video at",t.startTime),this.player.pause()),this.player.emit("metadata:pause",{time:t.startTime,text:i}));let e=i.match(/FOCUS:([\w#-]+)/);if(e){let n=e[1],c=document.querySelector(n);c?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",n),this.setManagedTimeout(()=>{c.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",n),this.player.emit("metadata:focus",{time:t.startTime,target:n,element:c,text:i})}let a=i.match(/#[\w-]+/g);a&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",a),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:a,text:i}))}createTranscriptEntry(t,i,e="caption"){let a=this.stripVTTFormatting(t.text),n=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${e}`,attributes:{tabindex:"0","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":e}}),c=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:M.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),p=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:a});n.appendChild(c),n.appendChild(p);let r=()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()};return n.addEventListener("click",r),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:l.t("transcript.noTranscript")});this.transcriptContent.appendChild(t)}updateActiveEntry(){if(!this.isVisible||this.transcriptEntries.length===0)return;let t=this.player.state.currentTime,i=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);i&&i!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),i.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(i.element),this.currentActiveEntry=i):!i&&this.currentActiveEntry&&(this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),this.currentActiveEntry=null)}scrollToEntry(t){if(!this.transcriptContent||!this.autoscrollEnabled)return;let i=this.transcriptContent.getBoundingClientRect(),e=t.getBoundingClientRect();if(e.top<i.top||e.bottom>i.bottom){let a=t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2;this.transcriptContent.scrollTo({top:a,behavior:"smooth"})}}saveAutoscrollPreference(){let t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;let t=window.innerWidth<768,i=this.player.state.fullscreen;if(t&&!i){this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null);return}this.draggableResizable||(this.draggableResizable=new P(this.transcriptWindow,{dragHandle:this.transcriptHeader,resizeHandles:this.transcriptResizeHandles,constrainToViewport:!0,classPrefix:`${this.player.options.classPrefix}-transcript`,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:10,keyboardStepLarge:50,minWidth:300,minHeight:200,maxWidth:()=>Math.max(320,window.innerWidth-40),maxHeight:()=>Math.max(200,window.innerHeight-120),pointerResizeIndicatorText:l.t("transcript.resizeModeHint"),onPointerResizeToggle:e=>{this.transcriptResizeHandles.forEach(a=>{a.style.display=e?"block":"none"}),this.onPointerResizeModeChange(e)},onDragStart:e=>{let a=[`.${this.player.options.classPrefix}-transcript-close`,`.${this.player.options.classPrefix}-transcript-settings`,`.${this.player.options.classPrefix}-transcript-language-select`,`.${this.player.options.classPrefix}-transcript-language-label`,`.${this.player.options.classPrefix}-transcript-settings-menu`,`.${this.player.options.classPrefix}-transcript-style-dialog`];for(let n of a)if(e.target.closest(n))return!1;return!0}}),this.customKeyHandler=e=>{let a=e.key.toLowerCase(),n=e.defaultPrevented;if(!(this.settingsMenuVisible||this.styleDialogVisible)){if(a==="home"){e.preventDefault(),e.stopPropagation(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(l.t("transcript.positionReset")));return}if(a==="r"){if(n)return;e.preventDefault(),e.stopPropagation(),this.toggleResizeMode()&&this.transcriptWindow.focus({preventScroll:!0});return}if(a==="escape"){if(this.draggableResizable&&this.draggableResizable.pointerResizeMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disablePointerResizeMode();return}if(this.draggableResizable&&this.draggableResizable.keyboardDragMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),this.announceLive(l.t("transcript.dragModeDisabled"));return}e.preventDefault(),e.stopPropagation(),this.hideTranscript({focusButton:!0});return}}},this.transcriptWindow.addEventListener("keydown",this.customKeyHandler))}toggleKeyboardDragMode(){if(this.draggableResizable){let t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();let i=this.draggableResizable.keyboardDragMode;!t&&i&&this.enableMoveMode(),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){if(this.settingsMenuJustOpened=!0,setTimeout(()=>{this.settingsMenuJustOpened=!1},350),this.documentClickHandlerAdded||setTimeout(()=>{document.addEventListener("click",this.handlers.documentClick),this.documentClickHandlerAdded=!0},300),this.settingsMenu){this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.attachSettingsMenuKeyboardNavigation(),this.positionSettingsMenuImmediate(),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50);return}this.settingsMenu=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-settings-menu`,attributes:{role:"menu"}});let t=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"move",label:"transcript.enableDragMode",hasTextClass:!0,onClick:()=>{this.toggleKeyboardDragMode(),this.hideSettingsMenu()}});t.setAttribute("role","switch"),t.setAttribute("aria-checked","false");let i=t.querySelector(`.${this.player.options.classPrefix}-tooltip`);i&&i.remove();let e=t.querySelector(`.${this.player.options.classPrefix}-button-text`);e&&e.remove(),this.dragOptionButton=t,this.dragOptionText=t.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateDragOptionState();let a=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"settings",label:"transcript.styleTranscript",onClick:g=>{g.preventDefault(),g.stopPropagation(),this.hideSettingsMenu(),setTimeout(()=>{this.showStyleDialog()},50)}}),n=a.querySelector(`.${this.player.options.classPrefix}-tooltip`);n&&n.remove();let c=a.querySelector(`.${this.player.options.classPrefix}-button-text`);c&&c.remove();let p=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"resize",label:"transcript.enableResizeMode",hasTextClass:!0,onClick:g=>{g.preventDefault(),g.stopPropagation(),this.toggleResizeMode({focus:!1})?(this.hideSettingsMenu({focusButton:!1}),setTimeout(()=>{this.transcriptWindow&&this.transcriptWindow.focus({preventScroll:!0})},20)):this.hideSettingsMenu({focusButton:!0})}});p.setAttribute("role","switch"),p.setAttribute("aria-checked","false");let r=p.querySelector(`.${this.player.options.classPrefix}-tooltip`);r&&r.remove();let s=p.querySelector(`.${this.player.options.classPrefix}-button-text`);s&&s.remove(),this.resizeOptionButton=p,this.resizeOptionText=p.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateResizeOptionState();let h=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});h.setAttribute("role","switch"),h.setAttribute("aria-checked",this.showTimestamps?"true":"false");let u=h.querySelector(`.${this.player.options.classPrefix}-tooltip`);u&&u.remove();let y=h.querySelector(`.${this.player.options.classPrefix}-button-text`);y&&y.remove(),this.showTimestampsButton=h,this.showTimestampsText=h.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateShowTimestampsState();let d=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"close",label:"transcript.closeMenu",onClick:()=>{this.hideSettingsMenu()}}),T=d.querySelector(`.${this.player.options.classPrefix}-tooltip`);T&&T.remove();let x=d.querySelector(`.${this.player.options.classPrefix}-button-text`);x&&x.remove(),this.settingsMenu.appendChild(t),this.settingsMenu.appendChild(p),this.settingsMenu.appendChild(a),this.settingsMenu.appendChild(h),this.settingsMenu.appendChild(d),this.settingsMenu.style.visibility="hidden",this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.parentNode?this.settingsButton.insertAdjacentElement("afterend",this.settingsMenu):this.headerLeft?this.headerLeft.appendChild(this.settingsMenu):this.transcriptHeader?this.transcriptHeader.appendChild(this.settingsMenu):this.transcriptWindow.appendChild(this.settingsMenu),this.positionSettingsMenuImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this.settingsMenuKeyHandler=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0})),this.settingsMenuVisible=!0,this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50)}positionSettingsMenuImmediate(){if(!this.settingsMenu||!this.settingsButton)return;let t=this.settingsButton.parentElement;if(!t)return;let i=this.settingsButton.getBoundingClientRect(),e=t.getBoundingClientRect(),a=this.settingsMenu.getBoundingClientRect(),n=window.innerHeight,c=i.left-e.left,p=i.bottom-e.top,r=i.top-e.top,s=n-i.bottom,h=i.top,u=p+4;s<a.height+20&&h>s?(u=r-a.height-4,this.settingsMenu.classList.add("vidply-menu-above")):this.settingsMenu.classList.remove("vidply-menu-above"),this.settingsMenu.style.top=`${u}px`,this.settingsMenu.style.left=`${c}px`,this.settingsMenu.style.right="auto",this.settingsMenu.style.bottom="auto"}positionSettingsMenu(){!this.settingsMenu||!this.settingsButton||requestAnimationFrame(()=>{setTimeout(()=>{this.positionSettingsMenuImmediate()},10)})}attachSettingsMenuKeyboardNavigation(){if(!this.settingsMenu)return;this.settingsMenuKeyHandler&&this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0);let t=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0}));this.settingsMenuKeyHandler=t}hideSettingsMenu({focusButton:t=!0}={}){this.settingsMenu&&(this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this.settingsMenuJustOpened=!1,this.settingsMenuKeyHandler&&(this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0),this.settingsMenuKeyHandler=null),this.settingsButton&&(this.settingsButton.setAttribute("aria-expanded","false"),t&&this.settingsButton.focus({preventScroll:!0})))}enableMoveMode(){this.hideResizeModeIndicator(),this.transcriptWindow.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`);let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-move-tooltip`,textContent:"Drag with mouse or press D for keyboard drag mode"});this.transcriptHeader.appendChild(t),setTimeout(()=>{this.transcriptWindow.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`),t.parentNode&&t.remove()},2e3)}toggleResizeMode({focus:t=!0}={}){return this.draggableResizable?this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0):!1}updateDragOptionState(){if(!this.dragOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.keyboardDragMode),i=t?l.t("transcript.disableDragMode"):l.t("transcript.enableDragMode"),e=t?l.t("transcript.disableDragModeAria"):l.t("transcript.enableDragModeAria");this.dragOptionButton.setAttribute("aria-checked",t?"true":"false"),this.dragOptionButton.setAttribute("aria-label",e),this.dragOptionText&&(this.dragOptionText.textContent=i)}updateResizeOptionState(){if(!this.resizeOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.pointerResizeMode),i=t?l.t("transcript.disableResizeMode"):l.t("transcript.enableResizeMode"),e=t?l.t("transcript.disableResizeModeAria"):l.t("transcript.enableResizeModeAria");this.resizeOptionButton.setAttribute("aria-checked",t?"true":"false"),this.resizeOptionButton.setAttribute("aria-label",e),this.resizeOptionText&&(this.resizeOptionText.textContent=i)}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;let t=this.showTimestamps?l.t("transcript.hideTimestamps"):l.t("transcript.showTimestamps"),i=this.showTimestamps?l.t("transcript.hideTimestampsAria"):l.t("transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",i),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){if(!this.transcriptContent)return;this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(i=>{i.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){let t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){if(!this.transcriptHeader)return;this.hideResizeModeIndicator();let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-tooltip`,textContent:l.t("transcript.resizeModeHint")||"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit."});this.transcriptHeader.appendChild(t),this.resizeModeIndicator=t,this.resizeModeIndicatorTimeout=this.setManagedTimeout(()=>{this.hideResizeModeIndicator()},3e3)}hideResizeModeIndicator(){this.resizeModeIndicatorTimeout&&(this.clearManagedTimeout(this.resizeModeIndicatorTimeout),this.resizeModeIndicatorTimeout=null),this.resizeModeIndicator&&this.resizeModeIndicator.parentNode&&this.resizeModeIndicator.remove(),this.resizeModeIndicator=null}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this.showResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeEnabled"))):(this.hideResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.styleDialog){this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0);return}this.styleDialog=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});let t=o.createElement("h4",{textContent:l.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});this.styleDialog.appendChild(t);let i=this.createStyleSelectControl(l.t("captions.fontSize"),"fontSize",[{label:l.t("fontSizes.small"),value:"90%"},{label:l.t("fontSizes.normal"),value:"100%"},{label:l.t("fontSizes.large"),value:"110%"},{label:l.t("fontSizes.xlarge"),value:"120%"}]);this.styleDialog.appendChild(i);let e=this.createStyleSelectControl(l.t("captions.fontFamily"),"fontFamily",[{label:l.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:l.t("fontFamilies.serif"),value:"serif"},{label:l.t("fontFamilies.monospace"),value:"monospace"}]);this.styleDialog.appendChild(e);let a=this.createStyleColorControl(l.t("captions.color"),"color");this.styleDialog.appendChild(a);let n=this.createStyleColorControl(l.t("captions.backgroundColor"),"backgroundColor");this.styleDialog.appendChild(n);let c=this.createStyleOpacityControl(l.t("captions.opacity"),"opacity");this.styleDialog.appendChild(c);let p=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:l.t("settings.close"),attributes:{type:"button"}});p.addEventListener("click",()=>this.hideStyleDialog()),this.styleDialog.appendChild(p),this.handlers.styleDialogKeydown=r=>{if(this.styleDialogVisible){if(r.key==="Escape"){r.preventDefault(),r.stopPropagation(),this.hideStyleDialog();return}if(r.key==="Tab"){let s=this.styleDialog.querySelectorAll("select, input, button"),h=s[0],u=s[s.length-1];r.shiftKey&&document.activeElement===h?(r.preventDefault(),u.focus({preventScroll:!0})):!r.shiftKey&&document.activeElement===u&&(r.preventDefault(),h.focus({preventScroll:!0}))}}},document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.headerLeft?this.headerLeft.appendChild(this.styleDialog):this.transcriptHeader.appendChild(this.styleDialog),this.applyTranscriptStyles(),this.styleDialogVisible=!0,this.styleDialog.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0)}hideStyleDialog(){this.styleDialog&&(this.styleDialog.style.display="none",this.styleDialogVisible=!1,this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.settingsButton&&this.settingsButton.focus({preventScroll:!0}))}createStyleSelectControl(t,i,e){let a=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),n=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,c=o.createElement("label",{textContent:t,attributes:{for:n}});a.appendChild(c);let p=o.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:n}});return e.forEach(r=>{let s=o.createElement("option",{textContent:r.label,attributes:{value:r.value}});this.transcriptStyle[i]===r.value&&(s.selected=!0),p.appendChild(s)}),p.addEventListener("change",r=>{this.transcriptStyle[i]=r.target.value,this.applyTranscriptStyles(),this.savePreferences()}),a.appendChild(p),a}createStyleColorControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("input",{attributes:{id:a,type:"color",value:this.transcriptStyle[i]},className:`${this.player.options.classPrefix}-transcript-style-color`});return c.addEventListener("input",p=>{this.transcriptStyle[i]=p.target.value,this.applyTranscriptStyles(),this.savePreferences()}),e.appendChild(c),e}createStyleOpacityControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("span",{textContent:Math.round(this.transcriptStyle[i]*100)+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),p=o.createElement("input",{attributes:{id:a,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[i])},className:`${this.player.options.classPrefix}-transcript-style-range`});p.addEventListener("input",s=>{let h=parseFloat(s.target.value);this.transcriptStyle[i]=h,c.textContent=Math.round(h*100)+"%",this.applyTranscriptStyles(),this.savePreferences()});let r=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return r.appendChild(p),r.appendChild(c),e.appendChild(n),e.appendChild(r),e}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){if(!this.transcriptWindow)return;this.transcriptWindow.style.backgroundColor=this.transcriptStyle.backgroundColor,this.transcriptWindow.style.opacity=String(this.transcriptStyle.opacity),this.transcriptContent&&(this.transcriptContent.style.fontSize=this.transcriptStyle.fontSize,this.transcriptContent.style.fontFamily=this.transcriptStyle.fontFamily,this.transcriptContent.style.color=this.transcriptStyle.color),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-text`).forEach(e=>{e.style.fontSize=this.transcriptStyle.fontSize,e.style.fontFamily=this.transcriptStyle.fontFamily,e.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(e=>{e.style.fontFamily=this.transcriptStyle.fontFamily})}setManagedTimeout(t,i){let e=setTimeout(()=>{this.timeouts.delete(e),t()},i);return this.timeouts.add(e),e}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.draggableResizable.destroy(),this.draggableResizable=null),this.transcriptWindow&&this.customKeyHandler&&(this.transcriptWindow.removeEventListener("keydown",this.customKeyHandler),this.customKeyHandler=null),this.handlers.timeupdate&&this.player.off("timeupdate",this.handlers.timeupdate),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.settingsButton&&(this.handlers.settingsClick&&this.settingsButton.removeEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown&&this.settingsButton.removeEventListener("keydown",this.handlers.settingsKeydown)),this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.handlers.documentClick&&document.removeEventListener("click",this.handlers.documentClick),this.handlers.resize&&window.removeEventListener("resize",this.handlers.resize),this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts.clear(),this.handlers=null,this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.settingsMenu=null,this.styleDialog=null,this.transcriptResizeHandles=[],this.resizeOptionButton=null,this.resizeOptionText=null,this.liveRegion=null}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{W as TranscriptManager};
@@ -1,6 +0,0 @@
1
- /*!
2
- * Universal, Accessible Video Player
3
- * (c) 2025 Matthias Peltzer
4
- * Released under GPL-2.0-or-later License
5
- */
6
- import{a as o,b as l,c as M,d as b,f as v,h as C,i as P,j as f,k as w,m as S,n as z}from"./vidply.chunk-MBUR3U5L.min.js";var W=class{constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new C("vidply"),this.draggableResizable=null,this.settingsMenuVisible=!1,this.settingsMenu=null,this.settingsButton=null,this.settingsMenuJustOpened=!1,this.resizeOptionButton=null,this.resizeOptionText=null,this.dragOptionButton=null,this.dragOptionText=null,this.resizeModeIndicator=null,this.resizeModeIndicatorTimeout=null,this.transcriptResizeHandles=[],this.liveRegion=null,this.styleDialog=null,this.styleDialogVisible=!1,this.styleDialogJustOpened=!1,this.languageSelector=null,this.languageLabel=null,this.currentTranscriptLanguage=null,this.availableTranscriptLanguages=[],this.languageSelectorHandler=null;let i=this.storage.getTranscriptPreferences();this.autoscrollEnabled=i?.autoscroll!==void 0?i.autoscroll:!0,this.showTimestamps=i?.showTimestamps!==void 0?i.showTimestamps:!1,this.transcriptStyle={fontSize:i?.fontSize||this.player.options.transcriptFontSize||"100%",fontFamily:i?.fontFamily||this.player.options.transcriptFontFamily||"sans-serif",color:i?.color||this.player.options.transcriptColor||"#ffffff",backgroundColor:i?.backgroundColor||this.player.options.transcriptBackgroundColor||"#1e1e1e",opacity:i?.opacity??this.player.options.transcriptOpacity??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null},this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),100))})}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.transcriptWindow){this.transcriptWindow.style.display="flex",this.isVisible=!0,this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),v(this.settingsButton,{delay:150});return}this.createTranscriptWindow(),this.loadTranscriptData(),this.transcriptWindow&&(this.transcriptWindow.style.display="flex",(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),0),v(this.settingsButton,{delay:150})),this.isVisible=!0}hideTranscript({focusButton:t=!1}={}){if(this.transcriptWindow&&(this.transcriptWindow.style.display="none",this.isVisible=!1),this.draggableResizable&&this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.hideResizeModeIndicator(),this.announceLive(""),this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),t){let i=this.player.controlBar?.controls?.transcript;i&&typeof i.focus=="function"&&i.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":"Video Transcript",tabindex:"-1"}}),this.transcriptHeader=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});let t=l.t("transcript.settingsMenu");this.settingsButton=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":t,"aria-expanded":"false"}}),this.settingsButton.appendChild(b("settings")),o.attachTooltip(this.settingsButton,t,this.player.options.classPrefix),this.handlers.settingsClick=d=>{d.preventDefault(),d.stopPropagation(),this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=d=>{d.key==="d"||d.key==="D"?(d.preventDefault(),d.stopPropagation(),this.toggleKeyboardDragMode()):d.key==="r"||d.key==="R"?(d.preventDefault(),d.stopPropagation(),this.toggleResizeMode()):d.key==="Escape"&&this.settingsMenuVisible&&(d.preventDefault(),d.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);let i=o.createElement("h3",{textContent:`${l.t("transcript.title")}. ${l.t("transcript.dragResizePrompt")}`}),e=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,a=o.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:e}});this.autoscrollCheckbox=o.createElement("input",{attributes:{id:e,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);let n=o.createElement("span",{textContent:l.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});a.appendChild(this.autoscrollCheckbox),a.appendChild(n),this.autoscrollCheckbox.addEventListener("change",d=>{this.autoscrollEnabled=d.target.checked,this.saveAutoscrollPreference()}),this.transcriptHeader.appendChild(i),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(a);let c=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:p,select:r}=S({classPrefix:this.player.options.classPrefix,labelClass:`${this.player.options.classPrefix}-transcript-language-label`,selectClass:`${this.player.options.classPrefix}-transcript-language-select`,labelText:"settings.language",selectId:c,hidden:!1});this.languageLabel=p,this.languageSelector=r;let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});s.appendChild(this.languageLabel),s.appendChild(this.languageSelector),this.languageSelectorWrapper=s,z(s),this.headerLeft.appendChild(s);let h=l.t("transcript.close"),u=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":h}});u.appendChild(b("close")),o.attachTooltip(u,h,this.player.options.classPrefix),u.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(u),this.transcriptContent=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=o.createElement("div",{className:"vidply-sr-only",attributes:{"aria-live":"polite","aria-atomic":"true"}}),this.transcriptWindow.appendChild(this.liveRegion),this.player.container.appendChild(this.transcriptWindow),this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript(),this.handlers.documentClick=d=>{this.settingsMenuJustOpened||this.styleDialogJustOpened||this.settingsButton&&this.settingsButton.contains(d.target)||this.settingsMenu&&this.settingsMenu.contains(d.target)||(this.settingsMenuVisible&&this.hideSettingsMenu(),this.styleDialogVisible&&this.styleDialog&&!this.styleDialog.contains(d.target)&&this.hideStyleDialog())},this.documentClickHandlerAdded=!1;let y;this.handlers.resize=()=>{y&&this.clearManagedTimeout(y),y=this.setManagedTimeout(()=>{(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize)}createResizeHandles(){if(!this.transcriptWindow)return;let t=["n","s","e","w","ne","nw","se","sw"];this.transcriptResizeHandles=t.map(i=>{let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${i}`,attributes:{"data-direction":i,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return e.style.display="none",this.transcriptWindow.appendChild(e),e})}positionTranscript(){if(!this.transcriptWindow||!this.player.videoWrapper||!this.isVisible||this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;let t=window.innerWidth<768,i=this.player.videoWrapper.getBoundingClientRect(),e=this.player.state.fullscreen;if(t&&!e)this.transcriptWindow.style.position="relative",this.transcriptWindow.style.left="0",this.transcriptWindow.style.right="0",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.width="100%",this.transcriptWindow.style.maxWidth="100%",this.transcriptWindow.style.maxHeight="400px",this.transcriptWindow.style.height="auto",this.transcriptWindow.style.borderRadius="0",this.transcriptWindow.style.transform="none",this.transcriptWindow.style.border="none",this.transcriptWindow.style.borderTop="1px solid var(--vidply-border-light)",this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptWindow.style.boxShadow="none",this.transcriptHeader&&(this.transcriptHeader.style.cursor="default"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow);else if(e){this.transcriptWindow.style.position="fixed",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right="20px",this.transcriptWindow.style.bottom="80px",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.maxHeight="calc(100vh - 180px)",this.transcriptWindow.style.height="auto";let a=260,n=Math.max(a,window.innerWidth-40),c=parseFloat(this.transcriptWindow.style.width)||400,p=Math.max(a,Math.min(c,n));this.transcriptWindow.style.width=`${p}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}else{let a=parseFloat(this.transcriptWindow.style.width)||400,n=20,c=260,p=this.player.container.getBoundingClientRect();window.getComputedStyle(this.player.container).position==="static"&&(this.player.container.style.position="relative");let s=i.right-p.left+n,h=window.innerWidth-i.right-n,u=Math.max(c,Math.min(a,h)),y=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${s}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${y}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${u}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}}getAvailableTranscriptLanguages(){let t=this.player.textTracks,i=new Map;return t.forEach(e=>{(e.kind==="captions"||e.kind==="subtitles")&&e.language&&(i.has(e.language)||i.set(e.language,{language:e.language,label:e.label||e.language,track:e}))}),Array.from(i.values())}updateLanguageSelector(){if(this.languageSelector){if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),this.languageSelector.innerHTML="",this.availableTranscriptLanguages.length<2){this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none");return}if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach((t,i)=>{let e=o.createElement("option",{textContent:t.label,attributes:{value:t.language,lang:t.language}});this.languageSelector.appendChild(e)}),this.currentTranscriptLanguage)this.languageSelector.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){let t=this.player.textTracks.find(i=>(i.kind==="captions"||i.kind==="subtitles")&&i.mode==="showing");this.currentTranscriptLanguage=t?t.language:this.availableTranscriptLanguages[0].language,this.languageSelector.value=this.currentTranscriptLanguage}this.languageSelectorHandler&&this.languageSelector.removeEventListener("change",this.languageSelectorHandler),this.languageSelectorHandler=t=>{this.currentTranscriptLanguage=t.target.value,this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)},this.languageSelector.addEventListener("change",this.languageSelectorHandler)}}loadTranscriptData(){this.transcriptEntries=[],this.transcriptContent.innerHTML="";let t=this.player.textTracks,i=null;this.currentTranscriptLanguage&&(i=t.find(s=>(s.kind==="captions"||s.kind==="subtitles")&&s.language===this.currentTranscriptLanguage)),i||(i=t.find(s=>s.kind==="captions"||s.kind==="subtitles"),i&&(this.currentTranscriptLanguage=i.language));let e=null;this.currentTranscriptLanguage&&(e=t.find(s=>s.kind==="descriptions"&&s.language===this.currentTranscriptLanguage)),e||(e=t.find(s=>s.kind==="descriptions"));let a=t.find(s=>s.kind==="metadata"),n=e&&this.player.state.audioDescriptionEnabled;if(!i&&!n&&!a){this.showNoTranscriptMessage();return}let c=[i,e,a].filter(Boolean);if(c.forEach(s=>{s.mode==="disabled"&&(s.mode="hidden")}),c.some(s=>!s.cues||s.cues.length===0)){let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:l.t("transcript.loading")});this.transcriptContent.appendChild(s);let h=0,u=()=>{h++,h>=c.length&&this.loadTranscriptData()};c.forEach(y=>{y.addEventListener("load",u,{once:!0})}),this.setManagedTimeout(()=>{this.loadTranscriptData()},500);return}let r=[];i&&i.cues&&Array.from(i.cues).forEach(s=>{r.push({cue:s,type:"caption"})}),e&&e.cues&&this.player.state.audioDescriptionEnabled&&Array.from(e.cues).forEach(s=>{r.push({cue:s,type:"description"})}),a&&a.cues&&(this.metadataCues=Array.from(a.cues),this.setupMetadataHandling()),r.sort((s,h)=>s.cue.startTime-h.cue.startTime),r.forEach((s,h)=>{let u=this.createTranscriptEntry(s.cue,h,s.type);this.transcriptEntries.push({element:u,cue:s.cue,type:s.type,startTime:s.cue.startTime,endTime:s.cue.endTime}),this.transcriptContent.appendChild(u)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector()}setupMetadataHandlingOnLoad(){let t=()=>{let e=this.player.textTracks.find(a=>a.kind==="metadata");if(e){if(e.mode==="disabled"&&(e.mode="hidden"),this.metadataCueChangeHandler&&e.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{let a=Array.from(e.activeCues||[]);a.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",a.map(n=>({start:n.startTime,end:n.endTime,text:n.text}))),a.forEach(n=>{this.handleMetadataCue(n)})},e.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug){let a=e.cues?e.cues.length:0;console.log("[VidPly Metadata] Track enabled,",a,"cues available")}}else this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){!this.metadataCues||this.metadataCues.length===0||this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){let i=t.text.trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:i}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:i,cue:t}),i.includes("PAUSE")&&(this.player.state.paused||(this.player.options.debug&&console.log("[VidPly Metadata] Pausing video at",t.startTime),this.player.pause()),this.player.emit("metadata:pause",{time:t.startTime,text:i}));let e=i.match(/FOCUS:([\w#-]+)/);if(e){let n=e[1],c=document.querySelector(n);c?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",n),this.setManagedTimeout(()=>{c.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",n),this.player.emit("metadata:focus",{time:t.startTime,target:n,element:c,text:i})}let a=i.match(/#[\w-]+/g);a&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",a),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:a,text:i}))}createTranscriptEntry(t,i,e="caption"){let a=this.stripVTTFormatting(t.text),n=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${e}`,attributes:{tabindex:"0","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":e}}),c=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:M.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),p=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:a});n.appendChild(c),n.appendChild(p);let r=()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()};return n.addEventListener("click",r),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:l.t("transcript.noTranscript")});this.transcriptContent.appendChild(t)}updateActiveEntry(){if(!this.isVisible||this.transcriptEntries.length===0)return;let t=this.player.state.currentTime,i=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);i&&i!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),i.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(i.element),this.currentActiveEntry=i):!i&&this.currentActiveEntry&&(this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),this.currentActiveEntry=null)}scrollToEntry(t){if(!this.transcriptContent||!this.autoscrollEnabled)return;let i=this.transcriptContent.getBoundingClientRect(),e=t.getBoundingClientRect();if(e.top<i.top||e.bottom>i.bottom){let a=t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2;this.transcriptContent.scrollTo({top:a,behavior:"smooth"})}}saveAutoscrollPreference(){let t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;let t=window.innerWidth<768,i=this.player.state.fullscreen;if(t&&!i){this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null);return}this.draggableResizable||(this.draggableResizable=new P(this.transcriptWindow,{dragHandle:this.transcriptHeader,resizeHandles:this.transcriptResizeHandles,constrainToViewport:!0,classPrefix:`${this.player.options.classPrefix}-transcript`,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:10,keyboardStepLarge:50,minWidth:300,minHeight:200,maxWidth:()=>Math.max(320,window.innerWidth-40),maxHeight:()=>Math.max(200,window.innerHeight-120),pointerResizeIndicatorText:l.t("transcript.resizeModeHint"),onPointerResizeToggle:e=>{this.transcriptResizeHandles.forEach(a=>{a.style.display=e?"block":"none"}),this.onPointerResizeModeChange(e)},onDragStart:e=>{let a=[`.${this.player.options.classPrefix}-transcript-close`,`.${this.player.options.classPrefix}-transcript-settings`,`.${this.player.options.classPrefix}-transcript-language-select`,`.${this.player.options.classPrefix}-transcript-language-label`,`.${this.player.options.classPrefix}-transcript-settings-menu`,`.${this.player.options.classPrefix}-transcript-style-dialog`];for(let n of a)if(e.target.closest(n))return!1;return!0}}),this.customKeyHandler=e=>{let a=e.key.toLowerCase(),n=e.defaultPrevented;if(!(this.settingsMenuVisible||this.styleDialogVisible)){if(a==="home"){e.preventDefault(),e.stopPropagation(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(l.t("transcript.positionReset")));return}if(a==="r"){if(n)return;e.preventDefault(),e.stopPropagation(),this.toggleResizeMode()&&this.transcriptWindow.focus({preventScroll:!0});return}if(a==="escape"){if(this.draggableResizable&&this.draggableResizable.pointerResizeMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disablePointerResizeMode();return}if(this.draggableResizable&&this.draggableResizable.keyboardDragMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),this.announceLive(l.t("transcript.dragModeDisabled"));return}e.preventDefault(),e.stopPropagation(),this.hideTranscript({focusButton:!0});return}}},this.transcriptWindow.addEventListener("keydown",this.customKeyHandler))}toggleKeyboardDragMode(){if(this.draggableResizable){let t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();let i=this.draggableResizable.keyboardDragMode;!t&&i&&this.enableMoveMode(),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){if(this.settingsMenuJustOpened=!0,setTimeout(()=>{this.settingsMenuJustOpened=!1},350),this.documentClickHandlerAdded||setTimeout(()=>{document.addEventListener("click",this.handlers.documentClick),this.documentClickHandlerAdded=!0},300),this.settingsMenu){this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.attachSettingsMenuKeyboardNavigation(),this.positionSettingsMenuImmediate(),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50);return}this.settingsMenu=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-settings-menu`,attributes:{role:"menu"}});let t=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"move",label:"transcript.enableDragMode",hasTextClass:!0,onClick:()=>{this.toggleKeyboardDragMode(),this.hideSettingsMenu()}});t.setAttribute("role","switch"),t.setAttribute("aria-checked","false");let i=t.querySelector(`.${this.player.options.classPrefix}-tooltip`);i&&i.remove();let e=t.querySelector(`.${this.player.options.classPrefix}-button-text`);e&&e.remove(),this.dragOptionButton=t,this.dragOptionText=t.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateDragOptionState();let a=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"settings",label:"transcript.styleTranscript",onClick:g=>{g.preventDefault(),g.stopPropagation(),this.hideSettingsMenu(),setTimeout(()=>{this.showStyleDialog()},50)}}),n=a.querySelector(`.${this.player.options.classPrefix}-tooltip`);n&&n.remove();let c=a.querySelector(`.${this.player.options.classPrefix}-button-text`);c&&c.remove();let p=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"resize",label:"transcript.enableResizeMode",hasTextClass:!0,onClick:g=>{g.preventDefault(),g.stopPropagation(),this.toggleResizeMode({focus:!1})?(this.hideSettingsMenu({focusButton:!1}),setTimeout(()=>{this.transcriptWindow&&this.transcriptWindow.focus({preventScroll:!0})},20)):this.hideSettingsMenu({focusButton:!0})}});p.setAttribute("role","switch"),p.setAttribute("aria-checked","false");let r=p.querySelector(`.${this.player.options.classPrefix}-tooltip`);r&&r.remove();let s=p.querySelector(`.${this.player.options.classPrefix}-button-text`);s&&s.remove(),this.resizeOptionButton=p,this.resizeOptionText=p.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateResizeOptionState();let h=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});h.setAttribute("role","switch"),h.setAttribute("aria-checked",this.showTimestamps?"true":"false");let u=h.querySelector(`.${this.player.options.classPrefix}-tooltip`);u&&u.remove();let y=h.querySelector(`.${this.player.options.classPrefix}-button-text`);y&&y.remove(),this.showTimestampsButton=h,this.showTimestampsText=h.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateShowTimestampsState();let d=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"close",label:"transcript.closeMenu",onClick:()=>{this.hideSettingsMenu()}}),T=d.querySelector(`.${this.player.options.classPrefix}-tooltip`);T&&T.remove();let x=d.querySelector(`.${this.player.options.classPrefix}-button-text`);x&&x.remove(),this.settingsMenu.appendChild(t),this.settingsMenu.appendChild(p),this.settingsMenu.appendChild(a),this.settingsMenu.appendChild(h),this.settingsMenu.appendChild(d),this.settingsMenu.style.visibility="hidden",this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.parentNode?this.settingsButton.insertAdjacentElement("afterend",this.settingsMenu):this.headerLeft?this.headerLeft.appendChild(this.settingsMenu):this.transcriptHeader?this.transcriptHeader.appendChild(this.settingsMenu):this.transcriptWindow.appendChild(this.settingsMenu),this.positionSettingsMenuImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this.settingsMenuKeyHandler=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0})),this.settingsMenuVisible=!0,this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50)}positionSettingsMenuImmediate(){if(!this.settingsMenu||!this.settingsButton)return;let t=this.settingsButton.parentElement;if(!t)return;let i=this.settingsButton.getBoundingClientRect(),e=t.getBoundingClientRect(),a=this.settingsMenu.getBoundingClientRect(),n=window.innerHeight,c=i.left-e.left,p=i.bottom-e.top,r=i.top-e.top,s=n-i.bottom,h=i.top,u=p+4;s<a.height+20&&h>s?(u=r-a.height-4,this.settingsMenu.classList.add("vidply-menu-above")):this.settingsMenu.classList.remove("vidply-menu-above"),this.settingsMenu.style.top=`${u}px`,this.settingsMenu.style.left=`${c}px`,this.settingsMenu.style.right="auto",this.settingsMenu.style.bottom="auto"}positionSettingsMenu(){!this.settingsMenu||!this.settingsButton||requestAnimationFrame(()=>{setTimeout(()=>{this.positionSettingsMenuImmediate()},10)})}attachSettingsMenuKeyboardNavigation(){if(!this.settingsMenu)return;this.settingsMenuKeyHandler&&this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0);let t=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0}));this.settingsMenuKeyHandler=t}hideSettingsMenu({focusButton:t=!0}={}){this.settingsMenu&&(this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this.settingsMenuJustOpened=!1,this.settingsMenuKeyHandler&&(this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0),this.settingsMenuKeyHandler=null),this.settingsButton&&(this.settingsButton.setAttribute("aria-expanded","false"),t&&this.settingsButton.focus({preventScroll:!0})))}enableMoveMode(){this.hideResizeModeIndicator(),this.transcriptWindow.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`);let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-move-tooltip`,textContent:"Drag with mouse or press D for keyboard drag mode"});this.transcriptHeader.appendChild(t),setTimeout(()=>{this.transcriptWindow.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`),t.parentNode&&t.remove()},2e3)}toggleResizeMode({focus:t=!0}={}){return this.draggableResizable?this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0):!1}updateDragOptionState(){if(!this.dragOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.keyboardDragMode),i=t?l.t("transcript.disableDragMode"):l.t("transcript.enableDragMode"),e=t?l.t("transcript.disableDragModeAria"):l.t("transcript.enableDragModeAria");this.dragOptionButton.setAttribute("aria-checked",t?"true":"false"),this.dragOptionButton.setAttribute("aria-label",e),this.dragOptionText&&(this.dragOptionText.textContent=i)}updateResizeOptionState(){if(!this.resizeOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.pointerResizeMode),i=t?l.t("transcript.disableResizeMode"):l.t("transcript.enableResizeMode"),e=t?l.t("transcript.disableResizeModeAria"):l.t("transcript.enableResizeModeAria");this.resizeOptionButton.setAttribute("aria-checked",t?"true":"false"),this.resizeOptionButton.setAttribute("aria-label",e),this.resizeOptionText&&(this.resizeOptionText.textContent=i)}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;let t=this.showTimestamps?l.t("transcript.hideTimestamps"):l.t("transcript.showTimestamps"),i=this.showTimestamps?l.t("transcript.hideTimestampsAria"):l.t("transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",i),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){if(!this.transcriptContent)return;this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(i=>{i.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){let t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){if(!this.transcriptHeader)return;this.hideResizeModeIndicator();let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-tooltip`,textContent:l.t("transcript.resizeModeHint")||"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit."});this.transcriptHeader.appendChild(t),this.resizeModeIndicator=t,this.resizeModeIndicatorTimeout=this.setManagedTimeout(()=>{this.hideResizeModeIndicator()},3e3)}hideResizeModeIndicator(){this.resizeModeIndicatorTimeout&&(this.clearManagedTimeout(this.resizeModeIndicatorTimeout),this.resizeModeIndicatorTimeout=null),this.resizeModeIndicator&&this.resizeModeIndicator.parentNode&&this.resizeModeIndicator.remove(),this.resizeModeIndicator=null}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this.showResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeEnabled"))):(this.hideResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.styleDialog){this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0);return}this.styleDialog=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});let t=o.createElement("h4",{textContent:l.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});this.styleDialog.appendChild(t);let i=this.createStyleSelectControl(l.t("captions.fontSize"),"fontSize",[{label:l.t("fontSizes.small"),value:"90%"},{label:l.t("fontSizes.normal"),value:"100%"},{label:l.t("fontSizes.large"),value:"110%"},{label:l.t("fontSizes.xlarge"),value:"120%"}]);this.styleDialog.appendChild(i);let e=this.createStyleSelectControl(l.t("captions.fontFamily"),"fontFamily",[{label:l.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:l.t("fontFamilies.serif"),value:"serif"},{label:l.t("fontFamilies.monospace"),value:"monospace"}]);this.styleDialog.appendChild(e);let a=this.createStyleColorControl(l.t("captions.color"),"color");this.styleDialog.appendChild(a);let n=this.createStyleColorControl(l.t("captions.backgroundColor"),"backgroundColor");this.styleDialog.appendChild(n);let c=this.createStyleOpacityControl(l.t("captions.opacity"),"opacity");this.styleDialog.appendChild(c);let p=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:l.t("settings.close"),attributes:{type:"button"}});p.addEventListener("click",()=>this.hideStyleDialog()),this.styleDialog.appendChild(p),this.handlers.styleDialogKeydown=r=>{if(this.styleDialogVisible){if(r.key==="Escape"){r.preventDefault(),r.stopPropagation(),this.hideStyleDialog();return}if(r.key==="Tab"){let s=this.styleDialog.querySelectorAll("select, input, button"),h=s[0],u=s[s.length-1];r.shiftKey&&document.activeElement===h?(r.preventDefault(),u.focus({preventScroll:!0})):!r.shiftKey&&document.activeElement===u&&(r.preventDefault(),h.focus({preventScroll:!0}))}}},document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.headerLeft?this.headerLeft.appendChild(this.styleDialog):this.transcriptHeader.appendChild(this.styleDialog),this.applyTranscriptStyles(),this.styleDialogVisible=!0,this.styleDialog.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0)}hideStyleDialog(){this.styleDialog&&(this.styleDialog.style.display="none",this.styleDialogVisible=!1,this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.settingsButton&&this.settingsButton.focus({preventScroll:!0}))}createStyleSelectControl(t,i,e){let a=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),n=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,c=o.createElement("label",{textContent:t,attributes:{for:n}});a.appendChild(c);let p=o.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:n}});return e.forEach(r=>{let s=o.createElement("option",{textContent:r.label,attributes:{value:r.value}});this.transcriptStyle[i]===r.value&&(s.selected=!0),p.appendChild(s)}),p.addEventListener("change",r=>{this.transcriptStyle[i]=r.target.value,this.applyTranscriptStyles(),this.savePreferences()}),a.appendChild(p),a}createStyleColorControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("input",{attributes:{id:a,type:"color",value:this.transcriptStyle[i]},className:`${this.player.options.classPrefix}-transcript-style-color`});return c.addEventListener("input",p=>{this.transcriptStyle[i]=p.target.value,this.applyTranscriptStyles(),this.savePreferences()}),e.appendChild(c),e}createStyleOpacityControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("span",{textContent:Math.round(this.transcriptStyle[i]*100)+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),p=o.createElement("input",{attributes:{id:a,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[i])},className:`${this.player.options.classPrefix}-transcript-style-range`});p.addEventListener("input",s=>{let h=parseFloat(s.target.value);this.transcriptStyle[i]=h,c.textContent=Math.round(h*100)+"%",this.applyTranscriptStyles(),this.savePreferences()});let r=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return r.appendChild(p),r.appendChild(c),e.appendChild(n),e.appendChild(r),e}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){if(!this.transcriptWindow)return;this.transcriptWindow.style.backgroundColor=this.transcriptStyle.backgroundColor,this.transcriptWindow.style.opacity=String(this.transcriptStyle.opacity),this.transcriptContent&&(this.transcriptContent.style.fontSize=this.transcriptStyle.fontSize,this.transcriptContent.style.fontFamily=this.transcriptStyle.fontFamily,this.transcriptContent.style.color=this.transcriptStyle.color),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-text`).forEach(e=>{e.style.fontSize=this.transcriptStyle.fontSize,e.style.fontFamily=this.transcriptStyle.fontFamily,e.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(e=>{e.style.fontFamily=this.transcriptStyle.fontFamily})}setManagedTimeout(t,i){let e=setTimeout(()=>{this.timeouts.delete(e),t()},i);return this.timeouts.add(e),e}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.draggableResizable.destroy(),this.draggableResizable=null),this.transcriptWindow&&this.customKeyHandler&&(this.transcriptWindow.removeEventListener("keydown",this.customKeyHandler),this.customKeyHandler=null),this.handlers.timeupdate&&this.player.off("timeupdate",this.handlers.timeupdate),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.settingsButton&&(this.handlers.settingsClick&&this.settingsButton.removeEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown&&this.settingsButton.removeEventListener("keydown",this.handlers.settingsKeydown)),this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.handlers.documentClick&&document.removeEventListener("click",this.handlers.documentClick),this.handlers.resize&&window.removeEventListener("resize",this.handlers.resize),this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts.clear(),this.handlers=null,this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.settingsMenu=null,this.styleDialog=null,this.transcriptResizeHandles=[],this.resizeOptionButton=null,this.resizeOptionText=null,this.liveRegion=null}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{W as TranscriptManager};