!function(){"use strict";var e=window.wp.escapeHtml;const t=wp.element.createElement,o={};o.speafIcon=t("img",{src:(0,e.escapeAttribute)(sp_easy_accordion_free.url+"admin/GutenbergBlock/assets/easy-accordion-icon.svg")});var a=o,c=window.wp.element,r=window.wp.i18n;const s=wp.element.createElement;var n=t=>{let{attributes:{shortcode:o},shortCodeList:a,shortcodeUpdate:n}=t;return(0,c.createElement)(c.Fragment,null,s("div",{className:"speaf-gutenberg-shortcode editor-styles-wrapper"},s("select",{className:"speaf-shortcode-selector",onChange:e=>n(e),value:(0,e.escapeAttribute)(o)},s("option",{value:(0,e.escapeAttribute)("0")},(0,e.escapeHTML)((0,r.__)("-- Select a shortcode --","easy-accordion-free"))),a.map((t=>{var o=t.title.length>35?t.title.substring(0,30)+".... #("+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))})))))},l=window.wp.blocks,i=window.wp.components,d=window.wp.blockEditor;const p=wp.serverSideRender,m=c.createElement;(0,l.registerBlockType)("sp-easy-accordion-pro/shortcode",{title:(0,e.escapeHTML)((0,r.__)("Easy Accordion","easy-accordion-free")),description:(0,e.escapeHTML)((0,r.__)("Use Easy Accordion to insert an accordion shortcode in your page.","easy-accordion-free")),icon:a.speafIcon,category:"common",supports:{html:!0},edit:t=>{const{attributes:o,setAttributes:a}=t;var s=sp_easy_accordion_free.shortCodeList;let l=e=>{let t=!1,o=setInterval((function(){let a=jQuery("#sp-ea-"+e).parents().attr("id");document.getElementById(a)&&(jQuery.getScript(sp_easy_accordion_free.loadScript),t=!0,a=""),t&&clearInterval(o),0==e&&clearInterval(o)}),10)},u=t=>{var o;o=t,a({shortcode:(0,e.escapeAttribute)(o.target.value)});let c=(0,e.escapeAttribute)(t.target.value);l(c)};return document.addEventListener("readystatechange",(t=>{if("complete"===t.target.readyState){let t=(0,e.escapeAttribute)(o.shortcode);l(t)}})),o.preview?m("div",{className:"speaf_shortcode_block_preview_image"},m("img",{src:(0,e.escapeAttribute)(sp_easy_accordion_free.url+"admin/GutenbergBlock/assets/easy-acondion-preview.svg")})):0===s.length?(0,c.createElement)(c.Fragment,null,m("div",{className:"components-placeholder components-placeholder is-large"},m("div",{className:"components-placeholder__label"},m("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_easy_accordion_free.url+"admin/GutenbergBlock/assets/easy-accordion-icon.svg")}),(0,e.escapeHTML)((0,r.__)("Easy Accordion","easy-accordion-free"))),m("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,r.__)("No shortcode found. ","easy-accordion-free")),m("a",{href:(0,e.escapeAttribute)(sp_easy_accordion_free.link)},(0,e.escapeHTML)((0,r.__)("Create a shortcode now!","easy-accordion-free")))))):o.shortcode&&0!=o.shortcode?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(i.PanelBody,{title:"Select a shortcode"},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(n,{attributes:o,shortCodeList:s,shortcodeUpdate:u})))),(0,c.createElement)(p,{block:"sp-easy-accordion-pro/shortcode",attributes:o})):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(i.PanelBody,{title:"Select a shortcode"},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(n,{attributes:o,shortCodeList:s,shortcodeUpdate:u})))),m("div",{className:"components-placeholder components-placeholder is-large"},m("div",{className:"components-placeholder__label"},m("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(sp_easy_accordion_free.url+"admin/GutenbergBlock/assets/easy-accordion-icon.svg")}),(0,e.escapeHTML)((0,r.__)("Easy Accordion","easy-accordion-free"))),m("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,r.__)("Select a shortcode","easy-accordion-free"))),(0,c.createElement)(n,{attributes:o,shortCodeList:s,shortcodeUpdate:u})))},save:()=>null})}();