(()=>{"use strict";var e={n:o=>{var l=o&&o.__esModule?()=>o.default:()=>o;return e.d(l,{a:l}),l},d:(o,l)=>{for(var n in l)e.o(l,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:l[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,l=(window.wp.i18n,JSON.parse('{"UU":"mine-cloudvod/video-playlist"}')),n=window.wp.serverSideRender;var t=e.n(n);const i=window.ReactJSXRuntime,{withNotices:a,ToggleControl:r,PanelBody:d,TextControl:s,ComboboxControl:c}=wp.components,{InspectorControls:p,useBlockProps:u}=wp.blockEditor,{useState:v,Fragment:h}=wp.element,{useSelect:w}=wp.data,m=a((({attributes:e,setAttributes:o})=>{const{plName:n,mcvTag:a,show:m,autonext:_}=e,g=u(),x=w((e=>e("core").getEntityRecords("taxonomy","mcv_video_tag",{per_page:-1,orderby:"count",order:"desc",_fields:["id","name","count"],hide_empty:!0})||[]),[]).map((e=>({value:e.id,label:e.name}))),[b,j]=v(null),y=null!==b?b:x,C=(0,i.jsx)(h,{children:(0,i.jsx)(p,{children:(0,i.jsxs)(d,{title:wp.i18n.__("Video Playlist","mine-cloudvod"),initialOpen:!0,children:[(0,i.jsx)(r,{label:wp.i18n.__("Display Playlist","mine-cloudvod"),onChange:toggleAttribute("show"),checked:m,help:wp.i18n.__("Display the playlist or not.","mine-cloudvod")}),(0,i.jsx)(r,{label:wp.i18n.__("Auto Next","mine-cloudvod"),onChange:toggleAttribute("autonext"),checked:_,help:wp.i18n.__("Auto play next video.","mine-cloudvod")}),(0,i.jsx)(c,{label:wp.i18n.__("CloudVod Album","mine-cloudvod"),value:a,onChange:e=>{let l=x.filter((o=>{if(o.value==e)return!0}));l&&l[0]?.label&&o({plName:l[0].label}),o({mcvTag:e})},options:y,onInputChange:e=>{j(e?x.filter((o=>o.label.toLowerCase().startsWith(e.toLowerCase()))):null)}}),(0,i.jsx)(s,{type:"string",label:wp.i18n.__("Playlist Name","mine-cloudvod"),value:void 0!==n?n:"",onChange:e=>{o({plName:e})}})]})})});return(0,i.jsx)("div",{...g,children:(0,i.jsxs)(h,{children:[C,(0,i.jsx)(t(),{block:l.UU,attributes:e,LoadingResponsePlaceholder:()=>(0,i.jsx)("div",{className:"mine-cloudvod__placeholder is-loading",children:(0,i.jsx)("p",{children:wp.i18n.__("Loading preview…","mine-cloudvod")})}),ErrorResponsePlaceholder:({error:e})=>(0,i.jsx)("div",{className:"mine-cloudvod__placeholder",children:(0,i.jsx)("p",{children:e||wp.i18n.__("Error loading preview","mine-cloudvod")})})})]})})})),_={icon:(0,i.jsx)("svg",{fill:"none",className:"mine-block-icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",children:(0,i.jsx)("path",{d:"M921.6 204.8H102.4a68.288 68.288 0 0 1 68.288-68.288h682.624A68.288 68.288 0 0 1 921.6 204.8zM819.2 68.288H204.8A68.288 68.288 0 0 1 273.088 0h477.888A68.288 68.288 0 0 1 819.2 68.288zM955.712 273.088H68.288A68.288 68.288 0 0 0 0 341.376v614.4a68.288 68.288 0 0 0 68.288 68.288h887.424A68.288 68.288 0 0 0 1024 955.776v-614.4a68.288 68.288 0 0 0-68.288-68.288zM409.6 819.2V477.888l273.088 170.688z"})}),edit:m,save:function(){return null}};(0,o.registerBlockType)(l.UU,_)})();