@clickview/curator 1.101.0-rc.4 → 1.101.0

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 (61) hide show
  1. package/dist/.vite/manifest.json +475 -475
  2. package/dist/Assets/js/dist/scripts/{Bs1Y6-vh.chunk.js → -OUl3n-W.chunk.js} +2 -2
  3. package/dist/Assets/js/dist/scripts/{Bs1Y6-vh.chunk.js.map → -OUl3n-W.chunk.js.map} +1 -1
  4. package/dist/Assets/js/dist/scripts/5FGdlWcH.chunk.js +9 -0
  5. package/dist/Assets/js/dist/scripts/5FGdlWcH.chunk.js.map +1 -0
  6. package/dist/Assets/js/dist/scripts/B0UOCPE6.chunk.js +2 -0
  7. package/dist/Assets/js/dist/scripts/{r-zw-56e.chunk.js.map → B0UOCPE6.chunk.js.map} +1 -1
  8. package/dist/Assets/js/dist/scripts/{Ds6WvphR2.chunk.js → BD2aIccu2.chunk.js} +2 -2
  9. package/dist/Assets/js/dist/scripts/{Ds6WvphR2.chunk.js.map → BD2aIccu2.chunk.js.map} +1 -1
  10. package/dist/Assets/js/dist/scripts/{BwpzKPd12.chunk.js → BJJeLngO2.chunk.js} +2 -2
  11. package/dist/Assets/js/dist/scripts/{BwpzKPd12.chunk.js.map → BJJeLngO2.chunk.js.map} +1 -1
  12. package/dist/Assets/js/dist/scripts/{CaG8Cjey2.chunk.js → BKQIzKcF2.chunk.js} +2 -2
  13. package/dist/Assets/js/dist/scripts/{CaG8Cjey2.chunk.js.map → BKQIzKcF2.chunk.js.map} +1 -1
  14. package/dist/Assets/js/dist/scripts/{BEw27Jf3.chunk.js → BOrAaHLK.chunk.js} +2 -2
  15. package/dist/Assets/js/dist/scripts/{BEw27Jf3.chunk.js.map → BOrAaHLK.chunk.js.map} +1 -1
  16. package/dist/Assets/js/dist/scripts/BSMzg7zU.chunk.js.map +1 -1
  17. package/dist/Assets/js/dist/scripts/{CO69n5GB2.chunk.js → BUWsFXQp2.chunk.js} +2 -2
  18. package/dist/Assets/js/dist/scripts/{CO69n5GB2.chunk.js.map → BUWsFXQp2.chunk.js.map} +1 -1
  19. package/dist/Assets/js/dist/scripts/{BZU4ADoQ2.chunk.js → C1xOGHlL2.chunk.js} +2 -2
  20. package/dist/Assets/js/dist/scripts/{BZU4ADoQ2.chunk.js.map → C1xOGHlL2.chunk.js.map} +1 -1
  21. package/dist/Assets/js/dist/scripts/{CbaobIxf2.chunk.js → CAo_C8em2.chunk.js} +2 -2
  22. package/dist/Assets/js/dist/scripts/{CbaobIxf2.chunk.js.map → CAo_C8em2.chunk.js.map} +1 -1
  23. package/dist/Assets/js/dist/scripts/{D_e7ctVq.chunk.js → COH92JF5.chunk.js} +2 -2
  24. package/dist/Assets/js/dist/scripts/{D_e7ctVq.chunk.js.map → COH92JF5.chunk.js.map} +1 -1
  25. package/dist/Assets/js/dist/scripts/{CJpr073K.chunk.js → CR-5nCWm.chunk.js} +2 -2
  26. package/dist/Assets/js/dist/scripts/{CJpr073K.chunk.js.map → CR-5nCWm.chunk.js.map} +1 -1
  27. package/dist/Assets/js/dist/scripts/{CqhZ98rZ2.chunk.js → CW1ea_Kx2.chunk.js} +2 -2
  28. package/dist/Assets/js/dist/scripts/{CqhZ98rZ2.chunk.js.map → CW1ea_Kx2.chunk.js.map} +1 -1
  29. package/dist/Assets/js/dist/scripts/{DPA1azNU2.chunk.js → Cbwl04yH2.chunk.js} +2 -2
  30. package/dist/Assets/js/dist/scripts/{DPA1azNU2.chunk.js.map → Cbwl04yH2.chunk.js.map} +1 -1
  31. package/dist/Assets/js/dist/scripts/{DsHVJvUP.chunk.js → CpqMUVVi.chunk.js} +2 -2
  32. package/dist/Assets/js/dist/scripts/{DsHVJvUP.chunk.js.map → CpqMUVVi.chunk.js.map} +1 -1
  33. package/dist/Assets/js/dist/scripts/{I_gdFDV7.chunk.js → CqZqlJSF.chunk.js} +2 -2
  34. package/dist/Assets/js/dist/scripts/{I_gdFDV7.chunk.js.map → CqZqlJSF.chunk.js.map} +1 -1
  35. package/dist/Assets/js/dist/scripts/{CofA9RRF.chunk.js → CzCUe0Ej.chunk.js} +2 -2
  36. package/dist/Assets/js/dist/scripts/{CofA9RRF.chunk.js.map → CzCUe0Ej.chunk.js.map} +1 -1
  37. package/dist/Assets/js/dist/scripts/{DhN_Jc2z.chunk.js → DTUkmChD.chunk.js} +3 -3
  38. package/dist/Assets/js/dist/scripts/{DhN_Jc2z.chunk.js.map → DTUkmChD.chunk.js.map} +1 -1
  39. package/dist/Assets/js/dist/scripts/{C8YkY0we.chunk.js → DW7-la-i.chunk.js} +2 -2
  40. package/dist/Assets/js/dist/scripts/{C8YkY0we.chunk.js.map → DW7-la-i.chunk.js.map} +1 -1
  41. package/dist/Assets/js/dist/scripts/{ecehd0o7.chunk.js → Dhnl-PB5.chunk.js} +2 -2
  42. package/dist/Assets/js/dist/scripts/{ecehd0o7.chunk.js.map → Dhnl-PB5.chunk.js.map} +1 -1
  43. package/dist/Assets/js/dist/scripts/{jdQzplq1.chunk.js → DuU4GBw5.chunk.js} +2 -2
  44. package/dist/Assets/js/dist/scripts/{jdQzplq1.chunk.js.map → DuU4GBw5.chunk.js.map} +1 -1
  45. package/dist/Assets/js/dist/scripts/{CvMpxc4j2.chunk.js → LmwQmHZz2.chunk.js} +2 -2
  46. package/dist/Assets/js/dist/scripts/{CvMpxc4j2.chunk.js.map → LmwQmHZz2.chunk.js.map} +1 -1
  47. package/dist/Assets/js/dist/scripts/{app-D2seXuq-.js → app-DHtN6XkT.js} +3 -3
  48. package/dist/Assets/js/dist/scripts/{app-D2seXuq-.js.map → app-DHtN6XkT.js.map} +1 -1
  49. package/dist/Assets/js/dist/scripts/{DUsXdKYh.chunk.js → eKSK4iyn.chunk.js} +2 -2
  50. package/dist/Assets/js/dist/scripts/{DUsXdKYh.chunk.js.map → eKSK4iyn.chunk.js.map} +1 -1
  51. package/dist/Assets/js/dist/scripts/{BdXsbiX1.chunk.js → esASf9N4.chunk.js} +2 -2
  52. package/dist/Assets/js/dist/scripts/{BdXsbiX1.chunk.js.map → esASf9N4.chunk.js.map} +1 -1
  53. package/dist/Assets/js/dist/scripts/{De-ohgjE.chunk.js → x1pOfdJd.chunk.js} +2 -2
  54. package/dist/Assets/js/dist/scripts/x1pOfdJd.chunk.js.map +1 -0
  55. package/dist/bundles.json +1 -1
  56. package/dist/en.json +1 -1
  57. package/package.json +1 -1
  58. package/dist/Assets/js/dist/scripts/C7Rwn3_U.chunk.js +0 -9
  59. package/dist/Assets/js/dist/scripts/C7Rwn3_U.chunk.js.map +0 -1
  60. package/dist/Assets/js/dist/scripts/De-ohgjE.chunk.js.map +0 -1
  61. package/dist/Assets/js/dist/scripts/r-zw-56e.chunk.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"DUsXdKYh.chunk.js","names":[],"sources":["../../../../../../player/src/plugins/create-clip-button-plugin/components/create-clip-button.scss","../../../../../../player/src/plugins/create-clip-button-plugin/components/create-clip-button.ts","../../../../../../player/src/plugins/create-clip-button-plugin/create-clip-button-plugin.ts","../../../../../../player/src/plugins/picture-in-picture-plugin/components/picture-in-picture-toggle.ts","../../../../../../player/src/plugins/picture-in-picture-plugin/picture-in-picture-plugin.ts","../../../../../../player/src/plugins/points-of-interest-plugin/components/point-of-interest-indicator/point-of-interest-indicator.ts","../../../../../../player/src/plugins/points-of-interest-plugin/components/points-of-interest-menu-item/points-of-interest-menu-item.ts","../../../../../../player/src/plugins/points-of-interest-plugin/points-of-interest-plugin.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/range-indicator/range-indicator.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/replay-view-button/replay-view-button.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/replay-view/replay-view.ts","../../../../../../player/src/plugins/range-indicator-plugin/range-indicator-plugin.ts","../../../../../../player/src/utils/id-helper.ts","../../../../../../player/src/players/player.ts","../../../../../../../../node_modules/jquery-deferred/lib/jquery-core.js","../../../../../../../../node_modules/jquery-deferred/lib/jquery-callbacks.js","../../../../../../../../node_modules/jquery-deferred/lib/jquery-deferred.js","../../../../../../../../node_modules/jquery-deferred/index.js","../../../../../../../../node_modules/jquery-param/jquery-param.js","../../../../../../../../node_modules/signalr-no-jquery/build/jQueryShim.js","../../../../../../../../node_modules/signalr-no-jquery/build/signalR.js","../../../../../../player/src/plugins/devices-plugin/clients/client-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/utils/promise-with-timeout.ts","../../../../../../player/src/plugins/devices-plugin/utils/event-bus.ts","../../../../../../player/src/plugins/devices-plugin/utils/scheduler.ts","../../../../../../player/src/plugins/devices-plugin/utils/proxy-helper.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-cast-session-state.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-cast-session.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-client.ts","../../../../../../player/src/plugins/devices-plugin/utils/resilient-web-socket.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-cast-session-state.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-cast-session.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-client.ts","../../../../../../player/src/plugins/devices-plugin/devices-session-manager.ts","../../../../../../player/src/plugins/devices-plugin/components/device-menu-item/device-menu-item.ts","../../../../../../player/src/plugins/devices-plugin/components/devices-menu/devices-menu.ts","../../../../../../player/src/plugins/devices-plugin/components/devices-cta/devices-cta.tsx","../../../../../../player/src/plugins/devices-plugin/components/devices-button/devices-button.ts","../../../../../../player/src/plugins/devices-plugin/tech/devices-tech-ui/devices-tech-ui.ts","../../../../../../player/src/plugins/devices-plugin/tech/devices-tech.ts","../../../../../../player/src/plugins/devices-plugin/devices-plugin.ts","../../../../../../player/src/plugins/resources-plugin/components/resource-menu-item/resource-menu-item.tsx","../../../../../../player/src/plugins/resources-plugin/components/resources-button/resources-button.ts","../../../../../../player/src/plugins/resources-plugin/resources-plugin.ts","../../../../../../../libs/shared/src/services/OldVersionService.ts","../../../../../../player/src/plugins/old-version-refresh-plugin/old-version-refresh-plugin.ts","../../../../../../player/src/react/Player.tsx"],"sourcesContent":[".video-js {\n .cv-create-clip-button {\n width: 4em;\n padding: 0;\n\n .vjs-icon-placeholder::before {\n font-family: CVPlayer;\n /* Defined in font/icon-map.js */\n content: unquote(\"\\\"\\\\f10e\\\"\");\n }\n }\n}\n","import videojs from 'video.js';\n\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\n\nconst Button = videojs.getComponent('Button');\n\nimport './create-clip-button.scss';\n\nclass CreateClipButton extends Button implements CollapsibleComponent {\n public controlText_: string;\n\n public buildCSSClass(): string {\n return 'cv-create-clip-button';\n }\n\n /**\n * CollapsibleComponent interface implementation below\n */\n public alwaysCollapsed: boolean = false;\n\n public isCollapsed: boolean = false;\n\n public isCollabsible: boolean = true;\n\n public getCollabsibleName(): string {\n return this.controlText_;\n }\n \n public getCollabsibleValue(): string {\n return '';\n }\n \n public showInCollabsibleMenu(): boolean {\n return true;\n }\n \n public showCollapsibleMenu(): void {\n super.handleClick(null);\n }\n}\n\nCreateClipButton.prototype.controlText_ = 'Create clip';\n\nvideojs.registerComponent('CreateClipButton', CreateClipButton);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport 'projects/player/plugins/create-clip-button-plugin/components/create-clip-button';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface CreateClipButtonPluginOptions {\n onClick: () => void;\n}\n\nclass CreateClipButtonPlugin extends Plugin {\n private options: CreateClipButtonPluginOptions;\n\n constructor(player: VideoJsPlayer, options: CreateClipButtonPluginOptions) {\n super(player, options);\n\n this.options = options;\n\n player.ready(() => this.onReady());\n }\n\n private onReady(): void {\n const collapserator = this.player.getChild('collapserator');\n\n if (!collapserator)\n return;\n\n collapserator.addChild('CreateClipButton', {\n clickHandler: this.options.onClick\n });\n }\n}\n\nvideojs.registerPlugin('createClipButtonPlugin', CreateClipButtonPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n createClipButtonPlugin(options: CreateClipButtonPluginOptions): void;\n }\n}\n","import videojs from 'video.js';\n\nconst BasePictureInPictureToggle = videojs.getComponent('PictureInPictureToggle');\n\nclass PictureInPictureToggle extends BasePictureInPictureToggle {\n handlePictureInPictureEnabledChange() {\n (this as any).enable();\n }\n}\n\nvideojs.registerComponent('PictureInPictureToggle', PictureInPictureToggle);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './picture-in-picture.scss';\n\nimport './components/picture-in-picture-toggle';\n\nconst PlayToggle = videojs.getComponent('PlayToggle');\n\nconst Plugin = videojs.getPlugin('plugin');\n\nconst MIN_WIDTH = 800;\n\ninterface PictureInPicturePluginOptions {\n onRequestPictureInPicture: (isPiP: boolean) => void;\n}\n\nclass PictureInPicturePlugin extends Plugin {\n private options: PictureInPicturePluginOptions;\n private playerRequestPictureInPictureFn: () => Promise<videojs.PictureInPictureWindow>;\n private playerExitPictureInPictureFn: () => Promise<void>;\n private playToggle: videojs.Component;\n private toggle: videojs.Button;\n\n constructor(player: VideoJsPlayer, options: PictureInPicturePluginOptions) {\n super(player, options);\n\n this.options = options;\n\n this.bindFunctions();\n player.ready(() => this.initialize());\n }\n\n private bindFunctions(): void {\n this.requestPictureInPicture = this.requestPictureInPicture.bind(this);\n this.exitPictureInPicture = this.exitPictureInPicture.bind(this);\n this.onPlayerResize = this.onPlayerResize.bind(this);\n \n this.playerRequestPictureInPictureFn = this.player.requestPictureInPicture;\n this.playerExitPictureInPictureFn = this.player.exitPictureInPicture;\n \n this.player.requestPictureInPicture = this.requestPictureInPicture;\n this.player.exitPictureInPicture = this.exitPictureInPicture;\n }\n\n public initialize(): void {\n const toggleParent = this.player.getChild('collapserator');\n\n this.toggle = toggleParent.addChild('pictureInPictureToggle', {}) as videojs.Button;\n\n /**\n * By default the toggle is initialised in a disabled state.\n */\n this.toggle.enable();\n\n this.player.on('playerresize', this.onPlayerResize);\n\n this.player.on('dispose', () => {\n this.player?.off('playerresize', this.onPlayerResize);\n });\n }\n\n public togglePictureInPicture(isInPictureInPicture: boolean): void {\n if (isInPictureInPicture === this.player.isInPictureInPicture())\n return;\n\n const event = isInPictureInPicture ?\n 'enterpictureinpicture' :\n 'leavepictureinpicture';\n\n this.player.isInPictureInPicture(isInPictureInPicture);\n this.player.trigger(event);\n\n isInPictureInPicture ? this.addPipStyles() : this.removePipStyles();\n }\n\n private onPlayerResize(): void {\n /**\n * Don't enable/disable PiP while in PiP.\n */\n if (this.player.isInPictureInPicture())\n return;\n\n const playerRect = this.player.el().getBoundingClientRect();\n\n /**\n * In case our update function runs before our\n * player has properly rendered within the DOM\n */\n if (playerRect.width === 0)\n return;\n\n if (playerRect.width < MIN_WIDTH)\n this.toggle?.hide();\n else\n this.toggle?.show();\n }\n\n private addPipStyles(): void {\n this.player.addClass('cv-picture-in-picture');\n this.playToggle = new PlayToggle(this.player);\n this.playToggle.addClass('cv-pip-play-toggle');\n this.player.addChild(this.playToggle);\n\n if (this.player.paused())\n (this.playToggle as any).handlePause();\n else\n (this.playToggle as any).handlePlay();\n }\n\n private removePipStyles(): void {\n this.player.removeClass('cv-picture-in-picture');\n this.player.removeChild(this.playToggle);\n delete this.playToggle;\n }\n \n private requestPictureInPicture(): Promise<videojs.PictureInPictureWindow> {\n this.togglePictureInPicture(true);\n\n if (typeof this.options?.onRequestPictureInPicture === 'function')\n this.options.onRequestPictureInPicture(true);\n\n return;\n }\n\n private async exitPictureInPicture(): Promise<void> {\n this.togglePictureInPicture(false);\n this.options.onRequestPictureInPicture(false);\n this.removePipStyles();\n }\n\n public dispose(): void {\n this.player.requestPictureInPicture = this.playerRequestPictureInPictureFn;\n this.player.exitPictureInPicture = this.playerExitPictureInPictureFn;\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('pictureInPicture', PictureInPicturePlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n pictureInPicture(options?: PictureInPicturePluginOptions): PictureInPicturePlugin;\n isInPictureInPicture(isPiP?: boolean): boolean | void;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { EventsService, StaticEventsService } from 'libs/common/react/services/EventsService';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\n\nimport { MouseTimeDisplay } from 'projects/player/components/mouse-time-display/mouse-time-display';\nimport { TimeTooltip } from 'projects/player/components/time-tooltip/time-tooltip';\n\nimport './point-of-interest-indicator.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface PointOfInterestIndicatorOptions extends videojs.ComponentOptions {\n pointOfInterest: PointOfInterest;\n}\n\nexport class PointOfInterestIndicator extends Component {\n private el_: HTMLElement;\n public options_: PointOfInterestIndicatorOptions;\n\n private eventsService: StaticEventsService;\n\n private pointOfInterest: PointOfInterest;\n private hasBuffered: boolean = false;\n private hasPlayed: boolean = false;\n\n constructor(player: VideoJsPlayer, options: PointOfInterestIndicatorOptions) {\n super(player, options);\n\n this.eventsService = EventsService;\n\n this.pointOfInterest = options.pointOfInterest;\n\n this.onMouseOver = this.onMouseOver.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n this.onGlancePointOfInterestMouseEnter = this.onGlancePointOfInterestMouseEnter.bind(this);\n this.onGlancePointOfInterestMouseLeave = this.onGlancePointOfInterestMouseLeave.bind(this);\n\n this.initialize();\n }\n\n public initialize(): void {\n this.setPosition();\n this.bindListeners();\n }\n\n public buildCSSClass(): string {\n return `cv-point-of-interest-indicator ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n return super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n }\n\n private bindListeners(): void {\n this.on('mouseover', this.onMouseOver);\n this.on('mouseleave', this.onMouseLeave);\n\n this.eventsService.subscribe('glance:poi:mouseover', this.onGlancePointOfInterestMouseEnter);\n this.eventsService.subscribe('glance:poi:mouseleave', this.onGlancePointOfInterestMouseLeave);\n }\n\n public dispose(): void {\n this.eventsService.unsubscribe('glance:poi:mouseover', this.onGlancePointOfInterestMouseEnter);\n this.eventsService.unsubscribe('glance:poi:mouseleave', this.onGlancePointOfInterestMouseLeave);\n }\n\n private getPointOfInterestTime(): number {\n return this.pointOfInterest.startTime;\n }\n\n private setPosition(): void {\n const duration = this.player().duration();\n this.el_.style.left = (this.getPointOfInterestTime() / duration * 100) + '%';\n }\n\n public updateBuffered(bufferEnd: number): void {\n const hasBuffered = this.getPointOfInterestTime() <= bufferEnd;\n\n if (hasBuffered === this.hasBuffered)\n return;\n\n this.hasBuffered = hasBuffered;\n\n const bufferedClassName = 'cv-point-of-interest-indicator-buffered';\n\n if (this.hasBuffered)\n this.addClass(bufferedClassName);\n else\n this.removeClass(bufferedClassName);\n }\n\n public updatePlaybackProgress(currentTime: number): void {\n const hasPlayed = this.getPointOfInterestTime() <= currentTime;\n\n if (hasPlayed === this.hasPlayed)\n return;\n\n this.hasPlayed = hasPlayed;\n\n const className = 'cv-point-of-interest-indicator-played';\n\n if (hasPlayed)\n this.addClass(className);\n else\n this.removeClass(className);\n }\n\n public toggleVisibility(visible: boolean): void {\n const visibilityClassName = 'cv-point-of-interest-indicator-hidden';\n\n if (visible)\n this.removeClass(visibilityClassName);\n else\n this.addClass(visibilityClassName);\n }\n\n /**\n * We want the POI description to be displayed in the TimeTooltip when the user\n * hovers over a POI.\n * Because we don't know the exact time range on the seekbar covered by a POI indicator,\n * TimeTooltip can't use the current time to determine the active POI cue the same way\n * that it does for chapters. So instead we use the mouse events on this component and\n * set it manually.\n */\n private onMouseOver(): void {\n this.setTimeTooltipText();\n this.eventsService.trigger('player:poi:mouseover', this.pointOfInterest);\n }\n\n private onMouseLeave(): void {\n this.clearTimeTooltipText();\n this.eventsService.trigger('player:poi:mouseleave');\n }\n\n private onGlancePointOfInterestMouseEnter(pointOfInterest: PointOfInterest): void {\n if (pointOfInterest.id !== this.pointOfInterest.id)\n return;\n\n this.addClass('cv-point-of-interest-indicator-highlight');\n this.setTimeTooltipTime();\n this.setTimeTooltipText();\n this.positionMouseTimeDisplay();\n this.showMouseTimeDisplay();\n }\n\n private onGlancePointOfInterestMouseLeave(): void {\n this.removeClass('cv-point-of-interest-indicator-highlight');\n this.hideMouseTimeDisplay();\n }\n\n private setTimeTooltipText(): void {\n this.getTimeTooltip()?.setCustomChapterText(this.pointOfInterest.description);\n }\n\n private clearTimeTooltipText(): void {\n this.getTimeTooltip()?.setCustomChapterText();\n }\n\n /**\n * We only need to call this when we're manually forcing the MouseTimeDisplay\n * to show. If it's being triggered natively using pointer events then the time\n * will be set automatically.\n */\n private setTimeTooltipTime(): void {\n const timeTooltip = this.getTimeTooltip();\n timeTooltip?.updateTime(this.getPointOfInterestTime());\n }\n\n private positionMouseTimeDisplay(): void {\n const seekBarEl = this.getSeekBar()?.el();\n\n if (!seekBarEl)\n return;\n\n const seekBarRect = videojs.dom.findPosition(seekBarEl) as ClientRect;\n const point = this.getPointOfInterestTime() / this.player().duration();\n\n this.getMouseTimeDisplay()?.update(seekBarRect, point);\n }\n\n private showMouseTimeDisplay(): void {\n this.getMouseTimeDisplay()?.forceShow();\n }\n\n private hideMouseTimeDisplay(): void {\n this.getMouseTimeDisplay()?.removeForceShow();\n }\n\n private getSeekBar(): videojs.SeekBar {\n return this.player().controlBar\n .getChild('ProgressControl')\n ?.getChild('SeekBar') as videojs.SeekBar;\n }\n\n private getMouseTimeDisplay(): MouseTimeDisplay {\n return this.getSeekBar()\n ?.getChild('MouseTimeDisplay') as MouseTimeDisplay;\n }\n\n private getTimeTooltip(): TimeTooltip {\n return this.getMouseTimeDisplay()\n ?.getChild('TimeTooltip') as TimeTooltip;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './points-of-interest-menu-item.scss';\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\ninterface PointsOfInterestMenuItemOptions extends videojs.MenuItemOptions {\n pointsOfInterestVisible: boolean;\n}\n\nexport class PointsOfInterestMenuItem extends MenuItem {\n private toggleEl: Element;\n private pointsOfInterestVisible: boolean;\n\n /**\n * Because we want to bind our listener in createEl\n * and createEl runs in super. We store if we've bounud\n * our handler, so we only call bind once and \n * the call to removeEventListener will still work\n */\n private handlerBound: boolean;\n\n constructor(player: VideoJsPlayer, options: PointsOfInterestMenuItemOptions) {\n super(player, options);\n\n this.pointsOfInterestVisible = options.pointsOfInterestVisible;\n this.toggle(this.pointsOfInterestVisible);\n }\n\n public handleToggle(): void {\n this.toggle(!this.pointsOfInterestVisible);\n }\n\n private toggle(state: boolean): void {\n state ? this.toggleOn() : this.toggleOff();\n }\n\n private toggleOn(): void {\n videojs.dom.addClass(this.toggleEl, 'on');\n videojs.dom.setAttribute(this.toggleEl, 'aria-checked', 'true');\n this.pointsOfInterestVisible = true;\n this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible);\n }\n\n private toggleOff(): void {\n videojs.dom.removeClass(this.toggleEl, 'on');\n videojs.dom.setAttribute(this.toggleEl, 'aria-checked', 'false');\n this.pointsOfInterestVisible = false;\n this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible);\n }\n\n /**\n * Because we extend MenuItem which will close the menu by default\n * we need to halt the event propogation here\n */\n public handleClick(event: videojs.EventTarget.Event): void {\n event.stopImmediatePropagation();\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): HTMLLIElement {\n /**\n * Bind our event listener only once\n * see the comment where handlerBound is defined\n */\n if (!this.handlerBound) {\n this.handleToggle = this.handleToggle.bind(this);\n this.handlerBound = true;\n }\n\n if (this.toggleEl)\n this.toggleEl.removeEventListener('click', this.handleToggle);\n\n this.toggleEl = videojs.dom.createEl('div', {\n className: `custom-toggle custom-toggle-info toggle-option float-end`,\n innerHTML: '<span class=\"handle\"></span></div>'\n });\n videojs.dom.setAttribute(this.toggleEl, 'id', 'poi-toggle');\n videojs.dom.setAttribute(this.toggleEl, 'role', 'switch');\n this.toggleEl.addEventListener('click', this.handleToggle);\n\n const innerHTML = `\n <span for=\"poi-toggle\" class=\"vjs-menu-item-text\">Points of Interest</span>\n <span class=\"cv-toggle-container\"></span>`;\n\n const el = super.createEl(tagName, {\n className: 'vjs-menu-item cv-cog-menu-item cv-poi-toggle',\n innerHTML\n }, attributes);\n\n /**\n * Indexing into the child this way is only safe to do because\n * we know that the el only has two children\n */\n el.children[1].appendChild(this.toggleEl);\n\n return el;\n }\n}\n\nvideojs.registerComponent('PointsOfInterestMenuItem', PointsOfInterestMenuItem);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\n\nimport { CogButton } from 'projects/player/components/cog-button/cog-button';\nimport { getBufferedEnd } from 'projects/player/utils/getBufferedEnd';\nimport { LocalStorageHelper } from 'projects/player/utils/local-storage-helper';\n\nimport { PointOfInterestIndicator } from './components/point-of-interest-indicator/point-of-interest-indicator';\nimport { PointsOfInterestMenuItem } from './components/points-of-interest-menu-item/points-of-interest-menu-item';\n\nconst Plugin = videojs.getPlugin('plugin');\n\nconst POINTS_OF_INTEREST = 'cvplayer-points-of-interest';\n\ninterface PointsOfInterestPluginOptions {\n pointsOfInterest: PointOfInterest[];\n}\n\nexport class PointsOfInterestPlugin extends Plugin {\n private pointOfInterestIndicators: PointOfInterestIndicator[] = [];\n private pointsOfInterest?: PointOfInterest[];\n private enabled: boolean = true;\n\n constructor(player: VideoJsPlayer, options?: PointsOfInterestPluginOptions) {\n super(player);\n\n this.pointsOfInterest = options?.pointsOfInterest;\n \n this.initialize = this.initialize.bind(this);\n this.updateBuffered = this.updateBuffered.bind(this);\n this.updatePlaybackProgress = this.updatePlaybackProgress.bind(this);\n\n this.player.one('loadedmetadata', () => this.player.ready(this.initialize));\n }\n\n private initialize(): void {\n if (!this.pointsOfInterest)\n return;\n\n if (LocalStorageHelper.hasLocalStorage() && LocalStorageHelper.get(POINTS_OF_INTEREST) === 'false')\n this.enabled = false;\n\n this.setupTrack();\n this.createPointOfInterestIndicators();\n this.addMenuItem();\n this.bindListeners();\n }\n\n private bindListeners(): void {\n this.player.on('progress', this.updateBuffered);\n this.player.on('timeupdate', this.updatePlaybackProgress);\n\n this.player.on('dispose', () => {\n this.player?.off('progress', this.updateBuffered);\n this.player?.off('timeupdate', this.updatePlaybackProgress);\n });\n }\n\n public togglePointsOfInterest(visible: boolean): void {\n LocalStorageHelper.set(POINTS_OF_INTEREST, visible.toString());\n this.pointOfInterestIndicators.forEach(p => p.toggleVisibility(visible));\n }\n\n private setupTrack(): void {\n const track = this.player.addTextTrack('metadata', 'pointsofinterest') as any;\n\n this.pointsOfInterest.forEach(p => {\n track.addCue({\n startTime: p.startTime,\n endTime: p.endTime,\n text: p.description\n });\n });\n\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n }\n\n private createPointOfInterestIndicators(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n \n this.pointsOfInterest.forEach(pointOfInterest => {\n const component = new PointOfInterestIndicator(this.player, { pointOfInterest });\n this.pointOfInterestIndicators.push(component);\n seekBar.addChild(component);\n });\n }\n\n private addMenuItem(): void {\n /**\n * Check additionalItemOrder in cog-button.ts if you need to change the order. - Sha\n */\n const cogButton = this.player.getChild('collapserator')?.getChild('cogButton') as CogButton;\n cogButton.addItem({\n ctor: PointsOfInterestMenuItem,\n name: 'PointsOfInterestMenuItem',\n options: { pointsOfInterestVisible: this.enabled }\n });\n }\n\n private updateBuffered(): void {\n this.pointOfInterestIndicators.forEach(p => p.updateBuffered(getBufferedEnd(this.player)));\n }\n\n private updatePlaybackProgress(): void {\n this.pointOfInterestIndicators.forEach(p => p.updatePlaybackProgress(this.player.currentTime()));\n }\n}\n\nvideojs.registerPlugin('pointsOfInterestPlugin', PointsOfInterestPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n pointsOfInterestPlugin(options?: PointsOfInterestPluginOptions): PointsOfInterestPlugin;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './range-indicator.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface RangeIndicatorOptions extends videojs.ComponentOptions {\n time: number;\n}\n\nexport class RangeIndicator extends Component {\n private el_: HTMLElement;\n public options_: RangeIndicatorOptions;\n\n constructor(player: VideoJsPlayer, options: RangeIndicatorOptions) {\n super(player, options);\n\n this.initialize();\n }\n\n public initialize(): void {\n this.setPosition();\n }\n\n public buildCSSClass(): string {\n return `cv-range-indicator ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n return super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n }\n\n private setPosition(): void {\n const duration = this.player().duration();\n this.el_.style.left = (this.options_.time / duration * 100) + '%';\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './replay-view-button.scss';\n\nconst ClickableComponent = videojs.getComponent('ClickableComponent');\n\ninterface ReplayViewButtonOptions extends videojs.ComponentOptions {\n onPress: () => void;\n label: string;\n iconClassName: 'cv-replay-icon' | 'cv-continue-icon';\n}\n\nexport class ReplayViewButton extends ClickableComponent {\n public options_: ReplayViewButtonOptions;\n\n constructor(player: VideoJsPlayer, options: ReplayViewButtonOptions) {\n super(player, options);\n }\n\n public buildCSSClass(): string {\n return `cv-replay-view-button ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n const el = super.createEl(tagName, {\n ...properties,\n innerHTML: `<span class=\"${this.options_.iconClassName}\"></span><span>${this.options_.label}</span>`,\n className: this.buildCSSClass()\n }, attributes);\n\n return el;\n }\n\n public handleClick() {\n this.options_.onPress();\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { ReplayViewButton } from 'projects/player/plugins/range-indicator-plugin/components/replay-view-button/replay-view-button';\n\nimport './replay-view.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface ReplayViewOptions extends videojs.ComponentOptions {\n onContinuePress: () => void;\n onReplayPress: () => void;\n}\n\nexport class ReplayView extends Component {\n public options_: ReplayViewOptions;\n\n constructor(player: VideoJsPlayer, options: ReplayViewOptions) {\n super(player, options);\n }\n\n public buildCSSClass(): string {\n return `cv-replay-view ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n const el = super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n\n const heading = videojs.dom.createEl('h5', {\n innerHTML: this.localize('This clip has finished'),\n className: 'cv-replay-heading'\n });\n\n const buttonContainer = videojs.dom.createEl('div', {\n className: 'cv-button-container'\n });\n\n const replayButton = new ReplayViewButton(this.player_, {\n label: this.localize('Replay clip'),\n iconClassName: 'cv-replay-icon',\n onPress: this.options_.onReplayPress\n });\n\n const continueButton = new ReplayViewButton(this.player_, {\n label: this.localize('Continue watching'),\n iconClassName: 'cv-continue-icon',\n onPress: this.options_.onContinuePress\n });\n\n el.appendChild(heading);\n el.appendChild(buttonContainer);\n \n buttonContainer.appendChild(replayButton.el());\n buttonContainer.appendChild(continueButton.el());\n \n return el;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { RangeIndicator } from './components/range-indicator/range-indicator';\nimport { ReplayView } from './components/replay-view/replay-view';\n\nimport './range-indicator-plugin.scss';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface RangeIndicatorPluginOptions {\n startTime: number;\n endTime: number;\n}\n\nclass RangeIndicatorPlugin extends Plugin {\n private startTime: number;\n private endTime: number;\n private dismissed: boolean;\n private startTimeIndicator?: RangeIndicator;\n private endTimeIndicator?: RangeIndicator;\n private replayView?: ReplayView;\n\n constructor(player: VideoJsPlayer, options: RangeIndicatorPluginOptions) {\n super(player, options);\n\n this.startTime = parseFloat(options.startTime.toPrecision(4));\n this.endTime = parseFloat(options.endTime.toPrecision(4));\n this.dismissed = false;\n \n if (this.startTime > this.endTime)\n throw Error('Range start cannot be greater than range end');\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.onReady = this.onReady.bind(this);\n this.onTimeUpdateOrSeeked = this.onTimeUpdateOrSeeked.bind(this);\n this.onReplayPress = this.onReplayPress.bind(this);\n this.onContinuePress = this.onContinuePress.bind(this);\n }\n\n private initialize(): void {\n this.player.one('loadedmetadata', () => this.player.ready(this.onReady));\n this.player.on('timeupdate', this.onTimeUpdateOrSeeked);\n this.player.on('seeked', this.onTimeUpdateOrSeeked);\n }\n\n private onReady(): void {\n this.addCssClasses();\n this.showRangeIndicators();\n this.addMaskToProgressBar();\n }\n\n private onTimeUpdateOrSeeked(): void {\n if (this.dismissed) return;\n\n const currentTime = this.player.currentTime();\n\n if (currentTime < this.startTime) {\n this.player.currentTime(this.startTime);\n\n return;\n }\n\n if (currentTime > this.endTime) {\n this.showReplayView();\n this.disablePlayToggle();\n this.player.pause();\n this.player.currentTime(this.endTime);\n\n return;\n }\n }\n\n private onReplayPress(): void {\n this.player.currentTime(this.startTime);\n this.player.play();\n this.hideReplayView();\n this.enablePlayToggle();\n }\n\n private onContinuePress(): void {\n this.dismissed = true;\n this.player.play();\n this.hideRangeIndicators();\n this.removeMaskFromProgressBar();\n this.hideReplayView();\n this.enablePlayToggle();\n this.removeCssClasses();\n }\n\n private showRangeIndicators(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n\n if (!this.startTimeIndicator) {\n this.startTimeIndicator = new RangeIndicator(this.player, { time: this.startTime });\n seekBar?.addChild(this.startTimeIndicator);\n }\n\n if (!this.endTimeIndicator) {\n this.endTimeIndicator = new RangeIndicator(this.player, { time: this.endTime });\n seekBar?.addChild(this.endTimeIndicator);\n }\n }\n\n private hideRangeIndicators(): void {\n this.startTimeIndicator?.hide();\n this.endTimeIndicator?.hide();\n }\n\n private addMaskToProgressBar(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n const elements = seekBar?.el().getElementsByClassName('cv-chapter-bar-items');\n\n if (elements && elements.length) {\n const progressBar = elements[0] as HTMLElement;\n const duration = this.player.duration();\n const leftInset = this.startTime / duration * 100;\n const rightInset = 100 - (this.endTime / duration * 100);\n const verticalInset = -5; // Increase the mask vertically to account for the thumbtack during scrubbing\n\n progressBar.style.clipPath = `inset(${verticalInset}em ${rightInset}% ${verticalInset}em ${leftInset}%)`;\n }\n }\n\n private removeMaskFromProgressBar(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n const elements = seekBar?.el().getElementsByClassName('cv-chapter-bar-items');\n\n if (elements && elements.length) {\n const progressBar = elements[0] as HTMLElement;\n\n progressBar.style.clipPath = '';\n }\n }\n\n private showReplayView(): void {\n if (!this.replayView) {\n this.replayView = new ReplayView(this.player, {\n onContinuePress: this.onContinuePress,\n onReplayPress: this.onReplayPress\n });\n \n this.player.addChild(this.replayView);\n }\n\n this.replayView.show();\n }\n\n private hideReplayView(): void {\n this.replayView?.hide();\n }\n\n private getPlayToggle(): videojs.Button | undefined {\n const collapserator = this.player.getChild('collapserator');\n return collapserator?.getChild('PlayToggle') as videojs.Button;\n }\n\n private enablePlayToggle(): void {\n const playToggle = this.getPlayToggle();\n \n if (playToggle)\n playToggle.enable();\n }\n\n private disablePlayToggle(): void {\n const playToggle = this.getPlayToggle();\n \n if (playToggle)\n playToggle.disable();\n }\n\n private addCssClasses(): void {\n this.player.addClass('cv-range-indicator-plugin');\n }\n\n private removeCssClasses(): void {\n this.player.removeClass('cv-range-indicator-plugin');\n }\n\n public dispose(): void {\n this.removeCssClasses();\n\n this.player.off('timeupdate', this.onTimeUpdateOrSeeked);\n this.player.off('seeked', this.onTimeUpdateOrSeeked);\n \n this.startTimeIndicator?.dispose();\n this.endTimeIndicator?.dispose();\n this.replayView?.dispose();\n\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('rangeIndicatorPlugin', RangeIndicatorPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n rangeIndicatorPlugin(options: RangeIndicatorPluginOptions): void;\n }\n}\n","export const IdHelper = {\n generateRandomId: () => {\n return (window.crypto as any)?.randomUUID?.() ?? Math.random().toString();\n }\n};\n","/* eslint simple-import-sort/imports: 0 */\n\nimport { VideoJsPlayerOptions } from 'video.js';\nimport { BasePlayer, BasePlayerOptions } from './base-player';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\nimport { ShareActivityStatus } from 'libs/shared/enums/ShareActivityStatus';\nimport 'projects/player/plugins/clip-plugin/clip-plugin';\n\nimport 'projects/player/plugins/create-clip-button-plugin/create-clip-button-plugin';\n\nimport 'projects/player/plugins/picture-in-picture-plugin/picture-in-picture-plugin';\nimport 'projects/player/plugins/points-of-interest-plugin/points-of-interest-plugin';\nimport 'projects/player/plugins/activity-status-plugin/activity-status-plugin';\nimport 'projects/player/plugins/range-indicator-plugin/range-indicator-plugin';\nimport 'projects/player/plugins/theatre-mode-plugin/theatre-mode-plugin';\nimport 'projects/player/plugins/loop-video-plugin/loop-video-plugin';\n\nimport { PlaybackObject } from 'projects/player/interfaces/models/PlaybackObject';\nimport { ClipData } from 'projects/player/interfaces/models/ClipData';\nimport { NextVideo } from 'projects/player/interfaces/NextVideo';\n\nimport { IdHelper } from '../utils/id-helper';\nimport { TrackHelper } from 'projects/player/utils/track-helper';\n\nexport interface PlayerOptions extends BasePlayerOptions {\n showResources?: boolean;\n pointsOfInterest?: PointOfInterest[];\n}\n\nexport class Player extends BasePlayer {\n declare protected options: PlayerOptions;\n\n constructor(id: string | Element, options: PlayerOptions) {\n super(id, options);\n }\n\n protected getPlayerOptions(): VideoJsPlayerOptions {\n const options = super.getPlayerOptions();\n\n if (this.options.allowTranscript) {\n options.allowTranscript = true;\n }\n\n if (options.devicesConfig?.canUserCastToDevices) {\n return {\n ...options,\n techOrder: [ 'devices', ...options.techOrder ],\n devices: {\n instanceId: IdHelper.generateRandomId()\n }\n };\n }\n\n return options;\n }\n\n protected configurePlugins(): void {\n try {\n if (this.options.onClickCreateClip) {\n this.player.createClipButtonPlugin({\n onClick: this.options.onClickCreateClip\n });\n }\n\n if (this.options.onRequestPictureInPicture) {\n this.player.pictureInPicture({\n onRequestPictureInPicture: this.options.onRequestPictureInPicture\n });\n }\n\n if (this.options.pointsOfInterest?.length) {\n this.player.pointsOfInterestPlugin({\n pointsOfInterest: this.options.pointsOfInterest\n });\n }\n\n this.player.loopVideoPlugin({ allowLoop: this.options.allowLoop });\n } catch (ex) {\n console.log('failed to register plugins', ex);\n }\n }\n\n public setNextVideo(nextVideo: NextVideo, playNext: boolean, onPlayNext: () => void): void {\n /**\n * Next video plugin needs to be imported separately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (!this.player.nextVideoPlugin)\n return;\n\n const plugin = this.player.nextVideoPlugin();\n plugin.setNextVideo(nextVideo, playNext, onPlayNext);\n }\n\n public togglePictureInPicture(isInPictureInPicture: boolean): void {\n const plugin = this.player.pictureInPicture();\n\n if (plugin)\n plugin.togglePictureInPicture(isInPictureInPicture);\n }\n\n public toggleTheatreMode(status?: boolean): void {\n const plugin = this.player.theatreModePlugin();\n\n if (plugin)\n plugin.toggleTheatreMode(status, { shouldLog: true });\n }\n\n public toggleTranscript(status?: boolean): void {\n if (!this.player.viewTranscriptPlugin)\n return;\n\n const plugin = this.player.viewTranscriptPlugin();\n\n if (plugin)\n plugin.toggleTranscript(status);\n }\n\n public hasStarted(): boolean {\n return this.player.hasStarted();\n }\n\n protected async additionalSetup(playbackObject: PlaybackObject): Promise<void> {\n // instantiate before calling super\n // ensure the theatreMode is set up first before theatre mode registerAnalytics is called\n if (this.options.onRequestTheatreMode && this.options.allowTheatreMode && this.player.theatreModePlugin) {\n this.player.theatreModePlugin({\n onRequestTheatreMode: this.options.onRequestTheatreMode,\n theatreMode: this.options.theatreMode,\n playbackObject\n });\n }\n\n super.additionalSetup(playbackObject);\n\n /**\n * Resources plugin needs to be imported seperately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (this.options.showResources && playbackObject.resources && this.player.resourcesPlugin) {\n this.player.resourcesPlugin({\n resources: playbackObject.resources.list,\n imageCdnUrl: this.options.imageCdnUrl\n });\n }\n\n if (playbackObject.mediaType === 'MasterClip') {\n const clipData = playbackObject.additionalData as ClipData;\n\n if (clipData === null)\n throw Error('Invalid clip data');\n\n this.player.clipPlugin({\n startTime: clipData.startTime,\n endTime: clipData.endTime\n });\n }\n\n /**\n * The range indicator plugin is only applicable when watching videos\n */\n if (playbackObject.mediaType === 'MasterVideo' && this.options.startTime && this.options.endTime) {\n this.player.rangeIndicatorPlugin({\n startTime: this.options.startTime,\n endTime: this.options.endTime\n });\n }\n }\n\n protected setupAnalyticsDependentPlugins(playbackObject: PlaybackObject): void {\n super.setupAnalyticsDependentPlugins(playbackObject);\n\n if (this.options.allowTranscript) {\n this.player.viewTranscriptPlugin().registerAnalytics(\n this.analyticsService,\n playbackObject\n );\n }\n\n if (this.options.onRequestTheatreMode && this.options.allowTheatreMode && this.player.theatreModePlugin) {\n this.player.theatreModePlugin().registerAnalytics(\n this.analyticsService\n );\n }\n\n /**\n * The devices plugin needs to be imported separately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (this.options.devicesConfig?.canUserCastToDevices && this.player.devicesPlugin) {\n this.player.devicesPlugin({\n ...this.options.devicesConfig,\n userId: parseInt(playbackObject.viewerId),\n title: playbackObject.title,\n analyticsService: this.analyticsService\n });\n }\n }\n\n public setActivityStatus(status: ShareActivityStatus, onToggle: () => void): void {\n const plugin = this.player.activityStatusPlugin();\n plugin.setActivityStatus(status, onToggle);\n }\n\n public useCurrentTranscript(callback: (track: TextTrack) => void, language?: string): void {\n // eslint-disable-next-line react-hooks/rules-of-hooks \n TrackHelper.useMetadataTracks(this.player, 'transcript', callback, language);\n }\n\n public useChapters(callback: (track: TextTrack) => void): void {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n TrackHelper.useChapters(this.player, callback);\n }\n}\n","/**\n* jQuery core object.\n*\n* Worker with jQuery deferred\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/core.js\n*\n*/\n\nvar jQuery = module.exports = {\n\ttype: type\n\t, isArray: isArray\n\t, isFunction: isFunction\n\t, isPlainObject: isPlainObject\n\t, each: each\n\t, extend: extend\n\t, noop: function() {}\n};\n\nvar toString = Object.prototype.toString;\n\nvar class2type = {};\n// Populate the class2type map\n\"Boolean Number String Function Array Date RegExp Object\".split(\" \").forEach(function(name) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\n\nfunction type( obj ) {\n\treturn obj == null ?\n\t\tString( obj ) :\n\t\t\tclass2type[ toString.call(obj) ] || \"object\";\n}\n\nfunction isFunction( obj ) {\n\treturn jQuery.type(obj) === \"function\";\n}\n\nfunction isArray( obj ) {\n\treturn jQuery.type(obj) === \"array\";\n}\n\nfunction each( object, callback, args ) {\n\tvar name, i = 0,\n\tlength = object.length,\n\tisObj = length === undefined || isFunction( object );\n\n\tif ( args ) {\n\t\tif ( isObj ) {\n\t\t\tfor ( name in object ) {\n\t\t\t\tif ( callback.apply( object[ name ], args ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( ; i < length; ) {\n\t\t\t\tif ( callback.apply( object[ i++ ], args ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// A special, fast, case for the most common use of each\n\t} else {\n\t\tif ( isObj ) {\n\t\t\tfor ( name in object ) {\n\t\t\t\tif ( callback.call( object[ name ], name, object[ name ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( ; i < length; ) {\n\t\t\t\tif ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction isPlainObject( obj ) {\n\t// Must be an Object.\n\tif ( !obj || jQuery.type(obj) !== \"object\" ) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction extend() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\ttarget = arguments[0] || {},\n\ti = 1,\n\tlength = arguments.length,\n\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n\t\ttarget = {};\n\t}\n\n\t// extend jQuery itself if only one argument is passed\n\tif ( length === i ) {\n\t\ttarget = this;\n\t\t--i;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\t\t// Only deal with non-null/undefined values\n\t\tif ( (options = arguments[ i ]) != null ) {\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray(src) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject(src) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\n\n","var jQuery = module.exports = require(\"./jquery-core.js\"),\n\tcore_rspace = /\\s+/;\n/**\n* jQuery Callbacks\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/callbacks.js\n*\n*/\n\n\n// String to Object options format cache\nvar optionsCache = {};\n\n// Convert String-formatted options into Object-formatted ones and store in cache\nfunction createOptions( options ) {\n\tvar object = optionsCache[ options ] = {};\n\tjQuery.each( options.split( core_rspace ), function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t});\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\t( optionsCache[ options ] || createOptions( options ) ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Last fire value (for non-forgettable lists)\n\t\tmemory,\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\t\t// Flag to know if list is currently firing\n\t\tfiring,\n\t\t// First callback to fire (used internally by add and fireWith)\n\t\tfiringStart,\n\t\t// End of the loop when firing\n\t\tfiringLength,\n\t\t// Index of currently firing callback (modified by remove if needed)\n\t\tfiringIndex,\n\t\t// Actual callback list\n\t\tlist = [],\n\t\t// Stack of fire calls for repeatable lists\n\t\tstack = !options.once && [],\n\t\t// Fire callbacks\n\t\tfire = function( data ) {\n\t\t\tmemory = options.memory && data;\n\t\t\tfired = true;\n\t\t\tfiringIndex = firingStart || 0;\n\t\t\tfiringStart = 0;\n\t\t\tfiringLength = list.length;\n\t\t\tfiring = true;\n\t\t\tfor ( ; list && firingIndex < firingLength; firingIndex++ ) {\n\t\t\t\tif ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {\n\t\t\t\t\tmemory = false; // To prevent further calls using add\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiring = false;\n\t\t\tif ( list ) {\n\t\t\t\tif ( stack ) {\n\t\t\t\t\tif ( stack.length ) {\n\t\t\t\t\t\tfire( stack.shift() );\n\t\t\t\t\t}\n\t\t\t\t} else if ( memory ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t} else {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Actual Callbacks object\n\t\tself = {\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\t// First, we save the current length\n\t\t\t\t\tvar start = list.length;\n\t\t\t\t\t(function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tvar type = jQuery.type( arg );\n\t\t\t\t\t\t\tif ( type === \"function\" ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && type !== \"string\" ) {\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})( arguments );\n\t\t\t\t\t// Do we need to add the callbacks to the\n\t\t\t\t\t// current firing batch?\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tfiringLength = list.length;\n\t\t\t\t\t// With memory, if we're not firing then\n\t\t\t\t\t// we should call right away\n\t\t\t\t\t} else if ( memory ) {\n\t\t\t\t\t\tfiringStart = start;\n\t\t\t\t\t\tfire( memory );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\t\tvar index;\n\t\t\t\t\t\twhile( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\t\tlist.splice( index, 1 );\n\t\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\t\t\tif ( index <= firingLength ) {\n\t\t\t\t\t\t\t\t\tfiringLength--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Control if a given callback is in the list\n\t\t\thas: function( fn ) {\n\t\t\t\treturn jQuery.inArray( fn, list ) > -1;\n\t\t\t},\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tlist = [];\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Have the list do nothing anymore\n\t\t\tdisable: function() {\n\t\t\t\tlist = stack = memory = undefined;\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it disabled?\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\t\t\t// Lock the list in its current state\n\t\t\tlock: function() {\n\t\t\t\tstack = undefined;\n\t\t\t\tif ( !memory ) {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it locked?\n\t\t\tlocked: function() {\n\t\t\t\treturn !stack;\n\t\t\t},\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\targs = args || [];\n\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\tif ( list && ( !fired || stack ) ) {\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tstack.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfire( args );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\n\n","\n/*!\n* jquery-deferred\n* Copyright(c) 2011 Hidden <zzdhidden@gmail.com>\n* MIT Licensed\n*/\n\n/**\n* Library version.\n*/\n\nvar jQuery = module.exports = require(\"./jquery-callbacks.js\"),\n\tcore_slice = Array.prototype.slice;\n\n/**\n* jQuery deferred\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/deferred.js\n* Doc: http://api.jquery.com/category/deferred-object/\n*\n*/\n\njQuery.extend({\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\t\t\t\t// action, add listener, listener list, final state\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), \"rejected\" ],\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks(\"memory\") ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tthen: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\t\t\t\t\treturn jQuery.Deferred(function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\t\t\t\t\tvar action = tuple[ 0 ],\n\t\t\t\t\t\t\t\tfn = fns[ i ];\n\t\t\t\t\t\t\t// deferred[ done | fail | progress ] for forwarding actions to newDefer\n\t\t\t\t\t\t\tdeferred[ tuple[1] ]( jQuery.isFunction( fn ) ?\n\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\tvar returned = fn.apply( this, arguments );\n\t\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject )\n\t\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tnewDefer[ action + \"With\" ]( this === deferred ? newDefer : this, [ returned ] );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\tnewDefer[ action ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t}).promise();\n\t\t\t\t},\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Keep pipe for back-compat\n\t\tpromise.pipe = promise.then;\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 3 ];\n\n\t\t\t// promise[ done | fail | progress ] = list.add\n\t\t\tpromise[ tuple[1] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(function() {\n\t\t\t\t\t// state = [ resolved | rejected ]\n\t\t\t\t\tstate = stateString;\n\n\t\t\t\t// [ reject_list | resolve_list ].disable; progress_list.lock\n\t\t\t\t}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );\n\t\t\t}\n\n\t\t\t// deferred[ resolve | reject | notify ] = list.fire\n\t\t\tdeferred[ tuple[0] ] = list.fire;\n\t\t\tdeferred[ tuple[0] + \"With\" ] = list.fireWith;\n\t\t});\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( subordinate /* , ..., subordinateN */ ) {\n\t\tvar i = 0,\n\t\t\tresolveValues = core_slice.call( arguments ),\n\t\t\tlength = resolveValues.length,\n\n\t\t\t// the count of uncompleted subordinates\n\t\t\tremaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,\n\n\t\t\t// the master Deferred. If resolveValues consist of only a single Deferred, just use that.\n\t\t\tdeferred = remaining === 1 ? subordinate : jQuery.Deferred(),\n\n\t\t\t// Update function for both resolve and progress values\n\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tprogressValues, progressContexts, resolveContexts;\n\n\t\t// add listeners to Deferred subordinates; treat others as resolved\n\t\tif ( length > 1 ) {\n\t\t\tprogressValues = new Array( length );\n\t\t\tprogressContexts = new Array( length );\n\t\t\tresolveContexts = new Array( length );\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {\n\t\t\t\t\tresolveValues[ i ].promise()\n\t\t\t\t\t\t.done( updateFunc( i, resolveContexts, resolveValues ) )\n\t\t\t\t\t\t.fail( deferred.reject )\n\t\t\t\t\t\t.progress( updateFunc( i, progressContexts, progressValues ) );\n\t\t\t\t} else {\n\t\t\t\t\t--remaining;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if we're not waiting on anything, resolve the master\n\t\tif ( !remaining ) {\n\t\t\tdeferred.resolveWith( resolveContexts, resolveValues );\n\t\t}\n\n\t\treturn deferred.promise();\n\t}\n});\n","\nmodule.exports = require('./lib/jquery-deferred');","/**\n * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT\n */\n(function (global) {\n 'use strict';\n\n var param = function (a) {\n var s = [], rbracket = /\\[\\]$/,\n isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n }, add = function (k, v) {\n v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v;\n s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v);\n }, buildParams = function (prefix, obj) {\n var i, len, key;\n\n if (prefix) {\n if (isArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n if (rbracket.test(prefix)) {\n add(prefix, obj[i]);\n } else {\n buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]);\n }\n }\n } else if (obj && String(obj) === '[object Object]') {\n for (key in obj) {\n buildParams(prefix + '[' + key + ']', obj[key]);\n }\n } else {\n add(prefix, obj);\n }\n } else if (isArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n add(obj[i].name, obj[i].value);\n }\n } else {\n for (key in obj) {\n buildParams(key, obj[key]);\n }\n }\n return s;\n };\n\n return buildParams('', a).join('&').replace(/%20/g, '+');\n };\n\n if (typeof module === 'object' && typeof module.exports === 'object') {\n module.exports = param;\n } else if (typeof define === 'function' && define.amd) {\n define([], function () {\n return param;\n });\n } else {\n global.param = param;\n }\n\n}(this));\n\n","'use strict';\r\n\r\nvar jQueryDeferred = require('jquery-deferred');\r\nvar jQueryParam = require('jquery-param');\r\n\r\nvar jqueryFunction = function jqueryFunction(subject) {\r\n var events = subject.events || {};\r\n\r\n if (subject && subject === subject.window) return {\r\n 0: subject,\r\n load: function load(handler) {\r\n return subject.addEventListener('load', handler, false);\r\n },\r\n bind: function bind(event, handler) {\r\n return subject.addEventListener(event, handler, false);\r\n },\r\n unbind: function unbind(event, handler) {\r\n return subject.removeEventListener(event, handler, false);\r\n }\r\n };\r\n\r\n return {\r\n 0: subject,\r\n\r\n unbind: function unbind(event, handler) {\r\n var handlers = events[event] || [];\r\n\r\n if (handler) {\r\n var idx = handlers.indexOf(handler);\r\n if (idx !== -1) handlers.splice(idx, 1);\r\n } else handlers = [];\r\n\r\n events[event] = handlers;\r\n subject.events = events;\r\n },\r\n bind: function bind(event, handler) {\r\n var current = events[event] || [];\r\n events[event] = current.concat(handler);\r\n subject.events = events;\r\n },\r\n triggerHandler: function triggerHandler(event, args) {\r\n var _this = this;\r\n\r\n var handlers = events[event] || [];\r\n handlers.forEach(function (fn) {\r\n if (args && args[0] && args[0].type === undefined) {\r\n args = [{\r\n type: event\r\n }].concat(args || []);\r\n } else {\r\n args = args || [];\r\n }\r\n\r\n fn.apply(_this, args);\r\n });\r\n }\r\n };\r\n};\r\n\r\nvar xhr = function xhr() {\r\n try {\r\n return new window.XMLHttpRequest();\r\n } catch (e) {}\r\n};\r\n\r\nvar ajax = function ajax(options) {\r\n var request = xhr();\r\n\r\n if (options.xhrFields && options.xhrFields.withCredentials) {\r\n request.withCredentials = true;\r\n }\r\n\r\n request.onreadystatechange = function () {\r\n if (request.readyState !== 4) {\r\n return;\r\n }\r\n\r\n if (request.status === 200 && !request._hasError) {\r\n try {\r\n options.success && options.success(JSON.parse(request.responseText));\r\n } catch (e) {\r\n options.error && options.error(request);\r\n }\r\n } else {\r\n options.error && options.error(request);\r\n }\r\n };\r\n\r\n request.withCredentials = options.xhrFields.withCredentials;\r\n var cacheBuster = \"_=\" + new Date().getTime();\r\n if (options.url.indexOf(\"?\") === -1) {\r\n\t\toptions.url += \"?\" + cacheBuster;\r\n\t} else if (options.url.indexOf(\"_=\") === -1) {\r\n options.url += \"&\" + cacheBuster;\r\n } else {\r\n options.url = options.url.replace(/_=\\d+/, cacheBuster);\r\n }\r\n request.open(options.type, options.url);\r\n request.setRequestHeader('content-type', options.contentType);\r\n if (options.headers) {\r\n Object.keys(options.headers).forEach(function (key) {\r\n var value = options.headers[key];\r\n request.setRequestHeader(key, value);\r\n });\r\n }\r\n\r\n request.send(options.data.data && 'data=' + encodeURIComponent(options.data.data));\r\n\r\n return {\r\n abort: function abort(reason) {\r\n return request.abort(reason);\r\n }\r\n };\r\n};\r\n\r\nmodule.exports = jQueryDeferred.extend(jqueryFunction, jQueryDeferred, {\r\n defaultAjaxHeaders: null,\r\n ajax: ajax,\r\n inArray: function inArray(arr, item) {\r\n return arr.indexOf(item) !== -1;\r\n },\r\n trim: function trim(str) {\r\n return str && str.trim();\r\n },\r\n isEmptyObject: function isEmptyObject(obj) {\r\n return !obj || Object.keys(obj).length === 0;\r\n },\r\n makeArray: function makeArray(arr) {\r\n return [].slice.call(arr, 0);\r\n },\r\n param: function param(obj) {\r\n return jQueryParam(obj);\r\n },\r\n support: {\r\n cors: function () {\r\n var xhrObj = xhr();\r\n return !!xhrObj && \"withCredentials\" in xhrObj;\r\n }()\r\n }\r\n});","'use strict';\r\n\r\nObject.defineProperty(exports, \"__esModule\", {\r\n value: true\r\n});\r\n\r\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\r\n\r\nvar jQueryShim = require('./jQueryShim');\r\n\r\n/* jquery.signalR.core.js */\r\n/*global window:false */\r\n/*!\r\n * ASP.NET SignalR JavaScript Library 2.4.1\r\n * http://signalr.net/\r\n *\r\n * Copyright (c) .NET Foundation. All rights reserved.\r\n * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n *\r\n */\r\n\r\n/// <reference path=\"Scripts/jquery-1.6.4.js\" />\r\n/// <reference path=\"jquery.signalR.version.js\" />\r\n(function ($, window, undefined) {\r\n\r\n var resources = {\r\n nojQuery: \"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.\",\r\n noTransportOnInit: \"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.\",\r\n errorOnNegotiate: \"Error during negotiation request.\",\r\n stoppedWhileLoading: \"The connection was stopped during page load.\",\r\n stoppedWhileNegotiating: \"The connection was stopped during the negotiate request.\",\r\n errorParsingNegotiateResponse: \"Error parsing negotiate response.\",\r\n errorRedirectionExceedsLimit: \"Negotiate redirection limit exceeded.\",\r\n errorDuringStartRequest: \"Error during start request. Stopping the connection.\",\r\n errorFromServer: \"Error message received from the server: '{0}'.\",\r\n stoppedDuringStartRequest: \"The connection was stopped during the start request.\",\r\n errorParsingStartResponse: \"Error parsing start response: '{0}'. Stopping the connection.\",\r\n invalidStartResponse: \"Invalid start response: '{0}'. Stopping the connection.\",\r\n protocolIncompatible: \"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.\",\r\n aspnetCoreSignalrServer: \"Detected a connection attempt to an ASP.NET Core SignalR Server. This client only supports connecting to an ASP.NET SignalR Server. See https://aka.ms/signalr-core-differences for details.\",\r\n sendFailed: \"Send failed.\",\r\n parseFailed: \"Failed at parsing response: {0}\",\r\n longPollFailed: \"Long polling request failed.\",\r\n eventSourceFailedToConnect: \"EventSource failed to connect.\",\r\n eventSourceError: \"Error raised by EventSource\",\r\n webSocketClosed: \"WebSocket closed.\",\r\n pingServerFailedInvalidResponse: \"Invalid ping response when pinging server: '{0}'.\",\r\n pingServerFailed: \"Failed to ping server.\",\r\n pingServerFailedStatusCode: \"Failed to ping server. Server responded with status code {0}, stopping the connection.\",\r\n pingServerFailedParse: \"Failed to parse ping server response, stopping the connection.\",\r\n noConnectionTransport: \"Connection is in an invalid state, there is no transport active.\",\r\n webSocketsInvalidState: \"The Web Socket transport is in an invalid state, transitioning into reconnecting.\",\r\n reconnectTimeout: \"Couldn't reconnect within the configured timeout of {0} ms, disconnecting.\",\r\n reconnectWindowTimeout: \"The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection.\",\r\n jsonpNotSupportedWithAccessToken: \"The JSONP protocol does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.\"\r\n };\r\n\r\n if (typeof $ !== \"function\") {\r\n // no jQuery!\r\n throw new Error(resources.nojQuery);\r\n }\r\n\r\n var _signalR,\r\n _connection,\r\n _pageLoaded = window.document.readyState === \"complete\",\r\n _pageWindow = $(window),\r\n _negotiateAbortText = \"__Negotiate Aborted__\",\r\n events = {\r\n onStart: \"onStart\",\r\n onStarting: \"onStarting\",\r\n onReceived: \"onReceived\",\r\n onError: \"onError\",\r\n onConnectionSlow: \"onConnectionSlow\",\r\n onReconnecting: \"onReconnecting\",\r\n onReconnect: \"onReconnect\",\r\n onStateChanged: \"onStateChanged\",\r\n onDisconnect: \"onDisconnect\"\r\n },\r\n ajaxDefaults = {\r\n processData: true,\r\n timeout: null,\r\n async: true,\r\n global: false,\r\n cache: false\r\n },\r\n _log = function _log(msg, logging) {\r\n if (logging === false) {\r\n return;\r\n }\r\n var m;\r\n if (typeof window.console === \"undefined\") {\r\n return;\r\n }\r\n m = \"[\" + new Date().toTimeString() + \"] SignalR: \" + msg;\r\n if (window.console.debug) {\r\n window.console.debug(m);\r\n } else if (window.console.log) {\r\n window.console.log(m);\r\n }\r\n },\r\n changeState = function changeState(connection, expectedState, newState) {\r\n if (expectedState === connection.state) {\r\n connection.state = newState;\r\n\r\n $(connection).triggerHandler(events.onStateChanged, [{ oldState: expectedState, newState: newState }]);\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n isDisconnecting = function isDisconnecting(connection) {\r\n return connection.state === _signalR.connectionState.disconnected;\r\n },\r\n supportsKeepAlive = function supportsKeepAlive(connection) {\r\n return connection._.keepAliveData.activated && connection.transport.supportsKeepAlive(connection);\r\n },\r\n configureStopReconnectingTimeout = function configureStopReconnectingTimeout(connection) {\r\n var stopReconnectingTimeout, onReconnectTimeout;\r\n\r\n // Check if this connection has already been configured to stop reconnecting after a specified timeout.\r\n // Without this check if a connection is stopped then started events will be bound multiple times.\r\n if (!connection._.configuredStopReconnectingTimeout) {\r\n onReconnectTimeout = function onReconnectTimeout(connection) {\r\n var message = _signalR._.format(_signalR.resources.reconnectTimeout, connection.disconnectTimeout);\r\n connection.log(message);\r\n $(connection).triggerHandler(events.onError, [_signalR._.error(message, /* source */\"TimeoutException\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n };\r\n\r\n connection.reconnecting(function () {\r\n var connection = this;\r\n\r\n // Guard against state changing in a previous user defined even handler\r\n if (connection.state === _signalR.connectionState.reconnecting) {\r\n stopReconnectingTimeout = window.setTimeout(function () {\r\n onReconnectTimeout(connection);\r\n }, connection.disconnectTimeout);\r\n }\r\n });\r\n\r\n connection.stateChanged(function (data) {\r\n if (data.oldState === _signalR.connectionState.reconnecting) {\r\n // Clear the pending reconnect timeout check\r\n window.clearTimeout(stopReconnectingTimeout);\r\n }\r\n });\r\n\r\n connection._.configuredStopReconnectingTimeout = true;\r\n }\r\n };\r\n\r\n _signalR = function signalR(url, qs, logging) {\r\n /// <summary>Creates a new SignalR connection for the given url</summary>\r\n /// <param name=\"url\" type=\"String\">The URL of the long polling endpoint</param>\r\n /// <param name=\"qs\" type=\"Object\">\r\n /// [Optional] Custom querystring parameters to add to the connection URL.\r\n /// If an object, every non-function member will be added to the querystring.\r\n /// If a string, it's added to the QS as specified.\r\n /// </param>\r\n /// <param name=\"logging\" type=\"Boolean\">\r\n /// [Optional] A flag indicating whether connection logging is enabled to the browser\r\n /// console/log. Defaults to false.\r\n /// </param>\r\n\r\n return new _signalR.fn.init(url, qs, logging);\r\n };\r\n\r\n _signalR._ = {\r\n defaultContentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\r\n\r\n ieVersion: function () {\r\n var version, matches;\r\n\r\n if (window.navigator.appName === 'Microsoft Internet Explorer') {\r\n // Check if the user agent has the pattern \"MSIE (one or more numbers).(one or more numbers)\";\r\n matches = /MSIE ([0-9]+\\.[0-9]+)/.exec(window.navigator.userAgent);\r\n\r\n if (matches) {\r\n version = window.parseFloat(matches[1]);\r\n }\r\n }\r\n\r\n // undefined value means not IE\r\n return version;\r\n }(),\r\n\r\n error: function error(message, source, context) {\r\n var e = new Error(message);\r\n e.source = source;\r\n\r\n if (typeof context !== \"undefined\") {\r\n e.context = context;\r\n }\r\n\r\n return e;\r\n },\r\n\r\n transportError: function transportError(message, transport, source, context) {\r\n var e = this.error(message, source, context);\r\n e.transport = transport ? transport.name : undefined;\r\n return e;\r\n },\r\n\r\n format: function format() {\r\n /// <summary>Usage: format(\"Hi {0}, you are {1}!\", \"Foo\", 100) </summary>\r\n var s = arguments[0];\r\n for (var i = 0; i < arguments.length - 1; i++) {\r\n s = s.replace(\"{\" + i + \"}\", arguments[i + 1]);\r\n }\r\n return s;\r\n },\r\n\r\n firefoxMajorVersion: function firefoxMajorVersion(userAgent) {\r\n // Firefox user agents: http://useragentstring.com/pages/Firefox/\r\n var matches = userAgent.match(/Firefox\\/(\\d+)/);\r\n if (!matches || !matches.length || matches.length < 2) {\r\n return 0;\r\n }\r\n return parseInt(matches[1], 10 /* radix */);\r\n },\r\n\r\n configurePingInterval: function configurePingInterval(connection) {\r\n var config = connection._.config,\r\n onFail = function onFail(error) {\r\n $(connection).triggerHandler(events.onError, [error]);\r\n };\r\n\r\n if (config && !connection._.pingIntervalId && config.pingInterval) {\r\n connection._.pingIntervalId = window.setInterval(function () {\r\n _signalR.transports._logic.pingServer(connection).fail(onFail);\r\n }, config.pingInterval);\r\n }\r\n }\r\n };\r\n\r\n _signalR.events = events;\r\n\r\n _signalR.resources = resources;\r\n\r\n _signalR.ajaxDefaults = ajaxDefaults;\r\n\r\n _signalR.changeState = changeState;\r\n\r\n _signalR.isDisconnecting = isDisconnecting;\r\n\r\n _signalR.connectionState = {\r\n connecting: 0,\r\n connected: 1,\r\n reconnecting: 2,\r\n disconnected: 4\r\n };\r\n\r\n _signalR.hub = {\r\n start: function start() {\r\n // This will get replaced with the real hub connection start method when hubs is referenced correctly\r\n throw new Error(\"SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>.\");\r\n }\r\n };\r\n\r\n // .on() was added in version 1.7.0, .load() was removed in version 3.0.0 so we fallback to .load() if .on() does\r\n // not exist to not break existing applications\r\n if (typeof _pageWindow.on == \"function\") {\r\n _pageWindow.on(\"load\", function () {\r\n _pageLoaded = true;\r\n });\r\n } else {\r\n _pageWindow.load(function () {\r\n _pageLoaded = true;\r\n });\r\n }\r\n\r\n function validateTransport(requestedTransport, connection) {\r\n /// <summary>Validates the requested transport by cross checking it with the pre-defined signalR.transports</summary>\r\n /// <param name=\"requestedTransport\" type=\"Object\">The designated transports that the user has specified.</param>\r\n /// <param name=\"connection\" type=\"signalR\">The connection that will be using the requested transports. Used for logging purposes.</param>\r\n /// <returns type=\"Object\" />\r\n\r\n if ($.isArray(requestedTransport)) {\r\n // Go through transport array and remove an \"invalid\" tranports\r\n for (var i = requestedTransport.length - 1; i >= 0; i--) {\r\n var transport = requestedTransport[i];\r\n if ($.type(transport) !== \"string\" || !_signalR.transports[transport]) {\r\n connection.log(\"Invalid transport: \" + transport + \", removing it from the transports list.\");\r\n requestedTransport.splice(i, 1);\r\n }\r\n }\r\n\r\n // Verify we still have transports left, if we dont then we have invalid transports\r\n if (requestedTransport.length === 0) {\r\n connection.log(\"No transports remain within the specified transport array.\");\r\n requestedTransport = null;\r\n }\r\n } else if (!_signalR.transports[requestedTransport] && requestedTransport !== \"auto\") {\r\n connection.log(\"Invalid transport: \" + requestedTransport.toString() + \".\");\r\n requestedTransport = null;\r\n } else if (requestedTransport === \"auto\" && _signalR._.ieVersion <= 8) {\r\n // If we're doing an auto transport and we're IE8 then force longPolling, #1764\r\n return [\"longPolling\"];\r\n }\r\n\r\n return requestedTransport;\r\n }\r\n\r\n function getDefaultPort(protocol) {\r\n if (protocol === \"http:\") {\r\n return 80;\r\n } else if (protocol === \"https:\") {\r\n return 443;\r\n }\r\n }\r\n\r\n function addDefaultPort(protocol, url) {\r\n // Remove ports from url. We have to check if there's a / or end of line\r\n // following the port in order to avoid removing ports such as 8080.\r\n if (url.match(/:\\d+$/)) {\r\n return url;\r\n } else {\r\n return url + \":\" + getDefaultPort(protocol);\r\n }\r\n }\r\n\r\n function ConnectingMessageBuffer(connection, drainCallback) {\r\n var that = this,\r\n buffer = [];\r\n\r\n that.tryBuffer = function (message) {\r\n if (connection.state === $.signalR.connectionState.connecting) {\r\n buffer.push(message);\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n };\r\n\r\n that.drain = function () {\r\n // Ensure that the connection is connected when we drain (do not want to drain while a connection is not active)\r\n if (connection.state === $.signalR.connectionState.connected) {\r\n while (buffer.length > 0) {\r\n drainCallback(buffer.shift());\r\n }\r\n }\r\n };\r\n\r\n that.clear = function () {\r\n buffer = [];\r\n };\r\n }\r\n\r\n _signalR.fn = _signalR.prototype = {\r\n init: function init(url, qs, logging) {\r\n var $connection = $(this);\r\n\r\n this.url = url;\r\n this.qs = qs;\r\n this.lastError = null;\r\n this._ = {\r\n keepAliveData: {},\r\n connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {\r\n $connection.triggerHandler(events.onReceived, [message]);\r\n }),\r\n lastMessageAt: new Date().getTime(),\r\n lastActiveAt: new Date().getTime(),\r\n beatInterval: 5000, // Default value, will only be overridden if keep alive is enabled,\r\n beatHandle: null,\r\n totalTransportConnectTimeout: 0, // This will be the sum of the TransportConnectTimeout sent in response to negotiate and connection.transportConnectTimeout\r\n redirectQs: null\r\n };\r\n if (typeof logging === \"boolean\") {\r\n this.logging = logging;\r\n }\r\n },\r\n\r\n _parseResponse: function _parseResponse(response) {\r\n var that = this;\r\n\r\n if (!response) {\r\n return response;\r\n } else if (typeof response === \"string\") {\r\n return that.json.parse(response);\r\n } else {\r\n return response;\r\n }\r\n },\r\n\r\n _originalJson: window.JSON,\r\n\r\n json: window.JSON,\r\n\r\n isCrossDomain: function isCrossDomain(url, against) {\r\n /// <summary>Checks if url is cross domain</summary>\r\n /// <param name=\"url\" type=\"String\">The base URL</param>\r\n /// <param name=\"against\" type=\"Object\">\r\n /// An optional argument to compare the URL against, if not specified it will be set to window.location.\r\n /// If specified it must contain a protocol and a host property.\r\n /// </param>\r\n var link;\r\n\r\n url = $.trim(url);\r\n\r\n against = against || window.location;\r\n\r\n if (url.indexOf(\"http\") !== 0) {\r\n return false;\r\n }\r\n\r\n // Create an anchor tag.\r\n link = window.document.createElement(\"a\");\r\n link.href = url;\r\n\r\n // When checking for cross domain we have to special case port 80 because the window.location will remove the\r\n return link.protocol + addDefaultPort(link.protocol, link.host) !== against.protocol + addDefaultPort(against.protocol, against.host);\r\n },\r\n\r\n ajaxDataType: \"text\",\r\n\r\n contentType: \"application/json; charset=UTF-8\",\r\n\r\n logging: false,\r\n\r\n state: _signalR.connectionState.disconnected,\r\n\r\n clientProtocol: \"2.1\",\r\n\r\n // We want to support older servers since the 2.0 change is to support redirection results, which isn't\r\n // really breaking in the protocol. So if a user updates their client to 2.0 protocol version there's\r\n // no reason they can't still connect to a 1.5 server. The 2.1 protocol is sent by the client so the SignalR\r\n // service knows the client will use they query string returned via the RedirectUrl for subsequent requests.\r\n // It doesn't matter whether the server reflects back 2.1 or continues using 2.0 as the protocol version.\r\n supportedProtocols: [\"1.5\", \"2.0\", \"2.1\"],\r\n\r\n negotiateRedirectSupportedProtocols: [\"2.0\", \"2.1\"],\r\n\r\n reconnectDelay: 2000,\r\n\r\n transportConnectTimeout: 0,\r\n\r\n disconnectTimeout: 30000, // This should be set by the server in response to the negotiate request (30s default)\r\n\r\n reconnectWindow: 30000, // This should be set by the server in response to the negotiate request\r\n\r\n keepAliveWarnAt: 2 / 3, // Warn user of slow connection if we breach the X% mark of the keep alive timeout\r\n\r\n start: function start(options, callback) {\r\n /// <summary>Starts the connection</summary>\r\n /// <param name=\"options\" type=\"Object\">Options map</param>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection has started</param>\r\n var connection = this,\r\n config = {\r\n pingInterval: 300000,\r\n waitForPageLoad: true,\r\n transport: \"auto\",\r\n jsonp: false\r\n },\r\n _initialize,\r\n deferred = connection._deferral || $.Deferred(),\r\n // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it\r\n parser = window.document.createElement(\"a\"),\r\n setConnectionUrl = function setConnectionUrl(connection, url) {\r\n if (connection.url === url && connection.baseUrl) {\r\n // when the url related properties are already set\r\n return;\r\n }\r\n\r\n connection.url = url;\r\n\r\n // Resolve the full url\r\n parser.href = connection.url;\r\n if (!parser.protocol || parser.protocol === \":\") {\r\n connection.protocol = window.document.location.protocol;\r\n connection.host = parser.host || window.document.location.host;\r\n } else {\r\n connection.protocol = parser.protocol;\r\n connection.host = parser.host;\r\n }\r\n\r\n connection.baseUrl = connection.protocol + \"//\" + connection.host;\r\n\r\n // Set the websocket protocol\r\n connection.wsProtocol = connection.protocol === \"https:\" ? \"wss://\" : \"ws://\";\r\n\r\n // If the url is protocol relative, prepend the current windows protocol to the url.\r\n if (connection.url.indexOf(\"//\") === 0) {\r\n connection.url = window.location.protocol + connection.url;\r\n connection.log(\"Protocol relative URL detected, normalizing it to '\" + connection.url + \"'.\");\r\n }\r\n\r\n if (connection.isCrossDomain(connection.url)) {\r\n connection.log(\"Auto detected cross domain url.\");\r\n\r\n if (config.transport === \"auto\") {\r\n // Cross-domain does not support foreverFrame\r\n config.transport = [\"webSockets\", \"serverSentEvents\", \"longPolling\"];\r\n }\r\n\r\n if (typeof connection.withCredentials === \"undefined\") {\r\n connection.withCredentials = true;\r\n }\r\n\r\n // Determine if jsonp is the only choice for negotiation, ajaxSend and ajaxAbort.\r\n // i.e. if the browser doesn't supports CORS\r\n // If it is, ignore any preference to the contrary, and switch to jsonp.\r\n if (!$.support.cors) {\r\n connection.ajaxDataType = \"jsonp\";\r\n connection.log(\"Using jsonp because this browser doesn't support CORS.\");\r\n }\r\n\r\n connection.contentType = _signalR._.defaultContentType;\r\n }\r\n };\r\n\r\n connection.lastError = null;\r\n\r\n // Persist the deferral so that if start is called multiple times the same deferral is used.\r\n connection._deferral = deferred;\r\n\r\n if (!connection.json) {\r\n // no JSON!\r\n throw new Error(\"SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.\");\r\n }\r\n\r\n if ($.type(options) === \"function\") {\r\n // Support calling with single callback parameter\r\n callback = options;\r\n } else if ($.type(options) === \"object\") {\r\n $.extend(config, options);\r\n if ($.type(config.callback) === \"function\") {\r\n callback = config.callback;\r\n }\r\n }\r\n\r\n config.transport = validateTransport(config.transport, connection);\r\n\r\n // If the transport is invalid throw an error and abort start\r\n if (!config.transport) {\r\n throw new Error(\"SignalR: Invalid transport(s) specified, aborting start.\");\r\n }\r\n\r\n connection._.config = config;\r\n\r\n // Check to see if start is being called prior to page load\r\n // If waitForPageLoad is true we then want to re-direct function call to the window load event\r\n if (!_pageLoaded && config.waitForPageLoad === true) {\r\n connection._.deferredStartHandler = function () {\r\n connection.start(options, callback);\r\n };\r\n _pageWindow.bind(\"load\", connection._.deferredStartHandler);\r\n\r\n return deferred.promise();\r\n }\r\n\r\n // If we're already connecting just return the same deferral as the original connection start\r\n if (connection.state === _signalR.connectionState.connecting) {\r\n return deferred.promise();\r\n } else if (changeState(connection, _signalR.connectionState.disconnected, _signalR.connectionState.connecting) === false) {\r\n // We're not connecting so try and transition into connecting.\r\n // If we fail to transition then we're either in connected or reconnecting.\r\n\r\n deferred.resolve(connection);\r\n return deferred.promise();\r\n }\r\n\r\n configureStopReconnectingTimeout(connection);\r\n\r\n // If jsonp with no/auto transport is specified, then set the transport to long polling\r\n // since that is the only transport for which jsonp really makes sense.\r\n // Some developers might actually choose to specify jsonp for same origin requests\r\n // as demonstrated by Issue #623.\r\n if (config.transport === \"auto\" && config.jsonp === true) {\r\n config.transport = \"longPolling\";\r\n }\r\n\r\n connection.withCredentials = config.withCredentials;\r\n\r\n // Save the original url so that we can reset it when we stop and restart the connection\r\n connection._originalUrl = connection.url;\r\n\r\n connection.ajaxDataType = config.jsonp ? \"jsonp\" : \"text\";\r\n\r\n setConnectionUrl(connection, connection.url);\r\n\r\n $(connection).bind(events.onStart, function (e, data) {\r\n if ($.type(callback) === \"function\") {\r\n callback.call(connection);\r\n }\r\n deferred.resolve(connection);\r\n });\r\n\r\n connection._.initHandler = _signalR.transports._logic.initHandler(connection);\r\n\r\n _initialize = function initialize(transports, index) {\r\n var noTransportError = _signalR._.error(resources.noTransportOnInit);\r\n\r\n index = index || 0;\r\n if (index >= transports.length) {\r\n if (index === 0) {\r\n connection.log(\"No transports supported by the server were selected.\");\r\n } else if (index === 1) {\r\n connection.log(\"No fallback transports were selected.\");\r\n } else {\r\n connection.log(\"Fallback transports exhausted.\");\r\n }\r\n\r\n // No transport initialized successfully\r\n $(connection).triggerHandler(events.onError, [noTransportError]);\r\n deferred.reject(noTransportError);\r\n // Stop the connection if it has connected and move it into the disconnected state\r\n connection.stop();\r\n return;\r\n }\r\n\r\n // The connection was aborted\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n return;\r\n }\r\n\r\n var transportName = transports[index],\r\n transport = _signalR.transports[transportName],\r\n onFallback = function onFallback() {\r\n _initialize(transports, index + 1);\r\n };\r\n\r\n connection.transport = transport;\r\n\r\n try {\r\n connection._.initHandler.start(transport, function () {\r\n // success\r\n // Firefox 11+ doesn't allow sync XHR withCredentials: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#withCredentials\r\n var isFirefox11OrGreater = _signalR._.firefoxMajorVersion(window.navigator.userAgent) >= 11,\r\n asyncAbort = true;\r\n\r\n connection.log(\"The start request succeeded. Transitioning to the connected state.\");\r\n\r\n if (supportsKeepAlive(connection)) {\r\n _signalR.transports._logic.monitorKeepAlive(connection);\r\n }\r\n\r\n _signalR.transports._logic.startHeartbeat(connection);\r\n\r\n // Used to ensure low activity clients maintain their authentication.\r\n // Must be configured once a transport has been decided to perform valid ping requests.\r\n _signalR._.configurePingInterval(connection);\r\n\r\n if (!changeState(connection, _signalR.connectionState.connecting, _signalR.connectionState.connected)) {\r\n connection.log(\"WARNING! The connection was not in the connecting state.\");\r\n }\r\n\r\n // Drain any incoming buffered messages (messages that came in prior to connect)\r\n connection._.connectingMessageBuffer.drain();\r\n\r\n $(connection).triggerHandler(events.onStart);\r\n\r\n // wire the stop handler for when the user leaves the page\r\n _pageWindow.bind(\"unload\", function () {\r\n connection.log(\"Window unloading, stopping the connection.\");\r\n\r\n connection.stop(asyncAbort);\r\n });\r\n\r\n if (isFirefox11OrGreater) {\r\n // Firefox does not fire cross-domain XHRs in the normal unload handler on tab close.\r\n // #2400\r\n _pageWindow.bind(\"beforeunload\", function () {\r\n // If connection.stop() runs runs in beforeunload and fails, it will also fail\r\n // in unload unless connection.stop() runs after a timeout.\r\n window.setTimeout(function () {\r\n connection.stop(asyncAbort);\r\n }, 0);\r\n });\r\n }\r\n }, onFallback);\r\n } catch (error) {\r\n connection.log(transport.name + \" transport threw '\" + error.message + \"' when attempting to start.\");\r\n onFallback();\r\n }\r\n };\r\n\r\n var url = connection.url + \"/negotiate\",\r\n onFailed = function onFailed(error, connection) {\r\n var err = _signalR._.error(resources.errorOnNegotiate, error, connection._.negotiateRequest);\r\n\r\n $(connection).triggerHandler(events.onError, err);\r\n deferred.reject(err);\r\n // Stop the connection if negotiate failed\r\n connection.stop();\r\n };\r\n\r\n $(connection).triggerHandler(events.onStarting);\r\n\r\n url = _signalR.transports._logic.prepareQueryString(connection, url);\r\n\r\n connection.log(\"Negotiating with '\" + url + \"'.\");\r\n\r\n // Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.\r\n connection._.negotiateRequest = function () {\r\n var res,\r\n redirects = 0,\r\n MAX_REDIRECTS = 100,\r\n keepAliveData,\r\n protocolError,\r\n transports = [],\r\n supportedTransports = [],\r\n negotiate = function negotiate(connection, onSuccess) {\r\n var url = _signalR.transports._logic.prepareQueryString(connection, connection.url + \"/negotiate\");\r\n connection.log(\"Negotiating with '\" + url + \"'.\");\r\n var options = {\r\n url: url,\r\n error: function error(_error, statusText) {\r\n // We don't want to cause any errors if we're aborting our own negotiate request.\r\n if (statusText !== _negotiateAbortText) {\r\n onFailed(_error, connection);\r\n } else {\r\n // This rejection will noop if the deferred has already been resolved or rejected.\r\n deferred.reject(_signalR._.error(resources.stoppedWhileNegotiating, null /* error */, connection._.negotiateRequest));\r\n }\r\n },\r\n success: onSuccess\r\n };\r\n\r\n if (connection.accessToken) {\r\n options.headers = { \"Authorization\": \"Bearer \" + connection.accessToken };\r\n }\r\n\r\n return _signalR.transports._logic.ajax(connection, options);\r\n },\r\n callback = function callback(result) {\r\n try {\r\n res = connection._parseResponse(result);\r\n } catch (error) {\r\n onFailed(_signalR._.error(resources.errorParsingNegotiateResponse, error), connection);\r\n return;\r\n }\r\n\r\n // Check if the server is an ASP.NET Core app\r\n if (res.availableTransports) {\r\n protocolError = _signalR._.error(resources.aspnetCoreSignalrServer);\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n return;\r\n }\r\n\r\n if (!res.ProtocolVersion || connection.supportedProtocols.indexOf(res.ProtocolVersion) === -1) {\r\n protocolError = _signalR._.error(_signalR._.format(resources.protocolIncompatible, connection.clientProtocol, res.ProtocolVersion));\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n\r\n return;\r\n }\r\n\r\n // Check for a redirect response (which must have a ProtocolVersion of 2.0 or greater)\r\n // ProtocolVersion 2.1 is the highest supported by the client, so we can just check for 2.0 or 2.1 for now\r\n // instead of trying to do proper version string comparison in JavaScript.\r\n if (connection.negotiateRedirectSupportedProtocols.indexOf(res.ProtocolVersion) !== -1) {\r\n if (res.Error) {\r\n protocolError = _signalR._.error(_signalR._.format(resources.errorFromServer, res.Error));\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n return;\r\n } else if (res.RedirectUrl) {\r\n if (redirects === MAX_REDIRECTS) {\r\n onFailed(_signalR._.error(resources.errorRedirectionExceedsLimit), connection);\r\n return;\r\n }\r\n\r\n if (config.transport === \"auto\") {\r\n // Redirected connections do not support foreverFrame\r\n config.transport = [\"webSockets\", \"serverSentEvents\", \"longPolling\"];\r\n }\r\n\r\n connection.log(\"Received redirect to: \" + res.RedirectUrl);\r\n connection.accessToken = res.AccessToken;\r\n\r\n var splitUrlAndQs = res.RedirectUrl.split(\"?\", 2);\r\n setConnectionUrl(connection, splitUrlAndQs[0]);\r\n\r\n // Update redirectQs with query string from only the most recent RedirectUrl.\r\n connection._.redirectQs = splitUrlAndQs.length === 2 ? splitUrlAndQs[1] : null;\r\n\r\n if (connection.ajaxDataType === \"jsonp\" && connection.accessToken) {\r\n onFailed(_signalR._.error(resources.jsonpNotSupportedWithAccessToken), connection);\r\n return;\r\n }\r\n\r\n redirects++;\r\n negotiate(connection, callback);\r\n return;\r\n }\r\n }\r\n\r\n keepAliveData = connection._.keepAliveData;\r\n connection.appRelativeUrl = res.Url;\r\n connection.id = res.ConnectionId;\r\n connection.token = res.ConnectionToken;\r\n connection.webSocketServerUrl = res.WebSocketServerUrl;\r\n\r\n // The long poll timeout is the ConnectionTimeout plus 10 seconds\r\n connection._.pollTimeout = res.ConnectionTimeout * 1000 + 10000; // in ms\r\n\r\n // Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect\r\n // after res.DisconnectTimeout seconds.\r\n connection.disconnectTimeout = res.DisconnectTimeout * 1000; // in ms\r\n\r\n // Add the TransportConnectTimeout from the response to the transportConnectTimeout from the client to calculate the total timeout\r\n connection._.totalTransportConnectTimeout = connection.transportConnectTimeout + res.TransportConnectTimeout * 1000;\r\n\r\n // If we have a keep alive\r\n if (res.KeepAliveTimeout) {\r\n // Register the keep alive data as activated\r\n keepAliveData.activated = true;\r\n\r\n // Timeout to designate when to force the connection into reconnecting converted to milliseconds\r\n keepAliveData.timeout = res.KeepAliveTimeout * 1000;\r\n\r\n // Timeout to designate when to warn the developer that the connection may be dead or is not responding.\r\n keepAliveData.timeoutWarning = keepAliveData.timeout * connection.keepAliveWarnAt;\r\n\r\n // Instantiate the frequency in which we check the keep alive. It must be short in order to not miss/pick up any changes\r\n connection._.beatInterval = (keepAliveData.timeout - keepAliveData.timeoutWarning) / 3;\r\n } else {\r\n keepAliveData.activated = false;\r\n }\r\n\r\n connection.reconnectWindow = connection.disconnectTimeout + (keepAliveData.timeout || 0);\r\n\r\n $.each(_signalR.transports, function (key) {\r\n if (key.indexOf(\"_\") === 0 || key === \"webSockets\" && !res.TryWebSockets) {\r\n return true;\r\n }\r\n supportedTransports.push(key);\r\n });\r\n\r\n if ($.isArray(config.transport)) {\r\n $.each(config.transport, function (_, transport) {\r\n if ($.inArray(transport, supportedTransports) >= 0) {\r\n transports.push(transport);\r\n }\r\n });\r\n } else if (config.transport === \"auto\") {\r\n transports = supportedTransports;\r\n } else if ($.inArray(config.transport, supportedTransports) >= 0) {\r\n transports.push(config.transport);\r\n }\r\n\r\n _initialize(transports);\r\n };\r\n\r\n return negotiate(connection, callback);\r\n }();\r\n\r\n return deferred.promise();\r\n },\r\n\r\n starting: function starting(callback) {\r\n /// <summary>Adds a callback that will be invoked before anything is sent over the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute before the connection is fully instantiated.</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onStarting, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n send: function send(data) {\r\n /// <summary>Sends data over the connection</summary>\r\n /// <param name=\"data\" type=\"String\">The data to send over the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n // Connection hasn't been started yet\r\n throw new Error(\"SignalR: Connection must be started before data can be sent. Call .start() before .send()\");\r\n }\r\n\r\n if (connection.state === _signalR.connectionState.connecting) {\r\n // Connection hasn't been started yet\r\n throw new Error(\"SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.\");\r\n }\r\n\r\n connection.transport.send(connection, data);\r\n // REVIEW: Should we return deferred here?\r\n return connection;\r\n },\r\n\r\n received: function received(callback) {\r\n /// <summary>Adds a callback that will be invoked after anything is received over the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when any data is received on the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReceived, function (e, data) {\r\n callback.call(connection, data);\r\n });\r\n return connection;\r\n },\r\n\r\n stateChanged: function stateChanged(callback) {\r\n /// <summary>Adds a callback that will be invoked when the connection state changes</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection state changes</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onStateChanged, function (e, data) {\r\n callback.call(connection, data);\r\n });\r\n return connection;\r\n },\r\n\r\n error: function error(callback) {\r\n /// <summary>Adds a callback that will be invoked after an error occurs with the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when an error occurs on the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onError, function (e, errorData, sendData) {\r\n connection.lastError = errorData;\r\n // In practice 'errorData' is the SignalR built error object.\r\n // In practice 'sendData' is undefined for all error events except those triggered by\r\n // 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.\r\n callback.call(connection, errorData, sendData);\r\n });\r\n return connection;\r\n },\r\n\r\n disconnected: function disconnected(callback) {\r\n /// <summary>Adds a callback that will be invoked when the client disconnects</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is broken</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onDisconnect, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n connectionSlow: function connectionSlow(callback) {\r\n /// <summary>Adds a callback that will be invoked when the client detects a slow connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is slow</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onConnectionSlow, function (e, data) {\r\n callback.call(connection);\r\n });\r\n\r\n return connection;\r\n },\r\n\r\n reconnecting: function reconnecting(callback) {\r\n /// <summary>Adds a callback that will be invoked when the underlying transport begins reconnecting</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection enters a reconnecting state</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReconnecting, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n reconnected: function reconnected(callback) {\r\n /// <summary>Adds a callback that will be invoked when the underlying transport reconnects</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is restored</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReconnect, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n stop: function stop(async, notifyServer) {\r\n /// <summary>Stops listening</summary>\r\n /// <param name=\"async\" type=\"Boolean\">Whether or not to asynchronously abort the connection</param>\r\n /// <param name=\"notifyServer\" type=\"Boolean\">Whether we want to notify the server that we are aborting the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this,\r\n\r\n // Save deferral because this is always cleaned up\r\n deferral = connection._deferral;\r\n\r\n // Verify that we've bound a load event.\r\n if (connection._.deferredStartHandler) {\r\n // Unbind the event.\r\n _pageWindow.unbind(\"load\", connection._.deferredStartHandler);\r\n }\r\n\r\n // Always clean up private non-timeout based state.\r\n delete connection._.config;\r\n delete connection._.deferredStartHandler;\r\n\r\n // This needs to be checked despite the connection state because a connection start can be deferred until page load.\r\n // If we've deferred the start due to a page load we need to unbind the \"onLoad\" -> start event.\r\n if (!_pageLoaded && (!connection._.config || connection._.config.waitForPageLoad === true)) {\r\n connection.log(\"Stopping connection prior to negotiate.\");\r\n\r\n // If we have a deferral we should reject it\r\n if (deferral) {\r\n deferral.reject(_signalR._.error(resources.stoppedWhileLoading));\r\n }\r\n\r\n // Short-circuit because the start has not been fully started.\r\n return;\r\n }\r\n\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n return;\r\n }\r\n\r\n connection.log(\"Stopping connection.\");\r\n\r\n // Clear this no matter what\r\n window.clearTimeout(connection._.beatHandle);\r\n window.clearInterval(connection._.pingIntervalId);\r\n\r\n if (connection.transport) {\r\n connection.transport.stop(connection);\r\n\r\n if (notifyServer !== false) {\r\n connection.transport.abort(connection, async);\r\n }\r\n\r\n if (supportsKeepAlive(connection)) {\r\n _signalR.transports._logic.stopMonitoringKeepAlive(connection);\r\n }\r\n\r\n connection.transport = null;\r\n }\r\n\r\n if (connection._.negotiateRequest) {\r\n // If the negotiation request has already completed this will noop.\r\n connection._.negotiateRequest.abort(_negotiateAbortText);\r\n delete connection._.negotiateRequest;\r\n }\r\n\r\n // Ensure that initHandler.stop() is called before connection._deferral is deleted\r\n if (connection._.initHandler) {\r\n connection._.initHandler.stop();\r\n }\r\n\r\n delete connection._deferral;\r\n delete connection.messageId;\r\n delete connection.groupsToken;\r\n delete connection.id;\r\n delete connection._.pingIntervalId;\r\n delete connection._.lastMessageAt;\r\n delete connection._.lastActiveAt;\r\n\r\n // Clear out our message buffer\r\n connection._.connectingMessageBuffer.clear();\r\n\r\n // Clean up this event\r\n $(connection).unbind(events.onStart);\r\n\r\n // Reset the URL and clear the access token\r\n delete connection.accessToken;\r\n delete connection.protocol;\r\n delete connection.host;\r\n delete connection.baseUrl;\r\n delete connection.wsProtocol;\r\n delete connection.contentType;\r\n connection.url = connection._originalUrl;\r\n connection._.redirectQs = null;\r\n\r\n // Trigger the disconnect event\r\n changeState(connection, connection.state, _signalR.connectionState.disconnected);\r\n $(connection).triggerHandler(events.onDisconnect);\r\n\r\n return connection;\r\n },\r\n\r\n log: function log(msg) {\r\n _log(msg, this.logging);\r\n }\r\n };\r\n\r\n _signalR.fn.init.prototype = _signalR.fn;\r\n\r\n _signalR.noConflict = function () {\r\n /// <summary>Reinstates the original value of $.connection and returns the signalR object for manual assignment</summary>\r\n /// <returns type=\"signalR\" />\r\n if ($.connection === _signalR) {\r\n $.connection = _connection;\r\n }\r\n return _signalR;\r\n };\r\n\r\n if ($.connection) {\r\n _connection = $.connection;\r\n }\r\n\r\n $.connection = $.signalR = _signalR;\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.common.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n startAbortText = \"__Start Aborted__\",\r\n transportLogic;\r\n\r\n signalR.transports = {};\r\n\r\n function beat(connection) {\r\n if (connection._.keepAliveData.monitoring) {\r\n checkIfAlive(connection);\r\n }\r\n\r\n // Ensure that we successfully marked active before continuing the heartbeat.\r\n if (transportLogic.markActive(connection)) {\r\n connection._.beatHandle = window.setTimeout(function () {\r\n beat(connection);\r\n }, connection._.beatInterval);\r\n }\r\n }\r\n\r\n function checkIfAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData,\r\n timeElapsed;\r\n\r\n // Only check if we're connected\r\n if (connection.state === signalR.connectionState.connected) {\r\n timeElapsed = new Date().getTime() - connection._.lastMessageAt;\r\n\r\n // Check if the keep alive has completely timed out\r\n if (timeElapsed >= keepAliveData.timeout) {\r\n connection.log(\"Keep alive timed out. Notifying transport that connection has been lost.\");\r\n\r\n // Notify transport that the connection has been lost\r\n connection.transport.lostConnection(connection);\r\n } else if (timeElapsed >= keepAliveData.timeoutWarning) {\r\n // This is to assure that the user only gets a single warning\r\n if (!keepAliveData.userNotified) {\r\n connection.log(\"Keep alive has been missed, connection may be dead/slow.\");\r\n $(connection).triggerHandler(events.onConnectionSlow);\r\n keepAliveData.userNotified = true;\r\n }\r\n } else {\r\n keepAliveData.userNotified = false;\r\n }\r\n }\r\n }\r\n\r\n function getAjaxUrl(connection, path) {\r\n var url = connection.url + path;\r\n\r\n if (connection.transport) {\r\n url += \"?transport=\" + connection.transport.name;\r\n }\r\n\r\n return transportLogic.prepareQueryString(connection, url);\r\n }\r\n\r\n function InitHandler(connection) {\r\n this.connection = connection;\r\n\r\n this.startRequested = false;\r\n this.startCompleted = false;\r\n this.connectionStopped = false;\r\n }\r\n\r\n InitHandler.prototype = {\r\n start: function start(transport, onSuccess, onFallback) {\r\n var that = this,\r\n connection = that.connection,\r\n failCalled = false;\r\n\r\n if (that.startRequested || that.connectionStopped) {\r\n connection.log(\"WARNING! \" + transport.name + \" transport cannot be started. Initialization ongoing or completed.\");\r\n return;\r\n }\r\n\r\n connection.log(transport.name + \" transport starting.\");\r\n\r\n transport.start(connection, function () {\r\n if (!failCalled) {\r\n that.initReceived(transport, onSuccess);\r\n }\r\n }, function (error) {\r\n // Don't allow the same transport to cause onFallback to be called twice\r\n if (!failCalled) {\r\n failCalled = true;\r\n that.transportFailed(transport, error, onFallback);\r\n }\r\n\r\n // Returns true if the transport should stop;\r\n // false if it should attempt to reconnect\r\n return !that.startCompleted || that.connectionStopped;\r\n });\r\n\r\n that.transportTimeoutHandle = window.setTimeout(function () {\r\n if (!failCalled) {\r\n failCalled = true;\r\n connection.log(transport.name + \" transport timed out when trying to connect.\");\r\n that.transportFailed(transport, undefined, onFallback);\r\n }\r\n }, connection._.totalTransportConnectTimeout);\r\n },\r\n\r\n stop: function stop() {\r\n this.connectionStopped = true;\r\n window.clearTimeout(this.transportTimeoutHandle);\r\n signalR.transports._logic.tryAbortStartRequest(this.connection);\r\n },\r\n\r\n initReceived: function initReceived(transport, onSuccess) {\r\n var that = this,\r\n connection = that.connection;\r\n\r\n if (that.startRequested) {\r\n connection.log(\"WARNING! The client received multiple init messages.\");\r\n return;\r\n }\r\n\r\n if (that.connectionStopped) {\r\n return;\r\n }\r\n\r\n that.startRequested = true;\r\n window.clearTimeout(that.transportTimeoutHandle);\r\n\r\n connection.log(transport.name + \" transport connected. Initiating start request.\");\r\n signalR.transports._logic.ajaxStart(connection, function () {\r\n that.startCompleted = true;\r\n onSuccess();\r\n });\r\n },\r\n\r\n transportFailed: function transportFailed(transport, error, onFallback) {\r\n var connection = this.connection,\r\n deferred = connection._deferral,\r\n wrappedError;\r\n\r\n if (this.connectionStopped) {\r\n return;\r\n }\r\n\r\n window.clearTimeout(this.transportTimeoutHandle);\r\n\r\n if (!this.startRequested) {\r\n transport.stop(connection);\r\n\r\n connection.log(transport.name + \" transport failed to connect. Attempting to fall back.\");\r\n onFallback();\r\n } else if (!this.startCompleted) {\r\n // Do not attempt to fall back if a start request is ongoing during a transport failure.\r\n // Instead, trigger an error and stop the connection.\r\n wrappedError = signalR._.error(signalR.resources.errorDuringStartRequest, error);\r\n\r\n connection.log(transport.name + \" transport failed during the start request. Stopping the connection.\");\r\n $(connection).triggerHandler(events.onError, [wrappedError]);\r\n if (deferred) {\r\n deferred.reject(wrappedError);\r\n }\r\n\r\n connection.stop();\r\n } else {\r\n // The start request has completed, but the connection has not stopped.\r\n // No need to do anything here. The transport should attempt its normal reconnect logic.\r\n }\r\n }\r\n };\r\n\r\n transportLogic = signalR.transports._logic = {\r\n ajax: function ajax(connection, options) {\r\n return $.ajax($.extend( /*deep copy*/true, {}, $.signalR.ajaxDefaults, {\r\n type: \"GET\",\r\n data: {},\r\n xhrFields: { withCredentials: connection.withCredentials },\r\n contentType: connection.contentType,\r\n dataType: connection.ajaxDataType\r\n }, options));\r\n },\r\n\r\n pingServer: function pingServer(connection) {\r\n /// <summary>Pings the server</summary>\r\n /// <param name=\"connection\" type=\"signalr\">Connection associated with the server ping</param>\r\n /// <returns type=\"signalR\" />\r\n var url,\r\n xhr,\r\n deferral = $.Deferred();\r\n\r\n if (connection.transport) {\r\n url = connection.url + \"/ping\";\r\n\r\n url = transportLogic.addQs(url, connection.qs);\r\n\r\n xhr = transportLogic.ajax(connection, {\r\n url: url,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(result);\r\n } catch (error) {\r\n deferral.reject(signalR._.transportError(signalR.resources.pingServerFailedParse, connection.transport, error, xhr));\r\n connection.stop();\r\n return;\r\n }\r\n\r\n if (data.Response === \"pong\") {\r\n deferral.resolve();\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result), connection.transport, null /* error */\r\n , xhr));\r\n }\r\n },\r\n error: function error(_error2) {\r\n if (_error2.status === 401 || _error2.status === 403) {\r\n deferral.reject(signalR._.transportError(signalR._.format(signalR.resources.pingServerFailedStatusCode, _error2.status), connection.transport, _error2, xhr));\r\n connection.stop();\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR.resources.pingServerFailed, connection.transport, _error2, xhr));\r\n }\r\n }\r\n });\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR.resources.noConnectionTransport, connection.transport));\r\n }\r\n\r\n return deferral.promise();\r\n },\r\n\r\n prepareQueryString: function prepareQueryString(connection, url) {\r\n var preparedUrl;\r\n\r\n // Use addQs to start since it handles the ?/& prefix for us\r\n preparedUrl = transportLogic.addQs(url, \"clientProtocol=\" + connection.clientProtocol);\r\n\r\n if (typeof connection._.redirectQs === \"string\") {\r\n // Add the redirect-specified query string params if any\r\n preparedUrl = transportLogic.addQs(preparedUrl, connection._.redirectQs);\r\n } else {\r\n // Otherwise, add the user-specified query string params if any\r\n preparedUrl = transportLogic.addQs(preparedUrl, connection.qs);\r\n }\r\n\r\n if (connection.token) {\r\n preparedUrl += \"&connectionToken=\" + window.encodeURIComponent(connection.token);\r\n }\r\n\r\n if (connection.data) {\r\n preparedUrl += \"&connectionData=\" + window.encodeURIComponent(connection.data);\r\n }\r\n\r\n return preparedUrl;\r\n },\r\n\r\n addQs: function addQs(url, qs) {\r\n var appender = url.indexOf(\"?\") !== -1 ? \"&\" : \"?\",\r\n firstChar;\r\n\r\n if (!qs) {\r\n return url;\r\n }\r\n\r\n if ((typeof qs === 'undefined' ? 'undefined' : _typeof(qs)) === \"object\") {\r\n return url + appender + $.param(qs);\r\n }\r\n\r\n if (typeof qs === \"string\") {\r\n firstChar = qs.charAt(0);\r\n\r\n if (firstChar === \"?\" || firstChar === \"&\") {\r\n appender = \"\";\r\n }\r\n\r\n return url + appender + qs;\r\n }\r\n\r\n throw new Error(\"Query string property must be either a string or object.\");\r\n },\r\n\r\n // BUG #2953: The url needs to be same otherwise it will cause a memory leak\r\n getUrl: function getUrl(connection, transport, reconnecting, poll, ajaxPost) {\r\n /// <summary>Gets the url for making a GET based connect request</summary>\r\n var baseUrl = transport === \"webSockets\" ? \"\" : connection.baseUrl,\r\n url = baseUrl + connection.appRelativeUrl,\r\n qs = \"transport=\" + transport;\r\n\r\n if (!ajaxPost && connection.groupsToken) {\r\n qs += \"&groupsToken=\" + window.encodeURIComponent(connection.groupsToken);\r\n }\r\n\r\n if (!reconnecting) {\r\n url += \"/connect\";\r\n } else {\r\n if (poll) {\r\n // longPolling transport specific\r\n url += \"/poll\";\r\n } else {\r\n url += \"/reconnect\";\r\n }\r\n\r\n if (!ajaxPost && connection.messageId) {\r\n qs += \"&messageId=\" + window.encodeURIComponent(connection.messageId);\r\n }\r\n }\r\n url += \"?\" + qs;\r\n url = transportLogic.prepareQueryString(connection, url);\r\n\r\n // With sse or ws, access_token in request header is not supported\r\n if (connection.transport && connection.accessToken) {\r\n if (connection.transport.name === \"serverSentEvents\" || connection.transport.name === \"webSockets\") {\r\n url += \"&access_token=\" + window.encodeURIComponent(connection.accessToken);\r\n }\r\n }\r\n\r\n if (!ajaxPost) {\r\n url += \"&tid=\" + Math.floor(Math.random() * 11);\r\n }\r\n\r\n return url;\r\n },\r\n\r\n maximizePersistentResponse: function maximizePersistentResponse(minPersistentResponse) {\r\n return {\r\n MessageId: minPersistentResponse.C,\r\n Messages: minPersistentResponse.M,\r\n Initialized: typeof minPersistentResponse.S !== \"undefined\" ? true : false,\r\n ShouldReconnect: typeof minPersistentResponse.T !== \"undefined\" ? true : false,\r\n LongPollDelay: minPersistentResponse.L,\r\n GroupsToken: minPersistentResponse.G,\r\n Error: minPersistentResponse.E\r\n };\r\n },\r\n\r\n updateGroups: function updateGroups(connection, groupsToken) {\r\n if (groupsToken) {\r\n connection.groupsToken = groupsToken;\r\n }\r\n },\r\n\r\n stringifySend: function stringifySend(connection, message) {\r\n if (typeof message === \"string\" || typeof message === \"undefined\" || message === null) {\r\n return message;\r\n }\r\n return connection.json.stringify(message);\r\n },\r\n\r\n ajaxSend: function ajaxSend(connection, data) {\r\n var payload = transportLogic.stringifySend(connection, data),\r\n url = getAjaxUrl(connection, \"/send\"),\r\n xhr,\r\n onFail = function onFail(error, connection) {\r\n $(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);\r\n };\r\n\r\n xhr = transportLogic.ajax(connection, {\r\n url: url,\r\n type: connection.ajaxDataType === \"jsonp\" ? \"GET\" : \"POST\",\r\n contentType: signalR._.defaultContentType,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n data: {\r\n data: payload\r\n },\r\n success: function success(result) {\r\n var res;\r\n\r\n if (result) {\r\n try {\r\n res = connection._parseResponse(result);\r\n } catch (error) {\r\n onFail(error, connection);\r\n connection.stop();\r\n return;\r\n }\r\n\r\n transportLogic.triggerReceived(connection, res);\r\n }\r\n },\r\n error: function error(_error3, textStatus) {\r\n if (textStatus === \"abort\" || textStatus === \"parsererror\") {\r\n // The parsererror happens for sends that don't return any data, and hence\r\n // don't write the jsonp callback to the response. This is harder to fix on the server\r\n // so just hack around it on the client for now.\r\n return;\r\n }\r\n\r\n onFail(_error3, connection);\r\n }\r\n });\r\n\r\n return xhr;\r\n },\r\n\r\n ajaxAbort: function ajaxAbort(connection, async) {\r\n if (typeof connection.transport === \"undefined\") {\r\n return;\r\n }\r\n\r\n // Async by default unless explicitly overidden\r\n async = typeof async === \"undefined\" ? true : async;\r\n\r\n var url = getAjaxUrl(connection, \"/abort\");\r\n\r\n transportLogic.ajax(connection, {\r\n url: url,\r\n async: async,\r\n timeout: 1000,\r\n type: \"POST\",\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n dataType: \"text\" // We don't want to use JSONP here even when JSONP is enabled\r\n });\r\n\r\n connection.log(\"Fired ajax abort async = \" + async + \".\");\r\n },\r\n\r\n ajaxStart: function ajaxStart(connection, onSuccess) {\r\n var rejectDeferred = function rejectDeferred(error) {\r\n var deferred = connection._deferral;\r\n if (deferred) {\r\n deferred.reject(error);\r\n }\r\n },\r\n triggerStartError = function triggerStartError(error) {\r\n connection.log(\"The start request failed. Stopping the connection.\");\r\n $(connection).triggerHandler(events.onError, [error]);\r\n rejectDeferred(error);\r\n connection.stop();\r\n };\r\n\r\n connection._.startRequest = transportLogic.ajax(connection, {\r\n url: getAjaxUrl(connection, \"/start\"),\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result, statusText, xhr) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(result);\r\n } catch (error) {\r\n triggerStartError(signalR._.error(signalR._.format(signalR.resources.errorParsingStartResponse, result), error, xhr));\r\n return;\r\n }\r\n\r\n if (data.Response === \"started\") {\r\n onSuccess();\r\n } else {\r\n triggerStartError(signalR._.error(signalR._.format(signalR.resources.invalidStartResponse, result), null /* error */, xhr));\r\n }\r\n },\r\n error: function error(xhr, statusText, _error4) {\r\n if (statusText !== startAbortText) {\r\n triggerStartError(signalR._.error(signalR.resources.errorDuringStartRequest, _error4, xhr));\r\n } else {\r\n // Stop has been called, no need to trigger the error handler\r\n // or stop the connection again with onStartError\r\n connection.log(\"The start request aborted because connection.stop() was called.\");\r\n rejectDeferred(signalR._.error(signalR.resources.stoppedDuringStartRequest, null /* error */, xhr));\r\n }\r\n }\r\n });\r\n },\r\n\r\n tryAbortStartRequest: function tryAbortStartRequest(connection) {\r\n if (connection._.startRequest) {\r\n // If the start request has already completed this will noop.\r\n connection._.startRequest.abort(startAbortText);\r\n delete connection._.startRequest;\r\n }\r\n },\r\n\r\n tryInitialize: function tryInitialize(connection, persistentResponse, onInitialized) {\r\n if (persistentResponse.Initialized && onInitialized) {\r\n onInitialized();\r\n } else if (persistentResponse.Initialized) {\r\n connection.log(\"WARNING! The client received an init message after reconnecting.\");\r\n }\r\n },\r\n\r\n triggerReceived: function triggerReceived(connection, data) {\r\n if (!connection._.connectingMessageBuffer.tryBuffer(data)) {\r\n $(connection).triggerHandler(events.onReceived, [data]);\r\n }\r\n },\r\n\r\n processMessages: function processMessages(connection, minData, onInitialized) {\r\n var data;\r\n\r\n if (minData && typeof minData.I !== \"undefined\") {\r\n // This is a response to a message the client sent\r\n transportLogic.triggerReceived(connection, minData);\r\n return;\r\n }\r\n\r\n // Update the last message time stamp\r\n transportLogic.markLastMessage(connection);\r\n\r\n if (minData) {\r\n // This is a message send directly to the client\r\n data = transportLogic.maximizePersistentResponse(minData);\r\n\r\n if (data.Error) {\r\n // This is a global error, stop the connection.\r\n connection.log(\"Received an error message from the server: \" + minData.E);\r\n $(connection).triggerHandler(signalR.events.onError, [signalR._.error(minData.E, /* source */\"ServerError\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n return;\r\n }\r\n\r\n transportLogic.updateGroups(connection, data.GroupsToken);\r\n\r\n if (data.MessageId) {\r\n connection.messageId = data.MessageId;\r\n }\r\n\r\n if (data.Messages) {\r\n $.each(data.Messages, function (index, message) {\r\n transportLogic.triggerReceived(connection, message);\r\n });\r\n\r\n transportLogic.tryInitialize(connection, data, onInitialized);\r\n }\r\n }\r\n },\r\n\r\n monitorKeepAlive: function monitorKeepAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData;\r\n\r\n // If we haven't initiated the keep alive timeouts then we need to\r\n if (!keepAliveData.monitoring) {\r\n keepAliveData.monitoring = true;\r\n\r\n transportLogic.markLastMessage(connection);\r\n\r\n // Save the function so we can unbind it on stop\r\n connection._.keepAliveData.reconnectKeepAliveUpdate = function () {\r\n // Mark a new message so that keep alive doesn't time out connections\r\n transportLogic.markLastMessage(connection);\r\n };\r\n\r\n // Update Keep alive on reconnect\r\n $(connection).bind(events.onReconnect, connection._.keepAliveData.reconnectKeepAliveUpdate);\r\n\r\n connection.log(\"Now monitoring keep alive with a warning timeout of \" + keepAliveData.timeoutWarning + \", keep alive timeout of \" + keepAliveData.timeout + \" and disconnecting timeout of \" + connection.disconnectTimeout);\r\n } else {\r\n connection.log(\"Tried to monitor keep alive but it's already being monitored.\");\r\n }\r\n },\r\n\r\n stopMonitoringKeepAlive: function stopMonitoringKeepAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData;\r\n\r\n // Only attempt to stop the keep alive monitoring if its being monitored\r\n if (keepAliveData.monitoring) {\r\n // Stop monitoring\r\n keepAliveData.monitoring = false;\r\n\r\n // Remove the updateKeepAlive function from the reconnect event\r\n $(connection).unbind(events.onReconnect, connection._.keepAliveData.reconnectKeepAliveUpdate);\r\n\r\n // Clear all the keep alive data\r\n connection._.keepAliveData = {};\r\n connection.log(\"Stopping the monitoring of the keep alive.\");\r\n }\r\n },\r\n\r\n startHeartbeat: function startHeartbeat(connection) {\r\n connection._.lastActiveAt = new Date().getTime();\r\n beat(connection);\r\n },\r\n\r\n markLastMessage: function markLastMessage(connection) {\r\n connection._.lastMessageAt = new Date().getTime();\r\n },\r\n\r\n markActive: function markActive(connection) {\r\n if (transportLogic.verifyLastActive(connection)) {\r\n connection._.lastActiveAt = new Date().getTime();\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n\r\n isConnectedOrReconnecting: function isConnectedOrReconnecting(connection) {\r\n return connection.state === signalR.connectionState.connected || connection.state === signalR.connectionState.reconnecting;\r\n },\r\n\r\n ensureReconnectingState: function ensureReconnectingState(connection) {\r\n if (changeState(connection, signalR.connectionState.connected, signalR.connectionState.reconnecting) === true) {\r\n $(connection).triggerHandler(events.onReconnecting);\r\n }\r\n return connection.state === signalR.connectionState.reconnecting;\r\n },\r\n\r\n clearReconnectTimeout: function clearReconnectTimeout(connection) {\r\n if (connection && connection._.reconnectTimeout) {\r\n window.clearTimeout(connection._.reconnectTimeout);\r\n delete connection._.reconnectTimeout;\r\n }\r\n },\r\n\r\n verifyLastActive: function verifyLastActive(connection) {\r\n if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {\r\n var message = signalR._.format(signalR.resources.reconnectWindowTimeout, new Date(connection._.lastActiveAt), connection.reconnectWindow);\r\n connection.log(message);\r\n $(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */\"TimeoutException\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n return false;\r\n }\r\n\r\n return true;\r\n },\r\n\r\n reconnect: function reconnect(connection, transportName) {\r\n var transport = signalR.transports[transportName];\r\n\r\n // We should only set a reconnectTimeout if we are currently connected\r\n // and a reconnectTimeout isn't already set.\r\n if (transportLogic.isConnectedOrReconnecting(connection) && !connection._.reconnectTimeout) {\r\n // Need to verify before the setTimeout occurs because an application sleep could occur during the setTimeout duration.\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n connection._.reconnectTimeout = window.setTimeout(function () {\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n transport.stop(connection);\r\n\r\n if (transportLogic.ensureReconnectingState(connection)) {\r\n connection.log(transportName + \" reconnecting.\");\r\n transport.start(connection);\r\n }\r\n }, connection.reconnectDelay);\r\n }\r\n },\r\n\r\n handleParseFailure: function handleParseFailure(connection, result, error, onFailed, context) {\r\n var wrappedError = signalR._.transportError(signalR._.format(signalR.resources.parseFailed, result), connection.transport, error, context);\r\n\r\n // If we're in the initialization phase trigger onFailed, otherwise stop the connection.\r\n if (onFailed && onFailed(wrappedError)) {\r\n connection.log(\"Failed to parse server response while attempting to connect.\");\r\n } else {\r\n $(connection).triggerHandler(events.onError, [wrappedError]);\r\n connection.stop();\r\n }\r\n },\r\n\r\n initHandler: function initHandler(connection) {\r\n return new InitHandler(connection);\r\n },\r\n\r\n foreverFrame: {\r\n count: 0,\r\n connections: {}\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.webSockets.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic;\r\n\r\n signalR.transports.webSockets = {\r\n name: \"webSockets\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n send: function send(connection, data) {\r\n var payload = transportLogic.stringifySend(connection, data);\r\n\r\n try {\r\n connection.socket.send(payload);\r\n } catch (ex) {\r\n $(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.webSocketsInvalidState, connection.transport, ex, connection.socket), data]);\r\n }\r\n },\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n var url,\r\n opened = false,\r\n that = this,\r\n reconnecting = !onSuccess,\r\n $connection = $(connection);\r\n\r\n if (!window.WebSocket) {\r\n onFailed();\r\n return;\r\n }\r\n\r\n if (!connection.socket) {\r\n if (connection.webSocketServerUrl) {\r\n url = connection.webSocketServerUrl;\r\n } else {\r\n url = connection.wsProtocol + connection.host;\r\n }\r\n\r\n url += transportLogic.getUrl(connection, this.name, reconnecting);\r\n\r\n connection.log(\"Connecting to websocket endpoint '\" + url + \"'.\");\r\n connection.socket = new window.WebSocket(url);\r\n\r\n connection.socket.onopen = function () {\r\n opened = true;\r\n connection.log(\"Websocket opened.\");\r\n\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n $connection.triggerHandler(events.onReconnect);\r\n }\r\n };\r\n\r\n connection.socket.onclose = function (event) {\r\n var error;\r\n\r\n // Only handle a socket close if the close is from the current socket.\r\n // Sometimes on disconnect the server will push down an onclose event\r\n // to an expired socket.\r\n\r\n if (this === connection.socket) {\r\n if (opened && typeof event.wasClean !== \"undefined\" && event.wasClean === false) {\r\n // Ideally this would use the websocket.onerror handler (rather than checking wasClean in onclose) but\r\n // I found in some circumstances Chrome won't call onerror. This implementation seems to work on all browsers.\r\n error = signalR._.transportError(signalR.resources.webSocketClosed, connection.transport, event);\r\n\r\n connection.log(\"Unclean disconnect from websocket: \" + (event.reason || \"[no reason given].\"));\r\n } else {\r\n connection.log(\"Websocket closed.\");\r\n }\r\n\r\n if (!onFailed || !onFailed(error)) {\r\n if (error) {\r\n $(connection).triggerHandler(events.onError, [error]);\r\n }\r\n\r\n that.reconnect(connection);\r\n }\r\n }\r\n };\r\n\r\n connection.socket.onmessage = function (event) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(event.data);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(connection, event.data, error, onFailed, event);\r\n return;\r\n }\r\n\r\n if (data) {\r\n transportLogic.processMessages(connection, data, onSuccess);\r\n }\r\n };\r\n }\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n transportLogic.reconnect(connection, this.name);\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n stop: function stop(connection) {\r\n // Don't trigger a reconnect after stopping\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (connection.socket) {\r\n connection.log(\"Closing the Websocket.\");\r\n connection.socket.close();\r\n connection.socket = null;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.serverSentEvents.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic,\r\n clearReconnectAttemptTimeout = function clearReconnectAttemptTimeout(connection) {\r\n window.clearTimeout(connection._.reconnectAttemptTimeoutHandle);\r\n delete connection._.reconnectAttemptTimeoutHandle;\r\n };\r\n\r\n signalR.transports.serverSentEvents = {\r\n name: \"serverSentEvents\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n timeOut: 3000,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n var that = this,\r\n opened = false,\r\n $connection = $(connection),\r\n reconnecting = !onSuccess,\r\n url;\r\n\r\n if (connection.eventSource) {\r\n connection.log(\"The connection already has an event source. Stopping it.\");\r\n connection.stop();\r\n }\r\n\r\n if (!window.EventSource) {\r\n if (onFailed) {\r\n connection.log(\"This browser doesn't support SSE.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n url = transportLogic.getUrl(connection, this.name, reconnecting);\r\n\r\n try {\r\n connection.log(\"Attempting to connect to SSE endpoint '\" + url + \"'.\");\r\n connection.eventSource = new window.EventSource(url, { withCredentials: connection.withCredentials });\r\n } catch (e) {\r\n connection.log(\"EventSource failed trying to connect with error \" + e.Message + \".\");\r\n if (onFailed) {\r\n // The connection failed, call the failed callback\r\n onFailed();\r\n } else {\r\n $connection.triggerHandler(events.onError, [signalR._.transportError(signalR.resources.eventSourceFailedToConnect, connection.transport, e)]);\r\n if (reconnecting) {\r\n // If we were reconnecting, rather than doing initial connect, then try reconnect again\r\n that.reconnect(connection);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (reconnecting) {\r\n connection._.reconnectAttemptTimeoutHandle = window.setTimeout(function () {\r\n if (opened === false) {\r\n // If we're reconnecting and the event source is attempting to connect,\r\n // don't keep retrying. This causes duplicate connections to spawn.\r\n if (connection.eventSource.readyState !== window.EventSource.OPEN) {\r\n // If we were reconnecting, rather than doing initial connect, then try reconnect again\r\n that.reconnect(connection);\r\n }\r\n }\r\n }, that.timeOut);\r\n }\r\n\r\n connection.eventSource.addEventListener(\"open\", function (e) {\r\n connection.log(\"EventSource connected.\");\r\n\r\n clearReconnectAttemptTimeout(connection);\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (opened === false) {\r\n opened = true;\r\n\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n $connection.triggerHandler(events.onReconnect);\r\n }\r\n }\r\n }, false);\r\n\r\n connection.eventSource.addEventListener(\"message\", function (e) {\r\n var res;\r\n\r\n // process messages\r\n if (e.data === \"initialized\") {\r\n return;\r\n }\r\n\r\n try {\r\n res = connection._parseResponse(e.data);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(connection, e.data, error, onFailed, e);\r\n return;\r\n }\r\n\r\n transportLogic.processMessages(connection, res, onSuccess);\r\n }, false);\r\n\r\n connection.eventSource.addEventListener(\"error\", function (e) {\r\n var error = signalR._.transportError(signalR.resources.eventSourceError, connection.transport, e);\r\n\r\n // Only handle an error if the error is from the current Event Source.\r\n // Sometimes on disconnect the server will push down an error event\r\n // to an expired Event Source.\r\n if (this !== connection.eventSource) {\r\n return;\r\n }\r\n\r\n if (onFailed && onFailed(error)) {\r\n return;\r\n }\r\n\r\n connection.log(\"EventSource readyState: \" + connection.eventSource.readyState + \".\");\r\n\r\n if (e.eventPhase === window.EventSource.CLOSED) {\r\n // We don't use the EventSource's native reconnect function as it\r\n // doesn't allow us to change the URL when reconnecting. We need\r\n // to change the URL to not include the /connect suffix, and pass\r\n // the last message id we received.\r\n connection.log(\"EventSource reconnecting due to the server connection ending.\");\r\n that.reconnect(connection);\r\n } else {\r\n // connection error\r\n connection.log(\"EventSource error.\");\r\n $connection.triggerHandler(events.onError, [error]);\r\n }\r\n }, false);\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n transportLogic.reconnect(connection, this.name);\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n stop: function stop(connection) {\r\n // Don't trigger a reconnect after stopping\r\n clearReconnectAttemptTimeout(connection);\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (connection && connection.eventSource) {\r\n connection.log(\"EventSource calling close().\");\r\n connection.eventSource.close();\r\n connection.eventSource = null;\r\n delete connection.eventSource;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.foreverFrame.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic,\r\n createFrame = function createFrame() {\r\n var frame = window.document.createElement(\"iframe\");\r\n frame.setAttribute(\"style\", \"position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;\");\r\n return frame;\r\n },\r\n\r\n // Used to prevent infinite loading icon spins in older versions of ie\r\n // We build this object inside a closure so we don't pollute the rest of\r\n // the foreverFrame transport with unnecessary functions/utilities.\r\n loadPreventer = function () {\r\n var loadingFixIntervalId = null,\r\n loadingFixInterval = 1000,\r\n attachedTo = 0;\r\n\r\n return {\r\n prevent: function prevent() {\r\n // Prevent additional iframe removal procedures from newer browsers\r\n if (signalR._.ieVersion <= 8) {\r\n // We only ever want to set the interval one time, so on the first attachedTo\r\n if (attachedTo === 0) {\r\n // Create and destroy iframe every 3 seconds to prevent loading icon, super hacky\r\n loadingFixIntervalId = window.setInterval(function () {\r\n var tempFrame = createFrame();\r\n\r\n window.document.body.appendChild(tempFrame);\r\n window.document.body.removeChild(tempFrame);\r\n\r\n tempFrame = null;\r\n }, loadingFixInterval);\r\n }\r\n\r\n attachedTo++;\r\n }\r\n },\r\n cancel: function cancel() {\r\n // Only clear the interval if there's only one more object that the loadPreventer is attachedTo\r\n if (attachedTo === 1) {\r\n window.clearInterval(loadingFixIntervalId);\r\n }\r\n\r\n if (attachedTo > 0) {\r\n attachedTo--;\r\n }\r\n }\r\n };\r\n }();\r\n\r\n signalR.transports.foreverFrame = {\r\n name: \"foreverFrame\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n // Added as a value here so we can create tests to verify functionality\r\n iframeClearThreshold: 50,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n if (connection.accessToken) {\r\n if (onFailed) {\r\n connection.log(\"Forever Frame does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n var that = this,\r\n frameId = transportLogic.foreverFrame.count += 1,\r\n url,\r\n frame = createFrame(),\r\n frameLoadHandler = function frameLoadHandler() {\r\n connection.log(\"Forever frame iframe finished loading and is no longer receiving messages.\");\r\n if (!onFailed || !onFailed()) {\r\n that.reconnect(connection);\r\n }\r\n };\r\n\r\n if (window.EventSource) {\r\n // If the browser supports SSE, don't use Forever Frame\r\n if (onFailed) {\r\n connection.log(\"Forever Frame is not supported by SignalR on browsers with SSE support.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n frame.setAttribute(\"data-signalr-connection-id\", connection.id);\r\n\r\n // Start preventing loading icon\r\n // This will only perform work if the loadPreventer is not attached to another connection.\r\n loadPreventer.prevent();\r\n\r\n // Build the url\r\n url = transportLogic.getUrl(connection, this.name);\r\n url += \"&frameId=\" + frameId;\r\n\r\n // add frame to the document prior to setting URL to avoid caching issues.\r\n window.document.documentElement.appendChild(frame);\r\n\r\n connection.log(\"Binding to iframe's load event.\");\r\n\r\n if (frame.addEventListener) {\r\n frame.addEventListener(\"load\", frameLoadHandler, false);\r\n } else if (frame.attachEvent) {\r\n frame.attachEvent(\"onload\", frameLoadHandler);\r\n }\r\n\r\n frame.src = url;\r\n transportLogic.foreverFrame.connections[frameId] = connection;\r\n\r\n connection.frame = frame;\r\n connection.frameId = frameId;\r\n\r\n if (onSuccess) {\r\n connection.onSuccess = function () {\r\n connection.log(\"Iframe transport started.\");\r\n onSuccess();\r\n };\r\n }\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n var that = this;\r\n\r\n // Need to verify connection state and verify before the setTimeout occurs because an application sleep could occur during the setTimeout duration.\r\n if (transportLogic.isConnectedOrReconnecting(connection) && transportLogic.verifyLastActive(connection)) {\r\n window.setTimeout(function () {\r\n // Verify that we're ok to reconnect.\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n if (connection.frame && transportLogic.ensureReconnectingState(connection)) {\r\n var frame = connection.frame,\r\n src = transportLogic.getUrl(connection, that.name, true) + \"&frameId=\" + connection.frameId;\r\n connection.log(\"Updating iframe src to '\" + src + \"'.\");\r\n frame.src = src;\r\n }\r\n }, connection.reconnectDelay);\r\n }\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n receive: function receive(connection, data) {\r\n var cw, body, response;\r\n\r\n if (connection.json !== connection._originalJson) {\r\n // If there's a custom JSON parser configured then serialize the object\r\n // using the original (browser) JSON parser and then deserialize it using\r\n // the custom parser (connection._parseResponse does that). This is so we\r\n // can easily send the response from the server as \"raw\" JSON but still\r\n // support custom JSON deserialization in the browser.\r\n data = connection._originalJson.stringify(data);\r\n }\r\n\r\n response = connection._parseResponse(data);\r\n\r\n transportLogic.processMessages(connection, response, connection.onSuccess);\r\n\r\n // Protect against connection stopping from a callback trigger within the processMessages above.\r\n if (connection.state === $.signalR.connectionState.connected) {\r\n // Delete the script & div elements\r\n connection.frameMessageCount = (connection.frameMessageCount || 0) + 1;\r\n if (connection.frameMessageCount > signalR.transports.foreverFrame.iframeClearThreshold) {\r\n connection.frameMessageCount = 0;\r\n cw = connection.frame.contentWindow || connection.frame.contentDocument;\r\n if (cw && cw.document && cw.document.body) {\r\n body = cw.document.body;\r\n\r\n // Remove all the child elements from the iframe's body to conserver memory\r\n while (body.firstChild) {\r\n body.removeChild(body.firstChild);\r\n }\r\n }\r\n }\r\n }\r\n },\r\n\r\n stop: function stop(connection) {\r\n var cw = null;\r\n\r\n // Stop attempting to prevent loading icon\r\n loadPreventer.cancel();\r\n\r\n if (connection.frame) {\r\n if (connection.frame.stop) {\r\n connection.frame.stop();\r\n } else {\r\n try {\r\n cw = connection.frame.contentWindow || connection.frame.contentDocument;\r\n if (cw.document && cw.document.execCommand) {\r\n cw.document.execCommand(\"Stop\");\r\n }\r\n } catch (e) {\r\n connection.log(\"Error occurred when stopping foreverFrame transport. Message = \" + e.message + \".\");\r\n }\r\n }\r\n\r\n // Ensure the iframe is where we left it\r\n if (connection.frame.parentNode === window.document.documentElement) {\r\n window.document.documentElement.removeChild(connection.frame);\r\n }\r\n\r\n delete transportLogic.foreverFrame.connections[connection.frameId];\r\n connection.frame = null;\r\n connection.frameId = null;\r\n delete connection.frame;\r\n delete connection.frameId;\r\n delete connection.onSuccess;\r\n delete connection.frameMessageCount;\r\n connection.log(\"Stopping forever frame.\");\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n },\r\n\r\n getConnection: function getConnection(id) {\r\n return transportLogic.foreverFrame.connections[id];\r\n },\r\n\r\n started: function started(connection) {\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n\r\n $(connection).triggerHandler(events.onReconnect);\r\n }\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.longPolling.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n isDisconnecting = $.signalR.isDisconnecting,\r\n transportLogic = signalR.transports._logic;\r\n\r\n signalR.transports.longPolling = {\r\n name: \"longPolling\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return false;\r\n },\r\n\r\n reconnectDelay: 3000,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n /// <summary>Starts the long polling connection</summary>\r\n /// <param name=\"connection\" type=\"signalR\">The SignalR connection to start</param>\r\n var that = this,\r\n _fireConnect = function fireConnect() {\r\n _fireConnect = $.noop;\r\n\r\n connection.log(\"LongPolling connected.\");\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n } else {\r\n connection.log(\"WARNING! The client received an init message after reconnecting.\");\r\n }\r\n },\r\n tryFailConnect = function tryFailConnect(error) {\r\n if (onFailed(error)) {\r\n connection.log(\"LongPolling failed to connect.\");\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n privateData = connection._,\r\n reconnectErrors = 0,\r\n fireReconnected = function fireReconnected(instance) {\r\n window.clearTimeout(privateData.reconnectTimeoutId);\r\n privateData.reconnectTimeoutId = null;\r\n\r\n if (changeState(instance, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n // Successfully reconnected!\r\n instance.log(\"Raising the reconnect event\");\r\n $(instance).triggerHandler(events.onReconnect);\r\n }\r\n },\r\n\r\n // 1 hour\r\n maxFireReconnectedTimeout = 3600000;\r\n\r\n if (connection.pollXhr) {\r\n connection.log(\"Polling xhr requests already exists, aborting.\");\r\n connection.stop();\r\n }\r\n\r\n connection.messageId = null;\r\n\r\n privateData.reconnectTimeoutId = null;\r\n\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n (function poll(instance, raiseReconnect) {\r\n var messageId = instance.messageId,\r\n connect = messageId === null,\r\n reconnecting = !connect,\r\n polling = !raiseReconnect,\r\n url = transportLogic.getUrl(instance, that.name, reconnecting, polling, true /* use Post for longPolling */),\r\n postData = {};\r\n\r\n if (instance.messageId) {\r\n postData.messageId = instance.messageId;\r\n }\r\n\r\n if (instance.groupsToken) {\r\n postData.groupsToken = instance.groupsToken;\r\n }\r\n\r\n // If we've disconnected during the time we've tried to re-instantiate the poll then stop.\r\n if (isDisconnecting(instance) === true) {\r\n return;\r\n }\r\n\r\n connection.log(\"Opening long polling request to '\" + url + \"'.\");\r\n instance.pollXhr = transportLogic.ajax(connection, {\r\n xhrFields: {\r\n onprogress: function onprogress() {\r\n transportLogic.markLastMessage(connection);\r\n }\r\n },\r\n url: url,\r\n type: \"POST\",\r\n contentType: signalR._.defaultContentType,\r\n data: postData,\r\n timeout: connection._.pollTimeout,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result) {\r\n var minData,\r\n delay = 0,\r\n data,\r\n shouldReconnect;\r\n\r\n connection.log(\"Long poll complete.\");\r\n\r\n // Reset our reconnect errors so if we transition into a reconnecting state again we trigger\r\n // reconnected quickly\r\n reconnectErrors = 0;\r\n\r\n try {\r\n // Remove any keep-alives from the beginning of the result\r\n minData = connection._parseResponse(result);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(instance, result, error, tryFailConnect, instance.pollXhr);\r\n return;\r\n }\r\n\r\n // If there's currently a timeout to trigger reconnect, fire it now before processing messages\r\n if (privateData.reconnectTimeoutId !== null) {\r\n fireReconnected(instance);\r\n }\r\n\r\n if (minData) {\r\n data = transportLogic.maximizePersistentResponse(minData);\r\n }\r\n\r\n transportLogic.processMessages(instance, minData, _fireConnect);\r\n\r\n if (data && $.type(data.LongPollDelay) === \"number\") {\r\n delay = data.LongPollDelay;\r\n }\r\n\r\n if (isDisconnecting(instance) === true) {\r\n return;\r\n }\r\n\r\n shouldReconnect = data && data.ShouldReconnect;\r\n if (shouldReconnect) {\r\n // Transition into the reconnecting state\r\n // If this fails then that means that the user transitioned the connection into a invalid state in processMessages.\r\n if (!transportLogic.ensureReconnectingState(instance)) {\r\n return;\r\n }\r\n }\r\n\r\n // We never want to pass a raiseReconnect flag after a successful poll. This is handled via the error function\r\n if (delay > 0) {\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n poll(instance, shouldReconnect);\r\n }, delay);\r\n } else {\r\n poll(instance, shouldReconnect);\r\n }\r\n },\r\n\r\n error: function error(data, textStatus) {\r\n var error = signalR._.transportError(signalR.resources.longPollFailed, connection.transport, data, instance.pollXhr);\r\n\r\n // Stop trying to trigger reconnect, connection is in an error state\r\n // If we're not in the reconnect state this will noop\r\n window.clearTimeout(privateData.reconnectTimeoutId);\r\n privateData.reconnectTimeoutId = null;\r\n\r\n if (textStatus === \"abort\") {\r\n connection.log(\"Aborted xhr request.\");\r\n return;\r\n }\r\n\r\n if (!tryFailConnect(error)) {\r\n\r\n // Increment our reconnect errors, we assume all errors to be reconnect errors\r\n // In the case that it's our first error this will cause Reconnect to be fired\r\n // after 1 second due to reconnectErrors being = 1.\r\n reconnectErrors++;\r\n\r\n if (connection.state !== signalR.connectionState.reconnecting) {\r\n connection.log(\"An error occurred using longPolling. Status = \" + textStatus + \". Response = \" + data.responseText + \".\");\r\n $(instance).triggerHandler(events.onError, [error]);\r\n }\r\n\r\n // We check the state here to verify that we're not in an invalid state prior to verifying Reconnect.\r\n // If we're not in connected or reconnecting then the next ensureReconnectingState check will fail and will return.\r\n // Therefore we don't want to change that failure code path.\r\n if ((connection.state === signalR.connectionState.connected || connection.state === signalR.connectionState.reconnecting) && !transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n // Transition into the reconnecting state\r\n // If this fails then that means that the user transitioned the connection into the disconnected or connecting state within the above error handler trigger.\r\n if (!transportLogic.ensureReconnectingState(instance)) {\r\n return;\r\n }\r\n\r\n // Call poll with the raiseReconnect flag as true after the reconnect delay\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n poll(instance, true);\r\n }, that.reconnectDelay);\r\n }\r\n }\r\n });\r\n\r\n // This will only ever pass after an error has occurred via the poll ajax procedure.\r\n if (reconnecting && raiseReconnect === true) {\r\n // We wait to reconnect depending on how many times we've failed to reconnect.\r\n // This is essentially a heuristic that will exponentially increase in wait time before\r\n // triggering reconnected. This depends on the \"error\" handler of Poll to cancel this\r\n // timeout if it triggers before the Reconnected event fires.\r\n // The Math.min at the end is to ensure that the reconnect timeout does not overflow.\r\n privateData.reconnectTimeoutId = window.setTimeout(function () {\r\n fireReconnected(instance);\r\n }, Math.min(1000 * (Math.pow(2, reconnectErrors) - 1), maxFireReconnectedTimeout));\r\n }\r\n })(connection);\r\n }, 250); // Have to delay initial poll so Chrome doesn't show loader spinner in tab\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n if (connection.pollXhr) {\r\n connection.pollXhr.abort(\"lostConnection\");\r\n }\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n stop: function stop(connection) {\r\n /// <summary>Stops the long polling connection</summary>\r\n /// <param name=\"connection\" type=\"signalR\">The SignalR connection to stop</param>\r\n\r\n window.clearTimeout(connection._.pollTimeoutId);\r\n window.clearTimeout(connection._.reconnectTimeoutId);\r\n\r\n delete connection._.pollTimeoutId;\r\n delete connection._.reconnectTimeoutId;\r\n\r\n if (connection.pollXhr) {\r\n connection.pollXhr.abort();\r\n connection.pollXhr = null;\r\n delete connection.pollXhr;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.hubs.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var nextGuid = 0;\r\n var eventNamespace = \".hubProxy\",\r\n signalR = $.signalR;\r\n\r\n function makeEventName(event) {\r\n return event + eventNamespace;\r\n }\r\n\r\n // Equivalent to Array.prototype.map\r\n function map(arr, fun, thisp) {\r\n var i,\r\n length = arr.length,\r\n result = [];\r\n for (i = 0; i < length; i += 1) {\r\n if (arr.hasOwnProperty(i)) {\r\n result[i] = fun.call(thisp, arr[i], i, arr);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n function getArgValue(a) {\r\n return $.isFunction(a) ? null : $.type(a) === \"undefined\" ? null : a;\r\n }\r\n\r\n function hasMembers(obj) {\r\n for (var key in obj) {\r\n // If we have any properties in our callback map then we have callbacks and can exit the loop via return\r\n if (obj.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function clearInvocationCallbacks(connection, error) {\r\n /// <param name=\"connection\" type=\"hubConnection\" />\r\n var callbacks = connection._.invocationCallbacks,\r\n callback;\r\n\r\n if (hasMembers(callbacks)) {\r\n connection.log(\"Clearing hub invocation callbacks with error: \" + error + \".\");\r\n }\r\n\r\n // Reset the callback cache now as we have a local var referencing it\r\n connection._.invocationCallbackId = 0;\r\n delete connection._.invocationCallbacks;\r\n connection._.invocationCallbacks = {};\r\n\r\n // Loop over the callbacks and invoke them.\r\n // We do this using a local var reference and *after* we've cleared the cache\r\n // so that if a fail callback itself tries to invoke another method we don't\r\n // end up with its callback in the list we're looping over.\r\n for (var callbackId in callbacks) {\r\n callback = callbacks[callbackId];\r\n callback.method.call(callback.scope, { E: error });\r\n }\r\n }\r\n\r\n function isCallbackFromGeneratedHubProxy(callback) {\r\n // https://github.com/SignalR/SignalR/issues/4310\r\n // The stringified callback from the old generated hub proxy is 137 characters in Edge, Firefox and Chrome.\r\n // We slice to avoid wasting too many cycles searching through the text of a long large function.\r\n return $.isFunction(callback) && callback.toString().slice(0, 256).indexOf(\"// Call the client hub method\") >= 0;\r\n }\r\n\r\n // hubProxy\r\n function hubProxy(hubConnection, hubName) {\r\n /// <summary>\r\n /// Creates a new proxy object for the given hub connection that can be used to invoke\r\n /// methods on server hubs and handle client method invocation requests from the server.\r\n /// </summary>\r\n return new hubProxy.fn.init(hubConnection, hubName);\r\n }\r\n\r\n hubProxy.fn = hubProxy.prototype = {\r\n init: function init(connection, hubName) {\r\n this.state = {};\r\n this.connection = connection;\r\n this.hubName = hubName;\r\n this._ = {\r\n callbackMap: {}\r\n };\r\n },\r\n\r\n constructor: hubProxy,\r\n\r\n hasSubscriptions: function hasSubscriptions() {\r\n return hasMembers(this._.callbackMap);\r\n },\r\n\r\n on: function on(eventName, callback, callbackIdentity) {\r\n /// <summary>Wires up a callback to be invoked when a invocation request is received from the server hub.</summary>\r\n /// <param name=\"eventName\" type=\"String\">The name of the hub event to register the callback for.</param>\r\n /// <param name=\"callback\" type=\"Function\">The callback to be invoked.</param>\r\n /// <param name=\"callbackIdentity\" type=\"Object\">An optional object to use as the \"identity\" for the callback when checking if the handler has already been registered. Defaults to the value of 'callback' if not provided.</param>\r\n var that = this,\r\n callbackMap = that._.callbackMap,\r\n isFromOldGeneratedHubProxy = !callbackIdentity && isCallbackFromGeneratedHubProxy(callback);\r\n\r\n // We need the third \"identity\" argument because the registerHubProxies call made by signalr/js wraps the user-provided callback in a custom wrapper which breaks the identity comparison.\r\n // callbackIdentity allows the caller of `on` to provide a separate object to use as the \"identity\". `registerHubProxies` uses the original user callback as this identity object.\r\n callbackIdentity = callbackIdentity || callback;\r\n\r\n // Assign a global ID to the identity object. This tags the object so we can detect the same object when it comes back.\r\n if (!callbackIdentity._signalRGuid) {\r\n callbackIdentity._signalRGuid = nextGuid++;\r\n }\r\n\r\n // Normalize the event name to lowercase\r\n eventName = eventName.toLowerCase();\r\n\r\n // If there is not an event registered for this callback yet we want to create its event space in the callback map.\r\n var callbackSpace = callbackMap[eventName];\r\n if (!callbackSpace) {\r\n callbackSpace = [];\r\n callbackMap[eventName] = callbackSpace;\r\n }\r\n\r\n // Check if there's already a registration\r\n var registration;\r\n for (var i = 0; i < callbackSpace.length; i++) {\r\n if (callbackSpace[i].guid === callbackIdentity._signalRGuid || isFromOldGeneratedHubProxy && callbackSpace[i].isFromOldGeneratedHubProxy) {\r\n registration = callbackSpace[i];\r\n }\r\n }\r\n\r\n // Create a registration if there isn't one already\r\n if (!registration) {\r\n registration = {\r\n guid: callbackIdentity._signalRGuid,\r\n eventHandlers: [],\r\n isFromOldGeneratedHubProxy: isFromOldGeneratedHubProxy\r\n };\r\n callbackMap[eventName].push(registration);\r\n }\r\n\r\n var handler = function handler(e, data) {\r\n callback.apply(that, data);\r\n };\r\n registration.eventHandlers.push(handler);\r\n\r\n $(that).bind(makeEventName(eventName), handler);\r\n\r\n return that;\r\n },\r\n\r\n off: function off(eventName, callback, callbackIdentity) {\r\n /// <summary>Removes the callback invocation request from the server hub for the given event name.</summary>\r\n /// <param name=\"eventName\" type=\"String\">The name of the hub event to unregister the callback for.</param>\r\n /// <param name=\"callback\" type=\"Function\">The callback to be removed.</param>\r\n /// <param name=\"callbackIdentity\" type=\"Object\">An optional object to use as the \"identity\" when looking up the callback. Corresponds to the same parameter provided to 'on'. Defaults to the value of 'callback' if not provided.</param>\r\n var that = this,\r\n callbackMap = that._.callbackMap,\r\n callbackSpace,\r\n isFromOldGeneratedHubProxy = !callbackIdentity && isCallbackFromGeneratedHubProxy(callback);\r\n\r\n callbackIdentity = callbackIdentity || callback;\r\n\r\n // Normalize the event name to lowercase\r\n eventName = eventName.toLowerCase();\r\n\r\n callbackSpace = callbackMap[eventName];\r\n\r\n // Verify that there is an event space to unbind\r\n if (callbackSpace) {\r\n\r\n if (callback) {\r\n // Find the callback registration\r\n var callbackRegistration;\r\n var callbackIndex;\r\n for (var i = 0; i < callbackSpace.length; i++) {\r\n if (callbackSpace[i].guid === callbackIdentity._signalRGuid || isFromOldGeneratedHubProxy && callbackSpace[i].isFromOldGeneratedHubProxy) {\r\n callbackIndex = i;\r\n callbackRegistration = callbackSpace[i];\r\n }\r\n }\r\n\r\n // Only unbind if there's an event bound with eventName and a callback with the specified callback\r\n if (callbackRegistration) {\r\n // Unbind all event handlers associated with the registration.\r\n for (var j = 0; j < callbackRegistration.eventHandlers.length; j++) {\r\n $(that).unbind(makeEventName(eventName), callbackRegistration.eventHandlers[j]);\r\n }\r\n\r\n // Remove the registration from the list\r\n callbackSpace.splice(i, 1);\r\n\r\n // Check if there are any registrations left, if not we need to destroy it.\r\n if (callbackSpace.length === 0) {\r\n delete callbackMap[eventName];\r\n }\r\n }\r\n } else if (!callback) {\r\n // Check if we're removing the whole event and we didn't error because of an invalid callback\r\n $(that).unbind(makeEventName(eventName));\r\n\r\n delete callbackMap[eventName];\r\n }\r\n }\r\n\r\n return that;\r\n },\r\n\r\n invoke: function invoke(methodName) {\r\n /// <summary>Invokes a server hub method with the given arguments.</summary>\r\n /// <param name=\"methodName\" type=\"String\">The name of the server hub method.</param>\r\n\r\n var that = this,\r\n connection = that.connection,\r\n args = $.makeArray(arguments).slice(1),\r\n argValues = map(args, getArgValue),\r\n data = { H: that.hubName, M: methodName, A: argValues, I: connection._.invocationCallbackId },\r\n d = $.Deferred(),\r\n callback = function callback(minResult) {\r\n var result = that._maximizeHubResponse(minResult),\r\n source,\r\n error;\r\n\r\n // Update the hub state\r\n $.extend(that.state, result.State);\r\n\r\n if (result.Progress) {\r\n if (d.notifyWith) {\r\n // Progress is only supported in jQuery 1.7+\r\n d.notifyWith(that, [result.Progress.Data]);\r\n } else if (!connection._.progressjQueryVersionLogged) {\r\n connection.log(\"A hub method invocation progress update was received but the version of jQuery in use (\" + $.prototype.jquery + \") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications.\");\r\n connection._.progressjQueryVersionLogged = true;\r\n }\r\n } else if (result.Error) {\r\n // Server hub method threw an exception, log it & reject the deferred\r\n if (result.StackTrace) {\r\n connection.log(result.Error + \"\\n\" + result.StackTrace + \".\");\r\n }\r\n\r\n // result.ErrorData is only set if a HubException was thrown\r\n source = result.IsHubException ? \"HubException\" : \"Exception\";\r\n error = signalR._.error(result.Error, source);\r\n error.data = result.ErrorData;\r\n\r\n connection.log(that.hubName + \".\" + methodName + \" failed to execute. Error: \" + error.message);\r\n d.rejectWith(that, [error]);\r\n } else {\r\n // Server invocation succeeded, resolve the deferred\r\n connection.log(\"Invoked \" + that.hubName + \".\" + methodName);\r\n d.resolveWith(that, [result.Result]);\r\n }\r\n };\r\n\r\n connection._.invocationCallbacks[connection._.invocationCallbackId.toString()] = { scope: that, method: callback };\r\n connection._.invocationCallbackId += 1;\r\n\r\n if (!$.isEmptyObject(that.state)) {\r\n data.S = that.state;\r\n }\r\n\r\n connection.log(\"Invoking \" + that.hubName + \".\" + methodName);\r\n connection.send(data);\r\n\r\n return d.promise();\r\n },\r\n\r\n _maximizeHubResponse: function _maximizeHubResponse(minHubResponse) {\r\n return {\r\n State: minHubResponse.S,\r\n Result: minHubResponse.R,\r\n Progress: minHubResponse.P ? {\r\n Id: minHubResponse.P.I,\r\n Data: minHubResponse.P.D\r\n } : null,\r\n Id: minHubResponse.I,\r\n IsHubException: minHubResponse.H,\r\n Error: minHubResponse.E,\r\n StackTrace: minHubResponse.T,\r\n ErrorData: minHubResponse.D\r\n };\r\n }\r\n };\r\n\r\n hubProxy.fn.init.prototype = hubProxy.fn;\r\n\r\n // hubConnection\r\n function hubConnection(url, options) {\r\n /// <summary>Creates a new hub connection.</summary>\r\n /// <param name=\"url\" type=\"String\">[Optional] The hub route url, defaults to \"/signalr\".</param>\r\n /// <param name=\"options\" type=\"Object\">[Optional] Settings to use when creating the hubConnection.</param>\r\n var settings = {\r\n qs: null,\r\n logging: false,\r\n useDefaultPath: true\r\n };\r\n\r\n $.extend(settings, options);\r\n\r\n if (!url || settings.useDefaultPath) {\r\n url = (url || \"\") + \"/signalr\";\r\n }\r\n return new hubConnection.fn.init(url, settings);\r\n }\r\n\r\n hubConnection.fn = hubConnection.prototype = $.connection();\r\n\r\n hubConnection.fn.init = function (url, options) {\r\n var settings = {\r\n qs: null,\r\n logging: false,\r\n useDefaultPath: true\r\n },\r\n connection = this;\r\n\r\n $.extend(settings, options);\r\n\r\n // Call the base constructor\r\n $.signalR.fn.init.call(connection, url, settings.qs, settings.logging);\r\n\r\n // Object to store hub proxies for this connection\r\n connection.proxies = {};\r\n\r\n connection._.invocationCallbackId = 0;\r\n connection._.invocationCallbacks = {};\r\n\r\n // Wire up the received handler\r\n connection.received(function (minData) {\r\n var data, proxy, dataCallbackId, callback, hubName, eventName;\r\n if (!minData) {\r\n return;\r\n }\r\n\r\n // We have to handle progress updates first in order to ensure old clients that receive\r\n // progress updates enter the return value branch and then no-op when they can't find\r\n // the callback in the map (because the minData.I value will not be a valid callback ID)\r\n // Process progress notification\r\n if (typeof minData.P !== \"undefined\") {\r\n dataCallbackId = minData.P.I.toString();\r\n callback = connection._.invocationCallbacks[dataCallbackId];\r\n if (callback) {\r\n callback.method.call(callback.scope, minData);\r\n }\r\n } else if (typeof minData.I !== \"undefined\") {\r\n // We received the return value from a server method invocation, look up callback by id and call it\r\n dataCallbackId = minData.I.toString();\r\n callback = connection._.invocationCallbacks[dataCallbackId];\r\n if (callback) {\r\n // Delete the callback from the proxy\r\n connection._.invocationCallbacks[dataCallbackId] = null;\r\n delete connection._.invocationCallbacks[dataCallbackId];\r\n\r\n // Invoke the callback\r\n callback.method.call(callback.scope, minData);\r\n }\r\n } else {\r\n data = this._maximizeClientHubInvocation(minData);\r\n\r\n // We received a client invocation request, i.e. broadcast from server hub\r\n connection.log(\"Triggering client hub event '\" + data.Method + \"' on hub '\" + data.Hub + \"'.\");\r\n\r\n // Normalize the names to lowercase\r\n hubName = data.Hub.toLowerCase();\r\n eventName = data.Method.toLowerCase();\r\n\r\n // Trigger the local invocation event\r\n proxy = this.proxies[hubName];\r\n\r\n // Update the hub state\r\n $.extend(proxy.state, data.State);\r\n $(proxy).triggerHandler(makeEventName(eventName), [data.Args]);\r\n }\r\n });\r\n\r\n connection.error(function (errData, origData) {\r\n var callbackId, callback;\r\n\r\n if (!origData) {\r\n // No original data passed so this is not a send error\r\n return;\r\n }\r\n\r\n callbackId = origData.I;\r\n callback = connection._.invocationCallbacks[callbackId];\r\n\r\n // Verify that there is a callback bound (could have been cleared)\r\n if (callback) {\r\n // Delete the callback\r\n connection._.invocationCallbacks[callbackId] = null;\r\n delete connection._.invocationCallbacks[callbackId];\r\n\r\n // Invoke the callback with an error to reject the promise\r\n callback.method.call(callback.scope, { E: errData });\r\n }\r\n });\r\n\r\n connection.reconnecting(function () {\r\n if (connection.transport && connection.transport.name === \"webSockets\") {\r\n clearInvocationCallbacks(connection, \"Connection started reconnecting before invocation result was received.\");\r\n }\r\n });\r\n\r\n connection.disconnected(function () {\r\n clearInvocationCallbacks(connection, \"Connection was disconnected before invocation result was received.\");\r\n });\r\n };\r\n\r\n hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {\r\n return {\r\n Hub: minClientHubInvocation.H,\r\n Method: minClientHubInvocation.M,\r\n Args: minClientHubInvocation.A,\r\n State: minClientHubInvocation.S\r\n };\r\n };\r\n\r\n hubConnection.fn._registerSubscribedHubs = function () {\r\n /// <summary>\r\n /// Sets the starting event to loop through the known hubs and register any new hubs\r\n /// that have been added to the proxy.\r\n /// </summary>\r\n var connection = this;\r\n\r\n if (!connection._subscribedToHubs) {\r\n connection._subscribedToHubs = true;\r\n connection.starting(function () {\r\n // Set the connection's data object with all the hub proxies with active subscriptions.\r\n // These proxies will receive notifications from the server.\r\n var subscribedHubs = [];\r\n\r\n $.each(connection.proxies, function (key) {\r\n if (this.hasSubscriptions()) {\r\n subscribedHubs.push({ name: key });\r\n connection.log(\"Client subscribed to hub '\" + key + \"'.\");\r\n }\r\n });\r\n\r\n if (subscribedHubs.length === 0) {\r\n connection.log(\"No hubs have been subscribed to. The client will not receive data from hubs. To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to.\");\r\n }\r\n\r\n connection.data = connection.json.stringify(subscribedHubs);\r\n });\r\n }\r\n };\r\n\r\n hubConnection.fn.createHubProxy = function (hubName) {\r\n /// <summary>\r\n /// Creates a new proxy object for the given hub connection that can be used to invoke\r\n /// methods on server hubs and handle client method invocation requests from the server.\r\n /// </summary>\r\n /// <param name=\"hubName\" type=\"String\">\r\n /// The name of the hub on the server to create the proxy for.\r\n /// </param>\r\n\r\n // Normalize the name to lowercase\r\n hubName = hubName.toLowerCase();\r\n\r\n var proxy = this.proxies[hubName];\r\n if (!proxy) {\r\n proxy = hubProxy(this, hubName);\r\n this.proxies[hubName] = proxy;\r\n }\r\n\r\n this._registerSubscribedHubs();\r\n\r\n return proxy;\r\n };\r\n\r\n hubConnection.fn.init.prototype = hubConnection.fn;\r\n\r\n $.hubConnection = hubConnection;\r\n})(jQueryShim, window);\r\n/* jquery.signalR.version.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n(function ($, undefined) {\r\n // This will be modified by the build script\r\n $.signalR.version = \"2.4.1\";\r\n})(jQueryShim);\r\n\r\nvar hubConnection = exports.hubConnection = jQueryShim.hubConnection;\r\nvar signalR = exports.signalR = jQueryShim.signalR;","import { BaseEvents, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nexport enum DeviceType {\n AppleTv = 'apple-tv',\n Vivi = 'vivi'\n}\n\nexport enum DeviceStatus {\n Available = 'available',\n Offline = 'offline',\n Busy = 'busy'\n}\n\nexport interface Device {\n id: string;\n name: string;\n schoolName?: string;\n description?: string;\n type: DeviceType;\n status: DeviceStatus;\n}\n\nexport interface SessionConfig {\n device: Device;\n title: string;\n}\n\nexport interface ClientEvents extends BaseEvents {\n deviceschange: void;\n error: Error;\n}\n\nexport interface Client<T extends ClientEvents = ClientEvents> extends EventBus<T> {\n getDevices: () => Device[];\n canCastToDevice: (deviceType: DeviceType) => boolean;\n startCastSession: (config: SessionConfig) => CastSession;\n}\n\nexport interface SessionEvents extends BaseEvents {\n durationchange: void;\n playingchange: void;\n volumechange: void;\n positionchange: void;\n sourceloaded: void;\n subtitleschange: void;\n error: Error;\n}\n\nexport interface CastSession<T extends SessionEvents = SessionEvents> extends EventBus<T> {\n loadSource: (videoSource: string, subtitleSource?: string) => void;\n play: () => void;\n pause: () => void;\n seek: (position: number) => void;\n setVolume: (volume: number) => void;\n setMuted: (muted: boolean) => void;\n setSubtitles: (subtitleSource?: string) => void;\n isPlaying: () => boolean;\n isPlaybackFinished: () => boolean;\n getPosition: () => number;\n getDuration: () => number | undefined;\n getVolume: () => number;\n getMuted: () => boolean;\n getSubtitles: () => string | undefined;\n getDevice: () => Device;\n getTitle: () => string;\n}\n","\nexport class PromiseWithTimeout<T> implements Promise<T> {\n readonly [Symbol.toStringTag]: string;\n private readonly innerPromise: Promise<T>;\n private readonly onTimeout?: () => void;\n\n constructor(innerPromise: Promise<T>, onTimeout?: () => void) {\n this[Symbol.toStringTag] = innerPromise[Symbol.toStringTag];\n this.innerPromise = innerPromise;\n this.onTimeout = onTimeout;\n\n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.timeout = this.timeout.bind(this);\n this.then = this.then.bind(this);\n this.catch = this.catch.bind(this);\n this.finally = this.finally.bind(this);\n }\n\n timeout(timeout: number): Promise<T> {\n return new Promise((resolve, reject) => {\n this\n .then(resolve)\n .catch(reject)\n .finally(() => clearTimeout(timeoutId));\n\n const timeoutId = setTimeout(() => {\n this.onTimeout?.();\n reject(new Error('Promise timed out'));\n }, timeout);\n });\n }\n\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null\n ): Promise<TResult1 | TResult2> {\n return this.innerPromise.then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null\n ): Promise<T | TResult> {\n return this.innerPromise.catch(onrejected);\n }\n\n finally(onfinally?: () => void): Promise<T> {\n return this.innerPromise.finally(onfinally);\n }\n\n static reject<T>(reason?: any): PromiseWithTimeout<T> {\n return new PromiseWithTimeout(Promise.reject(reason));\n }\n\n static fromPromise<T>(promise: Promise<T>): PromiseWithTimeout<T> {\n return new PromiseWithTimeout(promise);\n }\n}\n","import { PromiseWithTimeout } from './promise-with-timeout';\n\nexport type Unsubscribe = () => void;\n\nexport interface SubscribtionResult<T> {\n off: Unsubscribe;\n filter: (predicate: (ev: T) => boolean) => Unsubscribe;\n}\n\nclass EventChannel<T = void> {\n private callbacks: ((ev: T) => void)[] = [];\n private predicates: ((ev: T) => boolean)[] = [];\n private controller: AbortController = new AbortController();\n private signal: AbortSignal = this.controller.signal;\n \n constructor() {\n this.trigger = this.trigger.bind(this);\n this.on = this.on.bind(this);\n this.one = this.one.bind(this);\n this.off = this.off.bind(this);\n this.dispose = this.dispose.bind(this);\n this.isDisposed = this.isDisposed.bind(this);\n }\n\n public trigger(ev: T): void {\n this.callbacks.forEach((cb, idx) => {\n const predicate = this.predicates[idx];\n \n if (predicate && !predicate(ev))\n return;\n\n cb(ev);\n });\n }\n\n public on(callback: (ev: T) => void): SubscribtionResult<T> {\n if (this.isDisposed())\n console.warn('This EventChannel instance been disposed - this is a no-op');\n \n const idx = this.callbacks.length;\n\n this.callbacks[idx] = callback;\n this.predicates[idx] = () => true;\n\n const off = () => {\n this.off(callback);\n };\n\n const filter = (predicate: (ev: T) => boolean) => {\n this.predicates[idx] = predicate;\n return off;\n };\n \n return {\n off,\n filter\n };\n }\n\n public one(predicate: (ev: T) => boolean = () => true): PromiseWithTimeout<T> {\n if (this.isDisposed())\n return PromiseWithTimeout.reject(new Error('This EventChannel instance has been disposed'));\n\n let off: Unsubscribe;\n\n return new PromiseWithTimeout(new Promise((resolve, reject) => {\n off = this\n .on(ev => {\n this.signal.removeEventListener('abort', onAborted);\n off();\n resolve(ev);\n })\n .filter(predicate);\n \n const onAborted = () => {\n off();\n reject(new Error('Aborted while waiting for message'));\n };\n\n this.signal.addEventListener('abort', onAborted, { once: true });\n }), () => {\n off();\n });\n }\n\n public off(callback: (ev: T) => void): void {\n const index = this.callbacks.indexOf(callback);\n \n if (index !== -1) {\n this.callbacks.splice(index, 1);\n this.predicates.splice(index, 1);\n }\n }\n\n public dispose(): void {\n this.callbacks.length = 0;\n this.predicates.length = 0;\n this.controller.abort();\n }\n\n public isDisposed(): boolean {\n return this.signal.aborted;\n }\n}\n\nexport interface BaseEvents {\n dispose: void;\n}\n\nexport class EventBus<Events extends BaseEvents> {\n private channels: Partial<Record<keyof Events, EventChannel<Events[keyof Events]>>> = {};\n\n constructor() {\n this.trigger = this.trigger.bind(this);\n this.on = this.on.bind(this);\n this.one = this.one.bind(this);\n this.off = this.off.bind(this);\n this.dispose = this.dispose.bind(this);\n this.getChannel = this.getChannel.bind(this);\n }\n\n public trigger<Key extends keyof Events>(eventKey: Key, ev: Events[Key]): void {\n const channel = this.getChannel(eventKey);\n\n channel.trigger(ev);\n }\n\n public on<Key extends keyof Events>(\n eventKey: Key,\n callback: (ev: Events[Key]) => void\n ): SubscribtionResult<Events[Key]> {\n const channel = this.getChannel(eventKey);\n\n return channel.on(callback);\n }\n\n public one<Key extends keyof Events>(\n eventKey: Key,\n predicate?: (ev: Events[Key]) => boolean\n ): PromiseWithTimeout<Events[Key]> {\n const channel = this.getChannel(eventKey);\n\n return channel.one(predicate);\n }\n\n public off<Key extends keyof Events>(eventKey: Key, callback: (ev: Events[Key]) => void): void {\n const channel = this.getChannel(eventKey);\n\n channel.off(callback);\n }\n\n public dispose(): void {\n this.trigger('dispose', Event.void);\n\n Object.values(this.channels).forEach((channel: EventChannel<any>) => channel.dispose());\n \n this.channels = {};\n }\n\n private getChannel<Key extends keyof Events>(eventKey: Key): EventChannel<Events[Key]> {\n if (!this.channels[eventKey])\n this.channels[eventKey] = new EventChannel<Events[Key]>();\n\n return this.channels[eventKey] as EventChannel<Events[Key]>;\n }\n}\n\n/*\nBecause events need to be associated to a type, we can use the constant below\nwhen triggering an event that doesn't pass any data along to its listeners:\n\n- eventBus.trigger('dispose', Event.void);\n\nWhich I think is a bit nicer than:\n\n- eventBus.trigger('dispose', undefined);\n\nNOTE: I didn't want to make the payload optional - as this raises a whole bunch of TS questions\nthat I don't have the mental capacity to address right now..\n*/\n\nexport const Event = {\n void: undefined as any\n};\n","export class Scheduler {\n private task?: (s: Scheduler) => void;\n private intervalId?: NodeJS.Timeout;\n private intervalInMilliseconds: number;\n\n constructor() {\n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.schedule = this.schedule.bind(this);\n this.every = this.every.bind(this);\n this.trigger = this.trigger.bind(this);\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n }\n\n public schedule(task: (s: Scheduler) => void): Scheduler {\n this.task = task;\n return this;\n }\n\n public every(durationInMilliseconds: number): Scheduler {\n this.intervalInMilliseconds = durationInMilliseconds;\n return this;\n }\n\n public trigger(): Scheduler {\n this.task?.(this);\n return this;\n }\n\n public start(): Scheduler {\n if (!this.intervalId)\n this.intervalId = setInterval(() => this.trigger(), this.intervalInMilliseconds);\n\n return this;\n }\n\n public stop(): Scheduler {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n\n return this;\n }\n}\n","import { HashObject } from 'libs/common/react/interfaces';\n\nexport interface ProxiedObject extends HashObject {\n _lastModified?: {[key: string]: number };\n}\n\nfunction withDebouncedSetters<T extends ProxiedObject>(\n obj: T,\n debounceDurationInMillseconds: number\n): T {\n if (!obj._lastModified)\n obj._lastModified = {};\n\n return new Proxy(obj, {\n set: (target, property, value, receiver) => {\n const timestamp = obj._lastModified[property.toString()];\n\n if (timestamp && Date.now() < timestamp + debounceDurationInMillseconds)\n return true; // Don't return false here as it will cause the proxy to throw an error\n\n return Reflect.set(target, property, value, receiver);\n }\n });\n}\n\nfunction withTimestampedSetters<T extends ProxiedObject>(obj: T): T {\n if (!obj._lastModified)\n obj._lastModified = {};\n\n return new Proxy(obj, {\n set: (target, property, value, receiver) => {\n obj._lastModified[property.toString()] = Date.now();\n\n return Reflect.set(target, property, value, receiver);\n }\n });\n}\n\nexport const ProxyHelper = {\n withDebouncedSetters,\n withTimestampedSetters\n};\n","import { ClientEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nexport enum OnlineApiDeviceStatus {\n Offline = 0,\n Online = 1,\n Locked = 2,\n Suspended = 3\n}\n\nexport interface OnlineApiDevice {\n deviceId: string;\n crmId: number;\n name: string;\n status: OnlineApiDeviceStatus;\n lockedBy: string;\n lockedByUserId: number;\n lastAccessed: string;\n dateCreated: string;\n dateModified: string;\n dateDeleted: string;\n deleted: boolean;\n type?: 'unknown' | 'vivi' | 'apple_tv'; // This property is a necessary evil because we're piggy-backing on Online API to support Apple TV devices in NP\n}\n\nexport enum AppleTvEventName {\n PlaybackStatusChange,\n PositionChange\n}\n\nexport enum PlaybackStatus {\n Begin = 'BEGIN',\n Play = 'PLAY',\n Pause = 'PAUSE',\n Load = 'LOAD',\n Scan = 'SCAN',\n Stop = 'STOP'\n}\n\nexport interface AppleTvIncomingMessage {\n deviceId: string;\n event: AppleTvEventName;\n params: {\n position?: number,\n playbackStatus?: PlaybackStatus\n };\n}\n\nexport interface AppleTvClientEventMap extends ClientEvents {\n connected: void;\n disconnected: void;\n message: AppleTvIncomingMessage;\n}\n\nexport interface AppleTvPairRequest {\n deviceName: string;\n pin: string;\n crmId: number;\n}\n\nexport interface AppleTvRenameRequest {\n deviceName: string;\n deviceId: string;\n}\n","import { Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { ProxyHelper } from 'projects/player/plugins/devices-plugin/utils/proxy-helper';\n\nimport { PlaybackStatus } from './apple-tv-interfaces';\n\nconst PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS = 2000;\n\nexport class AppleTvCastSessionState {\n public title: string;\n public device: Device;\n public locked: boolean;\n public position: number;\n public playbackStatus: PlaybackStatus;\n public debounced: AppleTvCastSessionState;\n\n constructor(title: string, device: Device) {\n this.title = title;\n this.device = device;\n this.locked = false;\n this.position = 0;\n this.playbackStatus = PlaybackStatus.Load;\n this.debounced = ProxyHelper.withDebouncedSetters(this, PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS);\n\n return ProxyHelper.withTimestampedSetters(this);\n }\n}\n","import { CastSession, Device, SessionConfig, SessionEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nimport { AppleTvCastSessionState } from './apple-tv-cast-session-state';\nimport { AppleTvClient } from './apple-tv-client';\nimport { AppleTvEventName, AppleTvIncomingMessage, PlaybackStatus } from './apple-tv-interfaces';\n\nexport class AppleTvCastSession extends EventBus<SessionEvents> implements CastSession {\n private client: AppleTvClient;\n private localState: AppleTvCastSessionState;\n\n constructor(client: AppleTvClient, config: SessionConfig) {\n super();\n\n this.client = client;\n this.localState = new AppleTvCastSessionState(config.title, config.device);\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.dispose = this.dispose.bind(this);\n\n this.handleDisconnected = this.handleDisconnected.bind(this);\n this.handleAllVideoMessages = this.handleAllVideoMessages.bind(this);\n this.handlePlaybackChange = this.handlePlaybackChange.bind(this);\n this.handlePositionChange = this.handlePositionChange.bind(this);\n\n this.loadSource = this.loadSource.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.isPlaying = this.isPlaying.bind(this);\n this.getPosition = this.getPosition.bind(this);\n this.getDuration = this.getDuration.bind(this);\n this.getVolume = this.getVolume.bind(this);\n }\n\n private initialize(): void {\n this.client.on('dispose', this.dispose);\n this.client.on('disconnected', this.handleDisconnected);\n this.client.on('message', this.handleAllVideoMessages);\n }\n\n public dispose(): void {\n // Cleanup the subscriptions from the initialize function\n this.client.off('dispose', this.dispose);\n this.client.off('disconnected', this.handleDisconnected);\n this.client.off('message', this.handleAllVideoMessages);\n\n // Do our best to signal to the device that we're done with it.. \n // The stop command will also unlock the device.\n this.client.stop(this.getDevice().id).catch(err => console.error(err));\n\n // Trigger the dispose event\n super.dispose();\n }\n\n private handleDisconnected(): void {\n // Whilst we can reconnect to the SignalR hub, it appears we cannot properly recover from a full connection loss..\n // The client simply stops receiving events for the session. I believe this is an issue with our hub implementation in Online API.\n this.trigger('error', new Error('The connection to the Apple TV has been lost and cannot be recovered'));\n }\n\n private handleAllVideoMessages(message: AppleTvIncomingMessage): void {\n if (message.deviceId !== this.getDevice().id) return;\n\n const localState = this.localState.debounced;\n\n switch (message.event) {\n case AppleTvEventName.PlaybackStatusChange:\n this.handlePlaybackChange(localState, message);\n break;\n \n case AppleTvEventName.PositionChange:\n this.handlePositionChange(localState, message);\n break;\n }\n }\n\n private handlePlaybackChange(localState: AppleTvCastSessionState, remoteState: AppleTvIncomingMessage): void {\n if (localState.playbackStatus !== remoteState.params.playbackStatus) {\n localState.playbackStatus = remoteState.params.playbackStatus;\n this.trigger('playingchange', Event.void);\n\n if (localState.playbackStatus === PlaybackStatus.Stop)\n this.dispose();\n }\n }\n\n private handlePositionChange(localState: AppleTvCastSessionState, remoteState: AppleTvIncomingMessage): void {\n if (localState.position !== remoteState.params.position) {\n localState.position = remoteState.params.position;\n this.trigger('positionchange', Event.void);\n }\n }\n\n public async loadSource(): Promise<void> {\n try {\n // Only proceed if the session is not locked yet\n if (this.localState.locked) return;\n\n // Lock the session\n await this.client.lock(this.getDevice().id);\n this.localState.locked = true;\n\n // Load the video\n await this.client.loadVideo(this.getDevice().id);\n\n // Notify listeners that the video has loaded\n this.trigger('sourceloaded', Event.void);\n } catch (error) {\n console.error(error);\n\n this.trigger('error', new Error('Could not load video on Apple TV device'));\n }\n }\n\n public play(): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.playbackStatus !== PlaybackStatus.Play) {\n this.localState.playbackStatus = PlaybackStatus.Play;\n this.client.play(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public pause(): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.playbackStatus !== PlaybackStatus.Pause) {\n this.localState.playbackStatus = PlaybackStatus.Pause;\n this.client.pause(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public seek(position: number): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.position !== position) {\n this.localState.position = position;\n this.client.seek(this.getDevice().id, position);\n this.trigger('positionchange', Event.void);\n }\n }\n\n public setVolume(): void {\n console.info('Setting the volume is not supported on Apple TV');\n }\n\n public setMuted(): void {\n console.info('Muting is not supported on Apple TV');\n }\n\n public setSubtitles(): void {\n console.info('Subtitles are not supported on Apple TV');\n }\n\n public isPlaying(): boolean {\n return this.localState.playbackStatus === PlaybackStatus.Play ||\n this.localState.playbackStatus === PlaybackStatus.Begin ||\n this.localState.playbackStatus === PlaybackStatus.Load;\n }\n\n public isPlaybackFinished(): boolean {\n return this.localState.playbackStatus === PlaybackStatus.Stop;\n }\n\n public getPosition(): number {\n return this.localState.position;\n }\n\n public getDuration(): number | undefined {\n return undefined;\n }\n\n public getVolume(): number {\n return 1;\n }\n\n public getMuted(): boolean {\n return false;\n }\n\n public getSubtitles(): string | undefined {\n return undefined;\n }\n\n public getDevice(): Device {\n return this.localState.device;\n }\n\n public getTitle(): string {\n return this.localState.title;\n }\n}\n","import { Connection, hubConnection, Proxy } from 'signalr-no-jquery';\n\nimport { AppleTvAccessToken } from 'libs/shared/interfaces';\n\nimport { CastSession, Client, Device, DeviceStatus, DeviceType, SessionConfig } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\nimport { PromiseWithTimeout } from 'projects/player/plugins/devices-plugin/utils/promise-with-timeout';\nimport { Scheduler } from 'projects/player/plugins/devices-plugin/utils/scheduler';\nimport { debounce } from 'projects/player/utils/fn';\n\nimport { AppleTvCastSession } from './apple-tv-cast-session';\nimport { AppleTvClientEventMap, AppleTvEventName, AppleTvPairRequest, AppleTvRenameRequest, OnlineApiDevice, OnlineApiDeviceStatus, PlaybackStatus } from './apple-tv-interfaces';\n\nconst INVOKE_TIMEOUT_IN_MILLISECONDS = 20000;\nconst INVOKE_DEBOUNCE_IN_MILLISECONDS = 500;\nconst SIGNALR_HUB_NAME = 'DeviceUserHub';\nconst SIGNALR_HEARTBEAT_SCHEDULE_IN_MILLISECONDS = 5000;\n\nenum SignalrEventName {\n DeviceList = 'DeviceList',\n DeviceStateChange = 'DeviceStateChange',\n Paired = 'Paired',\n Unpaired = 'Unpaired',\n PlayStatusChange = 'PlayStatusChange',\n TimeSync = 'TimeSync'\n}\n\nenum SignalrMethodName {\n Command = 'Command',\n Pair = 'Pair',\n Unpair = 'Unpair',\n RenameDevice = 'Renamedevice',\n Subscribe = 'Subscribe',\n Lock = 'Lock'\n}\n\nconst enum SignalrConnectionState {\n Connecting = 0,\n Connected = 1,\n Reconnecting = 2,\n Disconnected = 4\n}\n\ninterface AppleTvClientOptions {\n fetchAccessToken: () => Promise<AppleTvAccessToken>;\n trackingCode?: string;\n username?: string;\n userId: number;\n}\n\nexport class AppleTvClient extends EventBus<AppleTvClientEventMap> implements Client<AppleTvClientEventMap> {\n private options: AppleTvClientOptions;\n private accessToken?: AppleTvAccessToken;\n private devices: Device[];\n private connection?: Connection;\n private hubProxy?: Proxy;\n private heartbeat: Scheduler;\n\n private invokeDebounced: (command: string, ...args: any[]) => boolean;\n\n constructor(options: AppleTvClientOptions) {\n super();\n \n this.options = options;\n this.accessToken = undefined;\n this.devices = [];\n this.heartbeat = new Scheduler();\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.connect = this.connect.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.tryFixConnection = this.tryFixConnection.bind(this);\n this.invoke = this.invoke.bind(this);\n this.invokeDebounced = debounce(this.invoke, INVOKE_DEBOUNCE_IN_MILLISECONDS, true);\n this.handleDeviceList = this.handleDeviceList.bind(this);\n this.handleDeviceStateChange = this.handleDeviceStateChange.bind(this);\n this.handleDevicePaired = this.handleDevicePaired.bind(this);\n this.handleDeviceUnpaired = this.handleDeviceUnpaired.bind(this);\n this.handlePlayStatusChange = this.handlePlayStatusChange.bind(this);\n this.handleTimeSync = this.handleTimeSync.bind(this);\n this.dispose = this.dispose.bind(this);\n this.canCastToDevice = this.canCastToDevice.bind(this);\n this.getDevices = this.getDevices.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.lock = this.lock.bind(this);\n this.loadVideo = this.loadVideo.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.stop = this.stop.bind(this);\n this.pair = this.pair.bind(this);\n this.unpair = this.unpair.bind(this);\n this.renameDevice = this.renameDevice.bind(this);\n }\n\n private async initialize(): Promise<void> {\n try {\n this.accessToken = await this.options.fetchAccessToken();\n this.connection = hubConnection(this.accessToken.host, { logging: false });\n this.hubProxy = this.connection.createHubProxy(SIGNALR_HUB_NAME);\n\n this.hubProxy.on(SignalrEventName.DeviceList, this.handleDeviceList);\n this.hubProxy.on(SignalrEventName.DeviceStateChange, this.handleDeviceStateChange);\n this.hubProxy.on(SignalrEventName.Paired, this.handleDevicePaired);\n this.hubProxy.on(SignalrEventName.Unpaired, this.handleDeviceUnpaired);\n this.hubProxy.on(SignalrEventName.PlayStatusChange, this.handlePlayStatusChange);\n this.hubProxy.on(SignalrEventName.TimeSync, this.handleTimeSync);\n\n await this.connect();\n await this.subscribe(this.accessToken.token);\n\n this.heartbeat\n .schedule(this.tryFixConnection)\n .every(SIGNALR_HEARTBEAT_SCHEDULE_IN_MILLISECONDS)\n .start();\n } catch (err) {\n console.error(err);\n this.trigger('error', new Error('Could not connect to Online API'));\n }\n }\n\n private async connect(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.connection\n .start({ jsonp: false, withCredentials: false })\n .done(() => resolve())\n .fail(() => reject(new Error('Could not connect to SignalR hub')));\n });\n }\n\n private async subscribe(token: string): Promise<void> {\n const subscribeResult = await this.invoke(SignalrMethodName.Subscribe, token);\n\n if (!subscribeResult)\n throw new Error('The subscription request was rejected by Online API');\n }\n\n private async tryFixConnection(): Promise<void> {\n // If this state is not disconnected, we don't need to do anything\n if ((this.connection as any).state !== SignalrConnectionState.Disconnected)\n return;\n\n try {\n // Stop the heartbeat while we try to reconnect\n this.heartbeat.stop();\n\n // We'll need a new access token to re-subscribe\n this.accessToken = await this.options.fetchAccessToken();\n \n // Reconnect and resubscribe\n await this.connect();\n await this.subscribe(this.accessToken.token);\n } catch (err) {\n console.warn(err);\n console.warn('Could not reconnect to Online API');\n } finally {\n // Resume the heartbeat\n this.heartbeat.start();\n }\n }\n\n private async invoke<T = any>(method: SignalrMethodName, ...args: any[]): Promise<T> {\n const invokeTask = new Promise<T>((resolve, reject) => {\n (this.hubProxy?.invoke(method, ...args) as unknown as JQueryPromise<T>)\n .done(resolve)\n .fail(reject);\n });\n\n return PromiseWithTimeout\n .fromPromise(invokeTask)\n .timeout(INVOKE_TIMEOUT_IN_MILLISECONDS);\n }\n\n private handleDeviceList(devices: OnlineApiDevice[]): void {\n this.devices = devices\n .filter(x => x.type !== 'vivi') // Ignore any Vivi devices coming from Online API\n .map(AppleTvClient.convertToGenericDevice);\n \n this.trigger('deviceschange', Event.void);\n }\n\n private handleDeviceStateChange(device: OnlineApiDevice): void {\n const deviceIndex = this.devices.findIndex(d => d.id === device.deviceId);\n\n if (deviceIndex >= 0) {\n this.devices[deviceIndex] = AppleTvClient.convertToGenericDevice(device);\n this.trigger('deviceschange', Event.void);\n }\n }\n\n private handleDevicePaired(device: OnlineApiDevice): void {\n if (device.type === 'vivi') return; // Ignore any Vivi devices coming from Online API\n\n this.devices.push(AppleTvClient.convertToGenericDevice(device));\n this.trigger('deviceschange', Event.void);\n }\n\n private handleDeviceUnpaired(deviceId: string): void {\n this.devices = this.devices.filter(d => d.id !== deviceId);\n this.trigger('deviceschange', Event.void);\n }\n\n private handlePlayStatusChange(deviceId: string, params: { commandType: PlaybackStatus }): void {\n this.trigger('message', {\n event: AppleTvEventName.PlaybackStatusChange,\n deviceId,\n params: { playbackStatus: params.commandType }\n });\n }\n\n private handleTimeSync(deviceId: string, position: number): void {\n this.trigger('message', {\n event: AppleTvEventName.PositionChange,\n deviceId,\n params: { position }\n });\n }\n\n public dispose(): void {\n // Unsubscribe from hub messages\n this.hubProxy.off(SignalrEventName.DeviceList, this.handleDeviceList);\n this.hubProxy.off(SignalrEventName.DeviceStateChange, this.handleDeviceStateChange);\n this.hubProxy.off(SignalrEventName.Paired, this.handleDevicePaired);\n this.hubProxy.off(SignalrEventName.Unpaired, this.handleDeviceUnpaired);\n this.hubProxy.off(SignalrEventName.PlayStatusChange, this.handlePlayStatusChange);\n this.hubProxy.off(SignalrEventName.TimeSync, this.handleTimeSync);\n\n // Stop the connection\n this.hubProxy.connection.stop(false, true);\n\n // Stop the heartbeat\n this.heartbeat.stop();\n\n // Dispose event bus\n super.dispose();\n }\n\n public canCastToDevice(deviceType: DeviceType): boolean {\n if (deviceType === DeviceType.AppleTv)\n return true;\n\n return false;\n }\n\n public getDevices(): Device[] {\n return this.devices;\n }\n\n public startCastSession(config: SessionConfig): CastSession {\n return new AppleTvCastSession(this, config);\n }\n\n public async lock(deviceId: string): Promise<void> {\n const locked = await this.invoke<boolean>(\n SignalrMethodName.Lock,\n deviceId,\n this.options.userId,\n this.options.username ?? '' // Fall back to an anonymous username if none is provided\n );\n\n if (!locked)\n throw new Error('Could not lock device');\n }\n\n public async loadVideo(deviceId: string): Promise<void> {\n if (!this.options.trackingCode)\n throw new Error('Tracking code must be provided to cast videos');\n\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play,\n Data: this.options.trackingCode\n });\n }\n\n public async play(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play\n });\n }\n\n public async pause(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Pause\n });\n }\n\n public seek(deviceId: string, position: number): void {\n this.invokeDebounced(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play,\n Params: `1,${Math.trunc(position)}` // Always seek to the first chapter at the specified position\n });\n }\n\n public async stop(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Stop\n });\n }\n\n public async pair(pairRequest: AppleTvPairRequest): Promise<OnlineApiDevice> {\n const result = await this.invoke<OnlineApiDevice>(SignalrMethodName.Pair, pairRequest);\n\n if (!result)\n throw new Error('Could not pair device');\n\n return result;\n }\n\n public async unpair(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Unpair, deviceId);\n }\n\n public async renameDevice({ deviceId, deviceName }: AppleTvRenameRequest): Promise<void> {\n const renamed = await this.invoke(SignalrMethodName.RenameDevice, deviceId, deviceName);\n\n if (!renamed)\n throw new Error('Could not rename device');\n }\n\n public static convertToGenericDeviceStatus(status: OnlineApiDeviceStatus): DeviceStatus {\n switch (status) {\n case OnlineApiDeviceStatus.Online:\n return DeviceStatus.Available;\n\n case OnlineApiDeviceStatus.Locked:\n return DeviceStatus.Busy;\n\n case OnlineApiDeviceStatus.Suspended:\n case OnlineApiDeviceStatus.Offline:\n return DeviceStatus.Offline;\n }\n }\n \n public static convertToGenericDevice(device: OnlineApiDevice): Device {\n return {\n id: device.deviceId,\n name: device.name,\n type: DeviceType.AppleTv,\n status: AppleTvClient.convertToGenericDeviceStatus(device.status)\n };\n }\n}\n","/**\n * Inspired by https://github.com/marchaos/resilient-websocket\n */\n\nimport { Scheduler } from './scheduler';\n\ntype MessageData = string | ArrayBufferLike | Blob | ArrayBufferView;\n\ninterface ResilientWebSocketOptions {\n reconnectIntervalInMilliseconds?: number;\n heartbeatEnabled?: boolean;\n heartbeatIntervalInMillseconds?: number;\n heartbeatMessage?: MessageData;\n}\n\nconst defaultOptions: ResilientWebSocketOptions = {\n reconnectIntervalInMilliseconds: 3000,\n heartbeatEnabled: false,\n heartbeatIntervalInMillseconds: 10000,\n heartbeatMessage: ''\n};\n\nexport class ResilientWebSocket {\n private readonly url: string;\n private readonly options: ResilientWebSocketOptions;\n \n private webSocket: WebSocket;\n private heartbeat: Scheduler;\n\n public onOpen?: (event: Event) => void;\n public onClose?: (event?: CloseEvent) => void;\n public onMessage?: (event: MessageEvent) => void;\n public onError?: (event: Event) => void;\n \n constructor(url: string, options: ResilientWebSocketOptions = defaultOptions) {\n this.bindFunctions();\n\n this.url = url;\n this.options = { ...defaultOptions, ...options };\n this.webSocket = this.connect();\n this.heartbeat = new Scheduler()\n .schedule(() => this.send(this.options.heartbeatMessage))\n .every(this.options.heartbeatIntervalInMillseconds);\n }\n\n private bindFunctions(): void {\n this.cleanup = this.cleanup.bind(this);\n this.handleOpen = this.handleOpen.bind(this);\n this.handleMessage = this.handleMessage.bind(this);\n this.handleClose = this.handleClose.bind(this);\n this.handleError = this.handleError.bind(this);\n this.connect = this.connect.bind(this);\n this.send = this.send.bind(this);\n this.dipose = this.dipose.bind(this);\n }\n\n private cleanup(): void {\n this.heartbeat.stop();\n\n this.webSocket.removeEventListener('error', this.handleError);\n this.webSocket.removeEventListener('message', this.handleMessage);\n this.webSocket.removeEventListener('open', this.handleOpen);\n this.webSocket.removeEventListener('close', this.handleClose);\n }\n\n private handleOpen(event?: Event): void {\n this.onOpen?.(event);\n\n if (this.options.heartbeatEnabled)\n this.heartbeat.start();\n }\n\n private handleMessage(event: MessageEvent): void {\n this.onMessage?.(event);\n }\n\n private handleClose(event?: CloseEvent): void {\n this.onClose?.(event);\n\n this.cleanup();\n\n setTimeout(() => {\n this.webSocket = this.connect();\n }, this.options.reconnectIntervalInMilliseconds);\n }\n\n private handleError(event: Event): void {\n this.onError?.(event);\n this.handleClose();\n }\n\n public connect(): WebSocket {\n const socket = new WebSocket(this.url);\n \n socket.addEventListener('open', this.handleOpen);\n socket.addEventListener('message', this.handleMessage);\n socket.addEventListener('close', this.handleClose);\n socket.addEventListener('error', this.handleError);\n\n return socket;\n }\n\n public send(data: MessageData): void {\n this.webSocket.send(data);\n }\n\n public dipose(): void {\n this.cleanup();\n this.webSocket.close();\n }\n}\n","import { Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { ProxyHelper } from 'projects/player/plugins/devices-plugin/utils/proxy-helper';\n\nconst PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS = 2000;\n\nexport class ViviCastSessionState {\n public duration: number | undefined;\n public mute: boolean;\n public videoSource: string;\n public subtitleSource: string;\n public subtitles: boolean;\n public volume: number;\n public title: string;\n public device: Device;\n public ready: boolean;\n public playbackFinished: boolean;\n public debounced: ViviCastSessionState;\n\n private _position: number;\n private _playing: boolean;\n private _timerStartedAt: number = 0;\n\n constructor(title: string, device: Device) {\n this.position = 0;\n this.duration = undefined;\n this.playing = false;\n this.mute = false;\n this.videoSource = '';\n this.subtitleSource = '';\n this.subtitles = false;\n this.volume = 0;\n this.title = title;\n this.device = device;\n this.ready = false;\n this.playbackFinished = false;\n this.debounced = ProxyHelper.withDebouncedSetters(this, PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS);\n \n return ProxyHelper.withTimestampedSetters(this);\n }\n\n public get position() {\n return this._position + this.getTimerDurationInSeconds();\n }\n \n public set position(val: number) {\n this._position = val;\n this.restartTimer();\n }\n\n public get playing() {\n return this._playing;\n }\n \n public set playing(val: boolean) {\n this._playing = val;\n\n if (val) {\n this.restartTimer();\n } else {\n this._position += this.getTimerDurationInSeconds();\n this.stopTimer();\n }\n }\n\n private restartTimer() {\n this._timerStartedAt = Date.now();\n }\n\n private stopTimer() {\n this._timerStartedAt = 0;\n }\n\n private getTimerDurationInSeconds() {\n if (this._timerStartedAt) {\n const duration = Date.now() - this._timerStartedAt;\n return duration / 1000;\n }\n\n return 0;\n }\n}\n","import { HashObject } from 'libs/common/react/interfaces';\n\nimport { ClientEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nexport interface ViviUrl {\n id?: string;\n url: string;\n title: string;\n suburl: string;\n}\n\nexport interface ViviRoom {\n id: string;\n name: string;\n organisation: string;\n location?: string;\n}\n\nexport interface ViviPlayState {\n duration: number;\n position: number;\n playing: boolean;\n volume: number;\n mute: boolean;\n chapter: number;\n subtitles: boolean;\n}\n\nexport interface ViviOutgoingIdentifyMessage {\n destination: 'relay';\n message: {\n type: 'identify_video_api',\n token: string\n };\n}\n\nexport interface ViviOutgoingRoomsMessage {\n destination: 'relay';\n message: {\n type: 'video_api_rooms'\n };\n}\n\nexport interface ViviOutgoingJoinRoomMessage {\n destination: 'relay';\n message: {\n type: 'connect',\n destination_type: 'box',\n new_destination: string,\n token: string\n };\n}\n\nexport interface ViviOutgoingQueryMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'query',\n ack_id: string\n };\n}\n\nexport interface ViviOutgoingQueueLoadMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'queue_load',\n ack_id: string,\n payload: {\n urls: ViviUrl[]\n }\n };\n}\n\nexport interface ViviOutgoingPlayMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_play',\n payload: HashObject // Yep, we need to send an empty object here\n };\n}\n\nexport interface ViviOutgoingPauseMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_pause'\n };\n}\n\nexport interface ViviOutgoingStopMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_stop'\n };\n}\n\nexport interface ViviOutgoingSeekMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_seek',\n payload: {\n position: number\n }\n };\n}\n\nexport interface ViviOutgoingVolumeMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'set_volume',\n payload: {\n volume: number\n }\n };\n}\n\nexport interface ViviOutgoingMuteMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'set_mute',\n payload: {\n mute: boolean\n }\n };\n}\n\nexport interface ViviOutgoingSubtitleMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'set_subtitles',\n ack_id: string,\n payload: {\n subtitles: boolean\n }\n };\n}\n\nexport enum ViviEventName {\n Update = 'update',\n Volume = 'volume',\n Playing = 'playing',\n Paused = 'paused',\n NewChapter = 'new_chapter',\n Stopped = 'stopped',\n Ready = 'ready',\n Mute = 'mute',\n Finished = 'finished',\n Subtitles = 'subtitles'\n}\n\nexport type ViviOutgoingMessage =\n ViviOutgoingIdentifyMessage |\n ViviOutgoingRoomsMessage |\n ViviOutgoingJoinRoomMessage |\n ViviOutgoingQueryMessage |\n ViviOutgoingQueueLoadMessage |\n ViviOutgoingPlayMessage |\n ViviOutgoingPauseMessage |\n ViviOutgoingStopMessage |\n ViviOutgoingSeekMessage |\n ViviOutgoingVolumeMessage |\n ViviOutgoingMuteMessage |\n ViviOutgoingSubtitleMessage;\n\nexport interface ViviIncomingMessageParams {\n level?: number;\n chapter?: number;\n duration?: number;\n position?: number;\n playing?: boolean;\n mute?: boolean;\n subtitles?: boolean;\n queue?: ViviUrl[];\n}\n\nexport interface ViviIncomingMessagePayload {\n play_state?: ViviPlayState;\n urls?: ViviUrl[];\n event?: ViviEventName;\n params?: ViviIncomingMessageParams;\n}\n\nexport interface ViviIncomingMessage {\n source: string;\n message: {\n type: string,\n payload?: ViviIncomingMessagePayload,\n error_type?: string,\n ack_id?: string,\n rooms?: ViviRoom[]\n };\n}\n\nexport interface ViviLoadQueueRequest {\n roomId: string;\n title: string;\n videoSource: string;\n subtitleSource?: string;\n}\n\nexport interface ViviClientEventMap extends ClientEvents {\n message: ViviIncomingMessage;\n connected: void;\n}\n","import { CastSession, Device, SessionConfig, SessionEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nimport { ViviCastSessionState } from './vivi-cast-session-state';\nimport { ViviClient } from './vivi-client';\nimport { ViviEventName, ViviIncomingMessage, ViviIncomingMessageParams } from './vivi-interfaces';\n\nexport class ViviCastSession extends EventBus<SessionEvents> implements CastSession {\n private client: ViviClient;\n private localState: ViviCastSessionState;\n\n constructor(client: ViviClient, config: SessionConfig) {\n super();\n\n this.client = client;\n this.localState = new ViviCastSessionState(config.title, config.device);\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.dispose = this.dispose.bind(this);\n \n this.handleClientConnected = this.handleClientConnected.bind(this);\n this.handleDisconnectMessage = this.handleDisconnectMessage.bind(this);\n this.handleAllVideoMessages = this.handleAllVideoMessages.bind(this);\n this.handleUpdateMessage = this.handleUpdateMessage.bind(this);\n this.handleVolumeMessage = this.handleVolumeMessage.bind(this);\n this.handlePlayingMessage = this.handlePlayingMessage.bind(this);\n this.handlePausedMessage = this.handlePausedMessage.bind(this);\n this.handleFinishedMessage = this.handleFinishedMessage.bind(this);\n this.handleNewChapterMessage = this.handleNewChapterMessage.bind(this);\n this.handleStoppedMessage = this.handleStoppedMessage.bind(this);\n\n this.loadSource = this.loadSource.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.isPlaying = this.isPlaying.bind(this);\n this.getPosition = this.getPosition.bind(this);\n this.getDuration = this.getDuration.bind(this);\n this.getVolume = this.getVolume.bind(this);\n }\n\n private initialize(): void {\n // Subscribe to client diposed messages\n this.client.on('dispose', this.dispose);\n\n // Subscribe to client connected messages\n this.client.on('connected', this.handleClientConnected);\n\n // Subscribe to device disconnect messages\n this.client\n .on('message', this.handleDisconnectMessage)\n .filter(msg =>\n msg.source === this.getDevice().id &&\n msg.message.type === 'disconnect');\n\n // Subscribe to device video messages\n this.client\n .on('message', this.handleAllVideoMessages)\n .filter(msg =>\n msg.source === this.getDevice().id &&\n msg.message.type === 'video_event');\n }\n\n public dispose(): void {\n // Cleanup the subscriptions from the initialize function\n this.client.off('dispose', this.dispose);\n this.client.off('connected', this.handleClientConnected);\n this.client.off('message', this.handleDisconnectMessage);\n this.client.off('message', this.handleAllVideoMessages);\n\n // Do our best to signal to the device that we're done with it\n this.client.stop(this.getDevice().id).catch(err => console.error(err));\n\n // Trigger the dispose event\n super.dispose();\n }\n\n private async handleClientConnected(): Promise<void> {\n try {\n await this.client.joinRoom(this.getDevice().id);\n } catch (error) {\n this.trigger('error', error);\n }\n }\n\n private handleDisconnectMessage(): void {\n this.dispose();\n }\n\n private handleAllVideoMessages(msg: ViviIncomingMessage): void {\n const localState = this.localState.debounced;\n const remoteState = msg.message.payload.params || {};\n\n switch (msg.message.payload.event) {\n case ViviEventName.Update:\n this.handleUpdateMessage(localState, remoteState);\n break;\n\n case ViviEventName.NewChapter:\n this.handleNewChapterMessage(localState, remoteState);\n break;\n \n case ViviEventName.Volume:\n this.handleVolumeMessage(localState, remoteState);\n break;\n\n case ViviEventName.Playing:\n this.handlePlayingMessage(localState);\n break;\n\n case ViviEventName.Paused:\n this.handlePausedMessage(localState);\n break;\n\n case ViviEventName.Finished:\n this.handleFinishedMessage(localState);\n break;\n \n case ViviEventName.Stopped:\n this.handleStoppedMessage();\n break;\n }\n }\n\n private handleUpdateMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n if (localState.duration !== remoteState.duration) {\n localState.duration = remoteState.duration;\n this.trigger('durationchange', Event.void);\n }\n\n if (localState.position !== remoteState.position) {\n localState.position = remoteState.position;\n this.trigger('positionchange', Event.void);\n }\n\n if (localState.subtitles !== remoteState.subtitles) {\n localState.subtitles = remoteState.subtitles;\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n private handleVolumeMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n if (localState.volume !== remoteState.level) {\n localState.volume = remoteState.level;\n localState.mute = remoteState.level === 0;\n this.trigger('volumechange', Event.void);\n }\n }\n\n private handlePlayingMessage(localState: ViviCastSessionState): void {\n if (localState.playing !== true) {\n localState.playing = true;\n localState.playbackFinished = false;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handlePausedMessage(localState: ViviCastSessionState): void {\n if (localState.playing !== false) {\n localState.playing = false;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handleFinishedMessage(localState: ViviCastSessionState): void {\n if (localState.playbackFinished !== true) {\n localState.playing = false;\n localState.playbackFinished = true;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handleNewChapterMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n const remoteUrls = remoteState.queue ?? [];\n const remoteChapter = remoteUrls.find(x => x.url === localState.videoSource);\n\n if (!remoteChapter) {\n console.info(`The device is no longer playing the source we loaded - disposing the session`);\n this.dispose();\n return;\n }\n\n if (localState.subtitleSource !== remoteChapter.suburl) {\n localState.subtitleSource = remoteChapter.suburl;\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n private handleStoppedMessage(): void {\n this.dispose();\n }\n\n public async loadSource(videoSource: string, subtitleSource?: string): Promise<void> {\n if (this.localState.videoSource === videoSource && this.localState.subtitleSource === subtitleSource)\n return;\n\n try {\n // Prepare some handy variables\n const roomId = this.getDevice().id;\n const currentPosition = this.getPosition();\n \n // Set the sources\n this.localState.videoSource = videoSource;\n this.localState.subtitleSource = subtitleSource;\n\n // Mark the session as not ready while we're loading a source\n this.localState.ready = false;\n\n // We need to be connected to the room before we can load a source\n await this.client.joinRoom(roomId);\n\n // Load the source\n await this.client.loadQueue({\n title: this.getTitle(),\n roomId,\n videoSource,\n subtitleSource\n });\n\n // Mark the session as ready\n this.localState.ready = true;\n\n // Notify listeners that the source has changed\n this.trigger('sourceloaded', Event.void);\n\n // Seek to where we were before changing sources\n if (currentPosition > 0)\n this.seek(currentPosition);\n\n // We need to explicity set subtitles if we have a subtitle source\n if (subtitleSource)\n this.setSubtitles(subtitleSource);\n } catch (error) {\n console.error(error);\n\n this.trigger('error', new Error('Could not load video on Vivi device'));\n }\n }\n\n public play(): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.playing !== true) {\n this.localState.playing = true;\n this.client.play(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public pause(): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.playing !== false) {\n this.localState.playing = false;\n this.client.pause(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public seek(position: number): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.position !== position) {\n this.localState.position = position;\n this.client.seek(this.getDevice().id, position);\n this.trigger('positionchange', Event.void);\n }\n }\n\n public setVolume(volume: number): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.volume !== volume) {\n this.localState.volume = volume;\n this.client.setVolume(this.getDevice().id, volume);\n this.trigger('volumechange', Event.void);\n }\n }\n\n public setMuted(muted: boolean): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.mute !== muted) {\n this.localState.mute = muted;\n this.client.setMuted(this.getDevice().id, muted);\n this.trigger('volumechange', Event.void);\n }\n }\n\n public async setSubtitles(subtitleSource?: string): Promise<void> {\n if (!this.localState.ready)\n return;\n\n if (subtitleSource)\n await this.loadSource(this.localState.videoSource, subtitleSource);\n \n const showSubtitles = !!subtitleSource;\n\n if (this.localState.subtitles !== showSubtitles) {\n this.localState.subtitles = showSubtitles;\n this.client.setSubtitles(this.getDevice().id, showSubtitles);\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n public isPlaying(): boolean {\n return this.localState.playing;\n }\n\n public isPlaybackFinished(): boolean {\n return this.localState.playbackFinished;\n }\n\n public getPosition(): number {\n return this.localState.position;\n }\n\n public getDuration(): number | undefined {\n return this.localState.duration;\n }\n\n public getVolume(): number {\n return this.localState.volume;\n }\n\n public getMuted(): boolean {\n return this.localState.mute;\n }\n\n public getSubtitles(): string | undefined {\n if (this.localState.subtitles)\n return this.localState.subtitleSource;\n }\n\n public getDevice(): Device {\n return this.localState.device;\n }\n\n public getTitle(): string {\n return this.localState.title;\n }\n}\n","import { CastSession, Client, Device, DeviceStatus, DeviceType, SessionConfig } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\nimport { ResilientWebSocket } from 'projects/player/plugins/devices-plugin/utils/resilient-web-socket';\nimport { Scheduler } from 'projects/player/plugins/devices-plugin/utils/scheduler';\nimport { debounce } from 'projects/player/utils/fn';\nimport { IdHelper } from 'projects/player/utils/id-helper';\n\nimport { ViviCastSession } from './vivi-cast-session';\nimport { ViviClientEventMap, ViviIncomingMessage, ViviLoadQueueRequest, ViviOutgoingMessage, ViviRoom } from './vivi-interfaces';\n\nconst MESSAGE_TIMEOUT_IN_MILLISECONDS = 10000;\nconst MESSAGE_DEBOUNCE_IN_MILLISECONDS = 500;\nconst DEVICE_DISCOVERY_SCHEDULE_IN_MILLISECONDS = 10000;\n\ninterface ViviClientOptions {\n url: string;\n fetchAccessToken: () => Promise<string>;\n}\n\nexport class ViviClient extends EventBus<ViviClientEventMap> implements Client<ViviClientEventMap> {\n private options: ViviClientOptions;\n private webSocket?: ResilientWebSocket;\n private accessToken: string;\n private devices: Device[];\n private devicesFingerprint: string;\n private deviceDiscovery: Scheduler;\n\n private sendMessageDebounced: (msg: ViviOutgoingMessage) => boolean;\n\n constructor(options: ViviClientOptions) {\n super();\n \n this.options = options;\n this.accessToken = '';\n this.devices = [];\n this.devicesFingerprint = '';\n this.deviceDiscovery = new Scheduler();\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n this.sendMessageDebounced = debounce(this.sendMessage, MESSAGE_DEBOUNCE_IN_MILLISECONDS, true);\n this.beginDeviceDiscovery = this.beginDeviceDiscovery.bind(this);\n this.dispose = this.dispose.bind(this);\n this.canCastToDevice = this.canCastToDevice.bind(this);\n this.getDevices = this.getDevices.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.authenticateWithVivi = this.authenticateWithVivi.bind(this);\n this.getRoomList = this.getRoomList.bind(this);\n this.joinRoom = this.joinRoom.bind(this);\n this.query = this.query.bind(this);\n this.loadQueue = this.loadQueue.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.stop = this.stop.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.setMuted = this.setMuted.bind(this);\n this.setSubtitles = this.setSubtitles.bind(this);\n }\n\n private initialize(): void {\n this.webSocket = new ResilientWebSocket(this.options.url);\n\n this.webSocket.onMessage = (event: MessageEvent) => this.trigger('message', JSON.parse(event.data));\n\n this.webSocket.onOpen = async () => {\n try {\n this.accessToken = await this.options.fetchAccessToken();\n \n await this.authenticateWithVivi();\n \n this.beginDeviceDiscovery();\n\n this.trigger('connected', Event.void);\n } catch (err) {\n console.error(err);\n \n this.trigger('error', new Error('Could not connect to Vivi'));\n }\n };\n }\n\n private sendMessage(msg: ViviOutgoingMessage): void {\n this.webSocket?.send(JSON.stringify(msg));\n }\n\n private beginDeviceDiscovery(): void {\n this.deviceDiscovery\n .every(DEVICE_DISCOVERY_SCHEDULE_IN_MILLISECONDS)\n .schedule(async () => {\n try {\n const rooms = await this.getRoomList();\n const roomsFingerprint = ViviClient.calculateFingerprint(rooms);\n\n // If the rooms haven't changed, don't bother updating the devices\n if (roomsFingerprint === this.devicesFingerprint)\n return;\n\n const numberOfUniqueOrganisations = new Set(rooms.map(r => r.organisation ?? '')).size;\n const numberOfUniqueLocations = new Set(rooms.map(r => r.location ?? '')).size;\n\n this.devices = rooms.map(r => ({\n id: r.id,\n name: r.name,\n schoolName: numberOfUniqueOrganisations > 1 ? r.organisation : '',\n description: numberOfUniqueLocations > 1 ? r.location : '',\n type: DeviceType.Vivi,\n status: DeviceStatus.Available\n }));\n\n this.devicesFingerprint = roomsFingerprint;\n\n this.trigger('deviceschange', Event.void);\n } catch (error) {\n // This could be a transient error, so we don't want to trigger the 'error' event\n // as that would cause the player to stop playback for an error that it could recover from..\n console.warn(error);\n }\n })\n .trigger()\n .start();\n }\n\n public dispose(): void {\n // Stop the device discovery\n this.deviceDiscovery.stop();\n\n // Dispose websocket\n this.webSocket?.dipose();\n\n // Dispose event bus\n super.dispose();\n }\n\n public canCastToDevice(deviceType: DeviceType): boolean {\n if (deviceType === DeviceType.Vivi)\n return true;\n\n return false;\n }\n\n public getDevices(): Device[] {\n return this.devices;\n }\n\n public startCastSession(config: SessionConfig): CastSession {\n return new ViviCastSession(this, config);\n }\n\n public async authenticateWithVivi(): Promise<void> {\n this.sendMessage({\n destination: 'relay',\n message: {\n token: this.accessToken,\n type: 'identify_video_api'\n }\n });\n\n await this\n .one('message', msg => msg.message.type === 'video_api_identified')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to authenticate with Vivi'); });\n }\n\n public async getRoomList(): Promise<ViviRoom[]> {\n this.sendMessage({\n destination: 'relay',\n message: {\n type: 'video_api_rooms'\n }\n });\n\n const response = await this\n .one('message', msg => msg.message.type === 'video_api_rooms')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to fetch rooms'); });\n\n return response.message.rooms || [];\n }\n\n public async joinRoom(roomId: string): Promise<void> {\n this.sendMessage({\n destination: 'relay',\n message: {\n destination_type: 'box',\n new_destination: roomId,\n token: this.accessToken,\n type: 'connect'\n }\n });\n\n await this\n .one('message', msg => {\n if (msg.source === roomId && msg.message.type === 'connect') return true;\n if (msg.message.type === 'error' && msg.message.error_type === 'already_connected') return true;\n })\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to join room'); });\n }\n\n public async query(roomId: string): Promise<ViviIncomingMessage> {\n const ackId = ViviClient.createAckId();\n\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ackId,\n name: 'query'\n }\n });\n\n return await this\n .one('message', msg => msg.message.ack_id === ackId)\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to fetch query'); });\n }\n\n public async loadQueue({ roomId, title, videoSource, subtitleSource }: ViviLoadQueueRequest): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ViviClient.createAckId(),\n name: 'queue_load',\n payload: {\n urls: [{\n title,\n url: videoSource,\n suburl: subtitleSource\n }]\n }\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'ready')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to load media'); });\n }\n\n public async play(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_play',\n payload: {}\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'playing')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to play video'); });\n }\n\n public async pause(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_pause'\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'paused')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to pause video'); });\n }\n\n public async stop(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_stop'\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'stopped')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to stop video'); });\n }\n\n public async seek(roomId: string, position: number): Promise<void> {\n const sent = this.sendMessageDebounced({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_seek',\n payload: {\n position\n }\n }\n });\n\n if (sent) {\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'playing')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to seek video'); });\n }\n }\n\n public async setVolume(roomId: string, volume: number): Promise<void> {\n const sent = this.sendMessageDebounced({\n destination: roomId,\n message: {\n type: 'message',\n name: 'set_volume',\n payload: {\n volume\n }\n }\n });\n\n if (sent) {\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'volume')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set volume'); });\n }\n }\n\n public async setMuted(roomId: string, muted: boolean): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'set_mute',\n payload: {\n mute: muted\n }\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'mute')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set mute'); });\n }\n\n public async setSubtitles(roomId: string, showSubtitles: boolean): Promise<void> {\n const ackId = ViviClient.createAckId();\n\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ackId,\n name: 'set_subtitles',\n payload: {\n subtitles: showSubtitles\n }\n }\n });\n \n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'subtitles')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set subtitles'); });\n }\n\n private static createAckId(): string {\n return IdHelper.generateRandomId();\n }\n\n private static calculateFingerprint(devicesOrRooms: { id: string }[]): string {\n return devicesOrRooms.map(dr => dr.id).sort().join(',');\n }\n}\n","import { CastSession, Client, Device, SessionConfig } from './clients/client-interfaces';\nimport { BaseEvents, EventBus } from './utils/event-bus';\n\ninterface DevicesSessionManagerEventMap extends BaseEvents {\n deviceschange: Device[];\n castsessionchange: CastSession | undefined;\n error: Error;\n}\n\nexport class DevicesSessionManager extends EventBus<DevicesSessionManagerEventMap> {\n private instanceId: string;\n private clients: Client[];\n private castSession?: CastSession;\n\n private constructor(instanceId: string) {\n super();\n\n this.instanceId = instanceId;\n this.clients = [];\n \n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.addClient = this.addClient.bind(this);\n this.hasInstanceOfClient = this.hasInstanceOfClient.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.gatherAndPublishDevices = this.gatherAndPublishDevices.bind(this);\n this.dispose = this.dispose.bind(this);\n }\n\n public addClient(client: Client): void {\n client.on('deviceschange', this.gatherAndPublishDevices);\n client.on('error', err => this.trigger('error', err));\n \n this.clients.push(client);\n }\n\n public hasInstanceOfClient(clientType: any): boolean {\n return this.clients.some(c => c instanceof clientType);\n }\n \n public startCastSession(config: SessionConfig): void {\n // If a session with the selected device is already in progress, we need to dispose it\n if (this.castSession) {\n if (this.castSession.getDevice().id !== config.device.id)\n this.castSession.dispose();\n else {\n console.info(`A session with device ${config.device.id} already exists - this is a no-op`);\n return;\n }\n }\n\n // Find a client that can cast to the selected device\n const client = this.clients.find(c => c.canCastToDevice(config.device.type));\n\n // Create a new session and notify listeners\n if (client) {\n this.castSession = client.startCastSession(config);\n\n this.castSession.on('error', err => {\n this.castSession.dispose();\n this.trigger('error', err);\n });\n\n this.castSession.on('dispose', () => {\n this.castSession = undefined;\n this.trigger('castsessionchange', undefined);\n });\n \n this.trigger('castsessionchange', this.castSession);\n }\n }\n\n public getCastSession(): CastSession | undefined {\n return this.castSession;\n }\n\n private gatherAndPublishDevices(): void {\n const results = this.clients.map(c => c.getDevices());\n const devices = results.reduce((agg, val) => [ ...agg, ...val ], []);\n\n this.trigger('deviceschange', devices);\n }\n\n public dispose(): void {\n this.castSession?.dispose();\n this.clients.forEach(c => c.dispose());\n \n this.castSession = undefined;\n this.clients = [];\n\n super.dispose();\n }\n\n private static instances: {[key: string]: DevicesSessionManager } = {};\n\n public static getOrCreateInstance(instanceId: string): DevicesSessionManager {\n if (!instanceId)\n throw new Error('instanceId is required');\n\n if (!this.instances[instanceId])\n this.instances[instanceId] = new DevicesSessionManager(instanceId);\n \n return this.instances[instanceId];\n }\n\n public static disposeAndRemoveInstance(sessionManager: DevicesSessionManager): void {\n sessionManager.dispose();\n delete this.instances[sessionManager.instanceId];\n }\n\n public static isActive(): boolean {\n return Object.keys(this.instances).length > 0;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport './device-menu-item.scss';\n\ninterface DeviceMenuItemOptions extends videojs.MenuItemOptions {\n available: boolean;\n type: DeviceType;\n id: string;\n schoolName?: string;\n description?: string;\n onClick: () => void;\n}\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\nexport class DeviceMenuItem extends MenuItem {\n public options_: DeviceMenuItemOptions;\n\n constructor(player: VideoJsPlayer, options?: DeviceMenuItemOptions) {\n super(player, options);\n\n this.isVisible = this.isVisible.bind(this);\n }\n\n public createEl(): HTMLLIElement {\n const iconClassNames: Record<DeviceType, string> = {\n 'vivi': 'cv-vivi-icon',\n 'apple-tv': 'cv-apple-icon'\n };\n\n const container = super.createEl('li', {\n className: 'vjs-menu-item cv-device-menu-item'\n });\n\n const el = videojs.dom.createEl('div', {\n className: 'cv-device-menu-item-body',\n innerHTML: `\n <span class=\"cv-device-icon ${iconClassNames[this.options_.type]}\"></span>\n <div>\n <span class=\"vjs-menu-item-text\">${this.options_.label}</span>\n <span class=\"vjs-menu-item-text cv-device-truncated-text\">${this.options_.schoolName ?? ''}</span>\n <span class=\"vjs-menu-item-text cv-device-truncated-text cv-device-description\">${this.options_.description ?? ''}</span>\n </div>\n `\n });\n\n container.replaceChildren(el);\n\n return container;\n }\n\n public handleClick(): void {\n this.options_.onClick();\n }\n\n public show(): void {\n super.show();\n }\n\n public hide(): void {\n super.hide();\n }\n\n public isVisible(): boolean {\n return !super.hasClass('vjs-hidden');\n }\n}\n","import SimpleBar from 'simplebar';\nimport videojs from 'video.js';\n\nimport { baseMenuCreateEl } from 'projects/player/components/menu/menu';\n\nimport './devices-menu.scss';\n\nconst Menu = videojs.getComponent('Menu');\n\nexport class DevicesMenu extends Menu {\n private contentWrapper: HTMLDivElement;\n private ctaElement: HTMLDivElement;\n private simpleBar: SimpleBar;\n\n public createEl(): HTMLDivElement {\n const el = baseMenuCreateEl.apply(this);\n const content = (this as any).contentEl_;\n\n this.contentWrapper = videojs.dom.createEl('div', {\n className: 'vjs-menu-content'\n }) as HTMLDivElement;\n \n el.className = 'vjs-menu cv-devices-menu';\n content.className = 'cv-devices-menu-item-list';\n\n el.removeChild(content);\n el.appendChild(this.contentWrapper);\n\n this.contentWrapper.appendChild(content);\n this.simpleBar = new SimpleBar(content as HTMLElement, { autoHide: false });\n\n return el;\n }\n\n public addCta(component: videojs.Component): void {\n if (this.ctaElement) {\n console.warn('CTA has already been added to the menu - this is a no-op');\n return;\n }\n\n this.ctaElement = component.el() as HTMLDivElement;\n this.contentWrapper.prepend(this.ctaElement);\n this.el().classList.add('has-cta');\n }\n\n public removeCta(): void {\n if (this.ctaElement) {\n this.contentWrapper.removeChild(this.ctaElement);\n this.el().classList.remove('has-cta');\n }\n }\n}\n\nvideojs.registerComponent('DevicesMenu', DevicesMenu);\n","import * as React from 'react';\nimport videojs, { VideoJsPlayer } from 'video.js';\n\nimport { CtaContext } from 'libs/shared/interfaces';\n\nimport { DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { getReactComponent } from 'projects/player/react/react-component';\n\nimport './devices-cta.scss';\n\ninterface DevicesCtaProps {\n onDismiss: (context: CtaContext) => void;\n onInstall: (context: CtaContext) => void;\n onLearnMore: (context: CtaContext) => void;\n onContactSupport: (context: CtaContext) => void;\n inactiveIntegrations: DeviceType[];\n canUserManageIntegrations: boolean;\n player: VideoJsPlayer;\n}\n\nfunction DevicesCta({\n inactiveIntegrations,\n canUserManageIntegrations,\n player,\n onDismiss,\n onInstall,\n onLearnMore,\n onContactSupport\n}: DevicesCtaProps): JSX.Element {\n if (inactiveIntegrations.length === 0) return <></>;\n\n const localize = (text: string) => player.localize(text);\n\n const isInactive = (val: DeviceType) =>\n inactiveIntegrations.indexOf(val) !== -1;\n\n let context: CtaContext;\n \n if (isInactive(DeviceType.AppleTv) && isInactive(DeviceType.Vivi))\n context = 'vivi_and_apple_tv';\n else if (isInactive(DeviceType.Vivi))\n context = 'vivi';\n else\n context = 'apple_tv';\n\n return (\n <div className='cv-devices-cta' tabIndex={-1}>\n <Header context={context} localize={localize} onDismiss={() => onDismiss(context)} />\n <Body context={context} />\n <Footer\n context={context}\n canUserManageIntegrations={canUserManageIntegrations}\n localize={localize}\n onContactSupport={() => onContactSupport(context)}\n onInstall={() => onInstall(context)}\n onLearnMore={() => onLearnMore(context)}\n />\n </div>\n );\n}\n\ninterface HeaderProps {\n context: CtaContext;\n localize: (text: string) => string;\n onDismiss: () => void;\n}\n\nfunction Header({ context, localize, onDismiss }: HeaderProps): JSX.Element {\n return (\n <div className='cv-devices-cta-header'>\n <span className='cv-devices-title'>\n {context === 'vivi_and_apple_tv' && localize('Cast to Vivi and Apple TV')}\n {context === 'vivi' && localize('Cast to Vivi')}\n {context === 'apple_tv' && localize('Cast to Apple TV')}\n </span>\n <span className='cv-devices-close' onClick={onDismiss}>\n <svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path fillRule='evenodd' clipRule='evenodd' fill='white' d='M11.9588 10.6413L16.3612 6.34478C16.7361 5.97191 17.3439 5.97191 17.7188 6.34478C18.0937 6.71764 18.0937 7.32218 17.7188 7.69505L13.3165 11.9916L17.7188 16.3701C18.0937 16.7429 18.0937 17.3475 17.7188 17.7203C17.3439 18.0932 16.7361 18.0932 16.3612 17.7203L11.9588 13.3419L7.63882 17.7203C7.26392 18.0932 6.65608 18.0932 6.28118 17.7203C5.90627 17.3475 5.90627 16.7429 6.28118 16.3701L10.6012 11.9916L6.28118 7.62993C5.90627 7.25706 5.90627 6.65252 6.28118 6.27965C6.65608 5.90678 7.26392 5.90678 7.63882 6.27965L11.9588 10.6413Z' />\n </svg>\n </span>\n </div>\n );\n}\n\ninterface BodyProps {\n context: CtaContext;\n}\n\nfunction Body({ context }: BodyProps): JSX.Element {\n const bgClassName = context === 'vivi_and_apple_tv' ? 'bg-vivi-and-apple' : context === 'vivi' ? 'bg-vivi' : 'bg-apple';\n\n return (\n <div className={`cv-devices-cta-body ${bgClassName}`}>\n {(context === 'vivi_and_apple_tv' || context === 'apple_tv') && <div className='cv-devices-icon-container'><span className='cv-devices-icon apple'></span></div>}\n {(context === 'vivi_and_apple_tv' || context === 'vivi') && <div className='cv-devices-icon-container'><span className='cv-devices-icon vivi'></span></div>}\n </div>\n );\n}\n\ninterface FooterProps {\n context: CtaContext;\n canUserManageIntegrations: boolean;\n localize: (text: string) => string;\n onInstall: () => void;\n onLearnMore: () => void;\n onContactSupport: () => void;\n}\n\nfunction Footer({\n context,\n canUserManageIntegrations,\n localize,\n onInstall,\n onLearnMore,\n onContactSupport\n}: FooterProps): JSX.Element {\n if (canUserManageIntegrations) {\n return (\n <div className='cv-devices-cta-footer'>\n <span>\n {context === 'vivi_and_apple_tv' && localize('Connect Vivi or Apple TV to make presenting in the classroom easy.')}\n {context === 'vivi' && localize('Connect Vivi to make presenting in the classroom easy.')}\n {context === 'apple_tv' && localize('Connect Apple TV to make presenting in the classroom easy.')}\n </span>\n <br />\n <span className='cv-devices-link' onClick={onInstall}>{localize('Click here to install')}</span>\n </div>\n );\n }\n\n return (\n <div className='cv-devices-cta-footer'>\n <span>\n {context === 'vivi_and_apple_tv' && localize('To cast to Vivi and Apple TV, contact ')}\n {context === 'vivi' && localize('To cast to Vivi, contact ')}\n {context === 'apple_tv' && localize('To cast to Apple TV, contact ')}\n </span>\n <span className='cv-devices-link' onClick={onContactSupport}>ClickView Support</span>\n <span>\n {context === 'vivi_and_apple_tv' && localize(' or your administrator to set them up.')}\n {context === 'vivi' && localize(' or your administrator to set it up.')}\n {context === 'apple_tv' && localize(' or your administrator to set it up.')}\n </span>\n <br />\n <span className='cv-devices-link' onClick={onLearnMore}>Learn more</span>\n </div>\n );\n}\n\nvideojs.registerComponent(\n 'DevicesCta',\n getReactComponent(\n (player: VideoJsPlayer, options: DevicesCtaProps) => <DevicesCta player={player} {...options} />,\n { properties: { className: 'cv-devices-cta-wrapper' } }\n )\n);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { CtaContext } from 'libs/shared/interfaces';\n\nimport { CollapsibleHeadingMenuItem } from 'projects/player/components/cog-button/collapsible-heading-menu-item';\nimport { NoMatchingResultsMenuItem, SearchInputMenuItem } from 'projects/player/components/search-input-menu-item/search-input-menu-item';\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\nimport { CastSession, Device, DeviceStatus, DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport { DeviceMenuItem } from '../device-menu-item/device-menu-item';\nimport { DevicesMenu } from '../devices-menu/devices-menu';\n\nimport './devices-button.scss';\n\nimport 'projects/player/plugins/devices-plugin/components/devices-cta/devices-cta';\n\nconst DEVICE_COUNT_THRESHOLD_FOR_SEARCH = 20;\n\nconst DevicesCta = videojs.getComponent('DevicesCta');\nconst MenuButton = videojs.getComponent('MenuButton');\n\nexport interface DevicesButtonOptions extends videojs.MenuButtonOptions {\n onClick: () => void;\n onDeviceMenuItemClick: (item: DeviceMenuItem, device: Device) => void;\n ctaOptions: {\n hasBeenDismissed: boolean,\n canUserManageIntegrations: boolean,\n inactiveIntegrations: DeviceType[],\n onDismiss: (context: CtaContext) => void,\n onInstall: (context: CtaContext) => void,\n onLearnMore: (context: CtaContext) => void,\n onContactSupport: (context: CtaContext) => void\n };\n}\n\nexport class DevicesButton extends MenuButton implements CollapsibleComponent {\n private searchText: string;\n private devices: Device[];\n private castSession?: CastSession;\n private headingItem?: CollapsibleHeadingMenuItem;\n private searchInputItem?: SearchInputMenuItem;\n private emptyPlaceholder?: NoMatchingResultsMenuItem;\n private cta?: videojs.Component;\n \n public options_: DevicesButtonOptions;\n public controlText_: string;\n\n constructor(player: VideoJsPlayer, options?: DevicesButtonOptions) {\n super(player, options);\n\n this.searchText = '';\n this.devices = [];\n this.castSession = undefined;\n\n this.bindFunctions();\n this.bindEventListeners();\n }\n\n private bindFunctions(): void {\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.setDevices = this.setDevices.bind(this);\n this.setCastSession = this.setCastSession.bind(this);\n this.setSearchText = this.setSearchText.bind(this);\n this.getDeviceMenuItems = this.getDeviceMenuItems.bind(this);\n this.render = this.render.bind(this);\n this.removeMenuItems = this.removeMenuItems.bind(this);\n this.addMenuItemsForDevices = this.addMenuItemsForDevices.bind(this);\n this.shouldShowSearchInput = this.shouldShowSearchInput.bind(this);\n this.toggleSearchInput = this.toggleSearchInput.bind(this);\n this.toggleDeviceMenuItems = this.toggleDeviceMenuItems.bind(this);\n this.toggleEmptyStatePlaceholder = this.toggleEmptyStatePlaceholder.bind(this);\n }\n\n private bindEventListeners(): void {\n const el = this.$('button');\n\n const onBlur = (e: videojs.EventTarget.Event) => {\n (this.menu as any).handleBlur(e);\n };\n\n el.addEventListener('blur', onBlur);\n\n this.one('dispose', () => {\n el.removeEventListener('blur', onBlur);\n this.cta?.dispose();\n });\n }\n\n public createEl(...args: any[]): Element {\n return MenuButton.prototype.createEl.apply(this, ...args);\n }\n\n public buildWrapperCSSClass() {\n return `cv-menu-small cv-devices-button ${super.buildWrapperCSSClass()}`;\n }\n\n public createMenu(): videojs.Menu {\n const menu = new DevicesMenu(this.player_, {\n menuButton: this\n });\n\n if (!this.options_.ctaOptions.hasBeenDismissed && this.options_.ctaOptions.inactiveIntegrations.length > 0) {\n const { onDismiss, ...rest } = this.options_.ctaOptions;\n\n this.cta = new DevicesCta(this.player(), {\n ...rest,\n onDismiss: (context: CtaContext) => {\n menu.removeCta();\n onDismiss(context);\n }\n } as any);\n\n menu.addCta(this.cta);\n }\n\n const children = this.createItems();\n\n children.forEach(x => menu.addItem(x));\n\n return menu;\n }\n\n public createItems(): videojs.MenuItem[] {\n const items: videojs.MenuItem[] = [];\n\n this.headingItem = new CollapsibleHeadingMenuItem(this.player_, {\n label: this.localize('Select a device'),\n selectable: false\n });\n\n this.searchInputItem = new SearchInputMenuItem(this.player_, {\n menuButton: this,\n search: searchText => this.setSearchText(searchText),\n className: 'cv-devices-search-input'\n });\n\n this.emptyPlaceholder = new NoMatchingResultsMenuItem(this.player_, {\n label: 'No devices found',\n selected: false,\n selectable: false,\n multiSelectable: false\n });\n\n this.headingItem.show();\n this.searchInputItem.hide();\n this.emptyPlaceholder.show();\n\n items.push(\n this.headingItem,\n this.searchInputItem,\n this.emptyPlaceholder\n );\n\n return items;\n }\n\n public pressButton(): void {\n super.pressButton();\n\n if (this.shouldShowSearchInput())\n this.searchInputItem?.focus();\n }\n\n public setDevices(devices: Device[]): void {\n this.devices = devices;\n this.render();\n }\n\n public setCastSession(castSession?: CastSession): void {\n this.castSession = castSession;\n this.render();\n }\n\n public setSearchText(searchText: string): void {\n this.searchText = searchText;\n this.render();\n }\n\n public getDeviceMenuItems(): DeviceMenuItem[] {\n return this.menu.children_.filter(x => x instanceof DeviceMenuItem) as DeviceMenuItem[];\n }\n\n private render(): void {\n // Update the UI\n this.removeMenuItems(this.getDeviceMenuItems());\n this.addMenuItemsForDevices(this.devices);\n this.toggleSearchInput();\n this.toggleDeviceMenuItems();\n this.toggleEmptyStatePlaceholder();\n }\n\n private removeMenuItems(items: videojs.MenuItem[]): void {\n items.forEach(x => {\n this.menu.removeChild(x);\n x.dispose();\n });\n }\n\n private addMenuItemsForDevices(devices: Device[]): void {\n // Sort devices by type, description and name\n const sortedDevices = devices.sort((a, b) => {\n const qualifiedNameDeviceA = `${a.type}${a.schoolName ?? ''}${a.description ?? ''}${a.name}`;\n const qualifiedNameDeviceB = `${b.type}${b.schoolName ?? ''}${b.description ?? ''}${b.name}`;\n return qualifiedNameDeviceA.localeCompare(qualifiedNameDeviceB);\n });\n\n sortedDevices.forEach(x => {\n const newItem = new DeviceMenuItem(this.player(), {\n id: x.id,\n label: x.name,\n schoolName: x.schoolName,\n description: x.description,\n selected: false,\n multiSelectable: false,\n selectable: true,\n available: x.status === DeviceStatus.Available,\n type: x.type,\n onClick: () => {\n this.options_.onDeviceMenuItemClick(newItem, x);\n }\n });\n\n this.menu.addItem(newItem);\n });\n }\n\n private shouldShowSearchInput(): boolean {\n const deviceMenuItems = this.getDeviceMenuItems();\n const showSearchInput = deviceMenuItems.length >= DEVICE_COUNT_THRESHOLD_FOR_SEARCH;\n\n return showSearchInput;\n }\n\n private toggleSearchInput(): void {\n if (this.shouldShowSearchInput()) {\n this.searchInputItem.show();\n this.menu.addClass('vertical-fill');\n } else {\n this.searchInputItem.hide();\n this.menu.removeClass('vertical-fill');\n }\n }\n\n private toggleDeviceMenuItems(): void {\n const deviceMenuItems = this.getDeviceMenuItems();\n const isSearchEnabled = this.shouldShowSearchInput();\n const searchTextLowerCase = this.searchText.toLowerCase();\n \n // Update the UI of each device menu item\n deviceMenuItems.forEach(x => {\n const device = this.devices.find(y => y.id === x.options_.id);\n\n if (!device)\n return;\n\n const isAvailable = device.status === DeviceStatus.Available;\n const isInSession = device.id === this.castSession?.getDevice().id;\n const isMatchingSearch = isSearchEnabled ?\n `${device.name} ${device.schoolName ?? ''} ${device.description ?? ''}`.trim().toLowerCase().indexOf(searchTextLowerCase) !== -1 :\n true;\n \n isAvailable ? x.enable() : x.disable();\n isMatchingSearch ? x.show() : x.hide();\n isInSession ? x.selected(true) : x.selected(false);\n });\n }\n\n private toggleEmptyStatePlaceholder(): void {\n const allDeviceMenuItems = this.getDeviceMenuItems();\n const visibleDeviceMenuItems = allDeviceMenuItems.filter(x => x.isVisible());\n\n visibleDeviceMenuItems.length ?\n this.emptyPlaceholder.hide() :\n this.emptyPlaceholder.show();\n \n allDeviceMenuItems.length ?\n this.emptyPlaceholder.setLabel(this.localize('No matching results')) :\n this.emptyPlaceholder.setLabel(this.localize('No devices found'));\n }\n\n /**\n * CollapsibileComponent interface implementation\n * from here onward\n */\n public alwaysCollapsed: boolean = false;\n public isCollapsed: boolean = false;\n public isCollabsible: boolean = true;\n public className: string = 'cv-devices-menu-button';\n\n public getCollabsibleName(): string {\n return this.controlText_;\n }\n\n public getCollabsibleValue(): string {\n return this.castSession?.getDevice().name ?? ' ';\n }\n\n public showInCollabsibleMenu(): boolean {\n return true;\n }\n\n public showCollapsibleMenu(): void {\n this.handleClick();\n }\n\n public handleClick(): void {\n super.handleClick(null);\n this.options_.onClick();\n }\n}\n\nDevicesButton.prototype.controlText_ = 'Devices';\n\nvideojs.registerComponent('DevicesButton', DevicesButton);\n","import videojs from 'video.js';\n\nimport { Device, DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport './devices-tech-ui.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface DevicesTechUIOptions extends videojs.ComponentOptions {\n onStopCasting: () => void;\n}\n\nexport class DevicesTechUI extends Component {\n private poster: string;\n private device?: Device;\n \n public options_: DevicesTechUIOptions;\n\n constructor(options: DevicesTechUIOptions) {\n super(null, options);\n }\n\n public createEl(): Element {\n return super.createEl('div', {\n className: 'cv-devices-tech'\n });\n }\n\n public setPoster(poster: string): void {\n this.poster = poster;\n this.update();\n }\n\n public setDevice(device: Device): void {\n this.device = device;\n this.update();\n }\n\n /**\n * Unfortunately we can't use the traditional way\n * of building out components and click handlers\n * because this component is ultimately detached\n * from the player so much of it's functionality won't work\n */\n public update(): void {\n const iconClassNames: Record<DeviceType, string> = {\n 'vivi': 'cv-vivi-icon',\n 'apple-tv': 'cv-apple-icon'\n };\n\n (this as any).el_.innerHTML = `\n <div class=\"cv-devices-content\">\n <p>${this.localize('Currently playing on')}</p>\n <h2><span class=\"cv-device-icon ${iconClassNames[this.device?.type ?? DeviceType.Vivi]}\"></span>${this.device?.name ?? ''}</h2>\n </div>\n <div class=\"cv-devices-background\" style=\"background-image: url(${this.poster})\"></div>\n `;\n\n const button = document.createElement('button');\n \n const onPress = (event: Event | TouchEvent) => {\n event.stopPropagation();\n this.options_.onStopCasting();\n };\n\n button.onclick = onPress;\n button.ontouchstart = onPress;\n button.className = 'stop-casting-button';\n button.innerHTML = this.localize('Stop casting');\n\n (this as any).el_.querySelector('.cv-devices-content').appendChild(button);\n }\n\n // This function needs to be here in order to get \n // VideoJS to add this component into its UI tree..\n public play(): void {}\n}\n","import videojs from 'video.js';\n\nimport { CastSession, Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { DevicesSessionManager } from 'projects/player/plugins/devices-plugin/devices-session-manager';\nimport { DASH_MIME_TYPE } from 'projects/player/plugins/media-sources-plugin/media-source-helper';\nimport { LocalCacheHelper } from 'projects/player/utils/local-cache-helper';\nimport { TrackHelper } from 'projects/player/utils/track-helper';\n\nimport { DevicesTechUI } from './devices-tech-ui/devices-tech-ui';\n\ninterface TechWithConstructor extends videojs.Tech {\n new (options: videojs.ComponentOptions, ready: videojs.Component.ReadyCallback): videojs.Tech;\n}\n\ninterface DevicesTechOptions extends videojs.ComponentOptions {\n source: videojs.Tech.SourceObject;\n instanceId?: string;\n poster?: string;\n playerId: string;\n}\n\ntype PlayerTextTrack = TextTrack & { src?: string };\n\nconst Tech = videojs.getComponent('Tech') as unknown as TechWithConstructor;\n\nclass DevicesTech extends Tech {\n private ui?: DevicesTechUI;\n private videojsPlayer: videojs.Player;\n\n public readonly featuresVolumeControl: boolean = true;\n public readonly featuresPlaybackRate: boolean = false;\n public readonly movingMediaElementInDOM: boolean = false;\n public readonly featuresFullscreenResize: boolean = true;\n public readonly featuresTimeupdateEvents: boolean = true;\n public readonly featuresProgressEvents: boolean = false;\n public readonly featuresNativeTextTracks: boolean = false;\n public readonly featuresNativeAudioTracks: boolean = false;\n public readonly featuresNativeVideoTracks: boolean = false;\n public readonly featuresMuteControl: boolean = true;\n public readonly featuresSourceset: boolean = false;\n\n public options_: DevicesTechOptions;\n\n constructor(options: videojs.ComponentOptions, ready: videojs.Component.ReadyCallback) {\n super(options, ready as any);\n\n this.videojsPlayer = videojs(this.options_.playerId);\n \n this.bindFunctions();\n this.bindEventListeners();\n\n this.ready((): void => {\n this.setSource(this.options_.source);\n });\n \n this.triggerReady();\n }\n\n private bindFunctions(): void {\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.onTextTrackChanged = this.onTextTrackChanged.bind(this);\n this.getSelectedTextTrack = this.getSelectedTextTrack.bind(this);\n this.setSelectedTextTrack = this.setSelectedTextTrack.bind(this);\n this.showUI = this.showUI.bind(this);\n this.hideUI = this.hideUI.bind(this);\n this.dispose = this.dispose.bind(this);\n this.setSource = this.setSource.bind(this);\n this.getCastSession = this.getCastSession.bind(this);\n }\n\n private bindEventListeners(): void {\n const session = this.getCastSession();\n\n if (!session) return;\n\n this.textTracks().on('change', this.onTextTrackChanged);\n\n this.videojsPlayer.one('ended', () => {\n session.dispose();\n });\n\n session.on('durationchange', () => {\n this.trigger('durationchange');\n });\n\n session.on('dispose', () => {\n this.trigger('ended');\n this.hideUI();\n });\n\n session.on('playingchange', () => {\n const playing = session.isPlaying();\n\n if (playing) {\n this.trigger('play');\n this.trigger('playing');\n } else {\n this.trigger('pause');\n }\n });\n\n session.on('volumechange', () => {\n this.trigger('volumechange');\n });\n\n session.on('sourceloaded', () => {\n this.trigger('loadeddata');\n });\n\n session.on('subtitleschange', () => {\n this.setSelectedTextTrack(session.getSubtitles());\n });\n }\n\n private onTextTrackChanged(): void {\n const textTrack = this.getSelectedTextTrack();\n\n this.getCastSession()?.setSubtitles(textTrack?.src);\n }\n\n private getSelectedTextTrack(): PlayerTextTrack | null {\n return TrackHelper.findTrackByPredicate(this.videojsPlayer.player_, (track: PlayerTextTrack) => {\n return track.mode === 'showing' && !!track.src;\n }) as PlayerTextTrack;\n }\n\n private setSelectedTextTrack(subtitleSource: string): void {\n TrackHelper.forEachTrack(this.videojsPlayer.player_, (t: PlayerTextTrack) => {\n if (t.kind !== 'subtitles')\n return;\n\n if (t.src === subtitleSource)\n t.mode = 'showing';\n else\n t.mode = 'disabled';\n });\n }\n\n private showUI(device: Device): void {\n if (!this.ui) return;\n\n this.ui.setPoster(this.options_.poster);\n this.ui.setDevice(device);\n this.ui.show();\n }\n\n private hideUI(): void {\n this.ui?.hide();\n }\n\n public dispose(): void {\n this.textTracks().off('change', this.onTextTrackChanged);\n\n const session = this.getCastSession();\n\n if (session)\n session.dispose();\n \n super.cleanupAutoTextTracks();\n super.dispose();\n }\n\n public createEl(): Element {\n this.ui = this.ui || new DevicesTechUI({\n onStopCasting: () => {\n this.getCastSession()?.dispose();\n }\n });\n\n return this.ui.el();\n }\n\n public setSource(source: videojs.Tech.SourceObject): void {\n const session = this.getCastSession();\n\n if (!session) return;\n\n this.showUI(session.getDevice());\n\n this.trigger('loadstart');\n\n const textTrack = this.getSelectedTextTrack();\n\n // The remote casting devices often cannot reach the Local Cache server on a\n // school's network. When setting the source for the casting session, we always\n // use the CDN URL..\n session.loadSource(LocalCacheHelper.getOriginalUrl(source.src), textTrack?.src);\n }\n\n public addRemoteTextTrack(options: videojs.TextTrackOptions): HTMLTrackElement {\n return super.addRemoteTextTrack(options, true);\n }\n\n public getCastSession(): CastSession | undefined {\n return DevicesSessionManager\n .getOrCreateInstance(this.options_.instanceId ?? '')\n .getCastSession();\n }\n\n public play(): void {\n this.getCastSession()?.play();\n }\n\n public pause(): void {\n this.getCastSession()?.pause();\n }\n\n public paused(): boolean {\n return this.getCastSession()?.isPlaying() === false;\n }\n\n public ended(): boolean {\n return this.getCastSession()?.isPlaybackFinished() ?? false;\n }\n\n public setCurrentTime(time?: number): void {\n this.getCastSession()?.seek(time ?? 0);\n }\n\n public currentTime(): number {\n return this.getCastSession()?.getPosition() ?? 0;\n }\n\n public duration(): number {\n return this.getCastSession()?.getDuration() ?? this.videojsPlayer.duration();\n }\n\n public volume(): number {\n return this.getCastSession()?.getVolume() ?? 1;\n }\n\n public setVolume(volume: number): void {\n this.getCastSession()?.setVolume(volume);\n }\n\n public muted(): boolean {\n return this.getCastSession()?.getMuted() ?? false;\n }\n\n public setMuted(muted: boolean): void {\n this.getCastSession()?.setMuted(muted);\n }\n \n public buffered(): void {\n return undefined; // Intentionally returning undefined to opt out of displaying a buffer\n }\n\n public seekable(): videojs.TimeRange {\n return videojs.createTimeRanges(0, this.duration());\n }\n\n public playbackRate(): number {\n return 1;\n }\n\n public readyState(): number {\n // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState\n return 4;\n }\n\n public controls(): boolean {\n return false;\n }\n\n public playsinline(): boolean {\n return true;\n }\n\n public supportsFullScreen(): boolean {\n return true;\n }\n\n public setAutoplay(): void { }\n\n public preload(): void { }\n\n public load(): void { }\n\n public setPlaybackRate(): void { }\n \n public static canPlayType(): string {\n return '';\n }\n\n public static canPlaySource(sourceObject: videojs.Tech.SourceObject, techOptions?: { instanceId: string }): boolean {\n // Cast devices are only ever handed progressive files. Rejecting dash here makes\n // tech-first source selection pick the progressive source for this tech while a\n // session is active, and there is no error event from the device to fall back on\n if (sourceObject.type === DASH_MIME_TYPE)\n return false;\n\n return !!DevicesSessionManager\n .getOrCreateInstance(techOptions?.instanceId ?? '')\n .getCastSession();\n }\n\n public static isSupported(): boolean {\n return DevicesSessionManager.isActive();\n }\n}\n\nvideojs.registerTech('devices', DevicesTech);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { EntityType, EventVersion, PlaybackDescriptor, UserAction, WorkflowPhase } from 'libs/analytics/interfaces';\n\nimport { DevicesConfig } from 'projects/player/interfaces/DevicesConfig';\nimport { AnalyticsService } from 'projects/player/services/analytics-service';\n\nimport { AppleTvClient } from './clients/apple-tv/apple-tv-client';\nimport { CastSession, Client, Device, DeviceType } from './clients/client-interfaces';\nimport { ViviClient } from './clients/vivi/vivi-client';\nimport { DeviceMenuItem } from './components/device-menu-item/device-menu-item';\nimport { DevicesButton, DevicesButtonOptions } from './components/devices-button/devices-button';\nimport { DevicesSessionManager } from './devices-session-manager';\n\nimport './devices-plugin.scss';\n\nimport './components/devices-button/devices-button';\nimport './tech/devices-tech';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface DevicesPluginOptions extends DevicesConfig {\n userId?: number;\n title: string;\n analyticsService?: AnalyticsService;\n}\n\nclass DevicesPlugin extends Plugin {\n private options: DevicesPluginOptions;\n private devicesButton?: DevicesButton;\n private instanceId: string;\n\n constructor(player: VideoJsPlayer, options: DevicesPluginOptions) {\n super(player, options);\n\n this.options = options;\n this.instanceId = this.player.options_.devices?.instanceId ?? '';\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.onReady = this.onReady.bind(this);\n this.onDevicesChanged = this.onDevicesChanged.bind(this);\n this.onCastSessionChanged = this.onCastSessionChanged.bind(this);\n this.onDevicesError = this.onDevicesError.bind(this);\n this.addViviClient = this.addViviClient.bind(this);\n this.addAppleTvClient = this.addAppleTvClient.bind(this);\n this.reloadTech = this.reloadTech.bind(this);\n this.getSessionManager = this.getSessionManager.bind(this);\n this.dispose = this.dispose.bind(this);\n }\n\n private initialize(): void {\n this.player.ready(this.onReady);\n }\n\n private onReady(): void {\n const collapserator = this.player.getChild('collapserator');\n const sessionManager = this.getSessionManager();\n\n if (!collapserator) return;\n if (!sessionManager) return;\n\n sessionManager.on('deviceschange', this.onDevicesChanged);\n sessionManager.on('castsessionchange', this.onCastSessionChanged);\n sessionManager.on('error', this.onDevicesError);\n\n const onDevicesButtonClick = () => {\n this.addViviClient(sessionManager);\n this.addAppleTvClient(sessionManager);\n };\n\n const onDeviceMenuItemClick = (item: DeviceMenuItem, device: Device) => {\n sessionManager.startCastSession({\n device,\n title: this.options.title\n });\n\n this.options.analyticsService?.logUserAction(device, {\n actionType: UserAction.Select,\n workflowPhase: WorkflowPhase.Complete,\n descriptor: PlaybackDescriptor.ChangeDevice,\n entity: EntityType.Device,\n eventVersion: EventVersion.V3\n });\n };\n\n // Determine which integrations are inactive for the CTA\n const ctaOptions = this.options.ctaOptions;\n const viviConfig = this.options.vivi;\n const appleTvConfig = this.options.appleTv;\n const inactiveIntegrations: DeviceType[] = [];\n\n if (!appleTvConfig.enabled)\n inactiveIntegrations.push(DeviceType.AppleTv);\n\n if (!viviConfig.enabled || !viviConfig.accountConnected)\n inactiveIntegrations.push(DeviceType.Vivi);\n\n const buttonOptions: DevicesButtonOptions = {\n onClick: onDevicesButtonClick,\n onDeviceMenuItemClick,\n ctaOptions: {\n ...ctaOptions,\n inactiveIntegrations\n }\n };\n\n this.devicesButton = collapserator.addChild('DevicesButton', buttonOptions) as DevicesButton;\n }\n\n private onDevicesChanged(devices: Device[]): void {\n this.devicesButton?.setDevices(devices);\n }\n\n private onCastSessionChanged(castSession: CastSession | undefined): void {\n this.devicesButton?.setCastSession(castSession);\n this.reloadTech();\n\n if (castSession) {\n // Hide some UI elements and prevent the controls from fading out when casting\n this.player.addClass('cv-device-casting');\n this.player.addClass(`cv-device-${castSession.getDevice().type}`);\n\n // Exit fullscreen when casting\n if (this.player.isFullscreen())\n this.player.exitFullscreen();\n } else {\n // Restore the UI elements\n this.player.removeClass('cv-device-casting');\n this.player.removeClass(`cv-device-${DeviceType.AppleTv}`);\n this.player.removeClass(`cv-device-${DeviceType.Vivi}`);\n }\n }\n\n private onDevicesError(err: Error): void {\n this.player.error(err.message);\n this.player.pause();\n }\n\n private addViviClient(sessionManager: DevicesSessionManager): void {\n if (!this.options.vivi.enabled) return;\n if (!this.options.vivi.accountConnected) return;\n if (!this.options.vivi.apiUrl) return;\n if (sessionManager.hasInstanceOfClient(ViviClient)) return;\n\n const viviClient = new ViviClient({\n url: this.options.vivi.apiUrl,\n fetchAccessToken: this.options.vivi.fetchAccessToken\n });\n\n sessionManager.addClient(viviClient as Client);\n }\n\n private addAppleTvClient(sessionManager: DevicesSessionManager): void {\n if (!this.options.appleTv.enabled) return;\n if (!this.options.trackingCode) return;\n if (!this.options.userId) return;\n if (sessionManager.hasInstanceOfClient(AppleTvClient)) return;\n\n const appleTvClient = new AppleTvClient({\n fetchAccessToken: this.options.appleTv.fetchAccessToken,\n trackingCode: this.options.trackingCode,\n userId: this.options.userId\n });\n\n sessionManager.addClient(appleTvClient as Client);\n }\n\n private reloadTech(): void {\n const player = this.player;\n const sources = player.currentSources();\n const volume = player.volume();\n const muted = player.muted();\n const time = player.currentTime();\n const paused = player.paused();\n \n // This will cause the techs to get re-evaluated in the provided `techOrder`\n player.src(sources);\n\n // Restore the state of the player when playback starts\n player.one('playing', () => {\n player.volume(volume);\n player.muted(muted);\n player.currentTime(time);\n \n if (paused)\n player.pause();\n else\n player.play();\n });\n }\n\n private getSessionManager(): DevicesSessionManager | undefined {\n if (this.instanceId)\n return DevicesSessionManager.getOrCreateInstance(this.instanceId);\n }\n\n public dispose(): void {\n const sessionManager = this.getSessionManager();\n\n if (!sessionManager) return;\n\n sessionManager.off('deviceschange', this.onDevicesChanged);\n sessionManager.off('castsessionchange', this.onCastSessionChanged);\n sessionManager.off('error', this.onDevicesError);\n\n DevicesSessionManager.disposeAndRemoveInstance(sessionManager);\n\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('devicesPlugin', DevicesPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n devicesPlugin(options: DevicesPluginOptions): void;\n }\n}\n","import React from 'react';\nimport videojs, { VideoJsPlayer } from 'video.js';\n\nimport { ResourceTile } from 'libs/shared/components/widgets/items/resource-widget-item/ResourceWidgetItem';\nimport { Resource } from 'libs/shared/interfaces';\n\nimport { Resource as PlayerResource } from 'projects/player/interfaces/models/PlaybackObject';\nimport { getReactComponent } from 'projects/player/react/react-component';\n\nimport './resource-menu-item.scss';\n\ninterface ResourceMenuItemProps {\n resource: PlayerResource;\n imageCdnUrl: string;\n label?: string;\n}\n\nfunction ReactResourceMenuItem(props: ResourceMenuItemProps): JSX.Element {\n return (\n <div className='cv-resource-item'>\n <ResourceTile\n data={props.resource as Resource}\n imageCdnUrl={props.imageCdnUrl}\n titlePosition='above'\n hideTypeBadge\n />\n </div>\n );\n}\n\nconst _ResourceMenuItem = getReactComponent<ResourceMenuItemProps>(\n (player: VideoJsPlayer, options: ResourceMenuItemProps) => <ReactResourceMenuItem {...options} />\n);\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\ninterface ResourceMenuItemOptions extends videojs.ComponentOptions, ResourceMenuItemProps {\n downloadResource: (resource: PlayerResource) => void;\n}\n\nexport class ResourceMenuItem extends MenuItem {\n public options_: ResourceMenuItemOptions;\n\n constructor(player: VideoJsPlayer, options: ResourceMenuItemOptions) {\n super(player, options);\n\n const menuItem = new _ResourceMenuItem(player, { resource: options.resource, imageCdnUrl: options.imageCdnUrl });\n this.addChild(menuItem);\n }\n\n public createEl(tagName?: string, properties: any = {}, attributes?: any): HTMLLIElement {\n return super.createEl(tagName, {\n ...properties,\n className: `${properties.className} cv-resource-menu-item`\n }, attributes);\n }\n\n public handleClick(event: videojs.EventTarget.Event): void {\n // Prevent menu from closing on click\n event.stopImmediatePropagation();\n\n this.options_.downloadResource(this.options_.resource);\n }\n}\n","import videojs from 'video.js';\n\nimport { LocationUtils } from 'libs/common/backbone/core';\n\nimport { CollapsibleHeadingMenuItem } from 'projects/player/components/cog-button/collapsible-heading-menu-item';\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\nimport { Resource as PlayerResource } from 'projects/player/interfaces/models/PlaybackObject';\nimport {\n ResourceMenuItem\n} from 'projects/player/plugins/resources-plugin/components/resource-menu-item/resource-menu-item';\n\nimport './resources-button.scss';\n\nconst MenuButton = videojs.getComponent('MenuButton');\n\ninterface ResourceButtonOptions extends videojs.MenuButtonOptions {\n resources: PlayerResource[];\n imageCdnUrl: string;\n onClickResource: (resource: PlayerResource) => void;\n}\n\nclass ResourcesButton extends MenuButton implements CollapsibleComponent {\n public options_: ResourceButtonOptions;\n public controlText_: string;\n\n private downloadIframe: HTMLIFrameElement;\n\n public buildWrapperCSSClass() {\n return `cv-menu-small cv-resources-button-wrapper ${super.buildWrapperCSSClass()}`;\n }\n\n public buildCSSClass(): string {\n return `cv-resources-button ${super.buildCSSClass()}`;\n }\n\n public update(): void {\n super.update();\n }\n\n public createItems(): videojs.MenuItem[] {\n const items: videojs.MenuItem[] = [];\n\n items.push(new CollapsibleHeadingMenuItem(this.player_, {\n label: 'Resources'\n }) as any);\n\n this.options_.resources.forEach(resource => {\n const menuItem = new ResourceMenuItem(this.player(), {\n resource,\n imageCdnUrl: this.options_.imageCdnUrl,\n downloadResource: (resource: PlayerResource) => this.downloadResource(resource),\n label: resource.name\n });\n\n items.push(menuItem as unknown as videojs.MenuItem);\n });\n\n return items;\n }\n\n private downloadResource(resource: PlayerResource): void {\n if (resource.type === 'link') {\n LocationUtils.PageLoad(resource.url, true);\n return;\n }\n\n this.getDownloadIframe().src = resource.url;\n }\n\n private getDownloadIframe(): HTMLIFrameElement {\n if (this.downloadIframe)\n return this.downloadIframe;\n\n this.downloadIframe = videojs.dom.createEl('iframe') as HTMLIFrameElement;\n this.downloadIframe.style.display = 'none';\n\n videojs.dom.appendContent(videojs.dom.$('body'), this.downloadIframe);\n\n return this.downloadIframe;\n }\n\n /**\n * CollapsibleComponent implementation below\n */\n public alwaysCollapsed: boolean = false;\n \n public isCollapsed: boolean = false;\n \n public isCollabsible: boolean = true;\n \n public getCollabsibleName(): string {\n return this.controlText_;\n }\n \n public getCollabsibleValue(): string {\n return '';\n }\n \n public showInCollabsibleMenu(): boolean {\n return true;\n }\n \n public showCollapsibleMenu(): void {\n super.handleClick(null);\n }\n}\n\nResourcesButton.prototype.controlText_ = 'Resources';\n\nvideojs.registerComponent('ResourcesButton', ResourcesButton);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { Resource } from 'projects/player/interfaces/models/PlaybackObject';\n\nimport 'projects/player/plugins/resources-plugin/components/resources-button/resources-button';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface ResourcesPluginOptions {\n resources: Resource[];\n imageCdnUrl: string;\n}\n\nclass ResourcesPlugin extends Plugin {\n private options: ResourcesPluginOptions;\n\n constructor(player: VideoJsPlayer, options: ResourcesPluginOptions) {\n super(player, options);\n\n this.options = options;\n\n player.ready(() => this.onReady());\n }\n\n private onReady(): void {\n if (!this.options.resources.length)\n return;\n\n const collapserator = this.player.getChild('collapserator');\n\n collapserator.addChild('ResourcesButton', {\n resources: this.options.resources,\n imageCdnUrl: this.options.imageCdnUrl\n });\n }\n}\n\nvideojs.registerPlugin('resourcesPlugin', ResourcesPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n resourcesPlugin(options: ResourcesPluginOptions): void;\n }\n}\n","import { LocationUtils } from 'libs/common/backbone/core';\nimport { Core } from 'libs/common/core';\n\nimport { SharedServices } from 'libs/shared/constants/SharedServices';\nimport { NavLockHelper } from 'libs/shared/hooks/useNavLock';\n\nconst INACTIVITY_TIMEOUT = 900000; // 15 minutes\n\n// OLD:VERSION:TESTING Uncomment below and comment above\n// search for 'OLD:VERSION:TESTING' to find the code that needs to be uncommented\n// const INACTIVITY_TIMEOUT = 3000; // 3 seconds\n\nclass StaticOldVersionService extends Core.Service {\n private timeout: number;\n private canReload: boolean = true;\n\n // @ts-ignore\n public get name(): string {\n return SharedServices.OldVersion;\n }\n\n public initialize(): void {\n this.onVisibilityChange = this.onVisibilityChange.bind(this);\n this.onInactivityTimeout = this.onInactivityTimeout.bind(this);\n }\n\n public handleOldVersion(): void {\n document.addEventListener('visibilitychange', this.onVisibilityChange);\n this.onVisibilityChange();\n }\n\n private onVisibilityChange(): void {\n if (!document.hidden) {\n window.clearTimeout(this.timeout);\n return;\n }\n\n this.setInactivityTimeout();\n }\n\n private setInactivityTimeout(): void {\n this.timeout = window.setTimeout(this.onInactivityTimeout, INACTIVITY_TIMEOUT);\n }\n\n private onInactivityTimeout(): void {\n /**\n * If we've locked the nav for whatever reason we wait another 15 minutes. For eg.\n * - Uploading a video\n * - Bulk actions in user manager\n * - Editing video details\n */\n if (NavLockHelper.isLocked()) {\n this.setInactivityTimeout();\n return;\n }\n\n this.onInactive();\n }\n\n private onInactive(): void {\n /**\n * There are 2 reasons why we can't reload the page:\n * \n * The nav is locked for things like\n * - Uploading a video\n * - Performing a bulk action in user manager\n * - Editing video details\n * \n * Something has opted out of the page reload, such as\n * - The player is currently in a playing state (OldVersionRefreshPlugin)\n */\n if (!this.canReload || NavLockHelper.isLocked()) {\n this.setInactivityTimeout();\n return;\n }\n\n LocationUtils.Reload();\n }\n\n public setCanReload(canReload: boolean): void {\n this.canReload = canReload;\n }\n}\nexport const OldVersionService = new StaticOldVersionService();\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { OldVersionService } from 'libs/shared/services/OldVersionService';\n\nconst Plugin = videojs.getPlugin('plugin');\n\nclass OldVersionRefreshPlugin extends Plugin {\n constructor(player: VideoJsPlayer) {\n super(player);\n this.player.dataLoaded(() => this.initialize());\n }\n\n private initialize(): void {\n OldVersionService.setCanReload(false);\n }\n\n public dispose(): void {\n OldVersionService.setCanReload(true);\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('oldVersionRefreshPlugin', OldVersionRefreshPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n oldVersionRefreshPlugin(): OldVersionRefreshPlugin;\n }\n}\n\n","import React from 'react';\n\nimport { Player, PlayerOptions } from 'projects/player/players/player';\nimport { getProxy } from 'projects/player/utils/getProxy';\n\n/**\n * React plugins are exported on the react player in order to allow\n * our dist files to not require react - Sha\n */\nimport 'projects/player/plugins/devices-plugin/devices-plugin';\nimport 'projects/player/plugins/next-video-plugin/next-video-plugin';\nimport 'projects/player/plugins/resources-plugin/resources-plugin';\nimport 'projects/player/plugins/transcript-plugin/transcript-plugin';\nimport 'projects/player/plugins/old-version-refresh-plugin/old-version-refresh-plugin';\n\nexport interface ClickViewPlayerProps extends Omit<PlayerOptions, 'playerApi'> {\n // TODO Remove optional from playerApi\n playerApi?: URL;\n className?: string;\n onReady?: (player: Player) => void;\n onError?: (error: any) => void;\n onDispose?: () => void;\n}\n\nexport function ClickViewPlayer(props: ClickViewPlayerProps): React.ReactElement {\n const { className = '', playerApi, onReady, onDispose, ...playerOptions } = props;\n \n const containerRef = React.useRef(null);\n\n React.useEffect(() => {\n if (!containerRef)\n return;\n\n const player = new Player(containerRef.current, {\n ...playerOptions,\n playerApi: playerApi\n });\n\n if (onReady) {\n player.ready(() => {\n onReady(getProxy(player));\n });\n }\n\n if (onDispose) {\n player.one('dispose', onDispose);\n }\n \n return () => {\n player?.dispose();\n };\n }, [props.viewKey]);\n\n return (\n <div ref={containerRef} className={className}></div>\n );\n}\n\nexport default ClickViewPlayer;\n"],"x_google_ignoreList":[14,15,16,17,18,19,20],"mappings":"ueCIM,GAAS,EAAQ,aAAa,QAAQ,EAItC,EAAN,cAA+B,EAAuC,oDAUlC,oBAEJ,sBAEE,GAXhC,eAA+B,CAC7B,MAAO,uBACT,CAWA,oBAAoC,CAClC,OAAO,KAAK,YACd,CAEA,qBAAqC,CACnC,MAAO,EACT,CAEA,uBAAwC,CACtC,MAAO,EACT,CAEA,qBAAmC,CACjC,MAAM,YAAY,IAAI,CACxB,CACF,EAEA,EAAiB,UAAU,aAAe,cAE1C,EAAQ,kBAAkB,mBAAoB,CAAgB,ECvC9D,IAAM,GAAS,EAAQ,UAAU,QAAQ,EAMnC,GAAN,cAAqC,EAAO,CAG1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AS,EAAG,CAC/C,KAAK,qBAAqB,EAC1B,MACF,CAEA,EAAc,OAAO,CACvB,CAEA,aAAoB,EAA0B,CAC5C,KAAK,UAAY,CACnB,CACF,EC9EM,GAAS,EAAQ,UAAU,QAAQ,EAEnC,GAAN,cAAsC,EAAO,CAC3C,YAAY,EAAuB,CACjC,MAAM,CAAM,EACZ,KAAK,OAAO,eAAiB,KAAK,WAAW,CAAC,CAChD,CAEA,YAA2B,CACzB,EAAkB,aAAa,EAAK,CACtC,CAEA,SAAuB,CACrB,EAAkB,aAAa,EAAI,EACnC,MAAM,QAAQ,CAChB,CACF,EAEA,EAAQ,eAAe,0BAA2B,EAAuB,ECEzE,SAAgB,GAAgB,EAAiD,CAC/E,GAAM,CAAE,YAAY,GAAI,YAAW,UAAS,YAAW,GAAG,GAAkB,EAEtE,EAAA,EAAqB,OAAO,IAAI,EA0BtC,OAxBA,EAAM,cAAgB,CACpB,GAAI,CAAC,EACH,OAEF,IAAM,EAAS,IAAI,GAAO,EAAa,QAAS,CAC9C,GAAG,EACQ,WACb,CAAC,EAYD,OAVI,GACF,EAAO,UAAY,CACjB,EAAQ,GAAS,CAAM,CAAC,CAC1B,CAAC,EAGC,GACF,EAAO,IAAI,UAAW,CAAS,MAGpB,CACX,GAAQ,QAAQ,CAClB,CACF,EAAG,CAAC,EAAM,OAAO,CAAC,GAGhB,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAyB,WAAgB,CAAA,CAEvD"}
1
+ {"version":3,"file":"eKSK4iyn.chunk.js","names":[],"sources":["../../../../../../player/src/plugins/create-clip-button-plugin/components/create-clip-button.scss","../../../../../../player/src/plugins/create-clip-button-plugin/components/create-clip-button.ts","../../../../../../player/src/plugins/create-clip-button-plugin/create-clip-button-plugin.ts","../../../../../../player/src/plugins/picture-in-picture-plugin/components/picture-in-picture-toggle.ts","../../../../../../player/src/plugins/picture-in-picture-plugin/picture-in-picture-plugin.ts","../../../../../../player/src/plugins/points-of-interest-plugin/components/point-of-interest-indicator/point-of-interest-indicator.ts","../../../../../../player/src/plugins/points-of-interest-plugin/components/points-of-interest-menu-item/points-of-interest-menu-item.ts","../../../../../../player/src/plugins/points-of-interest-plugin/points-of-interest-plugin.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/range-indicator/range-indicator.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/replay-view-button/replay-view-button.ts","../../../../../../player/src/plugins/range-indicator-plugin/components/replay-view/replay-view.ts","../../../../../../player/src/plugins/range-indicator-plugin/range-indicator-plugin.ts","../../../../../../player/src/utils/id-helper.ts","../../../../../../player/src/players/player.ts","../../../../../../../../node_modules/jquery-deferred/lib/jquery-core.js","../../../../../../../../node_modules/jquery-deferred/lib/jquery-callbacks.js","../../../../../../../../node_modules/jquery-deferred/lib/jquery-deferred.js","../../../../../../../../node_modules/jquery-deferred/index.js","../../../../../../../../node_modules/jquery-param/jquery-param.js","../../../../../../../../node_modules/signalr-no-jquery/build/jQueryShim.js","../../../../../../../../node_modules/signalr-no-jquery/build/signalR.js","../../../../../../player/src/plugins/devices-plugin/clients/client-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/utils/promise-with-timeout.ts","../../../../../../player/src/plugins/devices-plugin/utils/event-bus.ts","../../../../../../player/src/plugins/devices-plugin/utils/scheduler.ts","../../../../../../player/src/plugins/devices-plugin/utils/proxy-helper.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-cast-session-state.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-cast-session.ts","../../../../../../player/src/plugins/devices-plugin/clients/apple-tv/apple-tv-client.ts","../../../../../../player/src/plugins/devices-plugin/utils/resilient-web-socket.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-cast-session-state.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-interfaces.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-cast-session.ts","../../../../../../player/src/plugins/devices-plugin/clients/vivi/vivi-client.ts","../../../../../../player/src/plugins/devices-plugin/devices-session-manager.ts","../../../../../../player/src/plugins/devices-plugin/components/device-menu-item/device-menu-item.ts","../../../../../../player/src/plugins/devices-plugin/components/devices-menu/devices-menu.ts","../../../../../../player/src/plugins/devices-plugin/components/devices-cta/devices-cta.tsx","../../../../../../player/src/plugins/devices-plugin/components/devices-button/devices-button.ts","../../../../../../player/src/plugins/devices-plugin/tech/devices-tech-ui/devices-tech-ui.ts","../../../../../../player/src/plugins/devices-plugin/tech/devices-tech.ts","../../../../../../player/src/plugins/devices-plugin/devices-plugin.ts","../../../../../../player/src/plugins/resources-plugin/components/resource-menu-item/resource-menu-item.tsx","../../../../../../player/src/plugins/resources-plugin/components/resources-button/resources-button.ts","../../../../../../player/src/plugins/resources-plugin/resources-plugin.ts","../../../../../../../libs/shared/src/services/OldVersionService.ts","../../../../../../player/src/plugins/old-version-refresh-plugin/old-version-refresh-plugin.ts","../../../../../../player/src/react/Player.tsx"],"sourcesContent":[".video-js {\n .cv-create-clip-button {\n width: 4em;\n padding: 0;\n\n .vjs-icon-placeholder::before {\n font-family: CVPlayer;\n /* Defined in font/icon-map.js */\n content: unquote(\"\\\"\\\\f10e\\\"\");\n }\n }\n}\n","import videojs from 'video.js';\n\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\n\nconst Button = videojs.getComponent('Button');\n\nimport './create-clip-button.scss';\n\nclass CreateClipButton extends Button implements CollapsibleComponent {\n public controlText_: string;\n\n public buildCSSClass(): string {\n return 'cv-create-clip-button';\n }\n\n /**\n * CollapsibleComponent interface implementation below\n */\n public alwaysCollapsed: boolean = false;\n\n public isCollapsed: boolean = false;\n\n public isCollabsible: boolean = true;\n\n public getCollabsibleName(): string {\n return this.controlText_;\n }\n \n public getCollabsibleValue(): string {\n return '';\n }\n \n public showInCollabsibleMenu(): boolean {\n return true;\n }\n \n public showCollapsibleMenu(): void {\n super.handleClick(null);\n }\n}\n\nCreateClipButton.prototype.controlText_ = 'Create clip';\n\nvideojs.registerComponent('CreateClipButton', CreateClipButton);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport 'projects/player/plugins/create-clip-button-plugin/components/create-clip-button';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface CreateClipButtonPluginOptions {\n onClick: () => void;\n}\n\nclass CreateClipButtonPlugin extends Plugin {\n private options: CreateClipButtonPluginOptions;\n\n constructor(player: VideoJsPlayer, options: CreateClipButtonPluginOptions) {\n super(player, options);\n\n this.options = options;\n\n player.ready(() => this.onReady());\n }\n\n private onReady(): void {\n const collapserator = this.player.getChild('collapserator');\n\n if (!collapserator)\n return;\n\n collapserator.addChild('CreateClipButton', {\n clickHandler: this.options.onClick\n });\n }\n}\n\nvideojs.registerPlugin('createClipButtonPlugin', CreateClipButtonPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n createClipButtonPlugin(options: CreateClipButtonPluginOptions): void;\n }\n}\n","import videojs from 'video.js';\n\nconst BasePictureInPictureToggle = videojs.getComponent('PictureInPictureToggle');\n\nclass PictureInPictureToggle extends BasePictureInPictureToggle {\n handlePictureInPictureEnabledChange() {\n (this as any).enable();\n }\n}\n\nvideojs.registerComponent('PictureInPictureToggle', PictureInPictureToggle);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './picture-in-picture.scss';\n\nimport './components/picture-in-picture-toggle';\n\nconst PlayToggle = videojs.getComponent('PlayToggle');\n\nconst Plugin = videojs.getPlugin('plugin');\n\nconst MIN_WIDTH = 800;\n\ninterface PictureInPicturePluginOptions {\n onRequestPictureInPicture: (isPiP: boolean) => void;\n}\n\nclass PictureInPicturePlugin extends Plugin {\n private options: PictureInPicturePluginOptions;\n private playerRequestPictureInPictureFn: () => Promise<videojs.PictureInPictureWindow>;\n private playerExitPictureInPictureFn: () => Promise<void>;\n private playToggle: videojs.Component;\n private toggle: videojs.Button;\n\n constructor(player: VideoJsPlayer, options: PictureInPicturePluginOptions) {\n super(player, options);\n\n this.options = options;\n\n this.bindFunctions();\n player.ready(() => this.initialize());\n }\n\n private bindFunctions(): void {\n this.requestPictureInPicture = this.requestPictureInPicture.bind(this);\n this.exitPictureInPicture = this.exitPictureInPicture.bind(this);\n this.onPlayerResize = this.onPlayerResize.bind(this);\n \n this.playerRequestPictureInPictureFn = this.player.requestPictureInPicture;\n this.playerExitPictureInPictureFn = this.player.exitPictureInPicture;\n \n this.player.requestPictureInPicture = this.requestPictureInPicture;\n this.player.exitPictureInPicture = this.exitPictureInPicture;\n }\n\n public initialize(): void {\n const toggleParent = this.player.getChild('collapserator');\n\n this.toggle = toggleParent.addChild('pictureInPictureToggle', {}) as videojs.Button;\n\n /**\n * By default the toggle is initialised in a disabled state.\n */\n this.toggle.enable();\n\n this.player.on('playerresize', this.onPlayerResize);\n\n this.player.on('dispose', () => {\n this.player?.off('playerresize', this.onPlayerResize);\n });\n }\n\n public togglePictureInPicture(isInPictureInPicture: boolean): void {\n if (isInPictureInPicture === this.player.isInPictureInPicture())\n return;\n\n const event = isInPictureInPicture ?\n 'enterpictureinpicture' :\n 'leavepictureinpicture';\n\n this.player.isInPictureInPicture(isInPictureInPicture);\n this.player.trigger(event);\n\n isInPictureInPicture ? this.addPipStyles() : this.removePipStyles();\n }\n\n private onPlayerResize(): void {\n /**\n * Don't enable/disable PiP while in PiP.\n */\n if (this.player.isInPictureInPicture())\n return;\n\n const playerRect = this.player.el().getBoundingClientRect();\n\n /**\n * In case our update function runs before our\n * player has properly rendered within the DOM\n */\n if (playerRect.width === 0)\n return;\n\n if (playerRect.width < MIN_WIDTH)\n this.toggle?.hide();\n else\n this.toggle?.show();\n }\n\n private addPipStyles(): void {\n this.player.addClass('cv-picture-in-picture');\n this.playToggle = new PlayToggle(this.player);\n this.playToggle.addClass('cv-pip-play-toggle');\n this.player.addChild(this.playToggle);\n\n if (this.player.paused())\n (this.playToggle as any).handlePause();\n else\n (this.playToggle as any).handlePlay();\n }\n\n private removePipStyles(): void {\n this.player.removeClass('cv-picture-in-picture');\n this.player.removeChild(this.playToggle);\n delete this.playToggle;\n }\n \n private requestPictureInPicture(): Promise<videojs.PictureInPictureWindow> {\n this.togglePictureInPicture(true);\n\n if (typeof this.options?.onRequestPictureInPicture === 'function')\n this.options.onRequestPictureInPicture(true);\n\n return;\n }\n\n private async exitPictureInPicture(): Promise<void> {\n this.togglePictureInPicture(false);\n this.options.onRequestPictureInPicture(false);\n this.removePipStyles();\n }\n\n public dispose(): void {\n this.player.requestPictureInPicture = this.playerRequestPictureInPictureFn;\n this.player.exitPictureInPicture = this.playerExitPictureInPictureFn;\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('pictureInPicture', PictureInPicturePlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n pictureInPicture(options?: PictureInPicturePluginOptions): PictureInPicturePlugin;\n isInPictureInPicture(isPiP?: boolean): boolean | void;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { EventsService, StaticEventsService } from 'libs/common/react/services/EventsService';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\n\nimport { MouseTimeDisplay } from 'projects/player/components/mouse-time-display/mouse-time-display';\nimport { TimeTooltip } from 'projects/player/components/time-tooltip/time-tooltip';\n\nimport './point-of-interest-indicator.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface PointOfInterestIndicatorOptions extends videojs.ComponentOptions {\n pointOfInterest: PointOfInterest;\n}\n\nexport class PointOfInterestIndicator extends Component {\n private el_: HTMLElement;\n public options_: PointOfInterestIndicatorOptions;\n\n private eventsService: StaticEventsService;\n\n private pointOfInterest: PointOfInterest;\n private hasBuffered: boolean = false;\n private hasPlayed: boolean = false;\n\n constructor(player: VideoJsPlayer, options: PointOfInterestIndicatorOptions) {\n super(player, options);\n\n this.eventsService = EventsService;\n\n this.pointOfInterest = options.pointOfInterest;\n\n this.onMouseOver = this.onMouseOver.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n this.onGlancePointOfInterestMouseEnter = this.onGlancePointOfInterestMouseEnter.bind(this);\n this.onGlancePointOfInterestMouseLeave = this.onGlancePointOfInterestMouseLeave.bind(this);\n\n this.initialize();\n }\n\n public initialize(): void {\n this.setPosition();\n this.bindListeners();\n }\n\n public buildCSSClass(): string {\n return `cv-point-of-interest-indicator ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n return super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n }\n\n private bindListeners(): void {\n this.on('mouseover', this.onMouseOver);\n this.on('mouseleave', this.onMouseLeave);\n\n this.eventsService.subscribe('glance:poi:mouseover', this.onGlancePointOfInterestMouseEnter);\n this.eventsService.subscribe('glance:poi:mouseleave', this.onGlancePointOfInterestMouseLeave);\n }\n\n public dispose(): void {\n this.eventsService.unsubscribe('glance:poi:mouseover', this.onGlancePointOfInterestMouseEnter);\n this.eventsService.unsubscribe('glance:poi:mouseleave', this.onGlancePointOfInterestMouseLeave);\n }\n\n private getPointOfInterestTime(): number {\n return this.pointOfInterest.startTime;\n }\n\n private setPosition(): void {\n const duration = this.player().duration();\n this.el_.style.left = (this.getPointOfInterestTime() / duration * 100) + '%';\n }\n\n public updateBuffered(bufferEnd: number): void {\n const hasBuffered = this.getPointOfInterestTime() <= bufferEnd;\n\n if (hasBuffered === this.hasBuffered)\n return;\n\n this.hasBuffered = hasBuffered;\n\n const bufferedClassName = 'cv-point-of-interest-indicator-buffered';\n\n if (this.hasBuffered)\n this.addClass(bufferedClassName);\n else\n this.removeClass(bufferedClassName);\n }\n\n public updatePlaybackProgress(currentTime: number): void {\n const hasPlayed = this.getPointOfInterestTime() <= currentTime;\n\n if (hasPlayed === this.hasPlayed)\n return;\n\n this.hasPlayed = hasPlayed;\n\n const className = 'cv-point-of-interest-indicator-played';\n\n if (hasPlayed)\n this.addClass(className);\n else\n this.removeClass(className);\n }\n\n public toggleVisibility(visible: boolean): void {\n const visibilityClassName = 'cv-point-of-interest-indicator-hidden';\n\n if (visible)\n this.removeClass(visibilityClassName);\n else\n this.addClass(visibilityClassName);\n }\n\n /**\n * We want the POI description to be displayed in the TimeTooltip when the user\n * hovers over a POI.\n * Because we don't know the exact time range on the seekbar covered by a POI indicator,\n * TimeTooltip can't use the current time to determine the active POI cue the same way\n * that it does for chapters. So instead we use the mouse events on this component and\n * set it manually.\n */\n private onMouseOver(): void {\n this.setTimeTooltipText();\n this.eventsService.trigger('player:poi:mouseover', this.pointOfInterest);\n }\n\n private onMouseLeave(): void {\n this.clearTimeTooltipText();\n this.eventsService.trigger('player:poi:mouseleave');\n }\n\n private onGlancePointOfInterestMouseEnter(pointOfInterest: PointOfInterest): void {\n if (pointOfInterest.id !== this.pointOfInterest.id)\n return;\n\n this.addClass('cv-point-of-interest-indicator-highlight');\n this.setTimeTooltipTime();\n this.setTimeTooltipText();\n this.positionMouseTimeDisplay();\n this.showMouseTimeDisplay();\n }\n\n private onGlancePointOfInterestMouseLeave(): void {\n this.removeClass('cv-point-of-interest-indicator-highlight');\n this.hideMouseTimeDisplay();\n }\n\n private setTimeTooltipText(): void {\n this.getTimeTooltip()?.setCustomChapterText(this.pointOfInterest.description);\n }\n\n private clearTimeTooltipText(): void {\n this.getTimeTooltip()?.setCustomChapterText();\n }\n\n /**\n * We only need to call this when we're manually forcing the MouseTimeDisplay\n * to show. If it's being triggered natively using pointer events then the time\n * will be set automatically.\n */\n private setTimeTooltipTime(): void {\n const timeTooltip = this.getTimeTooltip();\n timeTooltip?.updateTime(this.getPointOfInterestTime());\n }\n\n private positionMouseTimeDisplay(): void {\n const seekBarEl = this.getSeekBar()?.el();\n\n if (!seekBarEl)\n return;\n\n const seekBarRect = videojs.dom.findPosition(seekBarEl) as ClientRect;\n const point = this.getPointOfInterestTime() / this.player().duration();\n\n this.getMouseTimeDisplay()?.update(seekBarRect, point);\n }\n\n private showMouseTimeDisplay(): void {\n this.getMouseTimeDisplay()?.forceShow();\n }\n\n private hideMouseTimeDisplay(): void {\n this.getMouseTimeDisplay()?.removeForceShow();\n }\n\n private getSeekBar(): videojs.SeekBar {\n return this.player().controlBar\n .getChild('ProgressControl')\n ?.getChild('SeekBar') as videojs.SeekBar;\n }\n\n private getMouseTimeDisplay(): MouseTimeDisplay {\n return this.getSeekBar()\n ?.getChild('MouseTimeDisplay') as MouseTimeDisplay;\n }\n\n private getTimeTooltip(): TimeTooltip {\n return this.getMouseTimeDisplay()\n ?.getChild('TimeTooltip') as TimeTooltip;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './points-of-interest-menu-item.scss';\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\ninterface PointsOfInterestMenuItemOptions extends videojs.MenuItemOptions {\n pointsOfInterestVisible: boolean;\n}\n\nexport class PointsOfInterestMenuItem extends MenuItem {\n private toggleEl: Element;\n private pointsOfInterestVisible: boolean;\n\n /**\n * Because we want to bind our listener in createEl\n * and createEl runs in super. We store if we've bounud\n * our handler, so we only call bind once and \n * the call to removeEventListener will still work\n */\n private handlerBound: boolean;\n\n constructor(player: VideoJsPlayer, options: PointsOfInterestMenuItemOptions) {\n super(player, options);\n\n this.pointsOfInterestVisible = options.pointsOfInterestVisible;\n this.toggle(this.pointsOfInterestVisible);\n }\n\n public handleToggle(): void {\n this.toggle(!this.pointsOfInterestVisible);\n }\n\n private toggle(state: boolean): void {\n state ? this.toggleOn() : this.toggleOff();\n }\n\n private toggleOn(): void {\n videojs.dom.addClass(this.toggleEl, 'on');\n videojs.dom.setAttribute(this.toggleEl, 'aria-checked', 'true');\n this.pointsOfInterestVisible = true;\n this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible);\n }\n\n private toggleOff(): void {\n videojs.dom.removeClass(this.toggleEl, 'on');\n videojs.dom.setAttribute(this.toggleEl, 'aria-checked', 'false');\n this.pointsOfInterestVisible = false;\n this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible);\n }\n\n /**\n * Because we extend MenuItem which will close the menu by default\n * we need to halt the event propogation here\n */\n public handleClick(event: videojs.EventTarget.Event): void {\n event.stopImmediatePropagation();\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): HTMLLIElement {\n /**\n * Bind our event listener only once\n * see the comment where handlerBound is defined\n */\n if (!this.handlerBound) {\n this.handleToggle = this.handleToggle.bind(this);\n this.handlerBound = true;\n }\n\n if (this.toggleEl)\n this.toggleEl.removeEventListener('click', this.handleToggle);\n\n this.toggleEl = videojs.dom.createEl('div', {\n className: `custom-toggle custom-toggle-info toggle-option float-end`,\n innerHTML: '<span class=\"handle\"></span></div>'\n });\n videojs.dom.setAttribute(this.toggleEl, 'id', 'poi-toggle');\n videojs.dom.setAttribute(this.toggleEl, 'role', 'switch');\n this.toggleEl.addEventListener('click', this.handleToggle);\n\n const innerHTML = `\n <span for=\"poi-toggle\" class=\"vjs-menu-item-text\">Points of Interest</span>\n <span class=\"cv-toggle-container\"></span>`;\n\n const el = super.createEl(tagName, {\n className: 'vjs-menu-item cv-cog-menu-item cv-poi-toggle',\n innerHTML\n }, attributes);\n\n /**\n * Indexing into the child this way is only safe to do because\n * we know that the el only has two children\n */\n el.children[1].appendChild(this.toggleEl);\n\n return el;\n }\n}\n\nvideojs.registerComponent('PointsOfInterestMenuItem', PointsOfInterestMenuItem);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\n\nimport { CogButton } from 'projects/player/components/cog-button/cog-button';\nimport { getBufferedEnd } from 'projects/player/utils/getBufferedEnd';\nimport { LocalStorageHelper } from 'projects/player/utils/local-storage-helper';\n\nimport { PointOfInterestIndicator } from './components/point-of-interest-indicator/point-of-interest-indicator';\nimport { PointsOfInterestMenuItem } from './components/points-of-interest-menu-item/points-of-interest-menu-item';\n\nconst Plugin = videojs.getPlugin('plugin');\n\nconst POINTS_OF_INTEREST = 'cvplayer-points-of-interest';\n\ninterface PointsOfInterestPluginOptions {\n pointsOfInterest: PointOfInterest[];\n}\n\nexport class PointsOfInterestPlugin extends Plugin {\n private pointOfInterestIndicators: PointOfInterestIndicator[] = [];\n private pointsOfInterest?: PointOfInterest[];\n private enabled: boolean = true;\n\n constructor(player: VideoJsPlayer, options?: PointsOfInterestPluginOptions) {\n super(player);\n\n this.pointsOfInterest = options?.pointsOfInterest;\n \n this.initialize = this.initialize.bind(this);\n this.updateBuffered = this.updateBuffered.bind(this);\n this.updatePlaybackProgress = this.updatePlaybackProgress.bind(this);\n\n this.player.one('loadedmetadata', () => this.player.ready(this.initialize));\n }\n\n private initialize(): void {\n if (!this.pointsOfInterest)\n return;\n\n if (LocalStorageHelper.hasLocalStorage() && LocalStorageHelper.get(POINTS_OF_INTEREST) === 'false')\n this.enabled = false;\n\n this.setupTrack();\n this.createPointOfInterestIndicators();\n this.addMenuItem();\n this.bindListeners();\n }\n\n private bindListeners(): void {\n this.player.on('progress', this.updateBuffered);\n this.player.on('timeupdate', this.updatePlaybackProgress);\n\n this.player.on('dispose', () => {\n this.player?.off('progress', this.updateBuffered);\n this.player?.off('timeupdate', this.updatePlaybackProgress);\n });\n }\n\n public togglePointsOfInterest(visible: boolean): void {\n LocalStorageHelper.set(POINTS_OF_INTEREST, visible.toString());\n this.pointOfInterestIndicators.forEach(p => p.toggleVisibility(visible));\n }\n\n private setupTrack(): void {\n const track = this.player.addTextTrack('metadata', 'pointsofinterest') as any;\n\n this.pointsOfInterest.forEach(p => {\n track.addCue({\n startTime: p.startTime,\n endTime: p.endTime,\n text: p.description\n });\n });\n\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n }\n\n private createPointOfInterestIndicators(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n \n this.pointsOfInterest.forEach(pointOfInterest => {\n const component = new PointOfInterestIndicator(this.player, { pointOfInterest });\n this.pointOfInterestIndicators.push(component);\n seekBar.addChild(component);\n });\n }\n\n private addMenuItem(): void {\n /**\n * Check additionalItemOrder in cog-button.ts if you need to change the order. - Sha\n */\n const cogButton = this.player.getChild('collapserator')?.getChild('cogButton') as CogButton;\n cogButton.addItem({\n ctor: PointsOfInterestMenuItem,\n name: 'PointsOfInterestMenuItem',\n options: { pointsOfInterestVisible: this.enabled }\n });\n }\n\n private updateBuffered(): void {\n this.pointOfInterestIndicators.forEach(p => p.updateBuffered(getBufferedEnd(this.player)));\n }\n\n private updatePlaybackProgress(): void {\n this.pointOfInterestIndicators.forEach(p => p.updatePlaybackProgress(this.player.currentTime()));\n }\n}\n\nvideojs.registerPlugin('pointsOfInterestPlugin', PointsOfInterestPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n pointsOfInterestPlugin(options?: PointsOfInterestPluginOptions): PointsOfInterestPlugin;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './range-indicator.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface RangeIndicatorOptions extends videojs.ComponentOptions {\n time: number;\n}\n\nexport class RangeIndicator extends Component {\n private el_: HTMLElement;\n public options_: RangeIndicatorOptions;\n\n constructor(player: VideoJsPlayer, options: RangeIndicatorOptions) {\n super(player, options);\n\n this.initialize();\n }\n\n public initialize(): void {\n this.setPosition();\n }\n\n public buildCSSClass(): string {\n return `cv-range-indicator ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n return super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n }\n\n private setPosition(): void {\n const duration = this.player().duration();\n this.el_.style.left = (this.options_.time / duration * 100) + '%';\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport './replay-view-button.scss';\n\nconst ClickableComponent = videojs.getComponent('ClickableComponent');\n\ninterface ReplayViewButtonOptions extends videojs.ComponentOptions {\n onPress: () => void;\n label: string;\n iconClassName: 'cv-replay-icon' | 'cv-continue-icon';\n}\n\nexport class ReplayViewButton extends ClickableComponent {\n public options_: ReplayViewButtonOptions;\n\n constructor(player: VideoJsPlayer, options: ReplayViewButtonOptions) {\n super(player, options);\n }\n\n public buildCSSClass(): string {\n return `cv-replay-view-button ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n const el = super.createEl(tagName, {\n ...properties,\n innerHTML: `<span class=\"${this.options_.iconClassName}\"></span><span>${this.options_.label}</span>`,\n className: this.buildCSSClass()\n }, attributes);\n\n return el;\n }\n\n public handleClick() {\n this.options_.onPress();\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { ReplayViewButton } from 'projects/player/plugins/range-indicator-plugin/components/replay-view-button/replay-view-button';\n\nimport './replay-view.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface ReplayViewOptions extends videojs.ComponentOptions {\n onContinuePress: () => void;\n onReplayPress: () => void;\n}\n\nexport class ReplayView extends Component {\n public options_: ReplayViewOptions;\n\n constructor(player: VideoJsPlayer, options: ReplayViewOptions) {\n super(player, options);\n }\n\n public buildCSSClass(): string {\n return `cv-replay-view ${super.buildCSSClass()}`;\n }\n\n public createEl(tagName?: string, properties?: any, attributes?: any): Element {\n const el = super.createEl(tagName, {\n ...properties,\n className: this.buildCSSClass()\n }, attributes);\n\n const heading = videojs.dom.createEl('h5', {\n innerHTML: this.localize('This clip has finished'),\n className: 'cv-replay-heading'\n });\n\n const buttonContainer = videojs.dom.createEl('div', {\n className: 'cv-button-container'\n });\n\n const replayButton = new ReplayViewButton(this.player_, {\n label: this.localize('Replay clip'),\n iconClassName: 'cv-replay-icon',\n onPress: this.options_.onReplayPress\n });\n\n const continueButton = new ReplayViewButton(this.player_, {\n label: this.localize('Continue watching'),\n iconClassName: 'cv-continue-icon',\n onPress: this.options_.onContinuePress\n });\n\n el.appendChild(heading);\n el.appendChild(buttonContainer);\n \n buttonContainer.appendChild(replayButton.el());\n buttonContainer.appendChild(continueButton.el());\n \n return el;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { RangeIndicator } from './components/range-indicator/range-indicator';\nimport { ReplayView } from './components/replay-view/replay-view';\n\nimport './range-indicator-plugin.scss';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface RangeIndicatorPluginOptions {\n startTime: number;\n endTime: number;\n}\n\nclass RangeIndicatorPlugin extends Plugin {\n private startTime: number;\n private endTime: number;\n private dismissed: boolean;\n private startTimeIndicator?: RangeIndicator;\n private endTimeIndicator?: RangeIndicator;\n private replayView?: ReplayView;\n\n constructor(player: VideoJsPlayer, options: RangeIndicatorPluginOptions) {\n super(player, options);\n\n this.startTime = parseFloat(options.startTime.toPrecision(4));\n this.endTime = parseFloat(options.endTime.toPrecision(4));\n this.dismissed = false;\n \n if (this.startTime > this.endTime)\n throw Error('Range start cannot be greater than range end');\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.onReady = this.onReady.bind(this);\n this.onTimeUpdateOrSeeked = this.onTimeUpdateOrSeeked.bind(this);\n this.onReplayPress = this.onReplayPress.bind(this);\n this.onContinuePress = this.onContinuePress.bind(this);\n }\n\n private initialize(): void {\n this.player.one('loadedmetadata', () => this.player.ready(this.onReady));\n this.player.on('timeupdate', this.onTimeUpdateOrSeeked);\n this.player.on('seeked', this.onTimeUpdateOrSeeked);\n }\n\n private onReady(): void {\n this.addCssClasses();\n this.showRangeIndicators();\n this.addMaskToProgressBar();\n }\n\n private onTimeUpdateOrSeeked(): void {\n if (this.dismissed) return;\n\n const currentTime = this.player.currentTime();\n\n if (currentTime < this.startTime) {\n this.player.currentTime(this.startTime);\n\n return;\n }\n\n if (currentTime > this.endTime) {\n this.showReplayView();\n this.disablePlayToggle();\n this.player.pause();\n this.player.currentTime(this.endTime);\n\n return;\n }\n }\n\n private onReplayPress(): void {\n this.player.currentTime(this.startTime);\n this.player.play();\n this.hideReplayView();\n this.enablePlayToggle();\n }\n\n private onContinuePress(): void {\n this.dismissed = true;\n this.player.play();\n this.hideRangeIndicators();\n this.removeMaskFromProgressBar();\n this.hideReplayView();\n this.enablePlayToggle();\n this.removeCssClasses();\n }\n\n private showRangeIndicators(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n\n if (!this.startTimeIndicator) {\n this.startTimeIndicator = new RangeIndicator(this.player, { time: this.startTime });\n seekBar?.addChild(this.startTimeIndicator);\n }\n\n if (!this.endTimeIndicator) {\n this.endTimeIndicator = new RangeIndicator(this.player, { time: this.endTime });\n seekBar?.addChild(this.endTimeIndicator);\n }\n }\n\n private hideRangeIndicators(): void {\n this.startTimeIndicator?.hide();\n this.endTimeIndicator?.hide();\n }\n\n private addMaskToProgressBar(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n const elements = seekBar?.el().getElementsByClassName('cv-chapter-bar-items');\n\n if (elements && elements.length) {\n const progressBar = elements[0] as HTMLElement;\n const duration = this.player.duration();\n const leftInset = this.startTime / duration * 100;\n const rightInset = 100 - (this.endTime / duration * 100);\n const verticalInset = -5; // Increase the mask vertically to account for the thumbtack during scrubbing\n\n progressBar.style.clipPath = `inset(${verticalInset}em ${rightInset}% ${verticalInset}em ${leftInset}%)`;\n }\n }\n\n private removeMaskFromProgressBar(): void {\n const seekBar = this.player.controlBar.getChild('ProgressControl')?.getChild('SeekBar');\n const elements = seekBar?.el().getElementsByClassName('cv-chapter-bar-items');\n\n if (elements && elements.length) {\n const progressBar = elements[0] as HTMLElement;\n\n progressBar.style.clipPath = '';\n }\n }\n\n private showReplayView(): void {\n if (!this.replayView) {\n this.replayView = new ReplayView(this.player, {\n onContinuePress: this.onContinuePress,\n onReplayPress: this.onReplayPress\n });\n \n this.player.addChild(this.replayView);\n }\n\n this.replayView.show();\n }\n\n private hideReplayView(): void {\n this.replayView?.hide();\n }\n\n private getPlayToggle(): videojs.Button | undefined {\n const collapserator = this.player.getChild('collapserator');\n return collapserator?.getChild('PlayToggle') as videojs.Button;\n }\n\n private enablePlayToggle(): void {\n const playToggle = this.getPlayToggle();\n \n if (playToggle)\n playToggle.enable();\n }\n\n private disablePlayToggle(): void {\n const playToggle = this.getPlayToggle();\n \n if (playToggle)\n playToggle.disable();\n }\n\n private addCssClasses(): void {\n this.player.addClass('cv-range-indicator-plugin');\n }\n\n private removeCssClasses(): void {\n this.player.removeClass('cv-range-indicator-plugin');\n }\n\n public dispose(): void {\n this.removeCssClasses();\n\n this.player.off('timeupdate', this.onTimeUpdateOrSeeked);\n this.player.off('seeked', this.onTimeUpdateOrSeeked);\n \n this.startTimeIndicator?.dispose();\n this.endTimeIndicator?.dispose();\n this.replayView?.dispose();\n\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('rangeIndicatorPlugin', RangeIndicatorPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n rangeIndicatorPlugin(options: RangeIndicatorPluginOptions): void;\n }\n}\n","export const IdHelper = {\n generateRandomId: () => {\n return (window.crypto as any)?.randomUUID?.() ?? Math.random().toString();\n }\n};\n","/* eslint simple-import-sort/imports: 0 */\n\nimport { VideoJsPlayerOptions } from 'video.js';\nimport { BasePlayer, BasePlayerOptions } from './base-player';\n\nimport { PointOfInterest } from 'libs/shared/interfaces';\nimport { ShareActivityStatus } from 'libs/shared/enums/ShareActivityStatus';\nimport 'projects/player/plugins/clip-plugin/clip-plugin';\n\nimport 'projects/player/plugins/create-clip-button-plugin/create-clip-button-plugin';\n\nimport 'projects/player/plugins/picture-in-picture-plugin/picture-in-picture-plugin';\nimport 'projects/player/plugins/points-of-interest-plugin/points-of-interest-plugin';\nimport 'projects/player/plugins/activity-status-plugin/activity-status-plugin';\nimport 'projects/player/plugins/range-indicator-plugin/range-indicator-plugin';\nimport 'projects/player/plugins/theatre-mode-plugin/theatre-mode-plugin';\nimport 'projects/player/plugins/loop-video-plugin/loop-video-plugin';\n\nimport { PlaybackObject } from 'projects/player/interfaces/models/PlaybackObject';\nimport { ClipData } from 'projects/player/interfaces/models/ClipData';\nimport { NextVideo } from 'projects/player/interfaces/NextVideo';\n\nimport { IdHelper } from '../utils/id-helper';\nimport { TrackHelper } from 'projects/player/utils/track-helper';\n\nexport interface PlayerOptions extends BasePlayerOptions {\n showResources?: boolean;\n pointsOfInterest?: PointOfInterest[];\n}\n\nexport class Player extends BasePlayer {\n declare protected options: PlayerOptions;\n\n constructor(id: string | Element, options: PlayerOptions) {\n super(id, options);\n }\n\n protected getPlayerOptions(): VideoJsPlayerOptions {\n const options = super.getPlayerOptions();\n\n if (this.options.allowTranscript) {\n options.allowTranscript = true;\n }\n\n if (options.devicesConfig?.canUserCastToDevices) {\n return {\n ...options,\n techOrder: [ 'devices', ...options.techOrder ],\n devices: {\n instanceId: IdHelper.generateRandomId()\n }\n };\n }\n\n return options;\n }\n\n protected configurePlugins(): void {\n try {\n if (this.options.onClickCreateClip) {\n this.player.createClipButtonPlugin({\n onClick: this.options.onClickCreateClip\n });\n }\n\n if (this.options.onRequestPictureInPicture) {\n this.player.pictureInPicture({\n onRequestPictureInPicture: this.options.onRequestPictureInPicture\n });\n }\n\n if (this.options.pointsOfInterest?.length) {\n this.player.pointsOfInterestPlugin({\n pointsOfInterest: this.options.pointsOfInterest\n });\n }\n\n this.player.loopVideoPlugin({ allowLoop: this.options.allowLoop });\n } catch (ex) {\n console.log('failed to register plugins', ex);\n }\n }\n\n public setNextVideo(nextVideo: NextVideo, playNext: boolean, onPlayNext: () => void): void {\n /**\n * Next video plugin needs to be imported separately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (!this.player.nextVideoPlugin)\n return;\n\n const plugin = this.player.nextVideoPlugin();\n plugin.setNextVideo(nextVideo, playNext, onPlayNext);\n }\n\n public togglePictureInPicture(isInPictureInPicture: boolean): void {\n const plugin = this.player.pictureInPicture();\n\n if (plugin)\n plugin.togglePictureInPicture(isInPictureInPicture);\n }\n\n public toggleTheatreMode(status?: boolean): void {\n const plugin = this.player.theatreModePlugin();\n\n if (plugin)\n plugin.toggleTheatreMode(status, { shouldLog: true });\n }\n\n public toggleTranscript(status?: boolean): void {\n if (!this.player.viewTranscriptPlugin)\n return;\n\n const plugin = this.player.viewTranscriptPlugin();\n\n if (plugin)\n plugin.toggleTranscript(status);\n }\n\n public hasStarted(): boolean {\n return this.player.hasStarted();\n }\n\n protected async additionalSetup(playbackObject: PlaybackObject): Promise<void> {\n // instantiate before calling super\n // ensure the theatreMode is set up first before theatre mode registerAnalytics is called\n if (this.options.onRequestTheatreMode && this.options.allowTheatreMode && this.player.theatreModePlugin) {\n this.player.theatreModePlugin({\n onRequestTheatreMode: this.options.onRequestTheatreMode,\n theatreMode: this.options.theatreMode,\n playbackObject\n });\n }\n\n super.additionalSetup(playbackObject);\n\n /**\n * Resources plugin needs to be imported seperately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (this.options.showResources && playbackObject.resources && this.player.resourcesPlugin) {\n this.player.resourcesPlugin({\n resources: playbackObject.resources.list,\n imageCdnUrl: this.options.imageCdnUrl\n });\n }\n\n if (playbackObject.mediaType === 'MasterClip') {\n const clipData = playbackObject.additionalData as ClipData;\n\n if (clipData === null)\n throw Error('Invalid clip data');\n\n this.player.clipPlugin({\n startTime: clipData.startTime,\n endTime: clipData.endTime\n });\n }\n\n /**\n * The range indicator plugin is only applicable when watching videos\n */\n if (playbackObject.mediaType === 'MasterVideo' && this.options.startTime && this.options.endTime) {\n this.player.rangeIndicatorPlugin({\n startTime: this.options.startTime,\n endTime: this.options.endTime\n });\n }\n }\n\n protected setupAnalyticsDependentPlugins(playbackObject: PlaybackObject): void {\n super.setupAnalyticsDependentPlugins(playbackObject);\n\n if (this.options.allowTranscript) {\n this.player.viewTranscriptPlugin().registerAnalytics(\n this.analyticsService,\n playbackObject\n );\n }\n\n if (this.options.onRequestTheatreMode && this.options.allowTheatreMode && this.player.theatreModePlugin) {\n this.player.theatreModePlugin().registerAnalytics(\n this.analyticsService\n );\n }\n\n /**\n * The devices plugin needs to be imported separately to be used \n * This is because it uses react components.\n * We want to keep react out of our main player bundle. - Sha\n */\n if (this.options.devicesConfig?.canUserCastToDevices && this.player.devicesPlugin) {\n this.player.devicesPlugin({\n ...this.options.devicesConfig,\n userId: parseInt(playbackObject.viewerId),\n title: playbackObject.title,\n analyticsService: this.analyticsService\n });\n }\n }\n\n public setActivityStatus(status: ShareActivityStatus, onToggle: () => void): void {\n const plugin = this.player.activityStatusPlugin();\n plugin.setActivityStatus(status, onToggle);\n }\n\n public useCurrentTranscript(callback: (track: TextTrack) => void, language?: string): void {\n // eslint-disable-next-line react-hooks/rules-of-hooks \n TrackHelper.useMetadataTracks(this.player, 'transcript', callback, language);\n }\n\n public useChapters(callback: (track: TextTrack) => void): void {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n TrackHelper.useChapters(this.player, callback);\n }\n}\n","/**\n* jQuery core object.\n*\n* Worker with jQuery deferred\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/core.js\n*\n*/\n\nvar jQuery = module.exports = {\n\ttype: type\n\t, isArray: isArray\n\t, isFunction: isFunction\n\t, isPlainObject: isPlainObject\n\t, each: each\n\t, extend: extend\n\t, noop: function() {}\n};\n\nvar toString = Object.prototype.toString;\n\nvar class2type = {};\n// Populate the class2type map\n\"Boolean Number String Function Array Date RegExp Object\".split(\" \").forEach(function(name) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\n\nfunction type( obj ) {\n\treturn obj == null ?\n\t\tString( obj ) :\n\t\t\tclass2type[ toString.call(obj) ] || \"object\";\n}\n\nfunction isFunction( obj ) {\n\treturn jQuery.type(obj) === \"function\";\n}\n\nfunction isArray( obj ) {\n\treturn jQuery.type(obj) === \"array\";\n}\n\nfunction each( object, callback, args ) {\n\tvar name, i = 0,\n\tlength = object.length,\n\tisObj = length === undefined || isFunction( object );\n\n\tif ( args ) {\n\t\tif ( isObj ) {\n\t\t\tfor ( name in object ) {\n\t\t\t\tif ( callback.apply( object[ name ], args ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( ; i < length; ) {\n\t\t\t\tif ( callback.apply( object[ i++ ], args ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// A special, fast, case for the most common use of each\n\t} else {\n\t\tif ( isObj ) {\n\t\t\tfor ( name in object ) {\n\t\t\t\tif ( callback.call( object[ name ], name, object[ name ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( ; i < length; ) {\n\t\t\t\tif ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction isPlainObject( obj ) {\n\t// Must be an Object.\n\tif ( !obj || jQuery.type(obj) !== \"object\" ) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction extend() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\ttarget = arguments[0] || {},\n\ti = 1,\n\tlength = arguments.length,\n\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n\t\ttarget = {};\n\t}\n\n\t// extend jQuery itself if only one argument is passed\n\tif ( length === i ) {\n\t\ttarget = this;\n\t\t--i;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\t\t// Only deal with non-null/undefined values\n\t\tif ( (options = arguments[ i ]) != null ) {\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray(src) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject(src) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\n\n","var jQuery = module.exports = require(\"./jquery-core.js\"),\n\tcore_rspace = /\\s+/;\n/**\n* jQuery Callbacks\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/callbacks.js\n*\n*/\n\n\n// String to Object options format cache\nvar optionsCache = {};\n\n// Convert String-formatted options into Object-formatted ones and store in cache\nfunction createOptions( options ) {\n\tvar object = optionsCache[ options ] = {};\n\tjQuery.each( options.split( core_rspace ), function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t});\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\t( optionsCache[ options ] || createOptions( options ) ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Last fire value (for non-forgettable lists)\n\t\tmemory,\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\t\t// Flag to know if list is currently firing\n\t\tfiring,\n\t\t// First callback to fire (used internally by add and fireWith)\n\t\tfiringStart,\n\t\t// End of the loop when firing\n\t\tfiringLength,\n\t\t// Index of currently firing callback (modified by remove if needed)\n\t\tfiringIndex,\n\t\t// Actual callback list\n\t\tlist = [],\n\t\t// Stack of fire calls for repeatable lists\n\t\tstack = !options.once && [],\n\t\t// Fire callbacks\n\t\tfire = function( data ) {\n\t\t\tmemory = options.memory && data;\n\t\t\tfired = true;\n\t\t\tfiringIndex = firingStart || 0;\n\t\t\tfiringStart = 0;\n\t\t\tfiringLength = list.length;\n\t\t\tfiring = true;\n\t\t\tfor ( ; list && firingIndex < firingLength; firingIndex++ ) {\n\t\t\t\tif ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {\n\t\t\t\t\tmemory = false; // To prevent further calls using add\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiring = false;\n\t\t\tif ( list ) {\n\t\t\t\tif ( stack ) {\n\t\t\t\t\tif ( stack.length ) {\n\t\t\t\t\t\tfire( stack.shift() );\n\t\t\t\t\t}\n\t\t\t\t} else if ( memory ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t} else {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Actual Callbacks object\n\t\tself = {\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\t// First, we save the current length\n\t\t\t\t\tvar start = list.length;\n\t\t\t\t\t(function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tvar type = jQuery.type( arg );\n\t\t\t\t\t\t\tif ( type === \"function\" ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && type !== \"string\" ) {\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})( arguments );\n\t\t\t\t\t// Do we need to add the callbacks to the\n\t\t\t\t\t// current firing batch?\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tfiringLength = list.length;\n\t\t\t\t\t// With memory, if we're not firing then\n\t\t\t\t\t// we should call right away\n\t\t\t\t\t} else if ( memory ) {\n\t\t\t\t\t\tfiringStart = start;\n\t\t\t\t\t\tfire( memory );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\t\tvar index;\n\t\t\t\t\t\twhile( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\t\tlist.splice( index, 1 );\n\t\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\t\t\tif ( index <= firingLength ) {\n\t\t\t\t\t\t\t\t\tfiringLength--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Control if a given callback is in the list\n\t\t\thas: function( fn ) {\n\t\t\t\treturn jQuery.inArray( fn, list ) > -1;\n\t\t\t},\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tlist = [];\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Have the list do nothing anymore\n\t\t\tdisable: function() {\n\t\t\t\tlist = stack = memory = undefined;\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it disabled?\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\t\t\t// Lock the list in its current state\n\t\t\tlock: function() {\n\t\t\t\tstack = undefined;\n\t\t\t\tif ( !memory ) {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it locked?\n\t\t\tlocked: function() {\n\t\t\t\treturn !stack;\n\t\t\t},\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\targs = args || [];\n\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\tif ( list && ( !fired || stack ) ) {\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tstack.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfire( args );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\n\n","\n/*!\n* jquery-deferred\n* Copyright(c) 2011 Hidden <zzdhidden@gmail.com>\n* MIT Licensed\n*/\n\n/**\n* Library version.\n*/\n\nvar jQuery = module.exports = require(\"./jquery-callbacks.js\"),\n\tcore_slice = Array.prototype.slice;\n\n/**\n* jQuery deferred\n*\n* Code from: https://github.com/jquery/jquery/blob/master/src/deferred.js\n* Doc: http://api.jquery.com/category/deferred-object/\n*\n*/\n\njQuery.extend({\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\t\t\t\t// action, add listener, listener list, final state\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), \"rejected\" ],\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks(\"memory\") ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tthen: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\t\t\t\t\treturn jQuery.Deferred(function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\t\t\t\t\tvar action = tuple[ 0 ],\n\t\t\t\t\t\t\t\tfn = fns[ i ];\n\t\t\t\t\t\t\t// deferred[ done | fail | progress ] for forwarding actions to newDefer\n\t\t\t\t\t\t\tdeferred[ tuple[1] ]( jQuery.isFunction( fn ) ?\n\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\tvar returned = fn.apply( this, arguments );\n\t\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject )\n\t\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tnewDefer[ action + \"With\" ]( this === deferred ? newDefer : this, [ returned ] );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\tnewDefer[ action ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t}).promise();\n\t\t\t\t},\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Keep pipe for back-compat\n\t\tpromise.pipe = promise.then;\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 3 ];\n\n\t\t\t// promise[ done | fail | progress ] = list.add\n\t\t\tpromise[ tuple[1] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(function() {\n\t\t\t\t\t// state = [ resolved | rejected ]\n\t\t\t\t\tstate = stateString;\n\n\t\t\t\t// [ reject_list | resolve_list ].disable; progress_list.lock\n\t\t\t\t}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );\n\t\t\t}\n\n\t\t\t// deferred[ resolve | reject | notify ] = list.fire\n\t\t\tdeferred[ tuple[0] ] = list.fire;\n\t\t\tdeferred[ tuple[0] + \"With\" ] = list.fireWith;\n\t\t});\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( subordinate /* , ..., subordinateN */ ) {\n\t\tvar i = 0,\n\t\t\tresolveValues = core_slice.call( arguments ),\n\t\t\tlength = resolveValues.length,\n\n\t\t\t// the count of uncompleted subordinates\n\t\t\tremaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,\n\n\t\t\t// the master Deferred. If resolveValues consist of only a single Deferred, just use that.\n\t\t\tdeferred = remaining === 1 ? subordinate : jQuery.Deferred(),\n\n\t\t\t// Update function for both resolve and progress values\n\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tprogressValues, progressContexts, resolveContexts;\n\n\t\t// add listeners to Deferred subordinates; treat others as resolved\n\t\tif ( length > 1 ) {\n\t\t\tprogressValues = new Array( length );\n\t\t\tprogressContexts = new Array( length );\n\t\t\tresolveContexts = new Array( length );\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {\n\t\t\t\t\tresolveValues[ i ].promise()\n\t\t\t\t\t\t.done( updateFunc( i, resolveContexts, resolveValues ) )\n\t\t\t\t\t\t.fail( deferred.reject )\n\t\t\t\t\t\t.progress( updateFunc( i, progressContexts, progressValues ) );\n\t\t\t\t} else {\n\t\t\t\t\t--remaining;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if we're not waiting on anything, resolve the master\n\t\tif ( !remaining ) {\n\t\t\tdeferred.resolveWith( resolveContexts, resolveValues );\n\t\t}\n\n\t\treturn deferred.promise();\n\t}\n});\n","\nmodule.exports = require('./lib/jquery-deferred');","/**\n * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT\n */\n(function (global) {\n 'use strict';\n\n var param = function (a) {\n var s = [], rbracket = /\\[\\]$/,\n isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n }, add = function (k, v) {\n v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v;\n s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v);\n }, buildParams = function (prefix, obj) {\n var i, len, key;\n\n if (prefix) {\n if (isArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n if (rbracket.test(prefix)) {\n add(prefix, obj[i]);\n } else {\n buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]);\n }\n }\n } else if (obj && String(obj) === '[object Object]') {\n for (key in obj) {\n buildParams(prefix + '[' + key + ']', obj[key]);\n }\n } else {\n add(prefix, obj);\n }\n } else if (isArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n add(obj[i].name, obj[i].value);\n }\n } else {\n for (key in obj) {\n buildParams(key, obj[key]);\n }\n }\n return s;\n };\n\n return buildParams('', a).join('&').replace(/%20/g, '+');\n };\n\n if (typeof module === 'object' && typeof module.exports === 'object') {\n module.exports = param;\n } else if (typeof define === 'function' && define.amd) {\n define([], function () {\n return param;\n });\n } else {\n global.param = param;\n }\n\n}(this));\n\n","'use strict';\r\n\r\nvar jQueryDeferred = require('jquery-deferred');\r\nvar jQueryParam = require('jquery-param');\r\n\r\nvar jqueryFunction = function jqueryFunction(subject) {\r\n var events = subject.events || {};\r\n\r\n if (subject && subject === subject.window) return {\r\n 0: subject,\r\n load: function load(handler) {\r\n return subject.addEventListener('load', handler, false);\r\n },\r\n bind: function bind(event, handler) {\r\n return subject.addEventListener(event, handler, false);\r\n },\r\n unbind: function unbind(event, handler) {\r\n return subject.removeEventListener(event, handler, false);\r\n }\r\n };\r\n\r\n return {\r\n 0: subject,\r\n\r\n unbind: function unbind(event, handler) {\r\n var handlers = events[event] || [];\r\n\r\n if (handler) {\r\n var idx = handlers.indexOf(handler);\r\n if (idx !== -1) handlers.splice(idx, 1);\r\n } else handlers = [];\r\n\r\n events[event] = handlers;\r\n subject.events = events;\r\n },\r\n bind: function bind(event, handler) {\r\n var current = events[event] || [];\r\n events[event] = current.concat(handler);\r\n subject.events = events;\r\n },\r\n triggerHandler: function triggerHandler(event, args) {\r\n var _this = this;\r\n\r\n var handlers = events[event] || [];\r\n handlers.forEach(function (fn) {\r\n if (args && args[0] && args[0].type === undefined) {\r\n args = [{\r\n type: event\r\n }].concat(args || []);\r\n } else {\r\n args = args || [];\r\n }\r\n\r\n fn.apply(_this, args);\r\n });\r\n }\r\n };\r\n};\r\n\r\nvar xhr = function xhr() {\r\n try {\r\n return new window.XMLHttpRequest();\r\n } catch (e) {}\r\n};\r\n\r\nvar ajax = function ajax(options) {\r\n var request = xhr();\r\n\r\n if (options.xhrFields && options.xhrFields.withCredentials) {\r\n request.withCredentials = true;\r\n }\r\n\r\n request.onreadystatechange = function () {\r\n if (request.readyState !== 4) {\r\n return;\r\n }\r\n\r\n if (request.status === 200 && !request._hasError) {\r\n try {\r\n options.success && options.success(JSON.parse(request.responseText));\r\n } catch (e) {\r\n options.error && options.error(request);\r\n }\r\n } else {\r\n options.error && options.error(request);\r\n }\r\n };\r\n\r\n request.withCredentials = options.xhrFields.withCredentials;\r\n var cacheBuster = \"_=\" + new Date().getTime();\r\n if (options.url.indexOf(\"?\") === -1) {\r\n\t\toptions.url += \"?\" + cacheBuster;\r\n\t} else if (options.url.indexOf(\"_=\") === -1) {\r\n options.url += \"&\" + cacheBuster;\r\n } else {\r\n options.url = options.url.replace(/_=\\d+/, cacheBuster);\r\n }\r\n request.open(options.type, options.url);\r\n request.setRequestHeader('content-type', options.contentType);\r\n if (options.headers) {\r\n Object.keys(options.headers).forEach(function (key) {\r\n var value = options.headers[key];\r\n request.setRequestHeader(key, value);\r\n });\r\n }\r\n\r\n request.send(options.data.data && 'data=' + encodeURIComponent(options.data.data));\r\n\r\n return {\r\n abort: function abort(reason) {\r\n return request.abort(reason);\r\n }\r\n };\r\n};\r\n\r\nmodule.exports = jQueryDeferred.extend(jqueryFunction, jQueryDeferred, {\r\n defaultAjaxHeaders: null,\r\n ajax: ajax,\r\n inArray: function inArray(arr, item) {\r\n return arr.indexOf(item) !== -1;\r\n },\r\n trim: function trim(str) {\r\n return str && str.trim();\r\n },\r\n isEmptyObject: function isEmptyObject(obj) {\r\n return !obj || Object.keys(obj).length === 0;\r\n },\r\n makeArray: function makeArray(arr) {\r\n return [].slice.call(arr, 0);\r\n },\r\n param: function param(obj) {\r\n return jQueryParam(obj);\r\n },\r\n support: {\r\n cors: function () {\r\n var xhrObj = xhr();\r\n return !!xhrObj && \"withCredentials\" in xhrObj;\r\n }()\r\n }\r\n});","'use strict';\r\n\r\nObject.defineProperty(exports, \"__esModule\", {\r\n value: true\r\n});\r\n\r\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\r\n\r\nvar jQueryShim = require('./jQueryShim');\r\n\r\n/* jquery.signalR.core.js */\r\n/*global window:false */\r\n/*!\r\n * ASP.NET SignalR JavaScript Library 2.4.1\r\n * http://signalr.net/\r\n *\r\n * Copyright (c) .NET Foundation. All rights reserved.\r\n * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n *\r\n */\r\n\r\n/// <reference path=\"Scripts/jquery-1.6.4.js\" />\r\n/// <reference path=\"jquery.signalR.version.js\" />\r\n(function ($, window, undefined) {\r\n\r\n var resources = {\r\n nojQuery: \"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.\",\r\n noTransportOnInit: \"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.\",\r\n errorOnNegotiate: \"Error during negotiation request.\",\r\n stoppedWhileLoading: \"The connection was stopped during page load.\",\r\n stoppedWhileNegotiating: \"The connection was stopped during the negotiate request.\",\r\n errorParsingNegotiateResponse: \"Error parsing negotiate response.\",\r\n errorRedirectionExceedsLimit: \"Negotiate redirection limit exceeded.\",\r\n errorDuringStartRequest: \"Error during start request. Stopping the connection.\",\r\n errorFromServer: \"Error message received from the server: '{0}'.\",\r\n stoppedDuringStartRequest: \"The connection was stopped during the start request.\",\r\n errorParsingStartResponse: \"Error parsing start response: '{0}'. Stopping the connection.\",\r\n invalidStartResponse: \"Invalid start response: '{0}'. Stopping the connection.\",\r\n protocolIncompatible: \"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.\",\r\n aspnetCoreSignalrServer: \"Detected a connection attempt to an ASP.NET Core SignalR Server. This client only supports connecting to an ASP.NET SignalR Server. See https://aka.ms/signalr-core-differences for details.\",\r\n sendFailed: \"Send failed.\",\r\n parseFailed: \"Failed at parsing response: {0}\",\r\n longPollFailed: \"Long polling request failed.\",\r\n eventSourceFailedToConnect: \"EventSource failed to connect.\",\r\n eventSourceError: \"Error raised by EventSource\",\r\n webSocketClosed: \"WebSocket closed.\",\r\n pingServerFailedInvalidResponse: \"Invalid ping response when pinging server: '{0}'.\",\r\n pingServerFailed: \"Failed to ping server.\",\r\n pingServerFailedStatusCode: \"Failed to ping server. Server responded with status code {0}, stopping the connection.\",\r\n pingServerFailedParse: \"Failed to parse ping server response, stopping the connection.\",\r\n noConnectionTransport: \"Connection is in an invalid state, there is no transport active.\",\r\n webSocketsInvalidState: \"The Web Socket transport is in an invalid state, transitioning into reconnecting.\",\r\n reconnectTimeout: \"Couldn't reconnect within the configured timeout of {0} ms, disconnecting.\",\r\n reconnectWindowTimeout: \"The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection.\",\r\n jsonpNotSupportedWithAccessToken: \"The JSONP protocol does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.\"\r\n };\r\n\r\n if (typeof $ !== \"function\") {\r\n // no jQuery!\r\n throw new Error(resources.nojQuery);\r\n }\r\n\r\n var _signalR,\r\n _connection,\r\n _pageLoaded = window.document.readyState === \"complete\",\r\n _pageWindow = $(window),\r\n _negotiateAbortText = \"__Negotiate Aborted__\",\r\n events = {\r\n onStart: \"onStart\",\r\n onStarting: \"onStarting\",\r\n onReceived: \"onReceived\",\r\n onError: \"onError\",\r\n onConnectionSlow: \"onConnectionSlow\",\r\n onReconnecting: \"onReconnecting\",\r\n onReconnect: \"onReconnect\",\r\n onStateChanged: \"onStateChanged\",\r\n onDisconnect: \"onDisconnect\"\r\n },\r\n ajaxDefaults = {\r\n processData: true,\r\n timeout: null,\r\n async: true,\r\n global: false,\r\n cache: false\r\n },\r\n _log = function _log(msg, logging) {\r\n if (logging === false) {\r\n return;\r\n }\r\n var m;\r\n if (typeof window.console === \"undefined\") {\r\n return;\r\n }\r\n m = \"[\" + new Date().toTimeString() + \"] SignalR: \" + msg;\r\n if (window.console.debug) {\r\n window.console.debug(m);\r\n } else if (window.console.log) {\r\n window.console.log(m);\r\n }\r\n },\r\n changeState = function changeState(connection, expectedState, newState) {\r\n if (expectedState === connection.state) {\r\n connection.state = newState;\r\n\r\n $(connection).triggerHandler(events.onStateChanged, [{ oldState: expectedState, newState: newState }]);\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n isDisconnecting = function isDisconnecting(connection) {\r\n return connection.state === _signalR.connectionState.disconnected;\r\n },\r\n supportsKeepAlive = function supportsKeepAlive(connection) {\r\n return connection._.keepAliveData.activated && connection.transport.supportsKeepAlive(connection);\r\n },\r\n configureStopReconnectingTimeout = function configureStopReconnectingTimeout(connection) {\r\n var stopReconnectingTimeout, onReconnectTimeout;\r\n\r\n // Check if this connection has already been configured to stop reconnecting after a specified timeout.\r\n // Without this check if a connection is stopped then started events will be bound multiple times.\r\n if (!connection._.configuredStopReconnectingTimeout) {\r\n onReconnectTimeout = function onReconnectTimeout(connection) {\r\n var message = _signalR._.format(_signalR.resources.reconnectTimeout, connection.disconnectTimeout);\r\n connection.log(message);\r\n $(connection).triggerHandler(events.onError, [_signalR._.error(message, /* source */\"TimeoutException\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n };\r\n\r\n connection.reconnecting(function () {\r\n var connection = this;\r\n\r\n // Guard against state changing in a previous user defined even handler\r\n if (connection.state === _signalR.connectionState.reconnecting) {\r\n stopReconnectingTimeout = window.setTimeout(function () {\r\n onReconnectTimeout(connection);\r\n }, connection.disconnectTimeout);\r\n }\r\n });\r\n\r\n connection.stateChanged(function (data) {\r\n if (data.oldState === _signalR.connectionState.reconnecting) {\r\n // Clear the pending reconnect timeout check\r\n window.clearTimeout(stopReconnectingTimeout);\r\n }\r\n });\r\n\r\n connection._.configuredStopReconnectingTimeout = true;\r\n }\r\n };\r\n\r\n _signalR = function signalR(url, qs, logging) {\r\n /// <summary>Creates a new SignalR connection for the given url</summary>\r\n /// <param name=\"url\" type=\"String\">The URL of the long polling endpoint</param>\r\n /// <param name=\"qs\" type=\"Object\">\r\n /// [Optional] Custom querystring parameters to add to the connection URL.\r\n /// If an object, every non-function member will be added to the querystring.\r\n /// If a string, it's added to the QS as specified.\r\n /// </param>\r\n /// <param name=\"logging\" type=\"Boolean\">\r\n /// [Optional] A flag indicating whether connection logging is enabled to the browser\r\n /// console/log. Defaults to false.\r\n /// </param>\r\n\r\n return new _signalR.fn.init(url, qs, logging);\r\n };\r\n\r\n _signalR._ = {\r\n defaultContentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\r\n\r\n ieVersion: function () {\r\n var version, matches;\r\n\r\n if (window.navigator.appName === 'Microsoft Internet Explorer') {\r\n // Check if the user agent has the pattern \"MSIE (one or more numbers).(one or more numbers)\";\r\n matches = /MSIE ([0-9]+\\.[0-9]+)/.exec(window.navigator.userAgent);\r\n\r\n if (matches) {\r\n version = window.parseFloat(matches[1]);\r\n }\r\n }\r\n\r\n // undefined value means not IE\r\n return version;\r\n }(),\r\n\r\n error: function error(message, source, context) {\r\n var e = new Error(message);\r\n e.source = source;\r\n\r\n if (typeof context !== \"undefined\") {\r\n e.context = context;\r\n }\r\n\r\n return e;\r\n },\r\n\r\n transportError: function transportError(message, transport, source, context) {\r\n var e = this.error(message, source, context);\r\n e.transport = transport ? transport.name : undefined;\r\n return e;\r\n },\r\n\r\n format: function format() {\r\n /// <summary>Usage: format(\"Hi {0}, you are {1}!\", \"Foo\", 100) </summary>\r\n var s = arguments[0];\r\n for (var i = 0; i < arguments.length - 1; i++) {\r\n s = s.replace(\"{\" + i + \"}\", arguments[i + 1]);\r\n }\r\n return s;\r\n },\r\n\r\n firefoxMajorVersion: function firefoxMajorVersion(userAgent) {\r\n // Firefox user agents: http://useragentstring.com/pages/Firefox/\r\n var matches = userAgent.match(/Firefox\\/(\\d+)/);\r\n if (!matches || !matches.length || matches.length < 2) {\r\n return 0;\r\n }\r\n return parseInt(matches[1], 10 /* radix */);\r\n },\r\n\r\n configurePingInterval: function configurePingInterval(connection) {\r\n var config = connection._.config,\r\n onFail = function onFail(error) {\r\n $(connection).triggerHandler(events.onError, [error]);\r\n };\r\n\r\n if (config && !connection._.pingIntervalId && config.pingInterval) {\r\n connection._.pingIntervalId = window.setInterval(function () {\r\n _signalR.transports._logic.pingServer(connection).fail(onFail);\r\n }, config.pingInterval);\r\n }\r\n }\r\n };\r\n\r\n _signalR.events = events;\r\n\r\n _signalR.resources = resources;\r\n\r\n _signalR.ajaxDefaults = ajaxDefaults;\r\n\r\n _signalR.changeState = changeState;\r\n\r\n _signalR.isDisconnecting = isDisconnecting;\r\n\r\n _signalR.connectionState = {\r\n connecting: 0,\r\n connected: 1,\r\n reconnecting: 2,\r\n disconnected: 4\r\n };\r\n\r\n _signalR.hub = {\r\n start: function start() {\r\n // This will get replaced with the real hub connection start method when hubs is referenced correctly\r\n throw new Error(\"SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>.\");\r\n }\r\n };\r\n\r\n // .on() was added in version 1.7.0, .load() was removed in version 3.0.0 so we fallback to .load() if .on() does\r\n // not exist to not break existing applications\r\n if (typeof _pageWindow.on == \"function\") {\r\n _pageWindow.on(\"load\", function () {\r\n _pageLoaded = true;\r\n });\r\n } else {\r\n _pageWindow.load(function () {\r\n _pageLoaded = true;\r\n });\r\n }\r\n\r\n function validateTransport(requestedTransport, connection) {\r\n /// <summary>Validates the requested transport by cross checking it with the pre-defined signalR.transports</summary>\r\n /// <param name=\"requestedTransport\" type=\"Object\">The designated transports that the user has specified.</param>\r\n /// <param name=\"connection\" type=\"signalR\">The connection that will be using the requested transports. Used for logging purposes.</param>\r\n /// <returns type=\"Object\" />\r\n\r\n if ($.isArray(requestedTransport)) {\r\n // Go through transport array and remove an \"invalid\" tranports\r\n for (var i = requestedTransport.length - 1; i >= 0; i--) {\r\n var transport = requestedTransport[i];\r\n if ($.type(transport) !== \"string\" || !_signalR.transports[transport]) {\r\n connection.log(\"Invalid transport: \" + transport + \", removing it from the transports list.\");\r\n requestedTransport.splice(i, 1);\r\n }\r\n }\r\n\r\n // Verify we still have transports left, if we dont then we have invalid transports\r\n if (requestedTransport.length === 0) {\r\n connection.log(\"No transports remain within the specified transport array.\");\r\n requestedTransport = null;\r\n }\r\n } else if (!_signalR.transports[requestedTransport] && requestedTransport !== \"auto\") {\r\n connection.log(\"Invalid transport: \" + requestedTransport.toString() + \".\");\r\n requestedTransport = null;\r\n } else if (requestedTransport === \"auto\" && _signalR._.ieVersion <= 8) {\r\n // If we're doing an auto transport and we're IE8 then force longPolling, #1764\r\n return [\"longPolling\"];\r\n }\r\n\r\n return requestedTransport;\r\n }\r\n\r\n function getDefaultPort(protocol) {\r\n if (protocol === \"http:\") {\r\n return 80;\r\n } else if (protocol === \"https:\") {\r\n return 443;\r\n }\r\n }\r\n\r\n function addDefaultPort(protocol, url) {\r\n // Remove ports from url. We have to check if there's a / or end of line\r\n // following the port in order to avoid removing ports such as 8080.\r\n if (url.match(/:\\d+$/)) {\r\n return url;\r\n } else {\r\n return url + \":\" + getDefaultPort(protocol);\r\n }\r\n }\r\n\r\n function ConnectingMessageBuffer(connection, drainCallback) {\r\n var that = this,\r\n buffer = [];\r\n\r\n that.tryBuffer = function (message) {\r\n if (connection.state === $.signalR.connectionState.connecting) {\r\n buffer.push(message);\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n };\r\n\r\n that.drain = function () {\r\n // Ensure that the connection is connected when we drain (do not want to drain while a connection is not active)\r\n if (connection.state === $.signalR.connectionState.connected) {\r\n while (buffer.length > 0) {\r\n drainCallback(buffer.shift());\r\n }\r\n }\r\n };\r\n\r\n that.clear = function () {\r\n buffer = [];\r\n };\r\n }\r\n\r\n _signalR.fn = _signalR.prototype = {\r\n init: function init(url, qs, logging) {\r\n var $connection = $(this);\r\n\r\n this.url = url;\r\n this.qs = qs;\r\n this.lastError = null;\r\n this._ = {\r\n keepAliveData: {},\r\n connectingMessageBuffer: new ConnectingMessageBuffer(this, function (message) {\r\n $connection.triggerHandler(events.onReceived, [message]);\r\n }),\r\n lastMessageAt: new Date().getTime(),\r\n lastActiveAt: new Date().getTime(),\r\n beatInterval: 5000, // Default value, will only be overridden if keep alive is enabled,\r\n beatHandle: null,\r\n totalTransportConnectTimeout: 0, // This will be the sum of the TransportConnectTimeout sent in response to negotiate and connection.transportConnectTimeout\r\n redirectQs: null\r\n };\r\n if (typeof logging === \"boolean\") {\r\n this.logging = logging;\r\n }\r\n },\r\n\r\n _parseResponse: function _parseResponse(response) {\r\n var that = this;\r\n\r\n if (!response) {\r\n return response;\r\n } else if (typeof response === \"string\") {\r\n return that.json.parse(response);\r\n } else {\r\n return response;\r\n }\r\n },\r\n\r\n _originalJson: window.JSON,\r\n\r\n json: window.JSON,\r\n\r\n isCrossDomain: function isCrossDomain(url, against) {\r\n /// <summary>Checks if url is cross domain</summary>\r\n /// <param name=\"url\" type=\"String\">The base URL</param>\r\n /// <param name=\"against\" type=\"Object\">\r\n /// An optional argument to compare the URL against, if not specified it will be set to window.location.\r\n /// If specified it must contain a protocol and a host property.\r\n /// </param>\r\n var link;\r\n\r\n url = $.trim(url);\r\n\r\n against = against || window.location;\r\n\r\n if (url.indexOf(\"http\") !== 0) {\r\n return false;\r\n }\r\n\r\n // Create an anchor tag.\r\n link = window.document.createElement(\"a\");\r\n link.href = url;\r\n\r\n // When checking for cross domain we have to special case port 80 because the window.location will remove the\r\n return link.protocol + addDefaultPort(link.protocol, link.host) !== against.protocol + addDefaultPort(against.protocol, against.host);\r\n },\r\n\r\n ajaxDataType: \"text\",\r\n\r\n contentType: \"application/json; charset=UTF-8\",\r\n\r\n logging: false,\r\n\r\n state: _signalR.connectionState.disconnected,\r\n\r\n clientProtocol: \"2.1\",\r\n\r\n // We want to support older servers since the 2.0 change is to support redirection results, which isn't\r\n // really breaking in the protocol. So if a user updates their client to 2.0 protocol version there's\r\n // no reason they can't still connect to a 1.5 server. The 2.1 protocol is sent by the client so the SignalR\r\n // service knows the client will use they query string returned via the RedirectUrl for subsequent requests.\r\n // It doesn't matter whether the server reflects back 2.1 or continues using 2.0 as the protocol version.\r\n supportedProtocols: [\"1.5\", \"2.0\", \"2.1\"],\r\n\r\n negotiateRedirectSupportedProtocols: [\"2.0\", \"2.1\"],\r\n\r\n reconnectDelay: 2000,\r\n\r\n transportConnectTimeout: 0,\r\n\r\n disconnectTimeout: 30000, // This should be set by the server in response to the negotiate request (30s default)\r\n\r\n reconnectWindow: 30000, // This should be set by the server in response to the negotiate request\r\n\r\n keepAliveWarnAt: 2 / 3, // Warn user of slow connection if we breach the X% mark of the keep alive timeout\r\n\r\n start: function start(options, callback) {\r\n /// <summary>Starts the connection</summary>\r\n /// <param name=\"options\" type=\"Object\">Options map</param>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection has started</param>\r\n var connection = this,\r\n config = {\r\n pingInterval: 300000,\r\n waitForPageLoad: true,\r\n transport: \"auto\",\r\n jsonp: false\r\n },\r\n _initialize,\r\n deferred = connection._deferral || $.Deferred(),\r\n // Check to see if there is a pre-existing deferral that's being built on, if so we want to keep using it\r\n parser = window.document.createElement(\"a\"),\r\n setConnectionUrl = function setConnectionUrl(connection, url) {\r\n if (connection.url === url && connection.baseUrl) {\r\n // when the url related properties are already set\r\n return;\r\n }\r\n\r\n connection.url = url;\r\n\r\n // Resolve the full url\r\n parser.href = connection.url;\r\n if (!parser.protocol || parser.protocol === \":\") {\r\n connection.protocol = window.document.location.protocol;\r\n connection.host = parser.host || window.document.location.host;\r\n } else {\r\n connection.protocol = parser.protocol;\r\n connection.host = parser.host;\r\n }\r\n\r\n connection.baseUrl = connection.protocol + \"//\" + connection.host;\r\n\r\n // Set the websocket protocol\r\n connection.wsProtocol = connection.protocol === \"https:\" ? \"wss://\" : \"ws://\";\r\n\r\n // If the url is protocol relative, prepend the current windows protocol to the url.\r\n if (connection.url.indexOf(\"//\") === 0) {\r\n connection.url = window.location.protocol + connection.url;\r\n connection.log(\"Protocol relative URL detected, normalizing it to '\" + connection.url + \"'.\");\r\n }\r\n\r\n if (connection.isCrossDomain(connection.url)) {\r\n connection.log(\"Auto detected cross domain url.\");\r\n\r\n if (config.transport === \"auto\") {\r\n // Cross-domain does not support foreverFrame\r\n config.transport = [\"webSockets\", \"serverSentEvents\", \"longPolling\"];\r\n }\r\n\r\n if (typeof connection.withCredentials === \"undefined\") {\r\n connection.withCredentials = true;\r\n }\r\n\r\n // Determine if jsonp is the only choice for negotiation, ajaxSend and ajaxAbort.\r\n // i.e. if the browser doesn't supports CORS\r\n // If it is, ignore any preference to the contrary, and switch to jsonp.\r\n if (!$.support.cors) {\r\n connection.ajaxDataType = \"jsonp\";\r\n connection.log(\"Using jsonp because this browser doesn't support CORS.\");\r\n }\r\n\r\n connection.contentType = _signalR._.defaultContentType;\r\n }\r\n };\r\n\r\n connection.lastError = null;\r\n\r\n // Persist the deferral so that if start is called multiple times the same deferral is used.\r\n connection._deferral = deferred;\r\n\r\n if (!connection.json) {\r\n // no JSON!\r\n throw new Error(\"SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.\");\r\n }\r\n\r\n if ($.type(options) === \"function\") {\r\n // Support calling with single callback parameter\r\n callback = options;\r\n } else if ($.type(options) === \"object\") {\r\n $.extend(config, options);\r\n if ($.type(config.callback) === \"function\") {\r\n callback = config.callback;\r\n }\r\n }\r\n\r\n config.transport = validateTransport(config.transport, connection);\r\n\r\n // If the transport is invalid throw an error and abort start\r\n if (!config.transport) {\r\n throw new Error(\"SignalR: Invalid transport(s) specified, aborting start.\");\r\n }\r\n\r\n connection._.config = config;\r\n\r\n // Check to see if start is being called prior to page load\r\n // If waitForPageLoad is true we then want to re-direct function call to the window load event\r\n if (!_pageLoaded && config.waitForPageLoad === true) {\r\n connection._.deferredStartHandler = function () {\r\n connection.start(options, callback);\r\n };\r\n _pageWindow.bind(\"load\", connection._.deferredStartHandler);\r\n\r\n return deferred.promise();\r\n }\r\n\r\n // If we're already connecting just return the same deferral as the original connection start\r\n if (connection.state === _signalR.connectionState.connecting) {\r\n return deferred.promise();\r\n } else if (changeState(connection, _signalR.connectionState.disconnected, _signalR.connectionState.connecting) === false) {\r\n // We're not connecting so try and transition into connecting.\r\n // If we fail to transition then we're either in connected or reconnecting.\r\n\r\n deferred.resolve(connection);\r\n return deferred.promise();\r\n }\r\n\r\n configureStopReconnectingTimeout(connection);\r\n\r\n // If jsonp with no/auto transport is specified, then set the transport to long polling\r\n // since that is the only transport for which jsonp really makes sense.\r\n // Some developers might actually choose to specify jsonp for same origin requests\r\n // as demonstrated by Issue #623.\r\n if (config.transport === \"auto\" && config.jsonp === true) {\r\n config.transport = \"longPolling\";\r\n }\r\n\r\n connection.withCredentials = config.withCredentials;\r\n\r\n // Save the original url so that we can reset it when we stop and restart the connection\r\n connection._originalUrl = connection.url;\r\n\r\n connection.ajaxDataType = config.jsonp ? \"jsonp\" : \"text\";\r\n\r\n setConnectionUrl(connection, connection.url);\r\n\r\n $(connection).bind(events.onStart, function (e, data) {\r\n if ($.type(callback) === \"function\") {\r\n callback.call(connection);\r\n }\r\n deferred.resolve(connection);\r\n });\r\n\r\n connection._.initHandler = _signalR.transports._logic.initHandler(connection);\r\n\r\n _initialize = function initialize(transports, index) {\r\n var noTransportError = _signalR._.error(resources.noTransportOnInit);\r\n\r\n index = index || 0;\r\n if (index >= transports.length) {\r\n if (index === 0) {\r\n connection.log(\"No transports supported by the server were selected.\");\r\n } else if (index === 1) {\r\n connection.log(\"No fallback transports were selected.\");\r\n } else {\r\n connection.log(\"Fallback transports exhausted.\");\r\n }\r\n\r\n // No transport initialized successfully\r\n $(connection).triggerHandler(events.onError, [noTransportError]);\r\n deferred.reject(noTransportError);\r\n // Stop the connection if it has connected and move it into the disconnected state\r\n connection.stop();\r\n return;\r\n }\r\n\r\n // The connection was aborted\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n return;\r\n }\r\n\r\n var transportName = transports[index],\r\n transport = _signalR.transports[transportName],\r\n onFallback = function onFallback() {\r\n _initialize(transports, index + 1);\r\n };\r\n\r\n connection.transport = transport;\r\n\r\n try {\r\n connection._.initHandler.start(transport, function () {\r\n // success\r\n // Firefox 11+ doesn't allow sync XHR withCredentials: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#withCredentials\r\n var isFirefox11OrGreater = _signalR._.firefoxMajorVersion(window.navigator.userAgent) >= 11,\r\n asyncAbort = true;\r\n\r\n connection.log(\"The start request succeeded. Transitioning to the connected state.\");\r\n\r\n if (supportsKeepAlive(connection)) {\r\n _signalR.transports._logic.monitorKeepAlive(connection);\r\n }\r\n\r\n _signalR.transports._logic.startHeartbeat(connection);\r\n\r\n // Used to ensure low activity clients maintain their authentication.\r\n // Must be configured once a transport has been decided to perform valid ping requests.\r\n _signalR._.configurePingInterval(connection);\r\n\r\n if (!changeState(connection, _signalR.connectionState.connecting, _signalR.connectionState.connected)) {\r\n connection.log(\"WARNING! The connection was not in the connecting state.\");\r\n }\r\n\r\n // Drain any incoming buffered messages (messages that came in prior to connect)\r\n connection._.connectingMessageBuffer.drain();\r\n\r\n $(connection).triggerHandler(events.onStart);\r\n\r\n // wire the stop handler for when the user leaves the page\r\n _pageWindow.bind(\"unload\", function () {\r\n connection.log(\"Window unloading, stopping the connection.\");\r\n\r\n connection.stop(asyncAbort);\r\n });\r\n\r\n if (isFirefox11OrGreater) {\r\n // Firefox does not fire cross-domain XHRs in the normal unload handler on tab close.\r\n // #2400\r\n _pageWindow.bind(\"beforeunload\", function () {\r\n // If connection.stop() runs runs in beforeunload and fails, it will also fail\r\n // in unload unless connection.stop() runs after a timeout.\r\n window.setTimeout(function () {\r\n connection.stop(asyncAbort);\r\n }, 0);\r\n });\r\n }\r\n }, onFallback);\r\n } catch (error) {\r\n connection.log(transport.name + \" transport threw '\" + error.message + \"' when attempting to start.\");\r\n onFallback();\r\n }\r\n };\r\n\r\n var url = connection.url + \"/negotiate\",\r\n onFailed = function onFailed(error, connection) {\r\n var err = _signalR._.error(resources.errorOnNegotiate, error, connection._.negotiateRequest);\r\n\r\n $(connection).triggerHandler(events.onError, err);\r\n deferred.reject(err);\r\n // Stop the connection if negotiate failed\r\n connection.stop();\r\n };\r\n\r\n $(connection).triggerHandler(events.onStarting);\r\n\r\n url = _signalR.transports._logic.prepareQueryString(connection, url);\r\n\r\n connection.log(\"Negotiating with '\" + url + \"'.\");\r\n\r\n // Save the ajax negotiate request object so we can abort it if stop is called while the request is in flight.\r\n connection._.negotiateRequest = function () {\r\n var res,\r\n redirects = 0,\r\n MAX_REDIRECTS = 100,\r\n keepAliveData,\r\n protocolError,\r\n transports = [],\r\n supportedTransports = [],\r\n negotiate = function negotiate(connection, onSuccess) {\r\n var url = _signalR.transports._logic.prepareQueryString(connection, connection.url + \"/negotiate\");\r\n connection.log(\"Negotiating with '\" + url + \"'.\");\r\n var options = {\r\n url: url,\r\n error: function error(_error, statusText) {\r\n // We don't want to cause any errors if we're aborting our own negotiate request.\r\n if (statusText !== _negotiateAbortText) {\r\n onFailed(_error, connection);\r\n } else {\r\n // This rejection will noop if the deferred has already been resolved or rejected.\r\n deferred.reject(_signalR._.error(resources.stoppedWhileNegotiating, null /* error */, connection._.negotiateRequest));\r\n }\r\n },\r\n success: onSuccess\r\n };\r\n\r\n if (connection.accessToken) {\r\n options.headers = { \"Authorization\": \"Bearer \" + connection.accessToken };\r\n }\r\n\r\n return _signalR.transports._logic.ajax(connection, options);\r\n },\r\n callback = function callback(result) {\r\n try {\r\n res = connection._parseResponse(result);\r\n } catch (error) {\r\n onFailed(_signalR._.error(resources.errorParsingNegotiateResponse, error), connection);\r\n return;\r\n }\r\n\r\n // Check if the server is an ASP.NET Core app\r\n if (res.availableTransports) {\r\n protocolError = _signalR._.error(resources.aspnetCoreSignalrServer);\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n return;\r\n }\r\n\r\n if (!res.ProtocolVersion || connection.supportedProtocols.indexOf(res.ProtocolVersion) === -1) {\r\n protocolError = _signalR._.error(_signalR._.format(resources.protocolIncompatible, connection.clientProtocol, res.ProtocolVersion));\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n\r\n return;\r\n }\r\n\r\n // Check for a redirect response (which must have a ProtocolVersion of 2.0 or greater)\r\n // ProtocolVersion 2.1 is the highest supported by the client, so we can just check for 2.0 or 2.1 for now\r\n // instead of trying to do proper version string comparison in JavaScript.\r\n if (connection.negotiateRedirectSupportedProtocols.indexOf(res.ProtocolVersion) !== -1) {\r\n if (res.Error) {\r\n protocolError = _signalR._.error(_signalR._.format(resources.errorFromServer, res.Error));\r\n $(connection).triggerHandler(events.onError, [protocolError]);\r\n deferred.reject(protocolError);\r\n return;\r\n } else if (res.RedirectUrl) {\r\n if (redirects === MAX_REDIRECTS) {\r\n onFailed(_signalR._.error(resources.errorRedirectionExceedsLimit), connection);\r\n return;\r\n }\r\n\r\n if (config.transport === \"auto\") {\r\n // Redirected connections do not support foreverFrame\r\n config.transport = [\"webSockets\", \"serverSentEvents\", \"longPolling\"];\r\n }\r\n\r\n connection.log(\"Received redirect to: \" + res.RedirectUrl);\r\n connection.accessToken = res.AccessToken;\r\n\r\n var splitUrlAndQs = res.RedirectUrl.split(\"?\", 2);\r\n setConnectionUrl(connection, splitUrlAndQs[0]);\r\n\r\n // Update redirectQs with query string from only the most recent RedirectUrl.\r\n connection._.redirectQs = splitUrlAndQs.length === 2 ? splitUrlAndQs[1] : null;\r\n\r\n if (connection.ajaxDataType === \"jsonp\" && connection.accessToken) {\r\n onFailed(_signalR._.error(resources.jsonpNotSupportedWithAccessToken), connection);\r\n return;\r\n }\r\n\r\n redirects++;\r\n negotiate(connection, callback);\r\n return;\r\n }\r\n }\r\n\r\n keepAliveData = connection._.keepAliveData;\r\n connection.appRelativeUrl = res.Url;\r\n connection.id = res.ConnectionId;\r\n connection.token = res.ConnectionToken;\r\n connection.webSocketServerUrl = res.WebSocketServerUrl;\r\n\r\n // The long poll timeout is the ConnectionTimeout plus 10 seconds\r\n connection._.pollTimeout = res.ConnectionTimeout * 1000 + 10000; // in ms\r\n\r\n // Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect\r\n // after res.DisconnectTimeout seconds.\r\n connection.disconnectTimeout = res.DisconnectTimeout * 1000; // in ms\r\n\r\n // Add the TransportConnectTimeout from the response to the transportConnectTimeout from the client to calculate the total timeout\r\n connection._.totalTransportConnectTimeout = connection.transportConnectTimeout + res.TransportConnectTimeout * 1000;\r\n\r\n // If we have a keep alive\r\n if (res.KeepAliveTimeout) {\r\n // Register the keep alive data as activated\r\n keepAliveData.activated = true;\r\n\r\n // Timeout to designate when to force the connection into reconnecting converted to milliseconds\r\n keepAliveData.timeout = res.KeepAliveTimeout * 1000;\r\n\r\n // Timeout to designate when to warn the developer that the connection may be dead or is not responding.\r\n keepAliveData.timeoutWarning = keepAliveData.timeout * connection.keepAliveWarnAt;\r\n\r\n // Instantiate the frequency in which we check the keep alive. It must be short in order to not miss/pick up any changes\r\n connection._.beatInterval = (keepAliveData.timeout - keepAliveData.timeoutWarning) / 3;\r\n } else {\r\n keepAliveData.activated = false;\r\n }\r\n\r\n connection.reconnectWindow = connection.disconnectTimeout + (keepAliveData.timeout || 0);\r\n\r\n $.each(_signalR.transports, function (key) {\r\n if (key.indexOf(\"_\") === 0 || key === \"webSockets\" && !res.TryWebSockets) {\r\n return true;\r\n }\r\n supportedTransports.push(key);\r\n });\r\n\r\n if ($.isArray(config.transport)) {\r\n $.each(config.transport, function (_, transport) {\r\n if ($.inArray(transport, supportedTransports) >= 0) {\r\n transports.push(transport);\r\n }\r\n });\r\n } else if (config.transport === \"auto\") {\r\n transports = supportedTransports;\r\n } else if ($.inArray(config.transport, supportedTransports) >= 0) {\r\n transports.push(config.transport);\r\n }\r\n\r\n _initialize(transports);\r\n };\r\n\r\n return negotiate(connection, callback);\r\n }();\r\n\r\n return deferred.promise();\r\n },\r\n\r\n starting: function starting(callback) {\r\n /// <summary>Adds a callback that will be invoked before anything is sent over the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute before the connection is fully instantiated.</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onStarting, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n send: function send(data) {\r\n /// <summary>Sends data over the connection</summary>\r\n /// <param name=\"data\" type=\"String\">The data to send over the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n // Connection hasn't been started yet\r\n throw new Error(\"SignalR: Connection must be started before data can be sent. Call .start() before .send()\");\r\n }\r\n\r\n if (connection.state === _signalR.connectionState.connecting) {\r\n // Connection hasn't been started yet\r\n throw new Error(\"SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.\");\r\n }\r\n\r\n connection.transport.send(connection, data);\r\n // REVIEW: Should we return deferred here?\r\n return connection;\r\n },\r\n\r\n received: function received(callback) {\r\n /// <summary>Adds a callback that will be invoked after anything is received over the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when any data is received on the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReceived, function (e, data) {\r\n callback.call(connection, data);\r\n });\r\n return connection;\r\n },\r\n\r\n stateChanged: function stateChanged(callback) {\r\n /// <summary>Adds a callback that will be invoked when the connection state changes</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection state changes</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onStateChanged, function (e, data) {\r\n callback.call(connection, data);\r\n });\r\n return connection;\r\n },\r\n\r\n error: function error(callback) {\r\n /// <summary>Adds a callback that will be invoked after an error occurs with the connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when an error occurs on the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onError, function (e, errorData, sendData) {\r\n connection.lastError = errorData;\r\n // In practice 'errorData' is the SignalR built error object.\r\n // In practice 'sendData' is undefined for all error events except those triggered by\r\n // 'ajaxSend' and 'webSockets.send'.'sendData' is the original send payload.\r\n callback.call(connection, errorData, sendData);\r\n });\r\n return connection;\r\n },\r\n\r\n disconnected: function disconnected(callback) {\r\n /// <summary>Adds a callback that will be invoked when the client disconnects</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is broken</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onDisconnect, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n connectionSlow: function connectionSlow(callback) {\r\n /// <summary>Adds a callback that will be invoked when the client detects a slow connection</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is slow</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onConnectionSlow, function (e, data) {\r\n callback.call(connection);\r\n });\r\n\r\n return connection;\r\n },\r\n\r\n reconnecting: function reconnecting(callback) {\r\n /// <summary>Adds a callback that will be invoked when the underlying transport begins reconnecting</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection enters a reconnecting state</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReconnecting, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n reconnected: function reconnected(callback) {\r\n /// <summary>Adds a callback that will be invoked when the underlying transport reconnects</summary>\r\n /// <param name=\"callback\" type=\"Function\">A callback function to execute when the connection is restored</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this;\r\n $(connection).bind(events.onReconnect, function (e, data) {\r\n callback.call(connection);\r\n });\r\n return connection;\r\n },\r\n\r\n stop: function stop(async, notifyServer) {\r\n /// <summary>Stops listening</summary>\r\n /// <param name=\"async\" type=\"Boolean\">Whether or not to asynchronously abort the connection</param>\r\n /// <param name=\"notifyServer\" type=\"Boolean\">Whether we want to notify the server that we are aborting the connection</param>\r\n /// <returns type=\"signalR\" />\r\n var connection = this,\r\n\r\n // Save deferral because this is always cleaned up\r\n deferral = connection._deferral;\r\n\r\n // Verify that we've bound a load event.\r\n if (connection._.deferredStartHandler) {\r\n // Unbind the event.\r\n _pageWindow.unbind(\"load\", connection._.deferredStartHandler);\r\n }\r\n\r\n // Always clean up private non-timeout based state.\r\n delete connection._.config;\r\n delete connection._.deferredStartHandler;\r\n\r\n // This needs to be checked despite the connection state because a connection start can be deferred until page load.\r\n // If we've deferred the start due to a page load we need to unbind the \"onLoad\" -> start event.\r\n if (!_pageLoaded && (!connection._.config || connection._.config.waitForPageLoad === true)) {\r\n connection.log(\"Stopping connection prior to negotiate.\");\r\n\r\n // If we have a deferral we should reject it\r\n if (deferral) {\r\n deferral.reject(_signalR._.error(resources.stoppedWhileLoading));\r\n }\r\n\r\n // Short-circuit because the start has not been fully started.\r\n return;\r\n }\r\n\r\n if (connection.state === _signalR.connectionState.disconnected) {\r\n return;\r\n }\r\n\r\n connection.log(\"Stopping connection.\");\r\n\r\n // Clear this no matter what\r\n window.clearTimeout(connection._.beatHandle);\r\n window.clearInterval(connection._.pingIntervalId);\r\n\r\n if (connection.transport) {\r\n connection.transport.stop(connection);\r\n\r\n if (notifyServer !== false) {\r\n connection.transport.abort(connection, async);\r\n }\r\n\r\n if (supportsKeepAlive(connection)) {\r\n _signalR.transports._logic.stopMonitoringKeepAlive(connection);\r\n }\r\n\r\n connection.transport = null;\r\n }\r\n\r\n if (connection._.negotiateRequest) {\r\n // If the negotiation request has already completed this will noop.\r\n connection._.negotiateRequest.abort(_negotiateAbortText);\r\n delete connection._.negotiateRequest;\r\n }\r\n\r\n // Ensure that initHandler.stop() is called before connection._deferral is deleted\r\n if (connection._.initHandler) {\r\n connection._.initHandler.stop();\r\n }\r\n\r\n delete connection._deferral;\r\n delete connection.messageId;\r\n delete connection.groupsToken;\r\n delete connection.id;\r\n delete connection._.pingIntervalId;\r\n delete connection._.lastMessageAt;\r\n delete connection._.lastActiveAt;\r\n\r\n // Clear out our message buffer\r\n connection._.connectingMessageBuffer.clear();\r\n\r\n // Clean up this event\r\n $(connection).unbind(events.onStart);\r\n\r\n // Reset the URL and clear the access token\r\n delete connection.accessToken;\r\n delete connection.protocol;\r\n delete connection.host;\r\n delete connection.baseUrl;\r\n delete connection.wsProtocol;\r\n delete connection.contentType;\r\n connection.url = connection._originalUrl;\r\n connection._.redirectQs = null;\r\n\r\n // Trigger the disconnect event\r\n changeState(connection, connection.state, _signalR.connectionState.disconnected);\r\n $(connection).triggerHandler(events.onDisconnect);\r\n\r\n return connection;\r\n },\r\n\r\n log: function log(msg) {\r\n _log(msg, this.logging);\r\n }\r\n };\r\n\r\n _signalR.fn.init.prototype = _signalR.fn;\r\n\r\n _signalR.noConflict = function () {\r\n /// <summary>Reinstates the original value of $.connection and returns the signalR object for manual assignment</summary>\r\n /// <returns type=\"signalR\" />\r\n if ($.connection === _signalR) {\r\n $.connection = _connection;\r\n }\r\n return _signalR;\r\n };\r\n\r\n if ($.connection) {\r\n _connection = $.connection;\r\n }\r\n\r\n $.connection = $.signalR = _signalR;\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.common.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n startAbortText = \"__Start Aborted__\",\r\n transportLogic;\r\n\r\n signalR.transports = {};\r\n\r\n function beat(connection) {\r\n if (connection._.keepAliveData.monitoring) {\r\n checkIfAlive(connection);\r\n }\r\n\r\n // Ensure that we successfully marked active before continuing the heartbeat.\r\n if (transportLogic.markActive(connection)) {\r\n connection._.beatHandle = window.setTimeout(function () {\r\n beat(connection);\r\n }, connection._.beatInterval);\r\n }\r\n }\r\n\r\n function checkIfAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData,\r\n timeElapsed;\r\n\r\n // Only check if we're connected\r\n if (connection.state === signalR.connectionState.connected) {\r\n timeElapsed = new Date().getTime() - connection._.lastMessageAt;\r\n\r\n // Check if the keep alive has completely timed out\r\n if (timeElapsed >= keepAliveData.timeout) {\r\n connection.log(\"Keep alive timed out. Notifying transport that connection has been lost.\");\r\n\r\n // Notify transport that the connection has been lost\r\n connection.transport.lostConnection(connection);\r\n } else if (timeElapsed >= keepAliveData.timeoutWarning) {\r\n // This is to assure that the user only gets a single warning\r\n if (!keepAliveData.userNotified) {\r\n connection.log(\"Keep alive has been missed, connection may be dead/slow.\");\r\n $(connection).triggerHandler(events.onConnectionSlow);\r\n keepAliveData.userNotified = true;\r\n }\r\n } else {\r\n keepAliveData.userNotified = false;\r\n }\r\n }\r\n }\r\n\r\n function getAjaxUrl(connection, path) {\r\n var url = connection.url + path;\r\n\r\n if (connection.transport) {\r\n url += \"?transport=\" + connection.transport.name;\r\n }\r\n\r\n return transportLogic.prepareQueryString(connection, url);\r\n }\r\n\r\n function InitHandler(connection) {\r\n this.connection = connection;\r\n\r\n this.startRequested = false;\r\n this.startCompleted = false;\r\n this.connectionStopped = false;\r\n }\r\n\r\n InitHandler.prototype = {\r\n start: function start(transport, onSuccess, onFallback) {\r\n var that = this,\r\n connection = that.connection,\r\n failCalled = false;\r\n\r\n if (that.startRequested || that.connectionStopped) {\r\n connection.log(\"WARNING! \" + transport.name + \" transport cannot be started. Initialization ongoing or completed.\");\r\n return;\r\n }\r\n\r\n connection.log(transport.name + \" transport starting.\");\r\n\r\n transport.start(connection, function () {\r\n if (!failCalled) {\r\n that.initReceived(transport, onSuccess);\r\n }\r\n }, function (error) {\r\n // Don't allow the same transport to cause onFallback to be called twice\r\n if (!failCalled) {\r\n failCalled = true;\r\n that.transportFailed(transport, error, onFallback);\r\n }\r\n\r\n // Returns true if the transport should stop;\r\n // false if it should attempt to reconnect\r\n return !that.startCompleted || that.connectionStopped;\r\n });\r\n\r\n that.transportTimeoutHandle = window.setTimeout(function () {\r\n if (!failCalled) {\r\n failCalled = true;\r\n connection.log(transport.name + \" transport timed out when trying to connect.\");\r\n that.transportFailed(transport, undefined, onFallback);\r\n }\r\n }, connection._.totalTransportConnectTimeout);\r\n },\r\n\r\n stop: function stop() {\r\n this.connectionStopped = true;\r\n window.clearTimeout(this.transportTimeoutHandle);\r\n signalR.transports._logic.tryAbortStartRequest(this.connection);\r\n },\r\n\r\n initReceived: function initReceived(transport, onSuccess) {\r\n var that = this,\r\n connection = that.connection;\r\n\r\n if (that.startRequested) {\r\n connection.log(\"WARNING! The client received multiple init messages.\");\r\n return;\r\n }\r\n\r\n if (that.connectionStopped) {\r\n return;\r\n }\r\n\r\n that.startRequested = true;\r\n window.clearTimeout(that.transportTimeoutHandle);\r\n\r\n connection.log(transport.name + \" transport connected. Initiating start request.\");\r\n signalR.transports._logic.ajaxStart(connection, function () {\r\n that.startCompleted = true;\r\n onSuccess();\r\n });\r\n },\r\n\r\n transportFailed: function transportFailed(transport, error, onFallback) {\r\n var connection = this.connection,\r\n deferred = connection._deferral,\r\n wrappedError;\r\n\r\n if (this.connectionStopped) {\r\n return;\r\n }\r\n\r\n window.clearTimeout(this.transportTimeoutHandle);\r\n\r\n if (!this.startRequested) {\r\n transport.stop(connection);\r\n\r\n connection.log(transport.name + \" transport failed to connect. Attempting to fall back.\");\r\n onFallback();\r\n } else if (!this.startCompleted) {\r\n // Do not attempt to fall back if a start request is ongoing during a transport failure.\r\n // Instead, trigger an error and stop the connection.\r\n wrappedError = signalR._.error(signalR.resources.errorDuringStartRequest, error);\r\n\r\n connection.log(transport.name + \" transport failed during the start request. Stopping the connection.\");\r\n $(connection).triggerHandler(events.onError, [wrappedError]);\r\n if (deferred) {\r\n deferred.reject(wrappedError);\r\n }\r\n\r\n connection.stop();\r\n } else {\r\n // The start request has completed, but the connection has not stopped.\r\n // No need to do anything here. The transport should attempt its normal reconnect logic.\r\n }\r\n }\r\n };\r\n\r\n transportLogic = signalR.transports._logic = {\r\n ajax: function ajax(connection, options) {\r\n return $.ajax($.extend( /*deep copy*/true, {}, $.signalR.ajaxDefaults, {\r\n type: \"GET\",\r\n data: {},\r\n xhrFields: { withCredentials: connection.withCredentials },\r\n contentType: connection.contentType,\r\n dataType: connection.ajaxDataType\r\n }, options));\r\n },\r\n\r\n pingServer: function pingServer(connection) {\r\n /// <summary>Pings the server</summary>\r\n /// <param name=\"connection\" type=\"signalr\">Connection associated with the server ping</param>\r\n /// <returns type=\"signalR\" />\r\n var url,\r\n xhr,\r\n deferral = $.Deferred();\r\n\r\n if (connection.transport) {\r\n url = connection.url + \"/ping\";\r\n\r\n url = transportLogic.addQs(url, connection.qs);\r\n\r\n xhr = transportLogic.ajax(connection, {\r\n url: url,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(result);\r\n } catch (error) {\r\n deferral.reject(signalR._.transportError(signalR.resources.pingServerFailedParse, connection.transport, error, xhr));\r\n connection.stop();\r\n return;\r\n }\r\n\r\n if (data.Response === \"pong\") {\r\n deferral.resolve();\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR._.format(signalR.resources.pingServerFailedInvalidResponse, result), connection.transport, null /* error */\r\n , xhr));\r\n }\r\n },\r\n error: function error(_error2) {\r\n if (_error2.status === 401 || _error2.status === 403) {\r\n deferral.reject(signalR._.transportError(signalR._.format(signalR.resources.pingServerFailedStatusCode, _error2.status), connection.transport, _error2, xhr));\r\n connection.stop();\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR.resources.pingServerFailed, connection.transport, _error2, xhr));\r\n }\r\n }\r\n });\r\n } else {\r\n deferral.reject(signalR._.transportError(signalR.resources.noConnectionTransport, connection.transport));\r\n }\r\n\r\n return deferral.promise();\r\n },\r\n\r\n prepareQueryString: function prepareQueryString(connection, url) {\r\n var preparedUrl;\r\n\r\n // Use addQs to start since it handles the ?/& prefix for us\r\n preparedUrl = transportLogic.addQs(url, \"clientProtocol=\" + connection.clientProtocol);\r\n\r\n if (typeof connection._.redirectQs === \"string\") {\r\n // Add the redirect-specified query string params if any\r\n preparedUrl = transportLogic.addQs(preparedUrl, connection._.redirectQs);\r\n } else {\r\n // Otherwise, add the user-specified query string params if any\r\n preparedUrl = transportLogic.addQs(preparedUrl, connection.qs);\r\n }\r\n\r\n if (connection.token) {\r\n preparedUrl += \"&connectionToken=\" + window.encodeURIComponent(connection.token);\r\n }\r\n\r\n if (connection.data) {\r\n preparedUrl += \"&connectionData=\" + window.encodeURIComponent(connection.data);\r\n }\r\n\r\n return preparedUrl;\r\n },\r\n\r\n addQs: function addQs(url, qs) {\r\n var appender = url.indexOf(\"?\") !== -1 ? \"&\" : \"?\",\r\n firstChar;\r\n\r\n if (!qs) {\r\n return url;\r\n }\r\n\r\n if ((typeof qs === 'undefined' ? 'undefined' : _typeof(qs)) === \"object\") {\r\n return url + appender + $.param(qs);\r\n }\r\n\r\n if (typeof qs === \"string\") {\r\n firstChar = qs.charAt(0);\r\n\r\n if (firstChar === \"?\" || firstChar === \"&\") {\r\n appender = \"\";\r\n }\r\n\r\n return url + appender + qs;\r\n }\r\n\r\n throw new Error(\"Query string property must be either a string or object.\");\r\n },\r\n\r\n // BUG #2953: The url needs to be same otherwise it will cause a memory leak\r\n getUrl: function getUrl(connection, transport, reconnecting, poll, ajaxPost) {\r\n /// <summary>Gets the url for making a GET based connect request</summary>\r\n var baseUrl = transport === \"webSockets\" ? \"\" : connection.baseUrl,\r\n url = baseUrl + connection.appRelativeUrl,\r\n qs = \"transport=\" + transport;\r\n\r\n if (!ajaxPost && connection.groupsToken) {\r\n qs += \"&groupsToken=\" + window.encodeURIComponent(connection.groupsToken);\r\n }\r\n\r\n if (!reconnecting) {\r\n url += \"/connect\";\r\n } else {\r\n if (poll) {\r\n // longPolling transport specific\r\n url += \"/poll\";\r\n } else {\r\n url += \"/reconnect\";\r\n }\r\n\r\n if (!ajaxPost && connection.messageId) {\r\n qs += \"&messageId=\" + window.encodeURIComponent(connection.messageId);\r\n }\r\n }\r\n url += \"?\" + qs;\r\n url = transportLogic.prepareQueryString(connection, url);\r\n\r\n // With sse or ws, access_token in request header is not supported\r\n if (connection.transport && connection.accessToken) {\r\n if (connection.transport.name === \"serverSentEvents\" || connection.transport.name === \"webSockets\") {\r\n url += \"&access_token=\" + window.encodeURIComponent(connection.accessToken);\r\n }\r\n }\r\n\r\n if (!ajaxPost) {\r\n url += \"&tid=\" + Math.floor(Math.random() * 11);\r\n }\r\n\r\n return url;\r\n },\r\n\r\n maximizePersistentResponse: function maximizePersistentResponse(minPersistentResponse) {\r\n return {\r\n MessageId: minPersistentResponse.C,\r\n Messages: minPersistentResponse.M,\r\n Initialized: typeof minPersistentResponse.S !== \"undefined\" ? true : false,\r\n ShouldReconnect: typeof minPersistentResponse.T !== \"undefined\" ? true : false,\r\n LongPollDelay: minPersistentResponse.L,\r\n GroupsToken: minPersistentResponse.G,\r\n Error: minPersistentResponse.E\r\n };\r\n },\r\n\r\n updateGroups: function updateGroups(connection, groupsToken) {\r\n if (groupsToken) {\r\n connection.groupsToken = groupsToken;\r\n }\r\n },\r\n\r\n stringifySend: function stringifySend(connection, message) {\r\n if (typeof message === \"string\" || typeof message === \"undefined\" || message === null) {\r\n return message;\r\n }\r\n return connection.json.stringify(message);\r\n },\r\n\r\n ajaxSend: function ajaxSend(connection, data) {\r\n var payload = transportLogic.stringifySend(connection, data),\r\n url = getAjaxUrl(connection, \"/send\"),\r\n xhr,\r\n onFail = function onFail(error, connection) {\r\n $(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.sendFailed, connection.transport, error, xhr), data]);\r\n };\r\n\r\n xhr = transportLogic.ajax(connection, {\r\n url: url,\r\n type: connection.ajaxDataType === \"jsonp\" ? \"GET\" : \"POST\",\r\n contentType: signalR._.defaultContentType,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n data: {\r\n data: payload\r\n },\r\n success: function success(result) {\r\n var res;\r\n\r\n if (result) {\r\n try {\r\n res = connection._parseResponse(result);\r\n } catch (error) {\r\n onFail(error, connection);\r\n connection.stop();\r\n return;\r\n }\r\n\r\n transportLogic.triggerReceived(connection, res);\r\n }\r\n },\r\n error: function error(_error3, textStatus) {\r\n if (textStatus === \"abort\" || textStatus === \"parsererror\") {\r\n // The parsererror happens for sends that don't return any data, and hence\r\n // don't write the jsonp callback to the response. This is harder to fix on the server\r\n // so just hack around it on the client for now.\r\n return;\r\n }\r\n\r\n onFail(_error3, connection);\r\n }\r\n });\r\n\r\n return xhr;\r\n },\r\n\r\n ajaxAbort: function ajaxAbort(connection, async) {\r\n if (typeof connection.transport === \"undefined\") {\r\n return;\r\n }\r\n\r\n // Async by default unless explicitly overidden\r\n async = typeof async === \"undefined\" ? true : async;\r\n\r\n var url = getAjaxUrl(connection, \"/abort\");\r\n\r\n transportLogic.ajax(connection, {\r\n url: url,\r\n async: async,\r\n timeout: 1000,\r\n type: \"POST\",\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n dataType: \"text\" // We don't want to use JSONP here even when JSONP is enabled\r\n });\r\n\r\n connection.log(\"Fired ajax abort async = \" + async + \".\");\r\n },\r\n\r\n ajaxStart: function ajaxStart(connection, onSuccess) {\r\n var rejectDeferred = function rejectDeferred(error) {\r\n var deferred = connection._deferral;\r\n if (deferred) {\r\n deferred.reject(error);\r\n }\r\n },\r\n triggerStartError = function triggerStartError(error) {\r\n connection.log(\"The start request failed. Stopping the connection.\");\r\n $(connection).triggerHandler(events.onError, [error]);\r\n rejectDeferred(error);\r\n connection.stop();\r\n };\r\n\r\n connection._.startRequest = transportLogic.ajax(connection, {\r\n url: getAjaxUrl(connection, \"/start\"),\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result, statusText, xhr) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(result);\r\n } catch (error) {\r\n triggerStartError(signalR._.error(signalR._.format(signalR.resources.errorParsingStartResponse, result), error, xhr));\r\n return;\r\n }\r\n\r\n if (data.Response === \"started\") {\r\n onSuccess();\r\n } else {\r\n triggerStartError(signalR._.error(signalR._.format(signalR.resources.invalidStartResponse, result), null /* error */, xhr));\r\n }\r\n },\r\n error: function error(xhr, statusText, _error4) {\r\n if (statusText !== startAbortText) {\r\n triggerStartError(signalR._.error(signalR.resources.errorDuringStartRequest, _error4, xhr));\r\n } else {\r\n // Stop has been called, no need to trigger the error handler\r\n // or stop the connection again with onStartError\r\n connection.log(\"The start request aborted because connection.stop() was called.\");\r\n rejectDeferred(signalR._.error(signalR.resources.stoppedDuringStartRequest, null /* error */, xhr));\r\n }\r\n }\r\n });\r\n },\r\n\r\n tryAbortStartRequest: function tryAbortStartRequest(connection) {\r\n if (connection._.startRequest) {\r\n // If the start request has already completed this will noop.\r\n connection._.startRequest.abort(startAbortText);\r\n delete connection._.startRequest;\r\n }\r\n },\r\n\r\n tryInitialize: function tryInitialize(connection, persistentResponse, onInitialized) {\r\n if (persistentResponse.Initialized && onInitialized) {\r\n onInitialized();\r\n } else if (persistentResponse.Initialized) {\r\n connection.log(\"WARNING! The client received an init message after reconnecting.\");\r\n }\r\n },\r\n\r\n triggerReceived: function triggerReceived(connection, data) {\r\n if (!connection._.connectingMessageBuffer.tryBuffer(data)) {\r\n $(connection).triggerHandler(events.onReceived, [data]);\r\n }\r\n },\r\n\r\n processMessages: function processMessages(connection, minData, onInitialized) {\r\n var data;\r\n\r\n if (minData && typeof minData.I !== \"undefined\") {\r\n // This is a response to a message the client sent\r\n transportLogic.triggerReceived(connection, minData);\r\n return;\r\n }\r\n\r\n // Update the last message time stamp\r\n transportLogic.markLastMessage(connection);\r\n\r\n if (minData) {\r\n // This is a message send directly to the client\r\n data = transportLogic.maximizePersistentResponse(minData);\r\n\r\n if (data.Error) {\r\n // This is a global error, stop the connection.\r\n connection.log(\"Received an error message from the server: \" + minData.E);\r\n $(connection).triggerHandler(signalR.events.onError, [signalR._.error(minData.E, /* source */\"ServerError\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n return;\r\n }\r\n\r\n transportLogic.updateGroups(connection, data.GroupsToken);\r\n\r\n if (data.MessageId) {\r\n connection.messageId = data.MessageId;\r\n }\r\n\r\n if (data.Messages) {\r\n $.each(data.Messages, function (index, message) {\r\n transportLogic.triggerReceived(connection, message);\r\n });\r\n\r\n transportLogic.tryInitialize(connection, data, onInitialized);\r\n }\r\n }\r\n },\r\n\r\n monitorKeepAlive: function monitorKeepAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData;\r\n\r\n // If we haven't initiated the keep alive timeouts then we need to\r\n if (!keepAliveData.monitoring) {\r\n keepAliveData.monitoring = true;\r\n\r\n transportLogic.markLastMessage(connection);\r\n\r\n // Save the function so we can unbind it on stop\r\n connection._.keepAliveData.reconnectKeepAliveUpdate = function () {\r\n // Mark a new message so that keep alive doesn't time out connections\r\n transportLogic.markLastMessage(connection);\r\n };\r\n\r\n // Update Keep alive on reconnect\r\n $(connection).bind(events.onReconnect, connection._.keepAliveData.reconnectKeepAliveUpdate);\r\n\r\n connection.log(\"Now monitoring keep alive with a warning timeout of \" + keepAliveData.timeoutWarning + \", keep alive timeout of \" + keepAliveData.timeout + \" and disconnecting timeout of \" + connection.disconnectTimeout);\r\n } else {\r\n connection.log(\"Tried to monitor keep alive but it's already being monitored.\");\r\n }\r\n },\r\n\r\n stopMonitoringKeepAlive: function stopMonitoringKeepAlive(connection) {\r\n var keepAliveData = connection._.keepAliveData;\r\n\r\n // Only attempt to stop the keep alive monitoring if its being monitored\r\n if (keepAliveData.monitoring) {\r\n // Stop monitoring\r\n keepAliveData.monitoring = false;\r\n\r\n // Remove the updateKeepAlive function from the reconnect event\r\n $(connection).unbind(events.onReconnect, connection._.keepAliveData.reconnectKeepAliveUpdate);\r\n\r\n // Clear all the keep alive data\r\n connection._.keepAliveData = {};\r\n connection.log(\"Stopping the monitoring of the keep alive.\");\r\n }\r\n },\r\n\r\n startHeartbeat: function startHeartbeat(connection) {\r\n connection._.lastActiveAt = new Date().getTime();\r\n beat(connection);\r\n },\r\n\r\n markLastMessage: function markLastMessage(connection) {\r\n connection._.lastMessageAt = new Date().getTime();\r\n },\r\n\r\n markActive: function markActive(connection) {\r\n if (transportLogic.verifyLastActive(connection)) {\r\n connection._.lastActiveAt = new Date().getTime();\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n\r\n isConnectedOrReconnecting: function isConnectedOrReconnecting(connection) {\r\n return connection.state === signalR.connectionState.connected || connection.state === signalR.connectionState.reconnecting;\r\n },\r\n\r\n ensureReconnectingState: function ensureReconnectingState(connection) {\r\n if (changeState(connection, signalR.connectionState.connected, signalR.connectionState.reconnecting) === true) {\r\n $(connection).triggerHandler(events.onReconnecting);\r\n }\r\n return connection.state === signalR.connectionState.reconnecting;\r\n },\r\n\r\n clearReconnectTimeout: function clearReconnectTimeout(connection) {\r\n if (connection && connection._.reconnectTimeout) {\r\n window.clearTimeout(connection._.reconnectTimeout);\r\n delete connection._.reconnectTimeout;\r\n }\r\n },\r\n\r\n verifyLastActive: function verifyLastActive(connection) {\r\n if (new Date().getTime() - connection._.lastActiveAt >= connection.reconnectWindow) {\r\n var message = signalR._.format(signalR.resources.reconnectWindowTimeout, new Date(connection._.lastActiveAt), connection.reconnectWindow);\r\n connection.log(message);\r\n $(connection).triggerHandler(events.onError, [signalR._.error(message, /* source */\"TimeoutException\")]);\r\n connection.stop( /* async */false, /* notifyServer */false);\r\n return false;\r\n }\r\n\r\n return true;\r\n },\r\n\r\n reconnect: function reconnect(connection, transportName) {\r\n var transport = signalR.transports[transportName];\r\n\r\n // We should only set a reconnectTimeout if we are currently connected\r\n // and a reconnectTimeout isn't already set.\r\n if (transportLogic.isConnectedOrReconnecting(connection) && !connection._.reconnectTimeout) {\r\n // Need to verify before the setTimeout occurs because an application sleep could occur during the setTimeout duration.\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n connection._.reconnectTimeout = window.setTimeout(function () {\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n transport.stop(connection);\r\n\r\n if (transportLogic.ensureReconnectingState(connection)) {\r\n connection.log(transportName + \" reconnecting.\");\r\n transport.start(connection);\r\n }\r\n }, connection.reconnectDelay);\r\n }\r\n },\r\n\r\n handleParseFailure: function handleParseFailure(connection, result, error, onFailed, context) {\r\n var wrappedError = signalR._.transportError(signalR._.format(signalR.resources.parseFailed, result), connection.transport, error, context);\r\n\r\n // If we're in the initialization phase trigger onFailed, otherwise stop the connection.\r\n if (onFailed && onFailed(wrappedError)) {\r\n connection.log(\"Failed to parse server response while attempting to connect.\");\r\n } else {\r\n $(connection).triggerHandler(events.onError, [wrappedError]);\r\n connection.stop();\r\n }\r\n },\r\n\r\n initHandler: function initHandler(connection) {\r\n return new InitHandler(connection);\r\n },\r\n\r\n foreverFrame: {\r\n count: 0,\r\n connections: {}\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.webSockets.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic;\r\n\r\n signalR.transports.webSockets = {\r\n name: \"webSockets\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n send: function send(connection, data) {\r\n var payload = transportLogic.stringifySend(connection, data);\r\n\r\n try {\r\n connection.socket.send(payload);\r\n } catch (ex) {\r\n $(connection).triggerHandler(events.onError, [signalR._.transportError(signalR.resources.webSocketsInvalidState, connection.transport, ex, connection.socket), data]);\r\n }\r\n },\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n var url,\r\n opened = false,\r\n that = this,\r\n reconnecting = !onSuccess,\r\n $connection = $(connection);\r\n\r\n if (!window.WebSocket) {\r\n onFailed();\r\n return;\r\n }\r\n\r\n if (!connection.socket) {\r\n if (connection.webSocketServerUrl) {\r\n url = connection.webSocketServerUrl;\r\n } else {\r\n url = connection.wsProtocol + connection.host;\r\n }\r\n\r\n url += transportLogic.getUrl(connection, this.name, reconnecting);\r\n\r\n connection.log(\"Connecting to websocket endpoint '\" + url + \"'.\");\r\n connection.socket = new window.WebSocket(url);\r\n\r\n connection.socket.onopen = function () {\r\n opened = true;\r\n connection.log(\"Websocket opened.\");\r\n\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n $connection.triggerHandler(events.onReconnect);\r\n }\r\n };\r\n\r\n connection.socket.onclose = function (event) {\r\n var error;\r\n\r\n // Only handle a socket close if the close is from the current socket.\r\n // Sometimes on disconnect the server will push down an onclose event\r\n // to an expired socket.\r\n\r\n if (this === connection.socket) {\r\n if (opened && typeof event.wasClean !== \"undefined\" && event.wasClean === false) {\r\n // Ideally this would use the websocket.onerror handler (rather than checking wasClean in onclose) but\r\n // I found in some circumstances Chrome won't call onerror. This implementation seems to work on all browsers.\r\n error = signalR._.transportError(signalR.resources.webSocketClosed, connection.transport, event);\r\n\r\n connection.log(\"Unclean disconnect from websocket: \" + (event.reason || \"[no reason given].\"));\r\n } else {\r\n connection.log(\"Websocket closed.\");\r\n }\r\n\r\n if (!onFailed || !onFailed(error)) {\r\n if (error) {\r\n $(connection).triggerHandler(events.onError, [error]);\r\n }\r\n\r\n that.reconnect(connection);\r\n }\r\n }\r\n };\r\n\r\n connection.socket.onmessage = function (event) {\r\n var data;\r\n\r\n try {\r\n data = connection._parseResponse(event.data);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(connection, event.data, error, onFailed, event);\r\n return;\r\n }\r\n\r\n if (data) {\r\n transportLogic.processMessages(connection, data, onSuccess);\r\n }\r\n };\r\n }\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n transportLogic.reconnect(connection, this.name);\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n stop: function stop(connection) {\r\n // Don't trigger a reconnect after stopping\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (connection.socket) {\r\n connection.log(\"Closing the Websocket.\");\r\n connection.socket.close();\r\n connection.socket = null;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.serverSentEvents.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic,\r\n clearReconnectAttemptTimeout = function clearReconnectAttemptTimeout(connection) {\r\n window.clearTimeout(connection._.reconnectAttemptTimeoutHandle);\r\n delete connection._.reconnectAttemptTimeoutHandle;\r\n };\r\n\r\n signalR.transports.serverSentEvents = {\r\n name: \"serverSentEvents\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n timeOut: 3000,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n var that = this,\r\n opened = false,\r\n $connection = $(connection),\r\n reconnecting = !onSuccess,\r\n url;\r\n\r\n if (connection.eventSource) {\r\n connection.log(\"The connection already has an event source. Stopping it.\");\r\n connection.stop();\r\n }\r\n\r\n if (!window.EventSource) {\r\n if (onFailed) {\r\n connection.log(\"This browser doesn't support SSE.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n url = transportLogic.getUrl(connection, this.name, reconnecting);\r\n\r\n try {\r\n connection.log(\"Attempting to connect to SSE endpoint '\" + url + \"'.\");\r\n connection.eventSource = new window.EventSource(url, { withCredentials: connection.withCredentials });\r\n } catch (e) {\r\n connection.log(\"EventSource failed trying to connect with error \" + e.Message + \".\");\r\n if (onFailed) {\r\n // The connection failed, call the failed callback\r\n onFailed();\r\n } else {\r\n $connection.triggerHandler(events.onError, [signalR._.transportError(signalR.resources.eventSourceFailedToConnect, connection.transport, e)]);\r\n if (reconnecting) {\r\n // If we were reconnecting, rather than doing initial connect, then try reconnect again\r\n that.reconnect(connection);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (reconnecting) {\r\n connection._.reconnectAttemptTimeoutHandle = window.setTimeout(function () {\r\n if (opened === false) {\r\n // If we're reconnecting and the event source is attempting to connect,\r\n // don't keep retrying. This causes duplicate connections to spawn.\r\n if (connection.eventSource.readyState !== window.EventSource.OPEN) {\r\n // If we were reconnecting, rather than doing initial connect, then try reconnect again\r\n that.reconnect(connection);\r\n }\r\n }\r\n }, that.timeOut);\r\n }\r\n\r\n connection.eventSource.addEventListener(\"open\", function (e) {\r\n connection.log(\"EventSource connected.\");\r\n\r\n clearReconnectAttemptTimeout(connection);\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (opened === false) {\r\n opened = true;\r\n\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n $connection.triggerHandler(events.onReconnect);\r\n }\r\n }\r\n }, false);\r\n\r\n connection.eventSource.addEventListener(\"message\", function (e) {\r\n var res;\r\n\r\n // process messages\r\n if (e.data === \"initialized\") {\r\n return;\r\n }\r\n\r\n try {\r\n res = connection._parseResponse(e.data);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(connection, e.data, error, onFailed, e);\r\n return;\r\n }\r\n\r\n transportLogic.processMessages(connection, res, onSuccess);\r\n }, false);\r\n\r\n connection.eventSource.addEventListener(\"error\", function (e) {\r\n var error = signalR._.transportError(signalR.resources.eventSourceError, connection.transport, e);\r\n\r\n // Only handle an error if the error is from the current Event Source.\r\n // Sometimes on disconnect the server will push down an error event\r\n // to an expired Event Source.\r\n if (this !== connection.eventSource) {\r\n return;\r\n }\r\n\r\n if (onFailed && onFailed(error)) {\r\n return;\r\n }\r\n\r\n connection.log(\"EventSource readyState: \" + connection.eventSource.readyState + \".\");\r\n\r\n if (e.eventPhase === window.EventSource.CLOSED) {\r\n // We don't use the EventSource's native reconnect function as it\r\n // doesn't allow us to change the URL when reconnecting. We need\r\n // to change the URL to not include the /connect suffix, and pass\r\n // the last message id we received.\r\n connection.log(\"EventSource reconnecting due to the server connection ending.\");\r\n that.reconnect(connection);\r\n } else {\r\n // connection error\r\n connection.log(\"EventSource error.\");\r\n $connection.triggerHandler(events.onError, [error]);\r\n }\r\n }, false);\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n transportLogic.reconnect(connection, this.name);\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n stop: function stop(connection) {\r\n // Don't trigger a reconnect after stopping\r\n clearReconnectAttemptTimeout(connection);\r\n transportLogic.clearReconnectTimeout(connection);\r\n\r\n if (connection && connection.eventSource) {\r\n connection.log(\"EventSource calling close().\");\r\n connection.eventSource.close();\r\n connection.eventSource = null;\r\n delete connection.eventSource;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.foreverFrame.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n transportLogic = signalR.transports._logic,\r\n createFrame = function createFrame() {\r\n var frame = window.document.createElement(\"iframe\");\r\n frame.setAttribute(\"style\", \"position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;\");\r\n return frame;\r\n },\r\n\r\n // Used to prevent infinite loading icon spins in older versions of ie\r\n // We build this object inside a closure so we don't pollute the rest of\r\n // the foreverFrame transport with unnecessary functions/utilities.\r\n loadPreventer = function () {\r\n var loadingFixIntervalId = null,\r\n loadingFixInterval = 1000,\r\n attachedTo = 0;\r\n\r\n return {\r\n prevent: function prevent() {\r\n // Prevent additional iframe removal procedures from newer browsers\r\n if (signalR._.ieVersion <= 8) {\r\n // We only ever want to set the interval one time, so on the first attachedTo\r\n if (attachedTo === 0) {\r\n // Create and destroy iframe every 3 seconds to prevent loading icon, super hacky\r\n loadingFixIntervalId = window.setInterval(function () {\r\n var tempFrame = createFrame();\r\n\r\n window.document.body.appendChild(tempFrame);\r\n window.document.body.removeChild(tempFrame);\r\n\r\n tempFrame = null;\r\n }, loadingFixInterval);\r\n }\r\n\r\n attachedTo++;\r\n }\r\n },\r\n cancel: function cancel() {\r\n // Only clear the interval if there's only one more object that the loadPreventer is attachedTo\r\n if (attachedTo === 1) {\r\n window.clearInterval(loadingFixIntervalId);\r\n }\r\n\r\n if (attachedTo > 0) {\r\n attachedTo--;\r\n }\r\n }\r\n };\r\n }();\r\n\r\n signalR.transports.foreverFrame = {\r\n name: \"foreverFrame\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return true;\r\n },\r\n\r\n // Added as a value here so we can create tests to verify functionality\r\n iframeClearThreshold: 50,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n if (connection.accessToken) {\r\n if (onFailed) {\r\n connection.log(\"Forever Frame does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n var that = this,\r\n frameId = transportLogic.foreverFrame.count += 1,\r\n url,\r\n frame = createFrame(),\r\n frameLoadHandler = function frameLoadHandler() {\r\n connection.log(\"Forever frame iframe finished loading and is no longer receiving messages.\");\r\n if (!onFailed || !onFailed()) {\r\n that.reconnect(connection);\r\n }\r\n };\r\n\r\n if (window.EventSource) {\r\n // If the browser supports SSE, don't use Forever Frame\r\n if (onFailed) {\r\n connection.log(\"Forever Frame is not supported by SignalR on browsers with SSE support.\");\r\n onFailed();\r\n }\r\n return;\r\n }\r\n\r\n frame.setAttribute(\"data-signalr-connection-id\", connection.id);\r\n\r\n // Start preventing loading icon\r\n // This will only perform work if the loadPreventer is not attached to another connection.\r\n loadPreventer.prevent();\r\n\r\n // Build the url\r\n url = transportLogic.getUrl(connection, this.name);\r\n url += \"&frameId=\" + frameId;\r\n\r\n // add frame to the document prior to setting URL to avoid caching issues.\r\n window.document.documentElement.appendChild(frame);\r\n\r\n connection.log(\"Binding to iframe's load event.\");\r\n\r\n if (frame.addEventListener) {\r\n frame.addEventListener(\"load\", frameLoadHandler, false);\r\n } else if (frame.attachEvent) {\r\n frame.attachEvent(\"onload\", frameLoadHandler);\r\n }\r\n\r\n frame.src = url;\r\n transportLogic.foreverFrame.connections[frameId] = connection;\r\n\r\n connection.frame = frame;\r\n connection.frameId = frameId;\r\n\r\n if (onSuccess) {\r\n connection.onSuccess = function () {\r\n connection.log(\"Iframe transport started.\");\r\n onSuccess();\r\n };\r\n }\r\n },\r\n\r\n reconnect: function reconnect(connection) {\r\n var that = this;\r\n\r\n // Need to verify connection state and verify before the setTimeout occurs because an application sleep could occur during the setTimeout duration.\r\n if (transportLogic.isConnectedOrReconnecting(connection) && transportLogic.verifyLastActive(connection)) {\r\n window.setTimeout(function () {\r\n // Verify that we're ok to reconnect.\r\n if (!transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n if (connection.frame && transportLogic.ensureReconnectingState(connection)) {\r\n var frame = connection.frame,\r\n src = transportLogic.getUrl(connection, that.name, true) + \"&frameId=\" + connection.frameId;\r\n connection.log(\"Updating iframe src to '\" + src + \"'.\");\r\n frame.src = src;\r\n }\r\n }, connection.reconnectDelay);\r\n }\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n this.reconnect(connection);\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n receive: function receive(connection, data) {\r\n var cw, body, response;\r\n\r\n if (connection.json !== connection._originalJson) {\r\n // If there's a custom JSON parser configured then serialize the object\r\n // using the original (browser) JSON parser and then deserialize it using\r\n // the custom parser (connection._parseResponse does that). This is so we\r\n // can easily send the response from the server as \"raw\" JSON but still\r\n // support custom JSON deserialization in the browser.\r\n data = connection._originalJson.stringify(data);\r\n }\r\n\r\n response = connection._parseResponse(data);\r\n\r\n transportLogic.processMessages(connection, response, connection.onSuccess);\r\n\r\n // Protect against connection stopping from a callback trigger within the processMessages above.\r\n if (connection.state === $.signalR.connectionState.connected) {\r\n // Delete the script & div elements\r\n connection.frameMessageCount = (connection.frameMessageCount || 0) + 1;\r\n if (connection.frameMessageCount > signalR.transports.foreverFrame.iframeClearThreshold) {\r\n connection.frameMessageCount = 0;\r\n cw = connection.frame.contentWindow || connection.frame.contentDocument;\r\n if (cw && cw.document && cw.document.body) {\r\n body = cw.document.body;\r\n\r\n // Remove all the child elements from the iframe's body to conserver memory\r\n while (body.firstChild) {\r\n body.removeChild(body.firstChild);\r\n }\r\n }\r\n }\r\n }\r\n },\r\n\r\n stop: function stop(connection) {\r\n var cw = null;\r\n\r\n // Stop attempting to prevent loading icon\r\n loadPreventer.cancel();\r\n\r\n if (connection.frame) {\r\n if (connection.frame.stop) {\r\n connection.frame.stop();\r\n } else {\r\n try {\r\n cw = connection.frame.contentWindow || connection.frame.contentDocument;\r\n if (cw.document && cw.document.execCommand) {\r\n cw.document.execCommand(\"Stop\");\r\n }\r\n } catch (e) {\r\n connection.log(\"Error occurred when stopping foreverFrame transport. Message = \" + e.message + \".\");\r\n }\r\n }\r\n\r\n // Ensure the iframe is where we left it\r\n if (connection.frame.parentNode === window.document.documentElement) {\r\n window.document.documentElement.removeChild(connection.frame);\r\n }\r\n\r\n delete transportLogic.foreverFrame.connections[connection.frameId];\r\n connection.frame = null;\r\n connection.frameId = null;\r\n delete connection.frame;\r\n delete connection.frameId;\r\n delete connection.onSuccess;\r\n delete connection.frameMessageCount;\r\n connection.log(\"Stopping forever frame.\");\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n },\r\n\r\n getConnection: function getConnection(id) {\r\n return transportLogic.foreverFrame.connections[id];\r\n },\r\n\r\n started: function started(connection) {\r\n if (changeState(connection, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n\r\n $(connection).triggerHandler(events.onReconnect);\r\n }\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.transports.longPolling.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.transports.common.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var signalR = $.signalR,\r\n events = $.signalR.events,\r\n changeState = $.signalR.changeState,\r\n isDisconnecting = $.signalR.isDisconnecting,\r\n transportLogic = signalR.transports._logic;\r\n\r\n signalR.transports.longPolling = {\r\n name: \"longPolling\",\r\n\r\n supportsKeepAlive: function supportsKeepAlive() {\r\n return false;\r\n },\r\n\r\n reconnectDelay: 3000,\r\n\r\n start: function start(connection, onSuccess, onFailed) {\r\n /// <summary>Starts the long polling connection</summary>\r\n /// <param name=\"connection\" type=\"signalR\">The SignalR connection to start</param>\r\n var that = this,\r\n _fireConnect = function fireConnect() {\r\n _fireConnect = $.noop;\r\n\r\n connection.log(\"LongPolling connected.\");\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n } else {\r\n connection.log(\"WARNING! The client received an init message after reconnecting.\");\r\n }\r\n },\r\n tryFailConnect = function tryFailConnect(error) {\r\n if (onFailed(error)) {\r\n connection.log(\"LongPolling failed to connect.\");\r\n return true;\r\n }\r\n\r\n return false;\r\n },\r\n privateData = connection._,\r\n reconnectErrors = 0,\r\n fireReconnected = function fireReconnected(instance) {\r\n window.clearTimeout(privateData.reconnectTimeoutId);\r\n privateData.reconnectTimeoutId = null;\r\n\r\n if (changeState(instance, signalR.connectionState.reconnecting, signalR.connectionState.connected) === true) {\r\n // Successfully reconnected!\r\n instance.log(\"Raising the reconnect event\");\r\n $(instance).triggerHandler(events.onReconnect);\r\n }\r\n },\r\n\r\n // 1 hour\r\n maxFireReconnectedTimeout = 3600000;\r\n\r\n if (connection.pollXhr) {\r\n connection.log(\"Polling xhr requests already exists, aborting.\");\r\n connection.stop();\r\n }\r\n\r\n connection.messageId = null;\r\n\r\n privateData.reconnectTimeoutId = null;\r\n\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n (function poll(instance, raiseReconnect) {\r\n var messageId = instance.messageId,\r\n connect = messageId === null,\r\n reconnecting = !connect,\r\n polling = !raiseReconnect,\r\n url = transportLogic.getUrl(instance, that.name, reconnecting, polling, true /* use Post for longPolling */),\r\n postData = {};\r\n\r\n if (instance.messageId) {\r\n postData.messageId = instance.messageId;\r\n }\r\n\r\n if (instance.groupsToken) {\r\n postData.groupsToken = instance.groupsToken;\r\n }\r\n\r\n // If we've disconnected during the time we've tried to re-instantiate the poll then stop.\r\n if (isDisconnecting(instance) === true) {\r\n return;\r\n }\r\n\r\n connection.log(\"Opening long polling request to '\" + url + \"'.\");\r\n instance.pollXhr = transportLogic.ajax(connection, {\r\n xhrFields: {\r\n onprogress: function onprogress() {\r\n transportLogic.markLastMessage(connection);\r\n }\r\n },\r\n url: url,\r\n type: \"POST\",\r\n contentType: signalR._.defaultContentType,\r\n data: postData,\r\n timeout: connection._.pollTimeout,\r\n headers: connection.accessToken ? { \"Authorization\": \"Bearer \" + connection.accessToken } : {},\r\n success: function success(result) {\r\n var minData,\r\n delay = 0,\r\n data,\r\n shouldReconnect;\r\n\r\n connection.log(\"Long poll complete.\");\r\n\r\n // Reset our reconnect errors so if we transition into a reconnecting state again we trigger\r\n // reconnected quickly\r\n reconnectErrors = 0;\r\n\r\n try {\r\n // Remove any keep-alives from the beginning of the result\r\n minData = connection._parseResponse(result);\r\n } catch (error) {\r\n transportLogic.handleParseFailure(instance, result, error, tryFailConnect, instance.pollXhr);\r\n return;\r\n }\r\n\r\n // If there's currently a timeout to trigger reconnect, fire it now before processing messages\r\n if (privateData.reconnectTimeoutId !== null) {\r\n fireReconnected(instance);\r\n }\r\n\r\n if (minData) {\r\n data = transportLogic.maximizePersistentResponse(minData);\r\n }\r\n\r\n transportLogic.processMessages(instance, minData, _fireConnect);\r\n\r\n if (data && $.type(data.LongPollDelay) === \"number\") {\r\n delay = data.LongPollDelay;\r\n }\r\n\r\n if (isDisconnecting(instance) === true) {\r\n return;\r\n }\r\n\r\n shouldReconnect = data && data.ShouldReconnect;\r\n if (shouldReconnect) {\r\n // Transition into the reconnecting state\r\n // If this fails then that means that the user transitioned the connection into a invalid state in processMessages.\r\n if (!transportLogic.ensureReconnectingState(instance)) {\r\n return;\r\n }\r\n }\r\n\r\n // We never want to pass a raiseReconnect flag after a successful poll. This is handled via the error function\r\n if (delay > 0) {\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n poll(instance, shouldReconnect);\r\n }, delay);\r\n } else {\r\n poll(instance, shouldReconnect);\r\n }\r\n },\r\n\r\n error: function error(data, textStatus) {\r\n var error = signalR._.transportError(signalR.resources.longPollFailed, connection.transport, data, instance.pollXhr);\r\n\r\n // Stop trying to trigger reconnect, connection is in an error state\r\n // If we're not in the reconnect state this will noop\r\n window.clearTimeout(privateData.reconnectTimeoutId);\r\n privateData.reconnectTimeoutId = null;\r\n\r\n if (textStatus === \"abort\") {\r\n connection.log(\"Aborted xhr request.\");\r\n return;\r\n }\r\n\r\n if (!tryFailConnect(error)) {\r\n\r\n // Increment our reconnect errors, we assume all errors to be reconnect errors\r\n // In the case that it's our first error this will cause Reconnect to be fired\r\n // after 1 second due to reconnectErrors being = 1.\r\n reconnectErrors++;\r\n\r\n if (connection.state !== signalR.connectionState.reconnecting) {\r\n connection.log(\"An error occurred using longPolling. Status = \" + textStatus + \". Response = \" + data.responseText + \".\");\r\n $(instance).triggerHandler(events.onError, [error]);\r\n }\r\n\r\n // We check the state here to verify that we're not in an invalid state prior to verifying Reconnect.\r\n // If we're not in connected or reconnecting then the next ensureReconnectingState check will fail and will return.\r\n // Therefore we don't want to change that failure code path.\r\n if ((connection.state === signalR.connectionState.connected || connection.state === signalR.connectionState.reconnecting) && !transportLogic.verifyLastActive(connection)) {\r\n return;\r\n }\r\n\r\n // Transition into the reconnecting state\r\n // If this fails then that means that the user transitioned the connection into the disconnected or connecting state within the above error handler trigger.\r\n if (!transportLogic.ensureReconnectingState(instance)) {\r\n return;\r\n }\r\n\r\n // Call poll with the raiseReconnect flag as true after the reconnect delay\r\n privateData.pollTimeoutId = window.setTimeout(function () {\r\n poll(instance, true);\r\n }, that.reconnectDelay);\r\n }\r\n }\r\n });\r\n\r\n // This will only ever pass after an error has occurred via the poll ajax procedure.\r\n if (reconnecting && raiseReconnect === true) {\r\n // We wait to reconnect depending on how many times we've failed to reconnect.\r\n // This is essentially a heuristic that will exponentially increase in wait time before\r\n // triggering reconnected. This depends on the \"error\" handler of Poll to cancel this\r\n // timeout if it triggers before the Reconnected event fires.\r\n // The Math.min at the end is to ensure that the reconnect timeout does not overflow.\r\n privateData.reconnectTimeoutId = window.setTimeout(function () {\r\n fireReconnected(instance);\r\n }, Math.min(1000 * (Math.pow(2, reconnectErrors) - 1), maxFireReconnectedTimeout));\r\n }\r\n })(connection);\r\n }, 250); // Have to delay initial poll so Chrome doesn't show loader spinner in tab\r\n },\r\n\r\n lostConnection: function lostConnection(connection) {\r\n if (connection.pollXhr) {\r\n connection.pollXhr.abort(\"lostConnection\");\r\n }\r\n },\r\n\r\n send: function send(connection, data) {\r\n transportLogic.ajaxSend(connection, data);\r\n },\r\n\r\n stop: function stop(connection) {\r\n /// <summary>Stops the long polling connection</summary>\r\n /// <param name=\"connection\" type=\"signalR\">The SignalR connection to stop</param>\r\n\r\n window.clearTimeout(connection._.pollTimeoutId);\r\n window.clearTimeout(connection._.reconnectTimeoutId);\r\n\r\n delete connection._.pollTimeoutId;\r\n delete connection._.reconnectTimeoutId;\r\n\r\n if (connection.pollXhr) {\r\n connection.pollXhr.abort();\r\n connection.pollXhr = null;\r\n delete connection.pollXhr;\r\n }\r\n },\r\n\r\n abort: function abort(connection, async) {\r\n transportLogic.ajaxAbort(connection, async);\r\n }\r\n };\r\n})(jQueryShim, window);\r\n/* jquery.signalR.hubs.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n\r\n(function ($, window, undefined) {\r\n\r\n var nextGuid = 0;\r\n var eventNamespace = \".hubProxy\",\r\n signalR = $.signalR;\r\n\r\n function makeEventName(event) {\r\n return event + eventNamespace;\r\n }\r\n\r\n // Equivalent to Array.prototype.map\r\n function map(arr, fun, thisp) {\r\n var i,\r\n length = arr.length,\r\n result = [];\r\n for (i = 0; i < length; i += 1) {\r\n if (arr.hasOwnProperty(i)) {\r\n result[i] = fun.call(thisp, arr[i], i, arr);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n function getArgValue(a) {\r\n return $.isFunction(a) ? null : $.type(a) === \"undefined\" ? null : a;\r\n }\r\n\r\n function hasMembers(obj) {\r\n for (var key in obj) {\r\n // If we have any properties in our callback map then we have callbacks and can exit the loop via return\r\n if (obj.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n function clearInvocationCallbacks(connection, error) {\r\n /// <param name=\"connection\" type=\"hubConnection\" />\r\n var callbacks = connection._.invocationCallbacks,\r\n callback;\r\n\r\n if (hasMembers(callbacks)) {\r\n connection.log(\"Clearing hub invocation callbacks with error: \" + error + \".\");\r\n }\r\n\r\n // Reset the callback cache now as we have a local var referencing it\r\n connection._.invocationCallbackId = 0;\r\n delete connection._.invocationCallbacks;\r\n connection._.invocationCallbacks = {};\r\n\r\n // Loop over the callbacks and invoke them.\r\n // We do this using a local var reference and *after* we've cleared the cache\r\n // so that if a fail callback itself tries to invoke another method we don't\r\n // end up with its callback in the list we're looping over.\r\n for (var callbackId in callbacks) {\r\n callback = callbacks[callbackId];\r\n callback.method.call(callback.scope, { E: error });\r\n }\r\n }\r\n\r\n function isCallbackFromGeneratedHubProxy(callback) {\r\n // https://github.com/SignalR/SignalR/issues/4310\r\n // The stringified callback from the old generated hub proxy is 137 characters in Edge, Firefox and Chrome.\r\n // We slice to avoid wasting too many cycles searching through the text of a long large function.\r\n return $.isFunction(callback) && callback.toString().slice(0, 256).indexOf(\"// Call the client hub method\") >= 0;\r\n }\r\n\r\n // hubProxy\r\n function hubProxy(hubConnection, hubName) {\r\n /// <summary>\r\n /// Creates a new proxy object for the given hub connection that can be used to invoke\r\n /// methods on server hubs and handle client method invocation requests from the server.\r\n /// </summary>\r\n return new hubProxy.fn.init(hubConnection, hubName);\r\n }\r\n\r\n hubProxy.fn = hubProxy.prototype = {\r\n init: function init(connection, hubName) {\r\n this.state = {};\r\n this.connection = connection;\r\n this.hubName = hubName;\r\n this._ = {\r\n callbackMap: {}\r\n };\r\n },\r\n\r\n constructor: hubProxy,\r\n\r\n hasSubscriptions: function hasSubscriptions() {\r\n return hasMembers(this._.callbackMap);\r\n },\r\n\r\n on: function on(eventName, callback, callbackIdentity) {\r\n /// <summary>Wires up a callback to be invoked when a invocation request is received from the server hub.</summary>\r\n /// <param name=\"eventName\" type=\"String\">The name of the hub event to register the callback for.</param>\r\n /// <param name=\"callback\" type=\"Function\">The callback to be invoked.</param>\r\n /// <param name=\"callbackIdentity\" type=\"Object\">An optional object to use as the \"identity\" for the callback when checking if the handler has already been registered. Defaults to the value of 'callback' if not provided.</param>\r\n var that = this,\r\n callbackMap = that._.callbackMap,\r\n isFromOldGeneratedHubProxy = !callbackIdentity && isCallbackFromGeneratedHubProxy(callback);\r\n\r\n // We need the third \"identity\" argument because the registerHubProxies call made by signalr/js wraps the user-provided callback in a custom wrapper which breaks the identity comparison.\r\n // callbackIdentity allows the caller of `on` to provide a separate object to use as the \"identity\". `registerHubProxies` uses the original user callback as this identity object.\r\n callbackIdentity = callbackIdentity || callback;\r\n\r\n // Assign a global ID to the identity object. This tags the object so we can detect the same object when it comes back.\r\n if (!callbackIdentity._signalRGuid) {\r\n callbackIdentity._signalRGuid = nextGuid++;\r\n }\r\n\r\n // Normalize the event name to lowercase\r\n eventName = eventName.toLowerCase();\r\n\r\n // If there is not an event registered for this callback yet we want to create its event space in the callback map.\r\n var callbackSpace = callbackMap[eventName];\r\n if (!callbackSpace) {\r\n callbackSpace = [];\r\n callbackMap[eventName] = callbackSpace;\r\n }\r\n\r\n // Check if there's already a registration\r\n var registration;\r\n for (var i = 0; i < callbackSpace.length; i++) {\r\n if (callbackSpace[i].guid === callbackIdentity._signalRGuid || isFromOldGeneratedHubProxy && callbackSpace[i].isFromOldGeneratedHubProxy) {\r\n registration = callbackSpace[i];\r\n }\r\n }\r\n\r\n // Create a registration if there isn't one already\r\n if (!registration) {\r\n registration = {\r\n guid: callbackIdentity._signalRGuid,\r\n eventHandlers: [],\r\n isFromOldGeneratedHubProxy: isFromOldGeneratedHubProxy\r\n };\r\n callbackMap[eventName].push(registration);\r\n }\r\n\r\n var handler = function handler(e, data) {\r\n callback.apply(that, data);\r\n };\r\n registration.eventHandlers.push(handler);\r\n\r\n $(that).bind(makeEventName(eventName), handler);\r\n\r\n return that;\r\n },\r\n\r\n off: function off(eventName, callback, callbackIdentity) {\r\n /// <summary>Removes the callback invocation request from the server hub for the given event name.</summary>\r\n /// <param name=\"eventName\" type=\"String\">The name of the hub event to unregister the callback for.</param>\r\n /// <param name=\"callback\" type=\"Function\">The callback to be removed.</param>\r\n /// <param name=\"callbackIdentity\" type=\"Object\">An optional object to use as the \"identity\" when looking up the callback. Corresponds to the same parameter provided to 'on'. Defaults to the value of 'callback' if not provided.</param>\r\n var that = this,\r\n callbackMap = that._.callbackMap,\r\n callbackSpace,\r\n isFromOldGeneratedHubProxy = !callbackIdentity && isCallbackFromGeneratedHubProxy(callback);\r\n\r\n callbackIdentity = callbackIdentity || callback;\r\n\r\n // Normalize the event name to lowercase\r\n eventName = eventName.toLowerCase();\r\n\r\n callbackSpace = callbackMap[eventName];\r\n\r\n // Verify that there is an event space to unbind\r\n if (callbackSpace) {\r\n\r\n if (callback) {\r\n // Find the callback registration\r\n var callbackRegistration;\r\n var callbackIndex;\r\n for (var i = 0; i < callbackSpace.length; i++) {\r\n if (callbackSpace[i].guid === callbackIdentity._signalRGuid || isFromOldGeneratedHubProxy && callbackSpace[i].isFromOldGeneratedHubProxy) {\r\n callbackIndex = i;\r\n callbackRegistration = callbackSpace[i];\r\n }\r\n }\r\n\r\n // Only unbind if there's an event bound with eventName and a callback with the specified callback\r\n if (callbackRegistration) {\r\n // Unbind all event handlers associated with the registration.\r\n for (var j = 0; j < callbackRegistration.eventHandlers.length; j++) {\r\n $(that).unbind(makeEventName(eventName), callbackRegistration.eventHandlers[j]);\r\n }\r\n\r\n // Remove the registration from the list\r\n callbackSpace.splice(i, 1);\r\n\r\n // Check if there are any registrations left, if not we need to destroy it.\r\n if (callbackSpace.length === 0) {\r\n delete callbackMap[eventName];\r\n }\r\n }\r\n } else if (!callback) {\r\n // Check if we're removing the whole event and we didn't error because of an invalid callback\r\n $(that).unbind(makeEventName(eventName));\r\n\r\n delete callbackMap[eventName];\r\n }\r\n }\r\n\r\n return that;\r\n },\r\n\r\n invoke: function invoke(methodName) {\r\n /// <summary>Invokes a server hub method with the given arguments.</summary>\r\n /// <param name=\"methodName\" type=\"String\">The name of the server hub method.</param>\r\n\r\n var that = this,\r\n connection = that.connection,\r\n args = $.makeArray(arguments).slice(1),\r\n argValues = map(args, getArgValue),\r\n data = { H: that.hubName, M: methodName, A: argValues, I: connection._.invocationCallbackId },\r\n d = $.Deferred(),\r\n callback = function callback(minResult) {\r\n var result = that._maximizeHubResponse(minResult),\r\n source,\r\n error;\r\n\r\n // Update the hub state\r\n $.extend(that.state, result.State);\r\n\r\n if (result.Progress) {\r\n if (d.notifyWith) {\r\n // Progress is only supported in jQuery 1.7+\r\n d.notifyWith(that, [result.Progress.Data]);\r\n } else if (!connection._.progressjQueryVersionLogged) {\r\n connection.log(\"A hub method invocation progress update was received but the version of jQuery in use (\" + $.prototype.jquery + \") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications.\");\r\n connection._.progressjQueryVersionLogged = true;\r\n }\r\n } else if (result.Error) {\r\n // Server hub method threw an exception, log it & reject the deferred\r\n if (result.StackTrace) {\r\n connection.log(result.Error + \"\\n\" + result.StackTrace + \".\");\r\n }\r\n\r\n // result.ErrorData is only set if a HubException was thrown\r\n source = result.IsHubException ? \"HubException\" : \"Exception\";\r\n error = signalR._.error(result.Error, source);\r\n error.data = result.ErrorData;\r\n\r\n connection.log(that.hubName + \".\" + methodName + \" failed to execute. Error: \" + error.message);\r\n d.rejectWith(that, [error]);\r\n } else {\r\n // Server invocation succeeded, resolve the deferred\r\n connection.log(\"Invoked \" + that.hubName + \".\" + methodName);\r\n d.resolveWith(that, [result.Result]);\r\n }\r\n };\r\n\r\n connection._.invocationCallbacks[connection._.invocationCallbackId.toString()] = { scope: that, method: callback };\r\n connection._.invocationCallbackId += 1;\r\n\r\n if (!$.isEmptyObject(that.state)) {\r\n data.S = that.state;\r\n }\r\n\r\n connection.log(\"Invoking \" + that.hubName + \".\" + methodName);\r\n connection.send(data);\r\n\r\n return d.promise();\r\n },\r\n\r\n _maximizeHubResponse: function _maximizeHubResponse(minHubResponse) {\r\n return {\r\n State: minHubResponse.S,\r\n Result: minHubResponse.R,\r\n Progress: minHubResponse.P ? {\r\n Id: minHubResponse.P.I,\r\n Data: minHubResponse.P.D\r\n } : null,\r\n Id: minHubResponse.I,\r\n IsHubException: minHubResponse.H,\r\n Error: minHubResponse.E,\r\n StackTrace: minHubResponse.T,\r\n ErrorData: minHubResponse.D\r\n };\r\n }\r\n };\r\n\r\n hubProxy.fn.init.prototype = hubProxy.fn;\r\n\r\n // hubConnection\r\n function hubConnection(url, options) {\r\n /// <summary>Creates a new hub connection.</summary>\r\n /// <param name=\"url\" type=\"String\">[Optional] The hub route url, defaults to \"/signalr\".</param>\r\n /// <param name=\"options\" type=\"Object\">[Optional] Settings to use when creating the hubConnection.</param>\r\n var settings = {\r\n qs: null,\r\n logging: false,\r\n useDefaultPath: true\r\n };\r\n\r\n $.extend(settings, options);\r\n\r\n if (!url || settings.useDefaultPath) {\r\n url = (url || \"\") + \"/signalr\";\r\n }\r\n return new hubConnection.fn.init(url, settings);\r\n }\r\n\r\n hubConnection.fn = hubConnection.prototype = $.connection();\r\n\r\n hubConnection.fn.init = function (url, options) {\r\n var settings = {\r\n qs: null,\r\n logging: false,\r\n useDefaultPath: true\r\n },\r\n connection = this;\r\n\r\n $.extend(settings, options);\r\n\r\n // Call the base constructor\r\n $.signalR.fn.init.call(connection, url, settings.qs, settings.logging);\r\n\r\n // Object to store hub proxies for this connection\r\n connection.proxies = {};\r\n\r\n connection._.invocationCallbackId = 0;\r\n connection._.invocationCallbacks = {};\r\n\r\n // Wire up the received handler\r\n connection.received(function (minData) {\r\n var data, proxy, dataCallbackId, callback, hubName, eventName;\r\n if (!minData) {\r\n return;\r\n }\r\n\r\n // We have to handle progress updates first in order to ensure old clients that receive\r\n // progress updates enter the return value branch and then no-op when they can't find\r\n // the callback in the map (because the minData.I value will not be a valid callback ID)\r\n // Process progress notification\r\n if (typeof minData.P !== \"undefined\") {\r\n dataCallbackId = minData.P.I.toString();\r\n callback = connection._.invocationCallbacks[dataCallbackId];\r\n if (callback) {\r\n callback.method.call(callback.scope, minData);\r\n }\r\n } else if (typeof minData.I !== \"undefined\") {\r\n // We received the return value from a server method invocation, look up callback by id and call it\r\n dataCallbackId = minData.I.toString();\r\n callback = connection._.invocationCallbacks[dataCallbackId];\r\n if (callback) {\r\n // Delete the callback from the proxy\r\n connection._.invocationCallbacks[dataCallbackId] = null;\r\n delete connection._.invocationCallbacks[dataCallbackId];\r\n\r\n // Invoke the callback\r\n callback.method.call(callback.scope, minData);\r\n }\r\n } else {\r\n data = this._maximizeClientHubInvocation(minData);\r\n\r\n // We received a client invocation request, i.e. broadcast from server hub\r\n connection.log(\"Triggering client hub event '\" + data.Method + \"' on hub '\" + data.Hub + \"'.\");\r\n\r\n // Normalize the names to lowercase\r\n hubName = data.Hub.toLowerCase();\r\n eventName = data.Method.toLowerCase();\r\n\r\n // Trigger the local invocation event\r\n proxy = this.proxies[hubName];\r\n\r\n // Update the hub state\r\n $.extend(proxy.state, data.State);\r\n $(proxy).triggerHandler(makeEventName(eventName), [data.Args]);\r\n }\r\n });\r\n\r\n connection.error(function (errData, origData) {\r\n var callbackId, callback;\r\n\r\n if (!origData) {\r\n // No original data passed so this is not a send error\r\n return;\r\n }\r\n\r\n callbackId = origData.I;\r\n callback = connection._.invocationCallbacks[callbackId];\r\n\r\n // Verify that there is a callback bound (could have been cleared)\r\n if (callback) {\r\n // Delete the callback\r\n connection._.invocationCallbacks[callbackId] = null;\r\n delete connection._.invocationCallbacks[callbackId];\r\n\r\n // Invoke the callback with an error to reject the promise\r\n callback.method.call(callback.scope, { E: errData });\r\n }\r\n });\r\n\r\n connection.reconnecting(function () {\r\n if (connection.transport && connection.transport.name === \"webSockets\") {\r\n clearInvocationCallbacks(connection, \"Connection started reconnecting before invocation result was received.\");\r\n }\r\n });\r\n\r\n connection.disconnected(function () {\r\n clearInvocationCallbacks(connection, \"Connection was disconnected before invocation result was received.\");\r\n });\r\n };\r\n\r\n hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {\r\n return {\r\n Hub: minClientHubInvocation.H,\r\n Method: minClientHubInvocation.M,\r\n Args: minClientHubInvocation.A,\r\n State: minClientHubInvocation.S\r\n };\r\n };\r\n\r\n hubConnection.fn._registerSubscribedHubs = function () {\r\n /// <summary>\r\n /// Sets the starting event to loop through the known hubs and register any new hubs\r\n /// that have been added to the proxy.\r\n /// </summary>\r\n var connection = this;\r\n\r\n if (!connection._subscribedToHubs) {\r\n connection._subscribedToHubs = true;\r\n connection.starting(function () {\r\n // Set the connection's data object with all the hub proxies with active subscriptions.\r\n // These proxies will receive notifications from the server.\r\n var subscribedHubs = [];\r\n\r\n $.each(connection.proxies, function (key) {\r\n if (this.hasSubscriptions()) {\r\n subscribedHubs.push({ name: key });\r\n connection.log(\"Client subscribed to hub '\" + key + \"'.\");\r\n }\r\n });\r\n\r\n if (subscribedHubs.length === 0) {\r\n connection.log(\"No hubs have been subscribed to. The client will not receive data from hubs. To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to.\");\r\n }\r\n\r\n connection.data = connection.json.stringify(subscribedHubs);\r\n });\r\n }\r\n };\r\n\r\n hubConnection.fn.createHubProxy = function (hubName) {\r\n /// <summary>\r\n /// Creates a new proxy object for the given hub connection that can be used to invoke\r\n /// methods on server hubs and handle client method invocation requests from the server.\r\n /// </summary>\r\n /// <param name=\"hubName\" type=\"String\">\r\n /// The name of the hub on the server to create the proxy for.\r\n /// </param>\r\n\r\n // Normalize the name to lowercase\r\n hubName = hubName.toLowerCase();\r\n\r\n var proxy = this.proxies[hubName];\r\n if (!proxy) {\r\n proxy = hubProxy(this, hubName);\r\n this.proxies[hubName] = proxy;\r\n }\r\n\r\n this._registerSubscribedHubs();\r\n\r\n return proxy;\r\n };\r\n\r\n hubConnection.fn.init.prototype = hubConnection.fn;\r\n\r\n $.hubConnection = hubConnection;\r\n})(jQueryShim, window);\r\n/* jquery.signalR.version.js */\r\n// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n\r\n/*global window:false */\r\n/// <reference path=\"jquery.signalR.core.js\" />\r\n(function ($, undefined) {\r\n // This will be modified by the build script\r\n $.signalR.version = \"2.4.1\";\r\n})(jQueryShim);\r\n\r\nvar hubConnection = exports.hubConnection = jQueryShim.hubConnection;\r\nvar signalR = exports.signalR = jQueryShim.signalR;","import { BaseEvents, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nexport enum DeviceType {\n AppleTv = 'apple-tv',\n Vivi = 'vivi'\n}\n\nexport enum DeviceStatus {\n Available = 'available',\n Offline = 'offline',\n Busy = 'busy'\n}\n\nexport interface Device {\n id: string;\n name: string;\n schoolName?: string;\n description?: string;\n type: DeviceType;\n status: DeviceStatus;\n}\n\nexport interface SessionConfig {\n device: Device;\n title: string;\n}\n\nexport interface ClientEvents extends BaseEvents {\n deviceschange: void;\n error: Error;\n}\n\nexport interface Client<T extends ClientEvents = ClientEvents> extends EventBus<T> {\n getDevices: () => Device[];\n canCastToDevice: (deviceType: DeviceType) => boolean;\n startCastSession: (config: SessionConfig) => CastSession;\n}\n\nexport interface SessionEvents extends BaseEvents {\n durationchange: void;\n playingchange: void;\n volumechange: void;\n positionchange: void;\n sourceloaded: void;\n subtitleschange: void;\n error: Error;\n}\n\nexport interface CastSession<T extends SessionEvents = SessionEvents> extends EventBus<T> {\n loadSource: (videoSource: string, subtitleSource?: string) => void;\n play: () => void;\n pause: () => void;\n seek: (position: number) => void;\n setVolume: (volume: number) => void;\n setMuted: (muted: boolean) => void;\n setSubtitles: (subtitleSource?: string) => void;\n isPlaying: () => boolean;\n isPlaybackFinished: () => boolean;\n getPosition: () => number;\n getDuration: () => number | undefined;\n getVolume: () => number;\n getMuted: () => boolean;\n getSubtitles: () => string | undefined;\n getDevice: () => Device;\n getTitle: () => string;\n}\n","\nexport class PromiseWithTimeout<T> implements Promise<T> {\n readonly [Symbol.toStringTag]: string;\n private readonly innerPromise: Promise<T>;\n private readonly onTimeout?: () => void;\n\n constructor(innerPromise: Promise<T>, onTimeout?: () => void) {\n this[Symbol.toStringTag] = innerPromise[Symbol.toStringTag];\n this.innerPromise = innerPromise;\n this.onTimeout = onTimeout;\n\n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.timeout = this.timeout.bind(this);\n this.then = this.then.bind(this);\n this.catch = this.catch.bind(this);\n this.finally = this.finally.bind(this);\n }\n\n timeout(timeout: number): Promise<T> {\n return new Promise((resolve, reject) => {\n this\n .then(resolve)\n .catch(reject)\n .finally(() => clearTimeout(timeoutId));\n\n const timeoutId = setTimeout(() => {\n this.onTimeout?.();\n reject(new Error('Promise timed out'));\n }, timeout);\n });\n }\n\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null\n ): Promise<TResult1 | TResult2> {\n return this.innerPromise.then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null\n ): Promise<T | TResult> {\n return this.innerPromise.catch(onrejected);\n }\n\n finally(onfinally?: () => void): Promise<T> {\n return this.innerPromise.finally(onfinally);\n }\n\n static reject<T>(reason?: any): PromiseWithTimeout<T> {\n return new PromiseWithTimeout(Promise.reject(reason));\n }\n\n static fromPromise<T>(promise: Promise<T>): PromiseWithTimeout<T> {\n return new PromiseWithTimeout(promise);\n }\n}\n","import { PromiseWithTimeout } from './promise-with-timeout';\n\nexport type Unsubscribe = () => void;\n\nexport interface SubscribtionResult<T> {\n off: Unsubscribe;\n filter: (predicate: (ev: T) => boolean) => Unsubscribe;\n}\n\nclass EventChannel<T = void> {\n private callbacks: ((ev: T) => void)[] = [];\n private predicates: ((ev: T) => boolean)[] = [];\n private controller: AbortController = new AbortController();\n private signal: AbortSignal = this.controller.signal;\n \n constructor() {\n this.trigger = this.trigger.bind(this);\n this.on = this.on.bind(this);\n this.one = this.one.bind(this);\n this.off = this.off.bind(this);\n this.dispose = this.dispose.bind(this);\n this.isDisposed = this.isDisposed.bind(this);\n }\n\n public trigger(ev: T): void {\n this.callbacks.forEach((cb, idx) => {\n const predicate = this.predicates[idx];\n \n if (predicate && !predicate(ev))\n return;\n\n cb(ev);\n });\n }\n\n public on(callback: (ev: T) => void): SubscribtionResult<T> {\n if (this.isDisposed())\n console.warn('This EventChannel instance been disposed - this is a no-op');\n \n const idx = this.callbacks.length;\n\n this.callbacks[idx] = callback;\n this.predicates[idx] = () => true;\n\n const off = () => {\n this.off(callback);\n };\n\n const filter = (predicate: (ev: T) => boolean) => {\n this.predicates[idx] = predicate;\n return off;\n };\n \n return {\n off,\n filter\n };\n }\n\n public one(predicate: (ev: T) => boolean = () => true): PromiseWithTimeout<T> {\n if (this.isDisposed())\n return PromiseWithTimeout.reject(new Error('This EventChannel instance has been disposed'));\n\n let off: Unsubscribe;\n\n return new PromiseWithTimeout(new Promise((resolve, reject) => {\n off = this\n .on(ev => {\n this.signal.removeEventListener('abort', onAborted);\n off();\n resolve(ev);\n })\n .filter(predicate);\n \n const onAborted = () => {\n off();\n reject(new Error('Aborted while waiting for message'));\n };\n\n this.signal.addEventListener('abort', onAborted, { once: true });\n }), () => {\n off();\n });\n }\n\n public off(callback: (ev: T) => void): void {\n const index = this.callbacks.indexOf(callback);\n \n if (index !== -1) {\n this.callbacks.splice(index, 1);\n this.predicates.splice(index, 1);\n }\n }\n\n public dispose(): void {\n this.callbacks.length = 0;\n this.predicates.length = 0;\n this.controller.abort();\n }\n\n public isDisposed(): boolean {\n return this.signal.aborted;\n }\n}\n\nexport interface BaseEvents {\n dispose: void;\n}\n\nexport class EventBus<Events extends BaseEvents> {\n private channels: Partial<Record<keyof Events, EventChannel<Events[keyof Events]>>> = {};\n\n constructor() {\n this.trigger = this.trigger.bind(this);\n this.on = this.on.bind(this);\n this.one = this.one.bind(this);\n this.off = this.off.bind(this);\n this.dispose = this.dispose.bind(this);\n this.getChannel = this.getChannel.bind(this);\n }\n\n public trigger<Key extends keyof Events>(eventKey: Key, ev: Events[Key]): void {\n const channel = this.getChannel(eventKey);\n\n channel.trigger(ev);\n }\n\n public on<Key extends keyof Events>(\n eventKey: Key,\n callback: (ev: Events[Key]) => void\n ): SubscribtionResult<Events[Key]> {\n const channel = this.getChannel(eventKey);\n\n return channel.on(callback);\n }\n\n public one<Key extends keyof Events>(\n eventKey: Key,\n predicate?: (ev: Events[Key]) => boolean\n ): PromiseWithTimeout<Events[Key]> {\n const channel = this.getChannel(eventKey);\n\n return channel.one(predicate);\n }\n\n public off<Key extends keyof Events>(eventKey: Key, callback: (ev: Events[Key]) => void): void {\n const channel = this.getChannel(eventKey);\n\n channel.off(callback);\n }\n\n public dispose(): void {\n this.trigger('dispose', Event.void);\n\n Object.values(this.channels).forEach((channel: EventChannel<any>) => channel.dispose());\n \n this.channels = {};\n }\n\n private getChannel<Key extends keyof Events>(eventKey: Key): EventChannel<Events[Key]> {\n if (!this.channels[eventKey])\n this.channels[eventKey] = new EventChannel<Events[Key]>();\n\n return this.channels[eventKey] as EventChannel<Events[Key]>;\n }\n}\n\n/*\nBecause events need to be associated to a type, we can use the constant below\nwhen triggering an event that doesn't pass any data along to its listeners:\n\n- eventBus.trigger('dispose', Event.void);\n\nWhich I think is a bit nicer than:\n\n- eventBus.trigger('dispose', undefined);\n\nNOTE: I didn't want to make the payload optional - as this raises a whole bunch of TS questions\nthat I don't have the mental capacity to address right now..\n*/\n\nexport const Event = {\n void: undefined as any\n};\n","export class Scheduler {\n private task?: (s: Scheduler) => void;\n private intervalId?: NodeJS.Timeout;\n private intervalInMilliseconds: number;\n\n constructor() {\n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.schedule = this.schedule.bind(this);\n this.every = this.every.bind(this);\n this.trigger = this.trigger.bind(this);\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n }\n\n public schedule(task: (s: Scheduler) => void): Scheduler {\n this.task = task;\n return this;\n }\n\n public every(durationInMilliseconds: number): Scheduler {\n this.intervalInMilliseconds = durationInMilliseconds;\n return this;\n }\n\n public trigger(): Scheduler {\n this.task?.(this);\n return this;\n }\n\n public start(): Scheduler {\n if (!this.intervalId)\n this.intervalId = setInterval(() => this.trigger(), this.intervalInMilliseconds);\n\n return this;\n }\n\n public stop(): Scheduler {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n\n return this;\n }\n}\n","import { HashObject } from 'libs/common/react/interfaces';\n\nexport interface ProxiedObject extends HashObject {\n _lastModified?: {[key: string]: number };\n}\n\nfunction withDebouncedSetters<T extends ProxiedObject>(\n obj: T,\n debounceDurationInMillseconds: number\n): T {\n if (!obj._lastModified)\n obj._lastModified = {};\n\n return new Proxy(obj, {\n set: (target, property, value, receiver) => {\n const timestamp = obj._lastModified[property.toString()];\n\n if (timestamp && Date.now() < timestamp + debounceDurationInMillseconds)\n return true; // Don't return false here as it will cause the proxy to throw an error\n\n return Reflect.set(target, property, value, receiver);\n }\n });\n}\n\nfunction withTimestampedSetters<T extends ProxiedObject>(obj: T): T {\n if (!obj._lastModified)\n obj._lastModified = {};\n\n return new Proxy(obj, {\n set: (target, property, value, receiver) => {\n obj._lastModified[property.toString()] = Date.now();\n\n return Reflect.set(target, property, value, receiver);\n }\n });\n}\n\nexport const ProxyHelper = {\n withDebouncedSetters,\n withTimestampedSetters\n};\n","import { ClientEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nexport enum OnlineApiDeviceStatus {\n Offline = 0,\n Online = 1,\n Locked = 2,\n Suspended = 3\n}\n\nexport interface OnlineApiDevice {\n deviceId: string;\n crmId: number;\n name: string;\n status: OnlineApiDeviceStatus;\n lockedBy: string;\n lockedByUserId: number;\n lastAccessed: string;\n dateCreated: string;\n dateModified: string;\n dateDeleted: string;\n deleted: boolean;\n type?: 'unknown' | 'vivi' | 'apple_tv'; // This property is a necessary evil because we're piggy-backing on Online API to support Apple TV devices in NP\n}\n\nexport enum AppleTvEventName {\n PlaybackStatusChange,\n PositionChange\n}\n\nexport enum PlaybackStatus {\n Begin = 'BEGIN',\n Play = 'PLAY',\n Pause = 'PAUSE',\n Load = 'LOAD',\n Scan = 'SCAN',\n Stop = 'STOP'\n}\n\nexport interface AppleTvIncomingMessage {\n deviceId: string;\n event: AppleTvEventName;\n params: {\n position?: number,\n playbackStatus?: PlaybackStatus\n };\n}\n\nexport interface AppleTvClientEventMap extends ClientEvents {\n connected: void;\n disconnected: void;\n message: AppleTvIncomingMessage;\n}\n\nexport interface AppleTvPairRequest {\n deviceName: string;\n pin: string;\n crmId: number;\n}\n\nexport interface AppleTvRenameRequest {\n deviceName: string;\n deviceId: string;\n}\n","import { Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { ProxyHelper } from 'projects/player/plugins/devices-plugin/utils/proxy-helper';\n\nimport { PlaybackStatus } from './apple-tv-interfaces';\n\nconst PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS = 2000;\n\nexport class AppleTvCastSessionState {\n public title: string;\n public device: Device;\n public locked: boolean;\n public position: number;\n public playbackStatus: PlaybackStatus;\n public debounced: AppleTvCastSessionState;\n\n constructor(title: string, device: Device) {\n this.title = title;\n this.device = device;\n this.locked = false;\n this.position = 0;\n this.playbackStatus = PlaybackStatus.Load;\n this.debounced = ProxyHelper.withDebouncedSetters(this, PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS);\n\n return ProxyHelper.withTimestampedSetters(this);\n }\n}\n","import { CastSession, Device, SessionConfig, SessionEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nimport { AppleTvCastSessionState } from './apple-tv-cast-session-state';\nimport { AppleTvClient } from './apple-tv-client';\nimport { AppleTvEventName, AppleTvIncomingMessage, PlaybackStatus } from './apple-tv-interfaces';\n\nexport class AppleTvCastSession extends EventBus<SessionEvents> implements CastSession {\n private client: AppleTvClient;\n private localState: AppleTvCastSessionState;\n\n constructor(client: AppleTvClient, config: SessionConfig) {\n super();\n\n this.client = client;\n this.localState = new AppleTvCastSessionState(config.title, config.device);\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.dispose = this.dispose.bind(this);\n\n this.handleDisconnected = this.handleDisconnected.bind(this);\n this.handleAllVideoMessages = this.handleAllVideoMessages.bind(this);\n this.handlePlaybackChange = this.handlePlaybackChange.bind(this);\n this.handlePositionChange = this.handlePositionChange.bind(this);\n\n this.loadSource = this.loadSource.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.isPlaying = this.isPlaying.bind(this);\n this.getPosition = this.getPosition.bind(this);\n this.getDuration = this.getDuration.bind(this);\n this.getVolume = this.getVolume.bind(this);\n }\n\n private initialize(): void {\n this.client.on('dispose', this.dispose);\n this.client.on('disconnected', this.handleDisconnected);\n this.client.on('message', this.handleAllVideoMessages);\n }\n\n public dispose(): void {\n // Cleanup the subscriptions from the initialize function\n this.client.off('dispose', this.dispose);\n this.client.off('disconnected', this.handleDisconnected);\n this.client.off('message', this.handleAllVideoMessages);\n\n // Do our best to signal to the device that we're done with it.. \n // The stop command will also unlock the device.\n this.client.stop(this.getDevice().id).catch(err => console.error(err));\n\n // Trigger the dispose event\n super.dispose();\n }\n\n private handleDisconnected(): void {\n // Whilst we can reconnect to the SignalR hub, it appears we cannot properly recover from a full connection loss..\n // The client simply stops receiving events for the session. I believe this is an issue with our hub implementation in Online API.\n this.trigger('error', new Error('The connection to the Apple TV has been lost and cannot be recovered'));\n }\n\n private handleAllVideoMessages(message: AppleTvIncomingMessage): void {\n if (message.deviceId !== this.getDevice().id) return;\n\n const localState = this.localState.debounced;\n\n switch (message.event) {\n case AppleTvEventName.PlaybackStatusChange:\n this.handlePlaybackChange(localState, message);\n break;\n \n case AppleTvEventName.PositionChange:\n this.handlePositionChange(localState, message);\n break;\n }\n }\n\n private handlePlaybackChange(localState: AppleTvCastSessionState, remoteState: AppleTvIncomingMessage): void {\n if (localState.playbackStatus !== remoteState.params.playbackStatus) {\n localState.playbackStatus = remoteState.params.playbackStatus;\n this.trigger('playingchange', Event.void);\n\n if (localState.playbackStatus === PlaybackStatus.Stop)\n this.dispose();\n }\n }\n\n private handlePositionChange(localState: AppleTvCastSessionState, remoteState: AppleTvIncomingMessage): void {\n if (localState.position !== remoteState.params.position) {\n localState.position = remoteState.params.position;\n this.trigger('positionchange', Event.void);\n }\n }\n\n public async loadSource(): Promise<void> {\n try {\n // Only proceed if the session is not locked yet\n if (this.localState.locked) return;\n\n // Lock the session\n await this.client.lock(this.getDevice().id);\n this.localState.locked = true;\n\n // Load the video\n await this.client.loadVideo(this.getDevice().id);\n\n // Notify listeners that the video has loaded\n this.trigger('sourceloaded', Event.void);\n } catch (error) {\n console.error(error);\n\n this.trigger('error', new Error('Could not load video on Apple TV device'));\n }\n }\n\n public play(): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.playbackStatus !== PlaybackStatus.Play) {\n this.localState.playbackStatus = PlaybackStatus.Play;\n this.client.play(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public pause(): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.playbackStatus !== PlaybackStatus.Pause) {\n this.localState.playbackStatus = PlaybackStatus.Pause;\n this.client.pause(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public seek(position: number): void {\n if (!this.localState.locked)\n return;\n\n if (this.localState.position !== position) {\n this.localState.position = position;\n this.client.seek(this.getDevice().id, position);\n this.trigger('positionchange', Event.void);\n }\n }\n\n public setVolume(): void {\n console.info('Setting the volume is not supported on Apple TV');\n }\n\n public setMuted(): void {\n console.info('Muting is not supported on Apple TV');\n }\n\n public setSubtitles(): void {\n console.info('Subtitles are not supported on Apple TV');\n }\n\n public isPlaying(): boolean {\n return this.localState.playbackStatus === PlaybackStatus.Play ||\n this.localState.playbackStatus === PlaybackStatus.Begin ||\n this.localState.playbackStatus === PlaybackStatus.Load;\n }\n\n public isPlaybackFinished(): boolean {\n return this.localState.playbackStatus === PlaybackStatus.Stop;\n }\n\n public getPosition(): number {\n return this.localState.position;\n }\n\n public getDuration(): number | undefined {\n return undefined;\n }\n\n public getVolume(): number {\n return 1;\n }\n\n public getMuted(): boolean {\n return false;\n }\n\n public getSubtitles(): string | undefined {\n return undefined;\n }\n\n public getDevice(): Device {\n return this.localState.device;\n }\n\n public getTitle(): string {\n return this.localState.title;\n }\n}\n","import { Connection, hubConnection, Proxy } from 'signalr-no-jquery';\n\nimport { AppleTvAccessToken } from 'libs/shared/interfaces';\n\nimport { CastSession, Client, Device, DeviceStatus, DeviceType, SessionConfig } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\nimport { PromiseWithTimeout } from 'projects/player/plugins/devices-plugin/utils/promise-with-timeout';\nimport { Scheduler } from 'projects/player/plugins/devices-plugin/utils/scheduler';\nimport { debounce } from 'projects/player/utils/fn';\n\nimport { AppleTvCastSession } from './apple-tv-cast-session';\nimport { AppleTvClientEventMap, AppleTvEventName, AppleTvPairRequest, AppleTvRenameRequest, OnlineApiDevice, OnlineApiDeviceStatus, PlaybackStatus } from './apple-tv-interfaces';\n\nconst INVOKE_TIMEOUT_IN_MILLISECONDS = 20000;\nconst INVOKE_DEBOUNCE_IN_MILLISECONDS = 500;\nconst SIGNALR_HUB_NAME = 'DeviceUserHub';\nconst SIGNALR_HEARTBEAT_SCHEDULE_IN_MILLISECONDS = 5000;\n\nenum SignalrEventName {\n DeviceList = 'DeviceList',\n DeviceStateChange = 'DeviceStateChange',\n Paired = 'Paired',\n Unpaired = 'Unpaired',\n PlayStatusChange = 'PlayStatusChange',\n TimeSync = 'TimeSync'\n}\n\nenum SignalrMethodName {\n Command = 'Command',\n Pair = 'Pair',\n Unpair = 'Unpair',\n RenameDevice = 'Renamedevice',\n Subscribe = 'Subscribe',\n Lock = 'Lock'\n}\n\nconst enum SignalrConnectionState {\n Connecting = 0,\n Connected = 1,\n Reconnecting = 2,\n Disconnected = 4\n}\n\ninterface AppleTvClientOptions {\n fetchAccessToken: () => Promise<AppleTvAccessToken>;\n trackingCode?: string;\n username?: string;\n userId: number;\n}\n\nexport class AppleTvClient extends EventBus<AppleTvClientEventMap> implements Client<AppleTvClientEventMap> {\n private options: AppleTvClientOptions;\n private accessToken?: AppleTvAccessToken;\n private devices: Device[];\n private connection?: Connection;\n private hubProxy?: Proxy;\n private heartbeat: Scheduler;\n\n private invokeDebounced: (command: string, ...args: any[]) => boolean;\n\n constructor(options: AppleTvClientOptions) {\n super();\n \n this.options = options;\n this.accessToken = undefined;\n this.devices = [];\n this.heartbeat = new Scheduler();\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.connect = this.connect.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.tryFixConnection = this.tryFixConnection.bind(this);\n this.invoke = this.invoke.bind(this);\n this.invokeDebounced = debounce(this.invoke, INVOKE_DEBOUNCE_IN_MILLISECONDS, true);\n this.handleDeviceList = this.handleDeviceList.bind(this);\n this.handleDeviceStateChange = this.handleDeviceStateChange.bind(this);\n this.handleDevicePaired = this.handleDevicePaired.bind(this);\n this.handleDeviceUnpaired = this.handleDeviceUnpaired.bind(this);\n this.handlePlayStatusChange = this.handlePlayStatusChange.bind(this);\n this.handleTimeSync = this.handleTimeSync.bind(this);\n this.dispose = this.dispose.bind(this);\n this.canCastToDevice = this.canCastToDevice.bind(this);\n this.getDevices = this.getDevices.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.lock = this.lock.bind(this);\n this.loadVideo = this.loadVideo.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.stop = this.stop.bind(this);\n this.pair = this.pair.bind(this);\n this.unpair = this.unpair.bind(this);\n this.renameDevice = this.renameDevice.bind(this);\n }\n\n private async initialize(): Promise<void> {\n try {\n this.accessToken = await this.options.fetchAccessToken();\n this.connection = hubConnection(this.accessToken.host, { logging: false });\n this.hubProxy = this.connection.createHubProxy(SIGNALR_HUB_NAME);\n\n this.hubProxy.on(SignalrEventName.DeviceList, this.handleDeviceList);\n this.hubProxy.on(SignalrEventName.DeviceStateChange, this.handleDeviceStateChange);\n this.hubProxy.on(SignalrEventName.Paired, this.handleDevicePaired);\n this.hubProxy.on(SignalrEventName.Unpaired, this.handleDeviceUnpaired);\n this.hubProxy.on(SignalrEventName.PlayStatusChange, this.handlePlayStatusChange);\n this.hubProxy.on(SignalrEventName.TimeSync, this.handleTimeSync);\n\n await this.connect();\n await this.subscribe(this.accessToken.token);\n\n this.heartbeat\n .schedule(this.tryFixConnection)\n .every(SIGNALR_HEARTBEAT_SCHEDULE_IN_MILLISECONDS)\n .start();\n } catch (err) {\n console.error(err);\n this.trigger('error', new Error('Could not connect to Online API'));\n }\n }\n\n private async connect(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.connection\n .start({ jsonp: false, withCredentials: false })\n .done(() => resolve())\n .fail(() => reject(new Error('Could not connect to SignalR hub')));\n });\n }\n\n private async subscribe(token: string): Promise<void> {\n const subscribeResult = await this.invoke(SignalrMethodName.Subscribe, token);\n\n if (!subscribeResult)\n throw new Error('The subscription request was rejected by Online API');\n }\n\n private async tryFixConnection(): Promise<void> {\n // If this state is not disconnected, we don't need to do anything\n if ((this.connection as any).state !== SignalrConnectionState.Disconnected)\n return;\n\n try {\n // Stop the heartbeat while we try to reconnect\n this.heartbeat.stop();\n\n // We'll need a new access token to re-subscribe\n this.accessToken = await this.options.fetchAccessToken();\n \n // Reconnect and resubscribe\n await this.connect();\n await this.subscribe(this.accessToken.token);\n } catch (err) {\n console.warn(err);\n console.warn('Could not reconnect to Online API');\n } finally {\n // Resume the heartbeat\n this.heartbeat.start();\n }\n }\n\n private async invoke<T = any>(method: SignalrMethodName, ...args: any[]): Promise<T> {\n const invokeTask = new Promise<T>((resolve, reject) => {\n (this.hubProxy?.invoke(method, ...args) as unknown as JQueryPromise<T>)\n .done(resolve)\n .fail(reject);\n });\n\n return PromiseWithTimeout\n .fromPromise(invokeTask)\n .timeout(INVOKE_TIMEOUT_IN_MILLISECONDS);\n }\n\n private handleDeviceList(devices: OnlineApiDevice[]): void {\n this.devices = devices\n .filter(x => x.type !== 'vivi') // Ignore any Vivi devices coming from Online API\n .map(AppleTvClient.convertToGenericDevice);\n \n this.trigger('deviceschange', Event.void);\n }\n\n private handleDeviceStateChange(device: OnlineApiDevice): void {\n const deviceIndex = this.devices.findIndex(d => d.id === device.deviceId);\n\n if (deviceIndex >= 0) {\n this.devices[deviceIndex] = AppleTvClient.convertToGenericDevice(device);\n this.trigger('deviceschange', Event.void);\n }\n }\n\n private handleDevicePaired(device: OnlineApiDevice): void {\n if (device.type === 'vivi') return; // Ignore any Vivi devices coming from Online API\n\n this.devices.push(AppleTvClient.convertToGenericDevice(device));\n this.trigger('deviceschange', Event.void);\n }\n\n private handleDeviceUnpaired(deviceId: string): void {\n this.devices = this.devices.filter(d => d.id !== deviceId);\n this.trigger('deviceschange', Event.void);\n }\n\n private handlePlayStatusChange(deviceId: string, params: { commandType: PlaybackStatus }): void {\n this.trigger('message', {\n event: AppleTvEventName.PlaybackStatusChange,\n deviceId,\n params: { playbackStatus: params.commandType }\n });\n }\n\n private handleTimeSync(deviceId: string, position: number): void {\n this.trigger('message', {\n event: AppleTvEventName.PositionChange,\n deviceId,\n params: { position }\n });\n }\n\n public dispose(): void {\n // Unsubscribe from hub messages\n this.hubProxy.off(SignalrEventName.DeviceList, this.handleDeviceList);\n this.hubProxy.off(SignalrEventName.DeviceStateChange, this.handleDeviceStateChange);\n this.hubProxy.off(SignalrEventName.Paired, this.handleDevicePaired);\n this.hubProxy.off(SignalrEventName.Unpaired, this.handleDeviceUnpaired);\n this.hubProxy.off(SignalrEventName.PlayStatusChange, this.handlePlayStatusChange);\n this.hubProxy.off(SignalrEventName.TimeSync, this.handleTimeSync);\n\n // Stop the connection\n this.hubProxy.connection.stop(false, true);\n\n // Stop the heartbeat\n this.heartbeat.stop();\n\n // Dispose event bus\n super.dispose();\n }\n\n public canCastToDevice(deviceType: DeviceType): boolean {\n if (deviceType === DeviceType.AppleTv)\n return true;\n\n return false;\n }\n\n public getDevices(): Device[] {\n return this.devices;\n }\n\n public startCastSession(config: SessionConfig): CastSession {\n return new AppleTvCastSession(this, config);\n }\n\n public async lock(deviceId: string): Promise<void> {\n const locked = await this.invoke<boolean>(\n SignalrMethodName.Lock,\n deviceId,\n this.options.userId,\n this.options.username ?? '' // Fall back to an anonymous username if none is provided\n );\n\n if (!locked)\n throw new Error('Could not lock device');\n }\n\n public async loadVideo(deviceId: string): Promise<void> {\n if (!this.options.trackingCode)\n throw new Error('Tracking code must be provided to cast videos');\n\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play,\n Data: this.options.trackingCode\n });\n }\n\n public async play(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play\n });\n }\n\n public async pause(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Pause\n });\n }\n\n public seek(deviceId: string, position: number): void {\n this.invokeDebounced(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Play,\n Params: `1,${Math.trunc(position)}` // Always seek to the first chapter at the specified position\n });\n }\n\n public async stop(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Command, {\n DeviceId: deviceId,\n CommandType: PlaybackStatus.Stop\n });\n }\n\n public async pair(pairRequest: AppleTvPairRequest): Promise<OnlineApiDevice> {\n const result = await this.invoke<OnlineApiDevice>(SignalrMethodName.Pair, pairRequest);\n\n if (!result)\n throw new Error('Could not pair device');\n\n return result;\n }\n\n public async unpair(deviceId: string): Promise<void> {\n await this.invoke(SignalrMethodName.Unpair, deviceId);\n }\n\n public async renameDevice({ deviceId, deviceName }: AppleTvRenameRequest): Promise<void> {\n const renamed = await this.invoke(SignalrMethodName.RenameDevice, deviceId, deviceName);\n\n if (!renamed)\n throw new Error('Could not rename device');\n }\n\n public static convertToGenericDeviceStatus(status: OnlineApiDeviceStatus): DeviceStatus {\n switch (status) {\n case OnlineApiDeviceStatus.Online:\n return DeviceStatus.Available;\n\n case OnlineApiDeviceStatus.Locked:\n return DeviceStatus.Busy;\n\n case OnlineApiDeviceStatus.Suspended:\n case OnlineApiDeviceStatus.Offline:\n return DeviceStatus.Offline;\n }\n }\n \n public static convertToGenericDevice(device: OnlineApiDevice): Device {\n return {\n id: device.deviceId,\n name: device.name,\n type: DeviceType.AppleTv,\n status: AppleTvClient.convertToGenericDeviceStatus(device.status)\n };\n }\n}\n","/**\n * Inspired by https://github.com/marchaos/resilient-websocket\n */\n\nimport { Scheduler } from './scheduler';\n\ntype MessageData = string | ArrayBufferLike | Blob | ArrayBufferView;\n\ninterface ResilientWebSocketOptions {\n reconnectIntervalInMilliseconds?: number;\n heartbeatEnabled?: boolean;\n heartbeatIntervalInMillseconds?: number;\n heartbeatMessage?: MessageData;\n}\n\nconst defaultOptions: ResilientWebSocketOptions = {\n reconnectIntervalInMilliseconds: 3000,\n heartbeatEnabled: false,\n heartbeatIntervalInMillseconds: 10000,\n heartbeatMessage: ''\n};\n\nexport class ResilientWebSocket {\n private readonly url: string;\n private readonly options: ResilientWebSocketOptions;\n \n private webSocket: WebSocket;\n private heartbeat: Scheduler;\n\n public onOpen?: (event: Event) => void;\n public onClose?: (event?: CloseEvent) => void;\n public onMessage?: (event: MessageEvent) => void;\n public onError?: (event: Event) => void;\n \n constructor(url: string, options: ResilientWebSocketOptions = defaultOptions) {\n this.bindFunctions();\n\n this.url = url;\n this.options = { ...defaultOptions, ...options };\n this.webSocket = this.connect();\n this.heartbeat = new Scheduler()\n .schedule(() => this.send(this.options.heartbeatMessage))\n .every(this.options.heartbeatIntervalInMillseconds);\n }\n\n private bindFunctions(): void {\n this.cleanup = this.cleanup.bind(this);\n this.handleOpen = this.handleOpen.bind(this);\n this.handleMessage = this.handleMessage.bind(this);\n this.handleClose = this.handleClose.bind(this);\n this.handleError = this.handleError.bind(this);\n this.connect = this.connect.bind(this);\n this.send = this.send.bind(this);\n this.dipose = this.dipose.bind(this);\n }\n\n private cleanup(): void {\n this.heartbeat.stop();\n\n this.webSocket.removeEventListener('error', this.handleError);\n this.webSocket.removeEventListener('message', this.handleMessage);\n this.webSocket.removeEventListener('open', this.handleOpen);\n this.webSocket.removeEventListener('close', this.handleClose);\n }\n\n private handleOpen(event?: Event): void {\n this.onOpen?.(event);\n\n if (this.options.heartbeatEnabled)\n this.heartbeat.start();\n }\n\n private handleMessage(event: MessageEvent): void {\n this.onMessage?.(event);\n }\n\n private handleClose(event?: CloseEvent): void {\n this.onClose?.(event);\n\n this.cleanup();\n\n setTimeout(() => {\n this.webSocket = this.connect();\n }, this.options.reconnectIntervalInMilliseconds);\n }\n\n private handleError(event: Event): void {\n this.onError?.(event);\n this.handleClose();\n }\n\n public connect(): WebSocket {\n const socket = new WebSocket(this.url);\n \n socket.addEventListener('open', this.handleOpen);\n socket.addEventListener('message', this.handleMessage);\n socket.addEventListener('close', this.handleClose);\n socket.addEventListener('error', this.handleError);\n\n return socket;\n }\n\n public send(data: MessageData): void {\n this.webSocket.send(data);\n }\n\n public dipose(): void {\n this.cleanup();\n this.webSocket.close();\n }\n}\n","import { Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { ProxyHelper } from 'projects/player/plugins/devices-plugin/utils/proxy-helper';\n\nconst PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS = 2000;\n\nexport class ViviCastSessionState {\n public duration: number | undefined;\n public mute: boolean;\n public videoSource: string;\n public subtitleSource: string;\n public subtitles: boolean;\n public volume: number;\n public title: string;\n public device: Device;\n public ready: boolean;\n public playbackFinished: boolean;\n public debounced: ViviCastSessionState;\n\n private _position: number;\n private _playing: boolean;\n private _timerStartedAt: number = 0;\n\n constructor(title: string, device: Device) {\n this.position = 0;\n this.duration = undefined;\n this.playing = false;\n this.mute = false;\n this.videoSource = '';\n this.subtitleSource = '';\n this.subtitles = false;\n this.volume = 0;\n this.title = title;\n this.device = device;\n this.ready = false;\n this.playbackFinished = false;\n this.debounced = ProxyHelper.withDebouncedSetters(this, PROPERTY_SETTER_DEBOUNCE_DURATION_IN_MILLISECONDS);\n \n return ProxyHelper.withTimestampedSetters(this);\n }\n\n public get position() {\n return this._position + this.getTimerDurationInSeconds();\n }\n \n public set position(val: number) {\n this._position = val;\n this.restartTimer();\n }\n\n public get playing() {\n return this._playing;\n }\n \n public set playing(val: boolean) {\n this._playing = val;\n\n if (val) {\n this.restartTimer();\n } else {\n this._position += this.getTimerDurationInSeconds();\n this.stopTimer();\n }\n }\n\n private restartTimer() {\n this._timerStartedAt = Date.now();\n }\n\n private stopTimer() {\n this._timerStartedAt = 0;\n }\n\n private getTimerDurationInSeconds() {\n if (this._timerStartedAt) {\n const duration = Date.now() - this._timerStartedAt;\n return duration / 1000;\n }\n\n return 0;\n }\n}\n","import { HashObject } from 'libs/common/react/interfaces';\n\nimport { ClientEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nexport interface ViviUrl {\n id?: string;\n url: string;\n title: string;\n suburl: string;\n}\n\nexport interface ViviRoom {\n id: string;\n name: string;\n organisation: string;\n location?: string;\n}\n\nexport interface ViviPlayState {\n duration: number;\n position: number;\n playing: boolean;\n volume: number;\n mute: boolean;\n chapter: number;\n subtitles: boolean;\n}\n\nexport interface ViviOutgoingIdentifyMessage {\n destination: 'relay';\n message: {\n type: 'identify_video_api',\n token: string\n };\n}\n\nexport interface ViviOutgoingRoomsMessage {\n destination: 'relay';\n message: {\n type: 'video_api_rooms'\n };\n}\n\nexport interface ViviOutgoingJoinRoomMessage {\n destination: 'relay';\n message: {\n type: 'connect',\n destination_type: 'box',\n new_destination: string,\n token: string\n };\n}\n\nexport interface ViviOutgoingQueryMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'query',\n ack_id: string\n };\n}\n\nexport interface ViviOutgoingQueueLoadMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'queue_load',\n ack_id: string,\n payload: {\n urls: ViviUrl[]\n }\n };\n}\n\nexport interface ViviOutgoingPlayMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_play',\n payload: HashObject // Yep, we need to send an empty object here\n };\n}\n\nexport interface ViviOutgoingPauseMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_pause'\n };\n}\n\nexport interface ViviOutgoingStopMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_stop'\n };\n}\n\nexport interface ViviOutgoingSeekMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'video_seek',\n payload: {\n position: number\n }\n };\n}\n\nexport interface ViviOutgoingVolumeMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'set_volume',\n payload: {\n volume: number\n }\n };\n}\n\nexport interface ViviOutgoingMuteMessage {\n destination: string;\n message: {\n type: 'message',\n name: 'set_mute',\n payload: {\n mute: boolean\n }\n };\n}\n\nexport interface ViviOutgoingSubtitleMessage {\n destination: string;\n message: {\n type: 'message_with_ack',\n name: 'set_subtitles',\n ack_id: string,\n payload: {\n subtitles: boolean\n }\n };\n}\n\nexport enum ViviEventName {\n Update = 'update',\n Volume = 'volume',\n Playing = 'playing',\n Paused = 'paused',\n NewChapter = 'new_chapter',\n Stopped = 'stopped',\n Ready = 'ready',\n Mute = 'mute',\n Finished = 'finished',\n Subtitles = 'subtitles'\n}\n\nexport type ViviOutgoingMessage =\n ViviOutgoingIdentifyMessage |\n ViviOutgoingRoomsMessage |\n ViviOutgoingJoinRoomMessage |\n ViviOutgoingQueryMessage |\n ViviOutgoingQueueLoadMessage |\n ViviOutgoingPlayMessage |\n ViviOutgoingPauseMessage |\n ViviOutgoingStopMessage |\n ViviOutgoingSeekMessage |\n ViviOutgoingVolumeMessage |\n ViviOutgoingMuteMessage |\n ViviOutgoingSubtitleMessage;\n\nexport interface ViviIncomingMessageParams {\n level?: number;\n chapter?: number;\n duration?: number;\n position?: number;\n playing?: boolean;\n mute?: boolean;\n subtitles?: boolean;\n queue?: ViviUrl[];\n}\n\nexport interface ViviIncomingMessagePayload {\n play_state?: ViviPlayState;\n urls?: ViviUrl[];\n event?: ViviEventName;\n params?: ViviIncomingMessageParams;\n}\n\nexport interface ViviIncomingMessage {\n source: string;\n message: {\n type: string,\n payload?: ViviIncomingMessagePayload,\n error_type?: string,\n ack_id?: string,\n rooms?: ViviRoom[]\n };\n}\n\nexport interface ViviLoadQueueRequest {\n roomId: string;\n title: string;\n videoSource: string;\n subtitleSource?: string;\n}\n\nexport interface ViviClientEventMap extends ClientEvents {\n message: ViviIncomingMessage;\n connected: void;\n}\n","import { CastSession, Device, SessionConfig, SessionEvents } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\n\nimport { ViviCastSessionState } from './vivi-cast-session-state';\nimport { ViviClient } from './vivi-client';\nimport { ViviEventName, ViviIncomingMessage, ViviIncomingMessageParams } from './vivi-interfaces';\n\nexport class ViviCastSession extends EventBus<SessionEvents> implements CastSession {\n private client: ViviClient;\n private localState: ViviCastSessionState;\n\n constructor(client: ViviClient, config: SessionConfig) {\n super();\n\n this.client = client;\n this.localState = new ViviCastSessionState(config.title, config.device);\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.dispose = this.dispose.bind(this);\n \n this.handleClientConnected = this.handleClientConnected.bind(this);\n this.handleDisconnectMessage = this.handleDisconnectMessage.bind(this);\n this.handleAllVideoMessages = this.handleAllVideoMessages.bind(this);\n this.handleUpdateMessage = this.handleUpdateMessage.bind(this);\n this.handleVolumeMessage = this.handleVolumeMessage.bind(this);\n this.handlePlayingMessage = this.handlePlayingMessage.bind(this);\n this.handlePausedMessage = this.handlePausedMessage.bind(this);\n this.handleFinishedMessage = this.handleFinishedMessage.bind(this);\n this.handleNewChapterMessage = this.handleNewChapterMessage.bind(this);\n this.handleStoppedMessage = this.handleStoppedMessage.bind(this);\n\n this.loadSource = this.loadSource.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.isPlaying = this.isPlaying.bind(this);\n this.getPosition = this.getPosition.bind(this);\n this.getDuration = this.getDuration.bind(this);\n this.getVolume = this.getVolume.bind(this);\n }\n\n private initialize(): void {\n // Subscribe to client diposed messages\n this.client.on('dispose', this.dispose);\n\n // Subscribe to client connected messages\n this.client.on('connected', this.handleClientConnected);\n\n // Subscribe to device disconnect messages\n this.client\n .on('message', this.handleDisconnectMessage)\n .filter(msg =>\n msg.source === this.getDevice().id &&\n msg.message.type === 'disconnect');\n\n // Subscribe to device video messages\n this.client\n .on('message', this.handleAllVideoMessages)\n .filter(msg =>\n msg.source === this.getDevice().id &&\n msg.message.type === 'video_event');\n }\n\n public dispose(): void {\n // Cleanup the subscriptions from the initialize function\n this.client.off('dispose', this.dispose);\n this.client.off('connected', this.handleClientConnected);\n this.client.off('message', this.handleDisconnectMessage);\n this.client.off('message', this.handleAllVideoMessages);\n\n // Do our best to signal to the device that we're done with it\n this.client.stop(this.getDevice().id).catch(err => console.error(err));\n\n // Trigger the dispose event\n super.dispose();\n }\n\n private async handleClientConnected(): Promise<void> {\n try {\n await this.client.joinRoom(this.getDevice().id);\n } catch (error) {\n this.trigger('error', error);\n }\n }\n\n private handleDisconnectMessage(): void {\n this.dispose();\n }\n\n private handleAllVideoMessages(msg: ViviIncomingMessage): void {\n const localState = this.localState.debounced;\n const remoteState = msg.message.payload.params || {};\n\n switch (msg.message.payload.event) {\n case ViviEventName.Update:\n this.handleUpdateMessage(localState, remoteState);\n break;\n\n case ViviEventName.NewChapter:\n this.handleNewChapterMessage(localState, remoteState);\n break;\n \n case ViviEventName.Volume:\n this.handleVolumeMessage(localState, remoteState);\n break;\n\n case ViviEventName.Playing:\n this.handlePlayingMessage(localState);\n break;\n\n case ViviEventName.Paused:\n this.handlePausedMessage(localState);\n break;\n\n case ViviEventName.Finished:\n this.handleFinishedMessage(localState);\n break;\n \n case ViviEventName.Stopped:\n this.handleStoppedMessage();\n break;\n }\n }\n\n private handleUpdateMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n if (localState.duration !== remoteState.duration) {\n localState.duration = remoteState.duration;\n this.trigger('durationchange', Event.void);\n }\n\n if (localState.position !== remoteState.position) {\n localState.position = remoteState.position;\n this.trigger('positionchange', Event.void);\n }\n\n if (localState.subtitles !== remoteState.subtitles) {\n localState.subtitles = remoteState.subtitles;\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n private handleVolumeMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n if (localState.volume !== remoteState.level) {\n localState.volume = remoteState.level;\n localState.mute = remoteState.level === 0;\n this.trigger('volumechange', Event.void);\n }\n }\n\n private handlePlayingMessage(localState: ViviCastSessionState): void {\n if (localState.playing !== true) {\n localState.playing = true;\n localState.playbackFinished = false;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handlePausedMessage(localState: ViviCastSessionState): void {\n if (localState.playing !== false) {\n localState.playing = false;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handleFinishedMessage(localState: ViviCastSessionState): void {\n if (localState.playbackFinished !== true) {\n localState.playing = false;\n localState.playbackFinished = true;\n this.trigger('playingchange', Event.void);\n }\n }\n\n private handleNewChapterMessage(localState: ViviCastSessionState, remoteState: ViviIncomingMessageParams): void {\n const remoteUrls = remoteState.queue ?? [];\n const remoteChapter = remoteUrls.find(x => x.url === localState.videoSource);\n\n if (!remoteChapter) {\n console.info(`The device is no longer playing the source we loaded - disposing the session`);\n this.dispose();\n return;\n }\n\n if (localState.subtitleSource !== remoteChapter.suburl) {\n localState.subtitleSource = remoteChapter.suburl;\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n private handleStoppedMessage(): void {\n this.dispose();\n }\n\n public async loadSource(videoSource: string, subtitleSource?: string): Promise<void> {\n if (this.localState.videoSource === videoSource && this.localState.subtitleSource === subtitleSource)\n return;\n\n try {\n // Prepare some handy variables\n const roomId = this.getDevice().id;\n const currentPosition = this.getPosition();\n \n // Set the sources\n this.localState.videoSource = videoSource;\n this.localState.subtitleSource = subtitleSource;\n\n // Mark the session as not ready while we're loading a source\n this.localState.ready = false;\n\n // We need to be connected to the room before we can load a source\n await this.client.joinRoom(roomId);\n\n // Load the source\n await this.client.loadQueue({\n title: this.getTitle(),\n roomId,\n videoSource,\n subtitleSource\n });\n\n // Mark the session as ready\n this.localState.ready = true;\n\n // Notify listeners that the source has changed\n this.trigger('sourceloaded', Event.void);\n\n // Seek to where we were before changing sources\n if (currentPosition > 0)\n this.seek(currentPosition);\n\n // We need to explicity set subtitles if we have a subtitle source\n if (subtitleSource)\n this.setSubtitles(subtitleSource);\n } catch (error) {\n console.error(error);\n\n this.trigger('error', new Error('Could not load video on Vivi device'));\n }\n }\n\n public play(): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.playing !== true) {\n this.localState.playing = true;\n this.client.play(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public pause(): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.playing !== false) {\n this.localState.playing = false;\n this.client.pause(this.getDevice().id);\n this.trigger('playingchange', Event.void);\n }\n }\n\n public seek(position: number): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.position !== position) {\n this.localState.position = position;\n this.client.seek(this.getDevice().id, position);\n this.trigger('positionchange', Event.void);\n }\n }\n\n public setVolume(volume: number): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.volume !== volume) {\n this.localState.volume = volume;\n this.client.setVolume(this.getDevice().id, volume);\n this.trigger('volumechange', Event.void);\n }\n }\n\n public setMuted(muted: boolean): void {\n if (!this.localState.ready)\n return;\n\n if (this.localState.mute !== muted) {\n this.localState.mute = muted;\n this.client.setMuted(this.getDevice().id, muted);\n this.trigger('volumechange', Event.void);\n }\n }\n\n public async setSubtitles(subtitleSource?: string): Promise<void> {\n if (!this.localState.ready)\n return;\n\n if (subtitleSource)\n await this.loadSource(this.localState.videoSource, subtitleSource);\n \n const showSubtitles = !!subtitleSource;\n\n if (this.localState.subtitles !== showSubtitles) {\n this.localState.subtitles = showSubtitles;\n this.client.setSubtitles(this.getDevice().id, showSubtitles);\n this.trigger('subtitleschange', Event.void);\n }\n }\n\n public isPlaying(): boolean {\n return this.localState.playing;\n }\n\n public isPlaybackFinished(): boolean {\n return this.localState.playbackFinished;\n }\n\n public getPosition(): number {\n return this.localState.position;\n }\n\n public getDuration(): number | undefined {\n return this.localState.duration;\n }\n\n public getVolume(): number {\n return this.localState.volume;\n }\n\n public getMuted(): boolean {\n return this.localState.mute;\n }\n\n public getSubtitles(): string | undefined {\n if (this.localState.subtitles)\n return this.localState.subtitleSource;\n }\n\n public getDevice(): Device {\n return this.localState.device;\n }\n\n public getTitle(): string {\n return this.localState.title;\n }\n}\n","import { CastSession, Client, Device, DeviceStatus, DeviceType, SessionConfig } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { Event, EventBus } from 'projects/player/plugins/devices-plugin/utils/event-bus';\nimport { ResilientWebSocket } from 'projects/player/plugins/devices-plugin/utils/resilient-web-socket';\nimport { Scheduler } from 'projects/player/plugins/devices-plugin/utils/scheduler';\nimport { debounce } from 'projects/player/utils/fn';\nimport { IdHelper } from 'projects/player/utils/id-helper';\n\nimport { ViviCastSession } from './vivi-cast-session';\nimport { ViviClientEventMap, ViviIncomingMessage, ViviLoadQueueRequest, ViviOutgoingMessage, ViviRoom } from './vivi-interfaces';\n\nconst MESSAGE_TIMEOUT_IN_MILLISECONDS = 10000;\nconst MESSAGE_DEBOUNCE_IN_MILLISECONDS = 500;\nconst DEVICE_DISCOVERY_SCHEDULE_IN_MILLISECONDS = 10000;\n\ninterface ViviClientOptions {\n url: string;\n fetchAccessToken: () => Promise<string>;\n}\n\nexport class ViviClient extends EventBus<ViviClientEventMap> implements Client<ViviClientEventMap> {\n private options: ViviClientOptions;\n private webSocket?: ResilientWebSocket;\n private accessToken: string;\n private devices: Device[];\n private devicesFingerprint: string;\n private deviceDiscovery: Scheduler;\n\n private sendMessageDebounced: (msg: ViviOutgoingMessage) => boolean;\n\n constructor(options: ViviClientOptions) {\n super();\n \n this.options = options;\n this.accessToken = '';\n this.devices = [];\n this.devicesFingerprint = '';\n this.deviceDiscovery = new Scheduler();\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n this.sendMessageDebounced = debounce(this.sendMessage, MESSAGE_DEBOUNCE_IN_MILLISECONDS, true);\n this.beginDeviceDiscovery = this.beginDeviceDiscovery.bind(this);\n this.dispose = this.dispose.bind(this);\n this.canCastToDevice = this.canCastToDevice.bind(this);\n this.getDevices = this.getDevices.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.authenticateWithVivi = this.authenticateWithVivi.bind(this);\n this.getRoomList = this.getRoomList.bind(this);\n this.joinRoom = this.joinRoom.bind(this);\n this.query = this.query.bind(this);\n this.loadQueue = this.loadQueue.bind(this);\n this.play = this.play.bind(this);\n this.pause = this.pause.bind(this);\n this.stop = this.stop.bind(this);\n this.seek = this.seek.bind(this);\n this.setVolume = this.setVolume.bind(this);\n this.setMuted = this.setMuted.bind(this);\n this.setSubtitles = this.setSubtitles.bind(this);\n }\n\n private initialize(): void {\n this.webSocket = new ResilientWebSocket(this.options.url);\n\n this.webSocket.onMessage = (event: MessageEvent) => this.trigger('message', JSON.parse(event.data));\n\n this.webSocket.onOpen = async () => {\n try {\n this.accessToken = await this.options.fetchAccessToken();\n \n await this.authenticateWithVivi();\n \n this.beginDeviceDiscovery();\n\n this.trigger('connected', Event.void);\n } catch (err) {\n console.error(err);\n \n this.trigger('error', new Error('Could not connect to Vivi'));\n }\n };\n }\n\n private sendMessage(msg: ViviOutgoingMessage): void {\n this.webSocket?.send(JSON.stringify(msg));\n }\n\n private beginDeviceDiscovery(): void {\n this.deviceDiscovery\n .every(DEVICE_DISCOVERY_SCHEDULE_IN_MILLISECONDS)\n .schedule(async () => {\n try {\n const rooms = await this.getRoomList();\n const roomsFingerprint = ViviClient.calculateFingerprint(rooms);\n\n // If the rooms haven't changed, don't bother updating the devices\n if (roomsFingerprint === this.devicesFingerprint)\n return;\n\n const numberOfUniqueOrganisations = new Set(rooms.map(r => r.organisation ?? '')).size;\n const numberOfUniqueLocations = new Set(rooms.map(r => r.location ?? '')).size;\n\n this.devices = rooms.map(r => ({\n id: r.id,\n name: r.name,\n schoolName: numberOfUniqueOrganisations > 1 ? r.organisation : '',\n description: numberOfUniqueLocations > 1 ? r.location : '',\n type: DeviceType.Vivi,\n status: DeviceStatus.Available\n }));\n\n this.devicesFingerprint = roomsFingerprint;\n\n this.trigger('deviceschange', Event.void);\n } catch (error) {\n // This could be a transient error, so we don't want to trigger the 'error' event\n // as that would cause the player to stop playback for an error that it could recover from..\n console.warn(error);\n }\n })\n .trigger()\n .start();\n }\n\n public dispose(): void {\n // Stop the device discovery\n this.deviceDiscovery.stop();\n\n // Dispose websocket\n this.webSocket?.dipose();\n\n // Dispose event bus\n super.dispose();\n }\n\n public canCastToDevice(deviceType: DeviceType): boolean {\n if (deviceType === DeviceType.Vivi)\n return true;\n\n return false;\n }\n\n public getDevices(): Device[] {\n return this.devices;\n }\n\n public startCastSession(config: SessionConfig): CastSession {\n return new ViviCastSession(this, config);\n }\n\n public async authenticateWithVivi(): Promise<void> {\n this.sendMessage({\n destination: 'relay',\n message: {\n token: this.accessToken,\n type: 'identify_video_api'\n }\n });\n\n await this\n .one('message', msg => msg.message.type === 'video_api_identified')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to authenticate with Vivi'); });\n }\n\n public async getRoomList(): Promise<ViviRoom[]> {\n this.sendMessage({\n destination: 'relay',\n message: {\n type: 'video_api_rooms'\n }\n });\n\n const response = await this\n .one('message', msg => msg.message.type === 'video_api_rooms')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to fetch rooms'); });\n\n return response.message.rooms || [];\n }\n\n public async joinRoom(roomId: string): Promise<void> {\n this.sendMessage({\n destination: 'relay',\n message: {\n destination_type: 'box',\n new_destination: roomId,\n token: this.accessToken,\n type: 'connect'\n }\n });\n\n await this\n .one('message', msg => {\n if (msg.source === roomId && msg.message.type === 'connect') return true;\n if (msg.message.type === 'error' && msg.message.error_type === 'already_connected') return true;\n })\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to join room'); });\n }\n\n public async query(roomId: string): Promise<ViviIncomingMessage> {\n const ackId = ViviClient.createAckId();\n\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ackId,\n name: 'query'\n }\n });\n\n return await this\n .one('message', msg => msg.message.ack_id === ackId)\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to fetch query'); });\n }\n\n public async loadQueue({ roomId, title, videoSource, subtitleSource }: ViviLoadQueueRequest): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ViviClient.createAckId(),\n name: 'queue_load',\n payload: {\n urls: [{\n title,\n url: videoSource,\n suburl: subtitleSource\n }]\n }\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'ready')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to load media'); });\n }\n\n public async play(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_play',\n payload: {}\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'playing')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to play video'); });\n }\n\n public async pause(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_pause'\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'paused')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to pause video'); });\n }\n\n public async stop(roomId: string): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_stop'\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'stopped')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to stop video'); });\n }\n\n public async seek(roomId: string, position: number): Promise<void> {\n const sent = this.sendMessageDebounced({\n destination: roomId,\n message: {\n type: 'message',\n name: 'video_seek',\n payload: {\n position\n }\n }\n });\n\n if (sent) {\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'playing')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to seek video'); });\n }\n }\n\n public async setVolume(roomId: string, volume: number): Promise<void> {\n const sent = this.sendMessageDebounced({\n destination: roomId,\n message: {\n type: 'message',\n name: 'set_volume',\n payload: {\n volume\n }\n }\n });\n\n if (sent) {\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'volume')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set volume'); });\n }\n }\n\n public async setMuted(roomId: string, muted: boolean): Promise<void> {\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message',\n name: 'set_mute',\n payload: {\n mute: muted\n }\n }\n });\n\n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'mute')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set mute'); });\n }\n\n public async setSubtitles(roomId: string, showSubtitles: boolean): Promise<void> {\n const ackId = ViviClient.createAckId();\n\n this.sendMessage({\n destination: roomId,\n message: {\n type: 'message_with_ack',\n ack_id: ackId,\n name: 'set_subtitles',\n payload: {\n subtitles: showSubtitles\n }\n }\n });\n \n await this\n .one('message', msg => msg.source === roomId && msg.message.payload?.event === 'subtitles')\n .timeout(MESSAGE_TIMEOUT_IN_MILLISECONDS)\n .catch(() => { throw new Error('Failed to set subtitles'); });\n }\n\n private static createAckId(): string {\n return IdHelper.generateRandomId();\n }\n\n private static calculateFingerprint(devicesOrRooms: { id: string }[]): string {\n return devicesOrRooms.map(dr => dr.id).sort().join(',');\n }\n}\n","import { CastSession, Client, Device, SessionConfig } from './clients/client-interfaces';\nimport { BaseEvents, EventBus } from './utils/event-bus';\n\ninterface DevicesSessionManagerEventMap extends BaseEvents {\n deviceschange: Device[];\n castsessionchange: CastSession | undefined;\n error: Error;\n}\n\nexport class DevicesSessionManager extends EventBus<DevicesSessionManagerEventMap> {\n private instanceId: string;\n private clients: Client[];\n private castSession?: CastSession;\n\n private constructor(instanceId: string) {\n super();\n\n this.instanceId = instanceId;\n this.clients = [];\n \n this.bindFunctions();\n }\n\n private bindFunctions(): void {\n this.addClient = this.addClient.bind(this);\n this.hasInstanceOfClient = this.hasInstanceOfClient.bind(this);\n this.startCastSession = this.startCastSession.bind(this);\n this.gatherAndPublishDevices = this.gatherAndPublishDevices.bind(this);\n this.dispose = this.dispose.bind(this);\n }\n\n public addClient(client: Client): void {\n client.on('deviceschange', this.gatherAndPublishDevices);\n client.on('error', err => this.trigger('error', err));\n \n this.clients.push(client);\n }\n\n public hasInstanceOfClient(clientType: any): boolean {\n return this.clients.some(c => c instanceof clientType);\n }\n \n public startCastSession(config: SessionConfig): void {\n // If a session with the selected device is already in progress, we need to dispose it\n if (this.castSession) {\n if (this.castSession.getDevice().id !== config.device.id)\n this.castSession.dispose();\n else {\n console.info(`A session with device ${config.device.id} already exists - this is a no-op`);\n return;\n }\n }\n\n // Find a client that can cast to the selected device\n const client = this.clients.find(c => c.canCastToDevice(config.device.type));\n\n // Create a new session and notify listeners\n if (client) {\n this.castSession = client.startCastSession(config);\n\n this.castSession.on('error', err => {\n this.castSession.dispose();\n this.trigger('error', err);\n });\n\n this.castSession.on('dispose', () => {\n this.castSession = undefined;\n this.trigger('castsessionchange', undefined);\n });\n \n this.trigger('castsessionchange', this.castSession);\n }\n }\n\n public getCastSession(): CastSession | undefined {\n return this.castSession;\n }\n\n private gatherAndPublishDevices(): void {\n const results = this.clients.map(c => c.getDevices());\n const devices = results.reduce((agg, val) => [ ...agg, ...val ], []);\n\n this.trigger('deviceschange', devices);\n }\n\n public dispose(): void {\n this.castSession?.dispose();\n this.clients.forEach(c => c.dispose());\n \n this.castSession = undefined;\n this.clients = [];\n\n super.dispose();\n }\n\n private static instances: {[key: string]: DevicesSessionManager } = {};\n\n public static getOrCreateInstance(instanceId: string): DevicesSessionManager {\n if (!instanceId)\n throw new Error('instanceId is required');\n\n if (!this.instances[instanceId])\n this.instances[instanceId] = new DevicesSessionManager(instanceId);\n \n return this.instances[instanceId];\n }\n\n public static disposeAndRemoveInstance(sessionManager: DevicesSessionManager): void {\n sessionManager.dispose();\n delete this.instances[sessionManager.instanceId];\n }\n\n public static isActive(): boolean {\n return Object.keys(this.instances).length > 0;\n }\n}\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport './device-menu-item.scss';\n\ninterface DeviceMenuItemOptions extends videojs.MenuItemOptions {\n available: boolean;\n type: DeviceType;\n id: string;\n schoolName?: string;\n description?: string;\n onClick: () => void;\n}\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\nexport class DeviceMenuItem extends MenuItem {\n public options_: DeviceMenuItemOptions;\n\n constructor(player: VideoJsPlayer, options?: DeviceMenuItemOptions) {\n super(player, options);\n\n this.isVisible = this.isVisible.bind(this);\n }\n\n public createEl(): HTMLLIElement {\n const iconClassNames: Record<DeviceType, string> = {\n 'vivi': 'cv-vivi-icon',\n 'apple-tv': 'cv-apple-icon'\n };\n\n const container = super.createEl('li', {\n className: 'vjs-menu-item cv-device-menu-item'\n });\n\n const el = videojs.dom.createEl('div', {\n className: 'cv-device-menu-item-body',\n innerHTML: `\n <span class=\"cv-device-icon ${iconClassNames[this.options_.type]}\"></span>\n <div>\n <span class=\"vjs-menu-item-text\">${this.options_.label}</span>\n <span class=\"vjs-menu-item-text cv-device-truncated-text\">${this.options_.schoolName ?? ''}</span>\n <span class=\"vjs-menu-item-text cv-device-truncated-text cv-device-description\">${this.options_.description ?? ''}</span>\n </div>\n `\n });\n\n container.replaceChildren(el);\n\n return container;\n }\n\n public handleClick(): void {\n this.options_.onClick();\n }\n\n public show(): void {\n super.show();\n }\n\n public hide(): void {\n super.hide();\n }\n\n public isVisible(): boolean {\n return !super.hasClass('vjs-hidden');\n }\n}\n","import SimpleBar from 'simplebar';\nimport videojs from 'video.js';\n\nimport { baseMenuCreateEl } from 'projects/player/components/menu/menu';\n\nimport './devices-menu.scss';\n\nconst Menu = videojs.getComponent('Menu');\n\nexport class DevicesMenu extends Menu {\n private contentWrapper: HTMLDivElement;\n private ctaElement: HTMLDivElement;\n private simpleBar: SimpleBar;\n\n public createEl(): HTMLDivElement {\n const el = baseMenuCreateEl.apply(this);\n const content = (this as any).contentEl_;\n\n this.contentWrapper = videojs.dom.createEl('div', {\n className: 'vjs-menu-content'\n }) as HTMLDivElement;\n \n el.className = 'vjs-menu cv-devices-menu';\n content.className = 'cv-devices-menu-item-list';\n\n el.removeChild(content);\n el.appendChild(this.contentWrapper);\n\n this.contentWrapper.appendChild(content);\n this.simpleBar = new SimpleBar(content as HTMLElement, { autoHide: false });\n\n return el;\n }\n\n public addCta(component: videojs.Component): void {\n if (this.ctaElement) {\n console.warn('CTA has already been added to the menu - this is a no-op');\n return;\n }\n\n this.ctaElement = component.el() as HTMLDivElement;\n this.contentWrapper.prepend(this.ctaElement);\n this.el().classList.add('has-cta');\n }\n\n public removeCta(): void {\n if (this.ctaElement) {\n this.contentWrapper.removeChild(this.ctaElement);\n this.el().classList.remove('has-cta');\n }\n }\n}\n\nvideojs.registerComponent('DevicesMenu', DevicesMenu);\n","import * as React from 'react';\nimport videojs, { VideoJsPlayer } from 'video.js';\n\nimport { CtaContext } from 'libs/shared/interfaces';\n\nimport { DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { getReactComponent } from 'projects/player/react/react-component';\n\nimport './devices-cta.scss';\n\ninterface DevicesCtaProps {\n onDismiss: (context: CtaContext) => void;\n onInstall: (context: CtaContext) => void;\n onLearnMore: (context: CtaContext) => void;\n onContactSupport: (context: CtaContext) => void;\n inactiveIntegrations: DeviceType[];\n canUserManageIntegrations: boolean;\n player: VideoJsPlayer;\n}\n\nfunction DevicesCta({\n inactiveIntegrations,\n canUserManageIntegrations,\n player,\n onDismiss,\n onInstall,\n onLearnMore,\n onContactSupport\n}: DevicesCtaProps): JSX.Element {\n if (inactiveIntegrations.length === 0) return <></>;\n\n const localize = (text: string) => player.localize(text);\n\n const isInactive = (val: DeviceType) =>\n inactiveIntegrations.indexOf(val) !== -1;\n\n let context: CtaContext;\n \n if (isInactive(DeviceType.AppleTv) && isInactive(DeviceType.Vivi))\n context = 'vivi_and_apple_tv';\n else if (isInactive(DeviceType.Vivi))\n context = 'vivi';\n else\n context = 'apple_tv';\n\n return (\n <div className='cv-devices-cta' tabIndex={-1}>\n <Header context={context} localize={localize} onDismiss={() => onDismiss(context)} />\n <Body context={context} />\n <Footer\n context={context}\n canUserManageIntegrations={canUserManageIntegrations}\n localize={localize}\n onContactSupport={() => onContactSupport(context)}\n onInstall={() => onInstall(context)}\n onLearnMore={() => onLearnMore(context)}\n />\n </div>\n );\n}\n\ninterface HeaderProps {\n context: CtaContext;\n localize: (text: string) => string;\n onDismiss: () => void;\n}\n\nfunction Header({ context, localize, onDismiss }: HeaderProps): JSX.Element {\n return (\n <div className='cv-devices-cta-header'>\n <span className='cv-devices-title'>\n {context === 'vivi_and_apple_tv' && localize('Cast to Vivi and Apple TV')}\n {context === 'vivi' && localize('Cast to Vivi')}\n {context === 'apple_tv' && localize('Cast to Apple TV')}\n </span>\n <span className='cv-devices-close' onClick={onDismiss}>\n <svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path fillRule='evenodd' clipRule='evenodd' fill='white' d='M11.9588 10.6413L16.3612 6.34478C16.7361 5.97191 17.3439 5.97191 17.7188 6.34478C18.0937 6.71764 18.0937 7.32218 17.7188 7.69505L13.3165 11.9916L17.7188 16.3701C18.0937 16.7429 18.0937 17.3475 17.7188 17.7203C17.3439 18.0932 16.7361 18.0932 16.3612 17.7203L11.9588 13.3419L7.63882 17.7203C7.26392 18.0932 6.65608 18.0932 6.28118 17.7203C5.90627 17.3475 5.90627 16.7429 6.28118 16.3701L10.6012 11.9916L6.28118 7.62993C5.90627 7.25706 5.90627 6.65252 6.28118 6.27965C6.65608 5.90678 7.26392 5.90678 7.63882 6.27965L11.9588 10.6413Z' />\n </svg>\n </span>\n </div>\n );\n}\n\ninterface BodyProps {\n context: CtaContext;\n}\n\nfunction Body({ context }: BodyProps): JSX.Element {\n const bgClassName = context === 'vivi_and_apple_tv' ? 'bg-vivi-and-apple' : context === 'vivi' ? 'bg-vivi' : 'bg-apple';\n\n return (\n <div className={`cv-devices-cta-body ${bgClassName}`}>\n {(context === 'vivi_and_apple_tv' || context === 'apple_tv') && <div className='cv-devices-icon-container'><span className='cv-devices-icon apple'></span></div>}\n {(context === 'vivi_and_apple_tv' || context === 'vivi') && <div className='cv-devices-icon-container'><span className='cv-devices-icon vivi'></span></div>}\n </div>\n );\n}\n\ninterface FooterProps {\n context: CtaContext;\n canUserManageIntegrations: boolean;\n localize: (text: string) => string;\n onInstall: () => void;\n onLearnMore: () => void;\n onContactSupport: () => void;\n}\n\nfunction Footer({\n context,\n canUserManageIntegrations,\n localize,\n onInstall,\n onLearnMore,\n onContactSupport\n}: FooterProps): JSX.Element {\n if (canUserManageIntegrations) {\n return (\n <div className='cv-devices-cta-footer'>\n <span>\n {context === 'vivi_and_apple_tv' && localize('Connect Vivi or Apple TV to make presenting in the classroom easy.')}\n {context === 'vivi' && localize('Connect Vivi to make presenting in the classroom easy.')}\n {context === 'apple_tv' && localize('Connect Apple TV to make presenting in the classroom easy.')}\n </span>\n <br />\n <span className='cv-devices-link' onClick={onInstall}>{localize('Click here to install')}</span>\n </div>\n );\n }\n\n return (\n <div className='cv-devices-cta-footer'>\n <span>\n {context === 'vivi_and_apple_tv' && localize('To cast to Vivi and Apple TV, contact ')}\n {context === 'vivi' && localize('To cast to Vivi, contact ')}\n {context === 'apple_tv' && localize('To cast to Apple TV, contact ')}\n </span>\n <span className='cv-devices-link' onClick={onContactSupport}>ClickView Support</span>\n <span>\n {context === 'vivi_and_apple_tv' && localize(' or your administrator to set them up.')}\n {context === 'vivi' && localize(' or your administrator to set it up.')}\n {context === 'apple_tv' && localize(' or your administrator to set it up.')}\n </span>\n <br />\n <span className='cv-devices-link' onClick={onLearnMore}>Learn more</span>\n </div>\n );\n}\n\nvideojs.registerComponent(\n 'DevicesCta',\n getReactComponent(\n (player: VideoJsPlayer, options: DevicesCtaProps) => <DevicesCta player={player} {...options} />,\n { properties: { className: 'cv-devices-cta-wrapper' } }\n )\n);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { CtaContext } from 'libs/shared/interfaces';\n\nimport { CollapsibleHeadingMenuItem } from 'projects/player/components/cog-button/collapsible-heading-menu-item';\nimport { NoMatchingResultsMenuItem, SearchInputMenuItem } from 'projects/player/components/search-input-menu-item/search-input-menu-item';\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\nimport { CastSession, Device, DeviceStatus, DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport { DeviceMenuItem } from '../device-menu-item/device-menu-item';\nimport { DevicesMenu } from '../devices-menu/devices-menu';\n\nimport './devices-button.scss';\n\nimport 'projects/player/plugins/devices-plugin/components/devices-cta/devices-cta';\n\nconst DEVICE_COUNT_THRESHOLD_FOR_SEARCH = 20;\n\nconst DevicesCta = videojs.getComponent('DevicesCta');\nconst MenuButton = videojs.getComponent('MenuButton');\n\nexport interface DevicesButtonOptions extends videojs.MenuButtonOptions {\n onClick: () => void;\n onDeviceMenuItemClick: (item: DeviceMenuItem, device: Device) => void;\n ctaOptions: {\n hasBeenDismissed: boolean,\n canUserManageIntegrations: boolean,\n inactiveIntegrations: DeviceType[],\n onDismiss: (context: CtaContext) => void,\n onInstall: (context: CtaContext) => void,\n onLearnMore: (context: CtaContext) => void,\n onContactSupport: (context: CtaContext) => void\n };\n}\n\nexport class DevicesButton extends MenuButton implements CollapsibleComponent {\n private searchText: string;\n private devices: Device[];\n private castSession?: CastSession;\n private headingItem?: CollapsibleHeadingMenuItem;\n private searchInputItem?: SearchInputMenuItem;\n private emptyPlaceholder?: NoMatchingResultsMenuItem;\n private cta?: videojs.Component;\n \n public options_: DevicesButtonOptions;\n public controlText_: string;\n\n constructor(player: VideoJsPlayer, options?: DevicesButtonOptions) {\n super(player, options);\n\n this.searchText = '';\n this.devices = [];\n this.castSession = undefined;\n\n this.bindFunctions();\n this.bindEventListeners();\n }\n\n private bindFunctions(): void {\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.setDevices = this.setDevices.bind(this);\n this.setCastSession = this.setCastSession.bind(this);\n this.setSearchText = this.setSearchText.bind(this);\n this.getDeviceMenuItems = this.getDeviceMenuItems.bind(this);\n this.render = this.render.bind(this);\n this.removeMenuItems = this.removeMenuItems.bind(this);\n this.addMenuItemsForDevices = this.addMenuItemsForDevices.bind(this);\n this.shouldShowSearchInput = this.shouldShowSearchInput.bind(this);\n this.toggleSearchInput = this.toggleSearchInput.bind(this);\n this.toggleDeviceMenuItems = this.toggleDeviceMenuItems.bind(this);\n this.toggleEmptyStatePlaceholder = this.toggleEmptyStatePlaceholder.bind(this);\n }\n\n private bindEventListeners(): void {\n const el = this.$('button');\n\n const onBlur = (e: videojs.EventTarget.Event) => {\n (this.menu as any).handleBlur(e);\n };\n\n el.addEventListener('blur', onBlur);\n\n this.one('dispose', () => {\n el.removeEventListener('blur', onBlur);\n this.cta?.dispose();\n });\n }\n\n public createEl(...args: any[]): Element {\n return MenuButton.prototype.createEl.apply(this, ...args);\n }\n\n public buildWrapperCSSClass() {\n return `cv-menu-small cv-devices-button ${super.buildWrapperCSSClass()}`;\n }\n\n public createMenu(): videojs.Menu {\n const menu = new DevicesMenu(this.player_, {\n menuButton: this\n });\n\n if (!this.options_.ctaOptions.hasBeenDismissed && this.options_.ctaOptions.inactiveIntegrations.length > 0) {\n const { onDismiss, ...rest } = this.options_.ctaOptions;\n\n this.cta = new DevicesCta(this.player(), {\n ...rest,\n onDismiss: (context: CtaContext) => {\n menu.removeCta();\n onDismiss(context);\n }\n } as any);\n\n menu.addCta(this.cta);\n }\n\n const children = this.createItems();\n\n children.forEach(x => menu.addItem(x));\n\n return menu;\n }\n\n public createItems(): videojs.MenuItem[] {\n const items: videojs.MenuItem[] = [];\n\n this.headingItem = new CollapsibleHeadingMenuItem(this.player_, {\n label: this.localize('Select a device'),\n selectable: false\n });\n\n this.searchInputItem = new SearchInputMenuItem(this.player_, {\n menuButton: this,\n search: searchText => this.setSearchText(searchText),\n className: 'cv-devices-search-input'\n });\n\n this.emptyPlaceholder = new NoMatchingResultsMenuItem(this.player_, {\n label: 'No devices found',\n selected: false,\n selectable: false,\n multiSelectable: false\n });\n\n this.headingItem.show();\n this.searchInputItem.hide();\n this.emptyPlaceholder.show();\n\n items.push(\n this.headingItem,\n this.searchInputItem,\n this.emptyPlaceholder\n );\n\n return items;\n }\n\n public pressButton(): void {\n super.pressButton();\n\n if (this.shouldShowSearchInput())\n this.searchInputItem?.focus();\n }\n\n public setDevices(devices: Device[]): void {\n this.devices = devices;\n this.render();\n }\n\n public setCastSession(castSession?: CastSession): void {\n this.castSession = castSession;\n this.render();\n }\n\n public setSearchText(searchText: string): void {\n this.searchText = searchText;\n this.render();\n }\n\n public getDeviceMenuItems(): DeviceMenuItem[] {\n return this.menu.children_.filter(x => x instanceof DeviceMenuItem) as DeviceMenuItem[];\n }\n\n private render(): void {\n // Update the UI\n this.removeMenuItems(this.getDeviceMenuItems());\n this.addMenuItemsForDevices(this.devices);\n this.toggleSearchInput();\n this.toggleDeviceMenuItems();\n this.toggleEmptyStatePlaceholder();\n }\n\n private removeMenuItems(items: videojs.MenuItem[]): void {\n items.forEach(x => {\n this.menu.removeChild(x);\n x.dispose();\n });\n }\n\n private addMenuItemsForDevices(devices: Device[]): void {\n // Sort devices by type, description and name\n const sortedDevices = devices.sort((a, b) => {\n const qualifiedNameDeviceA = `${a.type}${a.schoolName ?? ''}${a.description ?? ''}${a.name}`;\n const qualifiedNameDeviceB = `${b.type}${b.schoolName ?? ''}${b.description ?? ''}${b.name}`;\n return qualifiedNameDeviceA.localeCompare(qualifiedNameDeviceB);\n });\n\n sortedDevices.forEach(x => {\n const newItem = new DeviceMenuItem(this.player(), {\n id: x.id,\n label: x.name,\n schoolName: x.schoolName,\n description: x.description,\n selected: false,\n multiSelectable: false,\n selectable: true,\n available: x.status === DeviceStatus.Available,\n type: x.type,\n onClick: () => {\n this.options_.onDeviceMenuItemClick(newItem, x);\n }\n });\n\n this.menu.addItem(newItem);\n });\n }\n\n private shouldShowSearchInput(): boolean {\n const deviceMenuItems = this.getDeviceMenuItems();\n const showSearchInput = deviceMenuItems.length >= DEVICE_COUNT_THRESHOLD_FOR_SEARCH;\n\n return showSearchInput;\n }\n\n private toggleSearchInput(): void {\n if (this.shouldShowSearchInput()) {\n this.searchInputItem.show();\n this.menu.addClass('vertical-fill');\n } else {\n this.searchInputItem.hide();\n this.menu.removeClass('vertical-fill');\n }\n }\n\n private toggleDeviceMenuItems(): void {\n const deviceMenuItems = this.getDeviceMenuItems();\n const isSearchEnabled = this.shouldShowSearchInput();\n const searchTextLowerCase = this.searchText.toLowerCase();\n \n // Update the UI of each device menu item\n deviceMenuItems.forEach(x => {\n const device = this.devices.find(y => y.id === x.options_.id);\n\n if (!device)\n return;\n\n const isAvailable = device.status === DeviceStatus.Available;\n const isInSession = device.id === this.castSession?.getDevice().id;\n const isMatchingSearch = isSearchEnabled ?\n `${device.name} ${device.schoolName ?? ''} ${device.description ?? ''}`.trim().toLowerCase().indexOf(searchTextLowerCase) !== -1 :\n true;\n \n isAvailable ? x.enable() : x.disable();\n isMatchingSearch ? x.show() : x.hide();\n isInSession ? x.selected(true) : x.selected(false);\n });\n }\n\n private toggleEmptyStatePlaceholder(): void {\n const allDeviceMenuItems = this.getDeviceMenuItems();\n const visibleDeviceMenuItems = allDeviceMenuItems.filter(x => x.isVisible());\n\n visibleDeviceMenuItems.length ?\n this.emptyPlaceholder.hide() :\n this.emptyPlaceholder.show();\n \n allDeviceMenuItems.length ?\n this.emptyPlaceholder.setLabel(this.localize('No matching results')) :\n this.emptyPlaceholder.setLabel(this.localize('No devices found'));\n }\n\n /**\n * CollapsibileComponent interface implementation\n * from here onward\n */\n public alwaysCollapsed: boolean = false;\n public isCollapsed: boolean = false;\n public isCollabsible: boolean = true;\n public className: string = 'cv-devices-menu-button';\n\n public getCollabsibleName(): string {\n return this.controlText_;\n }\n\n public getCollabsibleValue(): string {\n return this.castSession?.getDevice().name ?? ' ';\n }\n\n public showInCollabsibleMenu(): boolean {\n return true;\n }\n\n public showCollapsibleMenu(): void {\n this.handleClick();\n }\n\n public handleClick(): void {\n super.handleClick(null);\n this.options_.onClick();\n }\n}\n\nDevicesButton.prototype.controlText_ = 'Devices';\n\nvideojs.registerComponent('DevicesButton', DevicesButton);\n","import videojs from 'video.js';\n\nimport { Device, DeviceType } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\n\nimport './devices-tech-ui.scss';\n\nconst Component = videojs.getComponent('Component');\n\ninterface DevicesTechUIOptions extends videojs.ComponentOptions {\n onStopCasting: () => void;\n}\n\nexport class DevicesTechUI extends Component {\n private poster: string;\n private device?: Device;\n \n public options_: DevicesTechUIOptions;\n\n constructor(options: DevicesTechUIOptions) {\n super(null, options);\n }\n\n public createEl(): Element {\n return super.createEl('div', {\n className: 'cv-devices-tech'\n });\n }\n\n public setPoster(poster: string): void {\n this.poster = poster;\n this.update();\n }\n\n public setDevice(device: Device): void {\n this.device = device;\n this.update();\n }\n\n /**\n * Unfortunately we can't use the traditional way\n * of building out components and click handlers\n * because this component is ultimately detached\n * from the player so much of it's functionality won't work\n */\n public update(): void {\n const iconClassNames: Record<DeviceType, string> = {\n 'vivi': 'cv-vivi-icon',\n 'apple-tv': 'cv-apple-icon'\n };\n\n (this as any).el_.innerHTML = `\n <div class=\"cv-devices-content\">\n <p>${this.localize('Currently playing on')}</p>\n <h2><span class=\"cv-device-icon ${iconClassNames[this.device?.type ?? DeviceType.Vivi]}\"></span>${this.device?.name ?? ''}</h2>\n </div>\n <div class=\"cv-devices-background\" style=\"background-image: url(${this.poster})\"></div>\n `;\n\n const button = document.createElement('button');\n \n const onPress = (event: Event | TouchEvent) => {\n event.stopPropagation();\n this.options_.onStopCasting();\n };\n\n button.onclick = onPress;\n button.ontouchstart = onPress;\n button.className = 'stop-casting-button';\n button.innerHTML = this.localize('Stop casting');\n\n (this as any).el_.querySelector('.cv-devices-content').appendChild(button);\n }\n\n // This function needs to be here in order to get \n // VideoJS to add this component into its UI tree..\n public play(): void {}\n}\n","import videojs from 'video.js';\n\nimport { CastSession, Device } from 'projects/player/plugins/devices-plugin/clients/client-interfaces';\nimport { DevicesSessionManager } from 'projects/player/plugins/devices-plugin/devices-session-manager';\nimport { DASH_MIME_TYPE } from 'projects/player/plugins/media-sources-plugin/media-source-helper';\nimport { LocalCacheHelper } from 'projects/player/utils/local-cache-helper';\nimport { TrackHelper } from 'projects/player/utils/track-helper';\n\nimport { DevicesTechUI } from './devices-tech-ui/devices-tech-ui';\n\ninterface TechWithConstructor extends videojs.Tech {\n new (options: videojs.ComponentOptions, ready: videojs.Component.ReadyCallback): videojs.Tech;\n}\n\ninterface DevicesTechOptions extends videojs.ComponentOptions {\n source: videojs.Tech.SourceObject;\n instanceId?: string;\n poster?: string;\n playerId: string;\n}\n\ntype PlayerTextTrack = TextTrack & { src?: string };\n\nconst Tech = videojs.getComponent('Tech') as unknown as TechWithConstructor;\n\nclass DevicesTech extends Tech {\n private ui?: DevicesTechUI;\n private videojsPlayer: videojs.Player;\n\n public readonly featuresVolumeControl: boolean = true;\n public readonly featuresPlaybackRate: boolean = false;\n public readonly movingMediaElementInDOM: boolean = false;\n public readonly featuresFullscreenResize: boolean = true;\n public readonly featuresTimeupdateEvents: boolean = true;\n public readonly featuresProgressEvents: boolean = false;\n public readonly featuresNativeTextTracks: boolean = false;\n public readonly featuresNativeAudioTracks: boolean = false;\n public readonly featuresNativeVideoTracks: boolean = false;\n public readonly featuresMuteControl: boolean = true;\n public readonly featuresSourceset: boolean = false;\n\n public options_: DevicesTechOptions;\n\n constructor(options: videojs.ComponentOptions, ready: videojs.Component.ReadyCallback) {\n super(options, ready as any);\n\n this.videojsPlayer = videojs(this.options_.playerId);\n \n this.bindFunctions();\n this.bindEventListeners();\n\n this.ready((): void => {\n this.setSource(this.options_.source);\n });\n \n this.triggerReady();\n }\n\n private bindFunctions(): void {\n this.bindEventListeners = this.bindEventListeners.bind(this);\n this.onTextTrackChanged = this.onTextTrackChanged.bind(this);\n this.getSelectedTextTrack = this.getSelectedTextTrack.bind(this);\n this.setSelectedTextTrack = this.setSelectedTextTrack.bind(this);\n this.showUI = this.showUI.bind(this);\n this.hideUI = this.hideUI.bind(this);\n this.dispose = this.dispose.bind(this);\n this.setSource = this.setSource.bind(this);\n this.getCastSession = this.getCastSession.bind(this);\n }\n\n private bindEventListeners(): void {\n const session = this.getCastSession();\n\n if (!session) return;\n\n this.textTracks().on('change', this.onTextTrackChanged);\n\n this.videojsPlayer.one('ended', () => {\n session.dispose();\n });\n\n session.on('durationchange', () => {\n this.trigger('durationchange');\n });\n\n session.on('dispose', () => {\n this.trigger('ended');\n this.hideUI();\n });\n\n session.on('playingchange', () => {\n const playing = session.isPlaying();\n\n if (playing) {\n this.trigger('play');\n this.trigger('playing');\n } else {\n this.trigger('pause');\n }\n });\n\n session.on('volumechange', () => {\n this.trigger('volumechange');\n });\n\n session.on('sourceloaded', () => {\n this.trigger('loadeddata');\n });\n\n session.on('subtitleschange', () => {\n this.setSelectedTextTrack(session.getSubtitles());\n });\n }\n\n private onTextTrackChanged(): void {\n const textTrack = this.getSelectedTextTrack();\n\n this.getCastSession()?.setSubtitles(textTrack?.src);\n }\n\n private getSelectedTextTrack(): PlayerTextTrack | null {\n return TrackHelper.findTrackByPredicate(this.videojsPlayer.player_, (track: PlayerTextTrack) => {\n return track.mode === 'showing' && !!track.src;\n }) as PlayerTextTrack;\n }\n\n private setSelectedTextTrack(subtitleSource: string): void {\n TrackHelper.forEachTrack(this.videojsPlayer.player_, (t: PlayerTextTrack) => {\n if (t.kind !== 'subtitles')\n return;\n\n if (t.src === subtitleSource)\n t.mode = 'showing';\n else\n t.mode = 'disabled';\n });\n }\n\n private showUI(device: Device): void {\n if (!this.ui) return;\n\n this.ui.setPoster(this.options_.poster);\n this.ui.setDevice(device);\n this.ui.show();\n }\n\n private hideUI(): void {\n this.ui?.hide();\n }\n\n public dispose(): void {\n this.textTracks().off('change', this.onTextTrackChanged);\n\n const session = this.getCastSession();\n\n if (session)\n session.dispose();\n \n super.cleanupAutoTextTracks();\n super.dispose();\n }\n\n public createEl(): Element {\n this.ui = this.ui || new DevicesTechUI({\n onStopCasting: () => {\n this.getCastSession()?.dispose();\n }\n });\n\n return this.ui.el();\n }\n\n public setSource(source: videojs.Tech.SourceObject): void {\n const session = this.getCastSession();\n\n if (!session) return;\n\n this.showUI(session.getDevice());\n\n this.trigger('loadstart');\n\n const textTrack = this.getSelectedTextTrack();\n\n // The remote casting devices often cannot reach the Local Cache server on a\n // school's network. When setting the source for the casting session, we always\n // use the CDN URL..\n session.loadSource(LocalCacheHelper.getOriginalUrl(source.src), textTrack?.src);\n }\n\n public addRemoteTextTrack(options: videojs.TextTrackOptions): HTMLTrackElement {\n return super.addRemoteTextTrack(options, true);\n }\n\n public getCastSession(): CastSession | undefined {\n return DevicesSessionManager\n .getOrCreateInstance(this.options_.instanceId ?? '')\n .getCastSession();\n }\n\n public play(): void {\n this.getCastSession()?.play();\n }\n\n public pause(): void {\n this.getCastSession()?.pause();\n }\n\n public paused(): boolean {\n return this.getCastSession()?.isPlaying() === false;\n }\n\n public ended(): boolean {\n return this.getCastSession()?.isPlaybackFinished() ?? false;\n }\n\n public setCurrentTime(time?: number): void {\n this.getCastSession()?.seek(time ?? 0);\n }\n\n public currentTime(): number {\n return this.getCastSession()?.getPosition() ?? 0;\n }\n\n public duration(): number {\n return this.getCastSession()?.getDuration() ?? this.videojsPlayer.duration();\n }\n\n public volume(): number {\n return this.getCastSession()?.getVolume() ?? 1;\n }\n\n public setVolume(volume: number): void {\n this.getCastSession()?.setVolume(volume);\n }\n\n public muted(): boolean {\n return this.getCastSession()?.getMuted() ?? false;\n }\n\n public setMuted(muted: boolean): void {\n this.getCastSession()?.setMuted(muted);\n }\n \n public buffered(): void {\n return undefined; // Intentionally returning undefined to opt out of displaying a buffer\n }\n\n public seekable(): videojs.TimeRange {\n return videojs.createTimeRanges(0, this.duration());\n }\n\n public playbackRate(): number {\n return 1;\n }\n\n public readyState(): number {\n // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState\n return 4;\n }\n\n public controls(): boolean {\n return false;\n }\n\n public playsinline(): boolean {\n return true;\n }\n\n public supportsFullScreen(): boolean {\n return true;\n }\n\n public setAutoplay(): void { }\n\n public preload(): void { }\n\n public load(): void { }\n\n public setPlaybackRate(): void { }\n \n public static canPlayType(): string {\n return '';\n }\n\n public static canPlaySource(sourceObject: videojs.Tech.SourceObject, techOptions?: { instanceId: string }): boolean {\n // Cast devices are only ever handed progressive files. Rejecting dash here makes\n // tech-first source selection pick the progressive source for this tech while a\n // session is active, and there is no error event from the device to fall back on\n if (sourceObject.type === DASH_MIME_TYPE)\n return false;\n\n return !!DevicesSessionManager\n .getOrCreateInstance(techOptions?.instanceId ?? '')\n .getCastSession();\n }\n\n public static isSupported(): boolean {\n return DevicesSessionManager.isActive();\n }\n}\n\nvideojs.registerTech('devices', DevicesTech);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { EntityType, EventVersion, PlaybackDescriptor, UserAction, WorkflowPhase } from 'libs/analytics/interfaces';\n\nimport { DevicesConfig } from 'projects/player/interfaces/DevicesConfig';\nimport { AnalyticsService } from 'projects/player/services/analytics-service';\n\nimport { AppleTvClient } from './clients/apple-tv/apple-tv-client';\nimport { CastSession, Client, Device, DeviceType } from './clients/client-interfaces';\nimport { ViviClient } from './clients/vivi/vivi-client';\nimport { DeviceMenuItem } from './components/device-menu-item/device-menu-item';\nimport { DevicesButton, DevicesButtonOptions } from './components/devices-button/devices-button';\nimport { DevicesSessionManager } from './devices-session-manager';\n\nimport './devices-plugin.scss';\n\nimport './components/devices-button/devices-button';\nimport './tech/devices-tech';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface DevicesPluginOptions extends DevicesConfig {\n userId?: number;\n title: string;\n analyticsService?: AnalyticsService;\n}\n\nclass DevicesPlugin extends Plugin {\n private options: DevicesPluginOptions;\n private devicesButton?: DevicesButton;\n private instanceId: string;\n\n constructor(player: VideoJsPlayer, options: DevicesPluginOptions) {\n super(player, options);\n\n this.options = options;\n this.instanceId = this.player.options_.devices?.instanceId ?? '';\n\n this.bindFunctions();\n this.initialize();\n }\n\n private bindFunctions(): void {\n this.initialize = this.initialize.bind(this);\n this.onReady = this.onReady.bind(this);\n this.onDevicesChanged = this.onDevicesChanged.bind(this);\n this.onCastSessionChanged = this.onCastSessionChanged.bind(this);\n this.onDevicesError = this.onDevicesError.bind(this);\n this.addViviClient = this.addViviClient.bind(this);\n this.addAppleTvClient = this.addAppleTvClient.bind(this);\n this.reloadTech = this.reloadTech.bind(this);\n this.getSessionManager = this.getSessionManager.bind(this);\n this.dispose = this.dispose.bind(this);\n }\n\n private initialize(): void {\n this.player.ready(this.onReady);\n }\n\n private onReady(): void {\n const collapserator = this.player.getChild('collapserator');\n const sessionManager = this.getSessionManager();\n\n if (!collapserator) return;\n if (!sessionManager) return;\n\n sessionManager.on('deviceschange', this.onDevicesChanged);\n sessionManager.on('castsessionchange', this.onCastSessionChanged);\n sessionManager.on('error', this.onDevicesError);\n\n const onDevicesButtonClick = () => {\n this.addViviClient(sessionManager);\n this.addAppleTvClient(sessionManager);\n };\n\n const onDeviceMenuItemClick = (item: DeviceMenuItem, device: Device) => {\n sessionManager.startCastSession({\n device,\n title: this.options.title\n });\n\n this.options.analyticsService?.logUserAction(device, {\n actionType: UserAction.Select,\n workflowPhase: WorkflowPhase.Complete,\n descriptor: PlaybackDescriptor.ChangeDevice,\n entity: EntityType.Device,\n eventVersion: EventVersion.V3\n });\n };\n\n // Determine which integrations are inactive for the CTA\n const ctaOptions = this.options.ctaOptions;\n const viviConfig = this.options.vivi;\n const appleTvConfig = this.options.appleTv;\n const inactiveIntegrations: DeviceType[] = [];\n\n if (!appleTvConfig.enabled)\n inactiveIntegrations.push(DeviceType.AppleTv);\n\n if (!viviConfig.enabled || !viviConfig.accountConnected)\n inactiveIntegrations.push(DeviceType.Vivi);\n\n const buttonOptions: DevicesButtonOptions = {\n onClick: onDevicesButtonClick,\n onDeviceMenuItemClick,\n ctaOptions: {\n ...ctaOptions,\n inactiveIntegrations\n }\n };\n\n this.devicesButton = collapserator.addChild('DevicesButton', buttonOptions) as DevicesButton;\n }\n\n private onDevicesChanged(devices: Device[]): void {\n this.devicesButton?.setDevices(devices);\n }\n\n private onCastSessionChanged(castSession: CastSession | undefined): void {\n this.devicesButton?.setCastSession(castSession);\n this.reloadTech();\n\n if (castSession) {\n // Hide some UI elements and prevent the controls from fading out when casting\n this.player.addClass('cv-device-casting');\n this.player.addClass(`cv-device-${castSession.getDevice().type}`);\n\n // Exit fullscreen when casting\n if (this.player.isFullscreen())\n this.player.exitFullscreen();\n } else {\n // Restore the UI elements\n this.player.removeClass('cv-device-casting');\n this.player.removeClass(`cv-device-${DeviceType.AppleTv}`);\n this.player.removeClass(`cv-device-${DeviceType.Vivi}`);\n }\n }\n\n private onDevicesError(err: Error): void {\n this.player.error(err.message);\n this.player.pause();\n }\n\n private addViviClient(sessionManager: DevicesSessionManager): void {\n if (!this.options.vivi.enabled) return;\n if (!this.options.vivi.accountConnected) return;\n if (!this.options.vivi.apiUrl) return;\n if (sessionManager.hasInstanceOfClient(ViviClient)) return;\n\n const viviClient = new ViviClient({\n url: this.options.vivi.apiUrl,\n fetchAccessToken: this.options.vivi.fetchAccessToken\n });\n\n sessionManager.addClient(viviClient as Client);\n }\n\n private addAppleTvClient(sessionManager: DevicesSessionManager): void {\n if (!this.options.appleTv.enabled) return;\n if (!this.options.trackingCode) return;\n if (!this.options.userId) return;\n if (sessionManager.hasInstanceOfClient(AppleTvClient)) return;\n\n const appleTvClient = new AppleTvClient({\n fetchAccessToken: this.options.appleTv.fetchAccessToken,\n trackingCode: this.options.trackingCode,\n userId: this.options.userId\n });\n\n sessionManager.addClient(appleTvClient as Client);\n }\n\n private reloadTech(): void {\n const player = this.player;\n const sources = player.currentSources();\n const volume = player.volume();\n const muted = player.muted();\n const time = player.currentTime();\n const paused = player.paused();\n \n // This will cause the techs to get re-evaluated in the provided `techOrder`\n player.src(sources);\n\n // Restore the state of the player when playback starts\n player.one('playing', () => {\n player.volume(volume);\n player.muted(muted);\n player.currentTime(time);\n \n if (paused)\n player.pause();\n else\n player.play();\n });\n }\n\n private getSessionManager(): DevicesSessionManager | undefined {\n if (this.instanceId)\n return DevicesSessionManager.getOrCreateInstance(this.instanceId);\n }\n\n public dispose(): void {\n const sessionManager = this.getSessionManager();\n\n if (!sessionManager) return;\n\n sessionManager.off('deviceschange', this.onDevicesChanged);\n sessionManager.off('castsessionchange', this.onCastSessionChanged);\n sessionManager.off('error', this.onDevicesError);\n\n DevicesSessionManager.disposeAndRemoveInstance(sessionManager);\n\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('devicesPlugin', DevicesPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n devicesPlugin(options: DevicesPluginOptions): void;\n }\n}\n","import React from 'react';\nimport videojs, { VideoJsPlayer } from 'video.js';\n\nimport { ResourceTile } from 'libs/shared/components/widgets/items/resource-widget-item/ResourceWidgetItem';\nimport { Resource } from 'libs/shared/interfaces';\n\nimport { Resource as PlayerResource } from 'projects/player/interfaces/models/PlaybackObject';\nimport { getReactComponent } from 'projects/player/react/react-component';\n\nimport './resource-menu-item.scss';\n\ninterface ResourceMenuItemProps {\n resource: PlayerResource;\n imageCdnUrl: string;\n label?: string;\n}\n\nfunction ReactResourceMenuItem(props: ResourceMenuItemProps): JSX.Element {\n return (\n <div className='cv-resource-item'>\n <ResourceTile\n data={props.resource as Resource}\n imageCdnUrl={props.imageCdnUrl}\n titlePosition='above'\n hideTypeBadge\n />\n </div>\n );\n}\n\nconst _ResourceMenuItem = getReactComponent<ResourceMenuItemProps>(\n (player: VideoJsPlayer, options: ResourceMenuItemProps) => <ReactResourceMenuItem {...options} />\n);\n\nconst MenuItem = videojs.getComponent('MenuItem');\n\ninterface ResourceMenuItemOptions extends videojs.ComponentOptions, ResourceMenuItemProps {\n downloadResource: (resource: PlayerResource) => void;\n}\n\nexport class ResourceMenuItem extends MenuItem {\n public options_: ResourceMenuItemOptions;\n\n constructor(player: VideoJsPlayer, options: ResourceMenuItemOptions) {\n super(player, options);\n\n const menuItem = new _ResourceMenuItem(player, { resource: options.resource, imageCdnUrl: options.imageCdnUrl });\n this.addChild(menuItem);\n }\n\n public createEl(tagName?: string, properties: any = {}, attributes?: any): HTMLLIElement {\n return super.createEl(tagName, {\n ...properties,\n className: `${properties.className} cv-resource-menu-item`\n }, attributes);\n }\n\n public handleClick(event: videojs.EventTarget.Event): void {\n // Prevent menu from closing on click\n event.stopImmediatePropagation();\n\n this.options_.downloadResource(this.options_.resource);\n }\n}\n","import videojs from 'video.js';\n\nimport { LocationUtils } from 'libs/common/backbone/core';\n\nimport { CollapsibleHeadingMenuItem } from 'projects/player/components/cog-button/collapsible-heading-menu-item';\nimport { CollapsibleComponent } from 'projects/player/interfaces/CollapsibleComponent';\nimport { Resource as PlayerResource } from 'projects/player/interfaces/models/PlaybackObject';\nimport {\n ResourceMenuItem\n} from 'projects/player/plugins/resources-plugin/components/resource-menu-item/resource-menu-item';\n\nimport './resources-button.scss';\n\nconst MenuButton = videojs.getComponent('MenuButton');\n\ninterface ResourceButtonOptions extends videojs.MenuButtonOptions {\n resources: PlayerResource[];\n imageCdnUrl: string;\n onClickResource: (resource: PlayerResource) => void;\n}\n\nclass ResourcesButton extends MenuButton implements CollapsibleComponent {\n public options_: ResourceButtonOptions;\n public controlText_: string;\n\n private downloadIframe: HTMLIFrameElement;\n\n public buildWrapperCSSClass() {\n return `cv-menu-small cv-resources-button-wrapper ${super.buildWrapperCSSClass()}`;\n }\n\n public buildCSSClass(): string {\n return `cv-resources-button ${super.buildCSSClass()}`;\n }\n\n public update(): void {\n super.update();\n }\n\n public createItems(): videojs.MenuItem[] {\n const items: videojs.MenuItem[] = [];\n\n items.push(new CollapsibleHeadingMenuItem(this.player_, {\n label: 'Resources'\n }) as any);\n\n this.options_.resources.forEach(resource => {\n const menuItem = new ResourceMenuItem(this.player(), {\n resource,\n imageCdnUrl: this.options_.imageCdnUrl,\n downloadResource: (resource: PlayerResource) => this.downloadResource(resource),\n label: resource.name\n });\n\n items.push(menuItem as unknown as videojs.MenuItem);\n });\n\n return items;\n }\n\n private downloadResource(resource: PlayerResource): void {\n if (resource.type === 'link') {\n LocationUtils.PageLoad(resource.url, true);\n return;\n }\n\n this.getDownloadIframe().src = resource.url;\n }\n\n private getDownloadIframe(): HTMLIFrameElement {\n if (this.downloadIframe)\n return this.downloadIframe;\n\n this.downloadIframe = videojs.dom.createEl('iframe') as HTMLIFrameElement;\n this.downloadIframe.style.display = 'none';\n\n videojs.dom.appendContent(videojs.dom.$('body'), this.downloadIframe);\n\n return this.downloadIframe;\n }\n\n /**\n * CollapsibleComponent implementation below\n */\n public alwaysCollapsed: boolean = false;\n \n public isCollapsed: boolean = false;\n \n public isCollabsible: boolean = true;\n \n public getCollabsibleName(): string {\n return this.controlText_;\n }\n \n public getCollabsibleValue(): string {\n return '';\n }\n \n public showInCollabsibleMenu(): boolean {\n return true;\n }\n \n public showCollapsibleMenu(): void {\n super.handleClick(null);\n }\n}\n\nResourcesButton.prototype.controlText_ = 'Resources';\n\nvideojs.registerComponent('ResourcesButton', ResourcesButton);\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { Resource } from 'projects/player/interfaces/models/PlaybackObject';\n\nimport 'projects/player/plugins/resources-plugin/components/resources-button/resources-button';\n\nconst Plugin = videojs.getPlugin('plugin');\n\ninterface ResourcesPluginOptions {\n resources: Resource[];\n imageCdnUrl: string;\n}\n\nclass ResourcesPlugin extends Plugin {\n private options: ResourcesPluginOptions;\n\n constructor(player: VideoJsPlayer, options: ResourcesPluginOptions) {\n super(player, options);\n\n this.options = options;\n\n player.ready(() => this.onReady());\n }\n\n private onReady(): void {\n if (!this.options.resources.length)\n return;\n\n const collapserator = this.player.getChild('collapserator');\n\n collapserator.addChild('ResourcesButton', {\n resources: this.options.resources,\n imageCdnUrl: this.options.imageCdnUrl\n });\n }\n}\n\nvideojs.registerPlugin('resourcesPlugin', ResourcesPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n resourcesPlugin(options: ResourcesPluginOptions): void;\n }\n}\n","import { LocationUtils } from 'libs/common/backbone/core';\nimport { Core } from 'libs/common/core';\n\nimport { SharedServices } from 'libs/shared/constants/SharedServices';\nimport { NavLockHelper } from 'libs/shared/hooks/useNavLock';\n\nconst INACTIVITY_TIMEOUT = 900000; // 15 minutes\n\n// OLD:VERSION:TESTING Uncomment below and comment above\n// search for 'OLD:VERSION:TESTING' to find the code that needs to be uncommented\n// const INACTIVITY_TIMEOUT = 3000; // 3 seconds\n\nclass StaticOldVersionService extends Core.Service {\n private timeout: number;\n private canReload: boolean = true;\n\n // @ts-ignore\n public get name(): string {\n return SharedServices.OldVersion;\n }\n\n public initialize(): void {\n this.onVisibilityChange = this.onVisibilityChange.bind(this);\n this.onInactivityTimeout = this.onInactivityTimeout.bind(this);\n }\n\n public handleOldVersion(): void {\n document.addEventListener('visibilitychange', this.onVisibilityChange);\n this.onVisibilityChange();\n }\n\n private onVisibilityChange(): void {\n if (!document.hidden) {\n window.clearTimeout(this.timeout);\n return;\n }\n\n this.setInactivityTimeout();\n }\n\n private setInactivityTimeout(): void {\n this.timeout = window.setTimeout(this.onInactivityTimeout, INACTIVITY_TIMEOUT);\n }\n\n private onInactivityTimeout(): void {\n /**\n * If we've locked the nav for whatever reason we wait another 15 minutes. For eg.\n * - Uploading a video\n * - Bulk actions in user manager\n * - Editing video details\n */\n if (NavLockHelper.isLocked()) {\n this.setInactivityTimeout();\n return;\n }\n\n this.onInactive();\n }\n\n private onInactive(): void {\n /**\n * There are 2 reasons why we can't reload the page:\n * \n * The nav is locked for things like\n * - Uploading a video\n * - Performing a bulk action in user manager\n * - Editing video details\n * \n * Something has opted out of the page reload, such as\n * - The player is currently in a playing state (OldVersionRefreshPlugin)\n */\n if (!this.canReload || NavLockHelper.isLocked()) {\n this.setInactivityTimeout();\n return;\n }\n\n LocationUtils.Reload();\n }\n\n public setCanReload(canReload: boolean): void {\n this.canReload = canReload;\n }\n}\nexport const OldVersionService = new StaticOldVersionService();\n","import videojs, { VideoJsPlayer } from 'video.js';\n\nimport { OldVersionService } from 'libs/shared/services/OldVersionService';\n\nconst Plugin = videojs.getPlugin('plugin');\n\nclass OldVersionRefreshPlugin extends Plugin {\n constructor(player: VideoJsPlayer) {\n super(player);\n this.player.dataLoaded(() => this.initialize());\n }\n\n private initialize(): void {\n OldVersionService.setCanReload(false);\n }\n\n public dispose(): void {\n OldVersionService.setCanReload(true);\n super.dispose();\n }\n}\n\nvideojs.registerPlugin('oldVersionRefreshPlugin', OldVersionRefreshPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n oldVersionRefreshPlugin(): OldVersionRefreshPlugin;\n }\n}\n\n","import React from 'react';\n\nimport { Player, PlayerOptions } from 'projects/player/players/player';\nimport { getProxy } from 'projects/player/utils/getProxy';\n\n/**\n * React plugins are exported on the react player in order to allow\n * our dist files to not require react - Sha\n */\nimport 'projects/player/plugins/devices-plugin/devices-plugin';\nimport 'projects/player/plugins/next-video-plugin/next-video-plugin';\nimport 'projects/player/plugins/resources-plugin/resources-plugin';\nimport 'projects/player/plugins/transcript-plugin/transcript-plugin';\nimport 'projects/player/plugins/old-version-refresh-plugin/old-version-refresh-plugin';\n\nexport interface ClickViewPlayerProps extends Omit<PlayerOptions, 'playerApi'> {\n // TODO Remove optional from playerApi\n playerApi?: URL;\n className?: string;\n onReady?: (player: Player) => void;\n onError?: (error: any) => void;\n onDispose?: () => void;\n}\n\nexport function ClickViewPlayer(props: ClickViewPlayerProps): React.ReactElement {\n const { className = '', playerApi, onReady, onDispose, ...playerOptions } = props;\n \n const containerRef = React.useRef(null);\n\n React.useEffect(() => {\n if (!containerRef)\n return;\n\n const player = new Player(containerRef.current, {\n ...playerOptions,\n playerApi: playerApi\n });\n\n if (onReady) {\n player.ready(() => {\n onReady(getProxy(player));\n });\n }\n\n if (onDispose) {\n player.one('dispose', onDispose);\n }\n \n return () => {\n player?.dispose();\n };\n }, [props.viewKey]);\n\n return (\n <div ref={containerRef} className={className}></div>\n );\n}\n\nexport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