"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Edit=void 0;const element_1=require("@wordpress/element"),components_1=require("@wordpress/components"),block_templates_1=require("@woocommerce/block-templates"),sanitize_html_1=require("../../../utils/sanitize-html"),use_product_entity_prop_1=__importDefault(require("../../../hooks/use-product-entity-prop"));function Edit({attributes:e,context:{postType:t}}){const o=(0,block_templates_1.useWooBlockProps)(e),{label:r,property:l,disabled:s,disabledCopy:i,checkedValue:n,uncheckedValue:c}=e,[p,u]=(0,use_product_entity_prop_1.default)(l,{postType:t,fallbackValue:!1});return(0,element_1.createElement)("div",{...o},(0,element_1.createElement)(components_1.ToggleControl,{label:r,checked:void 0!==n?n===p:p,disabled:s,onChange:function(e){u(e?void 0!==n?n:e:void 0!==c?c:e)}}),s&&(0,element_1.createElement)("p",{className:"wp-block-woocommerce-product-toggle__disable-copy",dangerouslySetInnerHTML:(0,sanitize_html_1.sanitizeHTML)(i)}))}exports.Edit=Edit;