import{R as m}from"./RubleIcon.js";import{r as v,o as c,c as a,F as h,i as b,n as i,b as y,a as d,f as u,d as C,_ as p}from"./index.js";const k=["onClick"],w={key:0,class:"cards-item--top"},T=["innerHTML"],E=["innerHTML"];function I(e,r,t,n,o,_){const f=v("RubleIcon");return c(),a("div",{class:i(["cards",{cards_mobile:t.isMobile,"cards_with-hover":!t.isMobile}]),ref:"container"},[(c(!0),a(h,null,b(t.data,(s,l)=>(c(),a("div",{class:i(["cards-item",{active:(t.currentIndex!==null?t.currentIndex==l:o.activeElement==l)&&o.active}]),key:l,onClick:M=>_.select(l,!0)},[s.hint?(c(),a("div",w,[y(f,{class:"ruble-icon",fill:"#65c466"}),d("div",{class:"value",innerHTML:s.hint},null,8,T)])):u("",!0),d("div",{class:i(["cards-item--image",{"cards-item--image_clothes":t.isClothes}]),style:C({backgroundImage:`url('${s.icon}')`})},null,6),s.text?(c(),a("div",{key:1,class:"cards-item--text",innerHTML:s.text},null,8,E)):u("",!0)],10,k))),128))],2)}const g={props:{data:{default:[]},controllable:{default:!0},currentIndex:{default:null},controllableIndex:{require:!0},isActive:{default:!1},isClothes:{default:!1},isMobile:{type:Boolean,default:!1}},components:{RubleIcon:m},data(){return{active:!1,activeElement:0}},created(){this.active=this.isActive,document.addEventListener("keydown",this.onKeyDown)},unmounted(){document.removeEventListener("keydown",this.onKeyDown)},methods:{onKeyDown(e){(e.keyCode==window.KEY_CODE_ARROW_BOTTOM||e.keyCode==window.KEY_CODE_ARROW_TOP)&&e.preventDefault()},setActive(e){this.currentIndex===null&&(this.active=e)},select(e,r=!1){r&&window.setActiveControllableComponent(this),this.activeElement=e,this.$emit("change",e);const t=document.querySelector(`.cards-item:nth-child(${e+1})`),n=this.$refs.container,o=t.offsetTop-n.offsetTop;(o-n.scrollTop>n.offsetHeight||o-n.scrollTop<0)&&n.scrollTo({top:o,behavior:"smooth"})}}},L=p(g,[["render",I],["__scopeId","data-v-726c60fb"]]);export{L as C};
