vidply 1.2.0 → 1.2.3

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 (167) hide show
  1. package/README.md +974 -946
  2. package/dist/dev/{vidply.AudioDescriptionManager-R47Q4YR4.js → vidply.AudioDescriptionManager-JYYLK5KB.js} +275 -19
  3. package/dist/dev/vidply.AudioDescriptionManager-JYYLK5KB.js.map +7 -0
  4. package/dist/dev/{vidply.CaptionStyleMenu-7XHRBWUM.js → vidply.CaptionStyleMenu-47RCKQF5.js} +4 -4
  5. package/dist/dev/{vidply.DASHRenderer-PWEMC3BT.js → vidply.DASHRenderer-VEJ4HDHO.js} +3 -3
  6. package/dist/dev/vidply.DASHRenderer-VEJ4HDHO.js.map +7 -0
  7. package/dist/dev/{vidply.FloatingPlayerManager-PKNNNAS2.js → vidply.FloatingPlayerManager-C2UVRPZY.js} +5 -5
  8. package/dist/dev/vidply.FloatingPlayerManager-C2UVRPZY.js.map +7 -0
  9. package/dist/dev/{vidply.HLSRenderer-E7RQ74HI.js → vidply.HLSRenderer-ZVBK2TNQ.js} +4 -4
  10. package/dist/dev/vidply.HLSRenderer-ZVBK2TNQ.js.map +7 -0
  11. package/dist/dev/vidply.HTML5Renderer-HLRQUOCU.js +12 -0
  12. package/dist/dev/{vidply.SignLanguageManager-FET5FQZ7.js → vidply.SignLanguageManager-FLUCBW5H.js} +8 -8
  13. package/dist/dev/vidply.SignLanguageManager-FLUCBW5H.js.map +7 -0
  14. package/dist/dev/{vidply.SoundCloudRenderer-RVSJZODO.js → vidply.SoundCloudRenderer-MGMAJ7NK.js} +3 -3
  15. package/dist/dev/vidply.SoundCloudRenderer-MGMAJ7NK.js.map +7 -0
  16. package/dist/dev/{vidply.TranscriptManager-5GXOQCLX.js → vidply.TranscriptManager-Y2RYXHJW.js} +10 -10
  17. package/dist/dev/vidply.TranscriptManager-Y2RYXHJW.js.map +7 -0
  18. package/dist/dev/{vidply.VimeoRenderer-ER2LSBBW.js → vidply.VimeoRenderer-RQFQD7OE.js} +3 -3
  19. package/dist/dev/vidply.VimeoRenderer-RQFQD7OE.js.map +7 -0
  20. package/dist/dev/{vidply.YouTubeRenderer-NFTOWJAB.js → vidply.YouTubeRenderer-EU2BARZF.js} +3 -3
  21. package/dist/dev/vidply.YouTubeRenderer-EU2BARZF.js.map +7 -0
  22. package/dist/dev/{vidply.chunk-BNFIUL2Z.js → vidply.chunk-6LYZYI5G.js} +3 -3
  23. package/dist/dev/vidply.chunk-6LYZYI5G.js.map +7 -0
  24. package/dist/dev/{vidply.chunk-NQPURMQY.js → vidply.chunk-A4ESEOQ2.js} +6 -6
  25. package/dist/dev/vidply.chunk-A4ESEOQ2.js.map +7 -0
  26. package/dist/dev/{vidply.chunk-W25HUCHS.js → vidply.chunk-CGYIED2I.js} +2 -2
  27. package/dist/dev/vidply.chunk-CGYIED2I.js.map +7 -0
  28. package/dist/dev/{vidply.chunk-SK4V2DAU.js → vidply.chunk-HZ7UOKOU.js} +3 -3
  29. package/dist/dev/{vidply.chunk-RZWZGDV7.js → vidply.chunk-I6EDRYGJ.js} +33 -6
  30. package/dist/dev/vidply.chunk-I6EDRYGJ.js.map +7 -0
  31. package/dist/dev/{vidply.chunk-64WXMTGL.js → vidply.chunk-JKMQGLCJ.js} +5 -5
  32. package/dist/dev/vidply.chunk-JKMQGLCJ.js.map +7 -0
  33. package/dist/dev/{vidply.chunk-DZSDO3B7.js → vidply.chunk-JZNZX32Z.js} +2 -2
  34. package/dist/dev/{vidply.chunk-VMSQAZM7.js → vidply.chunk-P25MRJ6O.js} +2 -2
  35. package/dist/dev/{vidply.chunk-6RQA4ROD.js → vidply.chunk-PRFNESYA.js} +2 -2
  36. package/dist/dev/{vidply.chunk-KI7C3QVL.js → vidply.chunk-UI3RYCVF.js} +4 -3
  37. package/dist/dev/vidply.chunk-UI3RYCVF.js.map +7 -0
  38. package/dist/dev/{vidply.chunk-JJ47NO24.js → vidply.chunk-UNFGMABP.js} +2 -2
  39. package/dist/dev/vidply.chunk-UNFGMABP.js.map +7 -0
  40. package/dist/dev/{vidply.de-4YAT7FFM.js → vidply.de-VAUVSQXC.js} +29 -2
  41. package/dist/dev/vidply.de-VAUVSQXC.js.map +7 -0
  42. package/dist/dev/{vidply.es-LEWIRUBH.js → vidply.es-G65HFWO6.js} +29 -2
  43. package/dist/dev/vidply.es-G65HFWO6.js.map +7 -0
  44. package/dist/dev/vidply.esm.js +648 -35
  45. package/dist/dev/vidply.esm.js.map +3 -3
  46. package/dist/dev/{vidply.fr-Q4GV2NOE.js → vidply.fr-MJNOZELM.js} +29 -2
  47. package/dist/dev/vidply.fr-MJNOZELM.js.map +7 -0
  48. package/dist/dev/{vidply.ja-S6ITA6WU.js → vidply.ja-INMDHIYJ.js} +29 -2
  49. package/dist/dev/vidply.ja-INMDHIYJ.js.map +7 -0
  50. package/dist/legacy/vidply.js +1062 -34
  51. package/dist/legacy/vidply.js.map +3 -3
  52. package/dist/legacy/vidply.min.js +2 -2
  53. package/dist/legacy/vidply.min.meta.json +127 -55
  54. package/dist/prod/vidply.AudioDescriptionManager-EKWUNOPE.min.js +6 -0
  55. package/dist/prod/{vidply.CaptionStyleMenu-M3KVQWB5.min.js → vidply.CaptionStyleMenu-JTWSNHRQ.min.js} +2 -2
  56. package/dist/prod/{vidply.DASHRenderer-DN3S27AV.min.js → vidply.DASHRenderer-CIDAHFWM.min.js} +2 -2
  57. package/dist/prod/{vidply.FloatingPlayerManager-SKAZ4J43.min.js → vidply.FloatingPlayerManager-VZXHPCPM.min.js} +2 -2
  58. package/dist/prod/{vidply.HLSRenderer-62HH4YTK.min.js → vidply.HLSRenderer-Q6EFYKID.min.js} +2 -2
  59. package/dist/prod/vidply.HTML5Renderer-XRDJUTOO.min.js +6 -0
  60. package/dist/prod/{vidply.SignLanguageManager-V3OBTSSF.min.js → vidply.SignLanguageManager-JUOSA5AM.min.js} +2 -2
  61. package/dist/prod/{vidply.SoundCloudRenderer-CXRVZIAJ.min.js → vidply.SoundCloudRenderer-7ODD46PO.min.js} +2 -2
  62. package/dist/prod/{vidply.TranscriptManager-SYM3DFUY.min.js → vidply.TranscriptManager-4B2QKYGQ.min.js} +2 -2
  63. package/dist/prod/{vidply.VimeoRenderer-72TWRYFQ.min.js → vidply.VimeoRenderer-MR3UYLY7.min.js} +2 -2
  64. package/dist/prod/{vidply.YouTubeRenderer-UMHEV3KD.min.js → vidply.YouTubeRenderer-ITRTC7NR.min.js} +2 -2
  65. package/dist/prod/{vidply.chunk-YEENJS3Q.min.js → vidply.chunk-3EEDXU4T.min.js} +2 -2
  66. package/dist/prod/{vidply.chunk-P4UXOHWA.min.js → vidply.chunk-5HTX5QXW.min.js} +1 -1
  67. package/dist/prod/{vidply.chunk-ABPXVDLZ.min.js → vidply.chunk-6OGHHIYP.min.js} +2 -2
  68. package/dist/prod/{vidply.chunk-UK7YGOB5.min.js → vidply.chunk-GUPGMFUZ.min.js} +2 -2
  69. package/dist/prod/{vidply.chunk-WX3MVEAL.min.js → vidply.chunk-MWEBITCP.min.js} +1 -1
  70. package/dist/prod/{vidply.chunk-2TB6MUHO.min.js → vidply.chunk-PL3P3JHR.min.js} +1 -1
  71. package/dist/prod/{vidply.chunk-EKEYJWMG.min.js → vidply.chunk-QQZGV7TD.min.js} +2 -2
  72. package/dist/prod/{vidply.chunk-Z3YDSA7O.min.js → vidply.chunk-U5IRRYG5.min.js} +1 -1
  73. package/dist/prod/{vidply.chunk-TM6AXJVD.min.js → vidply.chunk-VKHV4QHA.min.js} +2 -2
  74. package/dist/prod/{vidply.chunk-P3PQBY7N.min.js → vidply.chunk-XA4M574A.min.js} +1 -1
  75. package/dist/prod/{vidply.chunk-RI3X7WHK.min.js → vidply.chunk-ZPTV4JEP.min.js} +2 -2
  76. package/dist/prod/{vidply.de-BCHXRQ53.min.js → vidply.de-UZHFCEZU.min.js} +2 -2
  77. package/dist/prod/{vidply.es-PICAKMZD.min.js → vidply.es-BOISUV2S.min.js} +2 -2
  78. package/dist/prod/vidply.esm.min.js +2 -2
  79. package/dist/prod/{vidply.fr-ZILI7CDR.min.js → vidply.fr-ICSMKPFM.min.js} +2 -2
  80. package/dist/prod/{vidply.ja-5WQ4OK4J.min.js → vidply.ja-VQ2HKGAY.min.js} +2 -2
  81. package/dist/vidply.css +5852 -5796
  82. package/dist/vidply.esm.min.meta.json +204 -149
  83. package/dist/vidply.min.css +1 -1
  84. package/package.json +11 -11
  85. package/src/controls/CaptionManager.ts +598 -598
  86. package/src/controls/ControlBar.ts +4191 -4159
  87. package/src/controls/KeyboardHelp.ts +326 -0
  88. package/src/controls/KeyboardManager.ts +387 -383
  89. package/src/controls/SettingsDialog.ts +488 -488
  90. package/src/controls/TranscriptManager.ts +2426 -2426
  91. package/src/core/AudioDescriptionManager.ts +863 -774
  92. package/src/core/DescriptionSpeechManager.ts +232 -0
  93. package/src/core/FloatingPlayerManager.ts +674 -674
  94. package/src/core/LazyInit.ts +80 -80
  95. package/src/core/MediaSessionManager.ts +341 -0
  96. package/src/core/MetadataAlertsManager.ts +514 -514
  97. package/src/core/Player.ts +2973 -2872
  98. package/src/core/PosterManager.ts +169 -169
  99. package/src/core/PseudoFullscreen.ts +179 -179
  100. package/src/core/ResponsiveManager.ts +231 -231
  101. package/src/core/ResumeManager.ts +236 -236
  102. package/src/core/SignLanguageManager.ts +1308 -1308
  103. package/src/core/ThemeManager.ts +157 -157
  104. package/src/features/PlaylistManager.ts +1838 -1827
  105. package/src/i18n/i18n.ts +223 -223
  106. package/src/i18n/languages/de.ts +244 -217
  107. package/src/i18n/languages/en.ts +245 -218
  108. package/src/i18n/languages/es.ts +241 -214
  109. package/src/i18n/languages/fr.ts +241 -214
  110. package/src/i18n/languages/ja.ts +241 -214
  111. package/src/icons/Icons.ts +168 -167
  112. package/src/index.ts +196 -193
  113. package/src/renderers/DASHRenderer.ts +1077 -1077
  114. package/src/renderers/HLSRenderer.ts +944 -944
  115. package/src/renderers/HTML5Renderer.ts +389 -389
  116. package/src/renderers/SoundCloudRenderer.ts +437 -437
  117. package/src/renderers/VimeoRenderer.ts +298 -298
  118. package/src/renderers/YouTubeRenderer.ts +290 -290
  119. package/src/styles/vidply.css +5852 -5796
  120. package/src/types/events.ts +128 -122
  121. package/src/types/globals.d.ts +313 -313
  122. package/src/types/options.ts +199 -182
  123. package/src/types/renderer.ts +58 -58
  124. package/src/utils/DOMUtils.ts +281 -281
  125. package/src/utils/DownloadInfo.ts +171 -171
  126. package/src/utils/DraggablePanel.ts +539 -539
  127. package/src/utils/DraggablePanelMenu.ts +195 -195
  128. package/src/utils/DraggableResizable.ts +997 -997
  129. package/src/utils/EventEmitter.ts +59 -59
  130. package/src/utils/FormUtils.ts +95 -95
  131. package/src/utils/MenuFactory.ts +483 -483
  132. package/src/utils/Sanitize.ts +70 -70
  133. package/src/utils/SettingsMenuFactory.ts +289 -289
  134. package/src/utils/StorageManager.ts +287 -287
  135. package/src/utils/TrackLabelUtils.ts +52 -52
  136. package/src/utils/UrlSafe.ts +69 -69
  137. package/src/utils/VideoFrameCapture.ts +114 -114
  138. package/src/utils/WindowComponents.ts +250 -250
  139. package/dist/dev/vidply.AudioDescriptionManager-R47Q4YR4.js.map +0 -7
  140. package/dist/dev/vidply.DASHRenderer-PWEMC3BT.js.map +0 -7
  141. package/dist/dev/vidply.FloatingPlayerManager-PKNNNAS2.js.map +0 -7
  142. package/dist/dev/vidply.HLSRenderer-E7RQ74HI.js.map +0 -7
  143. package/dist/dev/vidply.HTML5Renderer-BU4QJJJY.js +0 -12
  144. package/dist/dev/vidply.SignLanguageManager-FET5FQZ7.js.map +0 -7
  145. package/dist/dev/vidply.SoundCloudRenderer-RVSJZODO.js.map +0 -7
  146. package/dist/dev/vidply.TranscriptManager-5GXOQCLX.js.map +0 -7
  147. package/dist/dev/vidply.VimeoRenderer-ER2LSBBW.js.map +0 -7
  148. package/dist/dev/vidply.YouTubeRenderer-NFTOWJAB.js.map +0 -7
  149. package/dist/dev/vidply.chunk-64WXMTGL.js.map +0 -7
  150. package/dist/dev/vidply.chunk-BNFIUL2Z.js.map +0 -7
  151. package/dist/dev/vidply.chunk-JJ47NO24.js.map +0 -7
  152. package/dist/dev/vidply.chunk-KI7C3QVL.js.map +0 -7
  153. package/dist/dev/vidply.chunk-NQPURMQY.js.map +0 -7
  154. package/dist/dev/vidply.chunk-RZWZGDV7.js.map +0 -7
  155. package/dist/dev/vidply.chunk-W25HUCHS.js.map +0 -7
  156. package/dist/dev/vidply.de-4YAT7FFM.js.map +0 -7
  157. package/dist/dev/vidply.es-LEWIRUBH.js.map +0 -7
  158. package/dist/dev/vidply.fr-Q4GV2NOE.js.map +0 -7
  159. package/dist/dev/vidply.ja-S6ITA6WU.js.map +0 -7
  160. package/dist/prod/vidply.AudioDescriptionManager-RHLIJW5C.min.js +0 -6
  161. package/dist/prod/vidply.HTML5Renderer-IU5T3WEW.min.js +0 -6
  162. /package/dist/dev/{vidply.CaptionStyleMenu-7XHRBWUM.js.map → vidply.CaptionStyleMenu-47RCKQF5.js.map} +0 -0
  163. /package/dist/dev/{vidply.HTML5Renderer-BU4QJJJY.js.map → vidply.HTML5Renderer-HLRQUOCU.js.map} +0 -0
  164. /package/dist/dev/{vidply.chunk-SK4V2DAU.js.map → vidply.chunk-HZ7UOKOU.js.map} +0 -0
  165. /package/dist/dev/{vidply.chunk-DZSDO3B7.js.map → vidply.chunk-JZNZX32Z.js.map} +0 -0
  166. /package/dist/dev/{vidply.chunk-VMSQAZM7.js.map → vidply.chunk-P25MRJ6O.js.map} +0 -0
  167. /package/dist/dev/{vidply.chunk-6RQA4ROD.js.map → vidply.chunk-PRFNESYA.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- import{DraggablePanel as t,createLabeledSelect as e,createMenuItem as i,preventDragOnElement as s}from"./vidply.chunk-YEENJS3Q.min.js";import{DraggableResizable as a}from"./vidply.chunk-2TB6MUHO.min.js";import{TimeUtils as r}from"./vidply.chunk-TM6AXJVD.min.js";import{createIconElement as n}from"./vidply.chunk-ABPXVDLZ.min.js";import{focusElement as l}from"./vidply.chunk-P3PQBY7N.min.js";import{StorageManager as o,deriveTrackLabel as p}from"./vidply.chunk-RI3X7WHK.min.js";import"./vidply.chunk-WX3MVEAL.min.js";import{DOMUtils as c,i18n as h}from"./vidply.chunk-EKEYJWMG.min.js";var d=class{player;_cueUpdateTimeout;autoscrollCheckbox=null;autoscrollEnabled;availableTranscriptLanguages;currentActiveEntry;currentTranscriptLanguage;customKeyHandler=null;documentClickHandlerAdded=!1;draggableResizable;handlers={};headerLeft=null;isVisible;languageLabel;languageSelector;languageSelectorHandler;languageSelectorWrapper=null;liveRegion;metadataCueChangeHandler=null;metadataCues;settingsButton;showTimestamps;showTimestampsButton=null;showTimestampsText=null;storage;styleDialog;styleDialogJustOpened;styleDialogVisible;timeouts;transcriptContent=null;transcriptEntries;transcriptHeader=null;transcriptResizeHandles;transcriptStyle;transcriptWindow;_dashActiveLang;_vttCache;_panel=null;get settingsMenu(){return this._panel?.settingsMenu??null}set settingsMenu(t){}get settingsMenuVisible(){return this._panel?.settingsMenuVisible??!1}set settingsMenuVisible(t){}get settingsMenuJustOpened(){return this._panel?.justOpened??!1}set settingsMenuJustOpened(t){}get dragOptionButton(){return this._panel?.dragOptionButton??null}get dragOptionText(){return this._panel?.dragOptionText??null}get resizeOptionButton(){return this._panel?.resizeOptionButton??null}get resizeOptionText(){return this._panel?.resizeOptionText??null}constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new o("vidply"),this.draggableResizable=null,this.settingsButton=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;const e=this.storage.getTranscriptPreferences();this.autoscrollEnabled="boolean"!=typeof e?.autoscroll||e.autoscroll,this.showTimestamps="boolean"==typeof e?.showTimestamps&&e.showTimestamps,this.transcriptStyle={fontSize:("string"==typeof e?.fontSize?e.fontSize:void 0)||("string"==typeof this.player.options.transcriptFontSize?this.player.options.transcriptFontSize:void 0)||"100%",fontFamily:("string"==typeof e?.fontFamily?e.fontFamily:void 0)||("string"==typeof this.player.options.transcriptFontFamily?this.player.options.transcriptFontFamily:void 0)||"sans-serif",color:("string"==typeof e?.color?e.color:void 0)||("string"==typeof this.player.options.transcriptColor?this.player.options.transcriptColor:void 0)||"#ffffff",backgroundColor:("string"==typeof e?.backgroundColor?e.backgroundColor:void 0)||("string"==typeof this.player.options.transcriptBackgroundColor?this.player.options.transcriptBackgroundColor:void 0)||"#1e1e1e",opacity:("number"==typeof e?.opacity?e.opacity:void 0)??("number"==typeof this.player.options.transcriptOpacity?this.player.options.transcriptOpacity:void 0)??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),seeked:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},textcuesupdate:null,resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null,floatingchange:null},this._cueUpdateTimeout=null,this._dashActiveLang=null,this._vttCache=new Map,this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("seeked",this.handlers.seeked),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.handlers.textcuesupdate=()=>{this.isVisible&&(this.currentTranscriptLanguage&&this._vttCache.has(this.currentTranscriptLanguage)||(this._cueUpdateTimeout&&this.clearManagedTimeout(this._cueUpdateTimeout),this._cueUpdateTimeout=this.setManagedTimeout(()=>{this._cueUpdateTimeout=null,this.loadTranscriptData()},400)))},this.player.on("textcuesupdate",this.handlers.textcuesupdate),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.setManagedTimeout(()=>this.positionTranscript(),100))}),this.handlers.floatingchange=t=>{t&&this.isVisible&&this.hideTranscript()},this.player.on("floatingchange",this.handlers.floatingchange)}_requestStreamingTrack(t){if(!t)return;const e=this.player.renderer;e?.isStreaming&&"function"==typeof e.activateTextTrackForLanguage&&this._dashActiveLang!==t&&(this._dashActiveLang=t,e.activateTextTrackForLanguage(t))}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.player.state?.floating)return;if(this.player.invalidateTrackCache(),this.transcriptWindow)return this.transcriptWindow.style.display="flex",this.isVisible=!0,this.loadTranscriptData(),this._requestStreamingTrack(this.currentTranscriptLanguage),this.updateLanguageSelector(),this.player.controlBar&&"function"==typeof this.player.controlBar.updateTranscriptButton&&this.player.controlBar.updateTranscriptButton(),void l(this.settingsButton,{delay:150});this.createTranscriptWindow(),this.loadTranscriptData(),this._requestStreamingTrack(this.currentTranscriptLanguage);const t=this.transcriptWindow;t&&(t.style.display="flex",this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.setManagedTimeout(()=>this.positionTranscript(),0),l(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&&"function"==typeof this.player.controlBar.updateTranscriptButton&&this.player.controlBar.updateTranscriptButton(),t){const t=this.player.controlBar?.controls?.transcript;t&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":h.t("transcript.ariaLabel"),tabindex:"-1"}}),this.transcriptHeader=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});const a=h.t("transcript.settingsMenu");this.settingsButton=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":a,"aria-expanded":"false"}}),this.settingsButton.appendChild(n("settings")),c.attachTooltip(this.settingsButton,a,this.player.options.classPrefix),this._panel=new t({player:this.player,namespace:"transcript",settingsButton:this.settingsButton,getDraggable:()=>this.draggableResizable,i18nKeys:{enableDrag:"transcript.enableDragMode",disableDrag:"transcript.disableDragMode",enableDragAria:"transcript.enableDragModeAria",disableDragAria:"transcript.disableDragModeAria",enableResize:"transcript.enableResizeMode",disableResize:"transcript.disableResizeMode",enableResizeAria:"transcript.enableResizeModeAria",disableResizeAria:"transcript.disableResizeModeAria",closeMenu:"transcript.closeMenu"},menuAlign:"left",getMenuParent:()=>this.headerLeft??this.transcriptHeader??this.transcriptWindow,getBadgeHost:()=>this.transcriptWindow,onDragItemClick:t=>{this.toggleKeyboardDragMode(),t.hide()},onResizeItemClick:t=>{this.toggleResizeMode({focus:!1})?(t.hide({focusButton:!1}),setTimeout(()=>{this.transcriptWindow?.focus({preventScroll:!0})},20)):t.hide({focusButton:!0})},buildExtraItems:({menu:t,itemClass:e,classPrefix:s,stripInlineTooltip:a})=>{const r=i({classPrefix:s,itemClass:e,icon:"settings",label:"transcript.styleTranscript",onClick:t=>{t.preventDefault(),t.stopPropagation(),this._panel?.hide(),setTimeout(()=>{this.showStyleDialog()},50)}});a(r),t.appendChild(r);const n=i({classPrefix:s,itemClass:e,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});n.setAttribute("role","switch"),n.setAttribute("aria-checked",this.showTimestamps?"true":"false"),a(n),this.showTimestampsButton=n,this.showTimestampsText=n.querySelector(`.${s}-settings-text`),this.updateShowTimestampsState(),t.appendChild(n)}}),this.handlers.settingsClick=t=>{t.preventDefault(),t.stopPropagation(),this._panel?.markJustOpenedForClick(),this._panel?.toggle()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=t=>{"d"===t.key||"D"===t.key?(t.preventDefault(),t.stopPropagation(),this.toggleKeyboardDragMode()):"r"===t.key||"R"===t.key?(t.preventDefault(),t.stopPropagation(),this.toggleResizeMode()):"Escape"===t.key&&this.settingsMenuVisible&&(t.preventDefault(),t.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);const r=c.createElement("h3",{textContent:`${h.t("transcript.title")}. ${h.t("transcript.dragResizePrompt")}`}),l=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,o=c.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:l}});this.autoscrollCheckbox=c.createElement("input",{attributes:{id:l,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);const p=c.createElement("span",{textContent:h.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});o.appendChild(this.autoscrollCheckbox),o.appendChild(p),this.autoscrollCheckbox.addEventListener("change",t=>{this.autoscrollEnabled=t.target.checked,this.saveAutoscrollPreference()}),s(o),this.transcriptHeader.appendChild(r),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(o);const d=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:u,select:g}=e({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:d,hidden:!1});this.languageLabel=u,this.languageSelector=g;const y=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});y.appendChild(u),y.appendChild(g),this.languageSelectorWrapper=y,s(y),this.headerLeft&&this.headerLeft.appendChild(y);const m=h.t("transcript.close"),b=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":m}});b.appendChild(n("close")),c.attachTooltip(b,m,this.player.options.classPrefix),b.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(b),this.transcriptContent=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=c.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=t=>{if(this.styleDialogJustOpened)return;const e=t.target;this.styleDialogVisible&&this.styleDialog&&e&&!this.styleDialog.contains(e)&&this.hideStyleDialog()},this.documentClickHandlerAdded=!1;let f=null;this.handlers.resize=()=>{f&&this.clearManagedTimeout(f),f=this.setManagedTimeout(()=>{this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize,{signal:this.player.lifecycleSignal})}createResizeHandles(){const t=this.transcriptWindow;t&&(this.transcriptResizeHandles=["n","s","e","w","ne","nw","se","sw"].map(e=>{const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${e}`,attributes:{"data-direction":e,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return i.style.display="none",t.appendChild(i),i}))}positionTranscript(){const t=this.player;if(!this.transcriptWindow||!t.videoWrapper||!this.isVisible)return;if(this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;const e=window.innerWidth<768,i=t.videoWrapper.getBoundingClientRect(),s=this.player.state.fullscreen;if(e&&!s){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="300px",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");const e=t.videoWrapper;e&&e.parentNode&&e.nextSibling!==this.transcriptWindow&&e.parentNode.insertBefore(this.transcriptWindow,e.nextSibling)}else if(s){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";const t=260,e=Math.max(t,window.innerWidth-40),i=parseFloat(this.transcriptWindow.style.width)||400,s=Math.max(t,Math.min(i,e));this.transcriptWindow.style.width=`${s}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{const e=parseFloat(this.transcriptWindow.style.width)||400,s=20,a=260,r=this.player.container.getBoundingClientRect();(()=>{"static"===window.getComputedStyle(this.player.container).position&&(this.player.container.style.position="relative")})();const n=window.innerWidth-i.right-s;if(n<e||!(n>=a)){const e=320,s=280,n=Math.min(e,i.width-40),l=Math.min(s,i.height-120),o=t.videoWrapper.getBoundingClientRect(),p=70,c=Math.max(180,l),h=o.bottom-r.top-p-c,d=r.right-o.right+12;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right=`${d}px`,this.transcriptWindow.style.top=`${h}px`,this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.width=`${Math.max(a,n)}px`,this.transcriptWindow.style.maxWidth=`${e}px`,this.transcriptWindow.style.height=`${c}px`,this.transcriptWindow.style.maxHeight=`${s}px`,this.transcriptWindow.style.boxShadow="0 4px 16px rgba(0, 0, 0, 0.6)"}else{const t=i.right-r.left+s,l=Math.max(a,Math.min(e,n)),o=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${t}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${o}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${l}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.boxShadow=""}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(){const t=this.player.textTracks,e=new Map;return t.forEach(t=>{if(("captions"===t.kind||"subtitles"===t.kind)&&!t._vidplyStale){const i=(t.language??"").trim(),s=p(t.label,t.language,"player.captions"),a=i||s;a&&!e.has(a)&&e.set(a,{language:i,label:s,track:t})}}),Array.from(e.values())}updateLanguageSelector(){const t=this.languageSelector;if(!t)return;if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),t.innerHTML="",this.availableTranscriptLanguages.length<2)return void(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none"));if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach(e=>{const i={value:e.language||e.label};e.language&&(i.lang=e.language);const s=c.createElement("option",{textContent:e.label,attributes:i});t.appendChild(s)}),this.currentTranscriptLanguage)t.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){const e=this.player.textTracks.find(t=>("captions"===t.kind||"subtitles"===t.kind)&&"showing"===t.mode),i=this.availableTranscriptLanguages[0];this.currentTranscriptLanguage=e?e.language:i?i.language:null,this.currentTranscriptLanguage&&(t.value=this.currentTranscriptLanguage)}this.languageSelectorHandler&&t.removeEventListener("change",this.languageSelectorHandler);const e=t=>{this.currentTranscriptLanguage=t.target.value,this._requestStreamingTrack(this.currentTranscriptLanguage),this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)};this.languageSelectorHandler=e,t.addEventListener("change",e)}_parseVTT(t){const e=[],i=t.replace(/\r\n/g,"\n").split(/\n\n+/);for(const t of i){const i=t.trim().split("\n");let s=-1;for(let t=0;t<i.length;t++)if(i[t]?.includes("--\x3e")){s=t;break}if(s<0)continue;const a=i[s]?.match(/(\d{1,2}:)?(\d{2}):(\d{2})\.(\d{3})\s*-->\s*(\d{1,2}:)?(\d{2}):(\d{2})\.(\d{3})/);if(!a)continue;const r=(a[1]?3600*parseInt(a[1]):0)+60*parseInt(a[2]??"0")+parseInt(a[3]??"0")+parseInt(a[4]??"0")/1e3,n=(a[5]?3600*parseInt(a[5]):0)+60*parseInt(a[6]??"0")+parseInt(a[7]??"0")+parseInt(a[8]??"0")/1e3,l=i.slice(s+1).join("\n").trim();l&&e.push({cue:{startTime:r,endTime:n,text:l,id:""},type:"caption"})}return e}async _loadVttTranscript(t){const e=this._vttCache.get(t);if(e)return e;const i=this.player.renderer;if(!i?.isStreaming||"function"!=typeof i.getTextTrackURLs)return null;const s=i.getTextTrackURLs().find(e=>e.lang===t||e.lang.startsWith(t)||t.startsWith(e.lang));if(!s)return null;const a=this._buildFetchSignal(1e4);try{const e=await fetch(s.url,{signal:a});if(!e.ok)return null;let i=await e.text();if(i.trimStart().startsWith("#EXTM3U")){const t=i.split("\n").map(t=>t.trim()).find(t=>t&&!t.startsWith("#"));if(!t)return null;const e=s.url.substring(0,s.url.lastIndexOf("/")+1),a=t.startsWith("http")?t:new URL(t,e).href,r=await fetch(a,{signal:this._buildFetchSignal(1e4)});if(!r.ok)return null;i=await r.text()}const r=this._parseVTT(i);return r.length>0&&this._vttCache.set(t,r),r}catch{return null}}_buildFetchSignal(t){const e=[],i=this.player.lifecycleSignal;if(i&&e.push(i),"undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout&&e.push(AbortSignal.timeout(t)),0===e.length)return;if(1===e.length)return e[0];const s=AbortSignal.any;return s?s(e):e[0]}loadTranscriptData(){this.transcriptEntries=[],this.currentActiveEntry=null,this.transcriptContent&&(this.transcriptContent.innerHTML="");const t=this.player.textTracks;let e=null;if(this.currentTranscriptLanguage){const i=t.filter(t=>("captions"===t.kind||"subtitles"===t.kind)&&t.language===this.currentTranscriptLanguage&&!t._vidplyStale);e=i.find(t=>t.cues&&t.cues.length>0)||i[0]||null}if(!e){const i=t.filter(t=>("captions"===t.kind||"subtitles"===t.kind)&&!t._vidplyStale);e=i.find(t=>t.cues&&t.cues.length>0)||i[0]||null,e&&(this.currentTranscriptLanguage=e.language)}let i=null;this.currentTranscriptLanguage&&(i=t.find(t=>"descriptions"===t.kind&&t.language===this.currentTranscriptLanguage)||null),i||(i=t.find(t=>"descriptions"===t.kind)||null);const s=t.find(t=>"metadata"===t.kind);if(!e&&!i&&!s)return void this.showNoTranscriptMessage();[e,i,s].filter(t=>Boolean(t)).forEach(t=>{"disabled"===t.mode&&(t.mode="hidden")});const a=this.player.renderer,r=a?.isStreaming&&"function"==typeof a.getTextTrackURLs,n=this.currentTranscriptLanguage||(e?.language??"");if(r&&n){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:h.t("transcript.loading")});return this.transcriptContent?.appendChild(t),void this._loadVttTranscript(n).then(t=>{this.isVisible&&this._renderTranscriptCues(t&&t.length>0?t:null,e,i,s)})}const l=e;if(l&&(!l.cues||0===l.cues.length)){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:h.t("transcript.loading")});this.transcriptContent?.appendChild(t);const e=this.player.findTrackElement?.(l);if(e)l.addEventListener("load",()=>{this.loadTranscriptData()},{once:!0}),this.setManagedTimeout(()=>{this.loadTranscriptData()},1e3);else{let t=0;const e=()=>{t++,this.isVisible&&(l.cues&&l.cues.length>0?this.loadTranscriptData():t<40&&this.setManagedTimeout(e,500))};this.setManagedTimeout(e,300)}return}this._renderTranscriptCues(null,e,i,s)}_renderTranscriptCues(t,e,i,s){this.transcriptEntries=[],this.currentActiveEntry=null;const a=this.transcriptContent;a&&(a.innerHTML="");const r=[];t&&t.length>0?r.push(...t):e&&e.cues&&Array.from(e.cues).forEach(t=>{r.push({cue:t,type:"caption"})}),i&&i.cues&&Array.from(i.cues).forEach(t=>{r.push({cue:t,type:"description"})}),s&&s.cues&&(this.metadataCues=Array.from(s.cues),this.setupMetadataHandling()),r.sort((t,e)=>t.cue.startTime-e.cue.startTime),r.forEach((t,e)=>{const i=this.createTranscriptEntry(t.cue,e,t.type);this.transcriptEntries.push({element:i,cue:t.cue,type:t.type,startTime:t.cue.startTime,endTime:t.cue.endTime}),a?.appendChild(i)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector(),this.updateActiveEntry()}setupMetadataHandlingOnLoad(){const t=()=>{const t=this.player.textTracks.find(t=>"metadata"===t.kind);t?("disabled"===t.mode&&(t.mode="hidden"),this.metadataCueChangeHandler&&t.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{const e=Array.from(t.activeCues||[]);e.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",e.map(t=>({start:t.startTime,end:t.endTime,text:t.text}))),e.forEach(t=>{this.handleMetadataCue(t)})},t.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug&&console.log("[VidPly Metadata] Track enabled,",t.cues?t.cues.length:0,"cues available")):this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){this.metadataCues&&0!==this.metadataCues.length&&this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){const e=(t.text||"").trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:e}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:e,cue:t}),e.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:e}));const i=e.match(/FOCUS:([\w#-]+)/);if(i&&i[1]){const s=i[1],a=document.querySelector(s);a?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",s),this.setManagedTimeout(()=>{a.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",s),this.player.emit("metadata:focus",{time:t.startTime,target:s,element:a,text:e})}const s=e.match(/#[\w-]+/g);s&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",s),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:s,text:e}))}createTranscriptEntry(t,e,i="caption"){const s=this.stripVTTFormatting(t.text||""),a=(h.t("transcript.seekTo")||"Seek to {time}").replace("{time}",r.formatTime(t.startTime)).replace("{text}",s),n=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${i}`,attributes:{type:"button","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":i,"aria-label":`${a} — ${s}`}}),l=c.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:r.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),o=c.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:s});return n.appendChild(l),n.appendChild(o),n.addEventListener("click",()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:h.t("transcript.noTranscript")});this.transcriptContent?.appendChild(t)}updateActiveEntry(){if(!this.isVisible||0===this.transcriptEntries.length)return;const t=this.player.state.currentTime,e=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);e&&e!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),e.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(e.element),this.currentActiveEntry=e):!e&&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;const e=this.transcriptContent.getBoundingClientRect(),i=t.getBoundingClientRect();(i.top<e.top||i.bottom>e.bottom)&&this.transcriptContent.scrollTo({top:t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2,behavior:"smooth"})}saveAutoscrollPreference(){const t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;if(window.innerWidth<768&&!this.player.state.fullscreen)return void(this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null));if(this.draggableResizable)return;this.draggableResizable=new a(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:h.t("transcript.resizeModeHint"),onPointerResizeToggle:t=>{this.transcriptResizeHandles.forEach(e=>{e.style.display=t?"block":"none"}),this.onPointerResizeModeChange(t)},onDragStart:t=>{const e=[`.${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(const i of e)if(t.target.closest(i))return!1;return!0}}),this.customKeyHandler=t=>{const e=t.key.toLowerCase(),i=t.defaultPrevented;if(!this.settingsMenuVisible&&!this.styleDialogVisible){if("home"===e)return t.preventDefault(),t.stopPropagation(),void(this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(h.t("transcript.positionReset"))));if("r"===e){if(i)return;return t.preventDefault(),t.stopPropagation(),void(this.toggleResizeMode()&&this.transcriptWindow?.focus({preventScroll:!0}))}return"escape"===e?this.draggableResizable&&this.draggableResizable.pointerResizeMode?(t.preventDefault(),t.stopPropagation(),void this.draggableResizable.disablePointerResizeMode()):this.draggableResizable&&this.draggableResizable.keyboardDragMode?(t.preventDefault(),t.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),void this.announceLive(h.t("transcript.dragModeDisabled"))):(t.preventDefault(),t.stopPropagation(),void this.hideTranscript({focusButton:!0})):void 0}};const t=this.customKeyHandler;this.transcriptWindow&&t&&this.transcriptWindow.addEventListener("keydown",t,{signal:this.player.lifecycleSignal})}toggleKeyboardDragMode(){if(this.draggableResizable){const t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();const e=this.draggableResizable.keyboardDragMode;!t&&e?(this.enableMoveMode(),this._panel?.showBadge(h.t("transcript.dragModeBadge")),this.announceLive(h.t("transcript.dragModeEnabled"))):t&&!e&&(this._panel?.hideBadge(),this.announceLive(h.t("transcript.dragModeDisabled"))),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow?.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){this._panel?.show()}positionSettingsMenu(){this._panel?.reposition()}hideSettingsMenu({focusButton:t=!0}={}){this._panel?.hide({focusButton:t})}enableMoveMode(){this.transcriptWindow?.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`),setTimeout(()=>{this.transcriptWindow?.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`)},2e3)}toggleResizeMode({focus:t=!0}={}){return!!this.draggableResizable&&(this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0))}updateDragOptionState(){this._panel?.refreshDragState()}updateResizeOptionState(){this._panel?.refreshResizeState()}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;const t=h.t(this.showTimestamps?"transcript.hideTimestamps":"transcript.showTimestamps"),e=h.t(this.showTimestamps?"transcript.hideTimestampsAria":"transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",e),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){this.transcriptContent&&this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(t=>{t.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){const t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){this._panel?.showBadge(h.t("transcript.resizeModeBadge"))}hideResizeModeIndicator(){this._panel?.hideBadge()}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this._panel?.showBadge(h.t("transcript.resizeModeBadge")),this.announceLive(h.t("transcript.resizeModeEnabled"))):(this._panel?.hideBadge(),this.announceLive(h.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.documentClickHandlerAdded||setTimeout(()=>{const t=this.handlers.documentClick;t&&document.addEventListener("click",t,{signal:this.player.lifecycleSignal}),this.documentClickHandlerAdded=!0},300),this.styleDialog)return this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown,{signal:this.player.lifecycleSignal}),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),void setTimeout(()=>{const t=this.styleDialog;if(!t)return;const e=t.querySelector("select, input");e&&e.focus({preventScroll:!0})},0);const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});this.styleDialog=t;const e=c.createElement("h4",{textContent:h.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});t.appendChild(e);const i=this.createStyleSelectControl(h.t("captions.fontSize"),"fontSize",[{label:h.t("fontSizes.small"),value:"90%"},{label:h.t("fontSizes.normal"),value:"100%"},{label:h.t("fontSizes.large"),value:"110%"},{label:h.t("fontSizes.xlarge"),value:"120%"}]);t.appendChild(i);const s=this.createStyleSelectControl(h.t("captions.fontFamily"),"fontFamily",[{label:h.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:h.t("fontFamilies.serif"),value:"serif"},{label:h.t("fontFamilies.monospace"),value:"monospace"}]);t.appendChild(s);const a=this.createStyleColorControl(h.t("captions.color"),"color");t.appendChild(a);const r=this.createStyleColorControl(h.t("captions.backgroundColor"),"backgroundColor");t.appendChild(r);const n=this.createStyleOpacityControl(h.t("captions.opacity"),"opacity");t.appendChild(n);const l=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:h.t("settings.close"),attributes:{type:"button"}});l.addEventListener("click",()=>this.hideStyleDialog()),t.appendChild(l);const o=e=>{if(this.styleDialogVisible){if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void this.hideStyleDialog();if("Tab"===e.key){const i=t.querySelectorAll("select, input, button"),s=i[0],a=i[i.length-1];if(!s||!a)return;e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus({preventScroll:!0})):e.shiftKey||document.activeElement!==a||(e.preventDefault(),s.focus({preventScroll:!0}))}}};this.handlers.styleDialogKeydown=o,document.addEventListener("keydown",o,{signal:this.player.lifecycleSignal}),this.headerLeft?this.headerLeft.appendChild(t):this.transcriptHeader&&this.transcriptHeader.appendChild(t),this.applyTranscriptStyles(),this.styleDialogVisible=!0,t.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{const e=t.querySelector("select, input");e&&e.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,e,i){const s=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,r=c.createElement("label",{textContent:t,attributes:{for:a}});s.appendChild(r);const n=c.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:a}});return i.forEach(t=>{const i=c.createElement("option",{textContent:t.label,attributes:{value:t.value}});this.transcriptStyle[e]===t.value&&(i.selected=!0),n.appendChild(i)}),n.addEventListener("change",t=>{this.transcriptStyle[e]=t.target.value,this.applyTranscriptStyles(),this.savePreferences()}),s.appendChild(n),s}createStyleColorControl(t,e){const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),s=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,a=c.createElement("label",{textContent:t,attributes:{for:s}});i.appendChild(a);const r=c.createElement("input",{attributes:{id:s,type:"color",value:this.transcriptStyle[e]},className:`${this.player.options.classPrefix}-transcript-style-color`});return r.addEventListener("input",t=>{this.transcriptStyle[e]=t.target.value,this.applyTranscriptStyles(),this.savePreferences()}),i.appendChild(r),i}createStyleOpacityControl(t,e){const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),s=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,a=c.createElement("label",{textContent:t,attributes:{for:s}});i.appendChild(a);const r=e,n=c.createElement("span",{textContent:Math.round(100*this.transcriptStyle[r])+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),l=c.createElement("input",{attributes:{id:s,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[r])},className:`${this.player.options.classPrefix}-transcript-style-range`});l.addEventListener("input",t=>{const e=parseFloat(t.target.value);this.transcriptStyle[r]=e,n.textContent=Math.round(100*e)+"%",this.applyTranscriptStyles(),this.savePreferences()});const o=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return o.appendChild(l),o.appendChild(n),i.appendChild(a),i.appendChild(o),i}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){this.transcriptWindow&&(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(t=>{t.style.fontSize=this.transcriptStyle.fontSize,t.style.fontFamily=this.transcriptStyle.fontFamily,t.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(t=>{t.style.fontFamily=this.transcriptStyle.fontFamily}))}setManagedTimeout(t,e){const i=setTimeout(()=>{this.timeouts.delete(i),t()},e);return this.timeouts.add(i),i}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this._panel&&(this._panel.destroy(),this._panel=null),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.seeked&&this.player.off("seeked",this.handlers.seeked),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.handlers.textcuesupdate&&this.player.off("textcuesupdate",this.handlers.textcuesupdate),this.handlers.floatingchange&&this.player.off("floatingchange",this.handlers.floatingchange),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={},this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.styleDialog=null,this.transcriptResizeHandles=[],this.liveRegion=null,this._vttCache.clear()}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{d as TranscriptManager};
6
+ import{DraggablePanel as t,createLabeledSelect as e,createMenuItem as i,preventDragOnElement as s}from"./vidply.chunk-3EEDXU4T.min.js";import{DraggableResizable as a}from"./vidply.chunk-PL3P3JHR.min.js";import{TimeUtils as r}from"./vidply.chunk-VKHV4QHA.min.js";import{createIconElement as n}from"./vidply.chunk-6OGHHIYP.min.js";import{focusElement as l}from"./vidply.chunk-XA4M574A.min.js";import{StorageManager as o,deriveTrackLabel as p}from"./vidply.chunk-ZPTV4JEP.min.js";import"./vidply.chunk-MWEBITCP.min.js";import{DOMUtils as c,i18n as h}from"./vidply.chunk-QQZGV7TD.min.js";var d=class{player;_cueUpdateTimeout;autoscrollCheckbox=null;autoscrollEnabled;availableTranscriptLanguages;currentActiveEntry;currentTranscriptLanguage;customKeyHandler=null;documentClickHandlerAdded=!1;draggableResizable;handlers={};headerLeft=null;isVisible;languageLabel;languageSelector;languageSelectorHandler;languageSelectorWrapper=null;liveRegion;metadataCueChangeHandler=null;metadataCues;settingsButton;showTimestamps;showTimestampsButton=null;showTimestampsText=null;storage;styleDialog;styleDialogJustOpened;styleDialogVisible;timeouts;transcriptContent=null;transcriptEntries;transcriptHeader=null;transcriptResizeHandles;transcriptStyle;transcriptWindow;_dashActiveLang;_vttCache;_panel=null;get settingsMenu(){return this._panel?.settingsMenu??null}set settingsMenu(t){}get settingsMenuVisible(){return this._panel?.settingsMenuVisible??!1}set settingsMenuVisible(t){}get settingsMenuJustOpened(){return this._panel?.justOpened??!1}set settingsMenuJustOpened(t){}get dragOptionButton(){return this._panel?.dragOptionButton??null}get dragOptionText(){return this._panel?.dragOptionText??null}get resizeOptionButton(){return this._panel?.resizeOptionButton??null}get resizeOptionText(){return this._panel?.resizeOptionText??null}constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new o("vidply"),this.draggableResizable=null,this.settingsButton=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;const e=this.storage.getTranscriptPreferences();this.autoscrollEnabled="boolean"!=typeof e?.autoscroll||e.autoscroll,this.showTimestamps="boolean"==typeof e?.showTimestamps&&e.showTimestamps,this.transcriptStyle={fontSize:("string"==typeof e?.fontSize?e.fontSize:void 0)||("string"==typeof this.player.options.transcriptFontSize?this.player.options.transcriptFontSize:void 0)||"100%",fontFamily:("string"==typeof e?.fontFamily?e.fontFamily:void 0)||("string"==typeof this.player.options.transcriptFontFamily?this.player.options.transcriptFontFamily:void 0)||"sans-serif",color:("string"==typeof e?.color?e.color:void 0)||("string"==typeof this.player.options.transcriptColor?this.player.options.transcriptColor:void 0)||"#ffffff",backgroundColor:("string"==typeof e?.backgroundColor?e.backgroundColor:void 0)||("string"==typeof this.player.options.transcriptBackgroundColor?this.player.options.transcriptBackgroundColor:void 0)||"#1e1e1e",opacity:("number"==typeof e?.opacity?e.opacity:void 0)??("number"==typeof this.player.options.transcriptOpacity?this.player.options.transcriptOpacity:void 0)??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),seeked:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},textcuesupdate:null,resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null,floatingchange:null},this._cueUpdateTimeout=null,this._dashActiveLang=null,this._vttCache=new Map,this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("seeked",this.handlers.seeked),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.handlers.textcuesupdate=()=>{this.isVisible&&(this.currentTranscriptLanguage&&this._vttCache.has(this.currentTranscriptLanguage)||(this._cueUpdateTimeout&&this.clearManagedTimeout(this._cueUpdateTimeout),this._cueUpdateTimeout=this.setManagedTimeout(()=>{this._cueUpdateTimeout=null,this.loadTranscriptData()},400)))},this.player.on("textcuesupdate",this.handlers.textcuesupdate),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.setManagedTimeout(()=>this.positionTranscript(),100))}),this.handlers.floatingchange=t=>{t&&this.isVisible&&this.hideTranscript()},this.player.on("floatingchange",this.handlers.floatingchange)}_requestStreamingTrack(t){if(!t)return;const e=this.player.renderer;e?.isStreaming&&"function"==typeof e.activateTextTrackForLanguage&&this._dashActiveLang!==t&&(this._dashActiveLang=t,e.activateTextTrackForLanguage(t))}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.player.state?.floating)return;if(this.player.invalidateTrackCache(),this.transcriptWindow)return this.transcriptWindow.style.display="flex",this.isVisible=!0,this.loadTranscriptData(),this._requestStreamingTrack(this.currentTranscriptLanguage),this.updateLanguageSelector(),this.player.controlBar&&"function"==typeof this.player.controlBar.updateTranscriptButton&&this.player.controlBar.updateTranscriptButton(),void l(this.settingsButton,{delay:150});this.createTranscriptWindow(),this.loadTranscriptData(),this._requestStreamingTrack(this.currentTranscriptLanguage);const t=this.transcriptWindow;t&&(t.style.display="flex",this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.setManagedTimeout(()=>this.positionTranscript(),0),l(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&&"function"==typeof this.player.controlBar.updateTranscriptButton&&this.player.controlBar.updateTranscriptButton(),t){const t=this.player.controlBar?.controls?.transcript;t&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":h.t("transcript.ariaLabel"),tabindex:"-1"}}),this.transcriptHeader=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});const a=h.t("transcript.settingsMenu");this.settingsButton=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":a,"aria-expanded":"false"}}),this.settingsButton.appendChild(n("settings")),c.attachTooltip(this.settingsButton,a,this.player.options.classPrefix),this._panel=new t({player:this.player,namespace:"transcript",settingsButton:this.settingsButton,getDraggable:()=>this.draggableResizable,i18nKeys:{enableDrag:"transcript.enableDragMode",disableDrag:"transcript.disableDragMode",enableDragAria:"transcript.enableDragModeAria",disableDragAria:"transcript.disableDragModeAria",enableResize:"transcript.enableResizeMode",disableResize:"transcript.disableResizeMode",enableResizeAria:"transcript.enableResizeModeAria",disableResizeAria:"transcript.disableResizeModeAria",closeMenu:"transcript.closeMenu"},menuAlign:"left",getMenuParent:()=>this.headerLeft??this.transcriptHeader??this.transcriptWindow,getBadgeHost:()=>this.transcriptWindow,onDragItemClick:t=>{this.toggleKeyboardDragMode(),t.hide()},onResizeItemClick:t=>{this.toggleResizeMode({focus:!1})?(t.hide({focusButton:!1}),setTimeout(()=>{this.transcriptWindow?.focus({preventScroll:!0})},20)):t.hide({focusButton:!0})},buildExtraItems:({menu:t,itemClass:e,classPrefix:s,stripInlineTooltip:a})=>{const r=i({classPrefix:s,itemClass:e,icon:"settings",label:"transcript.styleTranscript",onClick:t=>{t.preventDefault(),t.stopPropagation(),this._panel?.hide(),setTimeout(()=>{this.showStyleDialog()},50)}});a(r),t.appendChild(r);const n=i({classPrefix:s,itemClass:e,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});n.setAttribute("role","switch"),n.setAttribute("aria-checked",this.showTimestamps?"true":"false"),a(n),this.showTimestampsButton=n,this.showTimestampsText=n.querySelector(`.${s}-settings-text`),this.updateShowTimestampsState(),t.appendChild(n)}}),this.handlers.settingsClick=t=>{t.preventDefault(),t.stopPropagation(),this._panel?.markJustOpenedForClick(),this._panel?.toggle()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=t=>{"d"===t.key||"D"===t.key?(t.preventDefault(),t.stopPropagation(),this.toggleKeyboardDragMode()):"r"===t.key||"R"===t.key?(t.preventDefault(),t.stopPropagation(),this.toggleResizeMode()):"Escape"===t.key&&this.settingsMenuVisible&&(t.preventDefault(),t.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);const r=c.createElement("h3",{textContent:`${h.t("transcript.title")}. ${h.t("transcript.dragResizePrompt")}`}),l=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,o=c.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:l}});this.autoscrollCheckbox=c.createElement("input",{attributes:{id:l,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);const p=c.createElement("span",{textContent:h.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});o.appendChild(this.autoscrollCheckbox),o.appendChild(p),this.autoscrollCheckbox.addEventListener("change",t=>{this.autoscrollEnabled=t.target.checked,this.saveAutoscrollPreference()}),s(o),this.transcriptHeader.appendChild(r),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(o);const d=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:u,select:g}=e({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:d,hidden:!1});this.languageLabel=u,this.languageSelector=g;const y=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});y.appendChild(u),y.appendChild(g),this.languageSelectorWrapper=y,s(y),this.headerLeft&&this.headerLeft.appendChild(y);const m=h.t("transcript.close"),b=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":m}});b.appendChild(n("close")),c.attachTooltip(b,m,this.player.options.classPrefix),b.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(b),this.transcriptContent=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=c.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=t=>{if(this.styleDialogJustOpened)return;const e=t.target;this.styleDialogVisible&&this.styleDialog&&e&&!this.styleDialog.contains(e)&&this.hideStyleDialog()},this.documentClickHandlerAdded=!1;let f=null;this.handlers.resize=()=>{f&&this.clearManagedTimeout(f),f=this.setManagedTimeout(()=>{this.draggableResizable&&this.draggableResizable.manuallyPositioned||this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize,{signal:this.player.lifecycleSignal})}createResizeHandles(){const t=this.transcriptWindow;t&&(this.transcriptResizeHandles=["n","s","e","w","ne","nw","se","sw"].map(e=>{const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${e}`,attributes:{"data-direction":e,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return i.style.display="none",t.appendChild(i),i}))}positionTranscript(){const t=this.player;if(!this.transcriptWindow||!t.videoWrapper||!this.isVisible)return;if(this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;const e=window.innerWidth<768,i=t.videoWrapper.getBoundingClientRect(),s=this.player.state.fullscreen;if(e&&!s){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="300px",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");const e=t.videoWrapper;e&&e.parentNode&&e.nextSibling!==this.transcriptWindow&&e.parentNode.insertBefore(this.transcriptWindow,e.nextSibling)}else if(s){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";const t=260,e=Math.max(t,window.innerWidth-40),i=parseFloat(this.transcriptWindow.style.width)||400,s=Math.max(t,Math.min(i,e));this.transcriptWindow.style.width=`${s}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{const e=parseFloat(this.transcriptWindow.style.width)||400,s=20,a=260,r=this.player.container.getBoundingClientRect();(()=>{"static"===window.getComputedStyle(this.player.container).position&&(this.player.container.style.position="relative")})();const n=window.innerWidth-i.right-s;if(n<e||!(n>=a)){const e=320,s=280,n=Math.min(e,i.width-40),l=Math.min(s,i.height-120),o=t.videoWrapper.getBoundingClientRect(),p=70,c=Math.max(180,l),h=o.bottom-r.top-p-c,d=r.right-o.right+12;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right=`${d}px`,this.transcriptWindow.style.top=`${h}px`,this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.width=`${Math.max(a,n)}px`,this.transcriptWindow.style.maxWidth=`${e}px`,this.transcriptWindow.style.height=`${c}px`,this.transcriptWindow.style.maxHeight=`${s}px`,this.transcriptWindow.style.boxShadow="0 4px 16px rgba(0, 0, 0, 0.6)"}else{const t=i.right-r.left+s,l=Math.max(a,Math.min(e,n)),o=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${t}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${o}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${l}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.boxShadow=""}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(){const t=this.player.textTracks,e=new Map;return t.forEach(t=>{if(("captions"===t.kind||"subtitles"===t.kind)&&!t._vidplyStale){const i=(t.language??"").trim(),s=p(t.label,t.language,"player.captions"),a=i||s;a&&!e.has(a)&&e.set(a,{language:i,label:s,track:t})}}),Array.from(e.values())}updateLanguageSelector(){const t=this.languageSelector;if(!t)return;if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),t.innerHTML="",this.availableTranscriptLanguages.length<2)return void(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none"));if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach(e=>{const i={value:e.language||e.label};e.language&&(i.lang=e.language);const s=c.createElement("option",{textContent:e.label,attributes:i});t.appendChild(s)}),this.currentTranscriptLanguage)t.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){const e=this.player.textTracks.find(t=>("captions"===t.kind||"subtitles"===t.kind)&&"showing"===t.mode),i=this.availableTranscriptLanguages[0];this.currentTranscriptLanguage=e?e.language:i?i.language:null,this.currentTranscriptLanguage&&(t.value=this.currentTranscriptLanguage)}this.languageSelectorHandler&&t.removeEventListener("change",this.languageSelectorHandler);const e=t=>{this.currentTranscriptLanguage=t.target.value,this._requestStreamingTrack(this.currentTranscriptLanguage),this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)};this.languageSelectorHandler=e,t.addEventListener("change",e)}_parseVTT(t){const e=[],i=t.replace(/\r\n/g,"\n").split(/\n\n+/);for(const t of i){const i=t.trim().split("\n");let s=-1;for(let t=0;t<i.length;t++)if(i[t]?.includes("--\x3e")){s=t;break}if(s<0)continue;const a=i[s]?.match(/(\d{1,2}:)?(\d{2}):(\d{2})\.(\d{3})\s*-->\s*(\d{1,2}:)?(\d{2}):(\d{2})\.(\d{3})/);if(!a)continue;const r=(a[1]?3600*parseInt(a[1]):0)+60*parseInt(a[2]??"0")+parseInt(a[3]??"0")+parseInt(a[4]??"0")/1e3,n=(a[5]?3600*parseInt(a[5]):0)+60*parseInt(a[6]??"0")+parseInt(a[7]??"0")+parseInt(a[8]??"0")/1e3,l=i.slice(s+1).join("\n").trim();l&&e.push({cue:{startTime:r,endTime:n,text:l,id:""},type:"caption"})}return e}async _loadVttTranscript(t){const e=this._vttCache.get(t);if(e)return e;const i=this.player.renderer;if(!i?.isStreaming||"function"!=typeof i.getTextTrackURLs)return null;const s=i.getTextTrackURLs().find(e=>e.lang===t||e.lang.startsWith(t)||t.startsWith(e.lang));if(!s)return null;const a=this._buildFetchSignal(1e4);try{const e=await fetch(s.url,{signal:a});if(!e.ok)return null;let i=await e.text();if(i.trimStart().startsWith("#EXTM3U")){const t=i.split("\n").map(t=>t.trim()).find(t=>t&&!t.startsWith("#"));if(!t)return null;const e=s.url.substring(0,s.url.lastIndexOf("/")+1),a=t.startsWith("http")?t:new URL(t,e).href,r=await fetch(a,{signal:this._buildFetchSignal(1e4)});if(!r.ok)return null;i=await r.text()}const r=this._parseVTT(i);return r.length>0&&this._vttCache.set(t,r),r}catch{return null}}_buildFetchSignal(t){const e=[],i=this.player.lifecycleSignal;if(i&&e.push(i),"undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout&&e.push(AbortSignal.timeout(t)),0===e.length)return;if(1===e.length)return e[0];const s=AbortSignal.any;return s?s(e):e[0]}loadTranscriptData(){this.transcriptEntries=[],this.currentActiveEntry=null,this.transcriptContent&&(this.transcriptContent.innerHTML="");const t=this.player.textTracks;let e=null;if(this.currentTranscriptLanguage){const i=t.filter(t=>("captions"===t.kind||"subtitles"===t.kind)&&t.language===this.currentTranscriptLanguage&&!t._vidplyStale);e=i.find(t=>t.cues&&t.cues.length>0)||i[0]||null}if(!e){const i=t.filter(t=>("captions"===t.kind||"subtitles"===t.kind)&&!t._vidplyStale);e=i.find(t=>t.cues&&t.cues.length>0)||i[0]||null,e&&(this.currentTranscriptLanguage=e.language)}let i=null;this.currentTranscriptLanguage&&(i=t.find(t=>"descriptions"===t.kind&&t.language===this.currentTranscriptLanguage)||null),i||(i=t.find(t=>"descriptions"===t.kind)||null);const s=t.find(t=>"metadata"===t.kind);if(!e&&!i&&!s)return void this.showNoTranscriptMessage();[e,i,s].filter(t=>Boolean(t)).forEach(t=>{"disabled"===t.mode&&(t.mode="hidden")});const a=this.player.renderer,r=a?.isStreaming&&"function"==typeof a.getTextTrackURLs,n=this.currentTranscriptLanguage||(e?.language??"");if(r&&n){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:h.t("transcript.loading")});return this.transcriptContent?.appendChild(t),void this._loadVttTranscript(n).then(t=>{this.isVisible&&this._renderTranscriptCues(t&&t.length>0?t:null,e,i,s)})}const l=e;if(l&&(!l.cues||0===l.cues.length)){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:h.t("transcript.loading")});this.transcriptContent?.appendChild(t);const e=this.player.findTrackElement?.(l);if(e)l.addEventListener("load",()=>{this.loadTranscriptData()},{once:!0}),this.setManagedTimeout(()=>{this.loadTranscriptData()},1e3);else{let t=0;const e=()=>{t++,this.isVisible&&(l.cues&&l.cues.length>0?this.loadTranscriptData():t<40&&this.setManagedTimeout(e,500))};this.setManagedTimeout(e,300)}return}this._renderTranscriptCues(null,e,i,s)}_renderTranscriptCues(t,e,i,s){this.transcriptEntries=[],this.currentActiveEntry=null;const a=this.transcriptContent;a&&(a.innerHTML="");const r=[];t&&t.length>0?r.push(...t):e&&e.cues&&Array.from(e.cues).forEach(t=>{r.push({cue:t,type:"caption"})}),i&&i.cues&&Array.from(i.cues).forEach(t=>{r.push({cue:t,type:"description"})}),s&&s.cues&&(this.metadataCues=Array.from(s.cues),this.setupMetadataHandling()),r.sort((t,e)=>t.cue.startTime-e.cue.startTime),r.forEach((t,e)=>{const i=this.createTranscriptEntry(t.cue,e,t.type);this.transcriptEntries.push({element:i,cue:t.cue,type:t.type,startTime:t.cue.startTime,endTime:t.cue.endTime}),a?.appendChild(i)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector(),this.updateActiveEntry()}setupMetadataHandlingOnLoad(){const t=()=>{const t=this.player.textTracks.find(t=>"metadata"===t.kind);t?("disabled"===t.mode&&(t.mode="hidden"),this.metadataCueChangeHandler&&t.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{const e=Array.from(t.activeCues||[]);e.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",e.map(t=>({start:t.startTime,end:t.endTime,text:t.text}))),e.forEach(t=>{this.handleMetadataCue(t)})},t.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug&&console.log("[VidPly Metadata] Track enabled,",t.cues?t.cues.length:0,"cues available")):this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){this.metadataCues&&0!==this.metadataCues.length&&this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){const e=(t.text||"").trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:e}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:e,cue:t}),e.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:e}));const i=e.match(/FOCUS:([\w#-]+)/);if(i&&i[1]){const s=i[1],a=document.querySelector(s);a?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",s),this.setManagedTimeout(()=>{a.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",s),this.player.emit("metadata:focus",{time:t.startTime,target:s,element:a,text:e})}const s=e.match(/#[\w-]+/g);s&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",s),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:s,text:e}))}createTranscriptEntry(t,e,i="caption"){const s=this.stripVTTFormatting(t.text||""),a=(h.t("transcript.seekTo")||"Seek to {time}").replace("{time}",r.formatTime(t.startTime)).replace("{text}",s),n=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${i}`,attributes:{type:"button","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":i,"aria-label":`${a} — ${s}`}}),l=c.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:r.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),o=c.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:s});return n.appendChild(l),n.appendChild(o),n.addEventListener("click",()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:h.t("transcript.noTranscript")});this.transcriptContent?.appendChild(t)}updateActiveEntry(){if(!this.isVisible||0===this.transcriptEntries.length)return;const t=this.player.state.currentTime,e=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);e&&e!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),e.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(e.element),this.currentActiveEntry=e):!e&&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;const e=this.transcriptContent.getBoundingClientRect(),i=t.getBoundingClientRect();(i.top<e.top||i.bottom>e.bottom)&&this.transcriptContent.scrollTo({top:t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2,behavior:"smooth"})}saveAutoscrollPreference(){const t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;if(window.innerWidth<768&&!this.player.state.fullscreen)return void(this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null));if(this.draggableResizable)return;this.draggableResizable=new a(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:h.t("transcript.resizeModeHint"),onPointerResizeToggle:t=>{this.transcriptResizeHandles.forEach(e=>{e.style.display=t?"block":"none"}),this.onPointerResizeModeChange(t)},onDragStart:t=>{const e=[`.${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(const i of e)if(t.target.closest(i))return!1;return!0}}),this.customKeyHandler=t=>{const e=t.key.toLowerCase(),i=t.defaultPrevented;if(!this.settingsMenuVisible&&!this.styleDialogVisible){if("home"===e)return t.preventDefault(),t.stopPropagation(),void(this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(h.t("transcript.positionReset"))));if("r"===e){if(i)return;return t.preventDefault(),t.stopPropagation(),void(this.toggleResizeMode()&&this.transcriptWindow?.focus({preventScroll:!0}))}return"escape"===e?this.draggableResizable&&this.draggableResizable.pointerResizeMode?(t.preventDefault(),t.stopPropagation(),void this.draggableResizable.disablePointerResizeMode()):this.draggableResizable&&this.draggableResizable.keyboardDragMode?(t.preventDefault(),t.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),void this.announceLive(h.t("transcript.dragModeDisabled"))):(t.preventDefault(),t.stopPropagation(),void this.hideTranscript({focusButton:!0})):void 0}};const t=this.customKeyHandler;this.transcriptWindow&&t&&this.transcriptWindow.addEventListener("keydown",t,{signal:this.player.lifecycleSignal})}toggleKeyboardDragMode(){if(this.draggableResizable){const t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();const e=this.draggableResizable.keyboardDragMode;!t&&e?(this.enableMoveMode(),this._panel?.showBadge(h.t("transcript.dragModeBadge")),this.announceLive(h.t("transcript.dragModeEnabled"))):t&&!e&&(this._panel?.hideBadge(),this.announceLive(h.t("transcript.dragModeDisabled"))),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow?.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){this._panel?.show()}positionSettingsMenu(){this._panel?.reposition()}hideSettingsMenu({focusButton:t=!0}={}){this._panel?.hide({focusButton:t})}enableMoveMode(){this.transcriptWindow?.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`),setTimeout(()=>{this.transcriptWindow?.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`)},2e3)}toggleResizeMode({focus:t=!0}={}){return!!this.draggableResizable&&(this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0))}updateDragOptionState(){this._panel?.refreshDragState()}updateResizeOptionState(){this._panel?.refreshResizeState()}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;const t=h.t(this.showTimestamps?"transcript.hideTimestamps":"transcript.showTimestamps"),e=h.t(this.showTimestamps?"transcript.hideTimestampsAria":"transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",e),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){this.transcriptContent&&this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(t=>{t.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){const t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){this._panel?.showBadge(h.t("transcript.resizeModeBadge"))}hideResizeModeIndicator(){this._panel?.hideBadge()}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this._panel?.showBadge(h.t("transcript.resizeModeBadge")),this.announceLive(h.t("transcript.resizeModeEnabled"))):(this._panel?.hideBadge(),this.announceLive(h.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.documentClickHandlerAdded||setTimeout(()=>{const t=this.handlers.documentClick;t&&document.addEventListener("click",t,{signal:this.player.lifecycleSignal}),this.documentClickHandlerAdded=!0},300),this.styleDialog)return this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown,{signal:this.player.lifecycleSignal}),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),void setTimeout(()=>{const t=this.styleDialog;if(!t)return;const e=t.querySelector("select, input");e&&e.focus({preventScroll:!0})},0);const t=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});this.styleDialog=t;const e=c.createElement("h4",{textContent:h.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});t.appendChild(e);const i=this.createStyleSelectControl(h.t("captions.fontSize"),"fontSize",[{label:h.t("fontSizes.small"),value:"90%"},{label:h.t("fontSizes.normal"),value:"100%"},{label:h.t("fontSizes.large"),value:"110%"},{label:h.t("fontSizes.xlarge"),value:"120%"}]);t.appendChild(i);const s=this.createStyleSelectControl(h.t("captions.fontFamily"),"fontFamily",[{label:h.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:h.t("fontFamilies.serif"),value:"serif"},{label:h.t("fontFamilies.monospace"),value:"monospace"}]);t.appendChild(s);const a=this.createStyleColorControl(h.t("captions.color"),"color");t.appendChild(a);const r=this.createStyleColorControl(h.t("captions.backgroundColor"),"backgroundColor");t.appendChild(r);const n=this.createStyleOpacityControl(h.t("captions.opacity"),"opacity");t.appendChild(n);const l=c.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:h.t("settings.close"),attributes:{type:"button"}});l.addEventListener("click",()=>this.hideStyleDialog()),t.appendChild(l);const o=e=>{if(this.styleDialogVisible){if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void this.hideStyleDialog();if("Tab"===e.key){const i=t.querySelectorAll("select, input, button"),s=i[0],a=i[i.length-1];if(!s||!a)return;e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus({preventScroll:!0})):e.shiftKey||document.activeElement!==a||(e.preventDefault(),s.focus({preventScroll:!0}))}}};this.handlers.styleDialogKeydown=o,document.addEventListener("keydown",o,{signal:this.player.lifecycleSignal}),this.headerLeft?this.headerLeft.appendChild(t):this.transcriptHeader&&this.transcriptHeader.appendChild(t),this.applyTranscriptStyles(),this.styleDialogVisible=!0,t.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{const e=t.querySelector("select, input");e&&e.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,e,i){const s=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,r=c.createElement("label",{textContent:t,attributes:{for:a}});s.appendChild(r);const n=c.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:a}});return i.forEach(t=>{const i=c.createElement("option",{textContent:t.label,attributes:{value:t.value}});this.transcriptStyle[e]===t.value&&(i.selected=!0),n.appendChild(i)}),n.addEventListener("change",t=>{this.transcriptStyle[e]=t.target.value,this.applyTranscriptStyles(),this.savePreferences()}),s.appendChild(n),s}createStyleColorControl(t,e){const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),s=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,a=c.createElement("label",{textContent:t,attributes:{for:s}});i.appendChild(a);const r=c.createElement("input",{attributes:{id:s,type:"color",value:this.transcriptStyle[e]},className:`${this.player.options.classPrefix}-transcript-style-color`});return r.addEventListener("input",t=>{this.transcriptStyle[e]=t.target.value,this.applyTranscriptStyles(),this.savePreferences()}),i.appendChild(r),i}createStyleOpacityControl(t,e){const i=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),s=`${this.player.options.classPrefix}-transcript-${e}-${Date.now()}`,a=c.createElement("label",{textContent:t,attributes:{for:s}});i.appendChild(a);const r=e,n=c.createElement("span",{textContent:Math.round(100*this.transcriptStyle[r])+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),l=c.createElement("input",{attributes:{id:s,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[r])},className:`${this.player.options.classPrefix}-transcript-style-range`});l.addEventListener("input",t=>{const e=parseFloat(t.target.value);this.transcriptStyle[r]=e,n.textContent=Math.round(100*e)+"%",this.applyTranscriptStyles(),this.savePreferences()});const o=c.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return o.appendChild(l),o.appendChild(n),i.appendChild(a),i.appendChild(o),i}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){this.transcriptWindow&&(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(t=>{t.style.fontSize=this.transcriptStyle.fontSize,t.style.fontFamily=this.transcriptStyle.fontFamily,t.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(t=>{t.style.fontFamily=this.transcriptStyle.fontFamily}))}setManagedTimeout(t,e){const i=setTimeout(()=>{this.timeouts.delete(i),t()},e);return this.timeouts.add(i),i}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this._panel&&(this._panel.destroy(),this._panel=null),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.seeked&&this.player.off("seeked",this.handlers.seeked),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.handlers.textcuesupdate&&this.player.off("textcuesupdate",this.handlers.textcuesupdate),this.handlers.floatingchange&&this.player.off("floatingchange",this.handlers.floatingchange),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={},this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.styleDialog=null,this.transcriptResizeHandles=[],this.liveRegion=null,this._vttCache.clear()}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{d as TranscriptManager};
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- import{loadScriptOnce as e}from"./vidply.chunk-P4UXOHWA.min.js";var t=class{player;media;vimeo;videoId;isReady;iframe;constructor(e){this.player=e,this.media=e.element,this.vimeo=null,this.videoId=null,this.isReady=!1,this.iframe=null}async init(){if(this.videoId=this.extractVideoId(this.player.currentSource||this.player.element.src),!this.videoId)throw new Error("Invalid Vimeo URL");await this.loadVimeoAPI(),this.createIframe(),await this.initializePlayer()}extractVideoId(e){const t=[/vimeo\.com\/(\d+)/,/vimeo\.com\/video\/(\d+)/,/player\.vimeo\.com\/video\/(\d+)/];for(const i of t){const t=e.match(i);if(t&&t[1])return t[1]}return null}async loadVimeoAPI(){return window.Vimeo&&window.Vimeo.Player?Promise.resolve():e("https://player.vimeo.com/api/player.js",{isReady:()=>!(!window.Vimeo||!window.Vimeo.Player)})}createIframe(){this.player.element.style.display="none",this.iframe=document.createElement("div"),this.iframe.id=`vimeo-player-${Math.random().toString(36).substr(2,9)}`,this.iframe.style.width="100%",this.iframe.style.maxHeight="100%",this.player.element.parentNode?.insertBefore(this.iframe,this.player.element)}async initializePlayer(){const e={id:this.videoId,width:"100%",height:"100%",controls:!0,autoplay:this.player.options.autoplay,muted:this.player.options.muted,loop:this.player.options.loop,keyboard:!1};if(this.player.options.startTime>0&&(e.startTime=this.player.options.startTime),!window.Vimeo||!this.iframe)throw new Error("Vimeo Player API is not available");this.vimeo=new window.Vimeo.Player(this.iframe.id,e),await this.vimeo.ready(),this.isReady=!0;const t=this.iframe?.querySelector("iframe");t&&(t.style.width="100%",t.style.height="100%",t.setAttribute("width","100%"),t.setAttribute("height","100%")),this.player.container&&this.player.container.classList.add("vidply-external-controls"),this.attachEvents();try{const e=await this.vimeo.getDuration();this.player.state.duration=e,this.player.emit("loadedmetadata")}catch(e){this.player.log("Error getting duration:",e,"warn")}}attachEvents(){const e=this.vimeo;e&&(e.on("play",()=>{this.player.state.playing=!0,this.player.state.paused=!1,this.player.state.ended=!1,this.player.emit("play"),this.player.options.onPlay&&this.player.options.onPlay.call(this.player)}),e.on("pause",()=>{this.player.state.playing=!1,this.player.state.paused=!0,this.player.emit("pause"),this.player.options.onPause&&this.player.options.onPause.call(this.player)}),e.on("ended",()=>{this.player.state.playing=!1,this.player.state.paused=!0,this.player.state.ended=!0,this.player.emit("ended"),this.player.options.onEnded&&this.player.options.onEnded.call(this.player)}),e.on("timeupdate",(...e)=>{const t=e[0];this.player.state.currentTime=t.seconds,this.player.state.duration=t.duration,this.player.emit("timeupdate",t.seconds),this.player.options.onTimeUpdate&&this.player.options.onTimeUpdate.call(this.player,t.seconds)}),e.on("volumechange",(...e)=>{const t=e[0];this.player.state.volume=t.volume,this.player.emit("volumechange",t.volume)}),e.on("bufferstart",()=>{this.player.state.buffering=!0,this.player.emit("waiting")}),e.on("bufferend",()=>{this.player.state.buffering=!1,this.player.emit("canplay")}),e.on("seeking",()=>{this.player.state.seeking=!0,this.player.emit("seeking")}),e.on("seeked",()=>{this.player.state.seeking=!1,this.player.emit("seeked")}),e.on("playbackratechange",(...e)=>{const t=e[0];this.player.state.playbackSpeed=t.playbackRate,this.player.emit("ratechange",t.playbackRate)}),e.on("error",(...e)=>{const t=e[0];this.player.handleError(new Error(`Vimeo error: ${t?.message??"unknown"}`))}))}play(){if(this.isReady&&this.vimeo){const e=window.scrollX,t=window.scrollY;this.vimeo.play().catch(e=>{this.player.log("Play error:",e,"warn")}),window.scrollTo(e,t)}}pause(){this.isReady&&this.vimeo&&this.vimeo.pause().catch(e=>{this.player.log("Pause error:",e,"warn")})}seek(e){this.isReady&&this.vimeo&&this.vimeo.setCurrentTime(e).catch(e=>{this.player.log("Seek error:",e,"warn")})}setVolume(e){this.isReady&&this.vimeo&&(this.vimeo.setVolume(e).catch(e=>{this.player.log("Volume error:",e,"warn")}),this.player.state.volume=e)}setMuted(e){this.isReady&&this.vimeo&&(this.vimeo.setVolume(e?0:this.player.state.volume),this.player.state.muted=e)}setPlaybackSpeed(e){this.isReady&&this.vimeo&&(this.vimeo.setPlaybackRate(e).catch(e=>{this.player.log("Playback rate error:",e,"warn")}),this.player.state.playbackSpeed=e)}destroy(){this.vimeo&&this.vimeo.destroy&&this.vimeo.destroy(),this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.player.element&&(this.player.element.style.display="")}};export{t as VimeoRenderer};
6
+ import{loadScriptOnce as e}from"./vidply.chunk-5HTX5QXW.min.js";var t=class{player;media;vimeo;videoId;isReady;iframe;constructor(e){this.player=e,this.media=e.element,this.vimeo=null,this.videoId=null,this.isReady=!1,this.iframe=null}async init(){if(this.videoId=this.extractVideoId(this.player.currentSource||this.player.element.src),!this.videoId)throw new Error("Invalid Vimeo URL");await this.loadVimeoAPI(),this.createIframe(),await this.initializePlayer()}extractVideoId(e){const t=[/vimeo\.com\/(\d+)/,/vimeo\.com\/video\/(\d+)/,/player\.vimeo\.com\/video\/(\d+)/];for(const i of t){const t=e.match(i);if(t&&t[1])return t[1]}return null}async loadVimeoAPI(){return window.Vimeo&&window.Vimeo.Player?Promise.resolve():e("https://player.vimeo.com/api/player.js",{isReady:()=>!(!window.Vimeo||!window.Vimeo.Player)})}createIframe(){this.player.element.style.display="none",this.iframe=document.createElement("div"),this.iframe.id=`vimeo-player-${Math.random().toString(36).substr(2,9)}`,this.iframe.style.width="100%",this.iframe.style.maxHeight="100%",this.player.element.parentNode?.insertBefore(this.iframe,this.player.element)}async initializePlayer(){const e={id:this.videoId,width:"100%",height:"100%",controls:!0,autoplay:this.player.options.autoplay,muted:this.player.options.muted,loop:this.player.options.loop,keyboard:!1};if(this.player.options.startTime>0&&(e.startTime=this.player.options.startTime),!window.Vimeo||!this.iframe)throw new Error("Vimeo Player API is not available");this.vimeo=new window.Vimeo.Player(this.iframe.id,e),await this.vimeo.ready(),this.isReady=!0;const t=this.iframe?.querySelector("iframe");t&&(t.style.width="100%",t.style.height="100%",t.setAttribute("width","100%"),t.setAttribute("height","100%")),this.player.container&&this.player.container.classList.add("vidply-external-controls"),this.attachEvents();try{const e=await this.vimeo.getDuration();this.player.state.duration=e,this.player.emit("loadedmetadata")}catch(e){this.player.log("Error getting duration:",e,"warn")}}attachEvents(){const e=this.vimeo;e&&(e.on("play",()=>{this.player.state.playing=!0,this.player.state.paused=!1,this.player.state.ended=!1,this.player.emit("play"),this.player.options.onPlay&&this.player.options.onPlay.call(this.player)}),e.on("pause",()=>{this.player.state.playing=!1,this.player.state.paused=!0,this.player.emit("pause"),this.player.options.onPause&&this.player.options.onPause.call(this.player)}),e.on("ended",()=>{this.player.state.playing=!1,this.player.state.paused=!0,this.player.state.ended=!0,this.player.emit("ended"),this.player.options.onEnded&&this.player.options.onEnded.call(this.player)}),e.on("timeupdate",(...e)=>{const t=e[0];this.player.state.currentTime=t.seconds,this.player.state.duration=t.duration,this.player.emit("timeupdate",t.seconds),this.player.options.onTimeUpdate&&this.player.options.onTimeUpdate.call(this.player,t.seconds)}),e.on("volumechange",(...e)=>{const t=e[0];this.player.state.volume=t.volume,this.player.emit("volumechange",t.volume)}),e.on("bufferstart",()=>{this.player.state.buffering=!0,this.player.emit("waiting")}),e.on("bufferend",()=>{this.player.state.buffering=!1,this.player.emit("canplay")}),e.on("seeking",()=>{this.player.state.seeking=!0,this.player.emit("seeking")}),e.on("seeked",()=>{this.player.state.seeking=!1,this.player.emit("seeked")}),e.on("playbackratechange",(...e)=>{const t=e[0];this.player.state.playbackSpeed=t.playbackRate,this.player.emit("ratechange",t.playbackRate)}),e.on("error",(...e)=>{const t=e[0];this.player.handleError(new Error(`Vimeo error: ${t?.message??"unknown"}`))}))}play(){if(this.isReady&&this.vimeo){const e=window.scrollX,t=window.scrollY;this.vimeo.play().catch(e=>{this.player.log("Play error:",e,"warn")}),window.scrollTo(e,t)}}pause(){this.isReady&&this.vimeo&&this.vimeo.pause().catch(e=>{this.player.log("Pause error:",e,"warn")})}seek(e){this.isReady&&this.vimeo&&this.vimeo.setCurrentTime(e).catch(e=>{this.player.log("Seek error:",e,"warn")})}setVolume(e){this.isReady&&this.vimeo&&(this.vimeo.setVolume(e).catch(e=>{this.player.log("Volume error:",e,"warn")}),this.player.state.volume=e)}setMuted(e){this.isReady&&this.vimeo&&(this.vimeo.setVolume(e?0:this.player.state.volume),this.player.state.muted=e)}setPlaybackSpeed(e){this.isReady&&this.vimeo&&(this.vimeo.setPlaybackRate(e).catch(e=>{this.player.log("Playback rate error:",e,"warn")}),this.player.state.playbackSpeed=e)}destroy(){this.vimeo&&this.vimeo.destroy&&this.vimeo.destroy(),this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.player.element&&(this.player.element.style.display="")}};export{t as VimeoRenderer};
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- import{loadScriptOnce as e}from"./vidply.chunk-P4UXOHWA.min.js";var t=class{player;media;youtube;videoId;isReady;iframe;timeUpdateInterval;constructor(e){this.player=e,this.media=e.element,this.youtube=null,this.videoId=null,this.isReady=!1,this.iframe=null}async init(){if(this.videoId=this.extractVideoId(this.player.currentSource||this.player.element.src),!this.videoId)throw new Error("Invalid YouTube URL");await this.loadYouTubeAPI(),this.createIframe(),await this.initializePlayer()}extractVideoId(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/,/youtube\.com\/embed\/([^&\s]+)/];for(const i of t){const t=e.match(i);if(t&&t[1])return t[1]}return null}async loadYouTubeAPI(){return window.YT&&window.YT.Player?Promise.resolve():e("https://www.youtube.com/iframe_api",{isReady:()=>!(!window.YT||!window.YT.Player),readyTimeout:8e3})}createIframe(){this.player.element.style.display="none",this.iframe=document.createElement("div"),this.iframe.id=`youtube-player-${Math.random().toString(36).substr(2,9)}`,this.iframe.style.width="100%",this.iframe.style.maxHeight="100%",this.player.element.parentNode?.insertBefore(this.iframe,this.player.element)}async initializePlayer(){return new Promise((e,t)=>{window.YT&&this.iframe?this.youtube=new window.YT.Player(this.iframe.id,{videoId:this.videoId??void 0,width:"100%",height:"100%",playerVars:{controls:1,disablekb:0,fs:1,modestbranding:1,rel:0,showinfo:0,iv_load_policy:3,autoplay:this.player.options.autoplay?1:0,mute:this.player.options.muted?1:0,start:this.player.options.startTime||0},events:{onReady:t=>{this.isReady=!0,this.attachEvents(),this.player.container&&this.player.container.classList.add("vidply-external-controls"),e()},onStateChange:e=>this.handleStateChange(e),onError:e=>this.handleError(e)}}):t(new Error("YouTube IFrame API is not available"))})}attachEvents(){this.timeUpdateInterval=setInterval(()=>{const e=this.youtube;if(this.isReady&&e){const t=e.getCurrentTime(),i=e.getDuration();this.player.state.currentTime=t,this.player.state.duration=i,this.player.emit("timeupdate",t)}},250);const e=this.youtube;e&&e.getDuration&&(this.player.state.duration=e.getDuration(),this.player.emit("loadedmetadata"))}handleStateChange(e){const t=window.YT?.PlayerState;if(t)switch(e.data){case t.PLAYING:this.player.state.playing=!0,this.player.state.paused=!1,this.player.state.ended=!1,this.player.state.buffering=!1,this.player.emit("play"),this.player.emit("playing"),this.player.options.onPlay&&this.player.options.onPlay.call(this.player);break;case t.PAUSED:this.player.state.playing=!1,this.player.state.paused=!0,this.player.emit("pause"),this.player.options.onPause&&this.player.options.onPause.call(this.player);break;case t.ENDED:this.player.state.playing=!1,this.player.state.paused=!0,this.player.state.ended=!0,this.player.emit("ended"),this.player.options.onEnded&&this.player.options.onEnded.call(this.player),this.player.options.loop&&this.youtube&&(this.youtube.seekTo(0),this.youtube.playVideo());break;case t.BUFFERING:this.player.state.buffering=!0,this.player.emit("waiting");break;case t.CUED:this.player.emit("loadedmetadata")}}handleError(e){const t=new Error({2:"Invalid video ID",5:"HTML5 player error",100:"Video not found",101:"Video not allowed to be played in embedded players",150:"Video not allowed to be played in embedded players"}[e.data]||"YouTube player error");this.player.handleError(t)}play(){if(this.isReady&&this.youtube){const e=window.scrollX,t=window.scrollY;this.youtube.playVideo(),window.scrollTo(e,t)}}pause(){this.isReady&&this.youtube&&this.youtube.pauseVideo()}seek(e){this.isReady&&this.youtube&&this.youtube.seekTo(e,!0)}setVolume(e){this.isReady&&this.youtube&&(this.youtube.setVolume(100*e),this.player.state.volume=e)}setMuted(e){this.isReady&&this.youtube&&(e?this.youtube.mute():this.youtube.unMute(),this.player.state.muted=e)}setPlaybackSpeed(e){this.isReady&&this.youtube&&(this.youtube.setPlaybackRate(e),this.player.state.playbackSpeed=e)}destroy(){this.timeUpdateInterval&&clearInterval(this.timeUpdateInterval),this.youtube&&this.youtube.destroy&&this.youtube.destroy(),this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.player.element&&(this.player.element.style.display="")}};export{t as YouTubeRenderer};
6
+ import{loadScriptOnce as e}from"./vidply.chunk-5HTX5QXW.min.js";var t=class{player;media;youtube;videoId;isReady;iframe;timeUpdateInterval;constructor(e){this.player=e,this.media=e.element,this.youtube=null,this.videoId=null,this.isReady=!1,this.iframe=null}async init(){if(this.videoId=this.extractVideoId(this.player.currentSource||this.player.element.src),!this.videoId)throw new Error("Invalid YouTube URL");await this.loadYouTubeAPI(),this.createIframe(),await this.initializePlayer()}extractVideoId(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/,/youtube\.com\/embed\/([^&\s]+)/];for(const i of t){const t=e.match(i);if(t&&t[1])return t[1]}return null}async loadYouTubeAPI(){return window.YT&&window.YT.Player?Promise.resolve():e("https://www.youtube.com/iframe_api",{isReady:()=>!(!window.YT||!window.YT.Player),readyTimeout:8e3})}createIframe(){this.player.element.style.display="none",this.iframe=document.createElement("div"),this.iframe.id=`youtube-player-${Math.random().toString(36).substr(2,9)}`,this.iframe.style.width="100%",this.iframe.style.maxHeight="100%",this.player.element.parentNode?.insertBefore(this.iframe,this.player.element)}async initializePlayer(){return new Promise((e,t)=>{window.YT&&this.iframe?this.youtube=new window.YT.Player(this.iframe.id,{videoId:this.videoId??void 0,width:"100%",height:"100%",playerVars:{controls:1,disablekb:0,fs:1,modestbranding:1,rel:0,showinfo:0,iv_load_policy:3,autoplay:this.player.options.autoplay?1:0,mute:this.player.options.muted?1:0,start:this.player.options.startTime||0},events:{onReady:t=>{this.isReady=!0,this.attachEvents(),this.player.container&&this.player.container.classList.add("vidply-external-controls"),e()},onStateChange:e=>this.handleStateChange(e),onError:e=>this.handleError(e)}}):t(new Error("YouTube IFrame API is not available"))})}attachEvents(){this.timeUpdateInterval=setInterval(()=>{const e=this.youtube;if(this.isReady&&e){const t=e.getCurrentTime(),i=e.getDuration();this.player.state.currentTime=t,this.player.state.duration=i,this.player.emit("timeupdate",t)}},250);const e=this.youtube;e&&e.getDuration&&(this.player.state.duration=e.getDuration(),this.player.emit("loadedmetadata"))}handleStateChange(e){const t=window.YT?.PlayerState;if(t)switch(e.data){case t.PLAYING:this.player.state.playing=!0,this.player.state.paused=!1,this.player.state.ended=!1,this.player.state.buffering=!1,this.player.emit("play"),this.player.emit("playing"),this.player.options.onPlay&&this.player.options.onPlay.call(this.player);break;case t.PAUSED:this.player.state.playing=!1,this.player.state.paused=!0,this.player.emit("pause"),this.player.options.onPause&&this.player.options.onPause.call(this.player);break;case t.ENDED:this.player.state.playing=!1,this.player.state.paused=!0,this.player.state.ended=!0,this.player.emit("ended"),this.player.options.onEnded&&this.player.options.onEnded.call(this.player),this.player.options.loop&&this.youtube&&(this.youtube.seekTo(0),this.youtube.playVideo());break;case t.BUFFERING:this.player.state.buffering=!0,this.player.emit("waiting");break;case t.CUED:this.player.emit("loadedmetadata")}}handleError(e){const t=new Error({2:"Invalid video ID",5:"HTML5 player error",100:"Video not found",101:"Video not allowed to be played in embedded players",150:"Video not allowed to be played in embedded players"}[e.data]||"YouTube player error");this.player.handleError(t)}play(){if(this.isReady&&this.youtube){const e=window.scrollX,t=window.scrollY;this.youtube.playVideo(),window.scrollTo(e,t)}}pause(){this.isReady&&this.youtube&&this.youtube.pauseVideo()}seek(e){this.isReady&&this.youtube&&this.youtube.seekTo(e,!0)}setVolume(e){this.isReady&&this.youtube&&(this.youtube.setVolume(100*e),this.player.state.volume=e)}setMuted(e){this.isReady&&this.youtube&&(e?this.youtube.mute():this.youtube.unMute(),this.player.state.muted=e)}setPlaybackSpeed(e){this.isReady&&this.youtube&&(this.youtube.setPlaybackRate(e),this.player.state.playbackSpeed=e)}destroy(){this.timeUpdateInterval&&clearInterval(this.timeUpdateInterval),this.youtube&&this.youtube.destroy&&this.youtube.destroy(),this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.player.element&&(this.player.element.style.display="")}};export{t as YouTubeRenderer};
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- import{createIconElement as t}from"./vidply.chunk-ABPXVDLZ.min.js";import{focusElement as e}from"./vidply.chunk-P3PQBY7N.min.js";import{reducedMotionScrollOptions as s}from"./vidply.chunk-WX3MVEAL.min.js";import{DOMUtils as i,i18n as n}from"./vidply.chunk-EKEYJWMG.min.js";function a({labelClass:t,selectClass:e,labelText:s,selectId:a,hidden:r=!1,onChange:o,options:l=[]}){const d="string"==typeof s&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")||s.startsWith("captions."))&&n.t(s)||s,u=i.createElement("label",{className:t,textContent:d,attributes:{for:a,style:r?"display: none;":void 0}}),h=i.createElement("select",{className:e,attributes:{id:a,style:r?"display: none;":void 0}});return l.forEach(t=>{const e=i.createElement("option",{textContent:t.text,attributes:{value:t.value,selected:t.selected?"selected":void 0}});h.appendChild(e)}),o&&h.addEventListener("change",o),{label:u,select:h}}function r(t){t&&["pointerdown","mousedown","click"].forEach(e=>{t.addEventListener(e,t=>{t.stopPropagation()})})}function o({classPrefix:e,itemClass:s,icon:a,label:r,ariaLabel:o,onClick:l,hasTextClass:d=!1}){const u="string"==typeof r&&(r.startsWith("transcript.")||r.startsWith("player.")||r.startsWith("settings.")),h=o||u&&n.t(r)||r,c=i.createElement("button",{className:s,attributes:{type:"button","aria-label":h,tabindex:"-1"}});a&&c.appendChild(t(a));const p="string"==typeof r&&(r.startsWith("transcript.")||r.startsWith("player.")||r.startsWith("settings."))&&n.t(r)||r,m=i.createElement("span",{textContent:p,className:d?`${e}-settings-text`:void 0,attributes:{"aria-hidden":"true"}});return c.appendChild(m),l&&c.addEventListener("click",l),c}function l(t,i,n=0){t&&setTimeout(()=>{const n=Array.from(t.querySelectorAll(i)).filter(t=>"true"!==t.getAttribute("aria-disabled")),a=n[0];a&&(n.forEach((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")}),e(a,{delay:0}),a.scrollIntoView(s("nearest")))},n)}function d(t,e,s){t&&(t.setAttribute("aria-checked",s.enabled?"true":"false"),t.setAttribute("aria-label",s.enabled?s.enabledAria:s.disabledAria),e&&(e.textContent=s.enabled?s.enabledText:s.disabledText))}function u(t,e,s={}){if(!t||!e)return;const{align:i="left",gap:n=4,spaceReserve:a=20}=s,r=e.parentElement;if(!r)return;const o=e.getBoundingClientRect(),l=r.getBoundingClientRect(),d=t.getBoundingClientRect(),u=window.innerHeight,h=window.innerWidth,c=o.top-l.top,p=o.left-l.left,m=p+o.width/2,g=u-o.bottom;let b,f,y,x=o.bottom-l.top+n,_=null;if(g<d.height+a&&o.top>g?("center"===i?(_=l.bottom-l.top-c+n,x=null):x=c-d.height-n,t.classList.add("vidply-menu-above")):t.classList.remove("vidply-menu-above"),"center"===i){const t=o.left+o.width/2-d.width/2;t<10?(b="0",f="auto",y="translateX(0)"):t+d.width>h-10?(b="auto",f="0",y="translateX(0)"):(b=`${m}px`,f="auto",y="translateX(-50%)")}else b=`${p}px`,f="auto",y="translateX(0)";null!==x?(t.style.top=`${x}px`,t.style.bottom="auto"):null!==_&&(t.style.top="auto",t.style.bottom=`${_}px`),t.style.left=b,t.style.right=f,t.style.transform=y}var h=class{opts;settingsMenu=null;settingsMenuVisible=!1;dragOptionButton=null;dragOptionText=null;resizeOptionButton=null;resizeOptionText=null;_justOpened=!1;_justOpenedTimer=null;_keyHandler=null;_documentClick=null;_documentClickAdded=!1;_modeBadge=null;constructor(t){this.opts=t}get justOpened(){return this._justOpened}get classPrefix(){return this.opts.player.options.classPrefix}get menuClass(){return`${this.classPrefix}-${this.opts.namespace}-settings-menu`}get itemClass(){return`${this.classPrefix}-${this.opts.namespace}-settings-item`}show(){if(this._markJustOpened(350),this._ensureDocumentClickHandler(),this.settingsMenu)return this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.opts.settingsButton.setAttribute("aria-expanded","true"),this._attachKeyboardNavigation(),this._positionImmediate(),this.refreshState(),void l(this.settingsMenu,`.${this.itemClass}`);this._createMenu()}hide({focusButton:t=!0}={}){if(!this.settingsMenu)return;this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this._clearJustOpened(),this._keyHandler&&(this.settingsMenu.removeEventListener("keydown",this._keyHandler,!0),this._keyHandler=null),this.settingsMenu.querySelectorAll(`.${this.itemClass}`).forEach(t=>t.setAttribute("tabindex","-1"));const{settingsButton:e}=this.opts;e.setAttribute("aria-expanded","false"),t&&e.focus({preventScroll:!0})}toggle(){this.settingsMenuVisible?this.hide():this.show()}markJustOpenedForClick(){this._documentClick&&this._markJustOpened(100)}refreshState(){this.refreshDragState(),this.refreshResizeState()}refreshDragState(){const t=this.opts.getDraggable();d(this.dragOptionButton,this.dragOptionText,{enabled:Boolean(t?.keyboardDragMode),enabledText:n.t(this.opts.i18nKeys.disableDrag),disabledText:n.t(this.opts.i18nKeys.enableDrag),enabledAria:n.t(this.opts.i18nKeys.disableDragAria),disabledAria:n.t(this.opts.i18nKeys.enableDragAria)})}refreshResizeState(){const t=this.opts.getDraggable();d(this.resizeOptionButton,this.resizeOptionText,{enabled:Boolean(t?.pointerResizeMode),enabledText:n.t(this.opts.i18nKeys.disableResize),disabledText:n.t(this.opts.i18nKeys.enableResize),enabledAria:n.t(this.opts.i18nKeys.disableResizeAria),disabledAria:n.t(this.opts.i18nKeys.enableResizeAria)})}showBadge(t){const e=this.opts.getBadgeHost?.();if(!e)return;this.hideBadge();const s=i.createElement("span",{className:this.opts.badgeClass??`${this.classPrefix}-${this.opts.namespace}-mode-badge`,textContent:t,attributes:{"aria-hidden":"true"}});e.appendChild(s),this._modeBadge=s}hideBadge(){this._modeBadge&&this._modeBadge.parentNode&&this._modeBadge.remove(),this._modeBadge=null}reposition(){((t,e,s={})=>{requestAnimationFrame(()=>{setTimeout(()=>u(t,e,s),10)})})(this.settingsMenu,this.opts.settingsButton,{align:this.opts.menuAlign,gap:this.opts.menuGap??4,spaceReserve:this.opts.menuSpaceReserve??20})}destroy(){this._justOpenedTimer&&(clearTimeout(this._justOpenedTimer),this._justOpenedTimer=null),this._justOpened=!1,this.hideBadge(),this.settingsMenu&&(this._keyHandler&&this.settingsMenu.removeEventListener("keydown",this._keyHandler,!0),this.settingsMenu.remove(),this.settingsMenu=null),this._keyHandler=null,this.settingsMenuVisible=!1,this.dragOptionButton=null,this.dragOptionText=null,this.resizeOptionButton=null,this.resizeOptionText=null,this._documentClick=null,this._documentClickAdded=!1}_createMenu(){const{settingsButton:t,i18nKeys:e}=this.opts,s=i.createElement("div",{className:this.menuClass,attributes:{role:"menu"}});this.settingsMenu=s;const n=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"move",label:e.enableDrag,hasTextClass:!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.opts.onDragItemClick(this),this.refreshState()}});n.setAttribute("role","switch"),n.setAttribute("aria-checked","false"),n.setAttribute("data-setting","keyboard-drag"),this._stripInlineTooltip(n),this.dragOptionButton=n,this.dragOptionText=n.querySelector(`.${this.classPrefix}-settings-text`);const a=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"resize",label:e.enableResize,hasTextClass:!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.opts.onResizeItemClick(this),this.refreshState()}});a.setAttribute("role","switch"),a.setAttribute("aria-checked","false"),this._stripInlineTooltip(a),this.resizeOptionButton=a,this.resizeOptionText=a.querySelector(`.${this.classPrefix}-settings-text`),s.appendChild(n),s.appendChild(a),this.opts.buildExtraItems&&this.opts.buildExtraItems({menu:s,itemClass:this.itemClass,classPrefix:this.classPrefix,stripInlineTooltip:t=>this._stripInlineTooltip(t)});const r=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"close",label:e.closeMenu,onClick:()=>this.hide()});this._stripInlineTooltip(r),s.appendChild(r),s.style.visibility="hidden",s.style.display="block";const d=this.opts.getMenuParent();t.parentNode?t.insertAdjacentElement("afterend",s):d&&d.appendChild(s),this._positionImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this._attachKeyboardNavigation(),this.settingsMenuVisible=!0,t.setAttribute("aria-expanded","true"),this.refreshState(),l(s,`.${this.itemClass}`)}_attachKeyboardNavigation(){const t=this.settingsMenu;if(!t)return;this._keyHandler&&t.removeEventListener("keydown",this._keyHandler,!0);const e=((t,e,i,n)=>{if(!t)return;const a=Array.from(t.querySelectorAll(i)).filter(t=>"true"!==t.getAttribute("aria-disabled"));if(0===a.length)return;const r=t=>{const i=a.indexOf(document.activeElement);switch(t.key){case"ArrowDown":{t.preventDefault(),t.stopPropagation();const e=(i+1)%a.length;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const n=a[e];n&&(n.focus({preventScroll:!1}),n.scrollIntoView(s("nearest")));break}case"ArrowUp":{t.preventDefault(),t.stopPropagation();const e=(i-1+a.length)%a.length;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const n=a[e];n&&(n.focus({preventScroll:!1}),n.scrollIntoView(s("nearest")));break}case"Home":{t.preventDefault(),t.stopPropagation(),a.forEach((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")});const e=a[0];e&&(e.focus({preventScroll:!1}),e.scrollIntoView(s("nearest")));break}case"End":{t.preventDefault(),t.stopPropagation();const e=a.length-1;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const i=a[e];i&&(i.focus({preventScroll:!1}),i.scrollIntoView(s("nearest")));break}case"Enter":case" ":t.preventDefault(),t.stopPropagation(),document.activeElement&&a.includes(document.activeElement)&&(document.activeElement.click(),n&&setTimeout(()=>{e&&document.contains(e)&&e.focus()},0));break;case"Escape":t.preventDefault(),t.stopPropagation(),n&&n()}};return t.addEventListener("keydown",r,!0),r})(t,this.opts.settingsButton,`.${this.itemClass}`,()=>this.hide({focusButton:!0}));this._keyHandler=e??null}_positionImmediate(){u(this.settingsMenu,this.opts.settingsButton,{align:this.opts.menuAlign,gap:this.opts.menuGap??4,spaceReserve:this.opts.menuSpaceReserve??20})}_stripInlineTooltip(t){const e=t.querySelector(`.${this.classPrefix}-tooltip`);e&&e.remove();const s=t.querySelector(`.${this.classPrefix}-button-text`);s&&s.remove()}_markJustOpened(t){this._justOpened=!0,this._justOpenedTimer&&clearTimeout(this._justOpenedTimer),this._justOpenedTimer=setTimeout(()=>{this._justOpened=!1,this._justOpenedTimer=null},t)}_clearJustOpened(){this._justOpened=!1,this._justOpenedTimer&&(clearTimeout(this._justOpenedTimer),this._justOpenedTimer=null)}_ensureDocumentClickHandler(){this._documentClickAdded||(this._documentClick=t=>{if(this._justOpened)return;const e=t.target,{settingsButton:s}=this.opts;s===e||e&&s.contains(e)||this.settingsMenu&&e&&this.settingsMenu.contains(e)||this.settingsMenuVisible&&this.hide()},setTimeout(()=>{const t=this._documentClick;t&&(document.addEventListener("mousedown",t,{capture:!0,signal:this.opts.player.lifecycleSignal}),this._documentClickAdded=!0)},300))}};export{a as createLabeledSelect,r as preventDragOnElement,o as createMenuItem,h as DraggablePanel};
6
+ import{createIconElement as t}from"./vidply.chunk-6OGHHIYP.min.js";import{focusElement as e}from"./vidply.chunk-XA4M574A.min.js";import{reducedMotionScrollOptions as s}from"./vidply.chunk-MWEBITCP.min.js";import{DOMUtils as i,i18n as n}from"./vidply.chunk-QQZGV7TD.min.js";function a({labelClass:t,selectClass:e,labelText:s,selectId:a,hidden:r=!1,onChange:o,options:l=[]}){const d="string"==typeof s&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")||s.startsWith("captions."))&&n.t(s)||s,u=i.createElement("label",{className:t,textContent:d,attributes:{for:a,style:r?"display: none;":void 0}}),h=i.createElement("select",{className:e,attributes:{id:a,style:r?"display: none;":void 0}});return l.forEach(t=>{const e=i.createElement("option",{textContent:t.text,attributes:{value:t.value,selected:t.selected?"selected":void 0}});h.appendChild(e)}),o&&h.addEventListener("change",o),{label:u,select:h}}function r(t){t&&["pointerdown","mousedown","click"].forEach(e=>{t.addEventListener(e,t=>{t.stopPropagation()})})}function o({classPrefix:e,itemClass:s,icon:a,label:r,ariaLabel:o,onClick:l,hasTextClass:d=!1}){const u="string"==typeof r&&(r.startsWith("transcript.")||r.startsWith("player.")||r.startsWith("settings.")),h=o||u&&n.t(r)||r,c=i.createElement("button",{className:s,attributes:{type:"button","aria-label":h,tabindex:"-1"}});a&&c.appendChild(t(a));const p="string"==typeof r&&(r.startsWith("transcript.")||r.startsWith("player.")||r.startsWith("settings."))&&n.t(r)||r,m=i.createElement("span",{textContent:p,className:d?`${e}-settings-text`:void 0,attributes:{"aria-hidden":"true"}});return c.appendChild(m),l&&c.addEventListener("click",l),c}function l(t,i,n=0){t&&setTimeout(()=>{const n=Array.from(t.querySelectorAll(i)).filter(t=>"true"!==t.getAttribute("aria-disabled")),a=n[0];a&&(n.forEach((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")}),e(a,{delay:0}),a.scrollIntoView(s("nearest")))},n)}function d(t,e,s){t&&(t.setAttribute("aria-checked",s.enabled?"true":"false"),t.setAttribute("aria-label",s.enabled?s.enabledAria:s.disabledAria),e&&(e.textContent=s.enabled?s.enabledText:s.disabledText))}function u(t,e,s={}){if(!t||!e)return;const{align:i="left",gap:n=4,spaceReserve:a=20}=s,r=e.parentElement;if(!r)return;const o=e.getBoundingClientRect(),l=r.getBoundingClientRect(),d=t.getBoundingClientRect(),u=window.innerHeight,h=window.innerWidth,c=o.top-l.top,p=o.left-l.left,m=p+o.width/2,g=u-o.bottom;let b,f,y,x=o.bottom-l.top+n,_=null;if(g<d.height+a&&o.top>g?("center"===i?(_=l.bottom-l.top-c+n,x=null):x=c-d.height-n,t.classList.add("vidply-menu-above")):t.classList.remove("vidply-menu-above"),"center"===i){const t=o.left+o.width/2-d.width/2;t<10?(b="0",f="auto",y="translateX(0)"):t+d.width>h-10?(b="auto",f="0",y="translateX(0)"):(b=`${m}px`,f="auto",y="translateX(-50%)")}else b=`${p}px`,f="auto",y="translateX(0)";null!==x?(t.style.top=`${x}px`,t.style.bottom="auto"):null!==_&&(t.style.top="auto",t.style.bottom=`${_}px`),t.style.left=b,t.style.right=f,t.style.transform=y}var h=class{opts;settingsMenu=null;settingsMenuVisible=!1;dragOptionButton=null;dragOptionText=null;resizeOptionButton=null;resizeOptionText=null;_justOpened=!1;_justOpenedTimer=null;_keyHandler=null;_documentClick=null;_documentClickAdded=!1;_modeBadge=null;constructor(t){this.opts=t}get justOpened(){return this._justOpened}get classPrefix(){return this.opts.player.options.classPrefix}get menuClass(){return`${this.classPrefix}-${this.opts.namespace}-settings-menu`}get itemClass(){return`${this.classPrefix}-${this.opts.namespace}-settings-item`}show(){if(this._markJustOpened(350),this._ensureDocumentClickHandler(),this.settingsMenu)return this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.opts.settingsButton.setAttribute("aria-expanded","true"),this._attachKeyboardNavigation(),this._positionImmediate(),this.refreshState(),void l(this.settingsMenu,`.${this.itemClass}`);this._createMenu()}hide({focusButton:t=!0}={}){if(!this.settingsMenu)return;this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this._clearJustOpened(),this._keyHandler&&(this.settingsMenu.removeEventListener("keydown",this._keyHandler,!0),this._keyHandler=null),this.settingsMenu.querySelectorAll(`.${this.itemClass}`).forEach(t=>t.setAttribute("tabindex","-1"));const{settingsButton:e}=this.opts;e.setAttribute("aria-expanded","false"),t&&e.focus({preventScroll:!0})}toggle(){this.settingsMenuVisible?this.hide():this.show()}markJustOpenedForClick(){this._documentClick&&this._markJustOpened(100)}refreshState(){this.refreshDragState(),this.refreshResizeState()}refreshDragState(){const t=this.opts.getDraggable();d(this.dragOptionButton,this.dragOptionText,{enabled:Boolean(t?.keyboardDragMode),enabledText:n.t(this.opts.i18nKeys.disableDrag),disabledText:n.t(this.opts.i18nKeys.enableDrag),enabledAria:n.t(this.opts.i18nKeys.disableDragAria),disabledAria:n.t(this.opts.i18nKeys.enableDragAria)})}refreshResizeState(){const t=this.opts.getDraggable();d(this.resizeOptionButton,this.resizeOptionText,{enabled:Boolean(t?.pointerResizeMode),enabledText:n.t(this.opts.i18nKeys.disableResize),disabledText:n.t(this.opts.i18nKeys.enableResize),enabledAria:n.t(this.opts.i18nKeys.disableResizeAria),disabledAria:n.t(this.opts.i18nKeys.enableResizeAria)})}showBadge(t){const e=this.opts.getBadgeHost?.();if(!e)return;this.hideBadge();const s=i.createElement("span",{className:this.opts.badgeClass??`${this.classPrefix}-${this.opts.namespace}-mode-badge`,textContent:t,attributes:{"aria-hidden":"true"}});e.appendChild(s),this._modeBadge=s}hideBadge(){this._modeBadge&&this._modeBadge.parentNode&&this._modeBadge.remove(),this._modeBadge=null}reposition(){((t,e,s={})=>{requestAnimationFrame(()=>{setTimeout(()=>u(t,e,s),10)})})(this.settingsMenu,this.opts.settingsButton,{align:this.opts.menuAlign,gap:this.opts.menuGap??4,spaceReserve:this.opts.menuSpaceReserve??20})}destroy(){this._justOpenedTimer&&(clearTimeout(this._justOpenedTimer),this._justOpenedTimer=null),this._justOpened=!1,this.hideBadge(),this.settingsMenu&&(this._keyHandler&&this.settingsMenu.removeEventListener("keydown",this._keyHandler,!0),this.settingsMenu.remove(),this.settingsMenu=null),this._keyHandler=null,this.settingsMenuVisible=!1,this.dragOptionButton=null,this.dragOptionText=null,this.resizeOptionButton=null,this.resizeOptionText=null,this._documentClick=null,this._documentClickAdded=!1}_createMenu(){const{settingsButton:t,i18nKeys:e}=this.opts,s=i.createElement("div",{className:this.menuClass,attributes:{role:"menu"}});this.settingsMenu=s;const n=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"move",label:e.enableDrag,hasTextClass:!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.opts.onDragItemClick(this),this.refreshState()}});n.setAttribute("role","switch"),n.setAttribute("aria-checked","false"),n.setAttribute("data-setting","keyboard-drag"),this._stripInlineTooltip(n),this.dragOptionButton=n,this.dragOptionText=n.querySelector(`.${this.classPrefix}-settings-text`);const a=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"resize",label:e.enableResize,hasTextClass:!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.opts.onResizeItemClick(this),this.refreshState()}});a.setAttribute("role","switch"),a.setAttribute("aria-checked","false"),this._stripInlineTooltip(a),this.resizeOptionButton=a,this.resizeOptionText=a.querySelector(`.${this.classPrefix}-settings-text`),s.appendChild(n),s.appendChild(a),this.opts.buildExtraItems&&this.opts.buildExtraItems({menu:s,itemClass:this.itemClass,classPrefix:this.classPrefix,stripInlineTooltip:t=>this._stripInlineTooltip(t)});const r=o({classPrefix:this.classPrefix,itemClass:this.itemClass,icon:"close",label:e.closeMenu,onClick:()=>this.hide()});this._stripInlineTooltip(r),s.appendChild(r),s.style.visibility="hidden",s.style.display="block";const d=this.opts.getMenuParent();t.parentNode?t.insertAdjacentElement("afterend",s):d&&d.appendChild(s),this._positionImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this._attachKeyboardNavigation(),this.settingsMenuVisible=!0,t.setAttribute("aria-expanded","true"),this.refreshState(),l(s,`.${this.itemClass}`)}_attachKeyboardNavigation(){const t=this.settingsMenu;if(!t)return;this._keyHandler&&t.removeEventListener("keydown",this._keyHandler,!0);const e=((t,e,i,n)=>{if(!t)return;const a=Array.from(t.querySelectorAll(i)).filter(t=>"true"!==t.getAttribute("aria-disabled"));if(0===a.length)return;const r=t=>{const i=a.indexOf(document.activeElement);switch(t.key){case"ArrowDown":{t.preventDefault(),t.stopPropagation();const e=(i+1)%a.length;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const n=a[e];n&&(n.focus({preventScroll:!1}),n.scrollIntoView(s("nearest")));break}case"ArrowUp":{t.preventDefault(),t.stopPropagation();const e=(i-1+a.length)%a.length;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const n=a[e];n&&(n.focus({preventScroll:!1}),n.scrollIntoView(s("nearest")));break}case"Home":{t.preventDefault(),t.stopPropagation(),a.forEach((t,e)=>{t.setAttribute("tabindex",0===e?"0":"-1")});const e=a[0];e&&(e.focus({preventScroll:!1}),e.scrollIntoView(s("nearest")));break}case"End":{t.preventDefault(),t.stopPropagation();const e=a.length-1;a.forEach((t,s)=>{t.setAttribute("tabindex",s===e?"0":"-1")});const i=a[e];i&&(i.focus({preventScroll:!1}),i.scrollIntoView(s("nearest")));break}case"Enter":case" ":t.preventDefault(),t.stopPropagation(),document.activeElement&&a.includes(document.activeElement)&&(document.activeElement.click(),n&&setTimeout(()=>{e&&document.contains(e)&&e.focus()},0));break;case"Escape":t.preventDefault(),t.stopPropagation(),n&&n()}};return t.addEventListener("keydown",r,!0),r})(t,this.opts.settingsButton,`.${this.itemClass}`,()=>this.hide({focusButton:!0}));this._keyHandler=e??null}_positionImmediate(){u(this.settingsMenu,this.opts.settingsButton,{align:this.opts.menuAlign,gap:this.opts.menuGap??4,spaceReserve:this.opts.menuSpaceReserve??20})}_stripInlineTooltip(t){const e=t.querySelector(`.${this.classPrefix}-tooltip`);e&&e.remove();const s=t.querySelector(`.${this.classPrefix}-button-text`);s&&s.remove()}_markJustOpened(t){this._justOpened=!0,this._justOpenedTimer&&clearTimeout(this._justOpenedTimer),this._justOpenedTimer=setTimeout(()=>{this._justOpened=!1,this._justOpenedTimer=null},t)}_clearJustOpened(){this._justOpened=!1,this._justOpenedTimer&&(clearTimeout(this._justOpenedTimer),this._justOpenedTimer=null)}_ensureDocumentClickHandler(){this._documentClickAdded||(this._documentClick=t=>{if(this._justOpened)return;const e=t.target,{settingsButton:s}=this.opts;s===e||e&&s.contains(e)||this.settingsMenu&&e&&this.settingsMenu.contains(e)||this.settingsMenuVisible&&this.hide()},setTimeout(()=>{const t=this._documentClick;t&&(document.addEventListener("mousedown",t,{capture:!0,signal:this.opts.player.lifecycleSignal}),this._documentClickAdded=!0)},300))}};export{a as createLabeledSelect,r as preventDragOnElement,o as createMenuItem,h as DraggablePanel};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- var t={play:'<path d="M8 5v14l11-7z"/>',pause:'<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>',stop:'<rect x="6" y="6" width="12" height="12"/>',rewind:'<path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"/>',forward:'<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/>',skipPrevious:'<path d="M6 6h2v12H6V6zm3 6l8.5 6V6L9 12z"/>',skipNext:'<path d="M16 6h2v12h-2V6zM6 6l8.5 6L6 18V6z"/>',restart:'<path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>',volumeHigh:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>',volumeMedium:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>',volumeLow:'<path d="M7 9v6h4l5 5V4l-5 5H7z"/>',volumeMuted:'<path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>',fullscreen:'<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>',fullscreenExit:'<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>',settings:'<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94L14.4 2.81c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>',captions:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/>',captionsOff:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/><path d="M0 0h24v24H0z" fill="none"/>',pip:'<path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/>',speed:'<path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44z"/><path d="M10.59 15.41a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>',check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',loading:'<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>',error:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',playlist:'<path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/>',hd:'<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm7-1c0 .55-.45 1-1 1h-.75v1.5h-1.5V15H14c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v4zm-3.5-.5h2v-3h-2v3z"/>',transcript:'<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>',chapters:'<path d="M3 5h2v2H3V5zm0 4h2v2H3V9zm0 4h2v2H3v-2zm0 4h2v2H3v-2zM7 5h14v2H7V5zm0 4h14v2H7V9zm0 4h14v2H7v-2zm0 4h14v2H7v-2z"/>',audioDescription:'<rect x="2" y="5" width="20" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><text x="12" y="14.5" text-anchor="middle" font-size="8" font-weight="bold" font-family="Arial, sans-serif" fill="currentColor">AD</text>',audioDescriptionOn:'<rect x="2" y="5" width="20" height="14" rx="2" fill="currentColor"/><text x="12" y="14.5" text-anchor="middle" font-size="8" font-weight="bold" font-family="Arial, sans-serif" class="vidply-icon-ad-fg">AD</text>',signLanguage:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguageOn:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguagePip:'<g transform="scale(1.2) translate(1, 1)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g><polygon points="14,23 23,14 23,23" fill="currentColor"/>',signLanguagePipOn:'<g transform="scale(1.2) translate(1, 1)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g><polygon points="14,23 23,14 23,23" fill="currentColor"/>',music:'<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7zm-1.5 16c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>',moreVertical:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',move:'<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>',resize:'<path d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v2.5L7 11l3-3.5V10h4V7.5l3 3.5-3 3.5z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>',download:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>'},e=t=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">${t}</svg>`,c=(Object.fromEntries(Object.entries(t).map(([t,c])=>[t,e(c)])),(()=>{const c=new DOMParser,h={};for(const[r,l]of Object.entries(t)){const t=c.parseFromString(e(l),"image/svg+xml").documentElement;t&&"svg"===t.nodeName.toLowerCase()&&!t.querySelector("parsererror")&&(h[r]=t)}return h})());function h(t,e=""){const h=document.createElement("span");h.className=`vidply-icon ${e}`.trim(),h.setAttribute("aria-hidden","true");const r=c[t]||c.play;return r&&h.appendChild(r.cloneNode(!0)),h}function r(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","vidply-play-overlay"),t.setAttribute("viewBox","0 0 80 80"),t.setAttribute("width","80"),t.setAttribute("height","80"),t.setAttribute("aria-hidden","true"),t.setAttribute("role","presentation"),t.style.cursor="pointer";const e=document.createElementNS("http://www.w3.org/2000/svg","defs"),c=`vidply-play-shadow-${Math.random().toString(36).slice(2,11)}`,h=document.createElementNS("http://www.w3.org/2000/svg","filter");h.setAttribute("id",c),h.setAttribute("x","-50%"),h.setAttribute("y","-50%"),h.setAttribute("width","200%"),h.setAttribute("height","200%");const r=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");r.setAttribute("in","SourceAlpha"),r.setAttribute("stdDeviation","3");const l=document.createElementNS("http://www.w3.org/2000/svg","feOffset");l.setAttribute("dx","0"),l.setAttribute("dy","2"),l.setAttribute("result","offsetblur");const s=document.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer"),a=document.createElementNS("http://www.w3.org/2000/svg","feFuncA");a.setAttribute("type","linear"),a.setAttribute("slope","0.3"),s.appendChild(a);const v=document.createElementNS("http://www.w3.org/2000/svg","feMerge"),i=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode"),n=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode");n.setAttribute("in","SourceGraphic"),v.appendChild(i),v.appendChild(n),h.appendChild(r),h.appendChild(l),h.appendChild(s),h.appendChild(v),e.appendChild(h),t.appendChild(e);const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx","40"),o.setAttribute("cy","40"),o.setAttribute("r","40"),o.setAttribute("fill","rgba(255, 255, 255, 0.95)"),o.setAttribute("filter",`url(#${c})`),o.setAttribute("class","vidply-play-overlay-bg"),t.appendChild(o);const d=document.createElementNS("http://www.w3.org/2000/svg","polygon");return d.setAttribute("points","32,28 32,52 54,40"),d.setAttribute("fill","#0a406e"),d.setAttribute("class","vidply-play-overlay-icon"),t.appendChild(d),t}export{h as createIconElement,r as createPlayOverlay};
6
+ var t={play:'<path d="M8 5v14l11-7z"/>',pause:'<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>',stop:'<rect x="6" y="6" width="12" height="12"/>',rewind:'<path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"/>',forward:'<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/>',skipPrevious:'<path d="M6 6h2v12H6V6zm3 6l8.5 6V6L9 12z"/>',skipNext:'<path d="M16 6h2v12h-2V6zM6 6l8.5 6L6 18V6z"/>',restart:'<path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>',volumeHigh:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>',volumeMedium:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>',volumeLow:'<path d="M7 9v6h4l5 5V4l-5 5H7z"/>',volumeMuted:'<path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>',fullscreen:'<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>',fullscreenExit:'<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>',settings:'<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94L14.4 2.81c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>',captions:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/>',captionsOff:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/><path d="M0 0h24v24H0z" fill="none"/>',pip:'<path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/>',speed:'<path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44z"/><path d="M10.59 15.41a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>',check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',loading:'<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>',error:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',playlist:'<path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/>',hd:'<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm7-1c0 .55-.45 1-1 1h-.75v1.5h-1.5V15H14c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v4zm-3.5-.5h2v-3h-2v3z"/>',transcript:'<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>',chapters:'<path d="M3 5h2v2H3V5zm0 4h2v2H3V9zm0 4h2v2H3v-2zm0 4h2v2H3v-2zM7 5h14v2H7V5zm0 4h14v2H7V9zm0 4h14v2H7v-2zm0 4h14v2H7v-2z"/>',audioDescription:'<rect x="2" y="5" width="20" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><text x="12" y="14.5" text-anchor="middle" font-size="8" font-weight="bold" font-family="Arial, sans-serif" fill="currentColor">AD</text>',audioDescriptionOn:'<rect x="2" y="5" width="20" height="14" rx="2" fill="currentColor"/><text x="12" y="14.5" text-anchor="middle" font-size="8" font-weight="bold" font-family="Arial, sans-serif" class="vidply-icon-ad-fg">AD</text>',signLanguage:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguageOn:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguagePip:'<g transform="scale(1.2) translate(1, 1)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g><polygon points="14,23 23,14 23,23" fill="currentColor"/>',signLanguagePipOn:'<g transform="scale(1.2) translate(1, 1)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g><polygon points="14,23 23,14 23,23" fill="currentColor"/>',music:'<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7zm-1.5 16c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>',moreVertical:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',move:'<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>',resize:'<path d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v2.5L7 11l3-3.5V10h4V7.5l3 3.5-3 3.5z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>',download:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>',help:'<path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"/>'},e=t=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">${t}</svg>`,c=(Object.fromEntries(Object.entries(t).map(([t,c])=>[t,e(c)])),(()=>{const c=new DOMParser,h={};for(const[l,r]of Object.entries(t)){const t=c.parseFromString(e(r),"image/svg+xml").documentElement;t&&"svg"===t.nodeName.toLowerCase()&&!t.querySelector("parsererror")&&(h[l]=t)}return h})());function h(t,e=""){const h=document.createElement("span");h.className=`vidply-icon ${e}`.trim(),h.setAttribute("aria-hidden","true");const l=c[t]||c.play;return l&&h.appendChild(l.cloneNode(!0)),h}function l(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","vidply-play-overlay"),t.setAttribute("viewBox","0 0 80 80"),t.setAttribute("width","80"),t.setAttribute("height","80"),t.setAttribute("aria-hidden","true"),t.setAttribute("role","presentation"),t.style.cursor="pointer";const e=document.createElementNS("http://www.w3.org/2000/svg","defs"),c=`vidply-play-shadow-${Math.random().toString(36).slice(2,11)}`,h=document.createElementNS("http://www.w3.org/2000/svg","filter");h.setAttribute("id",c),h.setAttribute("x","-50%"),h.setAttribute("y","-50%"),h.setAttribute("width","200%"),h.setAttribute("height","200%");const l=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("stdDeviation","3");const r=document.createElementNS("http://www.w3.org/2000/svg","feOffset");r.setAttribute("dx","0"),r.setAttribute("dy","2"),r.setAttribute("result","offsetblur");const s=document.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer"),a=document.createElementNS("http://www.w3.org/2000/svg","feFuncA");a.setAttribute("type","linear"),a.setAttribute("slope","0.3"),s.appendChild(a);const v=document.createElementNS("http://www.w3.org/2000/svg","feMerge"),i=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode"),n=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode");n.setAttribute("in","SourceGraphic"),v.appendChild(i),v.appendChild(n),h.appendChild(l),h.appendChild(r),h.appendChild(s),h.appendChild(v),e.appendChild(h),t.appendChild(e);const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx","40"),o.setAttribute("cy","40"),o.setAttribute("r","40"),o.setAttribute("fill","rgba(255, 255, 255, 0.95)"),o.setAttribute("filter",`url(#${c})`),o.setAttribute("class","vidply-play-overlay-bg"),t.appendChild(o);const p=document.createElementNS("http://www.w3.org/2000/svg","polygon");return p.setAttribute("points","32,28 32,52 54,40"),p.setAttribute("fill","#0a406e"),p.setAttribute("class","vidply-play-overlay-icon"),t.appendChild(p),t}export{h as createIconElement,l as createPlayOverlay};
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
6
- import{StorageManager as e,deriveTrackLabel as t}from"./vidply.chunk-RI3X7WHK.min.js";import{debounce as i,isMobile as n,rafWithTimeout as a,reducedMotionScrollOptions as s}from"./vidply.chunk-WX3MVEAL.min.js";import{DOMUtils as r,i18n as o}from"./vidply.chunk-EKEYJWMG.min.js";var l=class{player;_altCueChangeHandler=null;cueChangeHandler=null;currentCue;currentTrack;debouncedPositionCaptions;element;storage;tracks;constructor(t){this.player=t,this.tracks=[],this.currentTrack=null,this.currentCue=null,this.storage=new e("vidply"),this.loadSavedPreferences(),this.init()}loadSavedPreferences(){const e=this.storage.getCaptionPreferences();e&&("string"==typeof e.fontSize&&(this.player.options.captionsFontSize=e.fontSize),"string"==typeof e.fontFamily&&(this.player.options.captionsFontFamily=e.fontFamily),"string"==typeof e.color&&(this.player.options.captionsColor=e.color),"string"==typeof e.backgroundColor&&(this.player.options.captionsBackgroundColor=e.backgroundColor),"number"==typeof e.opacity&&(this.player.options.captionsOpacity=e.opacity))}saveCaptionPreferences(){this.storage.saveCaptionPreferences({fontSize:this.player.options.captionsFontSize,fontFamily:this.player.options.captionsFontFamily,color:this.player.options.captionsColor,backgroundColor:this.player.options.captionsBackgroundColor,opacity:this.player.options.captionsOpacity})}init(){this.createElement(),this.loadTracks(),this.attachEvents(),this.player.options.captionsDefault&&this.tracks.length>0&&!this.currentTrack&&this.enable()}createElement(){this.element=r.createElement("div",{className:`${this.player.options.classPrefix}-captions`,attributes:{role:"region","aria-label":o.t("player.captions"),"aria-live":"polite"}}),this.updateStyles(),(this.player.videoWrapper||this.player.container).appendChild(this.element)}loadTracks(){const e=this.player.element.textTracks;let i=-1;const n=new Map;for(let a=0;a<e.length;a++){const s=e[a];if(s&&("subtitles"===s.kind||"captions"===s.kind)&&!s._vidplyStale){s.mode="hidden";const e=`${s.language}|${s.label}`,r=n.get(e);if(r){r.alternatives.push(s);continue}const o=this.player.findTrackElement(s),l=!!o&&o.hasAttribute("default"),c={track:s,language:s.language,label:t(s.label,s.language),kind:s.kind,index:a,isDefault:l,alternatives:[]};this.tracks.push(c),n.set(e,c),l&&(i=this.tracks.length-1)}}i>=0&&requestAnimationFrame(()=>{this.enable(i)})}_syncHlsSubtitleTrack(e,t){const i=this.player.renderer;if(!i?.hls||!i.hls.subtitleTracks?.length)return;const n=i.hls.subtitleTracks;let a=n.findIndex(t=>t.lang===e);a<0&&t&&(a=n.findIndex(e=>e.name===t)),a>=0&&i.hls.subtitleTrack!==a&&(i.hls.subtitleTrack=a,this.player.log(`HLS subtitle track set to index ${a} (${e})`,"info"))}attachEvents(){this.player.on("timeupdate",()=>{this.updateCaptions()}),this.player.on("textcuesupdate",()=>{this.updateCaptions()}),this.player.on("captionschange",()=>{this.updateStyles()}),this.debouncedPositionCaptions=i(()=>{this.positionCaptionsOnMobile()},150),window.addEventListener("resize",this.debouncedPositionCaptions,{signal:this.player.lifecycleSignal}),this.player.on("enterfullscreen",()=>{a(()=>this.positionCaptionsOnMobile(),100)}),this.player.on("exitfullscreen",()=>{a(()=>this.positionCaptionsOnMobile(),100)})}enable(e=0){if(0===this.tracks.length)return;this._cleanupTrackListeners();const t=this.tracks[e];if(t&&t.track){t.track.mode="hidden",this.currentTrack=t,this.player.state.captionsEnabled=!0,t.language&&this.element.setAttribute("lang",t.language);const e=()=>{this.updateCaptions()};if(this.cueChangeHandler=e,t.track.addEventListener("cuechange",e),t.alternatives&&t.alternatives.length>0){const i=()=>{if(this.currentTrack===t)for(const n of t.alternatives)if(n.activeCues&&n.activeCues.length>0)return this.player.log(`Switching to alternative caption track for "${t.label}"`,"info"),t.track.removeEventListener("cuechange",e),t.alternatives.forEach(e=>e.removeEventListener("cuechange",i)),t.track=n,t.track.addEventListener("cuechange",e),this._altCueChangeHandler=null,void this.updateCaptions()};this._altCueChangeHandler=i,t.alternatives.forEach(e=>{e.mode="hidden",e.addEventListener("cuechange",i)})}const i=this.player.findTrackElement(t.track),n=()=>{if(i&&i.readyState<2){const e=()=>{i.removeEventListener("load",e),i.removeEventListener("error",e),requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&this.updateCaptions()})};i.addEventListener("load",e,{once:!0}),i.addEventListener("error",e,{once:!0})}else requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&this.updateCaptions()})};requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&n()}),this._syncHlsSubtitleTrack(t.language,t.label),this.player.emit("captionsenabled",t)}}_cleanupTrackListeners(){if(this.currentTrack&&this.currentTrack.track){const e=this.cueChangeHandler;e&&this.currentTrack.track.removeEventListener("cuechange",e);const t=this._altCueChangeHandler;t&&this.currentTrack.alternatives&&this.currentTrack.alternatives.forEach(e=>{e.removeEventListener("cuechange",t)}),this.currentTrack.track.mode="hidden"}this._altCueChangeHandler=null}disable(){this._cleanupTrackListeners(),this.currentTrack=null,this.element.style.display="none",this.element.replaceChildren(),this.element.removeAttribute("lang"),this.currentCue=null,this.player.state.captionsEnabled=!1,this.player.emit("captionsdisabled")}updateCaptions(){if(!this.currentTrack||!this.currentTrack.track)return;if(this.player.renderer?.handlesOwnCaptions?.())return;if("disabled"===this.currentTrack.track.mode&&(this.currentTrack.track.mode="hidden"),"showing"===this.currentTrack.track.mode&&(this.currentTrack.track.mode="hidden"),!this.currentTrack.track.activeCues)return void(this.currentTrack.track.cues&&this.currentTrack.track.cues.length>0&&this.currentCue&&(this.element.replaceChildren(),this.element.style.display="none",this.currentCue=null));const e=this.currentTrack.track.activeCues,t="audio"===this.player.element.tagName.toLowerCase();if(e.length>0){const i=e[0];if(this.currentCue!==i){this.currentCue=i;const e=i.text||"";if(!e.trim())return;const n=r.renderVTTToDOM(e);if(t){this.element.querySelectorAll(`.${this.player.options.classPrefix}-caption-cue`).forEach(e=>e.classList.remove(`${this.player.options.classPrefix}-caption-active`));const e=`cue-${i.startTime}-${i.endTime}`;let t=this.element.querySelector(`[data-cue-id="${e}"]`);t?t.replaceChildren(n):(t=document.createElement("div"),t.className=`${this.player.options.classPrefix}-caption-cue`,t.setAttribute("data-cue-id",e),t.replaceChildren(n),this.element.appendChild(t)),t.classList.add(`${this.player.options.classPrefix}-caption-active`),requestAnimationFrame(()=>{t&&t.scrollIntoView(s("center"))})}else this.element.replaceChildren(n);this.element.style.display="block",this.positionCaptionsOnMobile(),this.player.emit("captionchange",i)}}else this.currentCue&&(t||(this.element.replaceChildren(),this.element.style.display="none"),this.currentCue=null)}positionCaptionsOnMobile(){if(!this.element||"none"===this.element.style.display)return;const e=this.player.state?.fullscreen||!1,t=n();if(!t&&!e)return void(this.element.style.bottom="");const i=this.player.controlBar?.element;i&&requestAnimationFrame(()=>{if(!this.element||"none"===this.element.style.display)return;const n=i.getBoundingClientRect();if(!this.player.videoWrapper)return;const a=this.player.videoWrapper.getBoundingClientRect().bottom-n.top+16;this.element.style.bottom=`${a}px`,this.player.options.debug&&console.log("[VidPly] Caption position:",{mobile:t,isFullscreen:e,controlsHeight:n.height,bottomOffset:`${a}px`})})}updateStyles(){if(!this.element)return;const e=this.player.options;this.element.style.fontSize=e.captionsFontSize,this.element.style.fontFamily=e.captionsFontFamily,this.element.style.color=e.captionsColor,this.element.style.backgroundColor=this.hexToRgba(e.captionsBackgroundColor,e.captionsOpacity)}hexToRgba(e,t){const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i&&i[1]&&i[2]&&i[3]?`rgba(${parseInt(i[1],16)}, ${parseInt(i[2],16)}, ${parseInt(i[3],16)}, ${t})`:e}setCaptionStyle(e,t){switch(e){case"fontSize":this.player.options.captionsFontSize=String(t);break;case"fontFamily":this.player.options.captionsFontFamily=String(t);break;case"color":this.player.options.captionsColor=String(t);break;case"backgroundColor":this.player.options.captionsBackgroundColor=String(t);break;case"opacity":this.player.options.captionsOpacity=Number(t)}this.updateStyles(),this.saveCaptionPreferences(),this.player.emit("captionschange")}getAvailableTracks(){return this.tracks.map((e,t)=>({index:t,language:e.language,label:e.label||e.language,kind:e.kind}))}refreshTracks(){const e=this.currentTrack?.language,t=this.player.state.captionsEnabled;if(this.currentTrack&&this.disable(),this.tracks=[],this.loadTracks(),this.player.log(`Caption tracks refreshed, found ${this.tracks.length} tracks`,"info"),t&&e&&this.tracks.length>0){const t=this.tracks.findIndex(t=>t.language===e);t>=0&&this.enable(t)}return this.tracks.length}switchTrack(e){e>=0&&e<this.tracks.length&&(this.disable(),this.enable(e))}destroy(){this.disable(),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}};export{l as CaptionManager};
6
+ import{StorageManager as e,deriveTrackLabel as t}from"./vidply.chunk-ZPTV4JEP.min.js";import{debounce as i,isMobile as n,rafWithTimeout as a,reducedMotionScrollOptions as s}from"./vidply.chunk-MWEBITCP.min.js";import{DOMUtils as r,i18n as o}from"./vidply.chunk-QQZGV7TD.min.js";var l=class{player;_altCueChangeHandler=null;cueChangeHandler=null;currentCue;currentTrack;debouncedPositionCaptions;element;storage;tracks;constructor(t){this.player=t,this.tracks=[],this.currentTrack=null,this.currentCue=null,this.storage=new e("vidply"),this.loadSavedPreferences(),this.init()}loadSavedPreferences(){const e=this.storage.getCaptionPreferences();e&&("string"==typeof e.fontSize&&(this.player.options.captionsFontSize=e.fontSize),"string"==typeof e.fontFamily&&(this.player.options.captionsFontFamily=e.fontFamily),"string"==typeof e.color&&(this.player.options.captionsColor=e.color),"string"==typeof e.backgroundColor&&(this.player.options.captionsBackgroundColor=e.backgroundColor),"number"==typeof e.opacity&&(this.player.options.captionsOpacity=e.opacity))}saveCaptionPreferences(){this.storage.saveCaptionPreferences({fontSize:this.player.options.captionsFontSize,fontFamily:this.player.options.captionsFontFamily,color:this.player.options.captionsColor,backgroundColor:this.player.options.captionsBackgroundColor,opacity:this.player.options.captionsOpacity})}init(){this.createElement(),this.loadTracks(),this.attachEvents(),this.player.options.captionsDefault&&this.tracks.length>0&&!this.currentTrack&&this.enable()}createElement(){this.element=r.createElement("div",{className:`${this.player.options.classPrefix}-captions`,attributes:{role:"region","aria-label":o.t("player.captions"),"aria-live":"polite"}}),this.updateStyles(),(this.player.videoWrapper||this.player.container).appendChild(this.element)}loadTracks(){const e=this.player.element.textTracks;let i=-1;const n=new Map;for(let a=0;a<e.length;a++){const s=e[a];if(s&&("subtitles"===s.kind||"captions"===s.kind)&&!s._vidplyStale){s.mode="hidden";const e=`${s.language}|${s.label}`,r=n.get(e);if(r){r.alternatives.push(s);continue}const o=this.player.findTrackElement(s),l=!!o&&o.hasAttribute("default"),c={track:s,language:s.language,label:t(s.label,s.language),kind:s.kind,index:a,isDefault:l,alternatives:[]};this.tracks.push(c),n.set(e,c),l&&(i=this.tracks.length-1)}}i>=0&&requestAnimationFrame(()=>{this.enable(i)})}_syncHlsSubtitleTrack(e,t){const i=this.player.renderer;if(!i?.hls||!i.hls.subtitleTracks?.length)return;const n=i.hls.subtitleTracks;let a=n.findIndex(t=>t.lang===e);a<0&&t&&(a=n.findIndex(e=>e.name===t)),a>=0&&i.hls.subtitleTrack!==a&&(i.hls.subtitleTrack=a,this.player.log(`HLS subtitle track set to index ${a} (${e})`,"info"))}attachEvents(){this.player.on("timeupdate",()=>{this.updateCaptions()}),this.player.on("textcuesupdate",()=>{this.updateCaptions()}),this.player.on("captionschange",()=>{this.updateStyles()}),this.debouncedPositionCaptions=i(()=>{this.positionCaptionsOnMobile()},150),window.addEventListener("resize",this.debouncedPositionCaptions,{signal:this.player.lifecycleSignal}),this.player.on("enterfullscreen",()=>{a(()=>this.positionCaptionsOnMobile(),100)}),this.player.on("exitfullscreen",()=>{a(()=>this.positionCaptionsOnMobile(),100)})}enable(e=0){if(0===this.tracks.length)return;this._cleanupTrackListeners();const t=this.tracks[e];if(t&&t.track){t.track.mode="hidden",this.currentTrack=t,this.player.state.captionsEnabled=!0,t.language&&this.element.setAttribute("lang",t.language);const e=()=>{this.updateCaptions()};if(this.cueChangeHandler=e,t.track.addEventListener("cuechange",e),t.alternatives&&t.alternatives.length>0){const i=()=>{if(this.currentTrack===t)for(const n of t.alternatives)if(n.activeCues&&n.activeCues.length>0)return this.player.log(`Switching to alternative caption track for "${t.label}"`,"info"),t.track.removeEventListener("cuechange",e),t.alternatives.forEach(e=>e.removeEventListener("cuechange",i)),t.track=n,t.track.addEventListener("cuechange",e),this._altCueChangeHandler=null,void this.updateCaptions()};this._altCueChangeHandler=i,t.alternatives.forEach(e=>{e.mode="hidden",e.addEventListener("cuechange",i)})}const i=this.player.findTrackElement(t.track),n=()=>{if(i&&i.readyState<2){const e=()=>{i.removeEventListener("load",e),i.removeEventListener("error",e),requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&this.updateCaptions()})};i.addEventListener("load",e,{once:!0}),i.addEventListener("error",e,{once:!0})}else requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&this.updateCaptions()})};requestAnimationFrame(()=>{this.currentTrack&&this.currentTrack.track===t.track&&n()}),this._syncHlsSubtitleTrack(t.language,t.label),this.player.emit("captionsenabled",t)}}_cleanupTrackListeners(){if(this.currentTrack&&this.currentTrack.track){const e=this.cueChangeHandler;e&&this.currentTrack.track.removeEventListener("cuechange",e);const t=this._altCueChangeHandler;t&&this.currentTrack.alternatives&&this.currentTrack.alternatives.forEach(e=>{e.removeEventListener("cuechange",t)}),this.currentTrack.track.mode="hidden"}this._altCueChangeHandler=null}disable(){this._cleanupTrackListeners(),this.currentTrack=null,this.element.style.display="none",this.element.replaceChildren(),this.element.removeAttribute("lang"),this.currentCue=null,this.player.state.captionsEnabled=!1,this.player.emit("captionsdisabled")}updateCaptions(){if(!this.currentTrack||!this.currentTrack.track)return;if(this.player.renderer?.handlesOwnCaptions?.())return;if("disabled"===this.currentTrack.track.mode&&(this.currentTrack.track.mode="hidden"),"showing"===this.currentTrack.track.mode&&(this.currentTrack.track.mode="hidden"),!this.currentTrack.track.activeCues)return void(this.currentTrack.track.cues&&this.currentTrack.track.cues.length>0&&this.currentCue&&(this.element.replaceChildren(),this.element.style.display="none",this.currentCue=null));const e=this.currentTrack.track.activeCues,t="audio"===this.player.element.tagName.toLowerCase();if(e.length>0){const i=e[0];if(this.currentCue!==i){this.currentCue=i;const e=i.text||"";if(!e.trim())return;const n=r.renderVTTToDOM(e);if(t){this.element.querySelectorAll(`.${this.player.options.classPrefix}-caption-cue`).forEach(e=>e.classList.remove(`${this.player.options.classPrefix}-caption-active`));const e=`cue-${i.startTime}-${i.endTime}`;let t=this.element.querySelector(`[data-cue-id="${e}"]`);t?t.replaceChildren(n):(t=document.createElement("div"),t.className=`${this.player.options.classPrefix}-caption-cue`,t.setAttribute("data-cue-id",e),t.replaceChildren(n),this.element.appendChild(t)),t.classList.add(`${this.player.options.classPrefix}-caption-active`),requestAnimationFrame(()=>{t&&t.scrollIntoView(s("center"))})}else this.element.replaceChildren(n);this.element.style.display="block",this.positionCaptionsOnMobile(),this.player.emit("captionchange",i)}}else this.currentCue&&(t||(this.element.replaceChildren(),this.element.style.display="none"),this.currentCue=null)}positionCaptionsOnMobile(){if(!this.element||"none"===this.element.style.display)return;const e=this.player.state?.fullscreen||!1,t=n();if(!t&&!e)return void(this.element.style.bottom="");const i=this.player.controlBar?.element;i&&requestAnimationFrame(()=>{if(!this.element||"none"===this.element.style.display)return;const n=i.getBoundingClientRect();if(!this.player.videoWrapper)return;const a=this.player.videoWrapper.getBoundingClientRect().bottom-n.top+16;this.element.style.bottom=`${a}px`,this.player.options.debug&&console.log("[VidPly] Caption position:",{mobile:t,isFullscreen:e,controlsHeight:n.height,bottomOffset:`${a}px`})})}updateStyles(){if(!this.element)return;const e=this.player.options;this.element.style.fontSize=e.captionsFontSize,this.element.style.fontFamily=e.captionsFontFamily,this.element.style.color=e.captionsColor,this.element.style.backgroundColor=this.hexToRgba(e.captionsBackgroundColor,e.captionsOpacity)}hexToRgba(e,t){const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i&&i[1]&&i[2]&&i[3]?`rgba(${parseInt(i[1],16)}, ${parseInt(i[2],16)}, ${parseInt(i[3],16)}, ${t})`:e}setCaptionStyle(e,t){switch(e){case"fontSize":this.player.options.captionsFontSize=String(t);break;case"fontFamily":this.player.options.captionsFontFamily=String(t);break;case"color":this.player.options.captionsColor=String(t);break;case"backgroundColor":this.player.options.captionsBackgroundColor=String(t);break;case"opacity":this.player.options.captionsOpacity=Number(t)}this.updateStyles(),this.saveCaptionPreferences(),this.player.emit("captionschange")}getAvailableTracks(){return this.tracks.map((e,t)=>({index:t,language:e.language,label:e.label||e.language,kind:e.kind}))}refreshTracks(){const e=this.currentTrack?.language,t=this.player.state.captionsEnabled;if(this.currentTrack&&this.disable(),this.tracks=[],this.loadTracks(),this.player.log(`Caption tracks refreshed, found ${this.tracks.length} tracks`,"info"),t&&e&&this.tracks.length>0){const t=this.tracks.findIndex(t=>t.language===e);t>=0&&this.enable(t)}return this.tracks.length}switchTrack(e){e>=0&&e<this.tracks.length&&(this.disable(),this.enable(e))}destroy(){this.disable(),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}};export{l as CaptionManager};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VidPly v1.2.0 - Universal, Accessible Video Player
2
+ * VidPly v1.2.3 - Universal, Accessible Video Player
3
3
  * (c) 2026 Matthias Peltzer
4
4
  * Released under GPL-2.0-or-later License
5
5
  */