"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),o=require("classnames"),u=require("../icons/ebay-icon-eek-range-arrow/index.js"),E=require("../icons/ebay-icon-eek-arrow/index.js"),d={"A+++":["D","E","G"],"A++":["E","G"],"A+":["F","G"],A:["G"]},g=t=>{const{max:n,min:r,rating:s}=t,l=d[n];if(!(l&&l.indexOf(r)>-1))return null;let e=n,c=1;for(;e!==s;){if(c++,r===e)return null;e.length>1?e=e.slice(0,e.length-1):e=String.fromCharCode(e.charCodeAt(0)+1)}return c>7?7:c},m=({min:t="",max:n="",rating:r,a11yText:s,className:l})=>{const e=g({rating:r,min:t,max:n}),c=o(l,"eek",{[`eek--rating-${e}`]:!!e}),i=`Energy Rating: ${r}. Range: ${n} - ${t}.`;return a.createElement("div",{className:c,role:"figure","aria-label":s||i},a.createElement("div",{className:"eek__container","aria-hidden":!0},a.createElement("span",{className:"eek__rating-range"},a.createElement("span",{"aria-hidden":"true"},n),a.createElement(u.EbayIconEekRangeArrow,null),a.createElement("span",{"aria-hidden":"true"},t)),a.createElement("span",{className:"eek__rating","aria-hidden":"true"},r)),a.createElement(E.EbayIconEekArrow,null))};exports.EbayEek=m;
