import{useCurrentVariant as e}from"@gem-sdk/core";import{useCallback as t,useMemo as r}from"react";let l=({productImages:l,displayByVariant:n,variantSelect:a})=>{let i=e(),o=t(()=>{let e=i?.selectedOptions??[],t=e.find(e=>e.name===a);return t?.value?.toLowerCase()??""},[i?.selectedOptions,a]),s=r(()=>{if(!n||!a||!l)return l;let e=o();if(!e)return l;let t=l.filter(t=>{let r=(t.alt||"").toLowerCase();return r.includes(e)});return t.length>0?t:l},[n,a,l,o]);return{filteredProductImages:s,selectedVariantValue:o()}};export{l as useFilterImagesByVariant};
