"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Edit=void 0;const components_1=require("@woocommerce/components"),currency_1=require("@woocommerce/currency"),navigation_1=require("@woocommerce/navigation"),tracks_1=require("@woocommerce/tracks"),block_editor_1=require("@wordpress/block-editor"),compose_1=require("@wordpress/compose"),core_data_1=require("@wordpress/core-data"),element_1=require("@wordpress/element"),i18n_1=require("@wordpress/i18n"),components_2=require("@wordpress/components"),use_currency_input_props_1=require("../../hooks/use-currency-input-props"),utils_1=require("../../utils");function Edit({attributes:e}){const r=(0,block_editor_1.useBlockProps)(),{name:o,label:t,help:n}=e,[c,i]=(0,core_data_1.useEntityProp)("postType","product",o),s=(0,element_1.useContext)(currency_1.CurrencyContext),{getCurrencyConfig:u,formatAmount:p}=s,_=u(),l=(0,use_currency_input_props_1.useCurrencyInputProps)({value:c,setValue:i}),a=n?(0,element_1.createInterpolateElement)(n,{PricingTab:(0,element_1.createElement)(components_1.Link,{href:(0,navigation_1.getNewPath)({tab:"pricing"}),onClick:()=>{(0,tracks_1.recordEvent)("product_pricing_help_click")}})}):null,m=(0,compose_1.useInstanceId)(components_2.BaseControl,"wp-block-woocommerce-product-pricing-field");return(0,element_1.createElement)("div",{...r},(0,element_1.createElement)(components_2.BaseControl,{id:m,help:a},(0,element_1.createElement)(components_2.__experimentalInputControl,{...l,id:m,name:o,onChange:i,label:t||(0,i18n_1.__)("Price","woocommerce"),value:(0,utils_1.formatCurrencyDisplayValue)(String(c),_,p)})))}exports.Edit=Edit;