"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__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 i of __getOwnPropNames(t))__hasOwnProp.call(e,i)||i===o||__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return 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_data=require("@wordpress/data"),import_block_templates=require("@woocommerce/block-templates"),import_tracks=require("@woocommerce/tracks"),import_components=require("@woocommerce/components"),import_navigation=require("@woocommerce/navigation"),import_core_data=require("@wordpress/core-data"),import_notice=require("../../../components/notice"),import_use_notice=require("../../../hooks/use-notice");function Edit({attributes:e}){const t=(0,import_block_templates.useWooBlockProps)(e),{content:o,isDismissible:r,title:i,type:n="info"}=e,[s]=(0,import_core_data.useEntityProp)("postType","product_variation","parent_id"),{dismissedNotices:p,dismissNotice:_,isResolving:c}=(0,import_use_notice.useNotice)(),{parentName:m,isParentResolving:a}=(0,import_data.useSelect)(e=>{const{getEditedEntityRecord:t,hasFinishedResolution:o}=e(import_core_data.store),{name:r}=t("postType","product",s);return{parentName:r||"",isParentResolving:!o("getEditedEntityRecord",["postType","product",s])}},[s]);return p.includes(s)||c||a||""===m?null:(0,import_element.createElement)("div",{...t},(0,import_element.createElement)(import_notice.Notice,{title:i,type:n,isDismissible:r,handleDismiss:()=>{(0,import_tracks.recordEvent)("product_single_variation_notice_dismissed"),_(s)}},(0,import_element.createInterpolateElement)(o,{strong:(0,import_element.createElement)("strong",null),noticeLink:(0,import_element.createElement)(import_components.Link,{href:(0,import_navigation.getNewPath)({tab:"variations"},`/product/${s}`),onClick:()=>{(0,import_tracks.recordEvent)("product_single_variation_notice_click")}}),parentProductName:(0,import_element.createElement)("span",null,m)})))}