@xiping/react-components 1.0.45 → 1.0.50

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 (236) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.js +1 -0
  2. package/dist/cjs/_virtual/delegate.js +1 -0
  3. package/dist/cjs/_virtual/download.js +1 -0
  4. package/dist/cjs/_virtual/download2.js +1 -0
  5. package/dist/cjs/_virtual/index.js +1 -0
  6. package/dist/cjs/_virtual/index2.js +1 -0
  7. package/dist/cjs/components/subtitle-player/SubtitlePlayer.d.ts +21 -0
  8. package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +3 -3
  9. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.d.ts +23 -0
  10. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +1 -0
  11. package/dist/cjs/components/video-subtitle-player/index.d.ts +3 -0
  12. package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.d.ts +61 -0
  13. package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.js +1 -0
  14. package/dist/cjs/index.d.ts +1 -1
  15. package/dist/cjs/index.js +1 -1
  16. package/dist/cjs/node_modules/.pnpm/delegate@3.2.0/node_modules/delegate/src/closest.js +1 -0
  17. package/dist/cjs/node_modules/.pnpm/delegate@3.2.0/node_modules/delegate/src/delegate.js +1 -0
  18. package/dist/cjs/node_modules/.pnpm/downloadjs@1.4.7/node_modules/downloadjs/download.js +3 -0
  19. package/dist/cjs/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js +1 -0
  20. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/_virtual/_rollupPluginBabelHelpers.js +2 -0
  21. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/constant.js +1 -0
  22. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/defaultConfig.js +1 -0
  23. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/error.js +1 -0
  24. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/events.js +1 -0
  25. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/index.umd.js +1 -0
  26. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/instManager.js +1 -0
  27. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/en.js +1 -0
  28. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/i18n.js +1 -0
  29. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/zh-cn.js +1 -0
  30. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/mediaProxy.js +1 -0
  31. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/player.js +1 -0
  32. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/basePlugin.js +1 -0
  33. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/hooksDescriptor.js +1 -0
  34. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/plugin.js +1 -0
  35. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/pluginsManager.js +1 -0
  36. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/preset.js +1 -0
  37. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/resizeObserver.js +1 -0
  38. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/back.js +5 -0
  39. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/download.js +15 -0
  40. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/exitCssFull.js +4 -0
  41. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/exitFull.js +4 -0
  42. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/loading.js +4 -0
  43. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pause.js +4 -0
  44. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pipIcon.js +5 -0
  45. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pipIconExit.js +8 -0
  46. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/play.js +4 -0
  47. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/playNext.js +4 -0
  48. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/replay.js +4 -0
  49. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/requestCssFull.js +4 -0
  50. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/requestFull.js +4 -0
  51. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/rotate.js +12 -0
  52. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/seekicon.js +7 -0
  53. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeLarge.js +5 -0
  54. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeMuted.js +5 -0
  55. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeSmall.js +5 -0
  56. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/iconPlugin.js +1 -0
  57. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/iconTools.js +3 -0
  58. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/optionList.js +1 -0
  59. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/optionsIcon.js +4 -0
  60. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/thumbnail.js +1 -0
  61. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/controls/index.js +9 -0
  62. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/cssFullScreen/index.js +5 -0
  63. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/definition/index.js +1 -0
  64. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/download/index.js +5 -0
  65. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/dynamicBg/index.js +2 -0
  66. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/enter/index.js +1 -0
  67. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/error/index.js +6 -0
  68. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fpsDetect/index.js +1 -0
  69. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fullscreen/backicon.js +2 -0
  70. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fullscreen/index.js +5 -0
  71. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/gapJump/index.js +1 -0
  72. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/keyboard/index.js +1 -0
  73. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/loading/index.js +4 -0
  74. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/logger/index.js +1 -0
  75. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/miniScreen/index.js +13 -0
  76. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/miniScreen/miniScreenIcon.js +4 -0
  77. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/mobile/index.js +19 -0
  78. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/mobile/touch.js +1 -0
  79. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/pc/index.js +1 -0
  80. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/pip/index.js +8 -0
  81. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/play/index.js +5 -0
  82. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/playNext/index.js +7 -0
  83. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/playbackRate/index.js +1 -0
  84. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/poster/index.js +2 -0
  85. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/index.js +7 -0
  86. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/innerList.js +1 -0
  87. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/miniProgress.js +4 -0
  88. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progressPreview/dotsApi.js +1 -0
  89. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progressPreview/index.js +11 -0
  90. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/prompt/index.js +3 -0
  91. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/replay/index.js +3 -0
  92. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/rotate/index.js +6 -0
  93. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/screenShot/index.js +6 -0
  94. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/start/index.js +4 -0
  95. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/stats/index.js +1 -0
  96. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/testspeed/index.js +1 -0
  97. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/time/index.js +6 -0
  98. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/time/timesegments.js +1 -0
  99. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/volume/index.js +11 -0
  100. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/waitingTimeoutJump/index.js +1 -0
  101. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/presets/default.js +1 -0
  102. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/state.js +1 -0
  103. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/stateClassMap.js +1 -0
  104. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/database.js +1 -0
  105. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/debug.js +1 -0
  106. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/draggabilly.js +1 -0
  107. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/sniffer.js +1 -0
  108. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/util.js +1 -0
  109. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/xgplayerTimeRange.js +1 -0
  110. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/version.js +1 -0
  111. package/dist/cjs/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/react.js +1 -0
  112. package/dist/cjs/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +1 -0
  113. package/dist/cjs/packages/subtitle/lib/src/json-converter.js +1 -0
  114. package/dist/cjs/react-components.css +1 -1
  115. package/dist/es/_virtual/_commonjsHelpers.js +6 -0
  116. package/dist/es/_virtual/delegate.js +7 -0
  117. package/dist/es/_virtual/download.js +7 -0
  118. package/dist/es/_virtual/download2.js +4 -0
  119. package/dist/es/_virtual/index.js +8 -0
  120. package/dist/es/_virtual/index2.js +4 -0
  121. package/dist/es/components/subtitle-player/SubtitlePlayer.d.ts +21 -0
  122. package/dist/es/components/subtitle-player/SubtitlePlayer.js +274 -76
  123. package/dist/es/components/txt-editor/TxtEditor.js +4 -1
  124. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.d.ts +23 -0
  125. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +125 -0
  126. package/dist/es/components/video-subtitle-player/index.d.ts +3 -0
  127. package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.d.ts +61 -0
  128. package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.js +57 -0
  129. package/dist/es/index.d.ts +1 -1
  130. package/dist/es/index.js +60 -58
  131. package/dist/es/node_modules/.pnpm/delegate@3.2.0/node_modules/delegate/src/closest.js +21 -0
  132. package/dist/es/node_modules/.pnpm/delegate@3.2.0/node_modules/delegate/src/delegate.js +29 -0
  133. package/dist/es/node_modules/.pnpm/downloadjs@1.4.7/node_modules/downloadjs/download.js +77 -0
  134. package/dist/es/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js +111 -0
  135. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/_virtual/_rollupPluginBabelHelpers.js +197 -0
  136. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/constant.js +7 -0
  137. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/defaultConfig.js +87 -0
  138. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/error.js +64 -0
  139. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/events.js +67 -0
  140. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/index.umd.js +45 -0
  141. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/instManager.js +101 -0
  142. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/en.js +79 -0
  143. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/i18n.js +75 -0
  144. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/lang/zh-cn.js +79 -0
  145. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/mediaProxy.js +466 -0
  146. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/player.js +1240 -0
  147. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/basePlugin.js +207 -0
  148. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/hooksDescriptor.js +130 -0
  149. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/plugin.js +366 -0
  150. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/pluginsManager.js +204 -0
  151. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/preset.js +14 -0
  152. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugin/resizeObserver.js +81 -0
  153. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/back.js +10 -0
  154. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/download.js +20 -0
  155. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/exitCssFull.js +9 -0
  156. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/exitFull.js +9 -0
  157. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/loading.js +9 -0
  158. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pause.js +9 -0
  159. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pipIcon.js +10 -0
  160. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/pipIconExit.js +13 -0
  161. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/play.js +9 -0
  162. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/playNext.js +9 -0
  163. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/replay.js +9 -0
  164. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/requestCssFull.js +9 -0
  165. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/requestFull.js +9 -0
  166. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/rotate.js +17 -0
  167. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/seekicon.js +12 -0
  168. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeLarge.js +10 -0
  169. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeMuted.js +10 -0
  170. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/assets/volumeSmall.js +10 -0
  171. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/iconPlugin.js +35 -0
  172. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/iconTools.js +12 -0
  173. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/optionList.js +79 -0
  174. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/optionsIcon.js +193 -0
  175. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/common/thumbnail.js +141 -0
  176. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/controls/index.js +171 -0
  177. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/cssFullScreen/index.js +105 -0
  178. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/definition/index.js +110 -0
  179. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/download/index.js +83 -0
  180. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/dynamicBg/index.js +232 -0
  181. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/enter/index.js +42 -0
  182. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/error/index.js +68 -0
  183. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fpsDetect/index.js +116 -0
  184. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fullscreen/backicon.js +68 -0
  185. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/fullscreen/index.js +150 -0
  186. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/gapJump/index.js +96 -0
  187. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/keyboard/index.js +299 -0
  188. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/loading/index.js +46 -0
  189. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/logger/index.js +171 -0
  190. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/miniScreen/index.js +169 -0
  191. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/miniScreen/miniScreenIcon.js +55 -0
  192. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/mobile/index.js +448 -0
  193. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/mobile/touch.js +138 -0
  194. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/pc/index.js +122 -0
  195. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/pip/index.js +216 -0
  196. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/play/index.js +102 -0
  197. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/playNext/index.js +78 -0
  198. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/playbackRate/index.js +100 -0
  199. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/poster/index.js +119 -0
  200. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/index.js +431 -0
  201. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/innerList.js +215 -0
  202. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progress/miniProgress.js +93 -0
  203. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progressPreview/dotsApi.js +175 -0
  204. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/progressPreview/index.js +292 -0
  205. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/prompt/index.js +86 -0
  206. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/replay/index.js +92 -0
  207. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/rotate/index.js +106 -0
  208. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/screenShot/index.js +134 -0
  209. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/start/index.js +222 -0
  210. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/stats/index.js +152 -0
  211. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/testspeed/index.js +134 -0
  212. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/time/index.js +164 -0
  213. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/time/timesegments.js +146 -0
  214. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/volume/index.js +206 -0
  215. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/plugins/waitingTimeoutJump/index.js +53 -0
  216. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/presets/default.js +61 -0
  217. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/state.js +13 -0
  218. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/stateClassMap.js +34 -0
  219. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/database.js +83 -0
  220. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/debug.js +34 -0
  221. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/draggabilly.js +271 -0
  222. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/sniffer.js +111 -0
  223. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/util.js +517 -0
  224. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/utils/xgplayerTimeRange.js +25 -0
  225. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/version.js +4 -0
  226. package/dist/es/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/react.js +19 -0
  227. package/dist/es/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +14 -0
  228. package/dist/es/packages/subtitle/lib/src/json-converter.js +27 -0
  229. package/dist/es/react-components.css +1 -1
  230. package/package.json +19 -21
  231. package/dist/cjs/components/qr-code/index.d.ts +0 -103
  232. package/dist/cjs/components/qr-code/index.js +0 -1
  233. package/dist/es/components/qr-code/index.d.ts +0 -103
  234. package/dist/es/components/qr-code/index.js +0 -49
  235. /package/dist/cjs/{subtitle → packages/subtitle}/lib/src/parser.js +0 -0
  236. /package/dist/es/{subtitle → packages/subtitle}/lib/src/parser.js +0 -0
@@ -1,103 +1,301 @@
1
- import { jsx as s, jsxs as T } from "react/jsx-runtime";
2
- import { useRef as N, useMemo as S, useEffect as H } from "react";
3
- import { parseSRT as $, parseVTT as C } from "../../subtitle/lib/src/parser.js";
1
+ import { jsx as p, jsxs as $ } from "react/jsx-runtime";
2
+ import { useMemo as x, useRef as D, useState as G, useEffect as O, useCallback as R } from "react";
3
+ import { parseSRT as I, parseVTT as A } from "../../packages/subtitle/lib/src/parser.js";
4
+ import { srtToJson as U, vttToJson as X } from "../../packages/subtitle/lib/src/json-converter.js";
4
5
  /* empty css */
5
- function d(i) {
6
- const r = i.replace(",", ".").split(":");
7
- if (r.length !== 3)
6
+ function E(l) {
7
+ const c = l.replace(",", ".").split(":");
8
+ if (c.length !== 3)
8
9
  return 0;
9
- const c = parseInt(r[0], 10) || 0, o = parseInt(r[1], 10) || 0, m = parseFloat(r[2]) || 0;
10
- return c * 3600 + o * 60 + m;
10
+ const h = parseInt(c[0], 10) || 0, g = parseInt(c[1], 10) || 0, i = parseFloat(c[2]) || 0;
11
+ return h * 3600 + g * 60 + i;
11
12
  }
12
- function E(i, n) {
13
- for (const r of i) {
14
- const c = d(r.startTime), o = d(r.endTime);
15
- if (n >= c && n <= o)
16
- return r;
13
+ function Y(l) {
14
+ const a = Math.floor(l / 3600), c = Math.floor(l % 3600 / 60), h = Math.floor(l % 60);
15
+ return a > 0 ? `${a.toString().padStart(2, "0")}:${c.toString().padStart(2, "0")}:${h.toString().padStart(2, "0")}` : `${c.toString().padStart(2, "0")}:${h.toString().padStart(2, "0")}`;
16
+ }
17
+ function Z(l, a) {
18
+ for (const c of l) {
19
+ const h = E(c.startTime), g = E(c.endTime);
20
+ if (a >= h && a <= g)
21
+ return c;
17
22
  }
18
23
  return null;
19
24
  }
20
- const B = ({
21
- subtitles: i,
22
- currentTime: n,
23
- mode: r = "current",
24
- className: c = "",
25
- style: o
25
+ function q(l, a, c, h, g) {
26
+ if (!a || a.length === 0)
27
+ return { nodes: l, nextWordIndex: c };
28
+ const i = [];
29
+ let d = 0;
30
+ for (let u = c; u < a.length; u++) {
31
+ const m = a[u], f = l.substring(d).indexOf(m);
32
+ if (f === -1)
33
+ return {
34
+ nodes: i.length > 0 ? i : l,
35
+ nextWordIndex: u
36
+ };
37
+ const b = d + f;
38
+ if (b > d) {
39
+ const S = l.substring(d, b);
40
+ S && i.push(
41
+ /* @__PURE__ */ p("span", { className: "subtitle-word-before", children: S }, `before-${h}-${u}`)
42
+ );
43
+ }
44
+ const y = g?.(m, u, h);
45
+ if (i.push(
46
+ /* @__PURE__ */ p(
47
+ "span",
48
+ {
49
+ className: "subtitle-word",
50
+ "data-word": m,
51
+ onMouseEnter: y?.onMouseEnter,
52
+ onMouseLeave: y?.onMouseLeave,
53
+ children: m
54
+ },
55
+ `word-${h}-${u}`
56
+ )
57
+ ), d = b + m.length, d >= l.length)
58
+ return { nodes: i, nextWordIndex: u + 1 };
59
+ }
60
+ if (d < l.length) {
61
+ const u = l.substring(d);
62
+ u && i.push(
63
+ /* @__PURE__ */ p("span", { className: "subtitle-word-after", children: u }, `after-${h}`)
64
+ );
65
+ }
66
+ return {
67
+ nodes: i.length > 0 ? i : l,
68
+ nextWordIndex: a.length
69
+ };
70
+ }
71
+ const st = ({
72
+ subtitles: l,
73
+ currentTime: a,
74
+ mode: c = "current",
75
+ className: h = "",
76
+ style: g,
77
+ onWordHoverChange: i,
78
+ renderWordOverlay: d
26
79
  }) => {
27
- const m = Array.isArray(i) ? i : [i], f = N(null), y = N(null), b = S(() => m.map((e) => {
80
+ const u = x(
81
+ () => Array.isArray(l) ? l : [l],
82
+ [l]
83
+ ), m = D(null), N = D(null), [f, b] = G(null), [y, S] = G([]);
84
+ O(() => {
85
+ let n = !0;
86
+ async function s() {
87
+ try {
88
+ const e = await Promise.all(
89
+ u.map(async (t) => {
90
+ try {
91
+ const r = t.language || "zh", o = t.type === "srt" ? await U(t.content, r) : await X(t.content, r);
92
+ return {
93
+ entries: JSON.parse(o),
94
+ label: t.label
95
+ };
96
+ } catch (r) {
97
+ return console.error("字幕解析失败:", r), {
98
+ entries: t.type === "srt" ? I(t.content) : A(t.content),
99
+ label: t.label
100
+ };
101
+ }
102
+ })
103
+ );
104
+ n && S(e);
105
+ } catch (e) {
106
+ if (console.error("加载字幕失败:", e), n) {
107
+ const t = u.map((r) => {
108
+ try {
109
+ return {
110
+ entries: r.type === "srt" ? I(r.content) : A(r.content),
111
+ label: r.label
112
+ };
113
+ } catch (o) {
114
+ return console.error("字幕解析失败:", o), {
115
+ entries: [],
116
+ label: r.label
117
+ };
118
+ }
119
+ });
120
+ S(t);
121
+ }
122
+ }
123
+ }
124
+ return s(), () => {
125
+ n = !1;
126
+ };
127
+ }, [u]);
128
+ const w = x(() => y.length > 0 ? y : u.map((n) => {
28
129
  try {
29
130
  return {
30
- entries: e.type === "srt" ? $(e.content) : C(e.content),
31
- label: e.label
131
+ entries: n.type === "srt" ? I(n.content) : A(n.content),
132
+ label: n.label
32
133
  };
33
- } catch (t) {
34
- return console.error("字幕解析失败:", t), {
134
+ } catch (s) {
135
+ return console.error("字幕解析失败:", s), {
35
136
  entries: [],
36
- label: e.label
137
+ label: n.label
37
138
  };
38
139
  }
39
- }), [m]), h = S(() => b.map(({ entries: e, label: t }) => ({
40
- entry: E(e, n),
41
- label: t,
42
- entries: e
140
+ }), [y, u]), L = x(() => w.map(({ entries: n, label: s }) => ({
141
+ entry: Z(n, a),
142
+ label: s,
143
+ entries: n
43
144
  // 保留所有条目用于歌词模式
44
- })), [b, n]);
45
- return H(() => {
46
- if (r === "lyrics" && y.current && f.current) {
47
- const e = f.current, t = y.current;
48
- e.getBoundingClientRect(), t.getBoundingClientRect(), e.scrollTop;
49
- const l = t.offsetTop, a = e.clientHeight, u = t.clientHeight, p = l - a / 2 + u / 2;
50
- e.scrollTo({
51
- top: p,
145
+ })), [w, a]), H = x(() => {
146
+ const n = [];
147
+ w.forEach(({ entries: t, label: r }) => {
148
+ t.forEach((o) => {
149
+ n.push({
150
+ entry: o,
151
+ label: r,
152
+ startTime: E(o.startTime),
153
+ endTime: E(o.endTime)
154
+ });
155
+ });
156
+ }), n.sort((t, r) => t.startTime - r.startTime);
157
+ const s = [];
158
+ let e = [];
159
+ for (const t of n)
160
+ if (e.length === 0)
161
+ e.push(t);
162
+ else {
163
+ const r = e[e.length - 1];
164
+ t.startTime <= r.endTime ? e.push(t) : (s.push(e), e = [t]);
165
+ }
166
+ return e.length > 0 && s.push(e), s;
167
+ }, [w]);
168
+ O(() => {
169
+ if (c === "lyrics" && N.current && m.current) {
170
+ const n = m.current, s = N.current, e = s.offsetTop, t = n.clientHeight, r = s.clientHeight, o = e - t / 2 + r / 2;
171
+ n.scrollTo({
172
+ top: o,
52
173
  behavior: "smooth"
53
174
  });
54
175
  }
55
- }, [r, n]), r === "current" ? h.some(({ entry: t }) => t !== null) ? /* @__PURE__ */ s(
176
+ }, [c, a]);
177
+ const P = R(
178
+ (n, s) => {
179
+ const e = n.currentTarget.getBoundingClientRect(), t = m.current?.getBoundingClientRect(), r = t !== void 0 ? new DOMRect(
180
+ e.left - t.left,
181
+ e.top - t.top,
182
+ e.width,
183
+ e.height
184
+ ) : e, o = {
185
+ ...s,
186
+ rect: r
187
+ };
188
+ b(o), i?.(o);
189
+ },
190
+ [i]
191
+ ), j = R(() => {
192
+ b(null), i?.(null);
193
+ }, [i]), z = R(
194
+ (n, s) => (e, t, r) => ({
195
+ onMouseEnter: (o) => P(o, {
196
+ word: e,
197
+ wordIndex: t,
198
+ lineIndex: r,
199
+ entry: n,
200
+ label: s
201
+ }),
202
+ onMouseLeave: j
203
+ }),
204
+ [P, j]
205
+ ), B = d && f ? /* @__PURE__ */ p(
56
206
  "div",
57
207
  {
58
- className: `subtitle-player subtitle-player--current ${c}`,
59
- style: o,
60
- children: h.map(({ entry: t, label: l }, a) => t ? /* @__PURE__ */ T(
61
- "div",
62
- {
63
- className: "subtitle-player-item",
64
- "data-label": l || void 0,
65
- children: [
66
- l && /* @__PURE__ */ s("span", { className: "subtitle-player-label", children: l }),
67
- /* @__PURE__ */ s("div", { className: "subtitle-player-text", children: t.text.split(`
68
- `).map((u, p) => /* @__PURE__ */ s("div", { className: "subtitle-player-line", children: u }, p)) })
69
- ]
70
- },
71
- a
72
- ) : null)
208
+ className: "subtitle-player-hover-overlay",
209
+ style: {
210
+ left: f.rect.x + f.rect.width / 2,
211
+ top: f.rect.y + f.rect.height
212
+ },
213
+ children: d(f)
214
+ }
215
+ ) : null;
216
+ return c === "current" ? L.some(({ entry: s }) => s !== null) ? /* @__PURE__ */ $(
217
+ "div",
218
+ {
219
+ ref: m,
220
+ className: `subtitle-player subtitle-player--current ${h}`,
221
+ style: g,
222
+ children: [
223
+ L.map(({ entry: s, label: e }, t) => s ? /* @__PURE__ */ $(
224
+ "div",
225
+ {
226
+ className: "subtitle-player-item",
227
+ "data-label": e || void 0,
228
+ children: [
229
+ e && /* @__PURE__ */ p("span", { className: "subtitle-player-label", children: e }),
230
+ /* @__PURE__ */ p("div", { className: "subtitle-player-text", children: (() => {
231
+ let r = 0;
232
+ return s.text.split(`
233
+ `).map((o, T) => {
234
+ if (!s.words || s.words.length === 0)
235
+ return /* @__PURE__ */ p("div", { className: "subtitle-player-line", children: o }, T);
236
+ const v = q(
237
+ o,
238
+ s.words,
239
+ r,
240
+ T,
241
+ d || i ? z(s, e) : void 0
242
+ );
243
+ return r = v.nextWordIndex, /* @__PURE__ */ p("div", { className: "subtitle-player-line", children: v.nodes }, T);
244
+ });
245
+ })() })
246
+ ]
247
+ },
248
+ t
249
+ ) : null),
250
+ (d || i) && /* @__PURE__ */ p("div", { className: "subtitle-player-hover-layer", children: B })
251
+ ]
73
252
  }
74
- ) : null : /* @__PURE__ */ s(
253
+ ) : null : /* @__PURE__ */ $(
75
254
  "div",
76
255
  {
77
- ref: f,
78
- className: `subtitle-player subtitle-player--lyrics ${c}`,
79
- style: o,
80
- children: b.map(({ entries: e, label: t }, l) => /* @__PURE__ */ T("div", { className: "subtitle-player-group", children: [
81
- t && /* @__PURE__ */ s("span", { className: "subtitle-player-label", children: t }),
82
- e.map((a, u) => {
83
- const p = d(a.startTime), v = d(a.endTime), g = n >= p && n <= v, x = n > v;
84
- return /* @__PURE__ */ s(
85
- "div",
86
- {
87
- ref: g ? y : null,
88
- className: `subtitle-player-item ${g ? "subtitle-player-item--active" : ""} ${x ? "subtitle-player-item--past" : ""}`,
89
- "data-label": t || void 0,
90
- children: /* @__PURE__ */ s("div", { className: "subtitle-player-text", children: a.text.split(`
91
- `).map((R, A) => /* @__PURE__ */ s("div", { className: "subtitle-player-line", children: R }, A)) })
92
- },
93
- u
94
- );
95
- })
96
- ] }, l))
256
+ ref: m,
257
+ className: `subtitle-player subtitle-player--lyrics ${h}`,
258
+ style: g,
259
+ children: [
260
+ H.map((n, s) => {
261
+ const e = n[0]?.startTime ?? 0, t = Y(e);
262
+ return /* @__PURE__ */ p("div", { className: "subtitle-player-group", children: n.map(({ entry: r, label: o, startTime: T, endTime: v }, F) => {
263
+ const J = a >= T && a <= v, K = a > v, Q = F === 0;
264
+ let V = 0;
265
+ return /* @__PURE__ */ $(
266
+ "div",
267
+ {
268
+ ref: J ? N : null,
269
+ className: `subtitle-player-item ${J ? "subtitle-player-item--active" : ""} ${K ? "subtitle-player-item--past" : ""}`,
270
+ "data-label": o || void 0,
271
+ children: [
272
+ Q && /* @__PURE__ */ p("span", { className: "subtitle-player-time", children: t }),
273
+ o && /* @__PURE__ */ p("span", { className: "subtitle-player-label", children: o }),
274
+ /* @__PURE__ */ p("div", { className: "subtitle-player-text", children: r.text.split(`
275
+ `).map((W, M) => {
276
+ if (!r.words || r.words.length === 0)
277
+ return /* @__PURE__ */ p("div", { className: "subtitle-player-line", children: W }, M);
278
+ const k = q(
279
+ W,
280
+ r.words,
281
+ V,
282
+ M,
283
+ d || i ? z(r, o) : void 0
284
+ );
285
+ return V = k.nextWordIndex, /* @__PURE__ */ p("div", { className: "subtitle-player-line", children: k.nodes }, M);
286
+ }) })
287
+ ]
288
+ },
289
+ `${s}-${F}`
290
+ );
291
+ }) }, s);
292
+ }),
293
+ (d || i) && /* @__PURE__ */ p("div", { className: "subtitle-player-hover-layer", children: B })
294
+ ]
97
295
  }
98
296
  );
99
297
  };
100
298
  export {
101
- B as SubtitlePlayer,
102
- B as default
299
+ st as SubtitlePlayer,
300
+ st as default
103
301
  };
@@ -15,7 +15,10 @@ const U = ({
15
15
  onMount: s,
16
16
  className: u
17
17
  }) => {
18
- const l = o !== void 0, g = P(() => d || o || "", [d, o]), e = M({
18
+ const l = o !== void 0, g = P(
19
+ () => d || o || "",
20
+ [d, o]
21
+ ), e = M({
19
22
  extensions: [
20
23
  C.configure({
21
24
  // 禁用大部分格式化功能,保持纯文本编辑体验
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+ import { SubtitleData, HoverTarget } from '../subtitle-player/SubtitlePlayer';
3
+ export interface VideoSubtitlePlayerProps {
4
+ /** 视频URL */
5
+ videoUrl: string;
6
+ /** 字幕数据 */
7
+ subtitles: SubtitleData[];
8
+ /** 视频封面图 */
9
+ poster?: string;
10
+ /** 自定义类名 */
11
+ className?: string;
12
+ /** 自定义样式 */
13
+ style?: React.CSSProperties;
14
+ /** 自定义详情获取函数,用于调用大模型API */
15
+ onFetchDetail?: (target: HoverTarget | null) => Promise<void>;
16
+ }
17
+ /**
18
+ * 视频字幕播放器组件
19
+ * 左侧:上部分16:9视频播放器,下部分字幕显示
20
+ * 右侧:字幕详情(单词/短语的发音、解释等)
21
+ */
22
+ export declare const VideoSubtitlePlayer: React.FC<VideoSubtitlePlayerProps>;
23
+ export default VideoSubtitlePlayer;
@@ -0,0 +1,125 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as x, useEffect as u, useCallback as C } from "react";
3
+ /* empty css */
4
+ import { SubtitlePlayer as I } from "../subtitle-player/SubtitlePlayer.js";
5
+ import { useVideoSubtitleStore as R } from "./useVideoSubtitleStore.js";
6
+ /* empty css */
7
+ import j from "../../node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/es/index.umd.js";
8
+ const z = ({
9
+ videoUrl: p,
10
+ subtitles: o,
11
+ poster: m,
12
+ className: g = "",
13
+ style: P,
14
+ onFetchDetail: c
15
+ }) => {
16
+ const d = x(null), r = x(null), {
17
+ currentTime: s,
18
+ isPlaying: D,
19
+ setCurrentTime: v,
20
+ setIsPlaying: n,
21
+ setSubtitles: _,
22
+ currentDetail: l,
23
+ isLoadingDetail: w,
24
+ fetchDetail: y
25
+ } = R();
26
+ u(() => {
27
+ _(o);
28
+ }, [o, _]), u(() => {
29
+ if (!d.current) return;
30
+ const t = `video-subtitle-player-${Date.now()}`;
31
+ d.current && (d.current.id = t);
32
+ const i = new j({
33
+ id: t,
34
+ url: p,
35
+ poster: m,
36
+ autoplay: !1,
37
+ fluid: !0,
38
+ width: "100%",
39
+ height: "100%",
40
+ controls: !0
41
+ });
42
+ r.current = i;
43
+ const h = () => {
44
+ const T = i.currentTime || 0;
45
+ v(T);
46
+ }, f = () => {
47
+ n(!0);
48
+ }, b = () => {
49
+ n(!1);
50
+ }, N = () => {
51
+ n(!1);
52
+ };
53
+ return i.on("timeupdate", h), i.on("play", f), i.on("pause", b), i.on("ended", N), () => {
54
+ i.off("timeupdate", h), i.off("play", f), i.off("pause", b), i.off("ended", N), i.destroy(), r.current = null;
55
+ };
56
+ }, [p, m, v, n]), u(() => {
57
+ if (r.current) {
58
+ const t = r.current;
59
+ Math.abs(t.currentTime - s) > 0.5 && (t.currentTime = s);
60
+ }
61
+ }, [s]);
62
+ const S = C(
63
+ async (t) => {
64
+ c ? await c(t) : await y(t);
65
+ },
66
+ [c, y]
67
+ );
68
+ return /* @__PURE__ */ a(
69
+ "div",
70
+ {
71
+ className: `video-subtitle-player ${g}`,
72
+ style: P,
73
+ children: [
74
+ /* @__PURE__ */ a("div", { className: "video-subtitle-player__left", children: [
75
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__video-container", children: /* @__PURE__ */ e(
76
+ "div",
77
+ {
78
+ ref: d,
79
+ className: "video-subtitle-player__video"
80
+ }
81
+ ) }),
82
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__subtitle-container", children: /* @__PURE__ */ e(
83
+ I,
84
+ {
85
+ subtitles: o,
86
+ currentTime: s,
87
+ mode: "current",
88
+ onWordHoverChange: S
89
+ }
90
+ ) })
91
+ ] }),
92
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__right", children: /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail", children: w ? /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-loading", children: [
93
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-loading-spinner" }),
94
+ /* @__PURE__ */ e("span", { children: "加载中..." })
95
+ ] }) : l ? /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-content", children: [
96
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-word", children: l.word }),
97
+ l.pronunciation && /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-pronunciation", children: l.pronunciation }),
98
+ l.partOfSpeech && /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-pos", children: l.partOfSpeech }),
99
+ l.translation && /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-translation", children: [
100
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-label", children: "中文翻译" }),
101
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-text", children: l.translation })
102
+ ] }),
103
+ l.definition && /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-definition", children: [
104
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-label", children: "英文解释" }),
105
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-text", children: l.definition })
106
+ ] }),
107
+ l.examples && l.examples.length > 0 && /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-examples", children: [
108
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-label", children: "例句" }),
109
+ l.examples.map((t, i) => /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-example", children: [
110
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-example-en", children: t.sentence }),
111
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-example-zh", children: t.translation })
112
+ ] }, i))
113
+ ] })
114
+ ] }) : /* @__PURE__ */ a("div", { className: "video-subtitle-player__detail-empty", children: [
115
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-empty-icon", children: "📖" }),
116
+ /* @__PURE__ */ e("div", { className: "video-subtitle-player__detail-empty-text", children: "将鼠标悬停在字幕单词上查看详情" })
117
+ ] }) }) })
118
+ ]
119
+ }
120
+ );
121
+ };
122
+ export {
123
+ z as VideoSubtitlePlayer,
124
+ z as default
125
+ };
@@ -0,0 +1,3 @@
1
+ export * from './VideoSubtitlePlayer';
2
+ export * from './useVideoSubtitleStore';
3
+ export { default } from './VideoSubtitlePlayer';
@@ -0,0 +1,61 @@
1
+ import { SubtitleData, HoverTarget } from '../subtitle-player/SubtitlePlayer';
2
+ /**
3
+ * 字幕详情信息
4
+ */
5
+ export interface SubtitleDetail {
6
+ /** 单词或短语 */
7
+ word: string;
8
+ /** 发音(音标) */
9
+ pronunciation?: string;
10
+ /** 中文解释 */
11
+ translation?: string;
12
+ /** 英文解释 */
13
+ definition?: string;
14
+ /** 例句 */
15
+ examples?: Array<{
16
+ sentence: string;
17
+ translation: string;
18
+ }>;
19
+ /** 词性 */
20
+ partOfSpeech?: string;
21
+ }
22
+ /**
23
+ * 视频字幕播放器状态
24
+ */
25
+ export interface VideoSubtitleState {
26
+ /** 播放进度(秒数) */
27
+ currentTime: number;
28
+ /** 是否正在播放 */
29
+ isPlaying: boolean;
30
+ /** 字幕数据 */
31
+ subtitles: SubtitleData[];
32
+ /** 当前hover的单词详情 */
33
+ currentDetail: SubtitleDetail | null;
34
+ /** 是否正在加载详情 */
35
+ isLoadingDetail: boolean;
36
+ }
37
+ /**
38
+ * 视频字幕播放器操作
39
+ */
40
+ export interface VideoSubtitleActions {
41
+ /** 设置播放进度 */
42
+ setCurrentTime: (time: number) => void;
43
+ /** 设置播放状态 */
44
+ setIsPlaying: (playing: boolean) => void;
45
+ /** 设置字幕数据 */
46
+ setSubtitles: (subtitles: SubtitleData[]) => void;
47
+ /** 设置当前详情 */
48
+ setCurrentDetail: (detail: SubtitleDetail | null) => void;
49
+ /** 设置加载状态 */
50
+ setIsLoadingDetail: (loading: boolean) => void;
51
+ /** 根据hover目标获取详情(可以在这里调用大模型API) */
52
+ fetchDetail: (target: HoverTarget | null) => Promise<void>;
53
+ /** 重置状态 */
54
+ reset: () => void;
55
+ }
56
+ export type VideoSubtitleStore = VideoSubtitleState & VideoSubtitleActions;
57
+ /**
58
+ * 创建视频字幕播放器store
59
+ * @param fetchDetailFn 可选的详情获取函数,如果不提供则使用默认实现
60
+ */
61
+ export declare const useVideoSubtitleStore: import('zustand').UseBoundStore<import('zustand').StoreApi<VideoSubtitleStore>>;
@@ -0,0 +1,57 @@
1
+ import { create as r } from "../../node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/react.js";
2
+ const t = {
3
+ currentTime: 0,
4
+ isPlaying: !1,
5
+ subtitles: [],
6
+ currentDetail: null,
7
+ isLoadingDetail: !1
8
+ }, s = r((i, o) => ({
9
+ ...t,
10
+ setCurrentTime: (e) => {
11
+ i({ currentTime: e });
12
+ },
13
+ setIsPlaying: (e) => {
14
+ i({ isPlaying: e });
15
+ },
16
+ setSubtitles: (e) => {
17
+ i({ subtitles: e });
18
+ },
19
+ setCurrentDetail: (e) => {
20
+ i({ currentDetail: e });
21
+ },
22
+ setIsLoadingDetail: (e) => {
23
+ i({ isLoadingDetail: e });
24
+ },
25
+ fetchDetail: async (e) => {
26
+ if (!e) {
27
+ i({ currentDetail: null, isLoadingDetail: !1 });
28
+ return;
29
+ }
30
+ i({ isLoadingDetail: !0 });
31
+ try {
32
+ await new Promise((a) => setTimeout(a, 300));
33
+ const n = {
34
+ word: e.word,
35
+ pronunciation: `/${e.word.toLowerCase()}/`,
36
+ translation: `${e.word}的中文翻译`,
37
+ definition: `Definition of ${e.word}`,
38
+ examples: [
39
+ {
40
+ sentence: `This is an example sentence with ${e.word}.`,
41
+ translation: `这是一个包含${e.word}的例句。`
42
+ }
43
+ ],
44
+ partOfSpeech: "noun"
45
+ };
46
+ i({ currentDetail: n, isLoadingDetail: !1 });
47
+ } catch (n) {
48
+ console.error("获取详情失败:", n), i({ currentDetail: null, isLoadingDetail: !1 });
49
+ }
50
+ },
51
+ reset: () => {
52
+ i(t);
53
+ }
54
+ }));
55
+ export {
56
+ s as useVideoSubtitleStore
57
+ };