1import{u as ge,c as m,r as a,d as g,j as t,s as w,I as V}from"./index-CKs6T02L.js";import{B as he}from"./BottomNav-QIEouuRa.js";const me="_page_f26c3_1",pe="_hdr_f26c3_9",_e="_backBtn_f26c3_21",ue="_hdrTitle_f26c3_35",xe="_saveBtn_f26c3_46",be="_savedBadge_f26c3_61",fe="_content_f26c3_73",ve="_section_f26c3_79",je="_fieldLabel_f26c3_83",Se="_avatarSection_f26c3_94",ke="_bigAvatar_f26c3_103",Ne="_avatarSubtitle_f26c3_117",ye="_colorRow_f26c3_126",we="_colorDot_f26c3_133",Ee="_colorDotOn_f26c3_141",Ce="_input_f26c3_174",Ae="_inputFilled_f26c3_193",De="_ageBox_f26c3_199",Be="_ageTop_f26c3_206",Fe="_ageQ_f26c3_213",Le="_ageVal_f26c3_220",Oe="_ageSlider_f26c3_227",Te="_ageMinMax_f26c3_254",Ge="_intGrid_f26c3_264",Ie="_intCard_f26c3_270",Re="_intCardOn_f26c3_284",Me="_intEmoji_f26c3_289",qe="_intLabel_f26c3_291",$e="_intCheck_f26c3_301",ze="_goalsList_f26c3_315",We="_goalRow_f26c3_321",He="_goalRowOn_f26c3_335",Pe="_goalEmoji_f26c3_340",Ve="_goalLabel_f26c3_342",Je="_goalDot_f26c3_351",Qe="_btnGreen_f26c3_365",Ue="_overlay_f26c3_431",Ke="_modalSheet_f26c3_444",Ye="_modalHandle_f26c3_457",Xe="_modalTitle_f26c3_465",Ze="_modalSub_f26c3_473",et="_btnDanger_f26c3_481",tt="_btnGhost_f26c3_497",s={page:me,hdr:pe,backBtn:_e,hdrTitle:ue,saveBtn:xe,savedBadge:be,content:fe,section:ve,fieldLabel:je,avatarSection:Se,bigAvatar:ke,avatarSubtitle:Ne,colorRow:ye,colorDot:we,colorDotOn:Ee,input:Ce,inputFilled:Ae,ageBox:De,ageTop:Be,ageQ:Fe,ageVal:Le,ageSlider:Oe,ageMinMax:Te,intGrid:Ge,intCard:Ie,intCardOn:Re,intEmoji:Me,intLabel:qe,intCheck:$e,goalsList:ze,goalRow:We,goalRowOn:He,goalEmoji:Pe,goalLabel:Ve,goalDot:Je,btnGreen:Qe,overlay:Ue,modalSheet:Ke,modalHandle:Ye,modalTitle:Xe,modalSub:Ze,btnDanger:et,btnGhost:tt},p=[{id:"green",bg:"#EDFAF4",text:"#2E8B60",border:"#2E8B60"},{id:"orange",bg:"#FAF0E8",text:"#D4713A",border:"#D4713A"},{id:"honey",bg:"#FDF6E3",text:"#C09020",border:"#EDB84A"},{id:"purple",bg:"#F3EEFF",text:"#7C3AED",border:"#7C3AED"},{id:"blue",bg:"#E8F4FD",text:"#2A6DD9",border:"#2A6DD9"}
1,{id:"pink",bg:"#FEF0F5",text:"#EF476F",border:"#EF476F"},{id:"teal",bg:"#E0F7F4",text:"#009688",border:"#009688"},{id:"indigo",bg:"#EEF2FF",text:"#4F46E5",border:"#4F46E5"}],J=[{name:"default",price:0},{name:"gagarin",price:300},{name:"kpop",price:300},{name:"ninja",price:300},{name:"block",price:250},{name:"egypt",price:300}],Q=[{id:"love",icon:"sprout",title:"ÐÑÐ±Ð¾Ð²Ñ Ðº ÑÑÑбе"},{id:"school",icon:"school",title:"ÐодгоÑовка к Ñколе"},{id:"self",icon:"target",title:"СамоÑÑоÑÑелÑноÑÑÑ"},{id:"think",icon:"brain",title:"РазвиÑие мÑÑлениÑ"},{id:"world_kn",icon:"globe",title:"ÐÑÑÐ³Ð¾Ð·Ð¾Ñ Ð¸ ÑÑÑдиÑиÑ"},{id:"empathy",icon:"handshake",title:"ÐмпаÑÐ¸Ñ Ð¸ обÑение"}];function it(){var P;const b=ge(),o=m(e=>e.child),U=m(e=>e.setChild);m(e=>e.userId);const K=m(e=>e.equipped),E=m(e=>e.setEquipped),[r,Y]=a.useState(o.name||""),[d,X]=a.useState(o.age||7),[f,Z]=a.useState(()=>{const e=p.find(n=>n.text===o.color);return(e==null?void 0:e.id)||"green"}
1),[_,C]=a.useState(o.skinAvatar||null),[A,D]=a.useState(["default"]),[B,F]=a.useState(0),[L,O]=a.useState(""),[u,h]=a.useState(null),[v,ee]=a.useState([]),[te,se]=a.useState(!0),[j,T]=a.useState(()=>{try{const e=localStorage.getItem("child_interests");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}),[G,ne]=a.useState(((P=o.goal)==null?void 0:P.bigGoalId)||"love");a.useEffect(()=>{g.get("/topics").then(({data:e})=>{const n=(e==null?void 0:e.items)??(Array.isArray(e)?e:[]);ee(n),j.size===0&&n.length>0&&T(new Set(n.slice(0,3).map(i=>String(i.id))))}).catch(()=>{}).finally(()=>se(!1))},[]),a.useEffect(()=>{g.get("/chekoins/me").then(({data:e})=>{var c;const i=["default",...(Array.isArray(e==null?void 0:e.owned)?e.owned:[]).filter(l=>String(l).startsWith("skin_")).map(l=>String(l).replace(/^skin_/,""))];if(D([...new Set(i)]),F((e==null?void 0:e.balance)??0),e!=null&&e.equipped&&E(e.equipped),!o.skinAvatar){const l=String(((c=e==null?void 0:e.equipped)==null?void 0:c.skin)||"").replace(/^skin_/,"");C(l||"default")}}).catch(()=>{})},[]);const ie=e=>{if(O(""),A.includes(e)){I(e);return}h(e)},I=e=>{const n="skin_"+e;C(e),E({...K||{},skin:n});try{const i=JSON.parse(localStorage.getItem("che_equipped")||"{}");i.skin=n,localStorage.setItem("che_equipped",JSON.stringify(i))}catch{}g.post("/chekoins/equip",{item_id:n}).catch(()=>{})},ae=async()=>{var n;const e=u;if(e)try{const{data:i}=await g.post("/chekoins/buy",{item_id:"skin_"+e});typeof(i==null?void 0:i.balance)=="number"&&F(i.balance),D(c=>[...new Set([...c,e])]),h(null),I(e)}catch(i){h(null),O(((n=i==null?void 0:i.response)==null?void 0:n.status)===402?"Ðе Ñ
ваÑÐ°ÐµÑ Ð¼Ð¾Ð½ÐµÑок на ÑÑÐ¾Ñ Ñкин":"Ðе ÑдалоÑÑ ÐºÑпиÑÑ")}}
1,[oe,R]=a.useState(!1),[M,q]=a.useState(!1),[S,le]=a.useState(!1),[$,k]=a.useState(""),N=3,z=9,W=Math.round((d-N)/(z-N)*100),y=p.find(e=>e.id===f)||p[0],ce=r.trim().charAt(0).toUpperCase()||"?",x=Q.find(e=>e.id===G),re=e=>{T(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},H=async()=>{const e=r.trim();if(!e){k("ÐведиÑе Ð¸Ð¼Ñ ÑебÑнка");return}q(!0),k("");try{const n=p.find(l=>l.id===f),i=o.birth_date&&Number(o.age)===Number(d)?o.birth_date:`${new Date().getFullYear()-Number(d)}-01-01`;await g.post("/users/me/child",{name:e,display_color:n==null?void 0:n.text,birth_date:i});const c=[...j];localStorage.setItem("child_interests",JSON.stringify(c));try{await g.post("/users/me/topics",{topic_ids:c})}catch(l){console.warn("POST /users/me/topics failed:",l==null?void 0:l.message)}U({...o,name:e,age:d,initial:e.charAt(0).toUpperCase(),color:(n==null?void 0:n.text)||o.color||"#2E8B60",emojiAvatar:null,skinAvatar:_||null,goal:x?{bigGoalId:x.id,bigGoalIcon:x.icon,bigGoalTitle:x.title}:o.goal}),le(!0),setTimeout(()=>b(-1),800)}catch{k("ÐÑибка ÑоÑ
ÑанениÑ. ÐопÑобÑйÑе еÑÑ Ñаз.")}finally{q(!1)}},de=()=>{b("/home")};return t.jsxs("div",{className:s.page,children:[oe&&t.jsx("div",{className:s.overlay,onClick:()=>R(!1),children:t.jsxs("div",{className:s.modalSheet,onClick:e=>e.stopPropagation(),children:[t.jsx("div",{className:s.modalHandle}),t.jsxs("div",{style:{textAlign:"center",marginBottom:16},children:[t.jsx("div",{style:{fontSize:48,marginBottom:10},children:t.jsx("img",{src:"/icons/warning.webp",alt:"",style:{width:18,height:18,verticalAlign:"middle",display:"inline-block"}})}),t.jsxs("div",{className:s.modalTitle,children:["УдалиÑÑ Ð¿ÑоÑÐ¸Ð»Ñ ",r,"?"]}),t.jsx("div",{className:s.modalSub,children:"ÐеÑÑ Ð¿ÑогÑеÑÑ, опÑÑ Ð¸ ÑÑаÑиÑÑика бÑдÑÑ ÑÐ´Ð°Ð»ÐµÐ½Ñ Ð½Ð°Ð²Ñегда."})]}),t.jsx("button",{className:s.btnDanger,onClick:de,children:"Ðа, ÑдалиÑÑ Ð¿ÑоÑилÑ"}),t.jsx("button",{className:s.btnGhost,onClick:()=>R(!1),children:"ÐÑмена"})]})}),u&&(()=>{const e=J.find(i=>i.name===u),n=B>=((e==null?void 0:e.price)||0);return t.jsx("div",{className:s.overlay,style:{zIndex:9999},onClick:()=>h(null),children:t.jsxs("div",{className:s.modalSheet,style:{paddingBottom:"calc(20px + env(safe-area-inset-bottom, 0px))"},onClick:i=>i.stopPropagation(),children:[t.jsx("div",{className:s.modalHandle}),t.jsxs("div",{style:{textAlign:"center",marginBottom:12},children:[t.jsx("img",{src:w(u),alt:"",style:{display:"block",margin:"0 auto 8px",width:64,height:64,borderRadius:"50%",objectFit:"cover",border:"3px solid #D8EDDE"}}),t.jsx("div",{className:s.modalTitle,children:"ÐÑпиÑÑ ÑÑого ЧевоÑÑика?"}),t.jsxs("div",{className:s.modalSub,children:["Цена: ",t.jsx("b",{children:e==null?void 0:e.price})," ",t.jsx("img",{src:"/icons/coin.png",alt:"монеÑок",style:{display:"inline-block",width:14,height:14,verticalAlign:"middle"}})," · Ñ ÑебÑ: ",t.jsx("b",{children:B})," ",t.jsx("img",{src:"/icons/coin.png",alt:"",style:{display:"inline-block",width:14,height:14,verticalAlign:"middle"}}),!n&&t.jsxs(t.Fragment,{children:[t.jsx("br",{}),"Ðе Ñ
ваÑÐ°ÐµÑ Ð¼Ð¾Ð½ÐµÑок â иÑ
можно заÑабоÑаÑÑ Ð·Ð° занÑÑиÑ."]})]})]}),t.jsxs("button",{className:s.btnDanger,style:{background:n?"#2E8B60":"#cdd5df",cursor:n?"pointer":"default"},disabled:!n,onClick:ae,children:["ÐÑпиÑÑ Ð¸ надеÑÑ Ð·Ð° ",e==null?void 0:e.price," ",t.jsx("img",{src:"/icons/coin.png",alt:"",style:{display:"inline-block",width:16,height:16,verticalAlign:"middle"}})]}),t.jsx("button",{className:s.btnGhost,onClick:()=>h(null),children:"ÐÑмена"})]})})})(),t.jsxs("div",{className:s.hdr,children:[t.jsx("button",{className:s.backBtn,onClick:()=>b(-1),children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:t.jsx("path",{d:"M15 18l-6-6 6-6"})})}),t.jsxs("div",{className:s.hdrTitle,children:["ÐÑоÑÐ¸Ð»Ñ ",r||"..."]}),S?t.jsx("div",{className:s.savedBadge,children:"â СоÑ
Ñанено"}):t.jsx("button",{className:s.saveBtn,onClick:H,children:"СоÑ
ÑаниÑÑ"})]}),t.jsxs("div",{className:s.content,children:[t.jsxs("div",{className:s.avatarSection,children:[t.jsx("div",{className:s.bigAvatar,style:{background:y.bg,color:y.text,border:`3px solid ${y.border}`,overflow:"hidden"},children:_?t.jsx("img",{src:w(_),alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):ce}),t.jsx("div",{className:s.avatarSubtitle,children:"ÐÑбеÑи ÑвеÑ"}),t.jsx("div",{className:s.colorRow,children:p.map(e=>t.jsx("button",{className:`${s.colorDot} ${f===e.id?s.colorDotOn:""}`,style:{background:e.bg,border:`2.5px solid ${e.border}`},onClick:()=>Z(e.id)},e.id))}),t.jsx("div",{className:s.avatarSubtitle,style:{marginTop:10},children:"Ðли вÑбеÑи ЧевоÑÑика"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:12,justifyContent:"center",marginTop:6},children:J.map(e=>{const n=A.includes(e.name),i=_===e.name;return t.jsxs("button",{onClick:()=>ie(e.name),style:{width:84,height:84,padding:0,overflow:"hidden",position:"relative",borderRadius:18,cursor:"pointer",background:"#fff",border:i?"3px solid #2E8B60":"2px solid #D8EDDE",boxShadow:i?"0 4px 14px rgba(46,139,96,.25)":"0 2px 6px rgba(26,46,34,.08)"},children:[t.jsx("img",{src:w(e.name),alt:"",style:{width:"100%",height:"100%",objectFit:"cover",opacity:n?1:.95}}),!n&&t.jsxs("span",{style:{position:"absolute",left:0,right:0,bottom:0,background:"rgba(26,46,34,.82)",color:"#FFD66B",fontSize:12,fontWeight:800,padding:"3px 0",textAlign:"center",lineHeight:1.1},children:[e.price," ",t.jsx("img",{src:"/icons/coin.png",alt:"монеÑок",style:{display:"inline-block",width:12,height:12,verticalAlign:"middle"}})]})]},e.name)})}),L&&t.jsx("div",{style:{color:"#c0392b",fontWeight:700,fontSize:13,marginTop:6,textAlign:"center"},children:L})]}),t.jsxs("div",{className:s.section,children:[t.jsx("div",{className:s.fieldLabel,children:"ÐÐ¼Ñ ÑебÑнка"}),t.jsx("input",{className:`${s.input} ${r?s.inputFilled:""}`,type:"text",placeholder:"Ðведи имÑ",value:r,onChange:e=>Y(e.target.value),maxLength:20})]}),t.jsxs("div",{className:s.section,children:[t.jsx("div",{className:s.fieldLabel,children:"ÐозÑаÑÑ"}),t.jsxs("div",{className:s.ageBox,children:[t.jsxs("div",{className:s.ageTop,children:[t.jsx("span",{className:s.ageQ,children:"СколÑко леÑ?"}),t.jsxs("span",{className:s.ageVal,children:[d," леÑ"]})]}),t.jsx("input",{type:"range",min:N,max:z,value:d,className:s.ageSlider,style:{background:`linear-gradient(90deg, var(--t) ${W}%, var(--br) ${W}%)`},onChange:e=>X(Number(e.target.value))}),t.jsxs("div",{className:s.ageMinMax,children:[t.jsx("span",{children:"3 года"}),t.jsx("span",{children:"9 леÑ"})]})]})]}),t.jsxs("div",{className:s.section,children:[t.jsx("div",{className:s.fieldLabel,children:"ÐнÑеÑеÑÑ"}),te?t.jsx("div",{className:s.intGrid,children:[1,2,3,4,5,6].map(e=>t.jsx("div",{className:s.intCard,style:{opacity:.3},children:t.jsx("span",{className:s.intEmoji,children:"â¦"})},e))}):t.jsx("div",{className:s.intGrid,children:v.map((e,n)=>{const i=String(e.id),c=j.has(i);return t.jsxs("button",{className:`${s.intCard} ${c?s.intCardOn:""}`,onClick:()=>re(i),style:n===v.length-1&&v.length%2!==0?{gridColumn:"1 / -1"}:{},children:[e.logo_url?t.jsx("img",{src:e.logo_url,alt:e.name,style:{width:40,height:40,objectFit:"contain",background:"transparent"}}):t.jsx("span",{className:s.intEmoji,children:e.emoji||t.jsx(V,{name:"books",size:22})}),t.jsx("span",{className:s.intLabel,children:e.name}),c&&t.jsx("div",{className:s.intCheck,children:t.jsx("svg",{width:"10",height:"8",viewBox:"0 0 12 9",fill:"none",children:t.jsx("path",{d:"M1 4l3.5 3.5L11 1",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},i)})})]}),t.jsxs("div",{className:s.section,children:[t.jsx("div",{className:s.fieldLabel,children:"Ð¦ÐµÐ»Ñ ÑазвиÑиÑ"}),t.jsx("div",{className:s.goalsList,children:Q.map(e=>{const n=G===e.id;return t.jsxs("button",{className:`${s.goalRow} ${n?s.goalRowOn:""}`,onClick:()=>ne(e.id),children:[t.jsx("span",{className:s.goalEmoji,children:t.jsx(V,{name:e.icon,size:36})}),t.jsx("span",{className:s.goalLabel,children:e.title}),t.jsx("div",{className:s.goalDot,children:n&&t.jsx("svg",{width:"10",height:"8",viewBox:"0 0 12 9",fill:"none",children:t.jsx("path",{d:"M1 4l3.5 3.5L11 1",stroke:"var(--t)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},e.id)})})]}),t.jsxs("div",{className:s.section,children:[$&&t.jsx("div",{style:{color:"#dc2626",fontSize:13,fontWeight:700,marginBottom:8,textAlign:"center"},children:$}),t.jsx("button",{className:s.btnGreen,onClick:H,disabled:M||S,children:S?"â СоÑ
Ñанено!":M?"СоÑ
ÑанÑем...":"СоÑ
ÑаниÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ"})]}),t.jsx("div",{style:{height:40}})]}),t.jsx(he,{})]})}
1export{it as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.