!function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=21)}({21:function(e,t){window.PennController._AddElementType("Audio",(function(e){this.immediate=function(t,i){"string"==typeof t&&void 0===i&&(i=t);let s=!i.match(/^http/i);this.resource=e.resources.fetch(i,(function(e){this.object=new Audio,this.object.muted=!0;let t=!1;const i=()=>{if(t=!0,this.object.buffered.length&&this.object.seekable.length){if(this.object.buffered.end(0)==this.object.seekable.end(0))return this.object.pause(),this.object.currentTime=0,this.object.muted=!1,resolved=!0,e();this.object.muted=!0,this.object.play()}return window.requestAnimationFrame(i),!0};this.object.addEventListener("progress",()=>t||i()),this.object.src=this.value,this.object.load()}),s),void 0!==t&&"string"==typeof t&&0!=t.length||(t="Audio"),this.id=t},this.uponCreation=function(e){this.resource.object.controls=!0,this.audio=this.resource.object,this.hasPlayed=!1,this.disabled=!1,this.resource.object.style=null,this.jQueryElement=$(this.audio),this.jQueryElement.removeClass(),this.jQueryDisable=null,this.playEvents=[],this.endEvents=[],this.pauseEvents=[],this.seekEvents=[],this.bufferEvents=[],this.whatToSave=[],this.resource.object.onplay=()=>{this.playEvents.push(["play",this.audio.currentTime,Date.now()])},this.resource.object.onended=()=>{this.hasPlayed=!0,this.endEvents.push(["end",this.audio.currentTime,Date.now()])},this.resource.object.onpause=()=>{this.pauseEvents.push(["pause",this.audio.currentTime,Date.now()])},this.resource.object.onseeked=()=>{this.seekEvents.push(["seek",this.audio.currentTime,Date.now()])},this.resource.object.onwaiting=()=>{this.bufferEvents.push(["buffer",this.audio.currentTime,Date.now()])},this.printDisable=e=>{void 0===e&&(e=this.disabled),(!0===e||isNaN(Number(e)))&&(e=.5),this.jQueryDisable instanceof jQuery&&this.jQueryDisable.remove(),this.jQueryDisable=$("
").css({position:"absolute",display:"inline-block","background-color":"gray",opacity:e,width:this.jQueryElement.width(),height:this.jQueryElement.height()}),this.jQueryElement.before(this.jQueryDisable)},e()},this.end=function(){if(this.whatToSave&&this.whatToSave.indexOf("play")>-1){this.playEvents.length||e.controllers.running.save(this.type,this.id,"play","NA","Never");for(let t in this.playEvents)e.controllers.running.save(this.type,this.id,...this.playEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("end")>-1){this.endEvents.length||e.controllers.running.save(this.type,this.id,"end","NA","Never");for(let t in this.endEvents)e.controllers.running.save(this.type,this.id,...this.endEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("pause")>-1){this.pauseEvents.length||e.controllers.running.save(this.type,this.id,"pause","NA","Never");for(let t in this.pauseEvents)e.controllers.running.save(this.type,this.id,...this.pauseEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("seek")>-1){this.seekEvents.length||e.controllers.running.save(this.type,this.id,"seek","NA","Never");for(let t in this.seekEvents)e.controllers.running.save(this.type,this.id,...this.seekEvents[t])}if(this.bufferEvents)for(let t in this.bufferEvents)e.controllers.running.save(this.type,this.id,...this.bufferEvents[t]);this.resource.object.pause(),this.resource.object.currentTime=0,this.jQueryDisable&&this.jQueryDisable.remove()},this.value=function(){return this.endEvents.length?this.endEvents[this.endEvents.length-1][2]:0},this.actions={play:function(t,i){this.hasOwnProperty("audio")&&this.audio instanceof Audio?(i&&"once"==i?this.audio.removeAttribute("loop"):i&&(this.audio.loop=!0),this.audio.play()):e.debug.error("No audio to play for element ",this.id),t()},pause:function(e){this.audio.pause(),e()},print:function(t,...i){e.elements.standardCommands.actions.print.apply(this,[()=>{(this.disabled||null!==this.disabled&&!1!==this.disabled&&!isNaN(this.disabled))&&this.printDisable(this.disabled),t()},...i])},stop:function(e){this.audio.currentTime=this.audio.duration,e()},wait:function(e,t){if("first"==t&&this.hasPlayed)e();else{let i=!1,s=this.audio.onended;this.audio.onended=function(...n){if(s.apply(this,n),!i)if(t instanceof Object&&t._runPromises&&t.success){let s=this.disabled;this.disabled="tmp",t._runPromises().then(t=>{"success"==t&&(i=!0,e()),"tmp"==this.disabled&&(this.disabled=s)})}else i=!0,e()}}}},this.settings={disable:function(e,t){this.jQueryElement.addClass("PennController-disabled"),this.jQueryContainer.addClass("PennController-disabled"),t=!(!isNaN(t)&&null!==t)||Number(t),this.disabled=t,this.printDisable(t),e()},enable:function(e){this.jQueryDisable instanceof jQuery&&(this.disabled=!1,this.jQueryDisable.remove(),this.jQueryDisable=null,this.jQueryElement.removeClass("PennController-disabled"),this.jQueryContainer.removeClass("PennController-disabled"),this.jQueryElement.attr("controls",!0)),e()},once:function(e){if(this.hasPlayed)this.disabled=!0,this.printDisable();else{let e=this.audio.onended,t=this;this.audio.onended=function(...i){e.apply(this,i),t.disabled=!0,t.printDisable()}}e()},log:function(e,...t){1==t.length&&"string"==typeof t[0]?this.whatToSave.push(t[0]):t.length>1?this.whatToSave=this.whatToSave.concat(t):this.whatToSave=["play","end","pause","seek"],e()}},this.test={hasPlayed:function(){return this.hasPlayed},playing:function(){return this.audio.currentTime&&!this.audio.paused}}}))}});