(()=>{"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},e.apply(this,arguments)}const t=window.wp.element,{__}=wp.i18n,{registerBlockType:i}=wp.blocks,{TextControl:s,Button:r}=wp.components,{Component:n}=wp.element;class a extends n{constructor(){super(...arguments);const{attributes:{text:e,gridTitle:t}}=this.props;this.state={text:e,gridTitle:t},window.essgrid_react={}}render(){const{attributes:{text:e,gridTitle:i},setAttributes:n}=this.props;return window.essgrid_react=this,(0,t.createElement)("div",{className:"essgrid_block"},(0,t.createElement)("span",null,this.props.attributes.gridTitle," "),(0,t.createElement)(s,{className:"grid_slug",value:this.props.attributes.text,onChange:e=>n({text:e})}),(0,t.createElement)(r,{isDefault:!0,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,t.createElement)(r,{isDefault:!0,onClick:()=>{essgrid_react=this,ESG.SC.openBlockSettings({editor:"gutenberg"})},className:"grid_edit_button"},__("Select Grid","essgrid")))}}i("themepunch/essgrid",{title:__("Essential Grid Quick Builder","essgrid"),description:__("Add your Essential Grid","essgrid"),category:"essgrid",icon:{src:"screenoptions",background:"#c90000",color:"white"},example:{attributes:{cover:!0}},keywords:[__("image","essgrid"),__("gallery","essgrid"),__("grid","essgrid")],attributes:{text:{selector:".essgrid",type:"string",source:"text"},gridTitle:{selector:".essgrid",type:"string",source:"attribute",attribute:"data-gridtitle"},alias:{type:"string"},cover:{default:!1}},edit:i=>{const{setAttributes:s,attributes:{cover:r}}=i;return[!r&&(0,t.createElement)("div",null,(0,t.createElement)(a,e({setAttributes:s},i))),r&&(0,t.createElement)("center",null,(0,t.createElement)("img",{src:EssGridOptions.pluginurl+"/admin/includes/gutenberg-blocks/build/images/esg-minigif.gif",width:320,height:180}))]},save:e=>{const{attributes:{text:i,gridTitle:s}}=e;return(0,t.createElement)("div",{className:"essgrid","data-gridtitle":s},i)}})})();