'use client';
import{jsx as r}from"react/jsx-runtime";import{useRenderMode as e,isEmptyChildren as t,ProductProvider as o}from"@gem-sdk/core";import{useRef as i}from"react";import m from"../../../../../grid/components/row/Row.js";import s from"../../../../../grid/components/ChildrenDroppable.js";import{createAttr as n,createClass as d}from"@gem-sdk/system";import{getProductOfferAttrs as c}from"../common/attrs.js";import{getProductOfferItemClasses as l}from"../common/classes.js";import{ProductOfferSubscriptionPresenceProvider as a}from"../context/PrdOfferSubscriptionPresenceContext.js";let f=f=>{let{product:p,setting:u,builderProps:h,children:j,index:b,totalProduct:g,builderAttrs:y,styles:x}=f,{isEditMode:I}=e(),{variantSelected:O,productOfferLayout:k,layout:v,...P}=u??{};Object.keys(v||{}).forEach(r=>{k?.[r]==="2col"&&v?.[r]&&(v[r].display="fill")});let w=O?.[p?.baseID??""]?.variantId,C=n({...c(p,h?.uid)}),D=d({...l(b,u,g)}),R=i(null),A=r("div",{ref:R,...I&&C,children:r(m,{builderAttrs:y,setting:{...P,layout:v},styles:x,children:t(j)?r(s,{}):j})});return r("div",{className:D,children:r(o,{product:p,readOnly:!0,initialVariantId:w??"Latest",uid:h?.uid,children:r(a,{containerRef:R,children:A})})},`uid-${p?.id}`)};export{f as ProductOfferItem};
