"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TabBlockEdit=void 0;const block_editor_1=require("@wordpress/block-editor"),classnames_1=__importDefault(require("classnames")),element_1=require("@wordpress/element"),block_templates_1=require("@woocommerce/block-templates"),tab_button_1=require("./tab-button");function TabBlockEdit({setAttributes:e,attributes:t,context:o}){const r=(0,block_templates_1.useWooBlockProps)(t),{id:l,title:c,_templateBlockOrder:s,isSelected:a}=t,n=(0,classnames_1.default)("wp-block-woocommerce-product-tab__content",{"is-selected":a}),[i,_]=(0,element_1.useState)(!1);return(0,element_1.useEffect)((()=>{if(!o.selectedTab)return;const t=o.selectedTab===l;if(e({isSelected:t}),t)return void _(!0);const r=setTimeout(_,300,!0);return()=>clearTimeout(r)}),[o.selectedTab,l]),(0,element_1.createElement)("div",{...r},(0,element_1.createElement)(tab_button_1.TabButton,{id:l,selected:a,order:s},c),(0,element_1.createElement)("div",{id:`woocommerce-product-tab__${l}-content`,"aria-labelledby":`woocommerce-product-tab__${l}`,role:"tabpanel",className:n},i&&(0,element_1.createElement)(block_editor_1.InnerBlocks,{templateLock:"contentOnly"})))}exports.TabBlockEdit=TabBlockEdit;