(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e6128"],{"96d9":function(s,t,e){"use strict";e.r(t),e.d(t,"NativeAudioWeb",(function(){return i})),e.d(t,"NativeAudio",(function(){return n}));var o=e("1547");class a{constructor(s){this.audio=s}}class i extends o["a"]{constructor(){super({name:"NativeAudio",platforms:["web"]})}async resume(s){const t=this.getAudioAsset(s.assetId).audio;if(t.paused)return t.play()}async pause(s){const t=this.getAudioAsset(s.assetId).audio;return t.pause()}async getCurrentTime(s){const t=this.getAudioAsset(s.assetId).audio;return{currentTime:t.currentTime}}async getDuration(s){const t=this.getAudioAsset(s.assetId).audio;if(Number.isNaN(t.duration))throw"no duration available";if(!Number.isFinite(t.duration))throw"duration not available => media resource is streaming";return{duration:t.duration}}async configure(s){throw"configure is not supported for web: "+JSON.stringify(s)}async preload(s){var t;if(i.AUDIO_ASSET_BY_ASSET_ID.has(s.assetId))throw"AssetId already exists. Unload first if like to change!";if(!(null===(t=s.assetPath)||void 0===t?void 0:t.length))throw"no assetPath provided";if(!s.isUrl&&!new RegExp("^/?"+i.FILE_LOCATION).test(s.assetPath)){const t=s.assetPath.startsWith("/")?"":"/";s.assetPath=`${i.FILE_LOCATION}${t}${s.assetPath}`}const e=new Audio(s.assetPath);e.autoplay=!1,e.loop=!1,e.preload="auto",s.volume&&(e.volume=s.volume),i.AUDIO_ASSET_BY_ASSET_ID.set(s.assetId,new a(e))}async play(s){var t;const e=this.getAudioAsset(s.assetId).audio;return await this.stop(s),e.loop=!1,e.currentTime=null!==(t=s.time)&&void 0!==t?t:0,e.play()}async loop(s){const t=this.getAudioAsset(s.assetId).audio;return await this.stop(s),t.loop=!0,t.play()}async stop(s){const t=this.getAudioAsset(s.assetId).audio;t.pause(),t.loop=!1,t.currentTime=0}async unload(s){await this.stop(s),i.AUDIO_ASSET_BY_ASSET_ID.delete(s.assetId)}async setVolume(s){if("number"!==typeof(null===s||void 0===s?void 0:s.volume))throw"no volume provided";const t=this.getAudioAsset(s.assetId).audio;t.volume=s.volume}async isPlaying(s){const t=this.getAudioAsset(s.assetId).audio;return{isPlaying:!t.paused}}getAudioAsset(s){if(this.checkAssetId(s),!i.AUDIO_ASSET_BY_ASSET_ID.has(s))throw`no asset for assetId "${s}" available. Call preload first!`;return i.AUDIO_ASSET_BY_ASSET_ID.get(s)}checkAssetId(s){if("string"!==typeof s)throw"assetId must be a string";if(!(null===s||void 0===s?void 0:s.length))throw"no assetId provided"}}i.FILE_LOCATION="assets/sounds",i.AUDIO_ASSET_BY_ASSET_ID=new Map;const n=new i}}]);