var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="68a064a1-3878-4db2-8981-ff66298cba2f",e._sentryDebugIdIdentifier="sentry-dbid-68a064a1-3878-4db2-8981-ff66298cba2f")}catch(x){}import{_ as i,c as l,g as d,b as u,d as c,e as f,f as y,s as p,T as v}from"./index.3a1c246f.js";import{a4 as g,i as w,D as b,X as O,c as P,_ as $,P as m,o as E,a as R,E as C,w as _,a2 as h,r as T,b as j,ax as q,K as F,Q as N,ai as k,a6 as D}from"./vendor.82ce4f28.js";const I={name:"ContentfulRenderer",props:{component:{type:Object,required:!0},contentType:{type:String,required:!0},slug:{type:String,default:null},activeOf:{type:String,default:null},isRequired:{type:Boolean,default:!0},isCritical:{type:Boolean,default:!1},showLoader:{type:Boolean,default:!0},class:{type:String,default:""},onEntryNotFound:{type:Function,default:()=>{}}},components:{NotFoundPage:g((()=>i((()=>import("./NotFoundPage.e0195e30.js")),["assets/NotFoundPage.e0195e30.js","assets/NotFoundPage.de6472a0.css","assets/index.3a1c246f.js","assets/index.4af69877.css","assets/vendor.82ce4f28.js","assets/PopularProductsCarousel.ac4c0632.js","assets/PopularProductsCarousel.9857fc4a.css","assets/ProductCarousel.816422a2.js","assets/ProductCarousel.a07765a9.css","assets/BundleProduct.9f7f870d.js","assets/BundleProduct.1256d1b0.css","assets/Product.8b2ef23d.js","assets/Product.ef6e5267.css","assets/product-add-to-cart.4b1831df.js","assets/AddToCartButton.8543ab46.js","assets/AddToCartButton.cddd631e.css","assets/useAddToCart.78e8c27e.js","assets/Swipe.c794141a.js","assets/ContentfulHeading.9a972f29.js","assets/slugify.bb683085.js","assets/CanFavorite.68f1376d.js","assets/CanFavorite.d193dd44.css","assets/useProductSearch.a619beb1.js"])))},async setup(e){var i;const u=w(""),g=b({entry:null}),m=w(!1),E=null==(i=O().currentRoute.value.query)?void 0:i.hasOwnProperty("ctpreview"),{mounted:R}=l(),C=c();await(async()=>{var t,n,r,o;try{const a=e.slug,s=e.isRequired?"none":"ignore";if(a)g.entry=await f(e.contentType,a,2,E,s);else{if(!e.activeOf)throw new Error(`ContentfulRenderer requires one of: activeOf (${e.activeOf}), slug(${a}) for contentType: ${e.contentType}`);{const a=await f("activeVersion",e.activeOf,2,E,s),i=null==(r=null==(n=null==(t=null==a?void 0:a.fields)?void 0:t.contentPage)?void 0:n.sys)?void 0:r.id;if(i)g.entry=await y(i,!1,2,E);else{if(e.isCritical)throw new Error(`invalid contentPageId: ${i} passed to ContentfulRenderer for ${e.activeOf} (${null==(o=null==a?void 0:a.sys)?void 0:o.id})`);e.isRequired&&(u.value=`invalid contentPageId: ${i} passed to ContentfulRenderer for ${e.activeOf}`)}}}if(g.entry||"function"!=typeof e.onEntryNotFound||e.onEntryNotFound(),g.entry)p({currentEntry:g.entry,isPreview:E});else{if(e.isCritical)throw new Error(`ContentfulRenderer failed for activeOf: ${e.activeOf}, slug: ${a}, contentType: ${e.contentType}, isRequired:${e.isRequired} , isCritical: ${e.isCritical}`);e.isRequired&&(u.value=`Content not found: ${e.contentType}/${a} (${e.activeOf})`)}}catch(a){console.error(a),v.sentryCaptureError(a)}finally{m.value=!0}})();const _=P((()=>R.value?d(C.moduleNames):null));return h=((e,t)=>{for(var n in t||(t={}))o.call(t,n)&&s(e,n,t[n]);if(r)for(var n of r(t))a.call(t,n)&&s(e,n,t[n]);return e})({},$(g)),T={loadedDependencyModules:_,isPreview:E,clazz:e.class,isLoaded:m,isNotFound:u},t(h,n(T));var h,T}},L={key:1},S={key:2,class:"loader-container"};var z=u(I,[["render",function(e,t,n,r,o,a){const s=m("NotFoundPage");return r.isNotFound?(E(),R(s,{key:0,reason:r.isNotFound},null,8,["reason"])):(E(),C("div",L,[(E(),R(k,null,{default:_((()=>[n.component&&e.entry?(E(),C(h,{key:0},[T(e.$slots,"default",{entry:e.entry,isPreview:r.isPreview,slug:n.slug}),(E(),R(j(n.component),q(e.entry,{slug:n.slug,class:r.clazz}),null,16,["slug","class"])),T(e.$slots,"after",{isPreview:r.isPreview,slug:n.slug})],64)):r.isLoaded?T(e.$slots,"fallback",{key:1,isPreview:r.isPreview,slug:n.slug}):n.showLoader?(E(),C("div",S,t[0]||(t[0]=[F("div",{class:"loader"},null,-1)]))):N("",!0)])),_:3})),(E(!0),C(h,null,D(r.loadedDependencyModules,((e,t)=>(E(),C(h,{key:t},[e?(E(),R(j(e),{key:0})):N("",!0)],64)))),128))]))}]]);export{z as default}; //# sourceMappingURL=ContentfulRenderer.65a68646.js.map