'use client';
import{jsx as e}from"react/jsx-runtime";import t from"../base/base.js";import{useMemo as a}from"react";let ImageShopifyVariant=({product:i,isVariantOutStock:d,...r})=>{let s=i?.medias?.edges.map(e=>e.node),m=i?.variants?.edges.map(e=>{let t=e.node?.mediaId||"0",a=s?.find(e=>e?.id===t)?.src||"";return{title:e.node?.title||"",selectedOptions:e.node?.selectedOptions.map(e=>e.value),mediaId:t,image:a,id:e.node?.id||"0"}}),n=a(()=>{let e=r.value?.label,t=m?.find(t=>t?.selectedOptions?.includes(e)&&t?.image)?.image||"";return t},[r.value,m]);return e(t,{...r,swatchesImage:n,isVariantOutStock:d})};export{ImageShopifyVariant as default};
