(()=>{"use strict";const e=window.wp.blocks,t=window.React,l=window.wp.blockEditor,a=window.wp.data,c=window.wp.element,n=window.wp.components,o=[["core/paragraph",{placeholder:"Lorem Ipsum"}]],r=JSON.parse('{"UU":"ucla-wordpress-plugin/tab-item"}');(0,e.registerBlockType)(r.UU,{parent:["ucla-wordpress-plugin/tabs"],edit:({attributes:e,setAttributes:r,clientId:s,isSelected:b})=>{const[i,u]=(0,c.useState)(!0);let{tabLabel:d,blockId:p,innerblockIndex:k}=e,w=(0,a.useSelect)((e=>e("core/block-editor").getBlockParents(s)));const m=(0,a.useSelect)((e=>e("core/block-editor").getBlockAttributes(w[0])));let g=(0,a.useSelect)((e=>e("core/block-editor").getBlockIndex(s))),I=d.replace(/\s+/g,"-").toLowerCase();const E=(0,l.useInnerBlocksProps)({className:"ucla-tabpanel",id:`ucla-tab-${I}-${g}-tab`,hidden:i},{template:o,templateLock:!1});return(0,c.useEffect)((()=>{u(m.currentTab!==g)}),[m.currentTab]),(0,c.useEffect)((()=>{(0,a.dispatch)("core/block-editor").updateBlockAttributes(w[0],{currentTab:g})}),[b]),(0,c.useEffect)((()=>{r({innerblockIndex:g})}),[]),(0,c.useEffect)((()=>{""===p&&r({blockId:s})}),[]),(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:"Tab Settings"},(0,t.createElement)(n.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:"Tab Label",value:d,onChange:e=>r({tabLabel:e})}))),(0,t.createElement)("article",{...E}))},save:({attributes:{blockId:e,innerblockIndex:a,tabLabel:c}})=>{const n=l.useBlockProps.save({className:"ucla-tabpanel"});return c.replace(/\s+/g,"-").toLowerCase(),(0,t.createElement)("article",{tabIndex:0,role:"tabpanel",...n,hidden:0!==a},(0,t.createElement)(l.InnerBlocks.Content,null))}})})();