define(["exports","./loading/loading.js","./common/globalize.js"],function(_exports,_loading,_globalize){function FormHelper(){}function showAlertAndReject(options,response){function onDone(){return Promise.reject(response)}return function(options){return Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)})}(options).then(onDone,onDone)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,FormHelper.prototype.handleConfigurationSavedResponse=function(response){var options;return _loading.default.hide(),options=_globalize.default.translate("MessageSettingsSaved"),Emby.importModule("./modules/toast/toast.js").then(function(toast){toast(options)}),Promise.resolve(response)},FormHelper.prototype.handleErrorResponse=function(response){var msg,_response$headers;return _loading.default.hide(),"noitems"===response?showAlertAndReject(_globalize.default.translate("NoSelectedItemsSupportOperation"),response):"nocommands"===response?showAlertAndReject(_globalize.default.translate("NoOperationsForSelectedItems"),response):(msg=[],(_response$headers=null==(_response$headers=response.headers)?void 0:_response$headers.get("X-Application-Error-Code"))&&msg.push(_response$headers),response.text?response.text().then(function(responseText){return responseText&&msg.push(responseText),showAlertAndReject({title:_globalize.default.translate("Error"),text:msg.join("\n\n")||_globalize.default.translate("DefaultErrorMessage"),html:msg.join("<br/><br/>")||_globalize.default.translate("DefaultErrorMessage")},response)}):showAlertAndReject({title:_globalize.default.translate("Error"),text:msg.join("\n\n")||_globalize.default.translate("DefaultErrorMessage"),html:msg.join("<br/><br/>")||_globalize.default.translate("DefaultErrorMessage")},response))};var _default=new FormHelper;_exports.default=_default});