!function(){"use strict";var e=window.wp.escapeHtml,t=window.wp.element;const o=t.createElement,a={};a.splwp_icon=o("img",{src:(0,e.escapeAttribute)(sp_location_weather.url+"/includes/Admin/Gutenberg_Block/assets/lw-icon.svg")});var r=a,c=window.wp.i18n;const s=t.createElement;var l=o=>{let{attributes:{shortcode:a},shortCodeList:r,shortcodeUpdate:l}=o;return(0,t.createElement)(t.Fragment,null,s("div",{className:"spwpcp-gutenberg-shortcode editor-styles-wrapper"},s("select",{className:"spwpcp-shortcode-selector",onChange:e=>l(e),value:(0,e.escapeAttribute)(a)},s("option",{value:(0,e.escapeAttribute)("0")},(0,e.escapeHTML)((0,c.__)("-- Select a shortcode --","wp-carousel-pro"))),r.map((t=>{var o=t.title.length>35?t.title.substring(0,35)+".... #("+t.id+")":t.title+" #("+t.id+")";return s("option",{value:(0,e.escapeAttribute)(t.id.toString()),key:(0,e.escapeAttribute)(t.id.toString())},(0,e.escapeHTML)(o))})))))},n=window.wp.blocks,i=window.wp.components,p=window.wp.blockEditor;const d=wp.serverSideRender,u=t.createElement;(0,n.registerBlockType)("sp-location-weather-pro/shortcode",{title:(0,e.escapeHTML)((0,c.__)("Location Weather","location-weather")),description:(0,e.escapeHTML)((0,c.__)("Use Location Weather to insert a shortcode in your page.","location-weather")),icon:r.splwp_icon,category:"common",supports:{html:!0},edit:o=>{const{attributes:a,setAttributes:r}=o;var s=sp_location_weather.shortCodeList;let n=e=>{let t=!1,o=setInterval((function(){let a=jQuery("#splw-location-weather-"+e).parents().attr("id");document.getElementById(a)&&(jQuery.getScript(sp_location_weather.loadScript),t=!0,a=""),t&&clearInterval(o),0==e&&clearInterval(o)}),10)},h=t=>{var o;o=t,r({shortcode:(0,e.escapeAttribute)(o.target.value)});let a=(0,e.escapeAttribute)(t.target.value);n(a)};return document.addEventListener("readystatechange",(t=>{if("complete"===t.target.readyState){let t=(0,e.escapeAttribute)(a.shortcode);n(t)}})),a.preview?u("div",{className:"spwpcp_shortcode_block_preview_image"},u("img",{src:(0,e.escapeAttribute)(sp_location_weather.url+"/includes/Admin/Gutenberg_Block/assets/lw-block-preview.svg")})):0===s.length?(0,t.createElement)(t.Fragment,null,u("div",{className:"components-placeholder components-placeholder is-large"},u("div",{className:"components-placeholder__label"},u("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_location_weather.url+"admin/GutenbergBlock/assets/wp-carousel-icon.svg")}),(0,e.escapeHTML)((0,c.__)("Location Weather","location-weather"))),u("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,c.__)("No shortcode found. ","location-weather")),u("a",{href:(0,e.escapeAttribute)(sp_location_weather.link)},(0,e.escapeHTML)((0,c.__)("Create a shortcode now!","location-weather")))))):a.shortcode&&0!=a.shortcode?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(p.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:"Select a shortcode"},(0,t.createElement)(i.PanelRow,null,(0,t.createElement)(l,{attributes:a,shortCodeList:s,shortcodeUpdate:h})))),(0,t.createElement)(d,{block:"sp-location-weather-pro/shortcode",attributes:a})):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(p.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:"Select a shortcode"},(0,t.createElement)(i.PanelRow,null,(0,t.createElement)(l,{attributes:a,shortCodeList:s,shortcodeUpdate:h})))),u("div",{className:"components-placeholder components-placeholder is-large"},u("div",{className:"components-placeholder__label"},u("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_location_weather.url+"/includes/Admin/Gutenberg_Block/assets/lw-icon.svg")}),(0,e.escapeHTML)((0,c.__)("Location Weather","location-weather"))),u("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,c.__)("Select a shortcode","location-weather"))),(0,t.createElement)(l,{attributes:a,shortCodeList:s,shortcodeUpdate:h})))},save:()=>null})}();