1import{fl as P,ao as q,O as D,r as o,cM as f,mz as N,j as l,ea as h,bT as v,e9 as C}from"./index-B79jx0QH.js";import{D as K,T as O}from"./hocuspocus-provider.esm-CiBI0lSK.js";import{q as Q,s as V,t as z}from"./knowledgeBase-CpxB7tpC.js";import{u as B}from"./useQueryError-BprBq0Eh.js";import{u as F}from"./useTipTapEmojis-X7ItjBtc.js";import"./index-DNi9bZVg.js";import"./get-hvE2u49Z.js";import"./_stringToPath-CT2uNAC1.js";import"./toString-CXzKODmQ.js";import"./_baseToString-BHVwc-td.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="4e3d4c72-d205-4832-bd9a-36a805732d18",t._sentryDebugIdIdentifier="sentry-dbid-4e3d4c72-d205-4832-bd9a-36a805732d18")}catch{}})();const $=()=>{var y,b,g,_,k;const{articleId:t}=P(),{state:n}=q(),d=D(),e=n==null?void 0:n.article,[a,T]=o.useState(),[s,m]=o.useState(),{data:r,error:A,isError:E,isLoading:j}=f({queryKey:["kb-article",t],queryFn:()=>Q({articleId:t}),enabled:!!t&&!(e!=null&&e._id)}),{data:w}=f({queryKey:["kb-article-stats",t],queryFn:()=>V({articleId:t,timeRange:"last_7_days"}),enabled:!!t&&!(e!=null&&e._id)}),{data:I}=f({queryKey:["kb-article-feedback-stats",t],queryFn:()=>z({articleId:t,timeRange:"last_7_days"}),enabled:!!t&&!(e!=null&&e._id)});B(A,"ERROR_FETCHING_ARTICLE");const p=o.useRef(new K);o.useEffect(()=>{e?m(e):r&&m(r.data.data)},[e,r]);const i=e?e.editorArticleName:(b=(y=r==null?void 0:r.data)==null?void 0:y.data)==null?void 0:b.editorArticleName,u=e?e.jwtSignedToken:(_=(g=r==null?void 0:r.data)==null?void 0:g.data)==null?void 0:_.jwtSignedToken;o.useEffect(()=>{if(i&&u){const x=new O({name:i,appId:N,token:u,document:p.current,preserveConnection:!1,user:d._id});T(c=>(c&&(c.disconnect(),c.destroy()),x))}},[i,u,d._id]),o.useEffect(()=>()=>{a&&(a.disconnect(),a.destroy())},[a]);const{emojis:R,isLoading:S}=F();return t?j||S?l.jsx(v,{}):!a||E?null:l.jsx(C,{context:{doc:p.current,emojis:R,provider:a,article:s,documentName:s==null?void 0:s.editorArticleName,token:s==null?void 0:s.jwtSignedToken,aiToken:s==null?void 0:s.aiToken,publishedVersion:(k=s==null?void 0:s.publishedVersion)==null?void 0:k.version,articleStats:w,articleFeedbackStats:I}}):l.jsx(h,{to:"/helpcenters/articles/all",replace:!0})};export{$ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.