PageSourceSearch

https://vault22.com/_next/static/chunks/pages/admin/newsroom-db86881ccdad4f6a.js

js vault22.com collected 2026-10-02 00:10:11 UTC 33,049 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[82920],{41518:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>H});var r=s(37876),a=s(14232),n=s(37497),i=s(53403),l=s(49548);let o=["in_review","held","published","rejected","withdrawn","guard_failed"],d=/^[a-z][a-z_]{1,30}:[A-Za-z0-9][A-Za-z0-9:._-]{0,160}$/;function c(e){if(!e)return null;let t=e=>"number"==typeof e&&Number.isInteger(e)?e:null;switch(e.status){case"in_review":var s;return null!=(s=t(e.reviewVersion))?s:t(e.currentVersion);case"published":case"withdrawn":return t(e.reviewVersion);case"held":return t(e.heldVersion);default:return null}}function u(e,t){var s;let r=(null!=t?t:"").trim(),a=/^([a-z][a-z0-9_]*)(?::\s*([\s\S]*))?$/.exec(r),n=a?a[1]:"",i=a?(null!=(s=a[2])?s:"").trim():r,l=e=>n===e||!n&&-1!==r.indexOf(e),o=e=>i?"".concat(e," Core: ").concat(i):e;switch(e){case 403:return l("not_an_editor")||!r?o("Only a listed Newsroom editor can do this (HTTP 403 not_an_editor)."):"Refused (HTTP 403): ".concat(r);case 409:if(l("version_mismatch"))return o("This version changed since you opened it. Reload the article and review it again (HTTP 409 version_mismatch).");if(l("not_in_review"))return o("This article has no version waiting for review (HTTP 409 not_in_review).");if(l("not_published"))return o("Only a published article can be withdrawn or corrected (HTTP 409 not_published).");if(l("newsroom_off"))return o("The Newsroom sync flag is off, so nothing can be published (HTTP 409 newsroom_off).");if(l("already_drafting"))return o("A draft for this trigger is already running (HTTP 409 already_drafting).");return"Conflict (HTTP 409): ".concat(r||"no detail");case 422:if(l("verification_failed"))return o("Core verification failed, so this cannot be published (HTTP 422 verification_failed).");if(l("unknown_trigger"))return o("The chatbot could not find or fetch that trigger (HTTP 422 unknown_trigger).");if(l("no_llm_sources"))return o("That trigger has no source the Newsroom may use (HTTP 422 no_llm_sources).");if(l("format_disabled"))return o("That format is switched off (HTTP 422 format_disabled).");return"Rejected (HTTP 422): ".concat(r||"no detail");case 423:return o("The Newsroom template copy is not approved yet, and unapproved copy is not allowed here (HTTP 423 copy_not_approved).");case 429:return o("The daily Newsroom drafting cap is reached. Try again tomorrow (HTTP 429 daily_cap_reached).");case 404:return"Not found (HTTP 404). ".concat(r).trim();default:return"Request failed (HTTP ".concat(null!=e?e:"—","): ").concat(r||"no detail")}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:280,s=e.trim();return s?s.length>t?"Keep the reason to ".concat(t," characters (").concat(s.length," now)."):null:"A reason is required."}function h(e,t){if(0===e.length)return"Select at least one sentence to strike.";let s=t.trim();return s?s.length>280?"Keep the note to ".concat(280," characters (").concat(s.length," now)."):null:"A correction note is required."}function x(e){return Array.isArray(e)?e:[]}function p(e){if(!e||"object"!=typeof e)return null;let t=e.story&&"object"==typeof e.story?e.story:{},s={...e};delete s.story;let r={...t,...s};return"number"!=typeof r.version?null:{...r,headline:"string"==typeof r.headline?r.headline:"",versionHash:"string"==typeof r.versionHash?r.versionHash:"",sections:x(r.sections),sentences:x(r.sentences),facts:x(r.facts),sources:x(r.sources),boundFacts:x(r.boundFacts)}}var f=s(48228),g=s(64026);let b="inline-flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",v="".concat(b," bg-[#1E3A5F] text-white hover:bg-[#24507F]"),w="".concat(b," bg-gray-100 text-gray-800 hover:bg-gray-200"),y="".concat(b," bg-red-600 text-white hover:bg-red-700"),j="".concat(b," bg-emerald-700 text-white hover:bg-emerald-800"),N="bg-white border border-gray-200 rounded-xl p-5",k="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-[#1E3A5F] focus:outline-none",_={supported:"bg-emerald-50 text-emerald-800",partially_supported:"bg-amber-50 text-amber-800",unsupported:"bg-red-50 text-red-800"};function T(e){let{version:t,striking:s,struck:a,onToggleStrike:n}=e,i=function(e){let t={};for(let s of e.sentences)s&&"string"==typeof s.id&&(t[s.id]=s);let s={},r=[];for(let a of e.sections){let e=x(a.sentenceIds).map(e=>(s[e]=!0,t[e])).filter(e=>!!e);r.push({key:a.key,heading:a.heading,sentences:e})}let a=e.sentences.filter(e=>e&&!s[e.id]);return a.length>0&&r.push({key:"_unplaced",heading:"Not in a section",sentences:a}),r}(t);return(0,r.jsx)("div",{className:"space-y-5","data-testid":"newsroom-admin-sentences",children:i.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-sm font-semibold text-gray-900",children:e.heading}),(0,r.jsx)("ol",{className:"mt-2 space-y-3",children:e.sentences.map(e=>{var i,o,d,c,u;let m=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return x(e.citations).map(e=>{var r,a,n,i,l;if("string"==typeof e.sourceId&&e.sourceId.startsWith("fact:")){let t=null!=(r=x(s).find(t=>
1t&&t.key===e.sourceId))?r:null;return{kind:"fact",sourceId:e.sourceId,agency:null,title:null,blocks:[{index:0,text:t&&"string"==typeof t.text?t.text:null}],missing:!t||"string"!=typeof t.text}}let o=null!=(a=t.find(t=>t.sourceId===e.sourceId))?a:null,d=[],c=Number.isInteger(e.startBlock)?e.startBlock:0,u=Number.isInteger(e.endBlock)?e.endBlock:c;for(let e=c;e<u&&e-c<50;e+=1){let t=null==o||null==(n=o.citedBlocks)?void 0:n[String(e)];d.push({index:e,text:"string"==typeof t?t:null})}return{kind:"source",sourceId:e.sourceId,agency:null!=(i=null==o?void 0:o.agency)?i:null,title:null!=(l=null==o?void 0:o.title)?l:null,blocks:d,missing:!o||0===d.length||d.some(e=>null===e.text)}})}(e,t.sources,null!=(i=t.boundFacts)?i:[]),h=-1!==a.indexOf(e.id);return(0,r.jsxs)("li",{"data-testid":"newsroom-admin-sentence",className:"grid gap-3 rounded-lg border border-gray-200 p-3 lg:grid-cols-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[e.quote&&(0,r.jsx)("span",{className:"rounded bg-violet-50 px-1.5 text-violet-800",children:"Direct quote"}),e.judge&&(0,r.jsx)("span",{"data-testid":"newsroom-admin-judge",className:"rounded px-1.5 ".concat(null!=(o=_[e.judge])?o:"bg-gray-100 text-gray-700"),children:(0,l.gy)(e.judge)}),(null!=(d=e.factKeys)?d:[]).length>0&&(0,r.jsxs)("span",{children:["Uses ",(null!=(c=e.factKeys)?c:[]).length," verified fact",1===(null!=(u=e.factKeys)?u:[]).length?"":"s"]})]}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-900 ".concat(h?"line-through opacity-60":""),children:e.text}),s&&(0,r.jsxs)("label",{className:"mt-1 inline-flex items-center gap-2 text-xs text-red-700",children:[(0,r.jsx)("input",{type:"checkbox",checked:h,onChange:()=>n(e.id),"data-testid":"newsroom-admin-strike"}),"Strike this sentence"]})]}),(0,r.jsxs)("div",{className:"space-y-2 text-xs","data-testid":"newsroom-admin-evidence",children:[0===m.length&&(0,r.jsx)("p",{className:"text-red-700",children:"No citation."}),m.map((e,t)=>{var s,a,n,i;return(0,r.jsxs)("div",{className:"rounded border px-2 py-1 ".concat(e.missing?"border-red-300 bg-red-50":"border-gray-200 bg-gray-50"),children:[(0,r.jsxs)("div",{className:"font-semibold text-gray-700",children:["fact"===e.kind?"Verified fact":"".concat(null!=(n=null!=(a=e.agency)?a:e.title)?n:"Source",", ").concat((0,l.M_)(e.blocks.map(e=>e.index))),e.missing&&(0,r.jsx)("span",{className:"ms-1 text-red-700",children:"fact"===e.kind?"(fact not in this version)":"(cited source text missing)"})]}),"fact"===e.kind?(0,r.jsx)("p",{className:"mt-0.5 text-gray-800","data-testid":"newsroom-admin-fact-citation",children:null!=(i=null==(s=e.blocks[0])?void 0:s.text)?i:"—"}):e.blocks.map(e=>{var t;return(0,r.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap text-gray-800",children:null!=(t=e.text)?t:"—"},e.index)})]},"".concat(e.sourceId,"-").concat(t))})]})]},e.id)})})]},e.key))})}function C(e){var t,s,n,o,d,p,b,_,C,S,I;let{detail:A,onChanged:P,onMessage:V}=e,[H,q]=(0,a.useState)(null),E=function(e,t){var s;let r=null!=(s=null==e?void 0:e.versions)?s:[];if(0===r.length)return null;for(let s of[t,c(e),null==e?void 0:e.publishedVersion,null==e?void 0:e.currentVersion]){if("number"!=typeof s)continue;let e=r.find(e=>e.version===s);if(e)return e}return r[r.length-1]}(A,H),F=function(e,t){var s,r;let a=null==e?void 0:e.status,n=c(e),i=null!=(r=null==t?void 0:t.version)?r:null,l="number"==typeof(null==e?void 0:e.publishedVersion)?e.publishedVersion:null;return{publish:null!==n&&i===n&&(null==t||null==(s=t.verification)?void 0:s.passed)!==!1,reject:null!==n,withdraw:"published"===a,correct:"published"===a&&null!==l&&i===l,redraft:"published"===a||"in_review"===a||"held"===a||"rejected"===a||"guard_failed"===a}}(A,E),D=c(A),[R,K]=(0,a.useState)(null),[L,B]=(0,a.useState)(""),[O,z]=(0,a.useState)(!1),[M,W]=(0,a.useState)([]),[U,X]=(0,a.useState)(""),Z=function(e){let t=null==e?void 0:e.verification;if(!t)return{passed:null,failures:[]};let s=x(t.failures).map(l.aj);return{passed:!0===t.passed,failures:s}}(E),$=!!E&&(E.version===D||E.version===A.publishedVersion),Y=null!=(s=null==E?void 0:E.guardReport)?s:null,J=(0,a.useMemo)(()=>[...A.versions].reverse(),[A.versions]),Q=async e=>{if(!E)return;if(("reject"===e||"withdraw"===e)&&m(L))return void V({kind:"error",text:m(L)});if("correct"===e&&h(M,U))return void V({kind:"error",text:h(M,U)});K(e);
1let t=A.articleId,s="publish"===e?await i.KD.publishNewsroomArticle(t,E.versionHash):"reject"===e?await i.KD.rejectNewsroomArticle(t,L.trim()):"withdraw"===e?await i.KD.withdrawNewsroomArticle(t,L.trim()):"correct"===e?await i.KD.correctNewsroomArticle(t,{versionHash:E.versionHash,strikeSentenceIds:M,note:U.trim()}):await i.KD.draftNewsroom({storyId:t,redraft:!0});if(K(null),!s.success)return void V({kind:"error",text:u(s.statusCode,s.error)});V({kind:"ok",text:{publish:"Published version ".concat(E.version,"."),reject:"Rejected.",withdraw:"Withdrawn. Customers now see the withdrawn stub.",correct:"Correction published as a new version.",redraft:"New draft requested. It arrives through the next import as in review; the published version stays live."}[e]}),B(""),X(""),W([]),z(!1),q(null),P()};return E?(0,r.jsxs)("section",{className:N,"data-testid":"newsroom-admin-review",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{className:"font-semibold text-gray-800","data-testid":"newsroom-admin-review-status",children:(0,l.z)(A.status)}),A.format&&(0,r.jsx)("span",{children:(0,l.wR)(A.format)})]}),(0,r.jsx)("h2",{className:"mt-1 text-lg font-semibold text-gray-900",children:E.headline}),E.dek&&(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-700",children:E.dek}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-500","data-testid":"newsroom-admin-version-hash","data-version-hash":E.versionHash,title:"Fingerprint ".concat(E.versionHash),children:["Version ",E.version,E.version===D?" \xb7 waiting for review":E.version===A.publishedVersion?"withdrawn"===A.status?" \xb7 withdrawn":" \xb7 live":""]})]}),(0,r.jsxs)("div",{className:"text-right text-xs",children:[(0,r.jsxs)("div",{"data-testid":"newsroom-admin-verification",className:"inline-block rounded-full px-2 py-0.5 font-semibold ".concat(!0===Z.passed?"bg-emerald-50 text-emerald-800":!1===Z.passed?"bg-red-50 text-red-800":"bg-gray-100 text-gray-700"),children:["Automatic checks: ",!0===Z.passed?"passed":!1===Z.passed?"FAILED":"not run"]}),(0,r.jsxs)("div",{className:"mt-1 text-gray-500",children:["Wording: ",(null==(t=E.templateSet)?void 0:t.approvalStatus)?(0,l.ic)(E.templateSet.approvalStatus).toLowerCase():"—"]})]})]}),Z.failures.length>0&&(0,r.jsx)("ul",{className:"mt-2 list-disc pl-5 text-xs text-red-800","data-testid":"newsroom-admin-verification-failures",children:Z.failures.map(e=>(0,r.jsx)("li",{children:e},e))}),!$&&(0,r.jsxs)("p",{className:"mt-2 rounded border border-amber-200 bg-amber-50 px-2 py-1 text-xs text-amber-900","data-testid":"newsroom-admin-readonly-version",children:["You are looking at a version that is neither waiting for review nor live. Publish is offered only on the version waiting for review",null!==D?" (version ".concat(D,")"):"",", and a correction only on the live version","number"==typeof A.publishedVersion?" (version ".concat(A.publishedVersion,")"):"","."]}),(0,r.jsxs)("div",{className:"mt-4 space-y-3 rounded-lg border border-gray-200 bg-gray-50 p-3","data-testid":"newsroom-admin-actions",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)("button",{type:"button",className:j,disabled:!F.publish||null!==R,onClick:()=>void Q("publish"),"data-testid":"newsroom-admin-publish",children:"publish"===R?"Publishing…":"Approve and publish"}),(0,r.jsx)("button",{type:"button",className:w,disabled:!F.redraft||null!==R,onClick:()=>void Q("redraft"),"data-testid":"newsroom-admin-redraft",children:"redraft"===R?"Requesting…":"Request a new draft"}),(0,r.jsx)("button",{type:"button",className:w,disabled:!F.correct||null!==R,onClick:()=>z(e=>!e),"aria-pressed":O,"data-testid":"newsroom-admin-correct-toggle",children:O?"Cancel correction":"Publish correction…"})]}),O&&(0,r.jsxs)("div",{className:"space-y-2","data-testid":"newsroom-admin-correct-form",children:[(0,r.jsx)("p",{className:"text-xs text-gray-600",children:"Tick the sentences to strike below, then add a note (at most 280 characters). Any number in the note must appear in the article's sources."}),(0,r.jsx)("textarea",{className:k,rows:2,maxLength:280,value:U,onChange:e=>X(e.target.value),placeholder:"Correction note shown to customers","data-testid":"newsroom-admin-correct-note"}),(0,r.jsx)("button",{type:"button",className:v,disabled:null!==R||0===M.length||!U.trim(),onClick:()=>
1void Q("correct"),"data-testid":"newsroom-admin-correct",children:"correct"===R?"Publishing…":"Publish correction (".concat(M.length," struck)")})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)("input",{className:k,value:L,maxLength:280,onChange:e=>B(e.target.value),placeholder:"Reason (required to reject or withdraw)","data-testid":"newsroom-admin-reason"}),(0,r.jsx)("button",{type:"button",className:w,disabled:!F.reject||null!==R||!L.trim(),onClick:()=>void Q("reject"),"data-testid":"newsroom-admin-reject",children:"reject"===R?"Rejecting…":"Reject"}),(0,r.jsx)("button",{type:"button",className:y,disabled:!F.withdraw||null!==R||!L.trim(),onClick:()=>void Q("withdraw"),"data-testid":"newsroom-admin-withdraw",children:"withdraw"===R?"Withdrawing…":"Withdraw"})]})]}),(0,r.jsx)("h3",{className:"mt-6 text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Sentences and cited source text"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Each sentence on the left, the exact source text it cites on the right. Every figure must appear in that text."}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(T,{version:E,striking:O,struck:M,onToggleStrike:e=>W(t=>-1===t.indexOf(e)?t.concat(e):t.filter(t=>t!==e))})}),(0,r.jsx)("h3",{className:"mt-6 text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Verified facts"}),0===E.facts.length?(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"No extracted facts."}):(0,r.jsxs)("table",{className:"mt-2 w-full text-left text-xs","data-testid":"newsroom-admin-facts",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b border-gray-200 text-gray-500",children:[(0,r.jsx)("th",{className:"py-1 pr-2",children:"Fact"}),(0,r.jsx)("th",{className:"py-1 pr-2",children:"Value"}),(0,r.jsx)("th",{className:"py-1 pr-2",children:"Period"}),(0,r.jsx)("th",{className:"py-1",children:"Source says"})]})}),(0,r.jsx)("tbody",{children:E.facts.map(e=>(0,r.jsxs)("tr",{className:"border-b border-gray-100 align-top",children:[(0,r.jsx)("td",{className:"py-1 pr-2",children:(0,l.p2)(e.kind)}),(0,r.jsxs)("td",{className:"py-1 pr-2",children:[[e.value,e.unit].filter(Boolean).join(" "),e.direction?" (".concat(e.direction,")"):""]}),(0,r.jsx)("td",{className:"py-1 pr-2",children:e.period}),(0,r.jsxs)("td",{className:"py-1 italic text-gray-700",children:["“",e.quote,"”"]})]},e.key))})]}),(null!=(n=E.boundFacts)?n:[]).length>0&&(0,r.jsxs)("details",{className:"mt-2 text-xs text-gray-700",children:[(0,r.jsxs)("summary",{className:"cursor-pointer text-gray-600",children:["The same facts as short sentences the draft may cite (",(null!=(o=E.boundFacts)?o:[]).length,")"]}),(0,r.jsx)("ul",{className:"mt-1 list-disc pl-5","data-testid":"newsroom-admin-bound-facts",children:(null!=(d=E.boundFacts)?d:[]).map(e=>(0,r.jsxs)("li",{children:[e.text,e.derived?" (Vault22 calculation)":""]},e.key))})]}),(0,r.jsx)("h3",{className:"mt-6 text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Automatic checks on the draft"}),(0,r.jsxs)("div",{className:"mt-1 text-xs text-gray-700","data-testid":"newsroom-admin-guard",children:[(0,r.jsxs)("div",{children:[(null==Y?void 0:Y.passed)===!0?"Passed":(null==Y?void 0:Y.passed)===!1?"Failed":"Not reported","number"==typeof(null==Y?void 0:Y.attempts)&&" after ".concat(Y.attempts," attempt").concat(1===Y.attempts?"":"s"),(null==Y?void 0:Y.judgeMode)&&"; ".concat((0,l.Z$)(Y.judgeMode)),".",(null==Y?void 0:Y.overlap)&&"number"==typeof Y.overlap.maxSharedRun&&(0,r.jsxs)(r.Fragment,{children:[" Longest run of words copied from a source: ",Y.overlap.maxSharedRun,"."]})]}),0===(null!=(p=null==Y?void 0:Y.dropped)?p:[]).length?(0,r.jsx)("p",{className:"mt-1 text-gray-500",children:"No sentences were removed."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"mt-1 text-gray-600",children:"Sentences the checks removed before the draft reached you:"}),(0,r.jsx)("ul",{className:"mt-1 list-disc pl-5","data-testid":"newsroom-admin-dropped",children:(null!=(b=null==Y?void 0:Y.dropped)?b:[]).map((e,t)=>{var s;return(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-semibold",children:(0,l.Kk)(e.reason)}),e.text&&(0,r.jsxs)("span",{className:"text-gray-500",children:[" \xb7 “",e.text,"”"]})]},"".concat(null!=(s=e.sentenceId)?s:t,"-").concat(e.reason))})})]})]}),(0,r.jsx)("h3",{className:"mt-6 text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Sources"}),(0,r.jsx)("ul",{className:"mt-1 space-y-1 text-xs text-gray-700",children:E.sources.map(e=>{var t;return(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-semibold",children:null!=(t=e.agency)?t:e.source})," \xb7 ",e.title,[(0,l.gY)(e.role),(0,l.Mq)(e.licenceClass)].filter(
1Boolean).map(e=>(0,r.jsxs)("span",{children:[" \xb7 ",e]},e)),(0,g.sX)(e.url)&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",(0,r.jsx)("a",{href:(0,g.sX)(e.url),target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Open the source"})]}),e.attributionLine&&(0,r.jsx)("div",{className:"text-gray-500",children:e.attributionLine})]},e.sourceId)})}),(0,r.jsx)("h3",{className:"mt-6 text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Version history"}),(0,r.jsx)("ul",{className:"mt-1 space-y-1 text-xs","data-testid":"newsroom-admin-versions",children:J.map(e=>{var t,s,a;return(0,r.jsxs)("li",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",className:"rounded px-2 py-0.5 ".concat(e.version===E.version?"bg-[#1E3A5F] text-white":"bg-gray-100 text-gray-800"),onClick:()=>q(e.version),children:["Version ",e.version]}),(0,r.jsx)("span",{children:(0,l.PN)(e.origin)}),e.createdBy&&(0,r.jsxs)("span",{children:["by ",e.createdBy]}),(0,r.jsx)("span",{className:"text-gray-500",children:null!=(a=(0,f.sV)(null!=(s=e.createdAt)?s:null))?a:""}),(0,r.jsx)("span",{children:(null==(t=e.verification)?void 0:t.passed)?"checks passed":e.verification?"checks failed":""}),A.publishedVersion===e.version&&("withdrawn"===A.status?(0,r.jsx)("span",{className:"rounded bg-rose-50 px-1.5 text-rose-800",children:"withdrawn"}):(0,r.jsx)("span",{className:"rounded bg-emerald-50 px-1.5 text-emerald-800",children:"live"})),D===e.version&&(0,r.jsx)("span",{className:"rounded bg-blue-50 px-1.5 text-blue-800",children:"waiting for review"})]},e.version)})}),(null!=(_=A.corrections)?_:[]).length>0&&(0,r.jsx)("ul",{className:"mt-2 list-disc pl-5 text-xs text-gray-700",children:(null!=(C=A.corrections)?C:[]).map(e=>{var t,s;return(0,r.jsxs)("li",{children:["Correction in version ",e.version," \xb7 ",null!=(t=(0,f.sV)(e.at))?t:e.at," \xb7 ",null!=(s=e.by)?s:"",": ",e.note]},"".concat(e.version,"-").concat(e.at))})}),A.rejected&&(0,r.jsxs)("p",{className:"mt-2 text-xs text-gray-700",children:["Rejected by ",A.rejected.by," at ",(0,f.sV)(null!=(S=A.rejected.at)?S:null),": ",A.rejected.reason]}),A.withdrawn&&(0,r.jsxs)("p",{className:"mt-2 text-xs text-rose-800",children:["Withdrawn by ",A.withdrawn.by," at ",(0,f.sV)(null!=(I=A.withdrawn.at)?I:null),": ",A.withdrawn.reason]})]}):(0,r.jsxs)("section",{className:N,"data-testid":"newsroom-admin-review",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:A.headline}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-500",children:"This article has no versions to show."})]})}let S={in_review:"bg-blue-50 text-blue-800",held:"bg-amber-50 text-amber-800",published:"bg-emerald-50 text-emerald-800",rejected:"bg-gray-100 text-gray-700",withdrawn:"bg-rose-50 text-rose-800",guard_failed:"bg-red-50 text-red-800"};function I(e){let{status:t,onStatus:s,articles:a,loading:n,error:i,selectedId:d,onSelect:c}=e;return(0,r.jsxs)("section",{className:N,"data-testid":"newsroom-admin-queue",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Queue (last 14 days)"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Filter by status",children:["",...o].map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":e===t,className:e===t?v:w,onClick:()=>s(e),"data-testid":"newsroom-admin-filter-".concat(e||"all"),children:e?(0,l.z)(e):"All"},e||"all"))})]}),i&&(0,r.jsx)("p",{className:"mt-3 text-sm text-red-700",role:"alert",children:i}),n?(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Loading…"}):0===a.length?(0,r.jsxs)("p",{className:"mt-3 text-sm text-gray-500","data-testid":"newsroom-admin-queue-empty",children:["No articles",t?": ".concat((0,l.z)(t).toLowerCase()):"","."]}):(0,r.jsx)("ul",{className:"mt-3 divide-y divide-gray-100","data-testid":"newsroom-admin-queue-list",children:a.map(e=>{var t,s,a,n,i,o,u,m,h;return(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",onClick:()=>c(e.articleId),className:"w-full px-2 py-2 text-left hover:bg-gray-50 ".concat(d===e.articleId?"bg-blue-50/60":""),"data-testid":"newsroom-admin-queue-item",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"rounded-full px-2 py-0.5 font-semibold ".concat(null!=(i=S[e.status])?i:"bg-gray-100 text-gray-700"),children:(0,l.z)(e.status)}),(0,r.jsx)("span",{className:"text-gray-500",children:(0,l.wR)(e.format)}),("published"===e.status||"withdrawn"===e.status)&&"number"==typeof e.reviewVersion&&(0,r.jsx)("span",{className:"rounded-full bg-blue-50 px-2 py-0.5 font-semibold text-blue-800","data-testid":"newsroom-admin-queue-redraft",children:"New draft waiting for review"}),((null==(t=e.label)?void 0:t.kind)==="auto_dev"||(null==(s=e.label)?void 0:s.auto)===!0)&&(0,r.jsx)("span",{className:"rounded-full bg-amber-100 px-2 py-0.5 font-semibold text-amber-900","data-testid":"newsroom-admin-queue-auto",children:(null==(a=e.label)?void 0:a.kind)==="reviewed"&&(null==(n=e.label)?void 0:n.editorName)?"Auto-published as ".concat(e.label.editorName):"Auto-published, not reviewed"}),(0,r.jsx)("span",{className:"ms-auto text-gray-500",children:null!=(h=(0,f.sV)(null!=(m=null!=(u=null!=(o=e.publishedAt)?o:e.importedAt)?u:e.updatedAt)?m:null))?h:""})]}),(0,r.jsx)("div",{className:"mt-1 text-sm font-medium text-gray-900",children:e.headline||"No headline: the draft failed its checks"})]})},e.articleId)})})]})}var A=s(60068);function P(e){var t,s;let{status:n,statusError:o,onChanged:c,onMessage:m}=e,[h,x]=(0,a.useState)(null),[p,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(""),y=function(e){if(!e)return!1;if(!0===e.autoPublish)return!0;let t=e.flags;return(null==t?void 0:t.NewsroomAutoPublish)===!0}(n),j="string"==typeof(null==n?void 0:n.autoPublishEditor)&&""!==n.autoPublishEditor.trim()?n.autoPublishEditor.trim():null,_=(0,l.dJ)(n),T=async e=>{var t,s,r,a,n,l;x(e?"import_dry":"import");let o=await i.KD.importNewsroom(e);if(x(null),!o.success)return void m({kind:"error",text:u(o.statusCode,o.error)});f(null!=(t=o.data)?t:null);let d=null!=(s=o.data)?s:{};m({kind:"ok",text:e?"Dry run: ".concat(null!=(r=d.imported)?r:0," would import, ").concat(null!=(a=d.held)?a:0," would be held").concat("number"==typeof d.wouldPublish?", ".concat(d.wouldPublish," passed verification (an editor could publish them)"):"",". Nothing was stored."):"Imported ".concat(null!=(n=d.imported)?n:0,", held ").concat(null!=(l=
1d.held)?l:0,".")}),e||c()},C=async()=>{let e=g.trim();if(!("string"==typeof e&&d.test(e.trim())))return void m({kind:"error",text:"Enter a trigger key such as auction:91282CRM5:2026-09-24 or edgar:0000320193-26-000071."});x("draft");let t=await i.KD.draftNewsroom({triggerKey:e});if(x(null),!t.success)return void m({kind:"error",text:u(t.statusCode,t.error)});m({kind:"ok",text:"Draft requested. It reaches the queue as “in review” with the next import, within 15 minutes."}),b("")};return(0,r.jsxs)("section",{className:N,"data-testid":"newsroom-admin-status",children:[y&&(0,r.jsx)("div",{role:"alert","data-testid":"newsroom-admin-auto-publish",className:"mb-4 rounded-lg border border-red-300 bg-red-50 px-3 py-2 text-sm font-bold text-red-800",children:j?(0,r.jsxs)(r.Fragment,{children:["AUTO-PUBLISH ON: drafts that pass every check publish without a manual review, as the editor ",j,' (labelled "Published by" that editor, AI-assisted). Dev only; switch auto-publish off when done.']}):(0,r.jsx)(r.Fragment,{children:'AUTO-PUBLISH ON: drafts that pass every check publish without review, labelled "not reviewed (dev preview)". Dev only; switch auto-publish off when done.'})}),(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Status"}),o?(0,r.jsx)("p",{className:"mt-2 text-sm text-red-700",role:"alert",children:o}):(0,r.jsx)(A.S,{groups:_,testId:"newsroom-admin-status-rows"}),(0,r.jsxs)("div",{className:"mt-5 flex flex-wrap items-center gap-2",children:[(0,r.jsx)("button",{type:"button",className:w,disabled:null!==h,onClick:()=>void T(!0),"data-testid":"newsroom-admin-import-dry",children:"import_dry"===h?"Importing…":"Import now (dry run)"}),(0,r.jsx)("button",{type:"button",className:v,disabled:null!==h,onClick:()=>void T(!1),"data-testid":"newsroom-admin-import",children:"import"===h?"Importing…":"Import now"})]}),p&&(null!=(s=null==(t=p.stories)?void 0:t.length)?s:0)>0&&(0,r.jsx)("ul",{className:"mt-3 space-y-1 text-xs text-gray-700","data-testid":"newsroom-admin-import-stories",children:p.stories.map((e,t)=>{var s;return(0,r.jsxs)("li",{children:["Article ",t+1,", version ",e.version,e.outcome?" \xb7 ".concat((0,l.z)(e.outcome)):""," \xb7 checks ",(null==(s=e.verification)?void 0:s.passed)===!0?"passed":e.verification?"FAILED":"not run"]},"".concat(e.storyId,"-").concat(e.version))})}),(0,r.jsxs)("div",{className:"mt-5 border-t border-gray-100 pt-4",children:[(0,r.jsx)("label",{htmlFor:"newsroom-trigger",className:"block text-sm font-medium text-gray-700",children:"Draft from trigger"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Ask for an article about one official release, for example a Treasury auction or an SEC filing. The chatbot fetches the release if it does not have it yet, and the draft arrives in the queue as “in review”."}),(0,r.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)("input",{id:"newsroom-trigger",className:k,value:g,onChange:e=>b(e.target.value),placeholder:"auction:91282CRM5:2026-09-24","data-testid":"newsroom-admin-trigger-input"}),(0,r.jsx)("button",{type:"button",className:v,disabled:null!==h||!g.trim(),onClick:()=>void C(),"data-testid":"newsroom-admin-draft",children:"draft"===h?"Requesting…":"Draft from trigger"})]})]})]})}function V(e){let{message:t,onDismiss:s}=e;return(0,r.jsxs)("div",{role:"error"===t.kind?"alert":"status","data-testid":"newsroom-admin-message",className:"mb-4 p-3 rounded-lg text-sm border ".concat("error"===t.kind?"bg-red-50 border-red-200 text-red-800":"bg-green-50 border-green-200 text-green-800"),children:[t.text,(0,r.jsx)("button",{type:"button",onClick:s,className:"ml-2 font-medium underline",children:"Dismiss"})]})}function H(){var e;let[t,s]=(0,a.useState)(null),[l,o]=(0,a.useState)(null),[d,c]=(0,a.useState)("in_review"),[m,h]=(0,a.useState)([]),[f,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(null),[y,j]=(0,a.useState)(null),[k,_]=(0,a.useState)(null),[T,S]=(0,a.useState)(null),[H,q]=(0,a.useState)(null),E=(0,a.useCallback)(async()=>{let e=await i.KD.getNewsroomStatus();if(e.success){var t;s(null!=(t=e.data)?t:null),o(null)}else s(null),o(u(e.statusCode,e.error))},[]),F=(0,a.useCallback)(async()=>{g(!0);let e=await i.KD.listNewsroomArticles({status:d||null,days:14});if(g(!1),e.success){var t,s;h((Array.isArray(t=e.data)?t:t&&"object"==typeof t?x(null!=(s=t.items)?s:t.articles):[]).filter(e=>!!e&&"object"==typeof e).map(e=>{var t,s,r;return{...e,articleId:String(null!=(r=null!=(s=null!=(t=e.articleId)?t:e.id)?s:e._id
1)?r:"")}}).filter(e=>""!==e.articleId)),v(null)}else h([]),v(u(e.statusCode,e.error))},[d]),D=(0,a.useCallback)(async e=>{S(null);let t=await i.KD.getNewsroomArticle(e);if(t.success){let e=function(e){var t,s,r,a;if(!e||"object"!=typeof e)return null;let n=e.article&&"object"==typeof e.article?e.article:e,i=null!=(r=null!=(s=null!=(t=n.articleId)?t:n.id)?s:n._id)?r:n.storyId;if("string"!=typeof i||!i)return null;let l=x(null!=(a=e.versions)?a:n.versions).map(p).filter(e=>null!==e).sort((e,t)=>e.version-t.version);return{...n,articleId:i,versions:l}}(t.data);_(e),e||S("Core returned an article this page cannot read.")}else _(null),S(u(t.statusCode,t.error))},[]);(0,a.useEffect)(()=>{E()},[E]),(0,a.useEffect)(()=>{F()},[F]),(0,a.useEffect)(()=>{y?D(y):_(null)},[D,y]);let R=()=>{E(),F(),y&&D(y)};return(0,r.jsx)(n.A,{requireRoles:["Admin","Nudge Manager"],children:(0,r.jsxs)("div",{className:"p-6 space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Newsroom"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Vault22's own AI-drafted, citation-locked articles from official sources. A listed editor reviews each version against its sources and publishes it."})]}),(0,r.jsx)("button",{type:"button",onClick:R,className:w,"data-testid":"newsroom-admin-refresh",children:"Refresh"})]}),(0,r.jsx)(A.B,{testId:"newsroom-admin-how",steps:["An official source publishes a release: a Treasury auction, a Census or Labor figure, EIA stocks, an SEC filing or a central-bank decision.","The chatbot drafts a short article. Every sentence cites the exact source text, and every figure must appear in it. Sentences that fail are removed.","Vault22 checks the draft again and brings it in every 15 minutes (the daily Markets in numbers story about two minutes after it is requested).","A listed editor reads each sentence beside its source, then publishes it, rejects it with a reason, or asks for a new draft.","A live article can be withdrawn or corrected. Customers see the correction note, and the article names who published it."]}),H&&(0,r.jsx)(V,{message:H,onDismiss:()=>q(null)}
1),(0,r.jsx)(P,{status:t,statusError:l,onChanged:R,onMessage:q}),(0,r.jsxs)("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",children:[(0,r.jsx)(I,{status:d,onStatus:e=>{c(e),j(null)},articles:m,loading:f,error:b,selectedId:y,onSelect:j}),(0,r.jsxs)("div",{children:[T&&(0,r.jsx)("p",{className:"".concat(N," text-sm text-red-700"),role:"alert",children:T}),k?(0,r.jsx)(C,{detail:k,onChanged:R,onMessage:q},"".concat(k.articleId,"-").concat(null!=(e=k.currentVersion)?e:"","-").concat(k.status)):!T&&(0,r.jsx)("p",{className:"".concat(N," text-sm text-gray-500"),children:"Select an article in the queue to review it."})]})]})]})})}},54880:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/newsroom",function(){return s(41518)}])}},e=>{e.O(0,[37497,79433,90636,46593,38792],()=>e(e.s=54880)),_N_E=e.O()}]);

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.