@darkclaw921/umgt 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/server/agents/core-tools.d.ts +6 -2
- package/dist/server/agents/core-tools.js +8 -3
- package/dist/server/agents/core-tools.js.map +1 -1
- package/dist/server/agents/core.js +4 -3
- package/dist/server/agents/core.js.map +1 -1
- package/dist/server/asset-media.d.ts +2 -1
- package/dist/server/asset-media.js +1 -1
- package/dist/server/asset-media.js.map +1 -1
- package/dist/server/chat-computer.d.ts +3 -1
- package/dist/server/chat-computer.js +8 -3
- package/dist/server/chat-computer.js.map +1 -1
- package/dist/server/chat.js +4 -3
- package/dist/server/chat.js.map +1 -1
- package/dist/server/core-client.d.ts +4 -0
- package/dist/server/core-client.js +19 -0
- package/dist/server/core-client.js.map +1 -1
- package/dist/server/generated-media.d.ts +19 -0
- package/dist/server/generated-media.js +342 -0
- package/dist/server/generated-media.js.map +1 -0
- package/dist/server/routes.js +3 -1
- package/dist/server/routes.js.map +1 -1
- package/dist/shared/generated-media.d.ts +2 -0
- package/dist/shared/generated-media.js +3 -0
- package/dist/shared/generated-media.js.map +1 -0
- package/dist/web/assets/{AgentActivity-sYJeY5Yf.js → AgentActivity-DRuju8iC.js} +1 -1
- package/dist/web/assets/{AssetSelectionWizard-a43_6NO7.js → AssetSelectionWizard-7SBX7wym.js} +1 -1
- package/dist/web/assets/CoreAccount-BfH0gEKJ.js +1 -0
- package/dist/web/assets/{KidsApp-D-8t3HPy.js → KidsApp-ChVKRU9B.js} +2 -2
- package/dist/web/assets/{PlainChat-CMxYwKko.js → PlainChat-C4V_wRVc.js} +1 -1
- package/dist/web/assets/{WorkflowJournal-Did0sRta.js → WorkflowJournal-BlTNapOH.js} +1 -1
- package/dist/web/assets/{YandexGamesView-R64RSJRL.js → YandexGamesView-BAuOI0EI.js} +1 -1
- package/dist/web/assets/{index-sNciOZYG.js → index-B6_q6dBC.js} +2 -2
- package/dist/web/assets/{resources-DppXCagL.js → resources-xyl8IpX6.js} +1 -1
- package/dist/web/assets/{workflow-BrIKN5ER.js → workflow-CEkwrbrT.js} +4 -4
- package/dist/web/assets/workflow-s2TewWL6.css +1 -0
- package/dist/web/index.html +1 -1
- package/package.json +7 -7
- package/dist/web/assets/CoreAccount-D4ZC8CWv.js +0 -1
- package/dist/web/assets/workflow-BhcU9uvG.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CdVFa8IP.js";import{i,n as a}from"./ui-wHE_yBK0.js";import{n as o,t as s}from"./PaperPlaneRight.es-U0twumpP.js";import{t as c}from"./PencilSimple.es-JVHwRvGx.js";import{i as l}from"./YandexConfigFields-DDL22Bfw.js";import{G as u,L as d,M as f,V as p,W as m,_ as h,g,h as _,j as v,v as ee}from"./index-sNciOZYG.js";import{PermissionCard as te,d as ne,i as re,l as ie,r as ae,u as y}from"./workflow-BrIKN5ER.js";var b=t(n(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),C=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:x}));C.displayName=`ArrowCounterClockwiseIcon`;var w=C,T=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:S}));T.displayName=`TrashIcon`;var E=T,D=r();function oe(e){let[t,n]=(0,b.useState)(),[r,o]=(0,b.useState)(),s=(0,b.useRef)(0),[l,u]=(0,b.useState)(!1),[d,p]=(0,b.useState)(``);(0,b.useEffect)(()=>{let e=()=>{s.current++,u(!1),n(void 0),o(void 0),p(``)};return window.addEventListener(`umgt-account-changed`,e),()=>{s.current++,window.removeEventListener(`umgt-account-changed`,e)}},[]);let m=async e=>{let t=s.current;u(!0),p(``);try{await e(),t===s.current&&(n(void 0),o(void 0))}catch(e){t===s.current&&p(f(e))}finally{t===s.current&&u(!1)}},h=n=>{n.preventDefault(),t?.title.trim()&&m(()=>e.onRename(t.id,t.title.trim()))},g=e.busy||l,_=`chat-dialog-modal ${e.modern?`account-modal-modern kids-theme`:``}`;return(0,D.jsxs)(`aside`,{className:`plain-chat-history`,"aria-label":`Диалоги`,children:[(0,D.jsxs)(`div`,{className:`chat-history-list`,children:[e.chats.map(t=>(0,D.jsxs)(`div`,{className:`chat-history-row ${e.selected===t.id?`selected`:``}`,children:[e.deleted?(0,D.jsx)(`span`,{className:`chat-history-deleted-title`,children:t.title}):(0,D.jsxs)(`button`,{type:`button`,className:`chat-history-select`,disabled:g,"aria-pressed":e.selected===t.id,onClick:()=>e.onSelect(t.id),children:[t.title,t.status===`running`&&(0,D.jsx)(`small`,{children:`Отвечает…`})]}),(0,D.jsx)(`div`,{className:`chat-history-actions`,children:e.deleted?(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Восстановить «${t.title}»`,title:`Восстановить`,onClick:()=>void m(()=>e.onRestore(t.id)),children:(0,D.jsx)(w,{size:18})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Переименовать «${t.title}»`,title:`Переименовать`,onClick:()=>{p(``),n({id:t.id,title:t.title})},children:(0,D.jsx)(c,{size:18})}),(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Удалить «${t.title}»`,title:`Удалить`,onClick:()=>{p(``),o(t)},children:(0,D.jsx)(E,{size:18})})]})})]},t.id)),!e.chats.length&&(0,D.jsx)(`p`,{children:e.deleted?`Нет удалённых диалогов.`:`Ваши диалоги появятся здесь.`})]}),(0,D.jsxs)(`button`,{type:`button`,className:`chat-history-trash`,disabled:g,onClick:e.onToggleDeleted,children:[(0,D.jsx)(E,{size:17}),e.deleted?`К диалогам`:`Удалённые диалоги`]}),d&&!t&&!r&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsx)(i,{open:!!t,onOpenChange:e=>{!e&&!l&&n(void 0)},title:`Переименовать диалог`,description:`Название видно в списке диалогов.`,className:_,children:(0,D.jsxs)(`form`,{onSubmit:h,className:`chat-dialog-form`,children:[(0,D.jsxs)(`label`,{children:[`Название диалога`,(0,D.jsx)(`input`,{autoFocus:!0,required:!0,maxLength:120,value:t?.title??``,disabled:l,onChange:e=>n(t=>t&&{...t,title:e.target.value})})]}),d&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsxs)(`div`,{className:`chat-dialog-actions`,children:[(0,D.jsx)(a,{type:`button`,disabled:l,onClick:()=>n(void 0),children:`Отмена`}),(0,D.jsx)(a,{type:`submit`,tone:`primary`,disabled:l||!t?.title.trim(),children:`Сохранить`})]})]})}),(0,D.jsxs)(i,{open:!!r,onOpenChange:e=>{!e&&!l&&o(void 0)},title:`Удалить диалог?`,description:`Диалог попадёт в «Удалённые», откуда его можно восстановить. Текущая генерация остановится, созданные игры останутся в проектах.`,className:_,children:[(0,D.jsx)(`p`,{className:`chat-dialog-name`,children:r?.title}),d&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsxs)(`div`,{className:`chat-dialog-actions`,children:[(0,D.jsx)(a,{disabled:l,onClick:()=>o(void 0),children:`Отмена`}),(0,D.jsx)(a,{tone:`danger`,disabled:l,onClick:()=>r&&void m(()=>e.onDelete(r.id)),children:`Удалить`})]})]})]})}function O({onClose:e,onOpenProject:t,modern:n=!1}){let r=h(),i=ae(),c=(0,b.useRef)(!1),x=(0,b.useRef)(void 0),S=(0,b.useRef)(new Set),C=(0,b.useRef)(new Set),w=(0,b.useRef)(null),[T,O]=(0,b.useState)([]),[k,A]=(0,b.useState)(),[j,M]=(0,b.useState)(),[N,P]=(0,b.useState)(``);(0,b.useEffect)(()=>{if(c.current&&!i.recording&&i.transcript){let e=i.transcript;P(t=>(t.trim()?`${t.trim()} ${e}`:e).slice(0,3e4)),i.reset()}c.current=i.recording},[i.recording]);let[F,I]=(0,b.useState)(``),[L,R]=(0,b.useState)(!1),[z,B]=(0,b.useState)(!0),[V,H]=(0,b.useState)(!1),[U,W]=(0,b.useState)(``),[G,K]=(0,b.useState)({}),q=(0,b.useRef)(k);q.current=k;let J=(0,b.useRef)(0),Y=(0,b.useRef)(``),X=(0,b.useRef)(null),Z=(0,b.useCallback)(async()=>{let e=J.current,t=await v(V?`/chats?deleted=true`:`/chats`);e===J.current&&(O(t),A(e=>V?void 0:t.some(t=>t.id===e)?e:t[0]?.id))},[V]);(0,b.useEffect)(()=>{let e=()=>{let e=++J.current;r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,S.current.clear(),C.current.clear(),M(void 0),O([]),A(void 0),P(``),I(``),R(!1),B(!0),W(``),K({}),Z().catch(t=>{e===J.current&&I(f(t))}).finally(()=>{e===J.current&&B(!1)})};return e(),window.addEventListener(`umgt-account-changed`,e),()=>{J.current++,window.removeEventListener(`umgt-account-changed`,e)}},[Z]),(0,b.useEffect)(()=>{M(void 0),P(``)},[k]),(0,b.useEffect)(()=>()=>{w.current?.close()},[]),(0,b.useEffect)(()=>{if(!k||V)return;let e=J.current,t=!1,n,r=async()=>{try{let i=await v(`/chats/${k}`);if(t||e!==J.current)return;M(i);let a=`${i.messages.at(-1)?.id}:${i.games?.map(e=>e.status).join(`,`)}`;i.status!==`running`&&a!==Y.current&&(Y.current=a,window.dispatchEvent(new Event(`umgt-usage-changed`))),O(e=>e.map(e=>e.id===i.id?{...e,title:i.title,model:i.model,status:i.status,updatedAt:i.updatedAt}:e)),(i.status===`running`||i.launches?.some(e=>e.status===`running`)||i.games?.some(e=>[`queued`,`planning`,`building`,`waiting`].includes(e.status)))&&(n=setTimeout(r,700))}catch(i){!t&&e===J.current&&(I(f(i)),n=setTimeout(r,2500))}};return r(),()=>{t=!0,clearTimeout(n)}},[k,L,V]),(0,b.useEffect)(()=>{X.current?.scrollIntoView({block:`nearest`})},[j?.messages.at(-1)?.content]),(0,b.useEffect)(()=>{if(!j||!x.current)return;let e=x.current,t=j.messages.findIndex(t=>t.id===e.requestId);if(t<0)return;let n=(e,t)=>{S.current.has(t)||(S.current.add(t),r.say(e,t))};for(let e of j.permissions??[])n(`Нужен ваш ответ или разрешение. Проверьте запрос в чате.`,`chat-permission:${e.id}`);let i=(j.launches??[]).filter(t=>t.requestId===e.requestId);for(let e of j.messages.slice(t+1))e.role===`assistant`&&e.status===`complete`&&e.speech&&!i.length&&n(e.speech,`chat-message:${e.id}`);for(let t of j.games??[])Date.parse(t.createdAt)>=e.at&&(t.status===`ready`&&n(`Игра готова. Можно запускать.`,`game-ready:${t.id}`),t.status===`waiting`&&n(`Нужен ваш ответ. Откройте запрос в проекте.`,`game-wait:${t.id}`),t.status===`error`&&n(`Нужна ваша помощь. Подробности есть в карточке игры.`,`game-error:${t.id}`));for(let e of i)if(!(e.status===`running`||C.current.has(e.id))){if(C.current.add(e.id),e.status===`error`){w.current?.close(),w.current=null,I(e.error||`Не удалось запустить игру.`);continue}try{let t=new URL(e.url);if(t.protocol!==`http:`||![`127.0.0.1`,`localhost`,`[::1]`].includes(t.hostname)||t.username||t.password)throw Error(`Неверный адрес игры.`);let r=w.current&&!w.current.closed?w.current:window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`);w.current=null,r?(r.opener=null,r.location.replace(t.href),n(`Как пожелаете. Открываю игру.`,`open:${e.id}`)):(I(`Разрешите новое окно или нажмите «Открыть игру» ниже.`),n(`Игра готова. Нажмите «Открыть игру».`,`open:${e.id}`))}catch(e){w.current?.close(),w.current=null,I(f(e))}}j.status!==`running`&&!i.length&&(w.current?.close(),w.current=null)},[j,r.enabled,r.say]);let se=async()=>{let e=J.current;r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,R(!0),I(``);try{let t=await v(`/chats`,`POST`,{});if(e!==J.current)return;O(e=>[t,...e]),A(t.id),M(t)}catch(t){e===J.current&&I(f(t))}finally{e===J.current&&R(!1)}},Q=async()=>{let e=N.trim();if(!e||L||z||i.recording||j?.status===`running`)return;let t=J.current;r.prepare();let n=crypto.randomUUID();x.current={requestId:n,at:Date.now()},ee(e)&&j?.games?.at(-1)?.status===`ready`&&(w.current=window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`),w.current&&(w.current.opener=null,w.current.document.title=`Запуск игры`,w.current.document.body.textContent=`Открываем игру…`)),R(!0),I(``);try{let i=k??(await v(`/chats`,`POST`,{})).id;if(t!==J.current)return;let a=await v(`/chats/${i}/messages`,`POST`,{text:e,requestId:n,voiceEnabled:r.enabled});if(t!==J.current)return;A(i),M(a),P(``),await Z()}catch(e){w.current?.close(),w.current=null,t===J.current&&I(f(e))}finally{t===J.current&&R(!1)}},ce=async()=>{if(!k)return;let e=J.current;R(!0);try{let t=await v(`/chats/${k}/stop`,`POST`,{});e===J.current&&q.current===t.id&&M(t)}catch(t){e===J.current&&I(f(t))}finally{e===J.current&&R(!1)}},le=async e=>{let t=J.current;try{let n=await v(`/chats/${k}/games/${e}/stop`,`POST`,{});t===J.current&&q.current===n.id&&M(n)}catch(e){t===J.current&&I(f(e))}},$=async e=>{let t=J.current,n=window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`);n&&(n.opener=null,n.document.title=`Запуск игры`,n.document.body.textContent=`Готовим игру…`),W(e),I(``);try{let r=await v(`/chats/${k}/games/${e}/launch`,`POST`,{});if(t!==J.current){n?.close();return}let i=new URL(r.url);if(i.protocol!==`http:`||![`127.0.0.1`,`localhost`,`[::1]`].includes(i.hostname)||i.username||i.password)throw Error(`Студия вернула неверный адрес игры.`);K(t=>({...t,[e]:i.href})),n&&!n.closed?n.location.replace(i.href):I(`Разрешите открытие нового окна или нажмите «Открыть игру» ниже.`)}catch(e){n?.close(),t===J.current&&I(f(e))}finally{t===J.current&&W(``)}};return(0,D.jsxs)(`section`,{className:`plain-chat-page ${n?`plain-chat-modern kids-theme`:``}`,"aria-label":`Чат`,children:[(0,D.jsxs)(`header`,{className:`plain-chat-page-heading`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{children:`Чат`}),(0,D.jsx)(`p`,{children:`Поговори с UM или попроси создать игру.`})]}),(0,D.jsxs)(a,{tone:`ghost`,onClick:e,children:[(0,D.jsx)(u,{size:18}),`К играм`]})]}),(0,D.jsxs)(`div`,{className:`plain-chat`,"data-testid":`plain-chat`,children:[(0,D.jsx)(`div`,{className:`plain-chat-toolbar`,children:(0,D.jsxs)(a,{onClick:()=>void se(),disabled:L||z||V,children:[(0,D.jsx)(d,{size:17}),`Новый диалог`]})}),(0,D.jsxs)(`div`,{className:`plain-chat-layout`,children:[(0,D.jsx)(oe,{chats:T,selected:k,busy:L||z,deleted:V,modern:n,onRename:async(e,t)=>{let n=J.current,r=await v(`/chats/${e}`,`PATCH`,{title:t});n===J.current&&(O(t=>t.map(t=>t.id===e?{...t,title:r.title,updatedAt:r.updatedAt}:t)),M(t=>t?.id===e?{...t,title:r.title}:t))},onDelete:async e=>{let t=J.current;await v(`/chats/${e}`,`DELETE`),t===J.current&&(q.current===e&&(r.interrupt(),c.current=!1,i.reset(),x.current=void 0,w.current?.close(),w.current=null,A(void 0),M(void 0),P(``),I(``)),await Z())},onRestore:async e=>{let t=J.current;await v(`/chats/${e}/restore`,`POST`,{}),t===J.current&&await Z()},onToggleDeleted:()=>H(e=>!e),onSelect:e=>{r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,A(e),I(``)}}),(0,D.jsx)(`div`,{className:`plain-chat-body`,children:V?(0,D.jsxs)(`div`,{className:`plain-chat-empty`,children:[(0,D.jsx)(E,{size:44}),(0,D.jsx)(`h3`,{children:`Удалённые диалоги`}),(0,D.jsx)(`p`,{children:`Нажмите значок восстановления рядом с диалогом, чтобы вернуть его в список.`}),(0,D.jsx)(a,{onClick:()=>H(!1),children:`К диалогам`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`plain-chat-messages`,role:`log`,"aria-label":`Сообщения чата`,"aria-busy":j?.status===`running`,children:[!j?.messages.length&&(0,D.jsxs)(`div`,{className:`plain-chat-empty`,children:[(0,D.jsx)(m,{size:48}),(0,D.jsx)(`h3`,{children:`Поговорим или сделаем игру?`}),(0,D.jsx)(`p`,{children:`Например: «Создай игру змейку». UM подготовит быстрый HTML-прототип, который можно сразу запустить.`}),(0,D.jsx)(a,{onClick:()=>P(`Создай игру змейку — быстрый HTML-прототип для проверки концепции.`),children:`Создать змейку`})]}),j?.messages.map(e=>(0,D.jsxs)(`article`,{className:`plain-chat-message ${e.role}`,children:[(0,D.jsx)(`strong`,{children:e.role===`user`?`Вы`:`UMGT`}),(0,D.jsx)(ie,{text:e.content}),e.role===`assistant`&&e.status===`interrupted`&&j.status!==`running`&&(0,D.jsx)(`small`,{children:`Незавершённый ответ`})]},e.id)),j?.permissions?.map(e=>(0,D.jsx)(te,{permission:e,projectId:``,onAnswer:t=>v(`/chats/${j.id}/permissions/${e.id}`,`POST`,t),onRefresh:async()=>{let e=await v(`/chats/${j.id}`);q.current===e.id&&M(e)}},e.id)),j?.games?.map(e=>(0,D.jsxs)(`article`,{className:`plain-chat-game ${e.status}`,"aria-label":`Игра ${e.name}`,children:[(0,D.jsxs)(`div`,{className:`plain-chat-game-heading`,children:[(0,D.jsx)(p,{size:28}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{children:e.name}),(0,D.jsx)(`small`,{children:e.engine===`html5`?`HTML-прототип`:e.engine===`roblox`?`Roblox Studio`:`Godot`})]}),(0,D.jsx)(`span`,{children:e.status===`ready`?`Готово`:e.status===`error`?`Ошибка`:e.status===`stopped`?`Остановлено`:`Создаётся`})]}),(0,D.jsxs)(`p`,{role:`status`,children:[e.stage,e.total>0&&` · ${e.completed}/${e.total} задач`]}),e.total>0&&(0,D.jsx)(`progress`,{"aria-label":`Готовность игры ${e.name}`,max:e.total,value:e.completed}),e.status===`error`&&e.error&&(0,D.jsx)(`p`,{className:`plain-chat-error`,children:e.error}),(0,D.jsxs)(`div`,{className:`plain-chat-game-actions`,children:[e.status===`ready`&&e.engine===`html5`&&(0,D.jsxs)(a,{tone:`primary`,disabled:!!U,onClick:()=>void $(e.id),children:[(0,D.jsx)(l,{size:19,weight:`fill`}),U===e.id?`Запускаем…`:`Запустить`]}),G[e.id]&&(0,D.jsx)(`a`,{className:`button`,href:G[e.id],target:`_blank`,rel:`noopener noreferrer`,children:`Открыть игру`}),(0,D.jsxs)(a,{onClick:()=>void t(e.projectId).catch(e=>I(f(e))),children:[(0,D.jsx)(o,{size:18}),`Открыть проект`]}),[`queued`,`planning`,`building`,`waiting`].includes(e.status)&&(0,D.jsxs)(a,{onClick:()=>void le(e.id),children:[(0,D.jsx)(y,{size:16}),`Остановить создание`]})]})]},e.id)),j?.launches?.slice(-1).filter(e=>e.status===`ready`).map(e=>(0,D.jsx)(`p`,{className:`plain-chat-launch`,children:(0,D.jsx)(a,{disabled:!!U,onClick:()=>void $(e.gameId),children:`Открыть игру`})},e.id)),(0,D.jsx)(`div`,{ref:X})]}),(F||j?.error)&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:F||j?.error}),j?.status===`running`&&(0,D.jsxs)(`div`,{className:`plain-chat-progress`,role:`status`,children:[(0,D.jsx)(`span`,{children:`UMGT отвечает…`}),(0,D.jsxs)(a,{onClick:()=>void ce(),disabled:L,children:[(0,D.jsx)(y,{size:16}),`Остановить ответ`]})]}),(0,D.jsxs)(`form`,{className:`plain-chat-compose`,onSubmit:e=>{e.preventDefault(),Q()},children:[(0,D.jsx)(g,{}),(0,D.jsx)(`textarea`,{"aria-label":`Сообщение чата`,placeholder:`Напишите сообщение…`,value:i.recording?[N.trim(),i.transcript].filter(Boolean).join(` `):N,readOnly:i.recording,maxLength:3e4,rows:3,disabled:L||j?.status===`running`,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Q())}}),(0,D.jsx)(a,{type:`submit`,tone:`primary`,"aria-label":`Отправить сообщение`,disabled:!N.trim()||L||z||i.recording||j?.status===`running`,children:(0,D.jsx)(s,{size:20})}),i.supported&&(0,D.jsx)(`button`,{type:`button`,className:`voice-reply-toggle ${i.recording?`enabled`:``}`,"aria-label":i.recording?`Остановить диктовку`:`Начать диктовку`,"aria-pressed":i.recording,disabled:L||j?.status===`running`,onClick:()=>{r.interrupt(),i.recording?i.stop():i.start()},children:i.recording?(0,D.jsx)(y,{size:22,weight:`fill`}):(0,D.jsx)(ne,{size:22})})]}),i.recording&&(0,D.jsxs)(`p`,{className:`voice-reply-status`,role:`status`,children:[`Диктовка · `,re(i.seconds),` · нажмите микрофон, чтобы закончить`]}),!i.recording&&i.error&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:i.error}),(0,D.jsx)(_,{}),(0,D.jsx)(`small`,{className:`plain-chat-caption`,children:`По умолчанию создаём быстрые HTML-прототипы. Enter — отправить, Shift+Enter — новая строка. Расход — из лимитов аккаунта.`})]})})]})]})]})}export{O as PlainChat};
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CdVFa8IP.js";import{i,n as a}from"./ui-wHE_yBK0.js";import{n as o,t as s}from"./PaperPlaneRight.es-U0twumpP.js";import{t as c}from"./PencilSimple.es-JVHwRvGx.js";import{i as l}from"./YandexConfigFields-DDL22Bfw.js";import{G as u,L as d,M as f,V as p,W as m,_ as h,g,h as _,j as v,v as ee}from"./index-B6_q6dBC.js";import{PermissionCard as te,d as ne,i as re,l as ie,r as ae,u as y}from"./workflow-CEkwrbrT.js";var b=t(n(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),C=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:x}));C.displayName=`ArrowCounterClockwiseIcon`;var w=C,T=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:S}));T.displayName=`TrashIcon`;var E=T,D=r();function oe(e){let[t,n]=(0,b.useState)(),[r,o]=(0,b.useState)(),s=(0,b.useRef)(0),[l,u]=(0,b.useState)(!1),[d,p]=(0,b.useState)(``);(0,b.useEffect)(()=>{let e=()=>{s.current++,u(!1),n(void 0),o(void 0),p(``)};return window.addEventListener(`umgt-account-changed`,e),()=>{s.current++,window.removeEventListener(`umgt-account-changed`,e)}},[]);let m=async e=>{let t=s.current;u(!0),p(``);try{await e(),t===s.current&&(n(void 0),o(void 0))}catch(e){t===s.current&&p(f(e))}finally{t===s.current&&u(!1)}},h=n=>{n.preventDefault(),t?.title.trim()&&m(()=>e.onRename(t.id,t.title.trim()))},g=e.busy||l,_=`chat-dialog-modal ${e.modern?`account-modal-modern kids-theme`:``}`;return(0,D.jsxs)(`aside`,{className:`plain-chat-history`,"aria-label":`Диалоги`,children:[(0,D.jsxs)(`div`,{className:`chat-history-list`,children:[e.chats.map(t=>(0,D.jsxs)(`div`,{className:`chat-history-row ${e.selected===t.id?`selected`:``}`,children:[e.deleted?(0,D.jsx)(`span`,{className:`chat-history-deleted-title`,children:t.title}):(0,D.jsxs)(`button`,{type:`button`,className:`chat-history-select`,disabled:g,"aria-pressed":e.selected===t.id,onClick:()=>e.onSelect(t.id),children:[t.title,t.status===`running`&&(0,D.jsx)(`small`,{children:`Отвечает…`})]}),(0,D.jsx)(`div`,{className:`chat-history-actions`,children:e.deleted?(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Восстановить «${t.title}»`,title:`Восстановить`,onClick:()=>void m(()=>e.onRestore(t.id)),children:(0,D.jsx)(w,{size:18})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Переименовать «${t.title}»`,title:`Переименовать`,onClick:()=>{p(``),n({id:t.id,title:t.title})},children:(0,D.jsx)(c,{size:18})}),(0,D.jsx)(`button`,{type:`button`,disabled:g,"aria-label":`Удалить «${t.title}»`,title:`Удалить`,onClick:()=>{p(``),o(t)},children:(0,D.jsx)(E,{size:18})})]})})]},t.id)),!e.chats.length&&(0,D.jsx)(`p`,{children:e.deleted?`Нет удалённых диалогов.`:`Ваши диалоги появятся здесь.`})]}),(0,D.jsxs)(`button`,{type:`button`,className:`chat-history-trash`,disabled:g,onClick:e.onToggleDeleted,children:[(0,D.jsx)(E,{size:17}),e.deleted?`К диалогам`:`Удалённые диалоги`]}),d&&!t&&!r&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsx)(i,{open:!!t,onOpenChange:e=>{!e&&!l&&n(void 0)},title:`Переименовать диалог`,description:`Название видно в списке диалогов.`,className:_,children:(0,D.jsxs)(`form`,{onSubmit:h,className:`chat-dialog-form`,children:[(0,D.jsxs)(`label`,{children:[`Название диалога`,(0,D.jsx)(`input`,{autoFocus:!0,required:!0,maxLength:120,value:t?.title??``,disabled:l,onChange:e=>n(t=>t&&{...t,title:e.target.value})})]}),d&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsxs)(`div`,{className:`chat-dialog-actions`,children:[(0,D.jsx)(a,{type:`button`,disabled:l,onClick:()=>n(void 0),children:`Отмена`}),(0,D.jsx)(a,{type:`submit`,tone:`primary`,disabled:l||!t?.title.trim(),children:`Сохранить`})]})]})}),(0,D.jsxs)(i,{open:!!r,onOpenChange:e=>{!e&&!l&&o(void 0)},title:`Удалить диалог?`,description:`Диалог попадёт в «Удалённые», откуда его можно восстановить. Текущая генерация остановится, созданные игры останутся в проектах.`,className:_,children:[(0,D.jsx)(`p`,{className:`chat-dialog-name`,children:r?.title}),d&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:d}),(0,D.jsxs)(`div`,{className:`chat-dialog-actions`,children:[(0,D.jsx)(a,{disabled:l,onClick:()=>o(void 0),children:`Отмена`}),(0,D.jsx)(a,{tone:`danger`,disabled:l,onClick:()=>r&&void m(()=>e.onDelete(r.id)),children:`Удалить`})]})]})]})}function O({onClose:e,onOpenProject:t,modern:n=!1}){let r=h(),i=ae(),c=(0,b.useRef)(!1),x=(0,b.useRef)(void 0),S=(0,b.useRef)(new Set),C=(0,b.useRef)(new Set),w=(0,b.useRef)(null),[T,O]=(0,b.useState)([]),[k,A]=(0,b.useState)(),[j,M]=(0,b.useState)(),[N,P]=(0,b.useState)(``);(0,b.useEffect)(()=>{if(c.current&&!i.recording&&i.transcript){let e=i.transcript;P(t=>(t.trim()?`${t.trim()} ${e}`:e).slice(0,3e4)),i.reset()}c.current=i.recording},[i.recording]);let[F,I]=(0,b.useState)(``),[L,R]=(0,b.useState)(!1),[z,B]=(0,b.useState)(!0),[V,H]=(0,b.useState)(!1),[U,W]=(0,b.useState)(``),[G,K]=(0,b.useState)({}),q=(0,b.useRef)(k);q.current=k;let J=(0,b.useRef)(0),Y=(0,b.useRef)(``),X=(0,b.useRef)(null),Z=(0,b.useCallback)(async()=>{let e=J.current,t=await v(V?`/chats?deleted=true`:`/chats`);e===J.current&&(O(t),A(e=>V?void 0:t.some(t=>t.id===e)?e:t[0]?.id))},[V]);(0,b.useEffect)(()=>{let e=()=>{let e=++J.current;r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,S.current.clear(),C.current.clear(),M(void 0),O([]),A(void 0),P(``),I(``),R(!1),B(!0),W(``),K({}),Z().catch(t=>{e===J.current&&I(f(t))}).finally(()=>{e===J.current&&B(!1)})};return e(),window.addEventListener(`umgt-account-changed`,e),()=>{J.current++,window.removeEventListener(`umgt-account-changed`,e)}},[Z]),(0,b.useEffect)(()=>{M(void 0),P(``)},[k]),(0,b.useEffect)(()=>()=>{w.current?.close()},[]),(0,b.useEffect)(()=>{if(!k||V)return;let e=J.current,t=!1,n,r=async()=>{try{let i=await v(`/chats/${k}`);if(t||e!==J.current)return;M(i);let a=`${i.messages.at(-1)?.id}:${i.games?.map(e=>e.status).join(`,`)}`;i.status!==`running`&&a!==Y.current&&(Y.current=a,window.dispatchEvent(new Event(`umgt-usage-changed`))),O(e=>e.map(e=>e.id===i.id?{...e,title:i.title,model:i.model,status:i.status,updatedAt:i.updatedAt}:e)),(i.status===`running`||i.launches?.some(e=>e.status===`running`)||i.games?.some(e=>[`queued`,`planning`,`building`,`waiting`].includes(e.status)))&&(n=setTimeout(r,700))}catch(i){!t&&e===J.current&&(I(f(i)),n=setTimeout(r,2500))}};return r(),()=>{t=!0,clearTimeout(n)}},[k,L,V]),(0,b.useEffect)(()=>{X.current?.scrollIntoView({block:`nearest`})},[j?.messages.at(-1)?.content]),(0,b.useEffect)(()=>{if(!j||!x.current)return;let e=x.current,t=j.messages.findIndex(t=>t.id===e.requestId);if(t<0)return;let n=(e,t)=>{S.current.has(t)||(S.current.add(t),r.say(e,t))};for(let e of j.permissions??[])n(`Нужен ваш ответ или разрешение. Проверьте запрос в чате.`,`chat-permission:${e.id}`);let i=(j.launches??[]).filter(t=>t.requestId===e.requestId);for(let e of j.messages.slice(t+1))e.role===`assistant`&&e.status===`complete`&&e.speech&&!i.length&&n(e.speech,`chat-message:${e.id}`);for(let t of j.games??[])Date.parse(t.createdAt)>=e.at&&(t.status===`ready`&&n(`Игра готова. Можно запускать.`,`game-ready:${t.id}`),t.status===`waiting`&&n(`Нужен ваш ответ. Откройте запрос в проекте.`,`game-wait:${t.id}`),t.status===`error`&&n(`Нужна ваша помощь. Подробности есть в карточке игры.`,`game-error:${t.id}`));for(let e of i)if(!(e.status===`running`||C.current.has(e.id))){if(C.current.add(e.id),e.status===`error`){w.current?.close(),w.current=null,I(e.error||`Не удалось запустить игру.`);continue}try{let t=new URL(e.url);if(t.protocol!==`http:`||![`127.0.0.1`,`localhost`,`[::1]`].includes(t.hostname)||t.username||t.password)throw Error(`Неверный адрес игры.`);let r=w.current&&!w.current.closed?w.current:window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`);w.current=null,r?(r.opener=null,r.location.replace(t.href),n(`Как пожелаете. Открываю игру.`,`open:${e.id}`)):(I(`Разрешите новое окно или нажмите «Открыть игру» ниже.`),n(`Игра готова. Нажмите «Открыть игру».`,`open:${e.id}`))}catch(e){w.current?.close(),w.current=null,I(f(e))}}j.status!==`running`&&!i.length&&(w.current?.close(),w.current=null)},[j,r.enabled,r.say]);let se=async()=>{let e=J.current;r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,R(!0),I(``);try{let t=await v(`/chats`,`POST`,{});if(e!==J.current)return;O(e=>[t,...e]),A(t.id),M(t)}catch(t){e===J.current&&I(f(t))}finally{e===J.current&&R(!1)}},Q=async()=>{let e=N.trim();if(!e||L||z||i.recording||j?.status===`running`)return;let t=J.current;r.prepare();let n=crypto.randomUUID();x.current={requestId:n,at:Date.now()},ee(e)&&j?.games?.at(-1)?.status===`ready`&&(w.current=window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`),w.current&&(w.current.opener=null,w.current.document.title=`Запуск игры`,w.current.document.body.textContent=`Открываем игру…`)),R(!0),I(``);try{let i=k??(await v(`/chats`,`POST`,{})).id;if(t!==J.current)return;let a=await v(`/chats/${i}/messages`,`POST`,{text:e,requestId:n,voiceEnabled:r.enabled});if(t!==J.current)return;A(i),M(a),P(``),await Z()}catch(e){w.current?.close(),w.current=null,t===J.current&&I(f(e))}finally{t===J.current&&R(!1)}},ce=async()=>{if(!k)return;let e=J.current;R(!0);try{let t=await v(`/chats/${k}/stop`,`POST`,{});e===J.current&&q.current===t.id&&M(t)}catch(t){e===J.current&&I(f(t))}finally{e===J.current&&R(!1)}},le=async e=>{let t=J.current;try{let n=await v(`/chats/${k}/games/${e}/stop`,`POST`,{});t===J.current&&q.current===n.id&&M(n)}catch(e){t===J.current&&I(f(e))}},$=async e=>{let t=J.current,n=window.open(`about:blank`,`_blank`,`popup,width=1200,height=800`);n&&(n.opener=null,n.document.title=`Запуск игры`,n.document.body.textContent=`Готовим игру…`),W(e),I(``);try{let r=await v(`/chats/${k}/games/${e}/launch`,`POST`,{});if(t!==J.current){n?.close();return}let i=new URL(r.url);if(i.protocol!==`http:`||![`127.0.0.1`,`localhost`,`[::1]`].includes(i.hostname)||i.username||i.password)throw Error(`Студия вернула неверный адрес игры.`);K(t=>({...t,[e]:i.href})),n&&!n.closed?n.location.replace(i.href):I(`Разрешите открытие нового окна или нажмите «Открыть игру» ниже.`)}catch(e){n?.close(),t===J.current&&I(f(e))}finally{t===J.current&&W(``)}};return(0,D.jsxs)(`section`,{className:`plain-chat-page ${n?`plain-chat-modern kids-theme`:``}`,"aria-label":`Чат`,children:[(0,D.jsxs)(`header`,{className:`plain-chat-page-heading`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{children:`Чат`}),(0,D.jsx)(`p`,{children:`Поговори с UM или попроси создать игру.`})]}),(0,D.jsxs)(a,{tone:`ghost`,onClick:e,children:[(0,D.jsx)(u,{size:18}),`К играм`]})]}),(0,D.jsxs)(`div`,{className:`plain-chat`,"data-testid":`plain-chat`,children:[(0,D.jsx)(`div`,{className:`plain-chat-toolbar`,children:(0,D.jsxs)(a,{onClick:()=>void se(),disabled:L||z||V,children:[(0,D.jsx)(d,{size:17}),`Новый диалог`]})}),(0,D.jsxs)(`div`,{className:`plain-chat-layout`,children:[(0,D.jsx)(oe,{chats:T,selected:k,busy:L||z,deleted:V,modern:n,onRename:async(e,t)=>{let n=J.current,r=await v(`/chats/${e}`,`PATCH`,{title:t});n===J.current&&(O(t=>t.map(t=>t.id===e?{...t,title:r.title,updatedAt:r.updatedAt}:t)),M(t=>t?.id===e?{...t,title:r.title}:t))},onDelete:async e=>{let t=J.current;await v(`/chats/${e}`,`DELETE`),t===J.current&&(q.current===e&&(r.interrupt(),c.current=!1,i.reset(),x.current=void 0,w.current?.close(),w.current=null,A(void 0),M(void 0),P(``),I(``)),await Z())},onRestore:async e=>{let t=J.current;await v(`/chats/${e}/restore`,`POST`,{}),t===J.current&&await Z()},onToggleDeleted:()=>H(e=>!e),onSelect:e=>{r.interrupt(),c.current=!1,i.reset(),w.current?.close(),w.current=null,x.current=void 0,A(e),I(``)}}),(0,D.jsx)(`div`,{className:`plain-chat-body`,children:V?(0,D.jsxs)(`div`,{className:`plain-chat-empty`,children:[(0,D.jsx)(E,{size:44}),(0,D.jsx)(`h3`,{children:`Удалённые диалоги`}),(0,D.jsx)(`p`,{children:`Нажмите значок восстановления рядом с диалогом, чтобы вернуть его в список.`}),(0,D.jsx)(a,{onClick:()=>H(!1),children:`К диалогам`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`plain-chat-messages`,role:`log`,"aria-label":`Сообщения чата`,"aria-busy":j?.status===`running`,children:[!j?.messages.length&&(0,D.jsxs)(`div`,{className:`plain-chat-empty`,children:[(0,D.jsx)(m,{size:48}),(0,D.jsx)(`h3`,{children:`Поговорим или сделаем игру?`}),(0,D.jsx)(`p`,{children:`Например: «Создай игру змейку». UM подготовит быстрый HTML-прототип, который можно сразу запустить.`}),(0,D.jsx)(a,{onClick:()=>P(`Создай игру змейку — быстрый HTML-прототип для проверки концепции.`),children:`Создать змейку`})]}),j?.messages.map(e=>(0,D.jsxs)(`article`,{className:`plain-chat-message ${e.role}`,children:[(0,D.jsx)(`strong`,{children:e.role===`user`?`Вы`:`UMGT`}),(0,D.jsx)(ie,{text:e.content}),e.role===`assistant`&&e.status===`interrupted`&&j.status!==`running`&&(0,D.jsx)(`small`,{children:`Незавершённый ответ`})]},e.id)),j?.permissions?.map(e=>(0,D.jsx)(te,{permission:e,projectId:``,onAnswer:t=>v(`/chats/${j.id}/permissions/${e.id}`,`POST`,t),onRefresh:async()=>{let e=await v(`/chats/${j.id}`);q.current===e.id&&M(e)}},e.id)),j?.games?.map(e=>(0,D.jsxs)(`article`,{className:`plain-chat-game ${e.status}`,"aria-label":`Игра ${e.name}`,children:[(0,D.jsxs)(`div`,{className:`plain-chat-game-heading`,children:[(0,D.jsx)(p,{size:28}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{children:e.name}),(0,D.jsx)(`small`,{children:e.engine===`html5`?`HTML-прототип`:e.engine===`roblox`?`Roblox Studio`:`Godot`})]}),(0,D.jsx)(`span`,{children:e.status===`ready`?`Готово`:e.status===`error`?`Ошибка`:e.status===`stopped`?`Остановлено`:`Создаётся`})]}),(0,D.jsxs)(`p`,{role:`status`,children:[e.stage,e.total>0&&` · ${e.completed}/${e.total} задач`]}),e.total>0&&(0,D.jsx)(`progress`,{"aria-label":`Готовность игры ${e.name}`,max:e.total,value:e.completed}),e.status===`error`&&e.error&&(0,D.jsx)(`p`,{className:`plain-chat-error`,children:e.error}),(0,D.jsxs)(`div`,{className:`plain-chat-game-actions`,children:[e.status===`ready`&&e.engine===`html5`&&(0,D.jsxs)(a,{tone:`primary`,disabled:!!U,onClick:()=>void $(e.id),children:[(0,D.jsx)(l,{size:19,weight:`fill`}),U===e.id?`Запускаем…`:`Запустить`]}),G[e.id]&&(0,D.jsx)(`a`,{className:`button`,href:G[e.id],target:`_blank`,rel:`noopener noreferrer`,children:`Открыть игру`}),(0,D.jsxs)(a,{onClick:()=>void t(e.projectId).catch(e=>I(f(e))),children:[(0,D.jsx)(o,{size:18}),`Открыть проект`]}),[`queued`,`planning`,`building`,`waiting`].includes(e.status)&&(0,D.jsxs)(a,{onClick:()=>void le(e.id),children:[(0,D.jsx)(y,{size:16}),`Остановить создание`]})]})]},e.id)),j?.launches?.slice(-1).filter(e=>e.status===`ready`).map(e=>(0,D.jsx)(`p`,{className:`plain-chat-launch`,children:(0,D.jsx)(a,{disabled:!!U,onClick:()=>void $(e.gameId),children:`Открыть игру`})},e.id)),(0,D.jsx)(`div`,{ref:X})]}),(F||j?.error)&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:F||j?.error}),j?.status===`running`&&(0,D.jsxs)(`div`,{className:`plain-chat-progress`,role:`status`,children:[(0,D.jsx)(`span`,{children:`UMGT отвечает…`}),(0,D.jsxs)(a,{onClick:()=>void ce(),disabled:L,children:[(0,D.jsx)(y,{size:16}),`Остановить ответ`]})]}),(0,D.jsxs)(`form`,{className:`plain-chat-compose`,onSubmit:e=>{e.preventDefault(),Q()},children:[(0,D.jsx)(g,{}),(0,D.jsx)(`textarea`,{"aria-label":`Сообщение чата`,placeholder:`Напишите сообщение…`,value:i.recording?[N.trim(),i.transcript].filter(Boolean).join(` `):N,readOnly:i.recording,maxLength:3e4,rows:3,disabled:L||j?.status===`running`,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Q())}}),(0,D.jsx)(a,{type:`submit`,tone:`primary`,"aria-label":`Отправить сообщение`,disabled:!N.trim()||L||z||i.recording||j?.status===`running`,children:(0,D.jsx)(s,{size:20})}),i.supported&&(0,D.jsx)(`button`,{type:`button`,className:`voice-reply-toggle ${i.recording?`enabled`:``}`,"aria-label":i.recording?`Остановить диктовку`:`Начать диктовку`,"aria-pressed":i.recording,disabled:L||j?.status===`running`,onClick:()=>{r.interrupt(),i.recording?i.stop():i.start()},children:i.recording?(0,D.jsx)(y,{size:22,weight:`fill`}):(0,D.jsx)(ne,{size:22})})]}),i.recording&&(0,D.jsxs)(`p`,{className:`voice-reply-status`,role:`status`,children:[`Диктовка · `,re(i.seconds),` · нажмите микрофон, чтобы закончить`]}),!i.recording&&i.error&&(0,D.jsx)(`p`,{className:`plain-chat-error`,role:`alert`,children:i.error}),(0,D.jsx)(_,{}),(0,D.jsx)(`small`,{className:`plain-chat-caption`,children:`По умолчанию создаём быстрые HTML-прототипы. Enter — отправить, Shift+Enter — новая строка. Расход — из лимитов аккаунта.`})]})})]})]})]})}export{O as PlainChat};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t,t as n}from"./jsx-runtime-CdVFa8IP.js";import{t as r}from"./ArrowRight.es-9w41WqD8.js";import{t as i}from"./CaretDown.es-Cq33NYip.js";import{n as a}from"./ui-wHE_yBK0.js";import{n as o,t as s}from"./Square.es-BjNN9Ypc.js";import{t as c}from"./WarningCircle.es-D63H8cL9.js";import{U as l,b as u,d}from"./index-
|
|
1
|
+
import{o as e,r as t,t as n}from"./jsx-runtime-CdVFa8IP.js";import{t as r}from"./ArrowRight.es-9w41WqD8.js";import{t as i}from"./CaretDown.es-Cq33NYip.js";import{n as a}from"./ui-wHE_yBK0.js";import{n as o,t as s}from"./Square.es-BjNN9Ypc.js";import{t as c}from"./WarningCircle.es-D63H8cL9.js";import{U as l,b as u,d}from"./index-B6_q6dBC.js";var f=e(t(),1),p=n();function m({workspace:e,request:t,activity:n,connected:m,onPermission:h,events:g=[],onAssets:_}){let v=d(e,t),[y,b]=(0,f.useState)(!0);if((0,f.useEffect)(()=>b(!0),[e.project.id,t?.startedAt,v.decomposition?.id]),!v.visible)return null;let x=[...new Map(g.filter(t=>t.type===`permission.auto_approved`&&t.projectId===e.project.id).filter(e=>{let t=e.payload;return t.runId===v.run?.id||t.runId===v.decomposition?.id}).map(e=>[e.id,e])).values()],S=n.run?.id===v.run?.id?u(n,e.permissions.length,m):void 0,C=m&&(v.pending||v.working||v.status===`assets-search`||v.status===`assets-import`)&&!v.waiting&&v.status!==`assets-choice`,w=v.stages.length?v.stages:v.accepted?[{id:`accepted`,label:`План принят`,status:`completed`,counts:void 0,createdAt:v.decomposition?.startedAt??t?.startedAt}]:[];return(0,p.jsxs)(`section`,{className:`workflow-journal ${C?`is-live`:``}`,"data-testid":`workflow-journal`,"data-state":v.status,"aria-label":`Журнал разработки`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`workflow-journal-toggle`,"aria-expanded":y,onClick:()=>b(e=>!e),"data-testid":`workflow-journal-toggle`,children:[(0,p.jsx)(`span`,{className:`workflow-journal-mark`,"aria-hidden":`true`,children:v.waiting||v.failed?(0,p.jsx)(c,{size:18}):v.status===`paused`?(0,p.jsx)(o,{size:18}):v.status===`stopped`?(0,p.jsx)(s,{size:16}):C?(0,p.jsxs)(`span`,{className:`journal-bars`,children:[(0,p.jsx)(`i`,{}),(0,p.jsx)(`i`,{}),(0,p.jsx)(`i`,{})]}):(0,p.jsx)(l,{size:18})}),(0,p.jsxs)(`span`,{className:`workflow-journal-heading`,children:[(0,p.jsx)(`strong`,{role:`status`,"data-testid":`workflow-journal-title`,children:v.title}),(0,p.jsx)(`small`,{children:!m&&(v.pending||v.working)?`Связь прервана · восстанавливаем состояние`:v.waiting?`Действие продолжится после вашего ответа`:v.pending?`Запрос отправлен. Ждём подтверждения сервера.`:v.working?S?.detail?`${S.label} · ${S.detail}`:S?.label??`Выполняем текущий этап`:v.tasks.length?`Завершено задач: ${v.done} из ${v.tasks.length}`:`Ход подготовки и разработки`})]}),(0,p.jsxs)(`span`,{className:`journal-toggle-label`,children:[`Журнал `,(0,p.jsx)(i,{size:15})]})]}),y&&(0,p.jsxs)(`div`,{className:`workflow-journal-body`,children:[(0,p.jsxs)(`ol`,{className:`workflow-journal-rows`,"data-testid":`workflow-journal-rows`,children:[v.pending&&(0,p.jsxs)(`li`,{"data-status":`running`,children:[(0,p.jsx)(`span`,{className:`journal-node`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`strong`,{children:`Отправлено утверждение плана`}),(0,p.jsx)(`small`,{children:`Подготовка начнётся после подтверждения.`})]})]}),w.map(e=>(0,p.jsxs)(`li`,{"data-status":e.status,children:[(0,p.jsx)(`span`,{className:`journal-node`,children:e.status===`completed`?(0,p.jsx)(l,{size:12}):e.status===`failed`?(0,p.jsx)(c,{size:12}):null}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`strong`,{children:`kind`in e&&e.kind===`approval`&&e.status===`completed`?`План принят`:e.label}),e.counts&&(0,p.jsx)(`small`,{children:e.counts.tasks===void 0?e.counts.skills===void 0?``:`Подключено: ${e.counts.skills}`:`Сохранено эпиков: ${e.counts.epics} · задач: ${e.counts.tasks}`})]}),(0,p.jsx)(`span`,{className:`journal-row-status`,children:e.status===`completed`?`Готово`:e.status===`failed`?`Ошибка`:e.status===`cancelled`?`Остановлено`:v.waiting?`Ждёт ответа`:`В работе`})]},e.id)),x.length>0&&(0,p.jsxs)(`li`,{"data-status":`completed`,"data-testid":`journal-auto-approved`,children:[(0,p.jsx)(`span`,{className:`journal-node`,children:(0,p.jsx)(l,{size:12})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`strong`,{children:`Действия разрешены автоматически`}),(0,p.jsxs)(`small`,{children:[`Подтверждено запросов: `,x.length,`. Агент продолжил работу.`]})]})]}),!!v.tasks.length&&(0,p.jsxs)(`li`,{"data-status":v.done===v.tasks.length?`completed`:v.working?`running`:`idle`,children:[(0,p.jsx)(`span`,{className:`journal-node`,children:v.done===v.tasks.length?(0,p.jsx)(l,{size:12}):null}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`strong`,{children:v.done===v.tasks.length?`Реализация завершена`:`Реализация задач`}),(0,p.jsx)(`small`,{children:v.tasks.find(e=>e.status===`running`)?.title??`Выполнено ${v.done} из ${v.tasks.length}`}),(0,p.jsx)(`progress`,{"aria-label":`Выполнение задач плана`,value:v.done,max:v.tasks.length})]}),(0,p.jsxs)(`span`,{className:`journal-row-status`,children:[v.done,` / `,v.tasks.length]})]})]}),v.selection&&(0,p.jsxs)(`div`,{className:`journal-asset-stage`,"data-testid":`journal-asset-selection`,children:[(0,p.jsx)(`span`,{children:v.selection.status===`confirmed`?`Набор ассетов подтверждён`:v.selection.status===`discovering`?`Ищем варианты по утверждённому плану`:v.selection.status===`importing`?`Импортируем подтверждённый набор`:`Подбор ассетов сохранён`}),_&&(0,p.jsxs)(a,{onClick:_,"data-testid":`journal-open-assets`,children:[v.selection.status===`confirmed`?`Посмотреть набор`:`Открыть подбор`,` `,(0,p.jsx)(r,{size:15})]})]}),v.error&&(0,p.jsx)(`p`,{className:`journal-error`,role:`alert`,children:v.error}),v.waiting&&(0,p.jsxs)(a,{onClick:h,"data-testid":`journal-open-permission`,children:[`Ответить агенту `,(0,p.jsx)(r,{size:15})]}),!v.pending&&!v.failed&&!v.stages.length&&v.working&&(0,p.jsx)(`p`,{className:`journal-legacy-note`,children:v.run?.kind===`decomposition`?`Агент создаёт эпики и задачи.`:`Состояние задач обновляется по событиям агента.`})]})]})}export{m as WorkflowJournal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CdVFa8IP.js";import{t as i}from"./CheckCircle.es-D5B3hdvz.js";import{a,n as o,o as s,t as c}from"./ui-wHE_yBK0.js";import{t as ee}from"./DownloadSimple.es-DwOWFbs2.js";import{t as l}from"./ImageSquare.es-DxCFt99_.js";import{n as u,t as d}from"./Square.es-BjNN9Ypc.js";import{i as f,n as te,r as p,t as m}from"./YandexConfigFields-DDL22Bfw.js";import{t as h}from"./UploadSimple.es-DxIuxpCC.js";import{t as g}from"./WarningCircle.es-D63H8cL9.js";import{M as _,S as v,j as y}from"./index-sNciOZYG.js";var b=t(n(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,52H182.42L170,33.34A12,12,0,0,0,160,28H96a12,12,0,0,0-10,5.34L73.57,52H48A28,28,0,0,0,20,80V192a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V80A28,28,0,0,0,208,52Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4H80a12,12,0,0,0,10-5.34L102.42,52h51.15L166,70.66A12,12,0,0,0,176,76h32a4,4,0,0,1,4,4ZM128,84a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,84Zm0,72a24,24,0,1,1,24-24A24,24,0,0,1,128,156Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,64H176L160,40H96L80,64H48A16,16,0,0,0,32,80V192a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V80A16,16,0,0,0,208,64ZM128,168a36,36,0,1,1,36-36A36,36,0,0,1,128,168Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm-44,76a36,36,0,1,1-36-36A36,36,0,0,1,164,132Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,58H179.21L165,36.67A6,6,0,0,0,160,34H96a6,6,0,0,0-5,2.67L76.78,58H48A22,22,0,0,0,26,80V192a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V80A22,22,0,0,0,208,58Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V80A10,10,0,0,1,48,70H80a6,6,0,0,0,5-2.67L99.21,46h57.57L171,67.33A6,6,0,0,0,176,70h32a10,10,0,0,1,10,10ZM128,90a42,42,0,1,0,42,42A42,42,0,0,0,128,90Zm0,72a30,30,0,1,1,30-30A30,30,0,0,1,128,162Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,60H178.13L163.32,37.78A4,4,0,0,0,160,36H96a4,4,0,0,0-3.32,1.78L77.85,60H48A20,20,0,0,0,28,80V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V80A20,20,0,0,0,208,60Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V80A12,12,0,0,1,48,68H80a4,4,0,0,0,3.33-1.78L98.13,44h59.72l14.82,22.22A4,4,0,0,0,176,68h32a12,12,0,0,1,12,12ZM128,92a40,40,0,1,0,40,40A40,40,0,0,0,128,92Zm0,72a32,32,0,1,1,32-32A32,32,0,0,1,128,164Z`}))]]),C=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:x}));C.displayName=`ArrowSquareOutIcon`;var w=C,T=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:S}));T.displayName=`CameraIcon`;var E=T,D=r();function O(e){if(e.size>10485760)return`Изображение должно быть не больше 10 МБ.`;if(![`image/png`,`image/jpeg`,`image/webp`].includes(e.type))return`Выберите PNG, JPEG или WebP.`;if(!e.size)return`Выбран пустой файл.`}function k(e,t){return`/api/v1/projects/${encodeURIComponent(e)}/publication/materials/${encodeURIComponent(t)}/file`}function ne({projectId:e,buildId:t,disabled:n,reviewed:r,refreshToken:i,onBusyChange:a}){let[u,d]=(0,b.useState)([]),[f,te]=(0,b.useState)(`icon`),[p,m]=(0,b.useState)(null),[g,v]=(0,b.useState)(``),[x,S]=(0,b.useState)(),[C,w]=(0,b.useState)(``),[T,ne]=(0,b.useState)(!0),[A,j]=(0,b.useState)(new Set),M=(0,b.useRef)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(!0),F=`/projects/${e}/publication/materials`;(0,b.useEffect)(()=>(a(!!g),()=>a(!1)),[g,a]),(0,b.useEffect)(()=>(P.current=!0,()=>{P.current=!1,M.current?.abort()}),[]),(0,b.useEffect)(()=>{let e=!1;return y(F).then(t=>{e||d(t.materials)}).catch(t=>{e||w(_(t))}).finally(()=>{e||ne(!1)}),()=>{e=!0}},[F,i]);let I=e=>d(t=>[e,...t.filter(t=>t.id!==e.id)]),L=e=>{if(e.preventDefault(),!p||g||n||r)return;let i=O(p);if(i){w(i);return}w(``),v(`Загружаем изображение`),S(void 0);let a=new FormData;a.append(`kind`,f),t&&a.append(`buildId`,t),a.append(`file`,p);let o=new XMLHttpRequest;M.current=o,o.open(`POST`,`/api/v1${F}`),o.upload.onprogress=e=>{P.current&&e.lengthComputable&&S(e.loaded/e.total*100)},o.upload.onload=()=>{P.current&&(v(`Проверяем изображение`),S(void 0))};let s=()=>{M.current=null,P.current&&(v(``),S(void 0))};o.onabort=()=>s(),o.onerror=()=>{P.current&&w(`Не удалось загрузить изображение. Файл сохранён в форме — попробуйте ещё раз.`),s()},o.onload=()=>{try{let e=JSON.parse(o.responseText);if(o.status<200||o.status>=300)throw Error(e.message??`Не удалось принять изображение`);P.current&&(I(e),m(null),N.current&&(N.current.value=``))}catch(e){P.current&&w(_(e))}finally{s()}},o.send(a)},R=async(e,t)=>{if(!(g||n||r)){w(``),v(e);try{await t()}catch(e){P.current&&w(_(e))}finally{P.current&&v(``)}}};return(0,D.jsxs)(`section`,{className:`panel publication-materials`,"data-testid":`publication-materials`,children:[(0,D.jsxs)(`div`,{className:`row-between`,children:[(0,D.jsx)(`h2`,{children:`Иконка и скриншоты`}),(0,D.jsxs)(`span`,{className:`muted`,children:[u.length,` / 10`]})]}),(0,D.jsx)(`p`,{className:`muted`,children:`Загрузите собственную иконку и кадры игры. Скриншот из превью снимается в отдельной фоновой вкладке Chrome.`}),r&&(0,D.jsx)(c,{type:`info`,children:`Черновик уже подготовлен к проверке. Остановите публикацию, чтобы изменить материалы и проверить их заново.`}),C&&(0,D.jsx)(c,{children:C}),T&&(0,D.jsx)(s,{label:`Загружаем материалы`}),g&&(0,D.jsxs)(`div`,{className:`publication-material-progress`,children:[(0,D.jsx)(s,{label:g,value:x}),M.current&&(0,D.jsx)(o,{tone:`ghost`,onClick:()=>M.current?.abort(),children:`Отменить загрузку`})]}),(0,D.jsxs)(`form`,{onSubmit:L,className:`publication-material-form`,children:[(0,D.jsxs)(`div`,{className:`form-columns`,children:[(0,D.jsxs)(`label`,{children:[`Назначение`,(0,D.jsxs)(`select`,{"data-testid":`publication-material-kind`,value:f,disabled:n||r||!!g,onChange:e=>te(e.target.value),children:[(0,D.jsx)(`option`,{value:`icon`,children:`Иконка`}),(0,D.jsx)(`option`,{value:`screenshot`,children:`Скриншот`})]})]}),(0,D.jsxs)(`label`,{children:[`Изображение`,(0,D.jsx)(`input`,{ref:N,"data-testid":`publication-material-file`,type:`file`,accept:`image/png,image/jpeg,image/webp`,disabled:n||r||!!g,onChange:e=>{m(e.target.files?.[0]??null),w(``)}})]})]}),(0,D.jsx)(`small`,{children:`PNG, JPEG или WebP · до 10 МБ · до 4096 × 4096. Итоговые требования иконки и скриншотов проверяются в консоли платформы.`}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[(0,D.jsxs)(o,{type:`submit`,"data-testid":`publication-material-upload`,disabled:!p||n||r||!!g||u.length>=10,children:[(0,D.jsx)(h,{size:16}),`Загрузить изображение`]}),(0,D.jsxs)(o,{type:`button`,"data-testid":`publication-material-capture`,disabled:!t||n||r||!!g||u.length>=10,onClick:()=>void R(`Снимаем кадр из игры в Chrome`,async()=>{let e=await y(`${F}/capture`,`POST`,{buildId:t});P.current&&I(e)}),children:[(0,D.jsx)(E,{size:16}),`Кадр из игры`]})]}),!t&&(0,D.jsx)(`small`,{children:`Для снимка из игры сначала выберите готовую сборку.`})]}),(0,D.jsx)(`div`,{className:`publication-material-grid`,children:u.map(i=>(0,D.jsxs)(`article`,{"data-testid":`publication-material-card`,"data-kind":i.kind,"data-source":i.source,children:[A.has(i.id)?(0,D.jsxs)(`div`,{className:`publication-material-fallback`,children:[(0,D.jsx)(l,{size:28}),(0,D.jsx)(`span`,{children:`Не удалось открыть изображение`})]}):(0,D.jsx)(`a`,{href:k(e,i.id),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Открыть ${i.filename}`,children:(0,D.jsx)(`img`,{"data-testid":`publication-material-image`,src:k(e,i.id),alt:i.kind===`icon`?`Иконка игры`:`Скриншот: ${i.filename}`,loading:`lazy`,onError:()=>j(e=>new Set(e).add(i.id))})}),(0,D.jsxs)(`div`,{className:`publication-material-info`,children:[(0,D.jsx)(`strong`,{children:i.kind===`icon`?`Иконка`:`Скриншот`}),(0,D.jsx)(`span`,{title:i.filename,children:i.filename}),(0,D.jsxs)(`small`,{children:[i.width,` × `,i.height,` · `,(i.bytes/1024).toFixed(0),` КБ`]}),(0,D.jsxs)(`small`,{children:[i.source===`preview`?`Снято из превью игры`:`Загружено вами`,i.buildId&&i.buildId!==t?` · другая сборка`:``]}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[(0,D.jsxs)(`a`,{href:k(e,i.id),className:`button button-ghost`,download:i.filename,children:[(0,D.jsx)(ee,{size:14}),`Скачать`]}),(0,D.jsx)(o,{tone:`ghost`,disabled:n||r||!!g,"aria-label":`Удалить ${i.filename}`,onClick:()=>void R(`Удаляем материал`,async()=>{await y(`${F}/${encodeURIComponent(i.id)}`,`DELETE`),P.current&&d(e=>e.filter(e=>e.id!==i.id))}),children:`Удалить`})]})]})]},i.id))}),!T&&!u.length&&(0,D.jsx)(`p`,{className:`muted`,children:`Материалов пока нет. Здесь появятся только ваши файлы и реальные кадры игры.`})]})}var A={preparing:`Подготовка`,draft:`Черновик`,materials:`Материалы`,upload:`Загрузка сборки`,testing:`Проверка игры`,review:`Готово к проверке`,moderation:`Модерация`},j={running:`Помощник работает`,paused:`Приостановлено`,stopped:`Остановлено`,interrupted:`Нужно возобновить`,waiting_user:`Нужно ваше действие`,ready_for_review:`Проверьте черновик`,submitted:`Отправлено на модерацию`,failed:`Не удалось завершить`};function M(e){try{let t=new URL(e??``);return t.protocol===`https:`&&!t.username&&!t.password?t.href:void 0}catch{return}}var N={open:`Открыта страница`,read:`Проверено содержимое страницы`,click:`Выполнено действие в консоли`,fill:`Заполнены данные`,upload:`Сборка загружена`,upload_confirmation:`Загрузка подтверждена`,console_validation:`Проверка консоли`,moderation_click:`Запрошена модерация`,moderation_confirmation:`Модерация подтверждена`,agent_report:`Результат работы`};function P(e){if(e.action!==`agent_report`)return e.detail;try{let t=JSON.parse(e.detail);return typeof t.summary==`string`?[t.summary,...Array.isArray(t.checks)?t.checks.map(e=>`${e.passed?`✓`:`!`} ${e.name}: ${e.evidence}`):[]].join(`
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CdVFa8IP.js";import{t as i}from"./CheckCircle.es-D5B3hdvz.js";import{a,n as o,o as s,t as c}from"./ui-wHE_yBK0.js";import{t as ee}from"./DownloadSimple.es-DwOWFbs2.js";import{t as l}from"./ImageSquare.es-DxCFt99_.js";import{n as u,t as d}from"./Square.es-BjNN9Ypc.js";import{i as f,n as te,r as p,t as m}from"./YandexConfigFields-DDL22Bfw.js";import{t as h}from"./UploadSimple.es-DxIuxpCC.js";import{t as g}from"./WarningCircle.es-D63H8cL9.js";import{M as _,S as v,j as y}from"./index-B6_q6dBC.js";var b=t(n(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,52H182.42L170,33.34A12,12,0,0,0,160,28H96a12,12,0,0,0-10,5.34L73.57,52H48A28,28,0,0,0,20,80V192a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V80A28,28,0,0,0,208,52Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4H80a12,12,0,0,0,10-5.34L102.42,52h51.15L166,70.66A12,12,0,0,0,176,76h32a4,4,0,0,1,4,4ZM128,84a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,84Zm0,72a24,24,0,1,1,24-24A24,24,0,0,1,128,156Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,64H176L160,40H96L80,64H48A16,16,0,0,0,32,80V192a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V80A16,16,0,0,0,208,64ZM128,168a36,36,0,1,1,36-36A36,36,0,0,1,128,168Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm-44,76a36,36,0,1,1-36-36A36,36,0,0,1,164,132Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,58H179.21L165,36.67A6,6,0,0,0,160,34H96a6,6,0,0,0-5,2.67L76.78,58H48A22,22,0,0,0,26,80V192a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V80A22,22,0,0,0,208,58Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V80A10,10,0,0,1,48,70H80a6,6,0,0,0,5-2.67L99.21,46h57.57L171,67.33A6,6,0,0,0,176,70h32a10,10,0,0,1,10,10ZM128,90a42,42,0,1,0,42,42A42,42,0,0,0,128,90Zm0,72a30,30,0,1,1,30-30A30,30,0,0,1,128,162Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M208,60H178.13L163.32,37.78A4,4,0,0,0,160,36H96a4,4,0,0,0-3.32,1.78L77.85,60H48A20,20,0,0,0,28,80V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V80A20,20,0,0,0,208,60Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V80A12,12,0,0,1,48,68H80a4,4,0,0,0,3.33-1.78L98.13,44h59.72l14.82,22.22A4,4,0,0,0,176,68h32a12,12,0,0,1,12,12ZM128,92a40,40,0,1,0,40,40A40,40,0,0,0,128,92Zm0,72a32,32,0,1,1,32-32A32,32,0,0,1,128,164Z`}))]]),C=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:x}));C.displayName=`ArrowSquareOutIcon`;var w=C,T=b.forwardRef((t,n)=>b.createElement(e,{ref:n,...t,weights:S}));T.displayName=`CameraIcon`;var E=T,D=r();function O(e){if(e.size>10485760)return`Изображение должно быть не больше 10 МБ.`;if(![`image/png`,`image/jpeg`,`image/webp`].includes(e.type))return`Выберите PNG, JPEG или WebP.`;if(!e.size)return`Выбран пустой файл.`}function k(e,t){return`/api/v1/projects/${encodeURIComponent(e)}/publication/materials/${encodeURIComponent(t)}/file`}function ne({projectId:e,buildId:t,disabled:n,reviewed:r,refreshToken:i,onBusyChange:a}){let[u,d]=(0,b.useState)([]),[f,te]=(0,b.useState)(`icon`),[p,m]=(0,b.useState)(null),[g,v]=(0,b.useState)(``),[x,S]=(0,b.useState)(),[C,w]=(0,b.useState)(``),[T,ne]=(0,b.useState)(!0),[A,j]=(0,b.useState)(new Set),M=(0,b.useRef)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(!0),F=`/projects/${e}/publication/materials`;(0,b.useEffect)(()=>(a(!!g),()=>a(!1)),[g,a]),(0,b.useEffect)(()=>(P.current=!0,()=>{P.current=!1,M.current?.abort()}),[]),(0,b.useEffect)(()=>{let e=!1;return y(F).then(t=>{e||d(t.materials)}).catch(t=>{e||w(_(t))}).finally(()=>{e||ne(!1)}),()=>{e=!0}},[F,i]);let I=e=>d(t=>[e,...t.filter(t=>t.id!==e.id)]),L=e=>{if(e.preventDefault(),!p||g||n||r)return;let i=O(p);if(i){w(i);return}w(``),v(`Загружаем изображение`),S(void 0);let a=new FormData;a.append(`kind`,f),t&&a.append(`buildId`,t),a.append(`file`,p);let o=new XMLHttpRequest;M.current=o,o.open(`POST`,`/api/v1${F}`),o.upload.onprogress=e=>{P.current&&e.lengthComputable&&S(e.loaded/e.total*100)},o.upload.onload=()=>{P.current&&(v(`Проверяем изображение`),S(void 0))};let s=()=>{M.current=null,P.current&&(v(``),S(void 0))};o.onabort=()=>s(),o.onerror=()=>{P.current&&w(`Не удалось загрузить изображение. Файл сохранён в форме — попробуйте ещё раз.`),s()},o.onload=()=>{try{let e=JSON.parse(o.responseText);if(o.status<200||o.status>=300)throw Error(e.message??`Не удалось принять изображение`);P.current&&(I(e),m(null),N.current&&(N.current.value=``))}catch(e){P.current&&w(_(e))}finally{s()}},o.send(a)},R=async(e,t)=>{if(!(g||n||r)){w(``),v(e);try{await t()}catch(e){P.current&&w(_(e))}finally{P.current&&v(``)}}};return(0,D.jsxs)(`section`,{className:`panel publication-materials`,"data-testid":`publication-materials`,children:[(0,D.jsxs)(`div`,{className:`row-between`,children:[(0,D.jsx)(`h2`,{children:`Иконка и скриншоты`}),(0,D.jsxs)(`span`,{className:`muted`,children:[u.length,` / 10`]})]}),(0,D.jsx)(`p`,{className:`muted`,children:`Загрузите собственную иконку и кадры игры. Скриншот из превью снимается в отдельной фоновой вкладке Chrome.`}),r&&(0,D.jsx)(c,{type:`info`,children:`Черновик уже подготовлен к проверке. Остановите публикацию, чтобы изменить материалы и проверить их заново.`}),C&&(0,D.jsx)(c,{children:C}),T&&(0,D.jsx)(s,{label:`Загружаем материалы`}),g&&(0,D.jsxs)(`div`,{className:`publication-material-progress`,children:[(0,D.jsx)(s,{label:g,value:x}),M.current&&(0,D.jsx)(o,{tone:`ghost`,onClick:()=>M.current?.abort(),children:`Отменить загрузку`})]}),(0,D.jsxs)(`form`,{onSubmit:L,className:`publication-material-form`,children:[(0,D.jsxs)(`div`,{className:`form-columns`,children:[(0,D.jsxs)(`label`,{children:[`Назначение`,(0,D.jsxs)(`select`,{"data-testid":`publication-material-kind`,value:f,disabled:n||r||!!g,onChange:e=>te(e.target.value),children:[(0,D.jsx)(`option`,{value:`icon`,children:`Иконка`}),(0,D.jsx)(`option`,{value:`screenshot`,children:`Скриншот`})]})]}),(0,D.jsxs)(`label`,{children:[`Изображение`,(0,D.jsx)(`input`,{ref:N,"data-testid":`publication-material-file`,type:`file`,accept:`image/png,image/jpeg,image/webp`,disabled:n||r||!!g,onChange:e=>{m(e.target.files?.[0]??null),w(``)}})]})]}),(0,D.jsx)(`small`,{children:`PNG, JPEG или WebP · до 10 МБ · до 4096 × 4096. Итоговые требования иконки и скриншотов проверяются в консоли платформы.`}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[(0,D.jsxs)(o,{type:`submit`,"data-testid":`publication-material-upload`,disabled:!p||n||r||!!g||u.length>=10,children:[(0,D.jsx)(h,{size:16}),`Загрузить изображение`]}),(0,D.jsxs)(o,{type:`button`,"data-testid":`publication-material-capture`,disabled:!t||n||r||!!g||u.length>=10,onClick:()=>void R(`Снимаем кадр из игры в Chrome`,async()=>{let e=await y(`${F}/capture`,`POST`,{buildId:t});P.current&&I(e)}),children:[(0,D.jsx)(E,{size:16}),`Кадр из игры`]})]}),!t&&(0,D.jsx)(`small`,{children:`Для снимка из игры сначала выберите готовую сборку.`})]}),(0,D.jsx)(`div`,{className:`publication-material-grid`,children:u.map(i=>(0,D.jsxs)(`article`,{"data-testid":`publication-material-card`,"data-kind":i.kind,"data-source":i.source,children:[A.has(i.id)?(0,D.jsxs)(`div`,{className:`publication-material-fallback`,children:[(0,D.jsx)(l,{size:28}),(0,D.jsx)(`span`,{children:`Не удалось открыть изображение`})]}):(0,D.jsx)(`a`,{href:k(e,i.id),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Открыть ${i.filename}`,children:(0,D.jsx)(`img`,{"data-testid":`publication-material-image`,src:k(e,i.id),alt:i.kind===`icon`?`Иконка игры`:`Скриншот: ${i.filename}`,loading:`lazy`,onError:()=>j(e=>new Set(e).add(i.id))})}),(0,D.jsxs)(`div`,{className:`publication-material-info`,children:[(0,D.jsx)(`strong`,{children:i.kind===`icon`?`Иконка`:`Скриншот`}),(0,D.jsx)(`span`,{title:i.filename,children:i.filename}),(0,D.jsxs)(`small`,{children:[i.width,` × `,i.height,` · `,(i.bytes/1024).toFixed(0),` КБ`]}),(0,D.jsxs)(`small`,{children:[i.source===`preview`?`Снято из превью игры`:`Загружено вами`,i.buildId&&i.buildId!==t?` · другая сборка`:``]}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[(0,D.jsxs)(`a`,{href:k(e,i.id),className:`button button-ghost`,download:i.filename,children:[(0,D.jsx)(ee,{size:14}),`Скачать`]}),(0,D.jsx)(o,{tone:`ghost`,disabled:n||r||!!g,"aria-label":`Удалить ${i.filename}`,onClick:()=>void R(`Удаляем материал`,async()=>{await y(`${F}/${encodeURIComponent(i.id)}`,`DELETE`),P.current&&d(e=>e.filter(e=>e.id!==i.id))}),children:`Удалить`})]})]})]},i.id))}),!T&&!u.length&&(0,D.jsx)(`p`,{className:`muted`,children:`Материалов пока нет. Здесь появятся только ваши файлы и реальные кадры игры.`})]})}var A={preparing:`Подготовка`,draft:`Черновик`,materials:`Материалы`,upload:`Загрузка сборки`,testing:`Проверка игры`,review:`Готово к проверке`,moderation:`Модерация`},j={running:`Помощник работает`,paused:`Приостановлено`,stopped:`Остановлено`,interrupted:`Нужно возобновить`,waiting_user:`Нужно ваше действие`,ready_for_review:`Проверьте черновик`,submitted:`Отправлено на модерацию`,failed:`Не удалось завершить`};function M(e){try{let t=new URL(e??``);return t.protocol===`https:`&&!t.username&&!t.password?t.href:void 0}catch{return}}var N={open:`Открыта страница`,read:`Проверено содержимое страницы`,click:`Выполнено действие в консоли`,fill:`Заполнены данные`,upload:`Сборка загружена`,upload_confirmation:`Загрузка подтверждена`,console_validation:`Проверка консоли`,moderation_click:`Запрошена модерация`,moderation_confirmation:`Модерация подтверждена`,agent_report:`Результат работы`};function P(e){if(e.action!==`agent_report`)return e.detail;try{let t=JSON.parse(e.detail);return typeof t.summary==`string`?[t.summary,...Array.isArray(t.checks)?t.checks.map(e=>`${e.passed?`✓`:`!`} ${e.name}: ${e.evidence}`):[]].join(`
|
|
2
2
|
`):e.detail}catch{return e.detail}}function F(e){return e?.status===`ready_for_review`}function I({project:e,events:t,onRefresh:n,onEngine:r,engineBusy:l}){let[h,x]=(0,b.useState)(e.yandexGames??te()),[S,C]=(0,b.useState)([]),[T,E]=(0,b.useState)(``),[O,k]=(0,b.useState)(),[I,L]=(0,b.useState)([]),[R,z]=(0,b.useState)({id:`chrome-mcp`,endpoint:`http://127.0.0.1:12306/mcp`,enabled:!0}),[B,re]=(0,b.useState)(),[V,H]=(0,b.useState)({title:e.name,description:e.description,instructions:``,locales:e.yandexGames?.languages??[`ru`,`en`]}),[U,ie]=(0,b.useState)(``),[W,ae]=(0,b.useState)(!1),[oe,G]=(0,b.useState)(``),[se,ce]=(0,b.useState)(``),[K,le]=(0,b.useState)(!1),[ue,de]=(0,b.useState)(),[fe,pe]=(0,b.useState)(!0),me=(0,b.useRef)(Date.now()),q=(0,b.useRef)(!0),J=t.filter(t=>t.projectId===e.id&&[`publication.updated`,`publication.materials`,`engine.completed`].includes(t.type)).at(-1),Y=J?.id;(0,b.useEffect)(()=>(q.current=!0,()=>{q.current=!1}),[]),(0,b.useEffect)(()=>{let t=!1;return pe(!0),Promise.all([y(`/projects/${e.id}/builds`),y(`/projects/${e.id}/publication`),y(`/browser/config`),y(`/projects/${e.id}/yandex-games/config`)]).then(([e,n,r,i])=>{t||(C(e.filter(e=>e.platform===`yandex-games`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),E(t=>t||e.filter(e=>e.platform===`yandex-games`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.id||``),k(n.run),L(n.runs),z(r),x(i.config),de(i.configHash),n.run&&H({...n.run.metadata,draftUrl:n.run.draftUrl??n.run.metadata.draftUrl}))}).catch(e=>{t||G(_(e))}).finally(()=>{t||pe(!1)}),()=>{t=!0}},[e.id]),(0,b.useEffect)(()=>{if(!Y)return;let t=!1;return Promise.all([y(`/projects/${e.id}/builds`),y(`/projects/${e.id}/publication`)]).then(([e,n])=>{if(t)return;C(e.filter(e=>e.platform===`yandex-games`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)));let r=J?.type===`engine.completed`&&Date.parse(J.createdAt)>=me.current?J.payload:void 0;E(t=>r?.ok&&e.some(e=>e.id===r.buildId)?r.buildId:t||e.filter(e=>e.platform===`yandex-games`).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.id||``),k(n.run),L(n.runs)}).catch(e=>{t||G(_(e))}),()=>{t=!0}},[Y,e.id]);let he=async()=>{let t=await y(`/projects/${e.id}/publication`);q.current&&(k(t.run),L(t.runs))},X=async(e,t)=>{if(!U){ie(e),G(``),ce(``);try{await t()}catch(e){q.current&&G(_(e))}finally{q.current&&ie(``)}}},ge=async t=>{t.preventDefault(),await X(`Сохраняем настройки SDK`,async()=>{await y(`/projects/${e.id}/yandex-games/config`,`PUT`,p(h));let t=await y(`/projects/${e.id}/yandex-games/config`);await n(),q.current&&(de(t.configHash),le(!1),ce(`Настройки игры сохранены. Соберите новый ZIP, чтобы применить их.`))})},Z=O?.status===`running`,_e=O&&[`paused`,`stopped`,`interrupted`,`waiting_user`,`failed`].includes(O.status),Q=S.find(e=>e.id===T),ve=!!Q&&!!ue&&Q.configHash!==ue,$=t=>X(t===`resume`?`Продолжаем публикацию`:t===`pause`?`Приостанавливаем публикацию`:`Останавливаем публикацию`,async()=>{await y(`/projects/${e.id}/publication/control`,`POST`,{action:t,...t===`resume`&&V.draftUrl?{draftUrl:V.draftUrl}:{}}),await he()});return fe?(0,D.jsx)(s,{label:`Загружаем настройки публикации`}):(0,D.jsxs)(`div`,{className:`yandex-view`,"data-testid":`yandex-games-view`,children:[(0,D.jsx)(a,{title:`Яндекс Игры`,description:`SDK, проверенная Web-сборка и публикация через ваш Chrome.`,action:(0,D.jsxs)(`span`,{className:`badge`,children:[e.engine===`html5`?`HTML5`:`Godot`,` · Web`]})}),oe&&(0,D.jsx)(c,{children:oe}),se&&(0,D.jsx)(c,{type:`success`,children:se}),U&&(0,D.jsx)(s,{label:U}),(0,D.jsxs)(`div`,{className:`yandex-layout`,children:[(0,D.jsxs)(`div`,{className:`yandex-main`,children:[(0,D.jsxs)(`section`,{className:`panel`,children:[(0,D.jsxs)(`div`,{className:`row-between`,children:[(0,D.jsx)(`h2`,{children:`Настройки игры`}),(0,D.jsx)(`span`,{className:`muted`,children:`SDK`})]}),(0,D.jsxs)(`form`,{onSubmit:ge,children:[(0,D.jsx)(m,{value:h,onChange:e=>{x(e),le(!0)},disabled:!!U||Z}),(0,D.jsx)(`div`,{className:`modal-actions`,children:(0,D.jsx)(o,{type:`submit`,tone:`primary`,"data-testid":`yandex-save-config`,disabled:!!U||W||Z||!h.devices.length||!h.languages.some(Boolean),children:`Сохранить настройки`})})]})]}),(0,D.jsxs)(`section`,{className:`panel`,children:[(0,D.jsxs)(`div`,{className:`row-between`,children:[(0,D.jsx)(`h2`,{children:`Сборка для загрузки`}),(0,D.jsx)(o,{"data-testid":`yandex-build`,busy:!!l,disabled:!!U||W||Z||K,onClick:()=>void r(`export`,`yandex-games`),children:`Собрать ZIP`})]}),l&&(0,D.jsx)(s,{label:l}),S.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{children:[`Сборка`,(0,D.jsx)(`select`,{"data-testid":`yandex-build-select`,value:T,onChange:e=>E(e.target.value),children:S.map(e=>(0,D.jsxs)(`option`,{value:e.id,children:[new Date(e.createdAt).toLocaleString(`ru-RU`),` · `,e.validation.ok?`Проверена`:`Есть замечания`]},e.id))})]}),Q&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`yandex-build-result`,"data-testid":`yandex-build-result`,children:[Q.validation.ok?(0,D.jsx)(i,{size:20}):(0,D.jsx)(g,{size:20}),(0,D.jsx)(`strong`,{children:Q.validation.ok?`Сборка прошла проверку`:`Исправьте ошибки сборки`}),(0,D.jsxs)(`span`,{children:[Q.validation.files,` файлов · `,(Q.validation.bytes/1024/1024).toFixed(1),` МБ`]})]}),(0,D.jsx)(`ul`,{className:`yandex-issues`,children:Q.validation.issues.map((e,t)=>(0,D.jsxs)(`li`,{"data-severity":e.severity,children:[e.message,e.file&&(0,D.jsx)(`small`,{children:e.file})]},t))}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[(0,D.jsxs)(`a`,{className:`button button-default`,"data-testid":`yandex-download`,href:`/api/v1/projects/${e.id}/builds/${Q.id}/download`,download:!0,children:[(0,D.jsx)(ee,{size:17}),`Скачать ZIP`]}),(0,D.jsx)(o,{"data-testid":`yandex-validate`,disabled:!!U,onClick:()=>void X(`Проверяем ZIP`,async()=>{let t=await y(`/projects/${e.id}/builds/${Q.id}/validate`,`POST`,{});q.current&&C(e=>e.map(e=>e.id===Q.id?{...e,validation:t}:e))}),children:`Проверить ещё раз`})]})]})]}):(0,D.jsx)(`p`,{className:`muted`,children:`Соберите игру. Здесь появятся ZIP и результаты проверки файлов.`})]}),(0,D.jsx)(ne,{projectId:e.id,buildId:Q?.validation.ok&&!ve?Q.id:void 0,disabled:Z||!!U,reviewed:O?.status===`ready_for_review`,refreshToken:Y,onBusyChange:ae}),(0,D.jsxs)(`section`,{className:`panel`,children:[(0,D.jsx)(`h2`,{children:`Карточка игры`}),(K||ve)&&(0,D.jsx)(c,{type:`info`,children:`Настройки изменились. Сохраните их и соберите новый ZIP перед публикацией.`}),(0,D.jsx)(`form`,{onSubmit:t=>{t.preventDefault(),X(`Запускаем помощника публикации`,async()=>{await y(`/projects/${e.id}/publication/start`,`POST`,{buildId:T,metadata:{...V,locales:V.locales.map(e=>e.trim()).filter(Boolean),tags:V.tags?.map(e=>e.trim()).filter(Boolean)}}),await he()})},children:(0,D.jsxs)(`div`,{className:`project-form`,children:[(0,D.jsxs)(`label`,{children:[`Название игры`,(0,D.jsx)(`input`,{required:!0,maxLength:100,value:V.title,onChange:e=>H({...V,title:e.target.value})})]}),(0,D.jsxs)(`label`,{children:[`Описание`,(0,D.jsx)(`textarea`,{required:!0,rows:3,value:V.description,onChange:e=>H({...V,description:e.target.value})})]}),(0,D.jsxs)(`label`,{children:[`Как играть`,(0,D.jsx)(`textarea`,{required:!0,rows:3,"data-testid":`publication-instructions`,value:V.instructions,onChange:e=>H({...V,instructions:e.target.value})})]}),(0,D.jsxs)(`label`,{children:[`Языки карточки`,(0,D.jsx)(`input`,{value:V.locales.join(`, `),onChange:e=>H({...V,locales:e.target.value.split(`,`).map(e=>e.trim())})})]}),(0,D.jsxs)(`label`,{children:[`Существующий черновик `,(0,D.jsx)(`span`,{className:`muted`,children:`· необязательно`}),(0,D.jsx)(`input`,{type:`url`,placeholder:`https://games.yandex.ru/console/…`,value:V.draftUrl??``,onChange:e=>H({...V,draftUrl:e.target.value||void 0})})]}),(0,D.jsxs)(`div`,{className:`form-columns`,children:[(0,D.jsxs)(`label`,{children:[`Жанр`,(0,D.jsx)(`input`,{value:V.genre??``,onChange:e=>H({...V,genre:e.target.value})})]}),(0,D.jsxs)(`label`,{children:[`Возрастной рейтинг`,(0,D.jsx)(`input`,{value:V.ageRating??``,onChange:e=>H({...V,ageRating:e.target.value})})]})]}),(0,D.jsxs)(`label`,{children:[`Теги`,(0,D.jsx)(`input`,{value:V.tags?.join(`, `)??``,onChange:e=>H({...V,tags:e.target.value.split(`,`).map(e=>e.trim())})})]}),(0,D.jsxs)(o,{type:`submit`,"data-testid":`publication-start`,tone:`primary`,disabled:!!U||Z||!!_e||O?.status===`ready_for_review`||W||K||ve||!Q?.validation.ok,children:[(0,D.jsx)(f,{size:16}),`Подготовить публикацию`]}),(0,D.jsx)(`small`,{children:`Помощник подготовит черновик, загрузит сборку и проверит игру. Отправку на модерацию вы запускаете отдельно.`})]})})]})]}),(0,D.jsxs)(`aside`,{className:`yandex-side`,children:[(0,D.jsxs)(`section`,{className:`panel`,children:[(0,D.jsx)(`h2`,{children:`Подключение Chrome`}),(0,D.jsx)(`p`,{className:`muted`,children:`Помощник использует Chrome MCP Bridge и расширение в вашем браузере.`}),(0,D.jsxs)(`label`,{children:[`Адрес локального bridge`,(0,D.jsx)(`input`,{"data-testid":`chrome-bridge-endpoint`,value:R.endpoint,onChange:e=>z({...R,endpoint:e.target.value})})]}),(0,D.jsxs)(`label`,{className:`checkbox-options`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:R.enabled,onChange:e=>z({...R,enabled:e.target.checked})}),`Использовать Chrome MCP`]}),(0,D.jsx)(o,{"data-testid":`chrome-connect`,disabled:!!U||Z,onClick:()=>void X(`Подключаем Chrome и проверяем расширение`,async()=>{await y(`/browser/config`,`PUT`,R);let e=await y(`/browser/diagnostics`,`POST`,{});q.current&&re(e)}),children:`Сохранить и проверить`}),B&&(0,D.jsxs)(`div`,{className:`yandex-diagnostic`,"data-testid":`chrome-diagnostic`,"data-ready":B.available,children:[(0,D.jsx)(`strong`,{children:B.available?`Chrome подключён`:`Подключение требует внимания`}),(0,D.jsx)(`p`,{children:B.message}),(0,D.jsxs)(`ul`,{children:[(0,D.jsxs)(`li`,{children:[`Bridge: `,B.bridgeConnected?`доступен`:`не подключён`]}),(0,D.jsxs)(`li`,{children:[`Расширение: `,B.extensionReady?`готово`:`не готово`]})]}),M(B.setupUrl)&&(0,D.jsxs)(`a`,{href:M(B.setupUrl),target:`_blank`,rel:`noopener noreferrer`,children:[`Настроить расширение `,(0,D.jsx)(w,{size:14})]})]})]}),(0,D.jsxs)(`section`,{className:`panel publication-journal`,"data-testid":`publication-journal`,"data-status":O?.status??`idle`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`ПУБЛИКАЦИЯ`}),(0,D.jsx)(`h2`,{"aria-live":`polite`,children:O?j[O.status]:`Готовы к первому черновику`}),O?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`p`,{children:A[O.stage]}),Z&&(0,D.jsx)(s,{label:A[O.stage]}),` `,O.userAction&&[`waiting_user`,`interrupted`].includes(O.status)&&(0,D.jsx)(c,{children:(0,D.jsx)(v,{id:`publication:${O.id}:user`,children:O.userAction})}),O.error&&(0,D.jsx)(c,{children:O.error}),(0,D.jsxs)(`div`,{className:`row-actions`,children:[Z&&(0,D.jsxs)(o,{"data-testid":`publication-pause`,disabled:!!U,onClick:()=>void $(`pause`),children:[(0,D.jsx)(u,{size:15}),`Пауза`]}),_e&&(0,D.jsxs)(o,{"data-testid":`publication-resume`,disabled:!!U,onClick:()=>void $(`resume`),children:[(0,D.jsx)(f,{size:15}),O.status===`waiting_user`?`Я выполнил действие`:`Продолжить`]}),(Z||_e||O.status===`ready_for_review`)&&(0,D.jsxs)(o,{"data-testid":`publication-stop`,disabled:!!U,onClick:()=>void $(`stop`),children:[(0,D.jsx)(d,{size:15}),`Остановить`]})]}),M(O.draftUrl)&&(0,D.jsxs)(`a`,{href:M(O.draftUrl),target:`_blank`,rel:`noopener noreferrer`,children:[`Открыть черновик `,(0,D.jsx)(w,{size:14})]}),(0,D.jsx)(`ol`,{className:`publication-evidence`,children:O.evidence.map((e,t)=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`publication-dot`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`strong`,{children:N[e.action]??e.action}),(0,D.jsx)(`p`,{children:(0,D.jsx)(v,{id:`publication:${O.id}:${t}`,children:P(e)})}),(0,D.jsx)(`small`,{children:new Date(e.at).toLocaleTimeString(`ru-RU`)})]})]},`${e.at}:${t}`))}),F(O)&&(0,D.jsxs)(`div`,{className:`publication-submit`,children:[(0,D.jsx)(`p`,{children:`Проверьте карточку, материалы и игру в консоли. Это отдельное действие отправит текущий черновик на модерацию.`}),(0,D.jsx)(o,{"data-testid":`publication-submit`,tone:`primary`,disabled:!!U||W,onClick:()=>void X(`Отправляем на модерацию`,async()=>{await y(`/projects/${e.id}/publication/submit`,`POST`,{runId:O.id}),await he()}),children:`Отправить на модерацию`})]})]}):(0,D.jsx)(`p`,{className:`muted`,children:`Сначала проверьте сборку и подключите Chrome. Вход в аккаунт и CAPTCHA выполняются вами в браузере.`}),I.length>1&&(0,D.jsxs)(`details`,{children:[(0,D.jsxs)(`summary`,{children:[`Предыдущие попытки · `,I.length-1]}),I.filter(e=>e.id!==O?.id).map(e=>(0,D.jsxs)(`p`,{children:[new Date(e.createdAt).toLocaleString(`ru-RU`),` · `,j[e.status]]},e.id))]})]})]})]})]})}export{I as YandexGamesView};
|