"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[504],{13614:(e,t,o)=>{o.r(t),o.d(t,{default:()=>f});var r=o(47778),d=o(98846),n=o(83306),c=o(51609),i=o(92279),s=o(33068),a=o(45155),u=o(27723),l=o(3582),p=o(47143),_=o(86087),m=o(16844),h=o(39793);(0,r.productEditorHeaderApiFetchMiddleware)(),(0,r.productApiFetchMiddleware)();const x=(0,c.lazy)(()=>o.e(2482).then(o.bind(o,2482))),b=(0,c.lazy)(()=>Promise.resolve().then(o.t.bind(o,47778,23)).then(e=>({default:e.__experimentalProductMVPFeedbackModalContainer})));function f(){const{productId:e}=(0,s.g)();(0,c.useEffect)(()=>{document.body.classList.add("is-product-editor");const e=(0,r.__experimentalInitBlocks)();return()=>{document.body.classList.remove("is-product-editor"),e()}},[]),(0,c.useEffect)(()=>((0,i.registerPlugin)("wc-admin-product-editor",{scope:"woocommerce-product-block-editor",render:()=>(0,c.useContext)(r.__experimentalEditorLoadingContext)?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(r.__experimentalWooProductMoreMenuItem,{children:({onClose:e})=>(0,h.jsx)(m.y,{onClose:e})}),(0,h.jsx)(a.WooFooterItem,{children:(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(c.Suspense,{fallback:(0,h.jsx)(d.Spinner,{}),children:(0,h.jsx)(b,{productId:e?Number.parseInt(e,10):void 0})})})}),(0,h.jsx)(c.Suspense,{fallback:(0,h.jsx)(d.Spinner,{}),children:(0,h.jsx)(x,{})})]})}),()=>{(0,i.unregisterPlugin)("wc-admin-product-editor")}),[e]),(0,c.useEffect)(function(){e?(0,n.recordEvent)("product_edit_view",{source:r.TRACKS_SOURCE,product_id:e}):(0,n.recordEvent)("product_add_view",{source:r.TRACKS_SOURCE})},[e]);const t=function(e){const[t,o]=(0,_.useState)(void 0);return(0,_.useEffect)(()=>{e?o(Number.parseInt(e,10)):(0,p.dispatch)(l.store).saveEntityRecord("postType","product",{title:r.AUTO_DRAFT_NAME,status:"auto-draft"}).then(e=>o(e.id)).catch(e=>{throw o(void 0),e})},[e]),t}(e);return t?(0,h.jsx)(r.__experimentalEditor,{productId:t}):(0,h.jsx)("div",{className:"woocommerce-layout__loading",children:(0,h.jsx)(d.Spinner,{"aria-label":(0,u.__)("Creating the product","woocommerce")})})}}}]);