import{d2 as e}from"./index-BzXujQ-F.js";const r=(r,s=3)=>{if(!r)return[];return e.filter(e=>e.id!==r.id&&!e.soldOut).map(e=>{let s=0;e.category===r.category&&("Equestrian"===e.category?s+=120:s+=80),e.type===r.type&&(s+=100),"Equestrian"!==r.category&&"barn"!==r.type&&"runinshed"!==r.type||"Equestrian"!==e.category&&"barn"!==e.type&&"runinshed"!==e.type||(s+=90),r.style&&e.style&&(r.style.includes("horse")&&e.style.includes("run-in")||r.style.includes("run-in")&&e.style.includes("horse")||r.style.includes("quaker")&&e.style.includes("quaker"))&&(s+=70);const n=t(r.dimensions),i=t(e.dimensions);if(n&&i){const e=Math.abs(n.area-i.area);e<=50?s+=60:e<=100?s+=40:e<=200&&(s+=20)}if(r.price&&e.price){const t=Math.abs(r.price-e.price)/r.price;t<=.2?s+=30:t<=.4&&(s+=15)}return{structure:e,score:s}}).sort((e,r)=>r.score-e.score).slice(0,s).map(e=>e.structure)};function t(e){if(!e)return null;const r=e.match(/(\d+)['"]?\s*[xX]\s*(\d+)['"]?/);if(!r)return null;const t=parseInt(r[1],10),s=parseInt(r[2],10);return{width:t,depth:s,area:t*s}}export{r as f};