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