"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),t=require("../../../grid/components/ChildrenDroppable.js"),s=require("../../../common/components/Loading.js");require("react");var i=require("../../../grid/components/row/Row.js"),d=require("@gem-sdk/system"),o=require("next/dynamic"),n=require("./hook/useProductSetting.js"),u=require("./common/helpers.js");const c=o(()=>Promise.resolve().then(function(){return require("../ProductNotFound.js")}),{loading:s.default});exports.default=o=>{let{builderProps:l,children:a,setting:m,style:j,builderAttrs:g}=o,{isAuto:h}=m??{},{isLoading:p,isProductPage:x,isProductNotFound:f,showProductNotFound:q,errorLoadProduct:P,product:y,isEditor:v,productProviderData:b,setShowProductNotFound:F}=n.useProductSetting(o),{rowSetting:k,rowStyles:C}=u.getData(o);return x&&h?e.jsx(e.Fragment,{children:r.isEmptyChildren(a)?e.jsx(t.default,{}):a}):e.jsx(e.Fragment,{children:d.If(!f,e.jsx(e.Fragment,{children:p?e.jsx(s.default,{}):e.jsx(e.Fragment,{children:P?e.jsxs("div",{children:["Error: ",P?.message]}):y?e.jsx(r.ProductProvider,{...b,children:e.jsx(i.default,{builderProps:l,builderAttrs:g,style:j,styles:C,setting:k,customAttrs:v?{"data-product-id":y?.baseID?.replace("gid://shopify/Product/","")??""}:void 0,children:r.isEmptyChildren(a)?e.jsx(t.default,{}):a})}):null})}),e.jsx(e.Fragment,{children:d.If(q,e.jsx(c,{builderAttrs:g,productSrc:"PickProduct",onClose:()=>F(!1),children:a}))}))})};
