"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let _ of __getOwnPropNames(t))__hasOwnProp.call(e,_)||_===o||__defProp(e,_,{get:()=>t[_],enumerable:!(r=__getOwnPropDesc(t,_))||r.enumerable});return e},__toESM=(e,t,o)=>(o=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?o:__defProp(o,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),edit_exports={};__export(edit_exports,{Edit:()=>Edit}),module.exports=__toCommonJS(edit_exports);var import_element=require("@wordpress/element"),import_block_templates=require("@woocommerce/block-templates"),import_i18n=require("@wordpress/i18n"),import_use_product_entity_prop=__toESM(require("../../../hooks/use-product-entity-prop")),import_validation_context=require("../../../contexts/validation-context"),import_number_control=require("../../../components/number-control"),import_use_product_edits=require("../../../hooks/use-product-edits");function Edit({attributes:e,context:{postType:t}}){const o=(0,import_block_templates.useWooBlockProps)(e),{label:r,property:_,suffix:p,placeholder:i,help:n,min:s,max:a,required:l,tooltip:m,disabled:u,step:c}=e,[d,f]=(0,import_use_product_entity_prop.default)(_,{postType:t,fallbackValue:""}),{hasEdit:b}=(0,import_use_product_edits.useProductEdits)(),{error:P,validate:y}=(0,import_validation_context.useValidation)(_,async function(){return"number"==typeof s&&d&&parseFloat(d)<s?{message:(0,import_i18n.sprintf)((0,import_i18n.__)("Value must be greater than or equal to %d","woocommerce"),s)}:"number"==typeof a&&d&&parseFloat(d)>a?{message:(0,import_i18n.sprintf)((0,import_i18n.__)("Value must be less than or equal to %d","woocommerce"),s)}:l&&!d?{message:(0,import_i18n.__)("This field is required.","woocommerce")}:void 0},[d]);return(0,import_element.createElement)("div",{...o},(0,import_element.createElement)(import_number_control.NumberControl,{label:r,onChange:f,value:d||"",help:n,suffix:p,placeholder:i,error:P,onBlur:()=>{b(_)&&y()},required:l,tooltip:m,disabled:u,step:c,min:s,max:a}))}