(()=>{"use strict";var e,t,n,r={4266(e,t,n){var r=n(5338),i=n(7665),o=n(867),a=n(2893),s=n(2658),l=(n(2796),{token:{colorPrimary:"#1F2937",colorPrimaryHover:"#374151",colorPrimaryActive:"#111827",colorLink:"#1F2937",colorLinkHover:"#374151",colorText:"#1A1A1A",colorTextSecondary:"#6B7280",colorTextTertiary:"#9CA3AF",colorBorder:"#E5E7EB",colorBorderSecondary:"#F3F4F6",colorBgLayout:"#F9FAFB",colorBgContainer:"#FFFFFF",borderRadius:6,borderRadiusLG:12,fontFamily:'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:14,fontSizeHeading1:28,fontSizeHeading2:22,fontSizeHeading3:18,fontWeightStrong:500,controlHeight:36,controlHeightLG:42,paddingContentHorizontal:16},components:{Button:{fontWeight:500,primaryShadow:"none",defaultShadow:"none"},Layout:{headerBg:"#FFFFFF",siderBg:"#F9FAFB",bodyBg:"#F9FAFB",headerHeight:56,headerPadding:"0 24px"},Menu:{itemBg:"transparent",itemSelectedBg:"#F3F4F6",itemSelectedColor:"#1F2937",itemHoverBg:"#F3F4F6",itemHoverColor:"#1F2937",itemHeight:40,iconSize:16},Card:{headerFontSize:16,paddingLG:24},Input:{activeShadow:"0 0 0 2px rgba(31, 41, 55, 0.1)"},Form:{labelColor:"#6B7280",labelFontSize:13,verticalLabelPadding:"0 0 4px"}}}),c=new(n(7865).E)({defaultOptions:{queries:{staleTime:3e4,gcTime:3e5,retry:1,refetchOnWindowFocus:!0},mutations:{retry:0}}}),u=n(4976),d=n(7767),y=n(3041),f=n(677),m=n(7072),h=n(7197),p=n(1468),v=n(327),g=n(1083),x={API_BASE_URL:null!=="https://cabinet.richat.ru/api"?"https://cabinet.richat.ru/api":"http://localhost:8003",APP_NAME:"RiChat",IS_DEV:!1,IS_PROD:!0};function A(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}var j=!1,b=[];function w(e){b.forEach(t=>t(e)),b=[]}var S=g.A.create({baseURL:x.API_BASE_URL,withCredentials:!0,timeout:3e4,headers:{"Content-Type":"application/json"}});S.interceptors.request.use(e=>{var t;return x.IS_DEV&&console.debug("[http]",null===(t=e.method)||void 0===t?void 0:t.toUpperCase(),e.url),e},e=>Promise.reject(e)),S.interceptors.response.use(e=>e,function(){var e,t=(e=function*(e){var t,n,r=e.config;if(!r||401!==(null===(t=e.response)||void 0===t?void 0:t.status)||r._retried)return Promise.reject(e);if(null!==(n=r.url)&&void 0!==n&&n.startsWith("/auth/"))return Promise.reject(e);if(r._retried=!0,j)return new Promise((t,n)=>{b.push(i=>{i?S(r).then(t).catch(n):n(e)})});j=!0;try{return yield S.post("/auth/refresh"),w(!0),S(r)}catch(e){return w(!1),"undefined"==typeof window||window.location.pathname.startsWith("/login")||window.location.assign("/login"),Promise.reject(e)}finally{j=!1}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){A(o,r,i,a,s,"next",e)}function s(e){A(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}());var F=n(3110);function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Что-то пошло не так";if(e instanceof F.pe){if(!e.response)return"ECONNABORTED"===e.code?"Сервер не отвечает. Попробуйте ещё раз.":"Нет связи с сервером. Проверьте подключение.";var n=e.response.data;if(null!=n&&n.detail){var r;if("string"==typeof n.detail)return n.detail;if(Array.isArray(n.detail)&&null!==(r=n.detail[0])&&void 0!==r&&r.msg)return n.detail[0].msg}return"Ошибка ".concat(e.response.status)}return e instanceof Error&&e.message||t}function I(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function k(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){I(o,r,i,a,s,"next",e)}function s(e){I(o,r,i,a,s,"throw",e)}a(void 0)})}}var T=e=>k(function*(){return(yield S.post("/assistants/",e)).data})(),_=(e,t)=>k(function*(){return(yield S.get("/assistants/".concat(e),{params:t?{include:t}:void 0})).data})(),E=(e,t)=>k(function*(){return(yield S.patch("/assistants/".concat(e),t)).data})(),P=e=>k(function*(){yield S.delete("/assistants/".concat(e))})(),B=n(3930),O=n(7097),z=(0,n(1621).vt)(e=>({user:null,isAuthenticated:!1,setUser:t=>e({user:t,isAuthenticated:!!t}),reset:()=>e({user:null,isAuthenticated:!1})})),q=n(6540);function M(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function D(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){M(o,r,i,a,s,"next",e)}function s(e){M(o,r,i,a,s,"throw",e)}a(void 0)})}}var R=()=>D(function*(){return(yield S.get("/user/",{params:{include:"assistants"}})).data})();function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H={all:["user"],me:()=>[...H.all,"me"]};var K={all:["assistants"],detail:e=>[...K.all,"detail",e]},N=n(7308);function W(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Z(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){W(o,r,i,a,s,"next",e)}function s(e){W(o,r,i,a,s,"throw",e)}a(void 0)})}}var Q=e=>Z(function*(){var t=new FormData;return t.append("assistant_id",e.assistant_id),t.append("file",e.file),(yield S.post("/knowledge/upload",t,{headers:{"Content-Type":void 0},timeout:3e5})).data})(),$=(e,t)=>Z(function*(){return(yield S.post("/knowledge/sources/".concat(e,"/confirm"),t)).data})(),V=e=>Z(function*(){return(yield S.get("/knowledge/sources",{params:{assistant_id:e}})).data})(),G=e=>Z(function*(){return(yield S.get("/knowledge/ingestion/".concat(e))).data})(),Y=e=>Z(function*(){yield S.delete("/sources/".concat(e))})(),X=["success","partial_success","fail"],J={all:["sources"],list:e=>[...J.all,"list",e],ingestion:e=>[...J.all,"ingestion",e]};var ee=n(9222),te=n(7618),ne=n(9029),re=n(5039);function ie(e){var t=e.toLocaleString("ru-RU",{minimumFractionDigits:0,maximumFractionDigits:2});return"".concat(t," ₽")}var oe=n(4848),ae=y.A.Text;function se(e){var t,n,r,i,o=e.estimate,a=e.processImages,s=e.onProcessImagesChange,l=a?o.estimated_cost_with_vision_rub:o.estimated_cost_without_vision_rub,c=a?o.estimated_cost_without_vision_rub:o.estimated_cost_with_vision_rub,u=l>o.current_balance_rub,d=o.images_count>0;return(0,oe.jsxs)(f.A,{size:"small",styles:{body:{padding:16}},children:[(0,oe.jsxs)("div",{style:{marginBottom:12},children:[(0,oe.jsx)(ae,{strong:!0,children:null!==(t=o.file_name)&&void 0!==t?t:"Файл"}),(0,oe.jsx)("div",{children:(0,oe.jsxs)(ae,{type:"secondary",style:{fontSize:12},children:[o.page_count," ",(n=o.page_count,r=n%10,i=n%100,i>=11&&i<=14?"страниц":1===r?"страница":r>=2&&r<=4?"страницы":"страниц"),d&&", ".concat(o.images_count," ").concat(le(o.images_count))]})})]}),d&&(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 12px",background:"#F9FAFB",borderRadius:6,marginBottom:12},children:[(0,oe.jsxs)("div",{children:[(0,oe.jsx)("div",{style:{fontSize:13,color:"#1A1A1A"},children:"Обрабатывать картинки"}),(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:11},children:"Vision разберёт изображения в документе"})]}),(0,oe.jsx)(re.A,{checked:a,onChange:s})]}),(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:13},children:"К списанию"}),(0,oe.jsx)(ae,{strong:!0,style:{fontSize:18},children:ie(l)})]}),d&&(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:8},children:[(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:12},children:a?"Без обработки картинок":"С обработкой картинок"}),(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:12},children:ie(c)})]}),(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",paddingTop:8,borderTop:"1px solid #F3F4F6"},children:[(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:12},children:"Баланс"}),(0,oe.jsx)(ae,{type:"secondary",style:{fontSize:12},children:ie(o.current_balance_rub)})]}),u&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Недостаточно средств на балансе",style:{marginTop:12}})]})}function le(e){var t=e%10,n=e%100;return n>=11&&n<=14?"картинок":1===t?"картинка":t>=2&&t<=4?"картинки":"картинок"}function ce(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ue(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ce(o,r,i,a,s,"next",e)}function s(e){ce(o,r,i,a,s,"throw",e)}a(void 0)})}}function de(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nQ(e)}),y=function(e){var t=(0,i.jE)();return(0,O.n)({mutationFn:e=>{var t=e.sourceId,n=e.process_images;return $(t,{process_images:n})},onSuccess:()=>{t.invalidateQueries({queryKey:J.list(e)})}})}(n);(0,q.useEffect)(()=>{t&&(s(null),u(!0),d.reset(),y.reset())},[t]);var f=function(){var e=ue(function*(e){try{var t=yield d.mutateAsync({assistant_id:n,file:e});s(t)}catch(e){}});return function(t){return e.apply(this,arguments)}}(),m=function(){var e=ue(function*(){if(a)try{yield y.mutateAsync({sourceId:a.source_id,process_images:c}),r()}catch(e){}});return function(){return e.apply(this,arguments)}}(),v=d.error?C(d.error):null,g=y.error?C(y.error):null,x=a?c?a.estimated_cost_with_vision_rub:a.estimated_cost_without_vision_rub:0,A=!!a&&x>a.current_balance_rub,j=d.isPending,b=y.isPending;return(0,oe.jsxs)(ee.A,{open:t,title:"Загрузить документ",onCancel:r,destroyOnClose:!0,width:520,footer:a?[(0,oe.jsx)(p.Ay,{onClick:()=>{s(null),d.reset()},disabled:b,children:"Выбрать другой файл"},"back"),(0,oe.jsx)(p.Ay,{type:"primary",onClick:m,loading:b,disabled:A,children:"Подтвердить и обработать"},"confirm")]:[(0,oe.jsx)(p.Ay,{onClick:r,children:"Отмена"},"cancel")],children:[!a&&!j&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(te.A.Dragger,{accept:".pdf,.docx,.pptx,.xlsx,.txt",multiple:!1,showUploadList:!1,beforeUpload:e=>(f(e),!1),disabled:j,children:[(0,oe.jsx)("p",{style:{fontSize:14,marginBottom:8},children:"Перетащите файл сюда или нажмите для выбора"}),(0,oe.jsx)(fe,{type:"secondary",style:{fontSize:12},children:"PDF, DOCX, PPTX, XLSX, TXT — до 100 МБ"})]}),v&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:v,style:{marginTop:12}})]}),j&&(0,oe.jsxs)("div",{style:{textAlign:"center",padding:"40px 0"},children:[(0,oe.jsx)(ne.A,{size:"large"}),(0,oe.jsx)("div",{style:{marginTop:12},children:(0,oe.jsx)(fe,{type:"secondary",children:"Анализируем файл..."})})]}),a&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(se,{estimate:a,processImages:c,onProcessImagesChange:u}),g&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:g,style:{marginTop:12}})]})]})}var he=n(6914),pe=n(6044);function ve(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ge(e){var t=e.sourceId,n=e.sourceName,r=e.assistantId,o=a.A.useApp().message,s=function(e){var t=(0,i.jE)();return(0,O.n)({mutationFn:e=>Y(e),onSuccess:(n,r)=>{t.removeQueries({queryKey:J.ingestion(r)}),t.invalidateQueries({queryKey:J.list(e)})}})}(r),l=function(){var e,r=(e=function*(){try{yield s.mutateAsync(t),o.success(n?"«".concat(n,"» удалён"):"Документ удалён")}catch(e){o.error(C(e))}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ve(o,r,i,a,s,"next",e)}function s(e){ve(o,r,i,a,s,"throw",e)}a(void 0)})});return function(){return r.apply(this,arguments)}}();return(0,oe.jsx)(pe.A,{title:"Удалить документ?",description:"Удалятся также все извлечённые из него фрагменты. Действие необратимо.",okText:"Удалить",cancelText:"Отмена",okButtonProps:{danger:!0,loading:s.isPending},onConfirm:l,placement:"topRight",children:(0,oe.jsx)(p.Ay,{size:"small",type:"text",danger:!0,children:"Удалить"})})}var xe=y.A.Text;function Ae(e){var t,n,r,i,o,a,s=e.source,l=e.assistantId,c=(a="in_queue"===s.status||"in_progress"===s.status||"pending_confirm"===s.status?s.source_id:void 0,(0,B.I)({queryKey:J.ingestion(null!=a?a:""),queryFn:()=>G(a),enabled:!!a,refetchInterval:e=>{var t,n=null===(t=e.state.data)||void 0===t?void 0:t.status;return n?!function(e){return X.includes(e)}(n)&&2e3:2e3},retry:(e,t)=>{var n,r=null===(n=t.response)||void 0===n?void 0:n.status;return 401!==r&&403!==r&&404!==r&&e<2}})).data,u=null!==(t=null==c?void 0:c.status)&&void 0!==t?t:s.status;return(0,oe.jsx)(f.A,{size:"small",styles:{body:{padding:12}},style:{marginBottom:8},children:(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},children:[(0,oe.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,oe.jsx)("div",{style:{fontSize:13,color:"#1A1A1A",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:null!==(n=s.name)&&void 0!==n?n:"Без имени",children:null!==(r=s.name)&&void 0!==r?r:"Без имени"}),(0,oe.jsx)(xe,{type:"secondary",style:{fontSize:11},children:(i=s.created_at,o=new Date(i),o.toLocaleString("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}))})]}),(0,oe.jsx)(je,{status:u}),(0,oe.jsx)(ge,{sourceId:s.source_id,sourceName:s.name,assistantId:l})]})})}function je(e){var t=e.status,n=be[t];return(0,oe.jsx)(he.A,{color:n.color,bordered:!1,style:{fontSize:11,margin:0},children:n.label})}var be={pending_confirm:{label:"Ждёт подтверждения",color:"default"},in_queue:{label:"В очереди",color:"default"},in_progress:{label:"Обработка...",color:"blue"},success:{label:"Готов",color:"success"},partial_success:{label:"Частично",color:"warning"},fail:{label:"Ошибка",color:"error"}};function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nV(e),enabled:!!e,staleTime:1e4})}(r),o=i.data,a=i.isLoading,s=i.error,l=(t=(0,q.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return we(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?we(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=l[0],u=l[1];return(0,oe.jsxs)("div",{children:[(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[(0,oe.jsx)(Se,{type:"secondary",style:{fontSize:13},children:"Документы, на которые опирается ассистент при ответах"}),(0,oe.jsx)(p.Ay,{type:"primary",onClick:()=>u(!0),children:"Загрузить документ"})]}),a&&(0,oe.jsx)(m.A,{active:!0,paragraph:{rows:2}}),s&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Не удалось загрузить список документов",description:C(s)}),o&&0===o.length&&(0,oe.jsx)(N.A,{description:(0,oe.jsx)(Se,{type:"secondary",children:"Пока ни одного документа. Нажмите «Загрузить документ», чтобы начать."})}),o&&o.length>0&&(0,oe.jsx)("div",{children:o.map(e=>(0,oe.jsx)(Ae,{source:e,assistantId:r},e.source_id))}),(0,oe.jsx)(me,{open:c,assistantId:r,onClose:()=>u(!1)})]})}var Ce=n(6552);function Ie(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ke(e){var t,n=e.assistantId,r=e.assistantName,o=(0,d.Zp)(),s=a.A.useApp().message,l=(t=(0,i.jE)(),(0,O.n)({mutationFn:e=>P(e),onSuccess:(e,n)=>{t.removeQueries({queryKey:K.detail(n)}),t.invalidateQueries({queryKey:H.me()})}})),c=function(){var e,t=(e=function*(){try{yield l.mutateAsync(n),s.success("Ассистент «".concat(r,"» удалён")),o("/assistants")}catch(e){s.error(C(e))}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ie(o,r,i,a,s,"next",e)}function s(e){Ie(o,r,i,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,oe.jsx)(pe.A,{title:"Удалить ассистента?",description:"Удалятся также все документы из базы знаний и история тест-чатов. Действие необратимо.",okText:"Удалить",cancelText:"Отмена",okButtonProps:{danger:!0,loading:l.isPending},onConfirm:c,placement:"topRight",children:(0,oe.jsx)(p.Ay,{danger:!0,children:"Удалить ассистента"})})}var Te=n(6003),_e=n(8618);function Ee(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nE(n,e),onSuccess:e=>{r.setQueryData(K.detail(n),e),r.invalidateQueries({queryKey:H.me()})}}));(0,q.useEffect)(()=>{var e;u.setFieldsValue({name:l.name,prompt:null!==(e=l.prompt)&&void 0!==e?e:""})},[l.id,l.name,l.prompt,u]);var y=function(){var e,t=(e=function*(e){var t,n={},r=e.name.trim(),i=e.prompt.trim(),o=null!==(t=l.prompt)&&void 0!==t?t:"";if(r!==l.name&&(n.name=r),i!==o&&(n.prompt=i||null),0!==Object.keys(n).length)try{yield d.mutateAsync(n),c.success("Сохранено")}catch(e){c.error(C(e))}else c.info("Нет изменений")},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ee(o,r,i,a,s,"next",e)}function s(e){Ee(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}();return(0,oe.jsxs)(Te.A,{form:u,layout:"vertical",requiredMark:!1,onFinish:y,initialValues:{name:l.name,prompt:null!==(t=l.prompt)&&void 0!==t?t:""},children:[(0,oe.jsx)(Te.A.Item,{name:"name",label:"Название",rules:[{required:!0,message:"Введите название"},{max:100,message:"Слишком длинное название"}],children:(0,oe.jsx)(_e.A,{size:"large"})}),(0,oe.jsx)(Te.A.Item,{name:"prompt",label:"Инструкция для ассистента",extra:"Оставьте пустым — будет использована стандартная инструкция.",children:(0,oe.jsx)(_e.A.TextArea,{rows:6,maxLength:1e4,showCount:!0})}),(0,oe.jsx)(Te.A.Item,{style:{marginBottom:0},children:(0,oe.jsx)(p.Ay,{type:"primary",htmlType:"submit",loading:d.isPending,children:"Сохранить"})})]})}var Oe=y.A.Title,ze=y.A.Text;function qe(e){var t=e.assistant;return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Be,{assistant:t}),(0,oe.jsx)(Ce.A,{style:{margin:"32px 0 24px"}}),(0,oe.jsx)(Oe,{level:5,style:{marginTop:0,marginBottom:8},children:"Опасная зона"}),(0,oe.jsx)(ze,{type:"secondary",style:{fontSize:13,display:"block",marginBottom:12},children:"Удаление ассистента сотрёт его базу знаний и историю чатов без возможности восстановления."}),(0,oe.jsx)(ke,{assistantId:t.id,assistantName:t.name})]})}function Me(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function De(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Me(o,r,i,a,s,"next",e)}function s(e){Me(o,r,i,a,s,"throw",e)}a(void 0)})}}var Re={createThread:e=>De(function*(){return(yield S.post("/chat/threads",{assistant_id:e})).data})(),listThreads:e=>De(function*(){return(yield S.get("/chat/threads",{params:{assistant_id:e}})).data})(),getMessages(e){var t=arguments;return De(function*(){var n=t.length>1&&void 0!==t[1]?t[1]:100;return(yield S.get("/chat/threads/".concat(e,"/messages"),{params:{limit:n}})).data})()},sendMessage:(e,t)=>De(function*(){return(yield S.post("/chat/threads/".concat(e,"/messages"),{content:t},{timeout:6e4})).data})(),deleteThread:e=>De(function*(){yield S.delete("/chat/threads/".concat(e))})(),getChunksMeta:e=>De(function*(){return 0===e.length?[]:(yield S.get("/knowledge/chunks",{params:{ids:e.join(",")}})).data})()};function Ue(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Le(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ue(o,r,i,a,s,"next",e)}function s(e){Ue(o,r,i,a,s,"throw",e)}a(void 0)})}}var He={all:["chat"],threads:e=>[...He.all,"threads",e],messages:e=>[...He.all,"messages",e],chunksMeta:e=>[...He.all,"chunksMeta",[...e].sort().join(",")]},Ke=n(2977);function Ne(e){var t,n,r,i,o,a=e.chunkIds,s=(t=a,(0,B.I)({queryKey:He.chunksMeta(t),queryFn:(n=Le(function*(){try{return yield Re.getChunksMeta(t)}catch(t){var e;if(404===(null===(e=t.response)||void 0===e?void 0:e.status))return[];throw t}}),function(){return n.apply(this,arguments)}),enabled:t.length>0,staleTime:3e5})),l=s.data;if(0===a.length)return null;if(!l||0===l.length)return(0,oe.jsx)("div",{style:{marginTop:8},children:(0,oe.jsxs)(he.A,{bordered:!1,style:{fontSize:11},children:[a.length," ",(r=a.length,i=r%10,o=r%100,o>=11&&o<=14?"фрагментов":1===i?"фрагмент":i>=2&&i<=4?"фрагмента":"фрагментов")]})});var c=function(e){var t=new Map;for(var n of e){var r=t.get(n.source_id);r?null==n.page_number||r.pages.includes(n.page_number)||r.pages.push(n.page_number):t.set(n.source_id,{sourceId:n.source_id,sourceName:n.source_name,pages:null!=n.page_number?[n.page_number]:[]})}for(var i of t.values())i.pages.sort((e,t)=>e-t);return Array.from(t.values())}(l);return(0,oe.jsx)("div",{style:{marginTop:8,display:"flex",flexWrap:"wrap",gap:6},children:c.map(e=>{var t=e.sourceId,n=e.sourceName,r=e.pages,i=null!=n?n:"Документ",o=r.length>0?"стр. ".concat(r.join(", ")):null,a=o?"".concat(i," · ").concat(o):i;return(0,oe.jsx)(Ke.A,{title:a,children:(0,oe.jsxs)(he.A,{bordered:!1,style:{fontSize:11,maxWidth:240},children:[(0,oe.jsx)("span",{style:{display:"inline-block",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"bottom"},children:i}),o&&(0,oe.jsx)("span",{style:{marginLeft:6,opacity:.6},children:o})]})},t)})})}var We=y.A.Text;function Ze(e){var t,n,r,i=e.message,o="user"===i.role,a=null!==(t=i.retrieved_chunk_ids)&&void 0!==t?t:[];return(0,oe.jsx)("div",{style:{display:"flex",justifyContent:o?"flex-end":"flex-start",marginBottom:12},children:(0,oe.jsxs)("div",{style:{maxWidth:"75%"},children:[(0,oe.jsx)("div",{style:{padding:"10px 14px",borderRadius:12,background:o?"#1F2937":"#F3F4F6",color:o?"#FFFFFF":"#1A1A1A",fontSize:14,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.content}),!o&&a.length>0&&(0,oe.jsx)(Ne,{chunkIds:a}),(0,oe.jsx)(We,{type:"secondary",style:{fontSize:11,marginTop:4,display:"block",textAlign:o?"right":"left"},children:(n=i.created_at,r=new Date(n),r.toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"}))})]})})}function Qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&!i&&!o,d=()=>{u&&(r(c),l(""))};return(0,oe.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end",padding:"12px 16px",borderTop:"1px solid #E5E7EB",background:"#FFFFFF"},children:[(0,oe.jsx)(_e.A.TextArea,{value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())},placeholder:"Напишите сообщение... (Ctrl+Enter — отправить)",autoSize:{minRows:1,maxRows:6},disabled:i,style:{resize:"none"}}),(0,oe.jsx)(p.Ay,{type:"primary",onClick:d,loading:o,disabled:!u,children:"Отправить"})]})}var Ve=y.A.Text;function Ge(e){var t=e.threadId,n=function(e){return(0,B.I)({queryKey:He.messages(null!=e?e:""),queryFn:()=>Re.getMessages(e),enabled:!!e,staleTime:1/0})}(t),r=n.data,o=n.isLoading,a=n.error,s=function(e){var t,n=(0,i.jE)(),r=He.messages(e);return(0,O.n)({mutationFn:t=>{var n=t.content;return Re.sendMessage(e,n)},onMutate:(t=Le(function*(t){var i=t.content;yield n.cancelQueries({queryKey:r});var o=n.getQueryData(r),a={id:"optimistic-".concat(Date.now()),thread_id:e,role:"user",content:i,created_at:(new Date).toISOString(),retrieved_chunk_ids:null,image_ids:null};return n.setQueryData(r,e=>[...null!=e?e:[],a]),{previous:o}}),function(e){return t.apply(this,arguments)}),onError:(e,t,i)=>{null!=i&&i.previous&&n.setQueryData(r,i.previous)},onSuccess:e=>{n.setQueryData(r,t=>t?[...t.filter(e=>!e.id.startsWith("optimistic-")),e]:[e]),n.invalidateQueries({queryKey:r})}})}(t),l=(0,q.useRef)(null);(0,q.useEffect)(()=>{var e;null===(e=l.current)||void 0===e||e.scrollTo({top:l.current.scrollHeight,behavior:"smooth"})},[null==r?void 0:r.length]);var c=s.error?C(s.error):null;return(0,oe.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"60vh",minHeight:400,border:"1px solid #E5E7EB",borderRadius:8,overflow:"hidden",background:"#FFFFFF"},children:[(0,oe.jsxs)("div",{ref:l,style:{flex:1,overflowY:"auto",padding:"16px 16px 4px"},children:[o&&(0,oe.jsx)(m.A,{active:!0,paragraph:{rows:4}}),a&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Не удалось загрузить историю",description:C(a)}),r&&0===r.length&&!s.isPending&&(0,oe.jsx)("div",{style:{textAlign:"center",padding:"40px 0"},children:(0,oe.jsx)(Ve,{type:"secondary",children:"Напишите ассистенту что-нибудь, чтобы проверить как он отвечает."})}),null==r?void 0:r.map(e=>(0,oe.jsx)(Ze,{message:e},e.id)),s.isPending&&(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:12,paddingLeft:14},children:[(0,oe.jsx)(ne.A,{size:"small"}),(0,oe.jsx)(Ve,{type:"secondary",style:{fontSize:13,marginLeft:8},children:"Ассистент думает..."})]}),c&&(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:c,style:{marginBottom:12}})]}),(0,oe.jsx)($e,{onSend:e=>{s.mutate({content:e})},isPending:s.isPending})]})}function Ye(e){var t=e.assistantId,n=function(e){return(0,B.I)({queryKey:He.threads(null!=e?e:""),queryFn:()=>Re.listThreads(e),enabled:!!e,staleTime:3e4})}(t),r=n.data,o=n.isLoading,a=n.error,s=function(e){var t=(0,i.jE)();return(0,O.n)({mutationFn:()=>Re.createThread(e),onSuccess:()=>{t.invalidateQueries({queryKey:He.threads(e)})}})}(t),l=(0,q.useRef)(!1),c=r&&r.length>0?r[0].id:void 0;return(0,q.useEffect)(()=>{o||a||!r||0!==r.length||l.current||(l.current=!0,s.mutate())},[r,o,a,s]),o?(0,oe.jsx)(m.A,{active:!0,paragraph:{rows:4}}):a?(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Не удалось загрузить тред",description:C(a)}):s.error?(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Не удалось создать тред",description:C(s.error)}):c?(0,oe.jsx)(Ge,{threadId:c}):(0,oe.jsx)(m.A,{active:!0,paragraph:{rows:4}})}var Xe=y.A.Title,Je=y.A.Text;function et(){var e,t,n=(0,d.Zp)(),r=(e=(0,d.g)().id,(0,B.I)({queryKey:K.detail(null!=e?e:""),queryFn:()=>_(e,t),enabled:!!e,staleTime:3e4,retry:(e,t)=>{var n,r=null===(n=t.response)||void 0===n?void 0:n.status;return 401!==r&&403!==r&&404!==r&&e<1}})),i=r.data,o=r.isLoading,a=r.error;return o?(0,oe.jsx)(f.A,{children:(0,oe.jsx)(m.A,{active:!0,paragraph:{rows:4}})}):a?(0,oe.jsx)(h.A,{type:"error",showIcon:!0,message:"Не удалось открыть ассистента",description:C(a),action:(0,oe.jsx)(p.Ay,{size:"small",onClick:()=>n("/assistants"),children:"К списку"})}):i?(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Xe,{level:2,style:{marginTop:0,marginBottom:4},children:i.name}),(0,oe.jsx)(Je,{type:"secondary",style:{fontSize:12},children:i.gpt_model}),(0,oe.jsx)(f.A,{style:{marginTop:24},children:(0,oe.jsx)(v.A,{defaultActiveKey:"knowledge",items:[{key:"knowledge",label:"База знаний",children:(0,oe.jsx)(Fe,{assistantId:i.id})},{key:"settings",label:"Настройки",children:(0,oe.jsx)(qe,{assistant:i})},{key:"test-chat",label:"Тест-чат",children:(0,oe.jsx)(Ye,{assistantId:i.id})}]})})]}):null}var tt=n(1983),nt=y.A.Text,rt=[{value:"NONE",title:"Лучшее качество",description:"OpenAI GPT-4o-mini. Понимает картинки в документах, лучше работает со сложными запросами."},{value:"PARTIAL",title:"Российские сервисы, кроме картинок",description:"YandexGPT для текста. Картинки в документах обрабатываются OpenAI Vision."},{value:"FULL",title:"Только российские сервисы",description:"YandexGPT, без обработки картинок. Все данные обрабатываются в РФ."}];function it(e){var t=e.value,n=e.onChange;return(0,oe.jsx)(tt.Ay.Group,{value:t,onChange:e=>null==n?void 0:n(e.target.value),style:{display:"flex",flexDirection:"column",gap:10,width:"100%"},children:rt.map(e=>{var n=t===e.value;return(0,oe.jsx)(tt.Ay,{value:e.value,style:{display:"flex",alignItems:"flex-start",padding:"12px 14px",margin:0,border:"1px solid ".concat(n?"#1F2937":"#E5E7EB"),borderRadius:8,background:n?"#F9FAFB":"#FFFFFF",transition:"border-color 0.15s, background 0.15s"},children:(0,oe.jsxs)("div",{style:{marginLeft:4},children:[(0,oe.jsx)("div",{style:{fontWeight:500,color:"#1A1A1A",marginBottom:2},children:e.title}),(0,oe.jsx)(nt,{type:"secondary",style:{fontSize:12,lineHeight:1.45},children:e.description})]})},e.value)})})}function ot(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nT(e),onSuccess:()=>{t.invalidateQueries({queryKey:H.me()})}}));(0,q.useEffect)(()=>{o&&(l.resetFields(),c.reset())},[o,l]);var u=function(){var e,t=(e=function*(e){var t,n={name:e.name.trim(),localization:e.localization},r=null===(t=e.prompt)||void 0===t?void 0:t.trim();r&&(n.prompt=r);try{var i=yield c.mutateAsync(n);a(),s("/assistants/".concat(i.id))}catch(e){}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ot(o,r,i,a,s,"next",e)}function s(e){ot(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}(),y=c.error?C(c.error):null;return(0,oe.jsx)(ee.A,{open:o,title:"Создать ассистента",onCancel:a,onOk:()=>l.submit(),okText:"Создать",cancelText:"Отмена",confirmLoading:c.isPending,destroyOnClose:!0,width:520,children:(0,oe.jsxs)(Te.A,{form:l,layout:"vertical",requiredMark:!1,onFinish:u,initialValues:st,children:[(0,oe.jsx)(Te.A.Item,{name:"name",label:"Название",rules:[{required:!0,message:"Введите название"},{max:100,message:"Слишком длинное название"}],children:(0,oe.jsx)(_e.A,{size:"large",placeholder:"Например, «Поддержка интернет-магазина»",autoFocus:!0})}),(0,oe.jsx)(Te.A.Item,{name:"localization",label:"Локализация",tooltip:"Где обрабатываются данные ассистента. После создания изменить нельзя.",rules:[{required:!0}],children:(0,oe.jsx)(it,{})}),(0,oe.jsx)(Te.A.Item,{name:"prompt",label:"Инструкция для ассистента (необязательно)",extra:"Если оставить пустым — будет использована стандартная инструкция.",children:(0,oe.jsx)(_e.A.TextArea,{rows:4,placeholder:"Опишите, как ассистент должен общаться и о чём отвечать",maxLength:1e4,showCount:!0})}),y&&(0,oe.jsx)("div",{style:{color:"#DC2626",fontSize:13,marginTop:4},children:y})]})})}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t,n;return null!==(t=null===(n=e.user)||void 0===n?void 0:n.assistants)&&void 0!==t?t:[]}),i=(e=(0,q.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ct(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ct(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];return(0,oe.jsxs)("div",{children:[(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[(0,oe.jsx)(ut,{level:2,style:{margin:0},children:"Ассистенты"}),(0,oe.jsx)(p.Ay,{type:"primary",onClick:()=>a(!0),children:"Создать ассистента"})]}),0===r.length?(0,oe.jsx)(f.A,{children:(0,oe.jsx)(N.A,{description:(0,oe.jsx)(dt,{type:"secondary",children:"Пока ни одного ассистента. Нажмите «Создать ассистента», чтобы начать."})})}):(0,oe.jsx)("div",{style:{display:"grid",gap:16,gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))"},children:r.map(e=>(0,oe.jsxs)(f.A,{hoverable:!0,onClick:()=>n("/assistants/".concat(e.id)),children:[(0,oe.jsx)(ut,{level:5,style:{margin:0,marginBottom:4},children:e.name}),(0,oe.jsx)(dt,{type:"secondary",style:{fontSize:12},children:e.gpt_model})]},e.id))}),(0,oe.jsx)(lt,{open:o,onClose:()=>a(!1)})]})}var ft=y.A.Title,mt=y.A.Text;function ht(){return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(ft,{level:2,style:{marginTop:0},children:"Биллинг"}),(0,oe.jsx)(f.A,{children:(0,oe.jsx)(mt,{type:"secondary",children:"Страница биллинга появится в следующих PR."})})]})}function pt(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){pt(o,r,i,a,s,"next",e)}function s(e){pt(o,r,i,a,s,"throw",e)}a(void 0)})}}var gt={register:e=>vt(function*(){yield S.post("/auth/email/register",e)})(),verify:e=>vt(function*(){return(yield S.post("/auth/email/verify",e)).data})(),login:e=>vt(function*(){return(yield S.post("/auth/email/login",e)).data})(),requestPasswordReset:e=>vt(function*(){yield S.post("/auth/email/password-reset/request",e)})(),confirmPasswordReset:e=>vt(function*(){yield S.post("/auth/email/password-reset/confirm",e)})(),refresh:()=>vt(function*(){return(yield S.post("/auth/refresh")).data})(),logout:()=>vt(function*(){yield S.delete("/auth/")})()};function xt(){return(0,O.n)({mutationFn:gt.register})}function At(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.setUser),t=(0,i.jE)(),(0,O.n)({mutationFn:gt.login,onSuccess:n=>{e(n.user),t.setQueryData(H.me(),n.user)}})),l=function(){var e,t=(e=function*(e){try{yield s.mutateAsync(e),o("/assistants")}catch(e){}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){At(o,r,i,a,s,"next",e)}function s(e){At(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}(),c=s.error?C(s.error):null;return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(bt,{level:3,style:{marginTop:0,marginBottom:4},children:"Вход в кабинет"}),(0,oe.jsx)(wt,{type:"secondary",style:{display:"block",marginBottom:24},children:"Введите email и пароль"}),(0,oe.jsxs)(Te.A,{form:a,layout:"vertical",onFinish:l,requiredMark:!1,autoComplete:"on",children:[(0,oe.jsx)(Te.A.Item,{name:"email",label:"Email",rules:[{required:!0,message:"Введите email"},{type:"email",message:"Некорректный email"}],children:(0,oe.jsx)(_e.A,{size:"large",type:"email",placeholder:"user@example.com",autoFocus:!0})}),(0,oe.jsx)(Te.A.Item,{name:"password",label:"Пароль",rules:[{required:!0,message:"Введите пароль"}],children:(0,oe.jsx)(_e.A.Password,{size:"large",placeholder:"••••••••"})}),c&&(0,oe.jsx)("div",{style:{marginBottom:16,color:"#DC2626",fontSize:13},children:c}),(0,oe.jsx)(p.Ay,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:s.isPending,children:"Войти"}),(0,oe.jsxs)("div",{style:{marginTop:16,display:"flex",justifyContent:"space-between"},children:[(0,oe.jsx)(u.N_,{to:"/forgot-password",children:"Забыли пароль?"}),(0,oe.jsx)(u.N_,{to:"/register",children:"Создать аккаунт"})]})]})]})}function Ft(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.getFieldValue;return{validator:(e,n)=>n&&t("password")!==n?Promise.reject(new Error("Пароли не совпадают")):Promise.resolve()}}],children:(0,oe.jsx)(_e.A.Password,{size:"large",placeholder:"••••••••",autoComplete:"new-password"})}),a&&(0,oe.jsx)("div",{style:{marginBottom:16,color:"#DC2626",fontSize:13},children:a}),(0,oe.jsx)(p.Ay,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:i.isPending,children:"Зарегистрироваться"}),(0,oe.jsxs)("div",{style:{marginTop:16,textAlign:"center"},children:[(0,oe.jsx)(kt,{type:"secondary",children:"Уже есть аккаунт? "}),(0,oe.jsx)(u.N_,{to:"/login",children:"Войти"})]})]})]})}function _t(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Et(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){_t(o,r,i,a,s,"next",e)}function s(e){_t(o,r,i,a,s,"throw",e)}a(void 0)})}}function Pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.setUser),n=(0,i.jE)(),(0,O.n)({mutationFn:gt.verify,onSuccess:e=>{t(e.user),n.setQueryData(H.me(),e.user)}})),l=xt(),c=Pt((0,q.useState)(null),2),y=c[0],f=c[1];if(!o)return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ot,{level:3,style:{marginTop:0},children:"Подтверждение email"}),(0,oe.jsx)(zt,{type:"secondary",style:{display:"block",marginBottom:16},children:"Сначала зарегистрируйтесь."}),(0,oe.jsx)(p.Ay,{type:"primary",size:"large",block:!0,onClick:()=>r("/register"),children:"К регистрации"})]});var m=function(){var e=Et(function*(e){try{yield s.mutateAsync({email:o,code:e.code}),r("/assistants")}catch(e){}});return function(t){return e.apply(this,arguments)}}(),h=function(){var e=Et(function*(){f(null);try{yield l.mutateAsync({email:o,password:"dummy_for_resend_xx"}),f("Код отправлен повторно. Проверьте почту.")}catch(e){f(C(e,"Не удалось отправить код повторно"))}});return function(){return e.apply(this,arguments)}}(),v=s.error?C(s.error):null;return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ot,{level:3,style:{marginTop:0,marginBottom:4},children:"Подтверждение email"}),(0,oe.jsxs)(zt,{type:"secondary",style:{display:"block",marginBottom:24},children:["Мы отправили код на ",(0,oe.jsx)("b",{style:{color:"#1A1A1A"},children:o}),". Введите его ниже."]}),(0,oe.jsxs)(Te.A,{form:a,layout:"vertical",onFinish:m,requiredMark:!1,children:[(0,oe.jsx)(Te.A.Item,{name:"code",label:"Код из письма",rules:[{required:!0,message:"Введите код"},{len:6,message:"Код состоит из 6 цифр"},{pattern:/^\d{6}$/,message:"Только цифры"}],children:(0,oe.jsx)(_e.A,{size:"large",placeholder:"000000",maxLength:6,autoFocus:!0,inputMode:"numeric",style:{letterSpacing:4,fontSize:18,textAlign:"center"}})}),v&&(0,oe.jsx)("div",{style:{marginBottom:16,color:"#DC2626",fontSize:13},children:v}),y&&(0,oe.jsx)("div",{style:{marginBottom:16,color:"#059669",fontSize:13},children:y}),(0,oe.jsx)(p.Ay,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:s.isPending,children:"Подтвердить"}),(0,oe.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,oe.jsx)(p.Ay,{type:"link",onClick:h,loading:l.isPending,style:{padding:0},children:"Отправить код повторно"})}),(0,oe.jsx)("div",{style:{marginTop:8,textAlign:"center"},children:(0,oe.jsx)(u.N_,{to:"/login",children:"Назад ко входу"})})]})]})}function Mt(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);nr("/forgot-password"),children:"Запросить код"})]});var s=function(){var e,t=(e=function*(e){try{yield a.mutateAsync({email:i,code:e.code,new_password:e.new_password}),r("/login",{state:{passwordResetSuccess:!0}})}catch(e){}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ht(o,r,i,a,s,"next",e)}function s(e){Ht(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}(),l=a.error?C(a.error):null;return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Nt,{level:3,style:{marginTop:0,marginBottom:4},children:"Новый пароль"}),(0,oe.jsxs)(Wt,{type:"secondary",style:{display:"block",marginBottom:24},children:["Код отправлен на ",(0,oe.jsx)("b",{style:{color:"#1A1A1A"},children:i}),". Введите его и новый пароль."]}),(0,oe.jsxs)(Te.A,{form:o,layout:"vertical",onFinish:s,requiredMark:!1,children:[(0,oe.jsx)(Te.A.Item,{name:"code",label:"Код из письма",rules:[{required:!0,message:"Введите код"},{len:6,message:"Код состоит из 6 цифр"},{pattern:/^\d{6}$/,message:"Только цифры"}],children:(0,oe.jsx)(_e.A,{size:"large",placeholder:"000000",maxLength:6,autoFocus:!0,inputMode:"numeric",style:{letterSpacing:4,fontSize:18,textAlign:"center"}})}),(0,oe.jsx)(Te.A.Item,{name:"new_password",label:"Новый пароль",rules:[{required:!0,message:"Придумайте пароль"},{min:8,message:"Минимум 8 символов"},{max:128,message:"Максимум 128 символов"}],children:(0,oe.jsx)(_e.A.Password,{size:"large",placeholder:"••••••••",autoComplete:"new-password"})}),(0,oe.jsx)(Te.A.Item,{name:"passwordConfirm",label:"Повторите пароль",dependencies:["new_password"],rules:[{required:!0,message:"Повторите пароль"},e=>{var t=e.getFieldValue;return{validator:(e,n)=>n&&t("new_password")!==n?Promise.reject(new Error("Пароли не совпадают")):Promise.resolve()}}],children:(0,oe.jsx)(_e.A.Password,{size:"large",placeholder:"••••••••",autoComplete:"new-password"})}),l&&(0,oe.jsx)("div",{style:{marginBottom:16,color:"#DC2626",fontSize:13},children:l}),(0,oe.jsx)(p.Ay,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:a.isPending,children:"Сменить пароль"}),(0,oe.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,oe.jsx)(u.N_,{to:"/login",children:"Назад ко входу"})})]})]})}function Qt(e){var t=e.width,n=void 0===t?120:t,r=e.color,i=void 0===r?"#1F2937":r,o=n/4.8;return(0,oe.jsx)("svg",{width:n,height:o,viewBox:"35 118 230 50",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"RiChat",children:(0,oe.jsxs)("g",{fill:i,children:[(0,oe.jsx)("path",{d:"M45.01,123.65h23.32c3.33,0,6.4,1.54,9.2,4.62,1.66,2.35,2.49,4.55,2.49,6.61v1.58c0,3.13-1.58,6.07-4.75,8.81-1.93,1.22-3.47,1.92-4.62,2.12v.05c4.04,3.53,6.7,5.98,7.97,7.36.56.93.85,1.82.85,2.66,0,2.02-1.15,3.54-3.44,4.54-.46.11-.79.16-1.01.16h-1.09c-1.27,0-2.96-1.11-5.05-3.33-.73-.59-4.86-4.31-12.4-11.15h-6.23v9.86c0,2.09-1.23,3.61-3.69,4.54-.27.05-.5.08-.68.08h-1.09c-1.66,0-3.01-.98-4.07-2.95-.2-.52-.3-.98-.3-1.37v-29.7c0-1.95,1.17-3.39,3.5-4.32.4-.11.76-.16,1.09-.16ZM50.25,133.21v5h17.44c1.38,0,2.5-1.12,2.5-2.5h0c0-1.38-1.12-2.5-2.5-2.5h-17.44Z"}),(0,oe.jsx)("path",{d:"M87.47,123.65h.74c1.67,0,3.07.91,4.18,2.74.31.59.46,1.3.46,2.12v29.03c0,2.09-1.26,3.61-3.77,4.54-.29.05-.53.08-.71.08h-1.12c-1.71,0-3.1-.98-4.18-2.95-.22-.52-.33-.98-.33-1.37v-29.7c0-1.95,1.2-3.39,3.6-4.32.4-.11.77-.16,1.12-.16Z"}),(0,oe.jsx)("path",{d:"M114.57,123.65h15.65c1.66,0,3.04.96,4.15,2.87.2.59.3,1.05.3,1.37v1.07c0,1.54-.98,2.83-2.95,3.87-.64.25-1.24.38-1.8.38h-13.16c-5.21,0-8.96,2.15-11.25,6.45-.4,1.18-.6,2.32-.6,3.41,0,3.49,2.02,6.29,6.06,8.41,1.79.75,3.51,1.13,5.16,1.13h13.33c2.55,0,4.26,1.19,5.13,3.57l.08.75v1.07c0,1.49-.94,2.75-2.81,3.79-.53.25-1.02.38-1.48.38h-16.3c-4.28,0-8.48-1.69-12.62-5.08-2.35-2.34-3.78-4.19-4.29-5.53-1.4-2.74-2.1-5.37-2.1-7.9v-1.42c0-4.58,1.95-8.91,5.84-12.97,4.19-3.74,8.74-5.61,13.65-5.61Z"}),(0,oe.jsx)("path",{d:"M141.09,123.65h.71c1.62,0,2.98.91,4.07,2.74.31.59.46,1.3.46,2.12v9.61h19.94v-9.32c0-2.58,1.27-4.27,3.82-5.08.36-.05.66-.08.87-.08h.68c1.67,0,3.06.96,4.15,2.87.2.59.3,1.05.3,1.37v30.1c0,1.49-.94,2.75-2.81,3.79-.53.25-1.02.38-1.48.38h-1.09c-1.73,0-3.1-1.04-4.12-3.12-.22-.63-.33-1.31-.33-2.04v-9.32h-19.94v9.86c0,2.09-1.23,3.61-3.69,4.54-.27.05-.5.08-.68.08h-1.09c-1.66,0-3.01-.98-4.07-2.95-.2-.52-.3-.98-.3-1.37v-29.7c0-1.95,1.17-3.39,3.5-4.32.4-.11.76-.16,1.09-.16Z"}),(0,oe.jsx)("path",{d:"M197.89,123.65h.85c2.02,0,3.65,1.58,4.89,4.75,9.34,18.1,14.15,27.51,14.42,28.23v1.45c0,1.63-1.09,2.94-3.28,3.92-.47.11-.86.16-1.15.16h-.71c-2.04,0-3.69-1.64-4.94-4.92-6.43-12.5-9.69-18.78-9.78-18.85-7.19,14.22-10.99,21.61-11.39,22.18-1.07,1.06-2.18,1.58-3.33,1.58h-.68c-1.66,0-3.02-.98-4.1-2.95-.16-.57-.25-1.03-.25-1.37v-.59c0-.72.93-2.78,2.79-6.2l13.16-25.57c1.04-1.22,2.2-1.83,3.5-1.83Z"}),(0,oe.jsx)("path",{d:"M224.57,123.65h30.56c1.67,0,3.06.96,4.15,2.87.2.59.3,1.05.3,1.37v1.07c0,1.54-.98,2.83-2.95,3.87-.64.25-1.24.38-1.8.38h-10.13v24.46c0,1.99-1.19,3.46-3.58,4.4l-.79.08h-1.09c-1.58,0-2.91-.96-3.99-2.87-.25-.63-.38-1.21-.38-1.75v-24.33h-9.89c-2.31,0-3.92-1.14-4.83-3.41-.11-.47-.16-.8-.16-.99v-.67c0-1.95,1.17-3.39,3.5-4.32.4-.11.76-.16,1.09-.16Z"})]})})}function $t(e){var t=e.children;return(0,oe.jsxs)("div",{style:{minHeight:"100vh",background:"#F9FAFB",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px 16px"},children:[(0,oe.jsx)(u.N_,{to:"/",style:{marginBottom:32},children:(0,oe.jsx)(Qt,{width:140})}),(0,oe.jsx)(f.A,{style:{width:"100%",maxWidth:400,boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},styles:{body:{padding:"32px 28px"}},children:t}),(0,oe.jsx)("div",{style:{marginTop:24,color:"#9CA3AF",fontSize:12},children:"© RiChat · Конструктор ИИ-ассистентов"})]})}function Vt(){return(0,oe.jsx)($t,{children:(0,oe.jsx)(Lt,{})})}function Gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(o){var e=setTimeout(()=>a(!1),8e3);return()=>clearTimeout(e)}},[o]),(0,oe.jsxs)($t,{children:[o&&(0,oe.jsx)(h.A,{type:"success",message:"Пароль успешно изменён. Войдите с новым паролем.",showIcon:!0,style:{marginBottom:16},closable:!0,onClose:()=>a(!1)}),(0,oe.jsx)(St,{})]})}var Xt=n(1568);function Jt(){var e=(0,d.Zp)();return(0,oe.jsx)(Xt.Ay,{status:"404",title:"404",subTitle:"Страница не найдена",extra:(0,oe.jsx)(p.Ay,{type:"primary",onClick:()=>e("/"),children:"На главную"})})}function en(){return(0,oe.jsx)($t,{children:(0,oe.jsx)(Tt,{})})}function tn(){return(0,oe.jsx)($t,{children:(0,oe.jsx)(Zt,{})})}var nn=y.A.Title,rn=y.A.Text;function on(){var e,t=z(e=>e.user);return(0,oe.jsxs)("div",{children:[(0,oe.jsx)(nn,{level:2,style:{marginTop:0},children:"Настройки"}),(0,oe.jsxs)(f.A,{children:[(0,oe.jsx)(rn,{type:"secondary",children:"ID юзера: "}),(0,oe.jsx)(rn,{code:!0,children:null!==(e=null==t?void 0:t.id)&&void 0!==e?e:"—"}),(0,oe.jsx)("br",{}),(0,oe.jsx)(rn,{type:"secondary",children:"Дата регистрации: "}),(0,oe.jsx)(rn,{children:null!=t&&t.joined_at?new Date(t.joined_at).toLocaleDateString("ru-RU"):"—"})]})]})}function an(){return(0,oe.jsx)($t,{children:(0,oe.jsx)(qt,{})})}var sn=n(5448),ln=n(7206),cn=n(3032),un=n(1427);function dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t,n;return null!==(t=null===(n=e.user)||void 0===n?void 0:n.assistants)&&void 0!==t?t:[]}),o=(e=(0,q.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1];return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("div",{style:{padding:"0 12px",marginTop:8},children:[(0,oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 8px 4px"},children:[(0,oe.jsx)(yn,{type:"secondary",style:{fontSize:11,letterSpacing:.5},children:"АССИСТЕНТЫ"}),(0,oe.jsx)(p.Ay,{type:"text",size:"small",onClick:()=>s(!0),style:{fontSize:18,lineHeight:1,padding:"0 6px",color:"#6B7280"},"aria-label":"Создать ассистента",title:"Создать ассистента",children:"+"})]}),0===i.length?(0,oe.jsx)(yn,{type:"secondary",style:{fontSize:12,padding:"4px 8px",display:"block"},children:"Пока ни одного"}):(0,oe.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:i.map(e=>{var t=e.id===r;return(0,oe.jsx)("button",{type:"button",onClick:()=>n("/assistants/".concat(e.id)),title:e.name,style:{background:t?"#F3F4F6":"transparent",border:"none",textAlign:"left",padding:"8px 12px",borderRadius:6,cursor:"pointer",color:t?"#1F2937":"#1A1A1A",fontSize:13,fontWeight:t?500:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onMouseEnter:e=>{t||(e.currentTarget.style.background="#F9FAFB")},onMouseLeave:e=>{t||(e.currentTarget.style.background="transparent")},children:e.name},e.id)})})]}),(0,oe.jsx)(lt,{open:a,onClose:()=>s(!1)})]})}function mn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}var hn=sn.A.Sider,pn=sn.A.Header,vn=sn.A.Content;function gn(){var e,t,n,r,o,a,s,l=(0,d.Zp)(),c=(0,d.zy)(),u=z(e=>e.user),y=(a=z(e=>e.reset),s=(0,i.jE)(),(0,O.n)({mutationFn:gt.logout,onSettled:()=>{a(),s.clear()}})),f=function(){var e,t=(e=function*(){try{yield y.mutateAsync()}finally{l("/login")}},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){mn(o,r,i,a,s,"next",e)}function s(e){mn(o,r,i,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),m=c.pathname.startsWith("/assistants")?"assistants":c.pathname.startsWith("/billing")?"billing":c.pathname.startsWith("/settings")?"settings":"assistants",h=[{key:"assistants",label:"Ассистенты",onClick:()=>l("/assistants")},{key:"billing",label:"Биллинг",onClick:()=>l("/billing")},{key:"settings",label:"Настройки",onClick:()=>l("/settings")}],v=[{key:"logout",label:"Выйти",onClick:f}],g=null!==(e=null!==(t=null==u||null===(n=u.tg_account)||void 0===n?void 0:n.name)&&void 0!==t?t:null==u?void 0:u.email)&&void 0!==e?e:"Профиль",x=null!==(r=null===(o=g[0])||void 0===o?void 0:o.toUpperCase())&&void 0!==r?r:"У";return(0,oe.jsxs)(sn.A,{style:{minHeight:"100vh"},children:[(0,oe.jsxs)(hn,{width:240,style:{background:"#FFFFFF",borderRight:"1px solid #E5E7EB"},children:[(0,oe.jsx)("div",{style:{padding:"20px 20px 16px",borderBottom:"1px solid #F3F4F6",display:"flex",alignItems:"center"},children:(0,oe.jsx)(Qt,{width:110})}),(0,oe.jsx)(ln.A,{mode:"inline",selectedKeys:[m],items:h,style:{borderInlineEnd:"none",padding:"12px 8px"}}),(0,oe.jsx)(fn,{})]}),(0,oe.jsxs)(sn.A,{children:[(0,oe.jsx)(pn,{style:{background:"#FFFFFF",borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"0 24px"},children:(0,oe.jsx)(cn.A,{menu:{items:v},placement:"bottomRight",children:(0,oe.jsxs)(p.Ay,{type:"text",style:{display:"flex",alignItems:"center",gap:8},children:[(0,oe.jsx)(un.A,{size:28,style:{background:"#1F2937",fontSize:13},children:x}),(0,oe.jsx)("span",{style:{color:"#1A1A1A",fontWeight:500},children:g})]})})}),(0,oe.jsx)(vn,{style:{padding:24,background:"#F9FAFB"},children:(0,oe.jsx)(d.sv,{})})]})]})}function xn(e){var t=e.children,n=(0,d.zy)(),r=z(e=>e.user),i=function(e){var t=z(e=>e.setUser),n=(0,B.I)(function(e){for(var t=1;tR(),staleTime:6e4,retry:(e,t)=>{var n,r=null===(n=t.response)||void 0===n?void 0:n.status;return 401!==r&&403!==r&&e<1}},e));return(0,q.useEffect)(()=>{n.data&&t(n.data)},[n.data,t]),n}({enabled:!r});return r?(0,oe.jsx)(oe.Fragment,{children:t}):i.isLoading?(0,oe.jsx)("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,oe.jsx)(ne.A,{size:"large"})}):(0,oe.jsx)(d.C5,{to:"/login",replace:!0,state:{from:n.pathname}})}function An(e){var t=e.children;return z(e=>e.user)?(0,oe.jsx)(d.C5,{to:"/assistants",replace:!0}):(0,oe.jsx)(oe.Fragment,{children:t})}function jn(){return(0,oe.jsx)(u.Kd,{children:(0,oe.jsxs)(d.BV,{children:[(0,oe.jsx)(d.qh,{path:"/login",element:(0,oe.jsx)(An,{children:(0,oe.jsx)(Yt,{})})}),(0,oe.jsx)(d.qh,{path:"/register",element:(0,oe.jsx)(An,{children:(0,oe.jsx)(en,{})})}),(0,oe.jsx)(d.qh,{path:"/verify-email",element:(0,oe.jsx)(An,{children:(0,oe.jsx)(an,{})})}),(0,oe.jsx)(d.qh,{path:"/forgot-password",element:(0,oe.jsx)(An,{children:(0,oe.jsx)(Vt,{})})}),(0,oe.jsx)(d.qh,{path:"/reset-password",element:(0,oe.jsx)(An,{children:(0,oe.jsx)(tn,{})})}),(0,oe.jsxs)(d.qh,{element:(0,oe.jsx)(xn,{children:(0,oe.jsx)(gn,{})}),children:[(0,oe.jsx)(d.qh,{index:!0,element:(0,oe.jsx)(d.C5,{to:"/assistants",replace:!0})}),(0,oe.jsx)(d.qh,{path:"/assistants",element:(0,oe.jsx)(yt,{})}),(0,oe.jsx)(d.qh,{path:"/assistants/:id",element:(0,oe.jsx)(et,{})}),(0,oe.jsx)(d.qh,{path:"/billing",element:(0,oe.jsx)(ht,{})}),(0,oe.jsx)(d.qh,{path:"/settings",element:(0,oe.jsx)(on,{})})]}),(0,oe.jsx)(d.qh,{path:"*",element:(0,oe.jsx)(Jt,{})})]})})}var bn=n(5072),wn=n.n(bn),Sn=n(7825),Fn=n.n(Sn),Cn=n(7659),In=n.n(Cn),kn=n(5056),Tn=n.n(kn),_n=n(540),En=n.n(_n),Pn=n(1113),Bn=n.n(Pn),On=n(9158),zn={};function qn(){return(0,oe.jsxs)(i.Ht,{client:c,children:[(0,oe.jsx)(o.Ay,{theme:l,locale:s.A,children:(0,oe.jsx)(a.A,{children:(0,oe.jsx)(jn,{})})}),!1]})}zn.styleTagTransform=Bn(),zn.setAttributes=Tn(),zn.insert=In().bind(null,"head"),zn.domAPI=Fn(),zn.insertStyleElement=En(),wn()(On.A,zn),On.A&&On.A.locals&&On.A.locals;var Mn=document.getElementById("root");if(!Mn)throw new Error("Root element #root not found in index.html");(0,r.H)(Mn).render((0,oe.jsx)(qn,{}))},9158(e,t,n){n.d(t,{A:()=>s});var r=n(1354),i=n.n(r),o=n(6314),a=n.n(o)()(i());a.push([e.id,"/* Глобальные стили — минимум, всё остальное через AntD theme. */\n\n* {\n box-sizing: border-box;\n}\n\nhtml,\nbody,\n#root {\n margin: 0;\n padding: 0;\n height: 100%;\n}\n\nbody {\n font-family:\n 'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: #f9fafb;\n color: #1a1a1a;\n}\n\na {\n color: #1f2937;\n text-decoration: none;\n transition: color 0.15s ease;\n}\n\na:hover {\n color: #374151;\n text-decoration: underline;\n}\n\n/* Скроллбары — тонкие и светло-серые */\n::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n::-webkit-scrollbar-track {\n background: transparent;\n}\n::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 4px;\n}\n::-webkit-scrollbar-thumb:hover {\n background: #9ca3af;\n}\n","",{version:3,sources:["webpack://./src/app/styles.css"],names:[],mappings:"AAAA,gEAAgE;;AAEhE;EACE,sBAAsB;AACxB;;AAEA;;;EAGE,SAAS;EACT,UAAU;EACV,YAAY;AACd;;AAEA;EACE;;;;;;cAMY;EACZ,mCAAmC;EACnC,kCAAkC;EAClC,mBAAmB;EACnB,cAAc;AAChB;;AAEA;EACE,cAAc;EACd,qBAAqB;EACrB,4BAA4B;AAC9B;;AAEA;EACE,cAAc;EACd,0BAA0B;AAC5B;;AAEA,uCAAuC;AACvC;EACE,UAAU;EACV,WAAW;AACb;AACA;EACE,uBAAuB;AACzB;AACA;EACE,mBAAmB;EACnB,kBAAkB;AACpB;AACA;EACE,mBAAmB;AACrB",sourcesContent:["/* Глобальные стили — минимум, всё остальное через AntD theme. */\n\n* {\n box-sizing: border-box;\n}\n\nhtml,\nbody,\n#root {\n margin: 0;\n padding: 0;\n height: 100%;\n}\n\nbody {\n font-family:\n 'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: #f9fafb;\n color: #1a1a1a;\n}\n\na {\n color: #1f2937;\n text-decoration: none;\n transition: color 0.15s ease;\n}\n\na:hover {\n color: #374151;\n text-decoration: underline;\n}\n\n/* Скроллбары — тонкие и светло-серые */\n::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n::-webkit-scrollbar-track {\n background: transparent;\n}\n::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 4px;\n}\n::-webkit-scrollbar-thumb:hover {\n background: #9ca3af;\n}\n"],sourceRoot:""}]);const s=a}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,exports:{}};return r[e].call(n.exports,n,n.exports,o),n.exports}o.m=r,e=[],o.O=(t,n,r,i)=>{if(!n){var a=1/0;for(u=0;u=i)&&Object.keys(o.O).every(e=>o.O[e](n[l]))?n.splice(l--,1):(s=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var i=Object.create(null);o.r(i);var a={};t=t||[null,n({}),n([]),n(n)];for(var s=2&r&&e;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,o.d(i,a),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={792:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[a,s,l]=n,c=0;if(a.some(t=>0!==e[t])){for(r in s)o.o(s,r)&&(o.m[r]=s[r]);if(l)var u=l(o)}for(t&&t(n);co(4266));a=o.O(a)})(); //# sourceMappingURL=main.fa5edb1e.js.map