!function(A,e){"object"==typeofexports&&"object"==typeofmodule?module.exports=e():"function"==typeofdefine&&define.amd?define([],e):"object"==typeofexports?exports.NoSleep=e():A.NoSleep=e()}(this,(function(){returnfunction(A){vare={};functionB(g){if(e[g])returne[g].exports;varo=e[g]={i:g,l:!1,exports:{}};returnA[g].call(o.exports,o,o.exports,B),o.l=!0,o.exports}returnB.m=A,B.c=e,B.d=function(A,e,g){B.o(A,e)||Object.defineProperty(A,e,{enumerable:!0,get:g})},B.r=function(A){"undefined"!=typeofSymbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},B.t=function(A,e){if(1&e&&(A=B(A)),8&e)returnA;if(4&e&&"object"==typeofA&&A&&A.__esModule)returnA;varg=Object.create(null);if(B.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:A}),2&e&&"string"!=typeofA)for(varoinA)B.d(g,o,function(e){returnA[e]}.bind(null,o));returng},B.n=function(A){vare=A&&A.__esModule?function(){returnA.default}:function(){returnA};returnB.d(e,"a",e),e},B.o=function(A,e){returnObject.prototype.hasOwnProperty.call(A,e)},B.p="",B(B.s=0)}([function(A,e,B){"use strict";varg=function(){functionA(A,e){for(varB=0;B<e.length;B++){varg=e[B];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"ing&&(g.writable=!0),Object.defineProperty(A,g.key,g)}}returnfunction(e,B,g){returnB&&A(e.prototype,B),g&&A(e,g),e}}();varo=B(1),E=o.webm,n=o.mp4,C=function(){return"undefined"!=typeofnavigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream},Q=function(){return"wakeLock"innavigator&&window.navigator.standalone!=true},i=function(){functionA(){vare=this;if(function(A,e){if(!(Ainstanceofe))thrownewTypeError("Cannot call a class as a function")}(this,A),this.enabled=!1,Q()){this._wakeLock=null;varB=function(){null!==e._wakeLock&&"visible"===document.visibilityState&&e.enable()};document.addEventListener("visibilitychange",B),document.addEventListener("fullscreenchange",B)}elseC()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",E),this._addSourceToVideo(this.noSleepVideo,"mp4",n),this.noSleepVideo.addEventListener("loadedmetadata",(function(){e.noSleepVideo.duration<=1?e.noSleepVideo.setAttribute("loop",""):e.noSleepVideo.addEventListener("timeupdate",(function(){e.noSleepVideo.currentTime>.5&&(e.noSleepVideo.currentTime=Math.random())}))})))}returng(A,[{key:"_addSourceToVideo",value:function(A,e,B){varg=document.createElement("source");g.src=B,g.type="video/"+e,A.appendChild(g)}},{key:"enable",value:function(){varA=this;returnQ()?navigator.wakeLock.request("screen").then((function(e){A._wakeLock=e,A.enabled=!0,console.log("Wake Lock active."),A._wakeLock.addEventListener("release",(function(){console.log("Wake Lock released.")}))})).catch((function(e){throwA.enabled=!1,console.error(e.name+", "+e.message),e})):C()?(this.disable(),console.warn("\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n "),this.noSleepTimer=window.setInterval((function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then((function(e){returnA.enabled=!0,e})).catch((function(e){throwA.enabled=!1,e}))}},{key:"disable",value:function(){Q()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):C()?this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}},{key:"isEnabled",g