(()=>{"use strict";const e=window.wp.blocks,i=JSON.parse('{"UU":"vimeify/videos-table"}'),t=window.wp.i18n,a=window.wp.blockEditor,l=window.wp.components,s=window.wp.element,n=window.ReactJSXRuntime,{UU:r}=i;(0,e.registerBlockType)(r,{attributes:{currentValue:{type:"string"},author:{type:"string",default:"-1"},categories:{type:"array",default:[]},posts_per_page:{type:"string",default:"6"},order:{type:"string",default:"DESC"},orderby:{type:"string",default:"date"},show_pagination:{type:"string",default:"yes"}},edit:({attributes:e,setAttributes:i})=>{const r=(0,a.useBlockProps)(),[o,c]=(0,s.useState)(null),[d,m]=(0,s.useState)(null),{show_pagination:h}=e;return null===o&&wp.apiFetch({path:"/wp/v2/users"}).then(e=>(e=>{const i=[{label:(0,t.__)("Any","vimeify"),value:-1}];c(i.concat(e))})(e.map(e=>({label:e.name,value:e.id})))),null===d&&wp.apiFetch({path:"/wp/v2/vimeify-category"}).then(e=>(e=>{const i=[{label:(0,t.__)("Any","vimeify"),value:-1}];m(i.concat(e))})(e.map(e=>({label:e.name,value:e.id})))),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{...r,children:[(0,n.jsx)(a.InspectorControls,{children:(0,n.jsxs)("div",{className:"vimeify-inspector-controls-block",children:[(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.SelectControl,{label:(0,t.__)("Author","vimeify"),value:e.author,options:o,onChange:e=>i({author:e})})}),(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.SelectControl,{label:(0,t.__)("Categories","vimeify"),value:e.categories,options:d,onChange:e=>i({categories:e}),multiple:!0})}),(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.SelectControl,{label:(0,t.__)("Order Direction","vimeify"),value:e.order,options:[{label:(0,t.__)("DESC","vimeify"),value:"desc"},{label:(0,t.__)("ASC","vimeify"),value:"asc"}],onChange:e=>i({order:e})})}),(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.SelectControl,{label:(0,t.__)("Order By","vimeify"),value:e.orderby,options:[{label:(0,t.__)("Title","vimeify"),value:"title"},{label:(0,t.__)("Date","vimeify"),value:"date"}],onChange:e=>i({orderby:e})})}),(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.TextControl,{label:(0,t.__)("Videos number","vimeify"),value:e.posts_per_page,onChange:e=>i({posts_per_page:e})})}),(0,n.jsx)("fieldset",{children:(0,n.jsx)(l.ToggleControl,{label:(0,t.__)("Show Pagination","vimeify"),help:"yes"===h?(0,t.__)("Yes","vimeify"):(0,t.__)("No","vimeify"),checked:"yes"===h,onChange:e=>{i({show_pagination:e?"yes":"no"})}})})]})}),(0,n.jsx)("div",{className:"vimeify-block-preview vimeify-table-wrapper table-responsive ",children:(0,n.jsxs)("table",{className:"vimeify-table table",border:"0",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"vimeify-head-title",children:"Title"}),(0,n.jsx)("th",{className:"vimeify-head-date",children:"Date"}),(0,n.jsx)("th",{className:"vimeify-head-actions",children:"Actions"})]})}),(0,n.jsxs)("tbody",{children:[(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"vimeify-row-title",children:"Exaple vimeo video #1"}),(0,n.jsx)("td",{className:"vimeify-row-date",children:"January 01, 2023"}),(0,n.jsx)("td",{className:"vimeify-row-actions",children:(0,n.jsx)("a",{href:"#",target:"_blank",title:"View",children:(0,n.jsx)("span",{className:"vimeify-icon-eye"})})})]}),(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"vimeify-row-title",children:"Exaple vimeo video #2"}),(0,n.jsx)("td",{className:"vimeify-row-date",children:"January 02, 2023"}),(0,n.jsx)("td",{className:"vimeify-row-actions",children:(0,n.jsx)("a",{href:"#",target:"_blank",title:"View",children:(0,n.jsx)("span",{className:"vimeify-icon-eye"})})})]}),(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"vimeify-row-title",children:"Exaple vimeo video #3"}),(0,n.jsx)("td",{className:"vimeify-row-date",children:"January 03, 2023"}),(0,n.jsx)("td",{className:"vimeify-row-actions",children:(0,n.jsx)("a",{href:"#",target:"_blank",title:"View",children:(0,n.jsx)("span",{className:"vimeify-icon-eye"})})})]})]})]})})]})})},save:()=>null})})();