!function(){function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var t=wp.i18n.__,r=wp.blocks.registerBlockType,n=wp.components,o=n.SelectControl,l=(n.PanelBody,n.PanelRow),a=(n.TextControl,wp.editor),i=(a.RichText,a.InspectorControls);r("rttpg/post-grid",{title:t("The Post Grid","the-post-grid"),icon:"grid-view",category:"common",keywords:[t("Post Grid","the-post-grid"),t("The Post Grid","the-post-grid"),t("the-post-grid-pro","the-post-grid")],attributes:{gridId:{type:"number",default:0}},edit:function(r){var n,a,c=r.attributes.gridId,s=r.setAttributes,u="",p=[{value:0,label:t("Select one","the-post-grid-pro")}];if(rttpgGB.short_codes)for(var d=0,g=Object.entries(rttpgGB.short_codes);d<g.length;d++){var m=(n=g[d],a=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,l=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw o}}return l}}(n,a)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(n,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),h=m[0],f=m[1];p.push({value:h,label:f}),c&&Number(h)===c&&(u=f)}return[React.createElement(i,null,React.createElement("div",{className:"tpg-panel-control-wrapper",style:{padding:"0 17px"}},"This text will show when the box is selected",React.createElement(l,null,React.createElement(o,{label:t("Select a grid:"),options:p,value:c,onChange:function(e){return s({gridId:Number(e)})}})))),React.createElement("div",{className:r.className},c?React.createElement("div",null,React.createElement("span",null,React.createElement("img",{src:rttpgGB.icon}))," ",React.createElement("span",null," ",t("The Post Grid","the-post-grid-pro")," ( ",u," )")):React.createElement("p",null,"Please select a shortcode from block settings"))]},save:function(e){return e.attributes.gridId,null}})}();