import{_ as $,o,h as k,w as g,c as r,d as f,f as a,F as A,i as B,a as c,b as T,T as S,t as N,y as u,Q as L,H as F,R}from"./index.js";import{_ as P}from"./center.js";import{_ as j}from"./MembersCount.js";import"./person.js";const M={key:0,class:"color-race-line"},U={key:1,class:"color-race-line__lines"},V={key:2,class:"color-race-line__lines color-race-line__lines_reversed"},D={class:"color-race-line__text"},I=3,H={__name:"Line",props:{color:Object,showText:Boolean},setup(e){return(x,d)=>(o(),k(S,{name:"show",appear:""},{default:g(()=>[e.showText?(o(),r("div",M,[e.color.toCenter?a("",!0):(o(),r("div",{key:0,class:"color-race-line__background",style:f({background:e.color.color})},null,4)),e.color.toCenter?a("",!0):(o(),r("div",U,[(o(),r(A,null,B(I,n=>c("div",{class:"color-race-line__line",key:n,style:f({background:e.color.color})},null,4)),64))])),e.color.toCenter?a("",!0):(o(),r("div",V,[(o(),r(A,null,B(I,n=>c("div",{class:"color-race-line__line",key:n,style:f({background:e.color.color})},null,4)),64))])),T(S,{name:"show-text",appear:""},{default:g(()=>[c("div",D,N(e.color.text)+"!",1)]),_:1})])):a("",!0)]),_:1}))}},J=$(H,[["__scopeId","data-v-deffc6ca"]]);const z={class:"color-race-timer"},G={class:"color-race-timer__content"},Q={class:"color-race-timer__value"},X={width:"54",height:"54",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q=c("circle",{cx:"27",cy:"27",r:"25",stroke:"#0C0A06","stroke-width":"3"},null,-1),K=["stroke","stroke-dashoffset"],W=c("div",{class:"color-race-timer__color__line"},null,-1),Y=c("div",{class:"color-race-timer__color__line"},null,-1),Z=c("div",{class:"color-race-timer__color__line"},null,-1),ee=[W,Y,Z],te={key:1,class:"color-race-timer__center",src:P},w=157,oe={__name:"Timer",props:{color:Object,timer:Object},setup(e){return(x,d)=>(o(),r("div",z,[c("div",G,[c("div",Q,N(e.timer.current),1),(o(),r("svg",X,[q,c("path",{d:"M2 27a25 25 0 1 0 50 0a25 25 0 1 0 -50 0",stroke:e.color.color,"stroke-width":"3","stroke-dasharray":w,"stroke-dashoffset":w-w*(e.timer.current/e.timer.max)},null,8,K)]))]),e.color.toCenter?(o(),r("img",te)):(o(),r("div",{key:0,class:"color-race-timer__color",style:f({background:e.color.color})},ee,4))]))}};const re={class:"color-race iface-container"},ce={data:()=>({noAdaptation:!0})},ie=Object.assign(ce,{__name:"ColorRace",props:{openParams:Object},setup(e,{expose:x}){const d=e,n=3e3,b=u(2),l=u({current:11,max:30}),m=u(null),i=u(!1),h=u({current:5,max:10}),O=[{color:"#B7B3AA",toCenter:!0},{color:"#B7B3AA",text:"Вернитесь в центр",toCenter:!0},{color:"#097FE8",text:"Синий"},{color:"#F64932",text:"Красный"},{color:"#FFB110",text:"Желтый"},{color:"#1AAE39",text:"Зеленый"}],v=L(()=>O[b.value]),E=t=>{const[s,_]=typeof t=="string"?JSON.parse(t):t;y(s),p(_)},y=t=>{i.value=!1,b.value=t,v.value.text&&(i.value=!0,window.playSound("color-race/sfx_gate_color.mp3"),setTimeout(()=>i.value=!1,n))},p=t=>{clearInterval(m.value),window.stopSound(),l.value={current:t,max:t},m.value=setInterval(()=>{--l.value.current,l.value.current<=0?window.playSound("color-race/sfx_timer_type_3.mp3"):l.value.current<=3?window.playSound("color-race/sfx_timer_type_2.mp3"):window.playSound("color-race/sfx_timer_type_1.mp3"),l.value.current<=0&&clearInterval(m.value)},1e3)},C=t=>{const[s,_]=typeof t=="string"?JSON.parse(t):t;h.value={current:s,max:_}};return F(()=>{if(d.openParams){const[t,s,_]=d.openParams;y(t),C(s),p(_)}}),R(()=>{clearInterval(m.value),window.stopSound()}),x({setStateAndTime:E,setState:y,setMembers:C,setTimer:p}),(t,s)=>(o(),r("div",re,[T(oe,{color:v.value,timer:l.value},null,8,["color","timer"]),v.value.text?(o(),k(J,{key:0,showText:i.value,color:v.value},null,8,["showText","color"])):a("",!0),T(S,{name:"fade"},{default:g(()=>[i.value?a("",!0):(o(),k(j,{key:0,current:h.value.current,max:h.value.max},null,8,["current","max"]))]),_:1})]))}});export{ie as default};
