(()=>{"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)({}).hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},e.apply(null,arguments)}window.React;const{__}=wp.i18n,{Component:t,Fragment:s}=wp.element,{InspectorControls:a}=wp.blockEditor,{SelectControl:n,Button:i,PanelBody:l,PanelRow:o}=wp.components;class c extends t{render(){const{attributes:e,setAttributes:t,onIdChange:o,selectOptions:c}=this.props,{id:r,views:m,testimonials:p}=e;return React.createElement(s,null,React.createElement(a,null,React.createElement(l,{title:__("View Settings"),initialOpen:!0},0===stViews.views.length&&React.createElement(s,null,React.createElement("p",null,__("You don't seem to have any views.")),React.createElement(i,{href:stViews.adminURL+"edit.php?post_type=wpm-testimonial&page=testimonial-views&action=add",target:"_blank",isDefault:!0},__("Add New View"))),stViews.views.length>0&&React.createElement(s,null,React.createElement(n,{label:__("Select View"),key:r,value:r,options:c,onChange:e=>o(parseInt(e))}),0!==r&&React.createElement(i,{target:"_blank",href:stViews.adminURL+"edit.php?post_type=wpm-testimonial&page=testimonial-views&action=edit&id="+r,isSecondary:!0},__("Edit View"))))))}}const{__:r}=wp.i18n,{Component:m,Fragment:p,useEffect:w}=wp.element,{withSelect:d}=wp.data,{SelectControl:u,Spinner:v,Toolbar:g,Button:b}=wp.components,{BlockControls:h}=wp.blockEditor,E=t=>{const{attributes:s,setAttributes:a}=t,{id:n,views:i,status:l,testimonials:o,mode:m}=s;w((()=>{a({status:"ready",views:stViews.views}),0!==n&&d(n)}),[]);const d=e=>{t.setAttributes({status:"ready",id:e})},g=()=>{const e=[{value:0,label:r("None")}];return stViews.views.forEach((function(t){e.push({value:t.id,label:t.name})})),e};return stViews.views.length>0&&r("Edit View"),"loading"===l?[React.createElement(p,{key:"logo"},React.createElement("div",{className:"st-block-preview"},React.createElement("div",{className:"st-block-preview__content"},React.createElement("div",{className:"st-block-preview__logo"}," "),React.createElement(v,null))))]:[React.createElement(p,{key:"viewSelect"},React.createElement(c,e({onIdChange:e=>d(e),selectOptions:g()},t)),React.createElement("div",{className:"st-block-preview"},React.createElement("div",{className:"st-block-preview__content"},React.createElement("div",{className:"st-block-preview__logo"}),0===stViews.views.length&&React.createElement(p,null,React.createElement("h6",null,r("You don't seem to have any views.")),React.createElement(b,{href:stViews.adminURL+"edit.php?post_type=wpm-testimonial&page=testimonial-views&action=add",target:"_blank",isDefault:!0},r("Add New View"))),stViews.views.length>0&&React.createElement(p,null,React.createElement(u,{label:"Select a view:",className:"st-view-select",key:n,value:n,options:g(),onChange:e=>d(parseInt(e))}),0!==n&&React.createElement(b,{target:"_blank",href:stViews.adminURL+"edit.php?post_type=wpm-testimonial&page=testimonial-views&action=edit&id="+n,isSecondary:!0},r("Edit Settings"))))))]},{__:R}=wp.i18n,{registerBlockType:k}=wp.blocks;new class{constructor(){this.registerBlock()}registerBlock(){this.blockName="strongtestimonials/view",this.blockAttributes={id:{type:"number",default:0},mode:{type:"string",default:"display"}},k(this.blockName,{title:"Strong Testimonial View",description:R("Render ST View","strong-testimonials"),icon:"editor-quote",category:"common",supports:{html:!1,customClassName:!1},attributes:this.blockAttributes,edit:E,save:()=>null})}}})();