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