!function(e){var t=wp.element.createElement,o=wp.blocks.registerBlockType,s=wp.components.SelectControl;function l(e){return e.replace(/\\(.)/gm,"$1")}o("image-map-pro/image-map-pro",{title:"Image Map Pro",category:"widgets",attributes:{shortcode:{type:"string"},saves:{type:"text"},didLoadSaves:{type:"bool",default:!1}},edit:function(n){return e.post(ajaxurl,{action:"image_map_pro_get_saves_list"}).done(function(t){var e=0;try{t=(t=l(t)).replace(/\\'/g,"'"),e=JSON.parse(t);for(var o=[],s=0;s<e.length;s++)o.push({value:"["+e[s].shortcode+"]",label:e[s].name});var a=!1;for(s=0;s<e.length;s++)if("["+e[s].shortcode+"]"==n.attributes.shortcode){a=!0;break}var r={};a&&n.attributes.shortcode||(console.log("store shortcode"),r.shortcode=o[0].value),JSON.stringify(n.attributes.saves)!==JSON.stringify(o)&&(console.log("store saves"),r.saves=o),(r.saves||r.shortcode)&&n.setAttributes(r)}catch(e){t=(t=l(t)).replace(/\\'/g,"'"),console.log(e),console.log("Failed to load saves list."),console.log(t)}}),t(s,{label:"Select an Image Map",value:n.attributes.shortcode,options:n.attributes.saves,onChange:function(e){n.setAttributes({shortcode:e})}})},save:function(e){return t("div",{},e.attributes.shortcode)}})}(jQuery,(window,document));