cordova.define("cordova/plugin/sound",function(e,t,n){function o(e){}function u(e,t,n){(void 0===e.errorCode||null===e.errorCode)&&(e.errorCode=t),(void 0===e.errorText||null===e.errorText)&&(e.errorText=n)}var r;window.PalmSystem?(o("Window.PalmSystem Available"),r=e("cordova/plugin/webos/service")):r={Request:function(e,t){o(e+" invoked. But I am a dummy because PalmSystem is not available"),"function"==typeof t.onFailure&&t.onFailure({returnValue:!1,errorText:"PalmSystem Not Available. Cordova is not installed?"})}};var a=function(){};a.prototype.getSoundStatus=function(e,t){o("getSoundStatus: "),r.Request("luna://com.webos.audio/",{method:"getVolume",onSuccess:function(n){if(o("getSoundStatus: On Success"),n.returnValue===!0){var a={};a.level=n.volume,a.muted=n.muted,r.Request("luna://com.webos.service.commercial.signage.storageservice/settings/",{method:"get",parameters:{category:"commercial",keys:["enableSpeaker"]},onSuccess:function(t){o("getSoundStatus: On Success 2"),t.returnValue===!0&&(a.externalSpeaker="on"===t.settings.enableSpeaker?!0:!1,"function"==typeof e&&e(a))},onFailure:function(e){o("getSoundStatus: On Failure 2"),delete e.returnValue,"function"==typeof t&&(u(e,"SGSS","Sound.getSoundStatus returns failure."),t(e))}})}},onFailure:function(e){o("getSoundStatus: On Failure"),delete e.returnValue,"function"==typeof t&&(u(e,"SGSS","Sound.getSoundStatus returns failure."),t(e))}}),o("Sound.getSoundStatus Done")},a.prototype.setVolumeLevel=function(e,t,n){if(o("setVolumeLevel: "+JSON.stringify(n)),"number"!=typeof n.level||isNaN(n.level)||n.level<0||n.level>100){if("function"==typeof t){var a={};u(a,"SSVL","Sound.setVolumeLevel returns failure. out of range or invalid parameter type."),t(a)}}else r.Request("luna://com.webos.audio/",{method:"setVolume",parameters:{volume:n.level},onSuccess:function(t){o("setVolumeLevel: On Success"),t.returnValue===!0&&"function"==typeof e&&e()},onFailure:function(e){o("setVolumeLevel: On Failure"),delete e.returnValue,"function"==typeof t&&(u(e,"SSVL","Sound.setVolumeLevel returns failure."),t(e))}}),o("Sound.setVolumeLevel Done")},a.prototype.setExternalSpeaker=function(e,t,n){if(o("setExternalSpeaker: "+JSON.stringify(n)),"boolean"==typeof n.externalSpeaker){var a=null;switch(n.externalSpeaker){case!0:a="on";break;case!1:a="off"}r.Request("luna://com.webos.service.commercial.signage.storageservice/settings/",{method:"set",parameters:{category:"commercial",settings:{enableSpeaker:a}},onSuccess:function(){o("setExternalSpeaker: On Success"),"function"==typeof e&&e()},onFailure:function(e){o("setExternalSpeaker: On Failure"),delete e.returnValue,"function"==typeof t&&(u(e,"SSES","Sound.setExternalSpeaker returns failure."),t(e))}}),o("Sound.setExternalSpeaker Done")}else if("function"==typeof t){var l={};u(l,"SSVL","Sound.setExternalSpeaker returns failure. out of range or invalid parameter type."),t(l)}},a.prototype.setMuted=function(e,t,n){if(o("setMuted: "+JSON.stringify(n)),"boolean"==typeof n.muted)r.Request("luna://com.webos.audio/",{method:"setMuted",parameters:{muted:n.muted},onSuccess:function(t){o("setMuted: On Success"),t.returnValue===!0&&"function"==typeof e&&e()},onFailure:function(e){o("setMuted: On Failure"),delete e.returnValue,"function"==typeof t&&(u(e,"SSM","Sound.setMuted returns failure."),t(e))}}),o("Sound.setMuted Done");else if("function"==typeof t){var a={};u(a,"SSVL","Sound.setMuted returns failure. out of range or invalid parameter type."),t(a)}},n.exports=a}),Sound=cordova.require("cordova/plugin/sound");