(()=>{"use strict";const e=window.React,{__}=wp.i18n,{registerBlockType:t}=wp.blocks,{TextControl:i,Button:s}=wp.components,{Component:r}=wp.element;class n extends r{constructor(){super(...arguments);const{attributes:{text:e,gridTitle:t}}=this.props;this.state={text:null!=e?e:"",gridTitle:null!=t?t:""},window.essgrid_react={}}render(){const{attributes:{text:t,gridTitle:r},setAttributes:n}=this.props;return(0,e.createElement)("div",{className:"essgrid_block"},(0,e.createElement)("span",null,r," "),(0,e.createElement)(i,{className:"grid_slug",value:null!=t?t:"",onChange:e=>n({text:e})}),(0,e.createElement)(s,{variant:"secondary",onClick:()=>{window.essgrid_react=this;var e=this.state.text,t={};if(void 0===e)return!1;var i=e.match(/[\w-]+=".+?"/g);return!!i&&(i.forEach((function(e){e=e.match(/([\w-]+)="(.+?)"/),t[e[1]]=e[2]})),void 0!==t.alias&&void window.open("admin.php?page=essential-grid&view=grid-create&alias="+encodeURI(t.alias),"_blank"))},className:"grid_edit_button editor_icon dashicons dashicons-edit"}),(0,e.createElement)(s,{variant:"secondary",onClick:()=>{window.essgrid_react=this,ESG.SC.openBlockSettings({editor:"gutenberg"})},className:"grid_edit_button"},__("Select Grid","essgrid")))}}t("themepunch/essgrid",{title:__("Essential Grid Quick Builder","essgrid"),description:__("Add your Essential Grid","essgrid"),category:"essgrid",icon:{src:"screenoptions",background:"#c90000",color:"white"},keywords:[__("image","essgrid"),__("gallery","essgrid"),__("grid","essgrid")],example:{attributes:{cover:EssGridOptions.pluginurl+"admin/includes/gutenberg-blocks/build/images/esg-minigif.gif",text:"",gridTitle:""}},attributes:{text:{selector:".essgrid",type:"string",source:"text"},gridTitle:{selector:".essgrid",type:"string",source:"attribute",attribute:"data-gridtitle"},cover:{default:!1}},edit:t=>{const{attributes:{cover:i}}=t;return i?(0,e.createElement)("center",null,(0,e.createElement)("img",{src:i,width:320,height:180})):(0,e.createElement)("div",null,(0,e.createElement)(n,{...t}))},save:t=>{const{attributes:{text:i,gridTitle:s}}=t;return(0,e.createElement)("div",{className:"essgrid","data-gridtitle":s},i)}})})();