1import{c as ae,r as $,j as i,b as me,H as de}from"./app-CctC73JC.js";import{A as ce}from"./article-form-DuVVSaxN.js";import{V as pe}from"./version-rail-CcoNsAjO.js";import{B as z}from"./button-CpuRyrDe.js";import{D as ue,a as fe,b as he,c as ge,d as _e,e as be}from"./dialog-Fp3NhzCC.js";import{b as ve,u as xe,g as ye,A as je}from"./app-layout-VH0XM7-O.js";import{T as we}from"./index-CJmBjYr-.js";/* empty css */import"./index-BWn-eN01.js";import"./document-editor-layout-yEhWaMhh.js";import"./createLucideIcon-CVF_mdwF.js";import"./rich-text-editor-Bweq3YFH.js";import"./index-Df4rGnCV.js";import"./index-C4FSPbsl.js";import"./with-selector-D-vOL35-.js";import"./utils-Bk3hkyGf.js";import"./index-BZy3hN9T.js";import"./index-BJA_CV-8.js";import"./index--z1qdwuo.js";import"./index-B0zZWnbD.js";import"./input-C9p7qAKQ.js";import"./index-CO7hdrxo.js";import"./index-BFDfCY-I.js";import"./check-gnqw2RCn.js";import"./x-BXb1ar1N.js";import"./spinner-WyPdsmR2.js";import"./loader-circle-JRm5_GsX.js";import"./plus-DXCarZfj.js";import"./label-BpftPcD0.js";import"./index-DCWlsYaN.js";import"./checkbox-CfTkoF2_.js";import"./index-CUUoIl5B.js";import"./index-CZjaRKkf.js";import"./select-mk149urv.js";import"./chevron-down-CZyu_sKp.js";import"./separator-DCi_GnP0.js";import"./copy-C6R6zVou.js";import"./index-Dag5ztfA.js";import"./badge-CGhtX30c.js";import"./upload-NXWnwL0O.js";import"./arrow-up-i2YRqWC1.js";import"./arrow-down-CcrftXdT.js";import"./list-checks-YbSvRfof.js";import"./minus-CLXANN-T.js";import"./pencil-B9IQszWh.js";import"./arrow-right-CG11107R.js";import"./input-error-DcSGA3Yl.js";import"./sparkles-BmOQJihs.js";import"./card-nLe6lPQR.js";import"./article-status-badge-yKruf4qX.js";import"./duration-mVqOt4E8.js";import"./eye-CJEyCNim.js";import"./date-XbsfC_ni.js";import"./flash-toaster-GfKa6l_n.js";import"./index-Ba8OW6IL.js";import"./use-current-url-DvLHY0Cc.js";import"./use-initials-C3ZspGUh.js";import"./index-eIYmd7L3.js";import"./index-BhgVjuNu.js";import"./index-DyYE4xxu.js";import"./index-RfzaMjoS.js";import"./app-logo-icon-Cal9jFFS.js";import"./search-B9DzGAlm.js";function Nt(oe){const e=ae.c(78),{article:t,categories:B,members:F,reviewIntervals:H,versions:r,canApprove:S}=oe,[o,re]=$.useState(null),[K,se]=$.useState(!1),[l,le]=$.useState(null),[M,k]=$.useState(!1);let D;e[0]!==o||e[1]!==r?(D=r.find(j=>j.id===o)??null,e[0]=o,e[1]=r,e[2]=D):D=e[2];const s=D,L=!S&&t.status==="published";let A;e[3]!==l||e[4]!==r?(A=r.find(j=>j.id===l)??null,e[3]=l,e[4]=r,e[5]=A):A=e[5];const w=A;let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C={title:"Knowledge base",href:ve().url},e[6]=C):C=e[6];let E;e[7]!==t.title?(E=[C,{title:t.title,href:"#"}],e[7]=t.title,e[8]=E):E=e[8];const P=E;let V;e[9]!==t.id?(V=function(){confirm("Delete this article?")&&me.delete(ye.url(t.id))},e[9]=t.id,e[10]=V):V=e[10];const Y=V;let I;e[11]!==K||e[12]!==o?(I=function(ie){if(ie!==o){if(K){le(ie),k(!0);return}re(ie)}},e[11]=K,e[12]=o,e[13]=I):I=e[13];const n=I;let N;e[14]!==l?(N=function(){re(l),k(!1)},e[14]=l,e[15]=N):N=e[15];const G=N,J=`Edit ${t.title}`;let a;e[16]!==J?(a=i.jsx(de,{title:J}),e[16]=J,e[17]=a):a=e[17];const Q=s?.id??"current",U=s?.title??t.title,W=s?s.content:t.content,X=L?"pending_approval":t.status;let m;e[18]!==t.category_id||e[19]!==t.estimated_minutes_override||e[20]!==t.owner_id||e[21]!==t.requires_acknowledgement||e[22]!==t.review_interval||e[23]!==U||e[24]!==W||e[25]!==X?(m={title:U,category_id:t.category_id,owner_id:t.owner_id,content:W,status:X,requires_acknowledgement:t.requires_acknowledgement,estimated_minutes_override:t.estimated_minutes_override,review_interval:t.review_interval,notify_team:!0},e[18]=t.category_id,e[19]=t.estimated_minutes_override,e[20]=t.owner_id,e[21]=t.requires_acknowledgement,e[22]=t.review_interval,e[23]=U,e[24]=W,e[25]=X,e[26]=m):m=e[26];const ne=t.estimated_minutes;let d;e[27]!==t.id?(d=xe.url(t.id),e[27]=t.id,e[28]=d):d=e[28];let c;e[29]!==d?(c={url:d,method:"put"},e[29]=d,e[30]=c):c=e[30];let q;e[31]===Symbol.for("react.memo_cache_sentinel")?(q=i.jsx(we,{className:"size-4"}),e[31]=q):q=e[31];let p;e[32]!==Y?(p=i.jsx(z,{type:"button",variant:"ghost",size:"icon",onClick:Y,"aria-label":"Delete article",children:q}),e[32]=Y,e[33]=p):p=e[33];let u;e[34]!==L?(u=L&&i.jsx("div",{className:"rounded-md border border-l-2 border-l-primary bg-muted/50 px-3 py-2 text-sm","data-test":"approval-notice",children:"Saving sends this article back for approval. It stays hidden from members until someone approves it again."}),e[34]=L,e[35]=u):u=e[35];let f;e[36]!==s||e[37]!==n?(f=s&&i.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 rounded-md border border-l-2 border-l-primary bg-muted/50 px-3 py-2 text-sm","data-test":"version-load-banner",children:[i.jsxs("span",{children:["You are editing from Version"," ",s.version,". Saving will make it the current article."]}),i.jsx(z,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),"data-test":"back-to-latest-button",children:"Back to latest"})]}),e[36]=s,e[37]=n,e[38]=f):f=e[38];let h;e[39]!==u||e[40]!==f?(h=i.jsxs(i.Fragment,{children:[u,f]}),e[39]=u,e[40]=f,e[41]=h):h=e[41];let g;e[42]!==t||e[43]!==o||e[44]!==n||e[45]!==r?(g=i.jsx(pe,{article:t,ver
1sions:r,selectedId:o,onSelect:n}),e[42]=t,e[43]=o,e[44]=n,e[45]=r,e[46]=g):g=e[46];let _;e[47]!==t.estimated_minutes||e[48]!==S||e[49]!==B||e[50]!==F||e[51]!==H||e[52]!==Q||e[53]!==m||e[54]!==c||e[55]!==p||e[56]!==h||e[57]!==g?(_=i.jsx("div",{className:"p-4 py-8",children:i.jsx(ce,{initial:m,autoEstimateMinutes:ne,categories:B,members:F,reviewIntervals:H,action:c,submitLabel:"Save",canApprove:S,withNotifyTeam:!0,onDirtyChange:se,toolbarExtra:p,notice:h,panelExtra:g},Q)}),e[47]=t.estimated_minutes,e[48]=S,e[49]=B,e[50]=F,e[51]=H,e[52]=Q,e[53]=m,e[54]=c,e[55]=p,e[56]=h,e[57]=g,e[58]=_):_=e[58];let O;e[59]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx(ue,{children:"Replace your unsaved changes?"}),e[59]=O):O=e[59];const Z=w?`Loading Version ${w.version} will discard what you have typed.`:"Loading the latest article will discard what you have typed.";let b;e[60]!==Z?(b=i.jsxs(fe,{children:[O,i.jsx(he,{children:Z})]}),e[60]=Z,e[61]=b):b=e[61];let R;e[62]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsx(z,{type:"button",variant:"ghost",onClick:()=>k(!1),children:"Keep editing"}),e[62]=R):R=e[62];const ee=w?"confirm-load-version-button":"confirm-load-latest-button",te=w?`Load Version ${w.version}`:"Load latest";let v;e[63]!==G||e[64]!==ee||e[65]!==te?(v=i.jsxs(ge,{children:[R,i.jsx(z,{type:"button",onClick:G,"data-test":ee,children:te})]}),e[63]=G,e[64]=ee,e[65]=te,e[66]=v):v=e[66];let x;e[67]!==b||e[68]!==v?(x=i.jsxs(_e,{children:[b,v]}),e[67]=b,e[68]=v,e[69]=x):x=e[69];let y;e[70]!==M||e[71]!==x?(y=i.jsx(be,{open:M,onOpenChange:k,children:x}),e[70]=M,e[71]=x,e[72]=y):y=e[72];let T;return e[73]!==P||e[74]!==_||e[75]!==y||e[76]!==a?(T=i.jsxs(je,{breadcrumbs:P,children:[a,_,y]}),e[73]=P,e[74]=_,e[75]=y,e[76]=a,e[77]=T):T=e[77],T}export{Nt 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.