@gcorevideo/player 2.20.1 → 2.20.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 (262) hide show
  1. package/dist/core.js +1 -1
  2. package/dist/index.css +1328 -1328
  3. package/dist/index.js +305 -217
  4. package/dist/player.d.ts +270 -52
  5. package/dist/plugins/index.css +612 -612
  6. package/dist/plugins/index.js +1459 -1347
  7. package/docs/api/player.audioselector.md +1 -251
  8. package/docs/api/player.bigmutebutton.md +1 -156
  9. package/docs/api/player.clapprstats.exportmetrics.md +4 -0
  10. package/docs/api/player.clapprstats.md +7 -223
  11. package/docs/api/player.clapprstats.setupdatemetrics.md +2 -0
  12. package/docs/api/player.clicktopause.md +5 -113
  13. package/docs/api/player.clipsplugin.gettext.md +9 -0
  14. package/docs/api/player.clipsplugin.md +10 -94
  15. package/docs/api/player.clipspluginsettings.md +57 -0
  16. package/docs/api/player.clipspluginsettings.text.md +13 -0
  17. package/docs/api/player.contextmenu._constructor_.md +6 -3
  18. package/docs/api/player.contextmenu.md +13 -256
  19. package/docs/api/player.contextmenupluginsettings.label.md +11 -0
  20. package/docs/api/player.contextmenupluginsettings.md +93 -0
  21. package/docs/api/player.contextmenupluginsettings.preventshowcontextmenu.md +11 -0
  22. package/docs/api/player.contextmenupluginsettings.url.md +11 -0
  23. package/docs/api/player.dvrcontrols.md +1 -1
  24. package/docs/api/player.errorscreen.md +0 -2
  25. package/docs/api/player.favicon._constructor_.md +3 -0
  26. package/docs/api/player.favicon.bindevents.md +3 -0
  27. package/docs/api/player.favicon.configure.md +3 -0
  28. package/docs/api/player.favicon.destroy.md +3 -0
  29. package/docs/api/player.favicon.disable.md +3 -0
  30. package/docs/api/player.favicon.md +18 -1
  31. package/docs/api/player.favicon.name.md +3 -0
  32. package/docs/api/player.favicon.supportedversion.md +3 -0
  33. package/docs/api/player.gearevents.md +4 -1
  34. package/docs/api/player.googleanalytics._constructor_.md +3 -0
  35. package/docs/api/player.googleanalytics.addeventlisteners.md +3 -0
  36. package/docs/api/player.googleanalytics.embedscript.md +3 -0
  37. package/docs/api/player.googleanalytics.md +42 -1
  38. package/docs/api/player.googleanalytics.name.md +3 -0
  39. package/docs/api/player.googleanalytics.onbufferfull.md +3 -0
  40. package/docs/api/player.googleanalytics.onbuffering.md +3 -0
  41. package/docs/api/player.googleanalytics.ondvr.md +3 -0
  42. package/docs/api/player.googleanalytics.onended.md +3 -0
  43. package/docs/api/player.googleanalytics.onerror.md +3 -0
  44. package/docs/api/player.googleanalytics.onfullscreen.md +3 -0
  45. package/docs/api/player.googleanalytics.onhd.md +3 -0
  46. package/docs/api/player.googleanalytics.onpause.md +3 -0
  47. package/docs/api/player.googleanalytics.onplay.md +3 -0
  48. package/docs/api/player.googleanalytics.onready.md +3 -0
  49. package/docs/api/player.googleanalytics.onseek.md +3 -0
  50. package/docs/api/player.googleanalytics.onstop.md +3 -0
  51. package/docs/api/player.googleanalytics.onvolumechanged.md +3 -0
  52. package/docs/api/player.googleanalytics.push.md +3 -0
  53. package/docs/api/player.googleanalytics.supportedversion.md +3 -0
  54. package/docs/api/player.initeventdata.event.md +3 -0
  55. package/docs/api/player.initeventdata.md +7 -0
  56. package/docs/api/player.logo._constructor_.md +3 -0
  57. package/docs/api/player.logo.attributes.md +3 -0
  58. package/docs/api/player.logo.bindevents.md +3 -0
  59. package/docs/api/player.logo.md +20 -1
  60. package/docs/api/player.logo.name.md +3 -0
  61. package/docs/api/player.logo.render.md +3 -0
  62. package/docs/api/player.logo.stoplistening.md +3 -0
  63. package/docs/api/player.logo.supportedversion.md +3 -0
  64. package/docs/api/player.logo.template.md +3 -0
  65. package/docs/api/player.md +68 -20
  66. package/docs/api/player.mediacontrolelement.md +1 -1
  67. package/docs/api/player.multicamera.md +2 -0
  68. package/docs/api/player.seektime.attributes.md +3 -0
  69. package/docs/api/player.seektime.bindevents.md +3 -0
  70. package/docs/api/player.seektime.durationshown.md +3 -0
  71. package/docs/api/player.seektime.getseektime.md +3 -0
  72. package/docs/api/player.seektime.islivestreamwithdvr.md +3 -0
  73. package/docs/api/player.seektime.md +31 -0
  74. package/docs/api/player.seektime.mediacontrol.md +3 -0
  75. package/docs/api/player.seektime.mediacontrolcontainer.md +3 -0
  76. package/docs/api/player.seektime.name.md +3 -0
  77. package/docs/api/player.seektime.render.md +3 -0
  78. package/docs/api/player.seektime.shouldbevisible.md +3 -0
  79. package/docs/api/player.seektime.supportedversion.md +3 -0
  80. package/docs/api/player.seektime.template.md +3 -0
  81. package/docs/api/player.seektime.update.md +3 -0
  82. package/docs/api/player.share.md +2 -0
  83. package/docs/api/player.skiptime.md +2 -0
  84. package/docs/api/player.stalleventdata.count.md +3 -0
  85. package/docs/api/player.stalleventdata.event.md +3 -0
  86. package/docs/api/player.stalleventdata.md +8 -3
  87. package/docs/api/player.stalleventdata.time.md +3 -0
  88. package/docs/api/player.stalleventdata.total_ms.md +3 -0
  89. package/docs/api/player.starteventdata.event.md +3 -0
  90. package/docs/api/player.starteventdata.md +7 -0
  91. package/docs/api/player.telemetryevent.md +11 -0
  92. package/docs/api/player.telemetryeventdata.md +3 -0
  93. package/docs/api/player.telemetrypluginsettings.md +4 -1
  94. package/docs/api/player.telemetrypluginsettings.send.md +3 -0
  95. package/docs/api/player.telemetryrecord.md +3 -0
  96. package/docs/api/player.thumbnails.md +21 -139
  97. package/docs/api/player.thumbnailspluginsettings.md +23 -0
  98. package/docs/api/player.volumefade.md +1 -0
  99. package/docs/api/player.watcheventdata.event.md +3 -0
  100. package/docs/api/player.watcheventdata.md +7 -0
  101. package/lib/index.plugins.d.ts +0 -1
  102. package/lib/index.plugins.d.ts.map +1 -1
  103. package/lib/index.plugins.js +0 -1
  104. package/lib/plugins/audio-selector/AudioSelector.d.ts +28 -6
  105. package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
  106. package/lib/plugins/audio-selector/AudioSelector.js +52 -22
  107. package/lib/plugins/big-mute-button/BigMuteButton.d.ts +18 -2
  108. package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
  109. package/lib/plugins/big-mute-button/BigMuteButton.js +21 -16
  110. package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -0
  111. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  112. package/lib/plugins/bottom-gear/BottomGear.js +1 -0
  113. package/lib/plugins/clappr-stats/ClapprStats.d.ts +31 -8
  114. package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
  115. package/lib/plugins/clappr-stats/ClapprStats.js +24 -0
  116. package/lib/plugins/clappr-stats/types.d.ts +12 -0
  117. package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
  118. package/lib/plugins/clappr-stats/types.js +3 -0
  119. package/lib/plugins/click-to-pause/ClickToPause.d.ts +13 -1
  120. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  121. package/lib/plugins/click-to-pause/ClickToPause.js +14 -4
  122. package/lib/plugins/clips/Clips.d.ts +34 -2
  123. package/lib/plugins/clips/Clips.d.ts.map +1 -1
  124. package/lib/plugins/clips/Clips.js +51 -22
  125. package/lib/plugins/context-menu/ContextMenu.d.ts +40 -13
  126. package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -1
  127. package/lib/plugins/context-menu/ContextMenu.js +48 -36
  128. package/lib/plugins/dvr-controls/DvrControls.d.ts +1 -3
  129. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
  130. package/lib/plugins/dvr-controls/DvrControls.js +11 -28
  131. package/lib/plugins/error-screen/ErrorScreen.d.ts +0 -1
  132. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
  133. package/lib/plugins/error-screen/ErrorScreen.js +0 -1
  134. package/lib/plugins/favicon/Favicon.d.ts +4 -0
  135. package/lib/plugins/favicon/Favicon.d.ts.map +1 -1
  136. package/lib/plugins/favicon/Favicon.js +4 -0
  137. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts +4 -0
  138. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts.map +1 -1
  139. package/lib/plugins/google-analytics/GoogleAnalytics.js +5 -1
  140. package/lib/plugins/index.d.ts +0 -1
  141. package/lib/plugins/index.d.ts.map +1 -1
  142. package/lib/plugins/index.js +0 -1
  143. package/lib/plugins/logo/Logo.d.ts +4 -0
  144. package/lib/plugins/logo/Logo.d.ts.map +1 -1
  145. package/lib/plugins/logo/Logo.js +4 -0
  146. package/lib/plugins/media-control/MediaControl.d.ts +1 -1
  147. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  148. package/lib/plugins/media-control/MediaControl.js +3 -1
  149. package/lib/plugins/multi-camera/MultiCamera.d.ts +3 -0
  150. package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -1
  151. package/lib/plugins/multi-camera/MultiCamera.js +3 -0
  152. package/lib/plugins/seek-time/SeekTime.d.ts +4 -0
  153. package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -1
  154. package/lib/plugins/seek-time/SeekTime.js +5 -1
  155. package/lib/plugins/share/Share.d.ts +3 -0
  156. package/lib/plugins/share/Share.d.ts.map +1 -1
  157. package/lib/plugins/share/Share.js +3 -0
  158. package/lib/plugins/skip-time/SkipTime.d.ts +3 -0
  159. package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -1
  160. package/lib/plugins/skip-time/SkipTime.js +3 -0
  161. package/lib/plugins/telemetry/Telemetry.d.ts +18 -0
  162. package/lib/plugins/telemetry/Telemetry.d.ts.map +1 -1
  163. package/lib/plugins/telemetry/Telemetry.js +1 -0
  164. package/lib/plugins/thumbnails/Thumbnails.d.ts +48 -3
  165. package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -1
  166. package/lib/plugins/thumbnails/Thumbnails.js +52 -18
  167. package/lib/plugins/volume-fade/VolumeFade.d.ts +1 -0
  168. package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
  169. package/lib/plugins/volume-fade/VolumeFade.js +1 -0
  170. package/package.json +1 -1
  171. package/src/index.plugins.ts +0 -1
  172. package/src/plugins/audio-selector/AudioSelector.ts +227 -154
  173. package/src/plugins/big-mute-button/BigMuteButton.ts +100 -79
  174. package/src/plugins/bottom-gear/BottomGear.ts +1 -0
  175. package/src/plugins/clappr-stats/ClapprStats.ts +32 -8
  176. package/src/plugins/clappr-stats/types.ts +13 -0
  177. package/src/plugins/click-to-pause/ClickToPause.ts +47 -36
  178. package/src/plugins/clips/Clips.ts +127 -71
  179. package/src/plugins/context-menu/ContextMenu.ts +105 -76
  180. package/src/plugins/dvr-controls/DvrControls.ts +11 -30
  181. package/src/plugins/error-screen/ErrorScreen.ts +0 -1
  182. package/src/plugins/favicon/Favicon.ts +4 -0
  183. package/src/plugins/google-analytics/GoogleAnalytics.ts +5 -1
  184. package/src/plugins/index.ts +0 -1
  185. package/src/plugins/logo/Logo.ts +4 -0
  186. package/src/plugins/media-control/MediaControl.ts +4 -1
  187. package/src/plugins/multi-camera/MultiCamera.ts +3 -0
  188. package/src/plugins/seek-time/SeekTime.ts +5 -1
  189. package/src/plugins/share/Share.ts +3 -0
  190. package/src/plugins/skip-time/SkipTime.ts +3 -0
  191. package/src/plugins/telemetry/Telemetry.ts +18 -0
  192. package/src/plugins/thumbnails/Thumbnails.ts +268 -194
  193. package/src/plugins/volume-fade/VolumeFade.ts +1 -0
  194. package/temp/player.api.json +622 -2463
  195. package/tsconfig.tsbuildinfo +1 -1
  196. package/docs/api/player.audioselector.attributes.md +0 -17
  197. package/docs/api/player.audioselector.bindevents.md +0 -18
  198. package/docs/api/player.audioselector.events.md +0 -17
  199. package/docs/api/player.audioselector.hideselecttrackmenu.md +0 -18
  200. package/docs/api/player.audioselector.name.md +0 -14
  201. package/docs/api/player.audioselector.onshowlevelselectmenu.md +0 -18
  202. package/docs/api/player.audioselector.reload.md +0 -18
  203. package/docs/api/player.audioselector.render.md +0 -18
  204. package/docs/api/player.audioselector.supportedversion.md +0 -16
  205. package/docs/api/player.audioselector.template.md +0 -14
  206. package/docs/api/player.audioselector.togglecontextmenu.md +0 -18
  207. package/docs/api/player.audioselector.unbindevents.md +0 -18
  208. package/docs/api/player.audioselector.version.md +0 -14
  209. package/docs/api/player.bigmutebutton.bindevents.md +0 -18
  210. package/docs/api/player.bigmutebutton.events.md +0 -17
  211. package/docs/api/player.bigmutebutton.name.md +0 -14
  212. package/docs/api/player.bigmutebutton.render.md +0 -18
  213. package/docs/api/player.bigmutebutton.supportedversion.md +0 -16
  214. package/docs/api/player.bigmutebutton.template.md +0 -14
  215. package/docs/api/player.clapprstats._buildreport.md +0 -18
  216. package/docs/api/player.clapprstats._defaultreport.md +0 -52
  217. package/docs/api/player.clapprstats._playbackname.md +0 -14
  218. package/docs/api/player.clapprstats._playbacktype.md +0 -14
  219. package/docs/api/player.clapprstats.bindevents.md +0 -18
  220. package/docs/api/player.clapprstats.destroy.md +0 -18
  221. package/docs/api/player.clapprstats.name.md +0 -14
  222. package/docs/api/player.clapprstats.onfirstplaying.md +0 -18
  223. package/docs/api/player.clapprstats.playafterpause.md +0 -18
  224. package/docs/api/player.clapprstats.starttimers.md +0 -18
  225. package/docs/api/player.clapprstats.stopreporting.md +0 -18
  226. package/docs/api/player.clapprstats.supportedversion.md +0 -16
  227. package/docs/api/player.clicktopause.bindevents.md +0 -15
  228. package/docs/api/player.clicktopause.config.md +0 -11
  229. package/docs/api/player.clicktopause.name.md +0 -11
  230. package/docs/api/player.clicktopause.supportedversion.md +0 -13
  231. package/docs/api/player.clipsplugin.attributes.md +0 -13
  232. package/docs/api/player.clipsplugin.bindevents.md +0 -15
  233. package/docs/api/player.clipsplugin.makesvg.md +0 -49
  234. package/docs/api/player.clipsplugin.name.md +0 -11
  235. package/docs/api/player.clipsplugin.unbindevents.md +0 -15
  236. package/docs/api/player.contextmenu.attributes.md +0 -13
  237. package/docs/api/player.contextmenu.bindevents.md +0 -15
  238. package/docs/api/player.contextmenu.destroy.md +0 -15
  239. package/docs/api/player.contextmenu.events.md +0 -13
  240. package/docs/api/player.contextmenu.exposeversion.md +0 -14
  241. package/docs/api/player.contextmenu.label.md +0 -11
  242. package/docs/api/player.contextmenu.mediacontrol.md +0 -11
  243. package/docs/api/player.contextmenu.name.md +0 -11
  244. package/docs/api/player.contextmenu.render.md +0 -15
  245. package/docs/api/player.contextmenu.supportedversion.md +0 -13
  246. package/docs/api/player.contextmenu.template.md +0 -11
  247. package/docs/api/player.contextmenu.url.md +0 -11
  248. package/docs/api/player.disablecontrols.bindevents.md +0 -15
  249. package/docs/api/player.disablecontrols.container.md +0 -11
  250. package/docs/api/player.disablecontrols.md +0 -138
  251. package/docs/api/player.disablecontrols.name.md +0 -11
  252. package/docs/api/player.disablecontrols.supportedversion.md +0 -13
  253. package/docs/api/player.disablecontrols.unbindevents.md +0 -15
  254. package/docs/api/player.thumbnails.attributes.md +0 -13
  255. package/docs/api/player.thumbnails.bindevents.md +0 -15
  256. package/docs/api/player.thumbnails.name.md +0 -11
  257. package/docs/api/player.thumbnails.settext.md +0 -49
  258. package/docs/api/player.thumbnails.supportedversion.md +0 -13
  259. package/docs/api/player.thumbnails.template.md +0 -11
  260. package/src/plugins/disable-controls/DisableControls.ts +0 -81
  261. package/src/plugins/ga-events/GaEvents.js +0 -395
  262. package/src/plugins/ga-events/ga-tracking.js +0 -46
@@ -31431,1328 +31431,1360 @@ const pluginHtml$8 = "<button data-track-selector-button class='gcore-skin-butto
31431
31431
 
31432
31432
  const audioArrow = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"9px\" height=\"6px\" viewBox=\"0 0 9 6\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n <title>quality-arrow</title>\n <desc>Created with Sketch.</desc>\n <defs></defs>\n <g id=\"quality-arrow\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"M5.07079194,5.78553848 C4.91457318,5.94277844 4.70551573,6.00941824 4.50028717,5.99893557 C4.2950586,6.00941824 4.08676693,5.94277844 3.92978239,5.78553848 L0.221118462,1.2997069 C-0.0737061539,1.00469478 -0.0737061539,0.526236029 0.221118462,0.231972666 C0.515177299,-0.0630394586 1.23500883,0.00734414472 1.64852907,0.00734414472 L7.77475484,0.00734414472 C8.21201421,0.00734414472 8.48539703,-0.0630394586 8.77945587,0.231972666 C9.07351471,0.526236029 9.07351471,1.00469478 8.77945587,1.2997069 L5.07079194,5.78553848 Z\"\n fill=\"#FFFFFE\"></path>\n </g>\n</svg>\n";
31433
31433
 
31434
- const VERSION$6 = '0.0.1';
31435
- // const T = 'plugins.audio_selector';
31436
- const AUTO = 0;
31434
+ const global$1 = (typeof global !== "undefined" ? global :
31435
+ typeof self !== "undefined" ? self :
31436
+ typeof window !== "undefined" ? window : {});
31437
+
31438
+ // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
31439
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
31440
+ // Object.prototype.constructor. Remove this eventually
31441
+ function isBuffer(obj) {
31442
+ return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
31443
+ }
31444
+
31445
+ function isFastBuffer (obj) {
31446
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
31447
+ }
31448
+
31449
+ // For Node v0.10 support. Remove this eventually.
31450
+ function isSlowBuffer (obj) {
31451
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
31452
+ }
31453
+
31454
+ var inherits;
31455
+ if (typeof Object.create === 'function'){
31456
+ inherits = function inherits(ctor, superCtor) {
31457
+ // implementation from standard node.js 'util' module
31458
+ ctor.super_ = superCtor;
31459
+ ctor.prototype = Object.create(superCtor.prototype, {
31460
+ constructor: {
31461
+ value: ctor,
31462
+ enumerable: false,
31463
+ writable: true,
31464
+ configurable: true
31465
+ }
31466
+ });
31467
+ };
31468
+ } else {
31469
+ inherits = function inherits(ctor, superCtor) {
31470
+ ctor.super_ = superCtor;
31471
+ var TempCtor = function () {};
31472
+ TempCtor.prototype = superCtor.prototype;
31473
+ ctor.prototype = new TempCtor();
31474
+ ctor.prototype.constructor = ctor;
31475
+ };
31476
+ }
31477
+
31437
31478
  /**
31438
- * @beta
31479
+ * Echos the value of a value. Trys to print the value out
31480
+ * in the best way possible given the different types.
31481
+ *
31482
+ * @param {Object} obj The object to print out.
31483
+ * @param {Object} opts Optional options object that alters the output.
31439
31484
  */
31440
- class AudioSelector extends UICorePlugin {
31441
- selectedTrackId;
31442
- currentTrack = null;
31443
- tracks = [];
31444
- get name() {
31445
- return 'media_control_audio_selector';
31446
- }
31447
- get supportedVersion() {
31448
- return { min: CLAPPR_VERSION };
31485
+ /* legacy: obj, showHidden, depth, colors*/
31486
+ function inspect$1(obj, opts) {
31487
+ // default options
31488
+ var ctx = {
31489
+ seen: [],
31490
+ stylize: stylizeNoColor
31491
+ };
31492
+ // legacy...
31493
+ if (arguments.length >= 3) ctx.depth = arguments[2];
31494
+ if (arguments.length >= 4) ctx.colors = arguments[3];
31495
+ if (isBoolean(opts)) {
31496
+ // legacy...
31497
+ ctx.showHidden = opts;
31498
+ } else if (opts) {
31499
+ // got an "options" object
31500
+ _extend(ctx, opts);
31501
+ }
31502
+ // set default options
31503
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
31504
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
31505
+ if (isUndefined(ctx.colors)) ctx.colors = false;
31506
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
31507
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
31508
+ return formatValue(ctx, obj, ctx.depth);
31509
+ }
31510
+
31511
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
31512
+ inspect$1.colors = {
31513
+ 'bold' : [1, 22],
31514
+ 'italic' : [3, 23],
31515
+ 'underline' : [4, 24],
31516
+ 'inverse' : [7, 27],
31517
+ 'white' : [37, 39],
31518
+ 'grey' : [90, 39],
31519
+ 'black' : [30, 39],
31520
+ 'blue' : [34, 39],
31521
+ 'cyan' : [36, 39],
31522
+ 'green' : [32, 39],
31523
+ 'magenta' : [35, 39],
31524
+ 'red' : [31, 39],
31525
+ 'yellow' : [33, 39]
31526
+ };
31527
+
31528
+ // Don't use 'blue' not visible on cmd.exe
31529
+ inspect$1.styles = {
31530
+ 'special': 'cyan',
31531
+ 'number': 'yellow',
31532
+ 'boolean': 'yellow',
31533
+ 'undefined': 'grey',
31534
+ 'null': 'bold',
31535
+ 'string': 'green',
31536
+ 'date': 'magenta',
31537
+ // "name": intentionally not styling
31538
+ 'regexp': 'red'
31539
+ };
31540
+
31541
+
31542
+ function stylizeWithColor(str, styleType) {
31543
+ var style = inspect$1.styles[styleType];
31544
+
31545
+ if (style) {
31546
+ return '\u001b[' + inspect$1.colors[style][0] + 'm' + str +
31547
+ '\u001b[' + inspect$1.colors[style][1] + 'm';
31548
+ } else {
31549
+ return str;
31550
+ }
31551
+ }
31552
+
31553
+
31554
+ function stylizeNoColor(str, styleType) {
31555
+ return str;
31556
+ }
31557
+
31558
+
31559
+ function arrayToHash(array) {
31560
+ var hash = {};
31561
+
31562
+ array.forEach(function(val, idx) {
31563
+ hash[val] = true;
31564
+ });
31565
+
31566
+ return hash;
31567
+ }
31568
+
31569
+
31570
+ function formatValue(ctx, value, recurseTimes) {
31571
+ // Provide a hook for user-specified inspect functions.
31572
+ // Check that value is an object with an inspect function on it
31573
+ if (ctx.customInspect &&
31574
+ value &&
31575
+ isFunction(value.inspect) &&
31576
+ // Filter out the util module, it's inspect function is special
31577
+ value.inspect !== inspect$1 &&
31578
+ // Also filter out any prototype objects using the circular check.
31579
+ !(value.constructor && value.constructor.prototype === value)) {
31580
+ var ret = value.inspect(recurseTimes, ctx);
31581
+ if (!isString(ret)) {
31582
+ ret = formatValue(ctx, ret, recurseTimes);
31449
31583
  }
31450
- static get version() {
31451
- return VERSION$6;
31584
+ return ret;
31585
+ }
31586
+
31587
+ // Primitive types cannot have properties
31588
+ var primitive = formatPrimitive(ctx, value);
31589
+ if (primitive) {
31590
+ return primitive;
31591
+ }
31592
+
31593
+ // Look up the keys of the object.
31594
+ var keys = Object.keys(value);
31595
+ var visibleKeys = arrayToHash(keys);
31596
+
31597
+ if (ctx.showHidden) {
31598
+ keys = Object.getOwnPropertyNames(value);
31599
+ }
31600
+
31601
+ // IE doesn't make error fields non-enumerable
31602
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
31603
+ if (isError(value)
31604
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
31605
+ return formatError(value);
31606
+ }
31607
+
31608
+ // Some type of object without properties can be shortcutted.
31609
+ if (keys.length === 0) {
31610
+ if (isFunction(value)) {
31611
+ var name = value.name ? ': ' + value.name : '';
31612
+ return ctx.stylize('[Function' + name + ']', 'special');
31452
31613
  }
31453
- get template() {
31454
- return tmpl(pluginHtml$8);
31614
+ if (isRegExp(value)) {
31615
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
31455
31616
  }
31456
- get attributes() {
31457
- return {
31458
- 'class': this.name,
31459
- 'data-track-selector': ''
31460
- };
31617
+ if (isDate(value)) {
31618
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
31461
31619
  }
31462
- get events() {
31463
- return {
31464
- 'click [data-track-selector-select]': 'onTrackSelect',
31465
- 'click [data-track-selector-button]': 'onShowLevelSelectMenu'
31466
- };
31620
+ if (isError(value)) {
31621
+ return formatError(value);
31467
31622
  }
31468
- bindEvents() {
31469
- this.listenTo(this.core, Events$1.CORE_READY, this.bindPlaybackEvents);
31470
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.reload);
31471
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.render);
31472
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_HIDE, this.hideSelectTrackMenu);
31623
+ }
31624
+
31625
+ var base = '', array = false, braces = ['{', '}'];
31626
+
31627
+ // Make Array say that they are Array
31628
+ if (isArray(value)) {
31629
+ array = true;
31630
+ braces = ['[', ']'];
31631
+ }
31632
+
31633
+ // Make functions say that they are functions
31634
+ if (isFunction(value)) {
31635
+ var n = value.name ? ': ' + value.name : '';
31636
+ base = ' [Function' + n + ']';
31637
+ }
31638
+
31639
+ // Make RegExps say that they are RegExps
31640
+ if (isRegExp(value)) {
31641
+ base = ' ' + RegExp.prototype.toString.call(value);
31642
+ }
31643
+
31644
+ // Make dates with properties first say the date
31645
+ if (isDate(value)) {
31646
+ base = ' ' + Date.prototype.toUTCString.call(value);
31647
+ }
31648
+
31649
+ // Make error with message first say the error
31650
+ if (isError(value)) {
31651
+ base = ' ' + formatError(value);
31652
+ }
31653
+
31654
+ if (keys.length === 0 && (!array || value.length == 0)) {
31655
+ return braces[0] + base + braces[1];
31656
+ }
31657
+
31658
+ if (recurseTimes < 0) {
31659
+ if (isRegExp(value)) {
31660
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
31661
+ } else {
31662
+ return ctx.stylize('[Object]', 'special');
31473
31663
  }
31474
- unBindEvents() {
31475
- // @ts-ignore
31476
- this.stopListening(this.core, Events$1.CORE_READY);
31477
- // @ts-ignore
31478
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED);
31479
- // @ts-ignore
31480
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED);
31481
- // @ts-ignore
31482
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_HIDE);
31483
- }
31484
- bindPlaybackEvents() {
31485
- // this.currentTrack = {};
31486
- // this.removeAuto = false;
31487
- this.selectedTrackId = undefined;
31488
- const currentPlayback = this.core.activePlayback;
31489
- this.listenTo(currentPlayback, Events$1.PLAYBACK_STOP, this.onStop);
31490
- this.setupAudioTrackListeners();
31491
- }
31492
- setupAudioTrackListeners() {
31493
- const currentPlayback = this.core.activePlayback;
31494
- // TODO no-crutch:currentPlayback._hls
31495
- if (currentPlayback._hls) {
31496
- // TODO AUDIO_TRACKS_UPDATED
31497
- // currentPlayback._hls.on('hlsAudioTracksUpdated', (e, data) => {
31498
- currentPlayback._hls.on(Events.AUDIO_TRACKS_UPDATED, (e, data) => {
31499
- // let id = -1;
31500
- // for (const audioTrack of data.audioTracks) {
31501
- // if (audioTrack.default) {
31502
- // id = audioTrack.id;
31503
- // this.currentTrack = audioTrack;
31504
- // }
31505
- // }
31506
- const defaultTrack = data.audioTracks.find((track) => track.default);
31507
- if (defaultTrack) {
31508
- this.currentTrack = {
31509
- id: defaultTrack.id,
31510
- label: defaultTrack.name
31511
- };
31512
- }
31513
- this.fillTracks(data.audioTracks.map(p => ({
31514
- id: p.id,
31515
- label: p.name
31516
- })), defaultTrack?.id);
31517
- });
31518
- currentPlayback._hls.on(Events.AUDIO_TRACK_SWITCHING, this.startTrackSwitch.bind(this));
31519
- currentPlayback._hls.on(Events.AUDIO_TRACK_SWITCHED, this.updateCurrentTrack.bind(this));
31520
- currentPlayback._hls.on(Events.AUDIO_TRACK_LOADED, this.updateCurrentTrack.bind(this));
31521
- }
31522
- else {
31523
- this.listenToOnce(currentPlayback, Events$1.PLAYBACK_PLAY, () => {
31524
- const mediaElement = currentPlayback.$el.get(0);
31525
- // const { audioTracks } = currentPlayback.$el.get(0);
31526
- const audioTracks = mediaElement.audioTracks;
31527
- if (audioTracks && audioTracks.length) {
31528
- let index = 0;
31529
- const trackItems = [];
31530
- for (const audioTrack of audioTracks) {
31531
- if (audioTrack.enabled) {
31532
- const t = {
31533
- id: index,
31534
- label: audioTrack.label,
31535
- };
31536
- this.currentTrack = t;
31537
- trackItems.push(t);
31538
- index++;
31539
- }
31540
- }
31541
- audioTracks.addEventListener('change', () => this.updateCurrentTrackW3C());
31542
- this.fillTracks(trackItems, trackItems[0].id);
31543
- }
31544
- });
31545
- }
31546
- }
31547
- onStop() { }
31548
- reload() {
31549
- this.unBindEvents();
31550
- this.bindEvents();
31551
- this.bindPlaybackEvents();
31552
- }
31553
- shouldRender() {
31554
- if (!this.core.activeContainer) {
31555
- return false;
31556
- }
31557
- const currentPlayback = this.core.activePlayback;
31558
- if (!currentPlayback) {
31559
- return false;
31560
- }
31561
- const { audioTracks } = (currentPlayback.activePlayback._hls || currentPlayback.$el.get(0));
31562
- this.tracks = audioTracks;
31563
- // Only care if we have at least 2 to choose from
31564
- return this.tracks && this.tracks.length > 1;
31565
- }
31566
- render() {
31567
- if (this.shouldRender()) {
31568
- this.$el.html(this.template({ 'tracks': this.tracks, 'title': this.getTitle() }));
31569
- if (Object.prototype.hasOwnProperty.call(this.core.mediaControl, '$audioTracksSelector') &&
31570
- this.core.mediaControl.$audioTracksSelector.length > 0) {
31571
- this.core.mediaControl.$audioTracksSelector.append(this.el);
31572
- }
31573
- this.highlightCurrentTrack();
31574
- }
31575
- if (Object.prototype.hasOwnProperty.call(this.core.mediaControl, '$audioTracksSelector') &&
31576
- this.core.mediaControl.$audioTracksSelector.find('span.audio-arrow').length > 0) {
31577
- this.core.mediaControl.$audioTracksSelector.find('span.audio-arrow').append(audioArrow);
31578
- }
31579
- return this;
31664
+ }
31665
+
31666
+ ctx.seen.push(value);
31667
+
31668
+ var output;
31669
+ if (array) {
31670
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
31671
+ } else {
31672
+ output = keys.map(function(key) {
31673
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
31674
+ });
31675
+ }
31676
+
31677
+ ctx.seen.pop();
31678
+
31679
+ return reduceToSingleString(output, base, braces);
31680
+ }
31681
+
31682
+
31683
+ function formatPrimitive(ctx, value) {
31684
+ if (isUndefined(value))
31685
+ return ctx.stylize('undefined', 'undefined');
31686
+ if (isString(value)) {
31687
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
31688
+ .replace(/'/g, "\\'")
31689
+ .replace(/\\"/g, '"') + '\'';
31690
+ return ctx.stylize(simple, 'string');
31691
+ }
31692
+ if (isNumber(value))
31693
+ return ctx.stylize('' + value, 'number');
31694
+ if (isBoolean(value))
31695
+ return ctx.stylize('' + value, 'boolean');
31696
+ // For some reason typeof null is "object", so special case here.
31697
+ if (isNull(value))
31698
+ return ctx.stylize('null', 'null');
31699
+ }
31700
+
31701
+
31702
+ function formatError(value) {
31703
+ return '[' + Error.prototype.toString.call(value) + ']';
31704
+ }
31705
+
31706
+
31707
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
31708
+ var output = [];
31709
+ for (var i = 0, l = value.length; i < l; ++i) {
31710
+ if (hasOwnProperty(value, String(i))) {
31711
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
31712
+ String(i), true));
31713
+ } else {
31714
+ output.push('');
31580
31715
  }
31581
- fillTracks(tracks, selected = AUTO) {
31582
- if (this.selectedTrackId === undefined) {
31583
- this.selectedTrackId = selected;
31584
- }
31585
- // this.tracks = levels.audioTracks;
31586
- // for (let i = 0; i < this.tracks.length; i++) {
31587
- // if (this.tracks[i].name && !this.tracks[i].label) {
31588
- // this.tracks[i].label = this.tracks[i].name;
31589
- // }
31590
- // }
31591
- this.tracks = tracks;
31592
- // Player.player.trigger('tracks', this.tracks);
31593
- // this.core.trigger('tracks', this.tracks);
31594
- this.render();
31716
+ }
31717
+ keys.forEach(function(key) {
31718
+ if (!key.match(/^\d+$/)) {
31719
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
31720
+ key, true));
31595
31721
  }
31596
- findTrackBy(id) {
31597
- return this.tracks.find((track) => track.id === id);
31722
+ });
31723
+ return output;
31724
+ }
31725
+
31726
+
31727
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
31728
+ var name, str, desc;
31729
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
31730
+ if (desc.get) {
31731
+ if (desc.set) {
31732
+ str = ctx.stylize('[Getter/Setter]', 'special');
31733
+ } else {
31734
+ str = ctx.stylize('[Getter]', 'special');
31598
31735
  }
31599
- onTrackSelect(event) {
31600
- // this.selectedTrackId = parseInt(event.target.dataset.levelSelectorSelect, 10)
31601
- const id = event.target?.dataset?.trackSelectorSelect;
31602
- if (id) {
31603
- this.setIndexTrack(Number(id));
31604
- }
31605
- this.toggleContextMenu();
31606
- event.stopPropagation();
31607
- return false;
31736
+ } else {
31737
+ if (desc.set) {
31738
+ str = ctx.stylize('[Setter]', 'special');
31608
31739
  }
31609
- setIndexTrack(index) {
31610
- this.selectedTrackId = index;
31611
- if (this.core.activePlayback._hls) {
31612
- if (this.core.activePlayback._hls.audioTrack.id === this.selectedTrackId) {
31613
- return;
31614
- }
31615
- this.core.activePlayback._hls.audioTrack = this.selectedTrackId;
31616
- }
31617
- else {
31618
- const { audioTracks } = this.core.activePlayback.$el.get(0);
31619
- for (const track of audioTracks) {
31620
- track.enabled = track.id === this.selectedTrackId;
31621
- }
31740
+ }
31741
+ if (!hasOwnProperty(visibleKeys, key)) {
31742
+ name = '[' + key + ']';
31743
+ }
31744
+ if (!str) {
31745
+ if (ctx.seen.indexOf(desc.value) < 0) {
31746
+ if (isNull(recurseTimes)) {
31747
+ str = formatValue(ctx, desc.value, null);
31748
+ } else {
31749
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
31750
+ }
31751
+ if (str.indexOf('\n') > -1) {
31752
+ if (array) {
31753
+ str = str.split('\n').map(function(line) {
31754
+ return ' ' + line;
31755
+ }).join('\n').substr(2);
31756
+ } else {
31757
+ str = '\n' + str.split('\n').map(function(line) {
31758
+ return ' ' + line;
31759
+ }).join('\n');
31622
31760
  }
31623
- this.updateText(this.selectedTrackId);
31624
- }
31625
- onShowLevelSelectMenu() {
31626
- this.toggleContextMenu();
31627
- }
31628
- hideSelectTrackMenu() {
31629
- this.$('.audio_selector ul').hide();
31630
- }
31631
- toggleContextMenu() {
31632
- this.$('.audio_selector ul').toggle();
31633
- }
31634
- buttonElement() {
31635
- return this.$('.audio_selector button');
31761
+ }
31762
+ } else {
31763
+ str = ctx.stylize('[Circular]', 'special');
31636
31764
  }
31637
- buttonElementText() {
31638
- return this.$('.audio_selector button .audio-text');
31765
+ }
31766
+ if (isUndefined(name)) {
31767
+ if (array && key.match(/^\d+$/)) {
31768
+ return str;
31639
31769
  }
31640
- trackElement(id) {
31641
- return this.$('.audio_selector ul a' + (id !== undefined ? '[data-track-selector-select="' + id + '"]' : '')).parent();
31770
+ name = JSON.stringify('' + key);
31771
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
31772
+ name = name.substr(1, name.length - 2);
31773
+ name = ctx.stylize(name, 'name');
31774
+ } else {
31775
+ name = name.replace(/'/g, "\\'")
31776
+ .replace(/\\"/g, '"')
31777
+ .replace(/(^"|"$)/g, "'");
31778
+ name = ctx.stylize(name, 'string');
31642
31779
  }
31643
- getTitle() {
31644
- if (!this.tracks) {
31645
- return '';
31646
- }
31647
- const selectedTrackId = this.selectedTrackId || 0;
31648
- const selectedTrack = this.tracks[selectedTrackId];
31649
- return selectedTrack?.label || '';
31650
- }
31651
- startTrackSwitch() {
31652
- this.buttonElement().addClass('changing');
31653
- }
31654
- updateText(trackId) {
31655
- if (trackId === undefined) {
31656
- return;
31657
- }
31658
- const track = this.findTrackBy(trackId);
31659
- if (track) {
31660
- this.buttonElementText().text(track.label);
31661
- }
31662
- }
31663
- updateCurrentTrack(e, info) {
31664
- // if (!info) {
31665
- // const { audioTracks } = this.core.activePlayback.$el.get(0);
31666
- // for (const track of audioTracks) {
31667
- // if (track.enabled) {
31668
- // info = track;
31669
- // }
31670
- // }
31671
- // }
31672
- // if (!info) {
31673
- // return;
31674
- // }
31675
- // const track = this.findTrackBy(info.id);
31676
- // this.currentTrack = track ? track : null;
31677
- // this.selectedTrackId = track?.id;
31678
- // this.highlightCurrentTrack();
31679
- // this.buttonElement().removeClass('changing');
31680
- this.setCurrentTrack(info.id);
31681
- }
31682
- updateCurrentTrackW3C() {
31683
- const { audioTracks } = this.core.activePlayback.$el.get(0);
31684
- const index = audioTracks.findIndex((track) => track.enabled);
31685
- if (index >= 0) {
31686
- this.setCurrentTrack(index);
31687
- }
31688
- }
31689
- setCurrentTrack(index) {
31690
- const track = this.findTrackBy(index);
31691
- this.currentTrack = track ?? null;
31692
- this.selectedTrackId = index;
31693
- this.highlightCurrentTrack();
31694
- this.buttonElement().removeClass('changing');
31695
- }
31696
- highlightCurrentTrack() {
31697
- this.trackElement().removeClass('current');
31698
- this.trackElement().find('a').removeClass('gcore-skin-active');
31699
- if (this.currentTrack) {
31700
- const currentTrackElement = this.trackElement(this.currentTrack.id);
31701
- currentTrackElement.addClass('current');
31702
- currentTrackElement.find('a').addClass('gcore-skin-active');
31703
- }
31704
- this.updateText(this.selectedTrackId);
31705
- }
31706
- }
31780
+ }
31707
31781
 
31708
- /**
31709
- * @public
31710
- * @param msg
31711
- * @param data
31712
- */
31713
- function trace(msg, data = {}) {
31782
+ return name + ': ' + str;
31714
31783
  }
31715
31784
 
31716
- const volumeOffIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.50025 8.00025C4.67125 8.00025 4.00025 8.67225 4.00025 9.50025V14.5003C4.00025 15.3283 4.67125 16.0003 5.50025 16.0003H7.24824C7.65024 16.0003 8.03627 16.1613 8.31727 16.4483L12.5443 20.7413C12.7083 20.9073 12.9262 20.9963 13.1492 20.9963C13.2572 20.9963 13.3672 20.9763 13.4722 20.9333C13.7932 20.8013 14.0003 20.4923 14.0003 20.1462V16.3283C14.0003 16.1963 13.9473 16.0683 13.8543 15.9753L6.02528 8.14625C5.93228 8.05325 5.80425 8.00025 5.67225 8.00025H5.50025ZM14.0003 3.85426C14.0003 3.50826 13.7932 3.19927 13.4722 3.06727C13.1502 2.93627 12.7873 3.01226 12.5443 3.25926L9.33827 6.51527C9.14627 6.71127 9.14626 7.02625 9.34126 7.22025L13.5733 11.4522C13.7313 11.6102 14.0003 11.4982 14.0003 11.2752V3.85426ZM20.8543 20.8543C20.7563 20.9513 20.6283 21.0003 20.5003 21.0003C20.3723 21.0003 20.2442 20.9513 20.1462 20.8543L3.14625 3.85426C2.95125 3.65826 2.95125 3.34225 3.14625 3.14625C3.34225 2.95125 3.65826 2.95125 3.85426 3.14625L20.8543 20.1462C21.0493 20.3422 21.0493 20.6583 20.8543 20.8543Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
31717
31785
 
31718
- const pluginHtml$7 = "<div class=\"big-mute-icon-wrapper\" data-big-mute>\n <div class=\"big-mute-icon gcore-skin-border-color\" data-big-mute-icon></div>\n</div>\n";
31786
+ function reduceToSingleString(output, base, braces) {
31787
+ var length = output.reduce(function(prev, cur) {
31788
+ if (cur.indexOf('\n') >= 0) ;
31789
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
31790
+ }, 0);
31719
31791
 
31720
- const T$9 = "plugins.big_mute_button";
31721
- /**
31722
- * @beta
31723
- */
31724
- class BigMuteButton extends UICorePlugin {
31725
- isBigMuteButtonHidden = false;
31726
- _adIsPlaying = false;
31727
- $bigMuteBtnContainer = null;
31728
- $bigMuteButton = null;
31729
- get name() {
31730
- return 'big_mute_button';
31731
- }
31732
- get supportedVersion() {
31733
- return { min: CLAPPR_VERSION };
31734
- }
31735
- get template() {
31736
- return tmpl(pluginHtml$7);
31737
- }
31738
- get events() {
31739
- return {
31740
- 'click .big-mute-icon': 'handleBigMuteBtnClick',
31741
- 'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
31742
- };
31743
- }
31744
- bindEvents() {
31745
- super.bindEvents();
31746
- this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
31747
- this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
31748
- this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
31749
- trace(`${T$9} bindEvents`, {
31750
- mediacontrol: !!this.core.mediaControl,
31751
- });
31752
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mediaControlRendered);
31753
- }
31754
- unBindEvents() {
31755
- // @ts-ignore
31756
- this.stopListening(this.core, Events$1.CORE_READY);
31757
- this.stopListening(this.core, 'core:advertisement:start', this.onStartAd);
31758
- this.stopListening(this.core, 'core:advertisement:finish', this.onFinishAd);
31759
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mediaControlRendered);
31760
- const container = this.core.activeContainer;
31761
- if (container) {
31762
- this.stopListening(container.playback, Events$1.PLAYBACK_PLAY, this.render);
31763
- }
31764
- }
31765
- onCoreReady() {
31766
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_VOLUME, this.onContainerVolume);
31767
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_READY, this.onContainerStart);
31768
- this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_ENDED, this.onPlaybackEnded);
31769
- }
31770
- onContainerVolume(value) {
31771
- if (value !== 0) {
31772
- this.destroyBigMuteBtn();
31773
- }
31774
- }
31775
- onContainerStart() {
31776
- if (this.isBigMuteButtonHidden) {
31777
- this.showBigMuteBtn();
31778
- }
31779
- }
31780
- onPlaybackEnded() {
31781
- this.hideBigMuteBtn();
31782
- }
31783
- mediaControlRendered() {
31784
- const container = this.core.activeContainer;
31785
- if (container) {
31786
- this.listenTo(container.playback, Events$1.PLAYBACK_PLAY, () => {
31787
- this.render();
31788
- });
31789
- }
31790
- }
31791
- onStartAd() {
31792
- this._adIsPlaying = true;
31793
- if (this.$bigMuteBtnContainer) {
31794
- this.$bigMuteBtnContainer.addClass('hide');
31795
- }
31796
- }
31797
- onFinishAd() {
31798
- this._adIsPlaying = false;
31799
- if (this.$bigMuteBtnContainer) {
31800
- this.$bigMuteBtnContainer.removeClass('hide');
31801
- }
31802
- }
31803
- shouldRender() {
31804
- const container = this.core.activeContainer;
31805
- if (!container) {
31806
- return false;
31807
- }
31808
- const { autoPlay, wasMuted } = this.options;
31809
- const volume = container.volume;
31810
- return autoPlay && !wasMuted && volume === 0;
31811
- }
31812
- render() {
31813
- if (this.shouldRender()) {
31814
- trace(`${T$9} render`, {
31815
- el: !!this.$el,
31816
- });
31817
- this.$el.html(this.template());
31818
- this.$bigMuteBtnContainer = this.$el.find('.big-mute-icon-wrapper[data-big-mute]');
31819
- this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide');
31820
- this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon');
31821
- this.$bigMuteButton.append(volumeOffIcon);
31822
- const container = this.core.activeContainer;
31823
- container.$el.append(this.$el.get(0));
31824
- }
31825
- return this;
31826
- }
31827
- hideBigMuteBtn() {
31828
- this.isBigMuteButtonHidden = true;
31829
- this.$bigMuteBtnContainer?.addClass('hide');
31830
- }
31831
- showBigMuteBtn() {
31832
- this.isBigMuteButtonHidden = false;
31833
- if (this.$bigMuteBtnContainer) {
31834
- this.$bigMuteBtnContainer.removeClass('hide');
31835
- }
31836
- }
31837
- destroyBigMuteBtn(e) {
31838
- this.hideBigMuteBtn();
31839
- if (e && e.stopPropagation) {
31840
- e.stopPropagation();
31841
- }
31842
- this.destroy();
31843
- }
31844
- handleBigMuteBtnClick(e) {
31845
- const localVolume = Utils.Config.restore('volume');
31846
- const volume = !isNaN(localVolume) ? localVolume : 100;
31847
- // TODO use container.setVolume() instead
31848
- this.core.mediaControl.setVolume(volume === 0 ? 100 : volume);
31849
- this.destroyBigMuteBtn(e);
31850
- }
31792
+ if (length > 60) {
31793
+ return braces[0] +
31794
+ (base === '' ? '' : base + '\n ') +
31795
+ ' ' +
31796
+ output.join(',\n ') +
31797
+ ' ' +
31798
+ braces[1];
31799
+ }
31800
+
31801
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
31851
31802
  }
31852
31803
 
31853
- const global$1 = (typeof global !== "undefined" ? global :
31854
- typeof self !== "undefined" ? self :
31855
- typeof window !== "undefined" ? window : {});
31856
31804
 
31857
- // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
31858
- // The _isBuffer check is for Safari 5-7 support, because it's missing
31859
- // Object.prototype.constructor. Remove this eventually
31860
- function isBuffer(obj) {
31861
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
31805
+ // NOTE: These type checking functions intentionally don't use `instanceof`
31806
+ // because it is fragile and can be easily faked with `Object.create()`.
31807
+ function isArray(ar) {
31808
+ return Array.isArray(ar);
31862
31809
  }
31863
31810
 
31864
- function isFastBuffer (obj) {
31865
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
31811
+ function isBoolean(arg) {
31812
+ return typeof arg === 'boolean';
31866
31813
  }
31867
31814
 
31868
- // For Node v0.10 support. Remove this eventually.
31869
- function isSlowBuffer (obj) {
31870
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
31815
+ function isNull(arg) {
31816
+ return arg === null;
31871
31817
  }
31872
31818
 
31873
- var inherits;
31874
- if (typeof Object.create === 'function'){
31875
- inherits = function inherits(ctor, superCtor) {
31876
- // implementation from standard node.js 'util' module
31877
- ctor.super_ = superCtor;
31878
- ctor.prototype = Object.create(superCtor.prototype, {
31879
- constructor: {
31880
- value: ctor,
31881
- enumerable: false,
31882
- writable: true,
31883
- configurable: true
31884
- }
31885
- });
31886
- };
31887
- } else {
31888
- inherits = function inherits(ctor, superCtor) {
31889
- ctor.super_ = superCtor;
31890
- var TempCtor = function () {};
31891
- TempCtor.prototype = superCtor.prototype;
31892
- ctor.prototype = new TempCtor();
31893
- ctor.prototype.constructor = ctor;
31894
- };
31819
+ function isNumber(arg) {
31820
+ return typeof arg === 'number';
31895
31821
  }
31896
31822
 
31897
- /**
31898
- * Echos the value of a value. Trys to print the value out
31899
- * in the best way possible given the different types.
31900
- *
31901
- * @param {Object} obj The object to print out.
31902
- * @param {Object} opts Optional options object that alters the output.
31903
- */
31904
- /* legacy: obj, showHidden, depth, colors*/
31905
- function inspect$1(obj, opts) {
31906
- // default options
31907
- var ctx = {
31908
- seen: [],
31909
- stylize: stylizeNoColor
31910
- };
31911
- // legacy...
31912
- if (arguments.length >= 3) ctx.depth = arguments[2];
31913
- if (arguments.length >= 4) ctx.colors = arguments[3];
31914
- if (isBoolean(opts)) {
31915
- // legacy...
31916
- ctx.showHidden = opts;
31917
- } else if (opts) {
31918
- // got an "options" object
31919
- _extend(ctx, opts);
31920
- }
31921
- // set default options
31922
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
31923
- if (isUndefined(ctx.depth)) ctx.depth = 2;
31924
- if (isUndefined(ctx.colors)) ctx.colors = false;
31925
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
31926
- if (ctx.colors) ctx.stylize = stylizeWithColor;
31927
- return formatValue(ctx, obj, ctx.depth);
31823
+ function isString(arg) {
31824
+ return typeof arg === 'string';
31928
31825
  }
31929
31826
 
31930
- // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
31931
- inspect$1.colors = {
31932
- 'bold' : [1, 22],
31933
- 'italic' : [3, 23],
31934
- 'underline' : [4, 24],
31935
- 'inverse' : [7, 27],
31936
- 'white' : [37, 39],
31937
- 'grey' : [90, 39],
31938
- 'black' : [30, 39],
31939
- 'blue' : [34, 39],
31940
- 'cyan' : [36, 39],
31941
- 'green' : [32, 39],
31942
- 'magenta' : [35, 39],
31943
- 'red' : [31, 39],
31944
- 'yellow' : [33, 39]
31945
- };
31946
-
31947
- // Don't use 'blue' not visible on cmd.exe
31948
- inspect$1.styles = {
31949
- 'special': 'cyan',
31950
- 'number': 'yellow',
31951
- 'boolean': 'yellow',
31952
- 'undefined': 'grey',
31953
- 'null': 'bold',
31954
- 'string': 'green',
31955
- 'date': 'magenta',
31956
- // "name": intentionally not styling
31957
- 'regexp': 'red'
31958
- };
31959
-
31960
-
31961
- function stylizeWithColor(str, styleType) {
31962
- var style = inspect$1.styles[styleType];
31827
+ function isUndefined(arg) {
31828
+ return arg === undefined;
31829
+ }
31963
31830
 
31964
- if (style) {
31965
- return '\u001b[' + inspect$1.colors[style][0] + 'm' + str +
31966
- '\u001b[' + inspect$1.colors[style][1] + 'm';
31967
- } else {
31968
- return str;
31969
- }
31831
+ function isRegExp(re) {
31832
+ return isObject(re) && objectToString(re) === '[object RegExp]';
31970
31833
  }
31971
31834
 
31835
+ function isObject(arg) {
31836
+ return typeof arg === 'object' && arg !== null;
31837
+ }
31972
31838
 
31973
- function stylizeNoColor(str, styleType) {
31974
- return str;
31839
+ function isDate(d) {
31840
+ return isObject(d) && objectToString(d) === '[object Date]';
31975
31841
  }
31976
31842
 
31843
+ function isError(e) {
31844
+ return isObject(e) &&
31845
+ (objectToString(e) === '[object Error]' || e instanceof Error);
31846
+ }
31977
31847
 
31978
- function arrayToHash(array) {
31979
- var hash = {};
31848
+ function isFunction(arg) {
31849
+ return typeof arg === 'function';
31850
+ }
31980
31851
 
31981
- array.forEach(function(val, idx) {
31982
- hash[val] = true;
31983
- });
31852
+ function isPrimitive(arg) {
31853
+ return arg === null ||
31854
+ typeof arg === 'boolean' ||
31855
+ typeof arg === 'number' ||
31856
+ typeof arg === 'string' ||
31857
+ typeof arg === 'symbol' || // ES6 symbol
31858
+ typeof arg === 'undefined';
31859
+ }
31984
31860
 
31985
- return hash;
31861
+ function objectToString(o) {
31862
+ return Object.prototype.toString.call(o);
31986
31863
  }
31987
31864
 
31865
+ function _extend(origin, add) {
31866
+ // Don't do anything if add isn't an object
31867
+ if (!add || !isObject(add)) return origin;
31988
31868
 
31989
- function formatValue(ctx, value, recurseTimes) {
31990
- // Provide a hook for user-specified inspect functions.
31991
- // Check that value is an object with an inspect function on it
31992
- if (ctx.customInspect &&
31993
- value &&
31994
- isFunction(value.inspect) &&
31995
- // Filter out the util module, it's inspect function is special
31996
- value.inspect !== inspect$1 &&
31997
- // Also filter out any prototype objects using the circular check.
31998
- !(value.constructor && value.constructor.prototype === value)) {
31999
- var ret = value.inspect(recurseTimes, ctx);
32000
- if (!isString(ret)) {
32001
- ret = formatValue(ctx, ret, recurseTimes);
32002
- }
32003
- return ret;
31869
+ var keys = Object.keys(add);
31870
+ var i = keys.length;
31871
+ while (i--) {
31872
+ origin[keys[i]] = add[keys[i]];
32004
31873
  }
31874
+ return origin;
31875
+ }
31876
+ function hasOwnProperty(obj, prop) {
31877
+ return Object.prototype.hasOwnProperty.call(obj, prop);
31878
+ }
32005
31879
 
32006
- // Primitive types cannot have properties
32007
- var primitive = formatPrimitive(ctx, value);
32008
- if (primitive) {
32009
- return primitive;
31880
+ function compare(a, b) {
31881
+ if (a === b) {
31882
+ return 0;
32010
31883
  }
32011
31884
 
32012
- // Look up the keys of the object.
32013
- var keys = Object.keys(value);
32014
- var visibleKeys = arrayToHash(keys);
31885
+ var x = a.length;
31886
+ var y = b.length;
32015
31887
 
32016
- if (ctx.showHidden) {
32017
- keys = Object.getOwnPropertyNames(value);
31888
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
31889
+ if (a[i] !== b[i]) {
31890
+ x = a[i];
31891
+ y = b[i];
31892
+ break;
31893
+ }
32018
31894
  }
32019
31895
 
32020
- // IE doesn't make error fields non-enumerable
32021
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
32022
- if (isError(value)
32023
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
32024
- return formatError(value);
31896
+ if (x < y) {
31897
+ return -1;
32025
31898
  }
32026
-
32027
- // Some type of object without properties can be shortcutted.
32028
- if (keys.length === 0) {
32029
- if (isFunction(value)) {
32030
- var name = value.name ? ': ' + value.name : '';
32031
- return ctx.stylize('[Function' + name + ']', 'special');
32032
- }
32033
- if (isRegExp(value)) {
32034
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
32035
- }
32036
- if (isDate(value)) {
32037
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
32038
- }
32039
- if (isError(value)) {
32040
- return formatError(value);
32041
- }
31899
+ if (y < x) {
31900
+ return 1;
32042
31901
  }
31902
+ return 0;
31903
+ }
31904
+ var hasOwn = Object.prototype.hasOwnProperty;
32043
31905
 
32044
- var base = '', array = false, braces = ['{', '}'];
32045
-
32046
- // Make Array say that they are Array
32047
- if (isArray(value)) {
32048
- array = true;
32049
- braces = ['[', ']'];
31906
+ var objectKeys = Object.keys || function (obj) {
31907
+ var keys = [];
31908
+ for (var key in obj) {
31909
+ if (hasOwn.call(obj, key)) keys.push(key);
32050
31910
  }
32051
-
32052
- // Make functions say that they are functions
32053
- if (isFunction(value)) {
32054
- var n = value.name ? ': ' + value.name : '';
32055
- base = ' [Function' + n + ']';
31911
+ return keys;
31912
+ };
31913
+ var pSlice = Array.prototype.slice;
31914
+ var _functionsHaveNames;
31915
+ function functionsHaveNames() {
31916
+ if (typeof _functionsHaveNames !== 'undefined') {
31917
+ return _functionsHaveNames;
32056
31918
  }
32057
-
32058
- // Make RegExps say that they are RegExps
32059
- if (isRegExp(value)) {
32060
- base = ' ' + RegExp.prototype.toString.call(value);
31919
+ return _functionsHaveNames = (function () {
31920
+ return function foo() {}.name === 'foo';
31921
+ }());
31922
+ }
31923
+ function pToString (obj) {
31924
+ return Object.prototype.toString.call(obj);
31925
+ }
31926
+ function isView(arrbuf) {
31927
+ if (isBuffer(arrbuf)) {
31928
+ return false;
32061
31929
  }
32062
-
32063
- // Make dates with properties first say the date
32064
- if (isDate(value)) {
32065
- base = ' ' + Date.prototype.toUTCString.call(value);
31930
+ if (typeof global$1.ArrayBuffer !== 'function') {
31931
+ return false;
32066
31932
  }
32067
-
32068
- // Make error with message first say the error
32069
- if (isError(value)) {
32070
- base = ' ' + formatError(value);
31933
+ if (typeof ArrayBuffer.isView === 'function') {
31934
+ return ArrayBuffer.isView(arrbuf);
32071
31935
  }
32072
-
32073
- if (keys.length === 0 && (!array || value.length == 0)) {
32074
- return braces[0] + base + braces[1];
31936
+ if (!arrbuf) {
31937
+ return false;
32075
31938
  }
32076
-
32077
- if (recurseTimes < 0) {
32078
- if (isRegExp(value)) {
32079
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
32080
- } else {
32081
- return ctx.stylize('[Object]', 'special');
32082
- }
31939
+ if (arrbuf instanceof DataView) {
31940
+ return true;
31941
+ }
31942
+ if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
31943
+ return true;
32083
31944
  }
31945
+ return false;
31946
+ }
31947
+ // 1. The assert module provides functions that throw
31948
+ // AssertionError's when particular conditions are not met. The
31949
+ // assert module must conform to the following interface.
32084
31950
 
32085
- ctx.seen.push(value);
32086
-
32087
- var output;
32088
- if (array) {
32089
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
32090
- } else {
32091
- output = keys.map(function(key) {
32092
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
32093
- });
32094
- }
32095
-
32096
- ctx.seen.pop();
32097
-
32098
- return reduceToSingleString(output, base, braces);
32099
- }
31951
+ function assert(value, message) {
31952
+ if (!value) fail(value, true, message, '==', ok);
31953
+ }
32100
31954
 
31955
+ // 2. The AssertionError is defined in assert.
31956
+ // new assert.AssertionError({ message: message,
31957
+ // actual: actual,
31958
+ // expected: expected })
32101
31959
 
32102
- function formatPrimitive(ctx, value) {
32103
- if (isUndefined(value))
32104
- return ctx.stylize('undefined', 'undefined');
32105
- if (isString(value)) {
32106
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
32107
- .replace(/'/g, "\\'")
32108
- .replace(/\\"/g, '"') + '\'';
32109
- return ctx.stylize(simple, 'string');
31960
+ var regex = /\s*function\s+([^\(\s]*)\s*/;
31961
+ // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
31962
+ function getName(func) {
31963
+ if (!isFunction(func)) {
31964
+ return;
32110
31965
  }
32111
- if (isNumber(value))
32112
- return ctx.stylize('' + value, 'number');
32113
- if (isBoolean(value))
32114
- return ctx.stylize('' + value, 'boolean');
32115
- // For some reason typeof null is "object", so special case here.
32116
- if (isNull(value))
32117
- return ctx.stylize('null', 'null');
32118
- }
32119
-
32120
-
32121
- function formatError(value) {
32122
- return '[' + Error.prototype.toString.call(value) + ']';
31966
+ if (functionsHaveNames()) {
31967
+ return func.name;
31968
+ }
31969
+ var str = func.toString();
31970
+ var match = str.match(regex);
31971
+ return match && match[1];
32123
31972
  }
31973
+ assert.AssertionError = AssertionError;
31974
+ function AssertionError(options) {
31975
+ this.name = 'AssertionError';
31976
+ this.actual = options.actual;
31977
+ this.expected = options.expected;
31978
+ this.operator = options.operator;
31979
+ if (options.message) {
31980
+ this.message = options.message;
31981
+ this.generatedMessage = false;
31982
+ } else {
31983
+ this.message = getMessage(this);
31984
+ this.generatedMessage = true;
31985
+ }
31986
+ var stackStartFunction = options.stackStartFunction || fail;
31987
+ if (Error.captureStackTrace) {
31988
+ Error.captureStackTrace(this, stackStartFunction);
31989
+ } else {
31990
+ // non v8 browsers so we can have a stacktrace
31991
+ var err = new Error();
31992
+ if (err.stack) {
31993
+ var out = err.stack;
32124
31994
 
31995
+ // try to strip useless frames
31996
+ var fn_name = getName(stackStartFunction);
31997
+ var idx = out.indexOf('\n' + fn_name);
31998
+ if (idx >= 0) {
31999
+ // once we have located the function frame
32000
+ // we need to strip out everything before it (and its line)
32001
+ var next_line = out.indexOf('\n', idx + 1);
32002
+ out = out.substring(next_line + 1);
32003
+ }
32125
32004
 
32126
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
32127
- var output = [];
32128
- for (var i = 0, l = value.length; i < l; ++i) {
32129
- if (hasOwnProperty(value, String(i))) {
32130
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
32131
- String(i), true));
32132
- } else {
32133
- output.push('');
32005
+ this.stack = out;
32134
32006
  }
32135
32007
  }
32136
- keys.forEach(function(key) {
32137
- if (!key.match(/^\d+$/)) {
32138
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
32139
- key, true));
32140
- }
32141
- });
32142
- return output;
32143
32008
  }
32144
32009
 
32010
+ // assert.AssertionError instanceof Error
32011
+ inherits(AssertionError, Error);
32145
32012
 
32146
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
32147
- var name, str, desc;
32148
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
32149
- if (desc.get) {
32150
- if (desc.set) {
32151
- str = ctx.stylize('[Getter/Setter]', 'special');
32152
- } else {
32153
- str = ctx.stylize('[Getter]', 'special');
32154
- }
32013
+ function truncate(s, n) {
32014
+ if (typeof s === 'string') {
32015
+ return s.length < n ? s : s.slice(0, n);
32155
32016
  } else {
32156
- if (desc.set) {
32157
- str = ctx.stylize('[Setter]', 'special');
32158
- }
32159
- }
32160
- if (!hasOwnProperty(visibleKeys, key)) {
32161
- name = '[' + key + ']';
32162
- }
32163
- if (!str) {
32164
- if (ctx.seen.indexOf(desc.value) < 0) {
32165
- if (isNull(recurseTimes)) {
32166
- str = formatValue(ctx, desc.value, null);
32167
- } else {
32168
- str = formatValue(ctx, desc.value, recurseTimes - 1);
32169
- }
32170
- if (str.indexOf('\n') > -1) {
32171
- if (array) {
32172
- str = str.split('\n').map(function(line) {
32173
- return ' ' + line;
32174
- }).join('\n').substr(2);
32175
- } else {
32176
- str = '\n' + str.split('\n').map(function(line) {
32177
- return ' ' + line;
32178
- }).join('\n');
32179
- }
32180
- }
32181
- } else {
32182
- str = ctx.stylize('[Circular]', 'special');
32183
- }
32017
+ return s;
32184
32018
  }
32185
- if (isUndefined(name)) {
32186
- if (array && key.match(/^\d+$/)) {
32187
- return str;
32188
- }
32189
- name = JSON.stringify('' + key);
32190
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
32191
- name = name.substr(1, name.length - 2);
32192
- name = ctx.stylize(name, 'name');
32193
- } else {
32194
- name = name.replace(/'/g, "\\'")
32195
- .replace(/\\"/g, '"')
32196
- .replace(/(^"|"$)/g, "'");
32197
- name = ctx.stylize(name, 'string');
32198
- }
32019
+ }
32020
+ function inspect(something) {
32021
+ if (functionsHaveNames() || !isFunction(something)) {
32022
+ return inspect$1(something);
32199
32023
  }
32200
-
32201
- return name + ': ' + str;
32024
+ var rawname = getName(something);
32025
+ var name = rawname ? ': ' + rawname : '';
32026
+ return '[Function' + name + ']';
32027
+ }
32028
+ function getMessage(self) {
32029
+ return truncate(inspect(self.actual), 128) + ' ' +
32030
+ self.operator + ' ' +
32031
+ truncate(inspect(self.expected), 128);
32202
32032
  }
32203
32033
 
32034
+ // At present only the three keys mentioned above are used and
32035
+ // understood by the spec. Implementations or sub modules can pass
32036
+ // other keys to the AssertionError's constructor - they will be
32037
+ // ignored.
32204
32038
 
32205
- function reduceToSingleString(output, base, braces) {
32206
- var length = output.reduce(function(prev, cur) {
32207
- if (cur.indexOf('\n') >= 0) ;
32208
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
32209
- }, 0);
32210
-
32211
- if (length > 60) {
32212
- return braces[0] +
32213
- (base === '' ? '' : base + '\n ') +
32214
- ' ' +
32215
- output.join(',\n ') +
32216
- ' ' +
32217
- braces[1];
32218
- }
32039
+ // 3. All of the following functions must throw an AssertionError
32040
+ // when a corresponding condition is not met, with a message that
32041
+ // may be undefined if not provided. All assertion methods provide
32042
+ // both the actual and expected values to the assertion error for
32043
+ // display purposes.
32219
32044
 
32220
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
32045
+ function fail(actual, expected, message, operator, stackStartFunction) {
32046
+ throw new AssertionError({
32047
+ message: message,
32048
+ actual: actual,
32049
+ expected: expected,
32050
+ operator: operator,
32051
+ stackStartFunction: stackStartFunction
32052
+ });
32221
32053
  }
32222
32054
 
32055
+ // EXTENSION! allows for well behaved errors defined elsewhere.
32056
+ assert.fail = fail;
32223
32057
 
32224
- // NOTE: These type checking functions intentionally don't use `instanceof`
32225
- // because it is fragile and can be easily faked with `Object.create()`.
32226
- function isArray(ar) {
32227
- return Array.isArray(ar);
32228
- }
32229
-
32230
- function isBoolean(arg) {
32231
- return typeof arg === 'boolean';
32232
- }
32058
+ // 4. Pure assertion tests whether a value is truthy, as determined
32059
+ // by !!guard.
32060
+ // assert.ok(guard, message_opt);
32061
+ // This statement is equivalent to assert.equal(true, !!guard,
32062
+ // message_opt);. To test strictly for the value true, use
32063
+ // assert.strictEqual(true, guard, message_opt);.
32233
32064
 
32234
- function isNull(arg) {
32235
- return arg === null;
32065
+ function ok(value, message) {
32066
+ if (!value) fail(value, true, message, '==', ok);
32236
32067
  }
32068
+ assert.ok = ok;
32237
32069
 
32238
- function isNumber(arg) {
32239
- return typeof arg === 'number';
32070
+ // 5. The equality assertion tests shallow, coercive equality with
32071
+ // ==.
32072
+ // assert.equal(actual, expected, message_opt);
32073
+ assert.equal = equal;
32074
+ function equal(actual, expected, message) {
32075
+ if (actual != expected) fail(actual, expected, message, '==', equal);
32240
32076
  }
32241
32077
 
32242
- function isString(arg) {
32243
- return typeof arg === 'string';
32078
+ // 6. The non-equality assertion tests for whether two objects are not equal
32079
+ // with != assert.notEqual(actual, expected, message_opt);
32080
+ assert.notEqual = notEqual;
32081
+ function notEqual(actual, expected, message) {
32082
+ if (actual == expected) {
32083
+ fail(actual, expected, message, '!=', notEqual);
32084
+ }
32244
32085
  }
32245
32086
 
32246
- function isUndefined(arg) {
32247
- return arg === undefined;
32087
+ // 7. The equivalence assertion tests a deep equality relation.
32088
+ // assert.deepEqual(actual, expected, message_opt);
32089
+ assert.deepEqual = deepEqual;
32090
+ function deepEqual(actual, expected, message) {
32091
+ if (!_deepEqual(actual, expected, false)) {
32092
+ fail(actual, expected, message, 'deepEqual', deepEqual);
32093
+ }
32248
32094
  }
32249
-
32250
- function isRegExp(re) {
32251
- return isObject(re) && objectToString(re) === '[object RegExp]';
32095
+ assert.deepStrictEqual = deepStrictEqual;
32096
+ function deepStrictEqual(actual, expected, message) {
32097
+ if (!_deepEqual(actual, expected, true)) {
32098
+ fail(actual, expected, message, 'deepStrictEqual', deepStrictEqual);
32099
+ }
32252
32100
  }
32253
32101
 
32254
- function isObject(arg) {
32255
- return typeof arg === 'object' && arg !== null;
32256
- }
32102
+ function _deepEqual(actual, expected, strict, memos) {
32103
+ // 7.1. All identical values are equivalent, as determined by ===.
32104
+ if (actual === expected) {
32105
+ return true;
32106
+ } else if (isBuffer(actual) && isBuffer(expected)) {
32107
+ return compare(actual, expected) === 0;
32257
32108
 
32258
- function isDate(d) {
32259
- return isObject(d) && objectToString(d) === '[object Date]';
32260
- }
32109
+ // 7.2. If the expected value is a Date object, the actual value is
32110
+ // equivalent if it is also a Date object that refers to the same time.
32111
+ } else if (isDate(actual) && isDate(expected)) {
32112
+ return actual.getTime() === expected.getTime();
32261
32113
 
32262
- function isError(e) {
32263
- return isObject(e) &&
32264
- (objectToString(e) === '[object Error]' || e instanceof Error);
32265
- }
32114
+ // 7.3 If the expected value is a RegExp object, the actual value is
32115
+ // equivalent if it is also a RegExp object with the same source and
32116
+ // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
32117
+ } else if (isRegExp(actual) && isRegExp(expected)) {
32118
+ return actual.source === expected.source &&
32119
+ actual.global === expected.global &&
32120
+ actual.multiline === expected.multiline &&
32121
+ actual.lastIndex === expected.lastIndex &&
32122
+ actual.ignoreCase === expected.ignoreCase;
32266
32123
 
32267
- function isFunction(arg) {
32268
- return typeof arg === 'function';
32269
- }
32124
+ // 7.4. Other pairs that do not both pass typeof value == 'object',
32125
+ // equivalence is determined by ==.
32126
+ } else if ((actual === null || typeof actual !== 'object') &&
32127
+ (expected === null || typeof expected !== 'object')) {
32128
+ return strict ? actual === expected : actual == expected;
32270
32129
 
32271
- function isPrimitive(arg) {
32272
- return arg === null ||
32273
- typeof arg === 'boolean' ||
32274
- typeof arg === 'number' ||
32275
- typeof arg === 'string' ||
32276
- typeof arg === 'symbol' || // ES6 symbol
32277
- typeof arg === 'undefined';
32278
- }
32130
+ // If both values are instances of typed arrays, wrap their underlying
32131
+ // ArrayBuffers in a Buffer each to increase performance
32132
+ // This optimization requires the arrays to have the same type as checked by
32133
+ // Object.prototype.toString (aka pToString). Never perform binary
32134
+ // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
32135
+ // bit patterns are not identical.
32136
+ } else if (isView(actual) && isView(expected) &&
32137
+ pToString(actual) === pToString(expected) &&
32138
+ !(actual instanceof Float32Array ||
32139
+ actual instanceof Float64Array)) {
32140
+ return compare(new Uint8Array(actual.buffer),
32141
+ new Uint8Array(expected.buffer)) === 0;
32279
32142
 
32280
- function objectToString(o) {
32281
- return Object.prototype.toString.call(o);
32282
- }
32143
+ // 7.5 For all other Object pairs, including Array objects, equivalence is
32144
+ // determined by having the same number of owned properties (as verified
32145
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
32146
+ // (although not necessarily the same order), equivalent values for every
32147
+ // corresponding key, and an identical 'prototype' property. Note: this
32148
+ // accounts for both named and indexed properties on Arrays.
32149
+ } else if (isBuffer(actual) !== isBuffer(expected)) {
32150
+ return false;
32151
+ } else {
32152
+ memos = memos || {actual: [], expected: []};
32283
32153
 
32284
- function _extend(origin, add) {
32285
- // Don't do anything if add isn't an object
32286
- if (!add || !isObject(add)) return origin;
32154
+ var actualIndex = memos.actual.indexOf(actual);
32155
+ if (actualIndex !== -1) {
32156
+ if (actualIndex === memos.expected.indexOf(expected)) {
32157
+ return true;
32158
+ }
32159
+ }
32287
32160
 
32288
- var keys = Object.keys(add);
32289
- var i = keys.length;
32290
- while (i--) {
32291
- origin[keys[i]] = add[keys[i]];
32161
+ memos.actual.push(actual);
32162
+ memos.expected.push(expected);
32163
+
32164
+ return objEquiv(actual, expected, strict, memos);
32292
32165
  }
32293
- return origin;
32294
32166
  }
32295
- function hasOwnProperty(obj, prop) {
32296
- return Object.prototype.hasOwnProperty.call(obj, prop);
32167
+
32168
+ function isArguments(object) {
32169
+ return Object.prototype.toString.call(object) == '[object Arguments]';
32297
32170
  }
32298
32171
 
32299
- function compare(a, b) {
32300
- if (a === b) {
32301
- return 0;
32172
+ function objEquiv(a, b, strict, actualVisitedObjects) {
32173
+ if (a === null || a === undefined || b === null || b === undefined)
32174
+ return false;
32175
+ // if one is a primitive, the other must be same
32176
+ if (isPrimitive(a) || isPrimitive(b))
32177
+ return a === b;
32178
+ if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
32179
+ return false;
32180
+ var aIsArgs = isArguments(a);
32181
+ var bIsArgs = isArguments(b);
32182
+ if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
32183
+ return false;
32184
+ if (aIsArgs) {
32185
+ a = pSlice.call(a);
32186
+ b = pSlice.call(b);
32187
+ return _deepEqual(a, b, strict);
32302
32188
  }
32303
-
32304
- var x = a.length;
32305
- var y = b.length;
32306
-
32307
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
32308
- if (a[i] !== b[i]) {
32309
- x = a[i];
32310
- y = b[i];
32311
- break;
32312
- }
32189
+ var ka = objectKeys(a);
32190
+ var kb = objectKeys(b);
32191
+ var key, i;
32192
+ // having the same number of owned properties (keys incorporates
32193
+ // hasOwnProperty)
32194
+ if (ka.length !== kb.length)
32195
+ return false;
32196
+ //the same set of keys (although not necessarily the same order),
32197
+ ka.sort();
32198
+ kb.sort();
32199
+ //~~~cheap key test
32200
+ for (i = ka.length - 1; i >= 0; i--) {
32201
+ if (ka[i] !== kb[i])
32202
+ return false;
32313
32203
  }
32314
-
32315
- if (x < y) {
32316
- return -1;
32204
+ //equivalent values for every corresponding key, and
32205
+ //~~~possibly expensive deep test
32206
+ for (i = ka.length - 1; i >= 0; i--) {
32207
+ key = ka[i];
32208
+ if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
32209
+ return false;
32317
32210
  }
32318
- if (y < x) {
32319
- return 1;
32211
+ return true;
32212
+ }
32213
+
32214
+ // 8. The non-equivalence assertion tests for any deep inequality.
32215
+ // assert.notDeepEqual(actual, expected, message_opt);
32216
+ assert.notDeepEqual = notDeepEqual;
32217
+ function notDeepEqual(actual, expected, message) {
32218
+ if (_deepEqual(actual, expected, false)) {
32219
+ fail(actual, expected, message, 'notDeepEqual', notDeepEqual);
32320
32220
  }
32321
- return 0;
32322
32221
  }
32323
- var hasOwn = Object.prototype.hasOwnProperty;
32324
32222
 
32325
- var objectKeys = Object.keys || function (obj) {
32326
- var keys = [];
32327
- for (var key in obj) {
32328
- if (hasOwn.call(obj, key)) keys.push(key);
32223
+ assert.notDeepStrictEqual = notDeepStrictEqual;
32224
+ function notDeepStrictEqual(actual, expected, message) {
32225
+ if (_deepEqual(actual, expected, true)) {
32226
+ fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
32329
32227
  }
32330
- return keys;
32331
- };
32332
- var pSlice = Array.prototype.slice;
32333
- var _functionsHaveNames;
32334
- function functionsHaveNames() {
32335
- if (typeof _functionsHaveNames !== 'undefined') {
32336
- return _functionsHaveNames;
32228
+ }
32229
+
32230
+
32231
+ // 9. The strict equality assertion tests strict equality, as determined by ===.
32232
+ // assert.strictEqual(actual, expected, message_opt);
32233
+ assert.strictEqual = strictEqual;
32234
+ function strictEqual(actual, expected, message) {
32235
+ if (actual !== expected) {
32236
+ fail(actual, expected, message, '===', strictEqual);
32337
32237
  }
32338
- return _functionsHaveNames = (function () {
32339
- return function foo() {}.name === 'foo';
32340
- }());
32341
32238
  }
32342
- function pToString (obj) {
32343
- return Object.prototype.toString.call(obj);
32239
+
32240
+ // 10. The strict non-equality assertion tests for strict inequality, as
32241
+ // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
32242
+ assert.notStrictEqual = notStrictEqual;
32243
+ function notStrictEqual(actual, expected, message) {
32244
+ if (actual === expected) {
32245
+ fail(actual, expected, message, '!==', notStrictEqual);
32246
+ }
32344
32247
  }
32345
- function isView(arrbuf) {
32346
- if (isBuffer(arrbuf)) {
32248
+
32249
+ function expectedException(actual, expected) {
32250
+ if (!actual || !expected) {
32347
32251
  return false;
32348
32252
  }
32349
- if (typeof global$1.ArrayBuffer !== 'function') {
32350
- return false;
32253
+
32254
+ if (Object.prototype.toString.call(expected) == '[object RegExp]') {
32255
+ return expected.test(actual);
32351
32256
  }
32352
- if (typeof ArrayBuffer.isView === 'function') {
32353
- return ArrayBuffer.isView(arrbuf);
32257
+
32258
+ try {
32259
+ if (actual instanceof expected) {
32260
+ return true;
32261
+ }
32262
+ } catch (e) {
32263
+ // Ignore. The instanceof check doesn't work for arrow functions.
32354
32264
  }
32355
- if (!arrbuf) {
32265
+
32266
+ if (Error.isPrototypeOf(expected)) {
32356
32267
  return false;
32357
32268
  }
32358
- if (arrbuf instanceof DataView) {
32359
- return true;
32360
- }
32361
- if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
32362
- return true;
32363
- }
32364
- return false;
32269
+
32270
+ return expected.call({}, actual) === true;
32365
32271
  }
32366
- // 1. The assert module provides functions that throw
32367
- // AssertionError's when particular conditions are not met. The
32368
- // assert module must conform to the following interface.
32369
32272
 
32370
- function assert(value, message) {
32371
- if (!value) fail(value, true, message, '==', ok);
32273
+ function _tryBlock(block) {
32274
+ var error;
32275
+ try {
32276
+ block();
32277
+ } catch (e) {
32278
+ error = e;
32279
+ }
32280
+ return error;
32372
32281
  }
32373
32282
 
32374
- // 2. The AssertionError is defined in assert.
32375
- // new assert.AssertionError({ message: message,
32376
- // actual: actual,
32377
- // expected: expected })
32283
+ function _throws(shouldThrow, block, expected, message) {
32284
+ var actual;
32378
32285
 
32379
- var regex = /\s*function\s+([^\(\s]*)\s*/;
32380
- // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
32381
- function getName(func) {
32382
- if (!isFunction(func)) {
32383
- return;
32286
+ if (typeof block !== 'function') {
32287
+ throw new TypeError('"block" argument must be a function');
32384
32288
  }
32385
- if (functionsHaveNames()) {
32386
- return func.name;
32289
+
32290
+ if (typeof expected === 'string') {
32291
+ message = expected;
32292
+ expected = null;
32387
32293
  }
32388
- var str = func.toString();
32389
- var match = str.match(regex);
32390
- return match && match[1];
32391
- }
32392
- assert.AssertionError = AssertionError;
32393
- function AssertionError(options) {
32394
- this.name = 'AssertionError';
32395
- this.actual = options.actual;
32396
- this.expected = options.expected;
32397
- this.operator = options.operator;
32398
- if (options.message) {
32399
- this.message = options.message;
32400
- this.generatedMessage = false;
32401
- } else {
32402
- this.message = getMessage(this);
32403
- this.generatedMessage = true;
32404
- }
32405
- var stackStartFunction = options.stackStartFunction || fail;
32406
- if (Error.captureStackTrace) {
32407
- Error.captureStackTrace(this, stackStartFunction);
32408
- } else {
32409
- // non v8 browsers so we can have a stacktrace
32410
- var err = new Error();
32411
- if (err.stack) {
32412
- var out = err.stack;
32413
-
32414
- // try to strip useless frames
32415
- var fn_name = getName(stackStartFunction);
32416
- var idx = out.indexOf('\n' + fn_name);
32417
- if (idx >= 0) {
32418
- // once we have located the function frame
32419
- // we need to strip out everything before it (and its line)
32420
- var next_line = out.indexOf('\n', idx + 1);
32421
- out = out.substring(next_line + 1);
32422
- }
32423
32294
 
32424
- this.stack = out;
32425
- }
32426
- }
32427
- }
32295
+ actual = _tryBlock(block);
32428
32296
 
32429
- // assert.AssertionError instanceof Error
32430
- inherits(AssertionError, Error);
32297
+ message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
32298
+ (message ? ' ' + message : '.');
32431
32299
 
32432
- function truncate(s, n) {
32433
- if (typeof s === 'string') {
32434
- return s.length < n ? s : s.slice(0, n);
32435
- } else {
32436
- return s;
32437
- }
32438
- }
32439
- function inspect(something) {
32440
- if (functionsHaveNames() || !isFunction(something)) {
32441
- return inspect$1(something);
32300
+ if (shouldThrow && !actual) {
32301
+ fail(actual, expected, 'Missing expected exception' + message);
32442
32302
  }
32443
- var rawname = getName(something);
32444
- var name = rawname ? ': ' + rawname : '';
32445
- return '[Function' + name + ']';
32446
- }
32447
- function getMessage(self) {
32448
- return truncate(inspect(self.actual), 128) + ' ' +
32449
- self.operator + ' ' +
32450
- truncate(inspect(self.expected), 128);
32451
- }
32452
32303
 
32453
- // At present only the three keys mentioned above are used and
32454
- // understood by the spec. Implementations or sub modules can pass
32455
- // other keys to the AssertionError's constructor - they will be
32456
- // ignored.
32457
-
32458
- // 3. All of the following functions must throw an AssertionError
32459
- // when a corresponding condition is not met, with a message that
32460
- // may be undefined if not provided. All assertion methods provide
32461
- // both the actual and expected values to the assertion error for
32462
- // display purposes.
32463
-
32464
- function fail(actual, expected, message, operator, stackStartFunction) {
32465
- throw new AssertionError({
32466
- message: message,
32467
- actual: actual,
32468
- expected: expected,
32469
- operator: operator,
32470
- stackStartFunction: stackStartFunction
32471
- });
32472
- }
32473
-
32474
- // EXTENSION! allows for well behaved errors defined elsewhere.
32475
- assert.fail = fail;
32476
-
32477
- // 4. Pure assertion tests whether a value is truthy, as determined
32478
- // by !!guard.
32479
- // assert.ok(guard, message_opt);
32480
- // This statement is equivalent to assert.equal(true, !!guard,
32481
- // message_opt);. To test strictly for the value true, use
32482
- // assert.strictEqual(true, guard, message_opt);.
32483
-
32484
- function ok(value, message) {
32485
- if (!value) fail(value, true, message, '==', ok);
32486
- }
32487
- assert.ok = ok;
32488
-
32489
- // 5. The equality assertion tests shallow, coercive equality with
32490
- // ==.
32491
- // assert.equal(actual, expected, message_opt);
32492
- assert.equal = equal;
32493
- function equal(actual, expected, message) {
32494
- if (actual != expected) fail(actual, expected, message, '==', equal);
32495
- }
32304
+ var userProvidedMessage = typeof message === 'string';
32305
+ var isUnwantedException = !shouldThrow && isError(actual);
32306
+ var isUnexpectedException = !shouldThrow && actual && !expected;
32496
32307
 
32497
- // 6. The non-equality assertion tests for whether two objects are not equal
32498
- // with != assert.notEqual(actual, expected, message_opt);
32499
- assert.notEqual = notEqual;
32500
- function notEqual(actual, expected, message) {
32501
- if (actual == expected) {
32502
- fail(actual, expected, message, '!=', notEqual);
32308
+ if ((isUnwantedException &&
32309
+ userProvidedMessage &&
32310
+ expectedException(actual, expected)) ||
32311
+ isUnexpectedException) {
32312
+ fail(actual, expected, 'Got unwanted exception' + message);
32503
32313
  }
32504
- }
32505
32314
 
32506
- // 7. The equivalence assertion tests a deep equality relation.
32507
- // assert.deepEqual(actual, expected, message_opt);
32508
- assert.deepEqual = deepEqual;
32509
- function deepEqual(actual, expected, message) {
32510
- if (!_deepEqual(actual, expected, false)) {
32511
- fail(actual, expected, message, 'deepEqual', deepEqual);
32512
- }
32513
- }
32514
- assert.deepStrictEqual = deepStrictEqual;
32515
- function deepStrictEqual(actual, expected, message) {
32516
- if (!_deepEqual(actual, expected, true)) {
32517
- fail(actual, expected, message, 'deepStrictEqual', deepStrictEqual);
32315
+ if ((shouldThrow && actual && expected &&
32316
+ !expectedException(actual, expected)) || (!shouldThrow && actual)) {
32317
+ throw actual;
32518
32318
  }
32519
32319
  }
32520
32320
 
32521
- function _deepEqual(actual, expected, strict, memos) {
32522
- // 7.1. All identical values are equivalent, as determined by ===.
32523
- if (actual === expected) {
32524
- return true;
32525
- } else if (isBuffer(actual) && isBuffer(expected)) {
32526
- return compare(actual, expected) === 0;
32527
-
32528
- // 7.2. If the expected value is a Date object, the actual value is
32529
- // equivalent if it is also a Date object that refers to the same time.
32530
- } else if (isDate(actual) && isDate(expected)) {
32531
- return actual.getTime() === expected.getTime();
32532
-
32533
- // 7.3 If the expected value is a RegExp object, the actual value is
32534
- // equivalent if it is also a RegExp object with the same source and
32535
- // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
32536
- } else if (isRegExp(actual) && isRegExp(expected)) {
32537
- return actual.source === expected.source &&
32538
- actual.global === expected.global &&
32539
- actual.multiline === expected.multiline &&
32540
- actual.lastIndex === expected.lastIndex &&
32541
- actual.ignoreCase === expected.ignoreCase;
32542
-
32543
- // 7.4. Other pairs that do not both pass typeof value == 'object',
32544
- // equivalence is determined by ==.
32545
- } else if ((actual === null || typeof actual !== 'object') &&
32546
- (expected === null || typeof expected !== 'object')) {
32547
- return strict ? actual === expected : actual == expected;
32548
-
32549
- // If both values are instances of typed arrays, wrap their underlying
32550
- // ArrayBuffers in a Buffer each to increase performance
32551
- // This optimization requires the arrays to have the same type as checked by
32552
- // Object.prototype.toString (aka pToString). Never perform binary
32553
- // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
32554
- // bit patterns are not identical.
32555
- } else if (isView(actual) && isView(expected) &&
32556
- pToString(actual) === pToString(expected) &&
32557
- !(actual instanceof Float32Array ||
32558
- actual instanceof Float64Array)) {
32559
- return compare(new Uint8Array(actual.buffer),
32560
- new Uint8Array(expected.buffer)) === 0;
32561
-
32562
- // 7.5 For all other Object pairs, including Array objects, equivalence is
32563
- // determined by having the same number of owned properties (as verified
32564
- // with Object.prototype.hasOwnProperty.call), the same set of keys
32565
- // (although not necessarily the same order), equivalent values for every
32566
- // corresponding key, and an identical 'prototype' property. Note: this
32567
- // accounts for both named and indexed properties on Arrays.
32568
- } else if (isBuffer(actual) !== isBuffer(expected)) {
32569
- return false;
32570
- } else {
32571
- memos = memos || {actual: [], expected: []};
32572
-
32573
- var actualIndex = memos.actual.indexOf(actual);
32574
- if (actualIndex !== -1) {
32575
- if (actualIndex === memos.expected.indexOf(expected)) {
32576
- return true;
32577
- }
32578
- }
32579
-
32580
- memos.actual.push(actual);
32581
- memos.expected.push(expected);
32582
-
32583
- return objEquiv(actual, expected, strict, memos);
32584
- }
32321
+ // 11. Expected to throw an error:
32322
+ // assert.throws(block, Error_opt, message_opt);
32323
+ assert.throws = throws;
32324
+ function throws(block, /*optional*/error, /*optional*/message) {
32325
+ _throws(true, block, error, message);
32585
32326
  }
32586
32327
 
32587
- function isArguments(object) {
32588
- return Object.prototype.toString.call(object) == '[object Arguments]';
32328
+ // EXTENSION! This is annoying to write outside this module.
32329
+ assert.doesNotThrow = doesNotThrow;
32330
+ function doesNotThrow(block, /*optional*/error, /*optional*/message) {
32331
+ _throws(false, block, error, message);
32589
32332
  }
32590
32333
 
32591
- function objEquiv(a, b, strict, actualVisitedObjects) {
32592
- if (a === null || a === undefined || b === null || b === undefined)
32593
- return false;
32594
- // if one is a primitive, the other must be same
32595
- if (isPrimitive(a) || isPrimitive(b))
32596
- return a === b;
32597
- if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
32598
- return false;
32599
- var aIsArgs = isArguments(a);
32600
- var bIsArgs = isArguments(b);
32601
- if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
32602
- return false;
32603
- if (aIsArgs) {
32604
- a = pSlice.call(a);
32605
- b = pSlice.call(b);
32606
- return _deepEqual(a, b, strict);
32607
- }
32608
- var ka = objectKeys(a);
32609
- var kb = objectKeys(b);
32610
- var key, i;
32611
- // having the same number of owned properties (keys incorporates
32612
- // hasOwnProperty)
32613
- if (ka.length !== kb.length)
32614
- return false;
32615
- //the same set of keys (although not necessarily the same order),
32616
- ka.sort();
32617
- kb.sort();
32618
- //~~~cheap key test
32619
- for (i = ka.length - 1; i >= 0; i--) {
32620
- if (ka[i] !== kb[i])
32621
- return false;
32622
- }
32623
- //equivalent values for every corresponding key, and
32624
- //~~~possibly expensive deep test
32625
- for (i = ka.length - 1; i >= 0; i--) {
32626
- key = ka[i];
32627
- if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
32628
- return false;
32629
- }
32630
- return true;
32334
+ assert.ifError = ifError;
32335
+ function ifError(err) {
32336
+ if (err) throw err;
32631
32337
  }
32632
32338
 
32633
- // 8. The non-equivalence assertion tests for any deep inequality.
32634
- // assert.notDeepEqual(actual, expected, message_opt);
32635
- assert.notDeepEqual = notDeepEqual;
32636
- function notDeepEqual(actual, expected, message) {
32637
- if (_deepEqual(actual, expected, false)) {
32638
- fail(actual, expected, message, 'notDeepEqual', notDeepEqual);
32639
- }
32640
- }
32641
-
32642
- assert.notDeepStrictEqual = notDeepStrictEqual;
32643
- function notDeepStrictEqual(actual, expected, message) {
32644
- if (_deepEqual(actual, expected, true)) {
32645
- fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
32646
- }
32647
- }
32648
-
32649
-
32650
- // 9. The strict equality assertion tests strict equality, as determined by ===.
32651
- // assert.strictEqual(actual, expected, message_opt);
32652
- assert.strictEqual = strictEqual;
32653
- function strictEqual(actual, expected, message) {
32654
- if (actual !== expected) {
32655
- fail(actual, expected, message, '===', strictEqual);
32656
- }
32657
- }
32658
-
32659
- // 10. The strict non-equality assertion tests for strict inequality, as
32660
- // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
32661
- assert.notStrictEqual = notStrictEqual;
32662
- function notStrictEqual(actual, expected, message) {
32663
- if (actual === expected) {
32664
- fail(actual, expected, message, '!==', notStrictEqual);
32665
- }
32666
- }
32667
-
32668
- function expectedException(actual, expected) {
32669
- if (!actual || !expected) {
32670
- return false;
32671
- }
32672
-
32673
- if (Object.prototype.toString.call(expected) == '[object RegExp]') {
32674
- return expected.test(actual);
32675
- }
32676
-
32677
- try {
32678
- if (actual instanceof expected) {
32679
- return true;
32339
+ const VERSION$6 = '0.0.1';
32340
+ // const T = 'plugins.audio_selector';
32341
+ const AUTO = 0;
32342
+ /**
32343
+ * Adds an audio track selector to the media control UI.
32344
+ * @beta
32345
+ */
32346
+ class AudioSelector extends UICorePlugin {
32347
+ // TODO
32348
+ selectedTrackId;
32349
+ currentTrack = null;
32350
+ tracks = [];
32351
+ /**
32352
+ * @internal
32353
+ */
32354
+ get name() {
32355
+ return 'audio_selector';
32356
+ }
32357
+ /**
32358
+ * @internal
32359
+ */
32360
+ get supportedVersion() {
32361
+ return { min: CLAPPR_VERSION };
32362
+ }
32363
+ /**
32364
+ * @internal
32365
+ */
32366
+ static get version() {
32367
+ return VERSION$6;
32368
+ }
32369
+ static template = tmpl(pluginHtml$8);
32370
+ /**
32371
+ * @internal
32372
+ */
32373
+ get attributes() {
32374
+ return {
32375
+ class: this.name,
32376
+ 'data-track-selector': '',
32377
+ };
32378
+ }
32379
+ /**
32380
+ * @internal
32381
+ */
32382
+ get events() {
32383
+ return {
32384
+ 'click [data-track-selector-select]': 'onTrackSelect',
32385
+ 'click [data-track-selector-button]': 'onShowLevelSelectMenu',
32386
+ };
32387
+ }
32388
+ /**
32389
+ * @internal
32390
+ */
32391
+ bindEvents() {
32392
+ this.listenTo(this.core, Events$1.CORE_READY, this.bindPlaybackEvents);
32393
+ // TODO CORE_ACTIVE_CONTAINER_CHANGED
32394
+ this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.reload);
32395
+ this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.render);
32396
+ this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_HIDE, this.hideSelectTrackMenu);
32397
+ }
32398
+ unBindEvents() {
32399
+ // @ts-ignore
32400
+ this.stopListening(this.core, Events$1.CORE_READY);
32401
+ // @ts-ignore
32402
+ this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED);
32403
+ // @ts-ignore
32404
+ this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED);
32405
+ // @ts-ignore
32406
+ this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_HIDE);
32407
+ }
32408
+ bindPlaybackEvents() {
32409
+ // this.currentTrack = {};
32410
+ // this.removeAuto = false;
32411
+ this.selectedTrackId = undefined;
32412
+ const currentPlayback = this.core.activePlayback;
32413
+ this.listenTo(currentPlayback, Events$1.PLAYBACK_STOP, this.onStop);
32414
+ this.setupAudioTrackListeners();
32415
+ }
32416
+ setupAudioTrackListeners() {
32417
+ const currentPlayback = this.core.activePlayback;
32418
+ // TODO no-crutch:currentPlayback._hls
32419
+ if (currentPlayback._hls) {
32420
+ // TODO AUDIO_TRACKS_UPDATED
32421
+ // currentPlayback._hls.on('hlsAudioTracksUpdated', (e, data) => {
32422
+ currentPlayback._hls.on(Events.AUDIO_TRACKS_UPDATED, (e, data) => {
32423
+ // let id = -1;
32424
+ // for (const audioTrack of data.audioTracks) {
32425
+ // if (audioTrack.default) {
32426
+ // id = audioTrack.id;
32427
+ // this.currentTrack = audioTrack;
32428
+ // }
32429
+ // }
32430
+ const defaultTrack = data.audioTracks.find((track) => track.default);
32431
+ if (defaultTrack) {
32432
+ this.currentTrack = {
32433
+ id: defaultTrack.id,
32434
+ label: defaultTrack.name,
32435
+ };
32436
+ }
32437
+ this.fillTracks(data.audioTracks.map((p) => ({
32438
+ id: p.id,
32439
+ label: p.name,
32440
+ })), defaultTrack?.id);
32441
+ });
32442
+ currentPlayback._hls.on(Events.AUDIO_TRACK_SWITCHING, this.startTrackSwitch.bind(this));
32443
+ currentPlayback._hls.on(Events.AUDIO_TRACK_SWITCHED, this.updateCurrentTrack.bind(this));
32444
+ currentPlayback._hls.on(Events.AUDIO_TRACK_LOADED, this.updateCurrentTrack.bind(this));
32445
+ }
32446
+ else {
32447
+ this.listenToOnce(currentPlayback, Events$1.PLAYBACK_PLAY, () => {
32448
+ const mediaElement = currentPlayback.$el.get(0);
32449
+ // const { audioTracks } = currentPlayback.$el.get(0);
32450
+ const audioTracks = mediaElement.audioTracks;
32451
+ if (audioTracks && audioTracks.length) {
32452
+ let index = 0;
32453
+ const trackItems = [];
32454
+ for (const audioTrack of audioTracks) {
32455
+ if (audioTrack.enabled) {
32456
+ const t = {
32457
+ id: index,
32458
+ label: audioTrack.label,
32459
+ };
32460
+ this.currentTrack = t;
32461
+ trackItems.push(t);
32462
+ index++;
32463
+ }
32464
+ }
32465
+ audioTracks.addEventListener('change', () => this.updateCurrentTrackW3C());
32466
+ this.fillTracks(trackItems, trackItems[0].id);
32467
+ }
32468
+ });
32469
+ }
32470
+ }
32471
+ onStop() { }
32472
+ reload() {
32473
+ this.unBindEvents();
32474
+ this.bindEvents();
32475
+ this.bindPlaybackEvents();
32476
+ }
32477
+ shouldRender() {
32478
+ if (!this.core.activeContainer) {
32479
+ return false;
32480
+ }
32481
+ const currentPlayback = this.core.activePlayback;
32482
+ if (!currentPlayback) {
32483
+ return false;
32484
+ }
32485
+ const { audioTracks } = currentPlayback.activePlayback._hls || currentPlayback.$el.get(0);
32486
+ this.tracks = audioTracks;
32487
+ // Only care if we have at least 2 to choose from
32488
+ return this.tracks && this.tracks.length > 1;
32489
+ }
32490
+ /**
32491
+ * @internal
32492
+ */
32493
+ render() {
32494
+ if (!this.shouldRender()) {
32495
+ return this;
32496
+ }
32497
+ const mediaControl = this.core.getPlugin('media_control');
32498
+ assert(mediaControl, 'media_control plugin is required');
32499
+ this.$el.html(AudioSelector.template({ tracks: this.tracks, title: this.getTitle() }));
32500
+ const ats = mediaControl.getElement('audioTracksSelector');
32501
+ if (!(ats && ats.length > 0)) {
32502
+ return this;
32503
+ }
32504
+ ats.append(this.el);
32505
+ this.highlightCurrentTrack();
32506
+ const aa = ats.find('audioArrow');
32507
+ if (aa.length > 0) {
32508
+ aa.append(audioArrow);
32509
+ }
32510
+ return this;
32511
+ }
32512
+ fillTracks(tracks, selected = AUTO) {
32513
+ if (this.selectedTrackId === undefined) {
32514
+ this.selectedTrackId = selected;
32515
+ }
32516
+ // this.tracks = levels.audioTracks;
32517
+ // for (let i = 0; i < this.tracks.length; i++) {
32518
+ // if (this.tracks[i].name && !this.tracks[i].label) {
32519
+ // this.tracks[i].label = this.tracks[i].name;
32520
+ // }
32521
+ // }
32522
+ this.tracks = tracks;
32523
+ // Player.player.trigger('tracks', this.tracks);
32524
+ // this.core.trigger('tracks', this.tracks);
32525
+ this.render();
32526
+ }
32527
+ findTrackBy(id) {
32528
+ return this.tracks.find((track) => track.id === id);
32529
+ }
32530
+ onTrackSelect(event) {
32531
+ // this.selectedTrackId = parseInt(event.target.dataset.levelSelectorSelect, 10)
32532
+ const id = event.target?.dataset?.trackSelectorSelect;
32533
+ if (id) {
32534
+ this.setIndexTrack(Number(id));
32535
+ }
32536
+ this.toggleContextMenu();
32537
+ event.stopPropagation();
32538
+ return false;
32539
+ }
32540
+ setIndexTrack(index) {
32541
+ this.selectedTrackId = index;
32542
+ if (this.core.activePlayback._hls) {
32543
+ if (this.core.activePlayback._hls.audioTrack.id === this.selectedTrackId) {
32544
+ return;
32545
+ }
32546
+ this.core.activePlayback._hls.audioTrack = this.selectedTrackId;
32547
+ }
32548
+ else {
32549
+ const { audioTracks } = this.core.activePlayback.$el.get(0);
32550
+ for (const track of audioTracks) {
32551
+ track.enabled = track.id === this.selectedTrackId;
32552
+ }
32553
+ }
32554
+ this.updateText(this.selectedTrackId);
32555
+ }
32556
+ onShowLevelSelectMenu() {
32557
+ this.toggleContextMenu();
32558
+ }
32559
+ hideSelectTrackMenu() {
32560
+ this.$('.audio_selector ul').hide();
32561
+ }
32562
+ toggleContextMenu() {
32563
+ this.$('.audio_selector ul').toggle();
32564
+ }
32565
+ buttonElement() {
32566
+ return this.$('.audio_selector button');
32567
+ }
32568
+ buttonElementText() {
32569
+ return this.$('.audio_selector button .audio-text');
32570
+ }
32571
+ trackElement(id) {
32572
+ return this.$('.audio_selector ul a' +
32573
+ (id !== undefined ? '[data-track-selector-select="' + id + '"]' : '')).parent();
32574
+ }
32575
+ getTitle() {
32576
+ if (!this.tracks) {
32577
+ return '';
32578
+ }
32579
+ const selectedTrackId = this.selectedTrackId || 0;
32580
+ const selectedTrack = this.tracks[selectedTrackId];
32581
+ return selectedTrack?.label || '';
32582
+ }
32583
+ startTrackSwitch() {
32584
+ this.buttonElement().addClass('changing');
32585
+ }
32586
+ updateText(trackId) {
32587
+ if (trackId === undefined) {
32588
+ return;
32589
+ }
32590
+ const track = this.findTrackBy(trackId);
32591
+ if (track) {
32592
+ this.buttonElementText().text(track.label);
32593
+ }
32594
+ }
32595
+ updateCurrentTrack(e, info) {
32596
+ // if (!info) {
32597
+ // const { audioTracks } = this.core.activePlayback.$el.get(0);
32598
+ // for (const track of audioTracks) {
32599
+ // if (track.enabled) {
32600
+ // info = track;
32601
+ // }
32602
+ // }
32603
+ // }
32604
+ // if (!info) {
32605
+ // return;
32606
+ // }
32607
+ // const track = this.findTrackBy(info.id);
32608
+ // this.currentTrack = track ? track : null;
32609
+ // this.selectedTrackId = track?.id;
32610
+ // this.highlightCurrentTrack();
32611
+ // this.buttonElement().removeClass('changing');
32612
+ this.setCurrentTrack(info.id);
32613
+ }
32614
+ updateCurrentTrackW3C() {
32615
+ const { audioTracks } = this.core.activePlayback.$el.get(0);
32616
+ const index = audioTracks.findIndex((track) => track.enabled);
32617
+ if (index >= 0) {
32618
+ this.setCurrentTrack(index);
32619
+ }
32620
+ }
32621
+ setCurrentTrack(index) {
32622
+ const track = this.findTrackBy(index);
32623
+ this.currentTrack = track ?? null;
32624
+ this.selectedTrackId = index;
32625
+ this.highlightCurrentTrack();
32626
+ this.buttonElement().removeClass('changing');
32627
+ }
32628
+ highlightCurrentTrack() {
32629
+ this.trackElement().removeClass('current');
32630
+ this.trackElement().find('a').removeClass('gcore-skin-active');
32631
+ if (this.currentTrack) {
32632
+ const currentTrackElement = this.trackElement(this.currentTrack.id);
32633
+ currentTrackElement.addClass('current');
32634
+ currentTrackElement.find('a').addClass('gcore-skin-active');
32635
+ }
32636
+ this.updateText(this.selectedTrackId);
32680
32637
  }
32681
- } catch (e) {
32682
- // Ignore. The instanceof check doesn't work for arrow functions.
32683
- }
32684
-
32685
- if (Error.isPrototypeOf(expected)) {
32686
- return false;
32687
- }
32688
-
32689
- return expected.call({}, actual) === true;
32690
- }
32691
-
32692
- function _tryBlock(block) {
32693
- var error;
32694
- try {
32695
- block();
32696
- } catch (e) {
32697
- error = e;
32698
- }
32699
- return error;
32700
32638
  }
32701
32639
 
32702
- function _throws(shouldThrow, block, expected, message) {
32703
- var actual;
32704
-
32705
- if (typeof block !== 'function') {
32706
- throw new TypeError('"block" argument must be a function');
32707
- }
32708
-
32709
- if (typeof expected === 'string') {
32710
- message = expected;
32711
- expected = null;
32712
- }
32713
-
32714
- actual = _tryBlock(block);
32715
-
32716
- message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
32717
- (message ? ' ' + message : '.');
32718
-
32719
- if (shouldThrow && !actual) {
32720
- fail(actual, expected, 'Missing expected exception' + message);
32721
- }
32722
-
32723
- var userProvidedMessage = typeof message === 'string';
32724
- var isUnwantedException = !shouldThrow && isError(actual);
32725
- var isUnexpectedException = !shouldThrow && actual && !expected;
32726
-
32727
- if ((isUnwantedException &&
32728
- userProvidedMessage &&
32729
- expectedException(actual, expected)) ||
32730
- isUnexpectedException) {
32731
- fail(actual, expected, 'Got unwanted exception' + message);
32732
- }
32733
-
32734
- if ((shouldThrow && actual && expected &&
32735
- !expectedException(actual, expected)) || (!shouldThrow && actual)) {
32736
- throw actual;
32737
- }
32640
+ /**
32641
+ * @public
32642
+ * @param msg
32643
+ * @param data
32644
+ */
32645
+ function trace(msg, data = {}) {
32738
32646
  }
32739
32647
 
32740
- // 11. Expected to throw an error:
32741
- // assert.throws(block, Error_opt, message_opt);
32742
- assert.throws = throws;
32743
- function throws(block, /*optional*/error, /*optional*/message) {
32744
- _throws(true, block, error, message);
32745
- }
32648
+ const volumeOffIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.50025 8.00025C4.67125 8.00025 4.00025 8.67225 4.00025 9.50025V14.5003C4.00025 15.3283 4.67125 16.0003 5.50025 16.0003H7.24824C7.65024 16.0003 8.03627 16.1613 8.31727 16.4483L12.5443 20.7413C12.7083 20.9073 12.9262 20.9963 13.1492 20.9963C13.2572 20.9963 13.3672 20.9763 13.4722 20.9333C13.7932 20.8013 14.0003 20.4923 14.0003 20.1462V16.3283C14.0003 16.1963 13.9473 16.0683 13.8543 15.9753L6.02528 8.14625C5.93228 8.05325 5.80425 8.00025 5.67225 8.00025H5.50025ZM14.0003 3.85426C14.0003 3.50826 13.7932 3.19927 13.4722 3.06727C13.1502 2.93627 12.7873 3.01226 12.5443 3.25926L9.33827 6.51527C9.14627 6.71127 9.14626 7.02625 9.34126 7.22025L13.5733 11.4522C13.7313 11.6102 14.0003 11.4982 14.0003 11.2752V3.85426ZM20.8543 20.8543C20.7563 20.9513 20.6283 21.0003 20.5003 21.0003C20.3723 21.0003 20.2442 20.9513 20.1462 20.8543L3.14625 3.85426C2.95125 3.65826 2.95125 3.34225 3.14625 3.14625C3.34225 2.95125 3.65826 2.95125 3.85426 3.14625L20.8543 20.1462C21.0493 20.3422 21.0493 20.6583 20.8543 20.8543Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
32746
32649
 
32747
- // EXTENSION! This is annoying to write outside this module.
32748
- assert.doesNotThrow = doesNotThrow;
32749
- function doesNotThrow(block, /*optional*/error, /*optional*/message) {
32750
- _throws(false, block, error, message);
32751
- }
32650
+ const pluginHtml$7 = "<div class=\"big-mute-icon-wrapper\" data-big-mute>\n <div class=\"big-mute-icon gcore-skin-border-color\" data-big-mute-icon></div>\n</div>\n";
32752
32651
 
32753
- assert.ifError = ifError;
32754
- function ifError(err) {
32755
- if (err) throw err;
32652
+ const T$9 = 'plugins.big_mute_button';
32653
+ // TODO rewrite as a container plugin
32654
+ /**
32655
+ * Displays a big mute button over the video when it's muted.
32656
+ * Once pressed, it unmutes the video.
32657
+ * @beta
32658
+ */
32659
+ class BigMuteButton extends UICorePlugin {
32660
+ isBigMuteButtonHidden = false;
32661
+ _adIsPlaying = false;
32662
+ $bigMuteBtnContainer = null;
32663
+ $bigMuteButton = null;
32664
+ /**
32665
+ * @internal
32666
+ */
32667
+ get name() {
32668
+ return 'big_mute_button';
32669
+ }
32670
+ /**
32671
+ * @internal
32672
+ */
32673
+ get supportedVersion() {
32674
+ return { min: CLAPPR_VERSION };
32675
+ }
32676
+ static template = tmpl(pluginHtml$7);
32677
+ /**
32678
+ * @internal
32679
+ */
32680
+ get events() {
32681
+ return {
32682
+ 'click .big-mute-icon': 'handleBigMuteBtnClick',
32683
+ 'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
32684
+ };
32685
+ }
32686
+ /**
32687
+ * @internal
32688
+ */
32689
+ bindEvents() {
32690
+ super.bindEvents();
32691
+ this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
32692
+ this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
32693
+ this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
32694
+ trace(`${T$9} bindEvents`, {
32695
+ mediacontrol: !!this.core.mediaControl,
32696
+ });
32697
+ this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mediaControlRendered);
32698
+ }
32699
+ onCoreReady() {
32700
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_VOLUME, this.onContainerVolume);
32701
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_READY, this.onContainerStart);
32702
+ this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_ENDED, this.onPlaybackEnded);
32703
+ }
32704
+ onContainerVolume(value) {
32705
+ if (value !== 0) {
32706
+ this.destroyBigMuteBtn();
32707
+ }
32708
+ }
32709
+ onContainerStart() {
32710
+ if (this.isBigMuteButtonHidden) {
32711
+ this.showBigMuteBtn();
32712
+ }
32713
+ }
32714
+ onPlaybackEnded() {
32715
+ this.hideBigMuteBtn();
32716
+ }
32717
+ mediaControlRendered() {
32718
+ const container = this.core.activeContainer;
32719
+ if (container) {
32720
+ this.listenTo(container.playback, Events$1.PLAYBACK_PLAY, () => {
32721
+ this.render();
32722
+ });
32723
+ }
32724
+ }
32725
+ onStartAd() {
32726
+ this._adIsPlaying = true;
32727
+ if (this.$bigMuteBtnContainer) {
32728
+ this.$bigMuteBtnContainer.addClass('hide');
32729
+ }
32730
+ }
32731
+ onFinishAd() {
32732
+ this._adIsPlaying = false;
32733
+ if (this.$bigMuteBtnContainer) {
32734
+ this.$bigMuteBtnContainer.removeClass('hide');
32735
+ }
32736
+ }
32737
+ shouldRender() {
32738
+ const container = this.core.activeContainer;
32739
+ if (!container) {
32740
+ return false;
32741
+ }
32742
+ const { autoPlay, wasMuted } = this.options;
32743
+ const volume = container.volume;
32744
+ return autoPlay && !wasMuted && volume === 0;
32745
+ }
32746
+ /**
32747
+ * @internal
32748
+ */
32749
+ render() {
32750
+ if (this.shouldRender()) {
32751
+ trace(`${T$9} render`, {
32752
+ el: !!this.$el,
32753
+ });
32754
+ this.$el.html(BigMuteButton.template());
32755
+ this.$bigMuteBtnContainer = this.$el.find('.big-mute-icon-wrapper[data-big-mute]');
32756
+ this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide');
32757
+ this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon');
32758
+ this.$bigMuteButton.append(volumeOffIcon);
32759
+ const container = this.core.activeContainer;
32760
+ container.$el.append(this.$el.get(0));
32761
+ }
32762
+ return this;
32763
+ }
32764
+ hideBigMuteBtn() {
32765
+ this.isBigMuteButtonHidden = true;
32766
+ this.$bigMuteBtnContainer?.addClass('hide');
32767
+ }
32768
+ showBigMuteBtn() {
32769
+ this.isBigMuteButtonHidden = false;
32770
+ if (this.$bigMuteBtnContainer) {
32771
+ this.$bigMuteBtnContainer.removeClass('hide');
32772
+ }
32773
+ }
32774
+ destroyBigMuteBtn(e) {
32775
+ this.hideBigMuteBtn();
32776
+ if (e && e.stopPropagation) {
32777
+ e.stopPropagation();
32778
+ }
32779
+ this.destroy();
32780
+ }
32781
+ handleBigMuteBtnClick(e) {
32782
+ const localVolume = Utils.Config.restore('volume');
32783
+ const volume = !isNaN(localVolume) ? localVolume : 100;
32784
+ // TODO use container.setVolume() instead
32785
+ this.core.mediaControl.setVolume(volume === 0 ? 100 : volume);
32786
+ this.destroyBigMuteBtn(e);
32787
+ }
32756
32788
  }
32757
32789
 
32758
32790
  const pluginHtml$6 = "<div class=\"media-control-gear\" data-<%= name %>>\n <button type=\"button\" class=\"button-gear gplayer-lite-btn gcore-skin-button-color\" data-gear-button=\"-1\">\n <span class=\"gear-icon\"><%= icon %></span>\n </button>\n <div class=\"gear-wrapper gcore-skin-bg-color\">\n <ul class=\"gear-options-list\">\n <% items.forEach(function (gear) { %>\n <li data-<%= gear %>></li>\n <% }); %>\n </ul>\n </div>\n</div>\n";
@@ -32764,6 +32796,7 @@ const gearHdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\
32764
32796
  const VERSION$5 = '2.19.12';
32765
32797
  /**
32766
32798
  * Custom events emitted by the plugin
32799
+ * @beta
32767
32800
  */
32768
32801
  var GearEvents;
32769
32802
  (function (GearEvents) {
@@ -33963,6 +33996,9 @@ function requireMousetrap () {
33963
33996
  var mousetrapExports = requireMousetrap();
33964
33997
  const Mousetrap = /*@__PURE__*/getDefaultExportFromCjs(mousetrapExports);
33965
33998
 
33999
+ /**
34000
+ * @beta
34001
+ */
33966
34002
  var ClapprStatsEvents;
33967
34003
  (function (ClapprStatsEvents) {
33968
34004
  ClapprStatsEvents["REPORT_EVENT"] = "clappr:stats:report";
@@ -35282,7 +35318,10 @@ function newMetrics() {
35282
35318
  // TODO: fix
35283
35319
  const updateMetrics = () => { };
35284
35320
  /**
35321
+ * Collects useful statistics about playback performance.
35285
35322
  * @beta
35323
+ * @remarks
35324
+ * This plugin does not render anything and is supposed to be extended or used together with other plugins that actually render something.
35286
35325
  */
35287
35326
  class ClapprStats extends ContainerPlugin {
35288
35327
  bwMeasureCount = 0;
@@ -35304,9 +35343,15 @@ class ClapprStats extends ContainerPlugin {
35304
35343
  updateFn = updateMetrics;
35305
35344
  urisToMeasureBandwidth;
35306
35345
  uriToMeasureLatency;
35346
+ /**
35347
+ * @internal
35348
+ */
35307
35349
  get name() {
35308
35350
  return 'clappr_stats';
35309
35351
  }
35352
+ /**
35353
+ * @internal
35354
+ */
35310
35355
  get supportedVersion() {
35311
35356
  return { min: CLAPPR_VERSION };
35312
35357
  }
@@ -35334,6 +35379,10 @@ class ClapprStats extends ContainerPlugin {
35334
35379
  // this._metrics.timers[timer] += this._now() - this[`_start${timer}`];
35335
35380
  this.metrics.timers[timer] += this._now() - this.timers[timer];
35336
35381
  }
35382
+ /**
35383
+ * Registers a callback to receive the metrics.
35384
+ * @param updateMetricsFn
35385
+ */
35337
35386
  setUpdateMetrics(updateMetricsFn) {
35338
35387
  this.updateFn = updateMetricsFn;
35339
35388
  }
@@ -35352,6 +35401,9 @@ class ClapprStats extends ContainerPlugin {
35352
35401
  calls: []
35353
35402
  };
35354
35403
  }
35404
+ /**
35405
+ * @internal
35406
+ */
35355
35407
  bindEvents() {
35356
35408
  this.listenTo(this.container, Events$1.CONTAINER_BITRATE, this.onBitrate);
35357
35409
  this.listenTo(this.container, Events$1.CONTAINER_STOP, this.stopReporting);
@@ -35370,10 +35422,17 @@ class ClapprStats extends ContainerPlugin {
35370
35422
  this.listenTo(this.container.playback, Events$1.PLAYBACK_PROGRESS, this.onProgress);
35371
35423
  this.listenTo(this.container.playback, Events$1.PLAYBACK_TIMEUPDATE, this.onTimeUpdate);
35372
35424
  }
35425
+ /**
35426
+ * @internal
35427
+ */
35373
35428
  destroy() {
35374
35429
  this.stopReporting();
35375
35430
  super.destroy();
35376
35431
  }
35432
+ /**
35433
+ * Returns the collected metrics.
35434
+ * @returns The collected metrics
35435
+ */
35377
35436
  exportMetrics() {
35378
35437
  return structuredClone(this.metrics);
35379
35438
  }
@@ -35395,6 +35454,7 @@ class ClapprStats extends ContainerPlugin {
35395
35454
  this.intervalId = null;
35396
35455
  }
35397
35456
  this._newMetrics();
35457
+ // TODO
35398
35458
  // @ts-ignore
35399
35459
  this.stopListening();
35400
35460
  this.bindEvents();
@@ -35612,19 +35672,29 @@ class ClapprStats extends ContainerPlugin {
35612
35672
 
35613
35673
  //Copyright 2014 Globo.com Player authors. All rights reserved.
35614
35674
  // Use of this source code is governed by a BSD-style
35615
- // license that can be found in the LICENSE file.
35675
+ // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE.
35676
+ /**
35677
+ * Adds a behavior of toggling the playback state on click over the container
35678
+ * @beta
35679
+ */
35616
35680
  class ClickToPause extends ContainerPlugin {
35617
35681
  pointerEnabled = false;
35618
35682
  timer = null;
35683
+ /**
35684
+ * @internal
35685
+ */
35619
35686
  get name() {
35620
35687
  return 'click_to_pause_custom';
35621
35688
  }
35689
+ /**
35690
+ * @internal
35691
+ */
35622
35692
  get supportedVersion() {
35623
35693
  return { min: CLAPPR_VERSION };
35624
35694
  }
35625
- get config() {
35626
- return this.container.options.clickToPauseConfig || {};
35627
- }
35695
+ /**
35696
+ * @internal
35697
+ */
35628
35698
  bindEvents() {
35629
35699
  this.listenTo(this.container, Events$1.CONTAINER_CLICK, this.click);
35630
35700
  this.listenTo(this.container, Events$1.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
@@ -35731,23 +35801,45 @@ function getPageX(event) {
35731
35801
  return 0;
35732
35802
  }
35733
35803
 
35804
+ /**
35805
+ * Adds a behavior of showing a text over the seekbar to indicate the current clip.
35806
+ * @beta
35807
+ * @remarks
35808
+ * Depends on:
35809
+ *
35810
+ * - {@link MediaControl}
35811
+ *
35812
+ * Configuration options - {@link ClipsPluginSettings}
35813
+ */
35734
35814
  class ClipsPlugin extends UICorePlugin {
35735
35815
  clips = new Map();
35736
35816
  duration = 0;
35737
35817
  durationGetting = false;
35738
35818
  _oldContainer;
35739
35819
  svgMask = null;
35820
+ /**
35821
+ * @internal
35822
+ */
35740
35823
  get name() {
35741
- return 'media_control_clips';
35824
+ return 'clips';
35742
35825
  }
35826
+ /**
35827
+ * @internal
35828
+ */
35743
35829
  get attributes() {
35744
35830
  return {
35745
- 'class': this.name
35831
+ class: this.name,
35746
35832
  };
35747
35833
  }
35834
+ /**
35835
+ * @internal
35836
+ */
35748
35837
  bindEvents() {
35838
+ const mediaControl = this.core.getPlugin('media_control');
35839
+ assert(mediaControl, 'media_control plugin is required');
35749
35840
  this.listenToOnce(this.core, Events$1.CORE_READY, this._onCoreReady);
35750
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this._onMediaControlContainerChanged);
35841
+ // TODO listen to CORE_ACTIVE_CONTAINER_CHANGED
35842
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this._onMediaControlContainerChanged);
35751
35843
  this.listenTo(this.core, Events$1.CORE_RESIZE, this.playerResize);
35752
35844
  }
35753
35845
  _onCoreReady() {
@@ -35757,12 +35849,6 @@ class ClipsPlugin extends UICorePlugin {
35757
35849
  }
35758
35850
  this.parseClips();
35759
35851
  }
35760
- unbindEvents() {
35761
- // @ts-ignore
35762
- this.stopListening(this.core, Events$1.CORE_READY);
35763
- // @ts-ignore
35764
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED);
35765
- }
35766
35852
  _onMediaControlContainerChanged() {
35767
35853
  this._bindContainerEvents();
35768
35854
  }
@@ -35776,9 +35862,10 @@ class ClipsPlugin extends UICorePlugin {
35776
35862
  if (this._oldContainer) {
35777
35863
  this.stopListening(this._oldContainer, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
35778
35864
  }
35779
- this._oldContainer = this.core.mediaControl.container;
35865
+ const mediaControl = this.core.getPlugin('media_control');
35866
+ this._oldContainer = mediaControl.container;
35780
35867
  this.durationGetting = false;
35781
- this.listenTo(this.core.mediaControl.container, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
35868
+ this.listenTo(mediaControl.container, Events$1.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
35782
35869
  }
35783
35870
  onTimeUpdate(event) {
35784
35871
  if (!this.durationGetting) {
@@ -35795,13 +35882,17 @@ class ClipsPlugin extends UICorePlugin {
35795
35882
  }
35796
35883
  parseClips() {
35797
35884
  const textArr = this.options.clips.text.split('\n');
35798
- const clipsArr = textArr.map((val) => {
35885
+ const clipsArr = textArr
35886
+ .map((val) => {
35799
35887
  const matchRes = val.match(/(\d+:\d+|:\d+) (.+)/i);
35800
- return matchRes ? {
35801
- start: strtimeToMiliseconds(matchRes[1]),
35802
- text: matchRes[2],
35803
- } : null;
35804
- }).filter((clip) => clip !== null);
35888
+ return matchRes
35889
+ ? {
35890
+ start: strtimeToMiliseconds(matchRes[1]),
35891
+ text: matchRes[2],
35892
+ }
35893
+ : null;
35894
+ })
35895
+ .filter((clip) => clip !== null);
35805
35896
  clipsArr.sort((a, b) => a.start - b.start);
35806
35897
  clipsArr.forEach((clip, index) => {
35807
35898
  this.clips.set(clip.start, {
@@ -35812,6 +35903,11 @@ class ClipsPlugin extends UICorePlugin {
35812
35903
  });
35813
35904
  });
35814
35905
  }
35906
+ /**
35907
+ * Returns the text of the current clip.
35908
+ * @param time - The current time of the player.
35909
+ * @returns The text of the current clip.
35910
+ */
35815
35911
  getText(time) {
35816
35912
  for (const [key, value] of this.clips.entries()) {
35817
35913
  if (time >= value.start && time < value.end) {
@@ -35822,14 +35918,14 @@ class ClipsPlugin extends UICorePlugin {
35822
35918
  }
35823
35919
  makeSvg(duration) {
35824
35920
  let svg = '<svg width="0" height="0">\n' + '<defs>\n' + '<clipPath id="myClip">\n';
35825
- const widthOfSeek = this.core.mediaControl.container.$el.width();
35921
+ const widthOfSeek = this.core.activeContainer.$el.width();
35826
35922
  let finishValue = 0;
35827
- this.clips.forEach(val => {
35923
+ this.clips.forEach((val) => {
35828
35924
  let end = val.end;
35829
35925
  if (!end) {
35830
35926
  end = val.end = duration;
35831
35927
  }
35832
- const widthChunk = (end - val.start) * widthOfSeek / duration;
35928
+ const widthChunk = ((end - val.start) * widthOfSeek) / duration;
35833
35929
  svg += `<rect x="${finishValue}" y="0" width="${widthChunk - 2}" height="30"/>\n`;
35834
35930
  finishValue += widthChunk;
35835
35931
  });
@@ -35842,7 +35938,8 @@ class ClipsPlugin extends UICorePlugin {
35842
35938
  if (this.svgMask) {
35843
35939
  this.svgMask.remove();
35844
35940
  }
35845
- const $seekBarContainer = this.core.mediaControl.getElement('seekBarContainer');
35941
+ const mediaControl = this.core.getPlugin('media_control');
35942
+ const $seekBarContainer = mediaControl.getElement('seekBarContainer');
35846
35943
  if ($seekBarContainer?.get(0)) {
35847
35944
  $seekBarContainer.addClass('clips');
35848
35945
  }
@@ -35850,7 +35947,8 @@ class ClipsPlugin extends UICorePlugin {
35850
35947
  $seekBarContainer?.append(this.svgMask);
35851
35948
  }
35852
35949
  setClipText(text) {
35853
- const $clipText = this.core.mediaControl.getElement('clipText');
35950
+ const mediaControl = this.core.getPlugin('media_control');
35951
+ const $clipText = mediaControl.getElement('clipText');
35854
35952
  if ($clipText && text) {
35855
35953
  $clipText.show();
35856
35954
  $clipText.text(`${text}`);
@@ -35860,28 +35958,61 @@ class ClipsPlugin extends UICorePlugin {
35860
35958
 
35861
35959
  const templateHtml$1 = "<ul class=\"context-menu-list\">\n <% if(options) { %>\n <% for (var i = 0; i < options.length; i++) { %>\n <li class=\"context-menu-list-item <%= options[i].class %>\"\n data-<%= options[i].name %>><%= options[i].label %></li>\n <% } %>\n <% } %>\n</ul>\n";
35862
35960
 
35863
- class ContextMenu extends UICorePlugin {
35961
+ var version$1 = "2.20.3";
35962
+
35963
+ var packages = {
35964
+ "node_modules/@clappr/core": {
35965
+ version: "0.11.4"},
35966
+ "node_modules/dashjs": {
35967
+ version: "4.7.4"},
35968
+ "node_modules/hls.js": {
35969
+ version: "1.5.20"}};
35970
+
35971
+ /**
35972
+ * Version information about the gplayer and its main dependencies
35973
+ * @returns Version information about the gplayer and its main dependencies
35974
+ * @beta
35975
+ */
35976
+ function version() {
35977
+ return {
35978
+ gplayer: version$1,
35979
+ clappr: packages['node_modules/@clappr/core'].version,
35980
+ dashjs: packages['node_modules/dashjs'].version,
35981
+ hlsjs: packages['node_modules/hls.js'].version,
35982
+ };
35983
+ }
35984
+
35985
+ /**
35986
+ * Displays a small context menu when clicked on the player container.
35987
+ * @beta
35988
+ * @remarks
35989
+ * Configuration options - {@link ContextMenuPluginSettings}
35990
+ */
35991
+ class ContextMenu extends UIContainerPlugin {
35864
35992
  _label = '';
35865
35993
  _url = '';
35866
- container = null;
35867
35994
  menuOptions = [];
35995
+ /**
35996
+ * @internal
35997
+ */
35868
35998
  get name() {
35869
35999
  return 'context_menu';
35870
36000
  }
36001
+ /**
36002
+ * @internal
36003
+ */
35871
36004
  get supportedVersion() {
35872
36005
  return { min: CLAPPR_VERSION };
35873
36006
  }
36007
+ /**
36008
+ * @internal
36009
+ */
35874
36010
  get attributes() {
35875
- return { 'class': 'context-menu' };
35876
- }
35877
- get mediaControl() {
35878
- return this.core.mediaControl;
35879
- }
35880
- get template() {
35881
- return tmpl(templateHtml$1);
36011
+ return { class: 'context-menu' };
35882
36012
  }
36013
+ static template = tmpl(templateHtml$1);
35883
36014
  get label() {
35884
- return this._label || 'Gcore player ver. ' + process.env.VERSION;
36015
+ return this._label || 'Gcore player ver. ' + version().gplayer;
35885
36016
  }
35886
36017
  get url() {
35887
36018
  return this._url || 'https://gcore.com/';
@@ -35889,16 +36020,19 @@ class ContextMenu extends UICorePlugin {
35889
36020
  get exposeVersion() {
35890
36021
  return {
35891
36022
  label: this.label,
35892
- name: 'version'
36023
+ name: 'version',
35893
36024
  };
35894
36025
  }
36026
+ /**
36027
+ * @internal
36028
+ */
35895
36029
  get events() {
35896
36030
  return {
35897
- 'click [data-version]': 'onOpenMainPage'
36031
+ 'click [data-version]': 'onOpenMainPage',
35898
36032
  };
35899
36033
  }
35900
- constructor(core) {
35901
- super(core);
36034
+ constructor(container) {
36035
+ super(container);
35902
36036
  if (this.options.contextMenu && this.options.contextMenu.label) {
35903
36037
  this._label = this.options.contextMenu.label;
35904
36038
  }
@@ -35908,28 +36042,21 @@ class ContextMenu extends UICorePlugin {
35908
36042
  this.render();
35909
36043
  this.bindEvents();
35910
36044
  }
36045
+ /**
36046
+ * @internal
36047
+ */
35911
36048
  bindEvents() {
35912
- if (this.mediaControl) {
35913
- this.listenTo(this.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
35914
- if (this.container) {
35915
- this.listenTo(this.container, Events$1.CONTAINER_CONTEXTMENU, this.toggleContextMenu);
35916
- this.listenTo(this.container, Events$1.CONTAINER_CLICK, this.hide);
35917
- }
35918
- }
35919
- $('body').on('click', this.hide.bind(this));
36049
+ this.listenTo(this.container, Events$1.CONTAINER_CONTEXTMENU, this.toggleContextMenu);
36050
+ this.listenTo(this.container, Events$1.CONTAINER_CLICK, this.hide);
36051
+ $('body').on('click', this.hideOnBodyClick);
35920
36052
  }
36053
+ /**
36054
+ * @internal
36055
+ */
35921
36056
  destroy() {
35922
- $('body').off('click', this.hide.bind(this));
35923
- // @ts-ignore
35924
- this.stopListening();
36057
+ $('body').off('click', this.hideOnBodyClick);
35925
36058
  return super.destroy();
35926
36059
  }
35927
- containerChanged() {
35928
- this.container = this.core.activeContainer;
35929
- // @ts-ignore
35930
- this.stopListening();
35931
- this.bindEvents();
35932
- }
35933
36060
  toggleContextMenu(event) {
35934
36061
  event.preventDefault();
35935
36062
  const offset = this.container?.$el.offset();
@@ -35937,7 +36064,8 @@ class ContextMenu extends UICorePlugin {
35937
36064
  }
35938
36065
  show(top, left) {
35939
36066
  this.hide();
35940
- if (this.options.contextMenu && this.options.contextMenu.preventShowContextMenu) {
36067
+ if (this.options.contextMenu &&
36068
+ this.options.contextMenu.preventShowContextMenu) {
35941
36069
  return;
35942
36070
  }
35943
36071
  this.$el.css({ top, left });
@@ -35949,80 +36077,19 @@ class ContextMenu extends UICorePlugin {
35949
36077
  onOpenMainPage() {
35950
36078
  window.open(this.url, '_blank');
35951
36079
  }
36080
+ /**
36081
+ * @internal
36082
+ */
35952
36083
  render() {
35953
36084
  this.menuOptions = [this.exposeVersion];
35954
- this.$el.html(this.template({ options: this.menuOptions }));
35955
- this.core.$el.append(this.$el);
36085
+ this.$el.html(ContextMenu.template({ options: this.menuOptions }));
36086
+ this.container.$el.append(this.$el); // TODO append to the container, turn into a container plugin
35956
36087
  this.hide();
35957
- this.disable();
35958
36088
  return this;
35959
36089
  }
35960
- }
35961
-
35962
- class DisableControls extends UICorePlugin {
35963
- get name() {
35964
- return 'disable_controls';
35965
- }
35966
- get container() {
35967
- return this.core && this.core.activeContainer;
35968
- }
35969
- get supportedVersion() {
35970
- return { min: CLAPPR_VERSION };
35971
- }
35972
- bindEvents() {
35973
- if (this.container) {
35974
- this.listenTo(this.container, Events$1.CONTAINER_MEDIACONTROL_ENABLE, this.enableControls);
35975
- this.listenTo(this.container, Events$1.CONTAINER_PLAY, this.enableControls);
35976
- this.listenTo(this.container, Events$1.CONTAINER_PAUSE, this.enableControls);
35977
- this.listenTo(this.container, Events$1.CONTAINER_STOP, this.enableControls);
35978
- this.listenTo(this.container, Events$1.CONTAINER_ENDED, this.enableControls);
35979
- this.listenTo(this.container, 'container:advertisement:start', this.enableControls);
35980
- }
35981
- this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
35982
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_SHOW, this.enableControls);
35983
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.enableControls);
35984
- }
35985
- unbindEvents() {
35986
- // @ts-ignore
35987
- this.stopListening(this.core, Events$1.CORE_READY);
35988
- // @ts-ignore
35989
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_SHOW);
35990
- // @ts-ignore
35991
- this.stopListening(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED);
35992
- // @ts-ignore
35993
- this.stopListening(this.container, Events$1.CONTAINER_MEDIACONTROL_ENABLE);
35994
- // @ts-ignore
35995
- this.stopListening(this.container, Events$1.CONTAINER_PLAY);
35996
- // @ts-ignore
35997
- this.stopListening(this.container, Events$1.CONTAINER_PAUSE);
35998
- // @ts-ignore
35999
- this.stopListening(this.container, Events$1.CONTAINER_STOP);
36000
- // @ts-ignore
36001
- this.stopListening(this.container, Events$1.CONTAINER_ENDED);
36002
- // @ts-ignore
36003
- this.stopListening(this.container, 'container:advertisement:start');
36004
- }
36005
- setDisableStyles() {
36006
- const css = document.createElement('style');
36007
- const styles = '.control-need-disable { display: none!important; }';
36008
- css.appendChild(document.createTextNode(styles));
36009
- this.core.$el.get(0).appendChild(css);
36010
- }
36011
- onCoreReady() {
36012
- this.setDisableStyles();
36013
- this.bindEvents();
36014
- this.enableControls();
36015
- }
36016
- enableControls() {
36017
- this.disableAllControls();
36018
- }
36019
- disableAllControls() {
36020
- setTimeout(() => {
36021
- const spinnerPlugin = this.container.getPlugin('spinner');
36022
- spinnerPlugin?.destroy();
36023
- this.container.disableMediaControl();
36024
- }, 0);
36025
- }
36090
+ hideOnBodyClick = () => {
36091
+ this.hide();
36092
+ };
36026
36093
  }
36027
36094
 
36028
36095
  const dvrHTML = "<div class=\"live-info\"><%= live %></div>\n<button type=\"button\" class=\"live-button\" aria-label=\"<%= backToLive %>\"><%= backToLive %></button>\n";
@@ -36034,7 +36101,7 @@ const dvrHTML = "<div class=\"live-info\"><%= live %></div>\n<button type=\"butt
36034
36101
  * @remarks
36035
36102
  * Depends on:
36036
36103
  *
36037
- * - {@link MediaControl | media_control}
36104
+ * - {@link MediaControl}
36038
36105
  *
36039
36106
  * The plugin renders the live stream indicator and the DVR seek bar, if DVR is enabled, in the media control UI.
36040
36107
  */
@@ -36044,7 +36111,7 @@ class DvrControls extends UICorePlugin {
36044
36111
  * @internal
36045
36112
  */
36046
36113
  get name() {
36047
- return 'media_control_dvr';
36114
+ return 'dvr_controls';
36048
36115
  }
36049
36116
  /**
36050
36117
  * @internal
@@ -36077,32 +36144,15 @@ class DvrControls extends UICorePlugin {
36077
36144
  * @internal
36078
36145
  */
36079
36146
  bindEvents() {
36080
- this.bindCoreEvents();
36081
- this.bindContainerEvents();
36082
- if (this.core.activeContainer) {
36083
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
36084
- }
36085
- }
36086
- bindCoreEvents() {
36087
- if (this.core.mediaControl.settings) {
36088
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
36089
- this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_RENDERED, this.settingsUpdate);
36090
- this.listenTo(this.core, Events$1.CORE_OPTIONS_CHANGE, this.render);
36091
- }
36092
- else {
36093
- setTimeout(() => this.bindCoreEvents(), 100);
36094
- }
36147
+ const mediaControl = this.core.getPlugin('media_control');
36148
+ assert(mediaControl, 'media_control plugin is required');
36149
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.settingsUpdate);
36150
+ this.listenTo(this.core, Events$1.CORE_OPTIONS_CHANGE, this.render);
36151
+ this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.bindContainerEvents);
36095
36152
  }
36096
36153
  bindContainerEvents() {
36097
- if (this.core.activeContainer) {
36098
- this.listenToOnce(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.render);
36099
- this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
36100
- }
36101
- }
36102
- containerChanged() {
36103
- // @ts-ignore
36104
- this.stopListening();
36105
- this.bindEvents();
36154
+ this.listenToOnce(this.core.activeContainer, Events$1.CONTAINER_TIMEUPDATE, this.render);
36155
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
36106
36156
  }
36107
36157
  dvrChanged(dvrEnabled) {
36108
36158
  if (this.core.getPlaybackType() !== Playback.LIVE) {
@@ -36135,7 +36185,7 @@ class DvrControls extends UICorePlugin {
36135
36185
  settingsUpdate() {
36136
36186
  // @ts-ignore
36137
36187
  this.stopListening(); // TODO sort out
36138
- this.core.mediaControl.$el.removeClass('live');
36188
+ this.core.getPlugin('media_control').$el.removeClass('live'); // TODO don't access directly
36139
36189
  if (this.shouldRender()) {
36140
36190
  this.render();
36141
36191
  this.$el.click(() => this.click());
@@ -36155,7 +36205,7 @@ class DvrControls extends UICorePlugin {
36155
36205
  backToLive: this.core.i18n.t('back_to_live')
36156
36206
  }));
36157
36207
  if (this.shouldRender()) {
36158
- const mediaControl = this.core.mediaControl;
36208
+ const mediaControl = this.core.getPlugin('media_control');
36159
36209
  assert(mediaControl, 'media_control plugin is required');
36160
36210
  // TODO don't tap into the $el directly
36161
36211
  mediaControl.$el.addClass('live');
@@ -36174,7 +36224,6 @@ const MAX_RETRY = 10;
36174
36224
  /**
36175
36225
  * Displays a descriptive error in the overlay on top of the player.
36176
36226
  * @beta
36177
- * TODO
36178
36227
  */
36179
36228
  class ErrorScreen extends UICorePlugin {
36180
36229
  _retry = 0;
@@ -36353,6 +36402,10 @@ const stopIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\
36353
36402
  const FAVICON_COLOR = '#567';
36354
36403
  const FAVICON_SELECTOR = 'link[rel="shortcut icon"]';
36355
36404
  // const oldIcon = $(FAVICON_SELECTOR);
36405
+ /**
36406
+ * The plugin adds custom favicon to the player's tab.
36407
+ * @beta
36408
+ */
36356
36409
  class Favicon extends CorePlugin {
36357
36410
  _container = null;
36358
36411
  oldIcon;
@@ -36454,7 +36507,11 @@ class Favicon extends CorePlugin {
36454
36507
 
36455
36508
  // Copyright 2014 Globo.com Player authors. All rights reserved.
36456
36509
  // Use of this source code is governed by a BSD-style
36457
- // license that can be found in the LICENSE file.
36510
+ // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE
36511
+ /**
36512
+ * An example Google Analytics integration plugin
36513
+ * @beta
36514
+ */
36458
36515
  class GoogleAnalytics extends ContainerPlugin {
36459
36516
  account = '';
36460
36517
  trackerName = '';
@@ -37098,6 +37155,10 @@ function calculateSize(original) {
37098
37155
 
37099
37156
  const logoHTML = "<div class=\"clappr-logo control-need-disable\">\n <img class=\"clappr-logo-img\"/>\n</div>\n";
37100
37157
 
37158
+ /**
37159
+ * The plugin adds custom logo to the player.
37160
+ * @beta
37161
+ */
37101
37162
  class Logo extends UIContainerPlugin {
37102
37163
  hasStartedPlaying = false;
37103
37164
  $logoContainer = null;
@@ -37375,7 +37436,7 @@ class MediaControl extends UICorePlugin {
37375
37436
  return { min: CLAPPR_VERSION };
37376
37437
  }
37377
37438
  get disabled() {
37378
- const playbackIsNOOP = this.container && this.container.getPlaybackType() === Playback.NO_OP;
37439
+ const playbackIsNOOP = this.core.activeContainer && this.core.activeContainer.getPlaybackType() === Playback.NO_OP;
37379
37440
  return this.userDisabled || playbackIsNOOP;
37380
37441
  }
37381
37442
  /**
@@ -38055,6 +38116,8 @@ class MediaControl extends UICorePlugin {
38055
38116
  */
38056
38117
  getElement(name) {
38057
38118
  switch (name) {
38119
+ case 'audioTracksSelector':
38120
+ return this.$audioTracksSelector;
38058
38121
  case 'clipText':
38059
38122
  return this.$clipText;
38060
38123
  case 'bottomGear':
@@ -38360,6 +38423,9 @@ const streamsWhiteNightsIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:
38360
38423
 
38361
38424
  const VERSION$3 = '0.0.1';
38362
38425
  const T$7 = 'plugins.media_control_multicamera';
38426
+ /**
38427
+ * The plugin adds support for loading multiple streams and switching between them using the media control UI.
38428
+ */
38363
38429
  class MultiCamera extends UICorePlugin {
38364
38430
  currentCamera = null;
38365
38431
  currentTime = 0;
@@ -39296,8 +39362,12 @@ const seekTimeHTML = "<span data-seek-time></span>\n<span data-duration></span>\
39296
39362
 
39297
39363
  // Copyright 2014 Globo.com Player authors. All rights reserved.
39298
39364
  // Use of this source code is governed by a BSD-style
39299
- // license that can be found in the LICENSE file.
39365
+ // license that can be found at https://github.com/clappr/clappr-plugins/blob/master/LICENSE
39300
39366
  const { formatTime } = Utils;
39367
+ /**
39368
+ * The plugin adds a seek time indicator to the media control UI.
39369
+ * @beta
39370
+ */
39301
39371
  class SeekTime extends UICorePlugin {
39302
39372
  get name() {
39303
39373
  return 'media_control_seek_time';
@@ -39454,6 +39524,9 @@ const fbIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"32px\"
39454
39524
 
39455
39525
  const twIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"32px\" height=\"32px\" viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n <title>twitter</title>\n <desc>Created with Sketch.</desc>\n <defs></defs>\n <g id=\"twitter\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill-rule=\"nonzero\" id=\"Shape\">\n <path d=\"M32,30 C32,31.104 31.104,32 30,32 L2,32 C0.896,32 0,31.104 0,30 L0,2 C0,0.896 0.896,0 2,0 L30,0 C31.104,0 32,0.896 32,2 L32,30 Z\" fill=\"#55ACEE\"></path>\n <path class=\"icon-hover\" d=\"M25.987,9.894 C25.251,10.216 24.462,10.431 23.63,10.529 C24.48,10.031 25.13,9.24 25.436,8.298 C24.644,8.759 23.766,9.095 22.831,9.276 C22.083,8.491 21.017,8 19.838,8 C17.572,8 15.738,9.807 15.738,12.038 C15.738,12.352 15.774,12.663 15.842,12.96 C12.435,12.788 9.413,11.181 7.39,8.739 C7.038,9.336 6.834,10.029 6.834,10.771 C6.834,12.17 7.56,13.406 8.658,14.131 C7.987,14.109 7.354,13.928 6.802,13.625 C6.801,13.642 6.801,13.659 6.801,13.677 C6.801,15.632 8.215,17.266 10.091,17.637 C9.748,17.727 9.386,17.779 9.01,17.779 C8.746,17.779 8.49,17.755 8.24,17.707 C8.76,19.311 10.274,20.478 12.068,20.512 C10.67,21.594 8.9,22.24 6.979,22.24 C6.649,22.24 6.321,22.222 6,22.184 C7.814,23.329 9.971,23.997 12.287,23.997 C19.828,23.997 23.953,17.843 23.953,12.506 C23.953,12.333 23.948,12.156 23.941,11.985 C24.741,11.414 25.438,10.703 25.987,9.894 Z\" fill=\"#FFFFFF\"></path>\n </g>\n </g>\n</svg>";
39456
39526
 
39527
+ /**
39528
+ * The plugin adds a share button to the media control UI.
39529
+ */
39457
39530
  class Share extends UICorePlugin {
39458
39531
  hide = false;
39459
39532
  container = null;
@@ -39571,6 +39644,9 @@ class Share extends UICorePlugin {
39571
39644
 
39572
39645
  const pluginHtml$1 = "<div class=\"skip-container\" data-skip-container>\n <div class=\"skip-item\" data-skip-left>\n </div>\n <div class=\"skip-item\" data-skip-mid>\n </div>\n <div class=\"skip-item\" data-skip-right>\n </div>\n</div>\n";
39573
39646
 
39647
+ /**
39648
+ * The plugin adds skip controls to the media control UI.
39649
+ */
39574
39650
  class SkipTime extends UICorePlugin {
39575
39651
  get name() {
39576
39652
  return 'skip_time';
@@ -40371,6 +40447,7 @@ const STALL_MEASURE_PERIOD = 10;
40371
40447
  const T$1 = 'plugins.telemetry';
40372
40448
  /**
40373
40449
  * Telemetry event type
40450
+ * @beta
40374
40451
  */
40375
40452
  var TelemetryEvent;
40376
40453
  (function (TelemetryEvent) {
@@ -40657,7 +40734,29 @@ const parseSRT = /*@__PURE__*/getDefaultExportFromCjs(parseSrtExports);
40657
40734
 
40658
40735
  const pluginHtml = "<div class=\"thumbnails-text\"></div>\n<% if (backdropHeight) { %>\n <div class=\"backdrop\" style=\"height: <%= backdropHeight %>px;\">\n <div class=\"carousel\"></div>\n </div>\n<% }; %>\n<% if (spotlightHeight) { %>\n <div class=\"spotlight\" style=\"height: <%= spotlightHeight %>px;\">\n </div>\n<% }; %>\n";
40659
40736
 
40660
- const T = 'plugins.media_control_thumbnails';
40737
+ const T = 'plugins.thumbnails';
40738
+ /**
40739
+ * Displays the thumbnails of the video when available.
40740
+ * @beta
40741
+ * @example
40742
+ * ```ts
40743
+ * import { Thumbnails } from '@gcorevideo/player'
40744
+ *
40745
+ * Player.registerPlugin(Thumbnails)
40746
+ *
40747
+ * new Player({
40748
+ * thumbnails: {
40749
+ * backdropHeight: 200,
40750
+ * backdropMinOpacity: 0.9,
40751
+ * backdropMaxOpacity: 0.99,
40752
+ * spotlightHeight: 100,
40753
+ * vtt: '1\n00:00:00,000 --> 00:00:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,0,100,56\n\n2\n00:00:10,000 --> 00:00:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,0,100,56\n\n3\n00:00:20,000 --> 00:00:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,0,100,56\n\n4\n00:00:30,000 --> 00:00:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,0,100,56\n\n5\n00:00:40,000 --> 00:00:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,0,100,56\n\n6\n00:00:50,000 --> 00:01:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,0,100,56\n\n7\n00:01:00,000 --> 00:01:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,0,100,56\n\n8\n00:01:10,000 --> 00:01:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,56,100,56\n\n9\n00:01:20,000 --> 00:01:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,56,100,56\n\n10\n00:01:30,000 --> 00:01:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,56,100,56\n\n11\n00:01:40,000 --> 00:01:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,56,100,56\n\n12\n00:01:50,000 --> 00:02:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,56,100,56\n\n13\n00:02:00,000 --> 00:02:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,56,100,56\n\n14\n00:02:10,000 --> 00:02:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,56,100,56\n\n15\n00:02:20,000 --> 00:02:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,112,100,56\n\n16\n00:02:30,000 --> 00:02:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,112,100,56\n\n17\n00:02:40,000 --> 00:02:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,112,100,56\n\n18\n00:02:50,000 --> 00:03:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,112,100,56\n\n19\n00:03:00,000 --> 00:03:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,112,100,56\n\n20\n00:03:10,000 --> 00:03:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,112,100,56\n\n21\n00:03:20,000 --> 00:03:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,112,100,56\n\n22\n00:03:30,000 --> 00:03:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,168,100,56\n\n23\n00:03:40,000 --> 00:03:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,168,100,56\n\n24\n00:03:50,000 --> 00:04:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,168,100,56\n\n25\n00:04:00,000 --> 00:04:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,168,100,56\n\n26\n00:04:10,000 --> 00:04:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,168,100,56\n\n27\n00:04:20,000 --> 00:04:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,168,100,56\n\n28\n00:04:30,000 --> 00:04:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,168,100,56\n\n29\n00:04:40,000 --> 00:04:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,224,100,56\n\n30\n00:04:50,000 --> 00:05:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,224,100,56\n\n31\n00:05:00,000 --> 00:05:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,224,100,56\n\n32\n00:05:10,000 --> 00:05:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,224,100,56\n\n33\n00:05:20,000 --> 00:05:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,224,100,56\n\n34\n00:05:30,000 --> 00:05:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,224,100,56\n\n35\n00:05:40,000 --> 00:05:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,224,100,56\n\n36\n00:05:50,000 --> 00:06:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,280,100,56\n\n37\n00:06:00,000 --> 00:06:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,280,100,56\n\n38\n00:06:10,000 --> 00:06:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,280,100,56\n\n39\n00:06:20,000 --> 00:06:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,280,100,56\n\n40\n00:06:30,000 --> 00:06:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,280,100,56\n\n41\n00:06:40,000 --> 00:06:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,280,100,56\n\n42\n00:06:50,000 --> 00:07:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,280,100,56\n\n43\n00:07:00,000 --> 00:07:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,336,100,56\n\n44\n00:07:10,000 --> 00:07:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,336,100,56\n\n45\n00:07:20,000 --> 00:07:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,336,100,56\n\n46\n00:07:30,000 --> 00:07:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,336,100,56\n\n47\n00:07:40,000 --> 00:07:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,336,100,56\n\n48\n00:07:50,000 --> 00:08:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,336,100,56\n\n49\n00:08:00,000 --> 00:08:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,336,100,56\n',
40754
+ * sprite:
40755
+ * 'https://static.gvideo.co/videoplatform/sprites/2675/2452164_3dk4NsRt6vWsffEr.mp4_sprite.jpg',
40756
+ * },
40757
+ * })
40758
+ * ```
40759
+ */
40661
40760
  class Thumbnails extends UICorePlugin {
40662
40761
  _$spotlight = null;
40663
40762
  _$backdrop = null;
@@ -40672,20 +40771,27 @@ class Thumbnails extends UICorePlugin {
40672
40771
  _thumbsLoaded = false;
40673
40772
  _oldContainer = null;
40674
40773
  _thumbs = [];
40774
+ /**
40775
+ * @internal
40776
+ */
40675
40777
  get name() {
40676
- return 'media_control_thumbnails';
40778
+ return 'thumbnails';
40677
40779
  }
40780
+ /**
40781
+ * @internal
40782
+ */
40678
40783
  get supportedVersion() {
40679
40784
  return { min: CLAPPR_VERSION };
40680
40785
  }
40786
+ /**
40787
+ * @internal
40788
+ */
40681
40789
  get attributes() {
40682
40790
  return {
40683
- 'class': this.name
40791
+ class: this.name,
40684
40792
  };
40685
40793
  }
40686
- get template() {
40687
- return tmpl(pluginHtml);
40688
- }
40794
+ static template = tmpl(pluginHtml);
40689
40795
  /*
40690
40796
  * Helper to build the "thumbs" property for a sprite sheet.
40691
40797
  *
@@ -40729,6 +40835,9 @@ class Thumbnails extends UICorePlugin {
40729
40835
  return thumbs;
40730
40836
  }
40731
40837
  // TODO check if seek enabled
40838
+ /**
40839
+ * @internal
40840
+ */
40732
40841
  bindEvents() {
40733
40842
  this.listenToOnce(this.core, Events$1.CORE_READY, this._onCoreReady);
40734
40843
  this.listenTo(this.core.mediaControl, Events$1.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this._onMouseMove);
@@ -40745,7 +40854,9 @@ class Thumbnails extends UICorePlugin {
40745
40854
  }
40746
40855
  _onCoreReady() {
40747
40856
  try {
40748
- if (!this.options.thumbnails || !this.options.thumbnails.sprite || !this.options.thumbnails.vtt) {
40857
+ if (!this.options.thumbnails ||
40858
+ !this.options.thumbnails.sprite ||
40859
+ !this.options.thumbnails.vtt) {
40749
40860
  this.destroy();
40750
40861
  return;
40751
40862
  }
@@ -40795,7 +40906,7 @@ class Thumbnails extends UICorePlugin {
40795
40906
  }
40796
40907
  _getOptions() {
40797
40908
  if (!('thumbnails' in this.core.options)) {
40798
- throw '\'thumbnail property missing from options object.';
40909
+ throw "'thumbnail property missing from options object.";
40799
40910
  }
40800
40911
  return this.core.options.thumbnails;
40801
40912
  }
@@ -40896,7 +41007,7 @@ class Thumbnails extends UICorePlugin {
40896
41007
  this.$img.css({
40897
41008
  height: this.spriteSheetHeight * scaleFactor,
40898
41009
  left: -1 * thumb.x * scaleFactor,
40899
- top: -1 * thumb.y * scaleFactor
41010
+ top: -1 * thumb.y * scaleFactor,
40900
41011
  });
40901
41012
  if (this.$container.find(this.$img).length === 0) {
40902
41013
  this.$container.append(this.$img);
@@ -40938,7 +41049,7 @@ class Thumbnails extends UICorePlugin {
40938
41049
  const videoDuration = this.core.mediaControl.container.getDuration();
40939
41050
  const startTimeOffset = this.core.mediaControl.container.getStartTimeOffset();
40940
41051
  // the time into the video at the current hover position
40941
- const hoverTime = startTimeOffset + (videoDuration * hoverPosition);
41052
+ const hoverTime = startTimeOffset + videoDuration * hoverPosition;
40942
41053
  const backdropWidth = this._$backdrop.width();
40943
41054
  const $carousel = this._$carousel;
40944
41055
  const carouselWidth = $carousel.width();
@@ -40963,9 +41074,9 @@ class Thumbnails extends UICorePlugin {
40963
41074
  const positionInThumb = timeIntoThumb / thumbDuration;
40964
41075
  const xCoordInThumb = thumbWidth * positionInThumb;
40965
41076
  // now calculate the position along carousel that we want to be above the hover position
40966
- const xCoordInCarousel = (thumbIndex * thumbWidth) + xCoordInThumb;
41077
+ const xCoordInCarousel = thumbIndex * thumbWidth + xCoordInThumb;
40967
41078
  // and finally the position of the carousel when the hover position is taken in to consideration
40968
- const carouselXCoord = xCoordInCarousel - (hoverPosition * backdropWidth);
41079
+ const carouselXCoord = xCoordInCarousel - hoverPosition * backdropWidth;
40969
41080
  $carousel.css('left', -carouselXCoord);
40970
41081
  const maxOpacity = this._getOptions().backdropMaxOpacity || 0.6;
40971
41082
  const minOpacity = this._getOptions().backdropMinOpacity || 0.08;
@@ -40981,7 +41092,7 @@ class Thumbnails extends UICorePlugin {
40981
41092
  distance = Math.min(0, distance + thumbWidth);
40982
41093
  }
40983
41094
  // fade over the width of 2 thumbnails
40984
- const opacity = Math.max(maxOpacity - (Math.abs(distance) / (2 * thumbWidth)), minOpacity);
41095
+ const opacity = Math.max(maxOpacity - Math.abs(distance) / (2 * thumbWidth), minOpacity);
40985
41096
  this._$backdropCarouselImgs[i].css('opacity', opacity);
40986
41097
  }
40987
41098
  }
@@ -40997,7 +41108,7 @@ class Thumbnails extends UICorePlugin {
40997
41108
  const videoDuration = this.core.mediaControl.container.getDuration();
40998
41109
  // the time into the video at the current hover position
40999
41110
  const startTimeOffset = this.core.mediaControl.container.getStartTimeOffset();
41000
- const hoverTime = startTimeOffset + (videoDuration * hoverPosition);
41111
+ const hoverTime = startTimeOffset + videoDuration * hoverPosition;
41001
41112
  this.setText(hoverTime);
41002
41113
  // determine which thumbnail applies to the current time
41003
41114
  const thumbIndex = this._getThumbIndexForTime(hoverTime);
@@ -41009,7 +41120,7 @@ class Thumbnails extends UICorePlugin {
41009
41120
  const elWidth = this.$el.width();
41010
41121
  const thumbWidth = $spotlight.width();
41011
41122
  const thumbHeight = $spotlight.height();
41012
- let spotlightXPos = (elWidth * hoverPosition) - (thumbWidth / 2);
41123
+ let spotlightXPos = elWidth * hoverPosition - thumbWidth / 2;
41013
41124
  // adjust so the entire thumbnail is always visible
41014
41125
  spotlightXPos = Math.max(Math.min(spotlightXPos, elWidth - thumbWidth), 0);
41015
41126
  $spotlight.css('left', spotlightXPos);
@@ -41049,9 +41160,9 @@ class Thumbnails extends UICorePlugin {
41049
41160
  }
41050
41161
  }
41051
41162
  _createElements() {
41052
- this.$el.html(this.template({
41053
- 'backdropHeight': this._getOptions().backdropHeight,
41054
- 'spotlightHeight': this._getOptions().spotlightHeight
41163
+ this.$el.html(Thumbnails.template({
41164
+ backdropHeight: this._getOptions().backdropHeight,
41165
+ spotlightHeight: this._getOptions().spotlightHeight,
41055
41166
  }));
41056
41167
  // cache dom references
41057
41168
  this._$spotlight = this.$el.find('.spotlight');
@@ -41068,6 +41179,7 @@ var VolumeFadeEvents;
41068
41179
  VolumeFadeEvents["FADE"] = "core:volume:fade";
41069
41180
  })(VolumeFadeEvents || (VolumeFadeEvents = {}));
41070
41181
  /**
41182
+ * Applies fade effect to the player's volume change.
41071
41183
  * @beta
41072
41184
  */
41073
41185
  class VolumeFade extends UICorePlugin {
@@ -41160,4 +41272,4 @@ class VolumeFade extends UICorePlugin {
41160
41272
  }
41161
41273
  }
41162
41274
 
41163
- export { AudioSelector, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ContextMenu, DisableControls, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, Kibo, LevelSelector, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackRate, Poster, SeekTime, Share, SkipTime, SourceController, SpinnerEvents, SpinnerThreeBounce, Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };
41275
+ export { AudioSelector, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, Kibo, LevelSelector, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackRate, Poster, SeekTime, Share, SkipTime, SourceController, SpinnerEvents, SpinnerThreeBounce, Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };