import{t as T,r as n,j as e,L as g}from"./vendor-react-BwKDLVNL.js";import{d as A,aD as L,v as S,w as E,y as u,x as d,F as x,I as h,z as i,B as o,H as _,K as z,L as B}from"./index-C1ye5P3I.js";import"./vendor-dayjs-5tvLiZdS.js";import{S as c}from"./skeleton-NS0Jk4e5.js";import{M as $,d as D}from"./MarketingShell-pJlumM7K.js";import{k as M,K as C}from"./kbArticlesApi-BgZHE3Wr.js";import{u as b}from"./vendor-i18n-C6wqqoou.js";import{A as R}from"./arrow-left-Em93IgUy.js";import{T as F}from"./tag-Cg6AYULm.js";import"./vendor-query-D-sr233n.js";import"./vendor-sentry-B6ofghpF.js";import"./vendor-antd-core-4y2ghozH.js";import"./zap-Bd320S-h.js";import"./globe-C6LFgqFt.js";import"./shield-check-CUe1YrFZ.js";import"./users-BQu_O3JR.js";import"./file-text-cRwgk8Y4.js";import"./SiteFooter-CMa-vyJL.js";import"./send-BPZS28JS.js";import"./building-2-BaHHBpzk.js";/**
* @license lucide-react v1.16.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],P=A("thumbs-down",I);/**
* @license lucide-react v1.16.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],U=A("thumbs-up",K),k={beginner:{label:"Начальный",color:"bg-green-50 text-green-700 border-green-200"},intermediate:{label:"Средний",color:"bg-blue-50 text-blue-700 border-blue-200"},advanced:{label:"Продвинутый",color:"bg-purple-50 text-purple-700 border-purple-200"}},q={client:"Для клиентов",manager:"Для менеджеров",admin:"Для администраторов",supplier:"Для поставщиков",all:"Для всех"};function O({article:s}){const{t:r}=b();return e.jsxs(u,{gap:2,wrap:!0,children:[e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700",children:[e.jsx(D,{className:"w-3 h-3"}),r(`helpCenter.aiHelp.categories.${s.category}`,C[s.category])]}),s.depth&&e.jsx("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium ${k[s.depth].color}`,children:r(`helpCenter.kbArticle.depth.${s.depth}`,k[s.depth].label)}),s.audience&&s.audience!=="all"&&e.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium bg-indigo-50 text-indigo-700 border-indigo-200",children:r(`helpCenter.kbArticle.audience.${s.audience}`,q[s.audience])}),s.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs text-gray-500 bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700",children:[e.jsx(F,{className:"w-3 h-3"}),t]},t))]})}function Z({article:s}){const{t:r}=b();return e.jsx(g,{to:`/help/article/${s.id}`,className:"block group",children:e.jsxs("div",{className:"rounded-lg border border-border bg-white dark:bg-gray-900 px-3 py-2.5 hover:border-primary/40 hover:bg-primary/5 transition-colors",children:[e.jsx("p",{className:"text-sm font-medium group-hover:text-primary",children:s.title}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:r(`helpCenter.aiHelp.categories.${s.category}`,C[s.category])})]})})}function xe(){const{t:s}=b(),{slug:r=""}=T(),[t,v]=n.useState(null),[j,w]=n.useState([]),[H,y]=n.useState(!0),[N,f]=n.useState(null);return n.useEffect(()=>{y(!0),M.list({}).then(a=>{const l=a.find(p=>p.id===r)??null;if(v(l),l){const p=a.filter(m=>m.id!==l.id&&(m.category===l.category||(l.relatedIds??[]).includes(m.id))).slice(0,4);w(p)}y(!1)})},[r]),e.jsxs($,{children:[e.jsxs(L,{children:[e.jsx("title",{children:t?s("helpCenter.kbArticle.seoTitle","{{title}} — Avalog Help",{title:t.title}):s("helpCenter.kbArticle.seoTitleFallback","Статья — Avalog Help")}),t&&e.jsx("meta",{name:"description",content:t.body.slice(0,160)})]}),e.jsx(S,{py:"lg",bg:"base",children:e.jsxs(E,{size:"2xl",className:"px-4 sm:px-6",children:[e.jsxs(u,{gap:2,align:"center",className:"mb-6 text-sm text-gray-400",children:[e.jsxs(g,{to:"/help",className:"hover:text-primary transition-colors flex items-center gap-1",children:[e.jsx(R,{className:"w-3.5 h-3.5"}),s("helpCenter.kbArticle.breadcrumbHelp","Центр помощи")]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300 truncate max-w-xs",children:t.title})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-2",children:H?e.jsxs(d,{gap:4,children:[e.jsx(c,{className:"h-8 w-3/4"}),e.jsx(c,{className:"h-5 w-full"}),e.jsx(c,{className:"h-5 w-full"}),e.jsx(c,{className:"h-5 w-4/5"}),e.jsx("div",{className:"flex gap-2 mt-2",children:[1,2,3].map(a=>e.jsx(c,{className:"h-6 w-20 rounded-full"},a))})]}):t?e.jsxs(d,{gap:4,children:[e.jsxs("div",{children:[e.jsx(_,{size:"h1",className:"text-2xl font-bold mb-3",children:t.title}),t.updatedAt&&e.jsx(i,{className:"text-xs text-gray-400 mb-4",children:s("helpCenter.kbArticle.updatedAt","Обновлено {{date}}",{date:new Date(t.updatedAt).toLocaleDateString("ru-RU")})}),e.jsx(O,{article:t})]}),e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-line text-gray-700 dark:text-gray-300",children:t.body})}),e.jsx("div",{className:"pt-4 border-t border-border",children:N===null?e.jsxs(u,{gap:3,align:"center",children:[e.jsx(i,{className:"text-sm text-gray-500",children:s("helpCenter.kbArticle.wasHelpful","Статья была полезной?")}),e.jsxs(o,{size:"sm",variant:"outline",onClick:()=>f(!0),className:"gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),s("helpCenter.kbArticle.yes","Да")]}),e.jsxs(o,{size:"sm",variant:"outline",onClick:()=>f(!1),className:"gap-1.5",children:[e.jsx(P,{className:"w-3.5 h-3.5"}),s("helpCenter.kbArticle.no","Нет")]})]}):e.jsx(i,{className:"text-sm text-gray-500",children:N?s("helpCenter.kbArticle.thanksPositive","Спасибо за обратную связь! 👍"):s("helpCenter.kbArticle.thanksNegative","Спасибо. Мы улучшим эту статью.")})})]}):e.jsx(x,{children:e.jsxs(h,{className:"py-12 text-center",children:[e.jsx(i,{variant:"muted",children:s("helpCenter.kbArticle.notFound","Статья не найдена")}),e.jsx(o,{variant:"outline",size:"sm",asChild:!0,className:"mt-4",children:e.jsx(g,{to:"/help",children:s("helpCenter.kbArticle.backToHelp","← Вернуться в центр помощи")})})]})})}),e.jsxs("div",{className:"lg:col-span-1",children:[j.length>0&&e.jsxs(x,{children:[e.jsx(z,{children:e.jsx(B,{className:"text-sm",children:s("helpCenter.kbArticle.related","Похожие статьи")})}),e.jsx(h,{children:e.jsx(d,{gap:2,children:j.map(a=>e.jsx(Z,{article:a},a.id))})})]}),e.jsx(x,{className:"mt-4",children:e.jsx(h,{className:"py-4",children:e.jsxs(d,{gap:2,align:"center",className:"text-center",children:[e.jsx(i,{className:"text-sm font-medium",children:s("helpCenter.kbArticle.noAnswerTitle","Не нашли ответ?")}),e.jsx(o,{size:"sm",variant:"outline",asChild:!0,className:"w-full",children:e.jsx("a",{href:"https://t.me/avalog_support",target:"_blank",rel:"noopener noreferrer",children:s("helpCenter.kbArticle.writeTelegram","Написать в Telegram")})})]})})})]})]})]})})]})}export{xe as default};