const o={data(){return{}},computed:{productImage(){var e;return this.attrImage||((e=this.product)==null?void 0:e.image)},attrImage(){var i,n,u;const e={},r={};(n=(i=this.product)==null?void 0:i.product_images)==null||n.forEach(t=>{t==null||t.attributes.forEach(c=>{e[t==null?void 0:t.id]||(e[t.id]=[],r[t.id]=t==null?void 0:t.image),e[t.id].push(c==null?void 0:c.attribute_value_id)})});const a=(u=this.inventoryAttributes)==null?void 0:u.map(t=>t==null?void 0:t.attribute_value_id),s=this.findBestMatchKey(a,e);return r[s]}},methods:{arraySimilarity(e,r){let a=0;for(let s of e)r.includes(s)&&a++;return a},findBestMatchKey(e,r){let a=null,s=-1;for(const i in r)if(Object.hasOwnProperty.call(r,i)){const n=r[i],u=this.arraySimilarity(e,n);u>s&&(s=u,a=i)}return a}}};export{o as p};
