{"version":3,"sources":["webpack://mediasite-player/../GitLabRunner/builds/MaDYF1-sx/0/espial/mediasite/server/mvp/Mediasite/Server/Player/Player/src/plugins/conditional/poll-notification.js"],"names":["localize","PollNotificationPlugin","videojs","constructor","player","options","bind","super","this","log","on","event","id","time","type","payload","isLive","usingPlugin","pollsUrl","polls","url","notifications","add","callback","open","icon","PollIcon","timeout","Infinity","description"],"mappings":"iMAIA,IAAIA,E,kBAcJ,MAAMC,UAA+BC,oBAAkB,WACnDC,YAAYC,EAAQC,GAAS,MACzBL,EAAQ,UAAGI,EAAOJ,gBAAV,aAAG,EAAiBM,KAAKF,GACjCG,MAAMH,EAAQC,GAFW,YAGzBG,KAAKC,IAAI,oCACTD,KAAKE,GAAGN,EAAQ,oB,4GAAhB,CAAqCI,KAArC,O,WAGcG,GAAO,GAAEC,EAAF,KAAMC,EAAN,KAAYC,EAAZ,QAAkBC,IACvC,MAAMC,EAASR,KAAKJ,OAAOa,YAAY,QACjCC,EAAWV,KAAKJ,OAAOe,QAAQC,IACjCJ,GAAUE,GA1BC,mBA0BWJ,IACtBN,KAAKC,IAAI,gCACTD,KAAKJ,OAAOiB,gBAAgBC,IAAItB,EAAS,kBAAmB,CACxDuB,SAAU,KACNf,KAAKJ,OAAOe,QAAQK,QAExBC,KAAMC,IACNC,QAASC,IACTC,YAAa7B,EAAS","file":"poll-notification.7aaef4b2c81b0a93edbd.js","sourcesContent":["import videojs from 'video.js';\r\nimport PollIcon from '../../assets/images/poll-white-24dp.svg';\r\n\r\nvar TIMED_EVENT_TYPE = 'mediasite/poll';\r\nlet localize;\r\n\r\n/**\r\n * The PollNotificationPlugin module.<br><br>\r\n * Note: this module is optional and might not be available on every MediasitePlayer instance.\r\n * @member {PollNotificationPlugin|undefined} pollNotification\r\n * @memberof MediasitePlayer#\r\n */\r\n\r\n/**\r\n * Listens for timed events during live playback and shows a notification whenever a new poll becomes available.<br><br>Note: this plugin currently has no configurable options.\r\n * @hideconstructor\r\n * @extends {external:\"videojs.Plugin\"}\r\n **/\r\nclass PollNotificationPlugin extends videojs.getPlugin('plugin') {\r\n    constructor(player, options) {\r\n        localize = player.localize?.bind(player);\r\n        super(player, options);\r\n        this.log('Loaded poll notification plugin.');\r\n        this.on(player, 'timedeventreached', this.#handleTimedEvent);\r\n    }\r\n\r\n    #handleTimedEvent(event, { id, time, type, payload }) {\r\n        const isLive = this.player.usingPlugin('live');\r\n        const pollsUrl = this.player.polls().url;\r\n        if (isLive && pollsUrl && type === TIMED_EVENT_TYPE) {\r\n            this.log('Received a poll notification');\r\n            this.player.notifications().add(localize('Poll available'), {\r\n                callback: () => {\r\n                    this.player.polls().open();\r\n                },\r\n                icon: PollIcon,\r\n                timeout: Infinity,\r\n                description: localize('Click to open in new window')\r\n            });\r\n        }\r\n    }\r\n}\r\n\r\nexport { PollNotificationPlugin };\r\n"],"sourceRoot":""}