!function(t){function n(e){return e.replace(/\\(.)/gm,"$1")}t.imp_editor_storage_get_saves_list=function(o){t.post(ajaxurl,{action:"image_map_pro_get_saves_list"}).done(function(a){var e=0;try{a=(a=n(a)).replace(/\\'/g,"'"),e=JSON.parse(a),o(e)}catch(e){a=(a=n(a)).replace(/\\'/g,"'"),console.log(e),console.log("Failed to load saves list."),console.log(a),o(!1)}})},t.imp_editor_storage_get_save=function(e,o){var a={action:"image_map_pro_get_save",saveID:e};t.ajax({type:"POST",url:ajaxurl,data:a}).done(function(a){var e=0;try{e=JSON.parse(n(a));o(e)}catch(e){console.log(e),console.log("Failed to verify loaded image map."),console.log("Original JSON: "),console.log(n(a)),o(!1)}})},t.imp_editor_storage_store_save=function(e,o){var a={action:"image_map_pro_store_save",json:JSON.stringify(e),saveID:e.id,name:e.general.name,shortcode:e.general.shortcode};t.ajax({type:"POST",url:ajaxurl,data:a}).done(function(a){try{JSON.parse(n(a));o(!0)}catch(e){console.log(e),console.log("Failed to verify saved image map."),console.log("Original JSON: "),console.log(n(a)),o(!1)}})},t.imp_editor_storage_delete_save=function(e,a){var o={action:"image_map_pro_delete_save",saveID:e};t.post(ajaxurl,o).done(function(e){a()})},t.imp_editor_storage_get_last_save=function(a){t.post(ajaxurl,{action:"image_map_pro_get_last_save"}).done(function(e){0<e.length?a(e):a(!1)})},t.imp_editor_storage_set_last_save=function(e,a){var o={action:"image_map_pro_set_last_save",saveID:e};t.post(ajaxurl,o).done(function(){a()})}}(jQuery,(window,document));