(()=>{"use strict";const e=window.React,t=JSON.parse('{"apiVersion":"2","name":"yt-player/parent","title":"Youtube Player Container","icon":"format-video","category":"media","keywords":["youtube player container","youtube player"],"supports":{"inserter":false,"reusable":false,"html":false},"attributes":{},"example":{"attributes":{"preview":true}},"editorScript":"file:./index.js","editorStyle":"file:./index.css"}'),{__:r}=wp.i18n,{InnerBlocks:l,useBlockProps:o}=wp.blockEditor,{useSelect:n,dispatch:i}=wp.data,{Button:a,Placeholder:c}=wp.components,{useEffect:s}=wp.element,{registerBlockType:p}=wp.blocks;p(t,{edit:t=>{const p=o(),{clientId:d,isSelected:y}=t,m=n((e=>e("core/block-editor").getBlock(d).innerBlocks)),[u,k]=(0,e.useState)("");s((()=>{y&&wp.data.dispatch("core/edit-post").openGeneralSidebar("edit-post/block")}),[y]),i("core/block-editor").setTemplateValidity(!0);const w=e=>{if("carousel"!==e){const t=wp.blocks.createBlock(`yt-player/${e}`);return i("core/block-editor").insertBlock(t,0,d)}k("")};return m?.length?(0,e.createElement)("div",null,(0,e.createElement)("div",{...p},(0,e.createElement)(l,{templateLock:!1,allowedBlocks:["yt-player/video","yt-player/timeline","yt-player/carousel"],renderAppender:()=>0===m.length&&(0,e.createElement)(l.ButtonBlockAppender,null)}))):(0,e.createElement)("div",null,(0,e.createElement)("div",{...p},(0,e.createElement)(c,{icon:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"html5-block-icon"},(0,e.createElement)("polygon",{points:"23 7 16 12 23 17 23 7"}),(0,e.createElement)("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})),instructions:r("Choose a video type to get started.","ytp"),label:r("Choose a Video Type","ytp")},(0,e.createElement)(a,{isPrimary:!0,onClick:()=>{w("video")}},r("Single Video","ytp")),(0,e.createElement)(a,{isPrimary:!0,onClick:()=>{w("timeline")}},r("Timeline","ytp")),(0,e.createElement)(a,{variant:"primary",disabled:!0,onClick:()=>{w("carousel")}},r("Carousel","ytp"))),(0,e.createElement)(l,{templateLock:!1,allowedBlocks:["yt-player/video","yt-player/timeline","yt-player/carousel"],renderAppender:()=>!1})))},save:()=>{const t=o.save();return(0,e.createElement)("div",{...t},(0,e.createElement)(l.Content,null))}})})();