{"version":3,"file":"Wistia-1b1ecb44.js","names":["define","Moduler","create","defaults","eventName","init","self","this","window","_wq","push","id","onReady","video","bind","Wistia","allVideos","api","all","i","length","container","pause","event","CustomEvent","options","detail","document","dispatchEvent","unbind","pwBind","pct","percent","lastPercent","value","detailedValue"],"sources":["Wistia.js"],"mappings":"AAAAA,OAAO,CAAC,YAAY,SAAUC,GAC1B,aAEA,OAAOA,EAAQC,OAAO,CAClBC,SAAU,CACNC,UAAW,kBAGfC,KAAM,WACF,IAAIC,EAAOC,KAEXC,OAAOC,IAAMD,OAAOC,KAAO,GAC3BA,IAAIC,KAAK,CACLC,GAAI,OAAQC,QAAS,SAAUC,GAE3BA,EAAMC,KAAK,QAAQ,WACf,GAAIC,OAIA,IADA,IAAIC,EAAYD,OAAOE,IAAIC,MAClBC,EAAI,EAAGA,EAAIH,EAAUI,OAAQD,IAC9BH,EAAUG,GAAGE,UAAUV,KAAOE,EAAMQ,UAAUV,IAC9CK,EAAUG,GAAGG,OAI7B,IAEAT,EAAMC,KAAK,QAAQ,WACf,IAAIS,EAAQ,IAAIC,YAAYlB,EAAKmB,QAAQrB,UAAW,CAChDsB,OAAQ,CAAEb,MAAOA,EAAOU,MAAO,OAAQZ,GAAIE,EAAMQ,UAAUV,MAG/D,OADAgB,SAASC,cAAcL,GAChBV,EAAMgB,MACjB,IAEA,IAAIC,EAAS,SAAUC,GACnBlB,EAAMC,KAAK,yBAAyB,SAAUkB,EAASC,GACnD,GAAID,GAAWD,EAAM,IAAK,CACtB,IAAIR,EAAQ,IAAIC,YAAYlB,EAAKmB,QAAQrB,UAAW,CAChDsB,OAAQ,CAAEb,MAAOA,EAAOU,MAAO,wBAAyBW,MAAOH,EAAKI,cAAeH,EAASrB,GAAIE,EAAMQ,UAAUV,MAGpH,OADAgB,SAASC,cAAcL,GAChBV,EAAMgB,MACjB,CACJ,GACJ,EAEAC,EAAO,IACPA,EAAO,IACPA,EAAO,IACPA,EAAO,IACPA,EAAO,IACX,GAER,GAER","sourcesContent":["define(['moduler'], function (Moduler) {\r\n 'use strict';\r\n\r\n return Moduler.create({\r\n defaults: {\r\n eventName: 'getinge-wistia' // can be used to listen for video events dispatched by the module\r\n },\r\n\r\n init: function () {\r\n var self = this;\r\n\r\n window._wq = window._wq || [];\r\n _wq.push({\r\n id: \"_all\", onReady: function (video) {\r\n // for all existing and future videos, run this function\r\n video.bind('play', function () {\r\n if (Wistia) { // this should be available whenever a video is present on the page\r\n // when one video plays, iterate over all the videos and pause each,\r\n // unless it's the video that just started playing.\r\n var allVideos = Wistia.api.all();\r\n for (var i = 0; i < allVideos.length; i++) {\r\n if (allVideos[i].container.id !== video.container.id) {\r\n allVideos[i].pause();\r\n }\r\n }\r\n }\r\n });\r\n\r\n video.bind('play', function () {\r\n var event = new CustomEvent(self.options.eventName, {\r\n detail: { video: video, event: 'play', id: video.container.id }\r\n });\r\n document.dispatchEvent(event);\r\n return video.unbind;\r\n });\r\n\r\n var pwBind = function (pct) {\r\n video.bind('percentwatchedchanged', function (percent, lastPercent) {\r\n if (percent >= pct / 100) {\r\n var event = new CustomEvent(self.options.eventName, {\r\n detail: { video: video, event: 'percentwatchedchanged', value: pct, detailedValue: percent, id: video.container.id }\r\n });\r\n document.dispatchEvent(event);\r\n return video.unbind;\r\n }\r\n });\r\n };\r\n\r\n pwBind(25);\r\n pwBind(50);\r\n pwBind(75);\r\n pwBind(95);\r\n pwBind(100);\r\n }\r\n });\r\n }\r\n });\r\n});"]}