@abstractframework/continuum 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{abnfDiagram-VRR7QNED-Brp5ylmu.js → abnfDiagram-VRR7QNED-Bi6Zq4uE.js} +2 -2
- package/dist/assets/{arc-BU6H2_LM.js → arc-2BZBvDDK.js} +2 -2
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-CGbgTH7Z.js → architectureDiagram-ZJ3FMSHR-Dr03tMo-.js} +2 -2
- package/dist/assets/{blockDiagram-677ZJIJ3-BVEpre9u.js → blockDiagram-677ZJIJ3-DQn17TUb.js} +2 -2
- package/dist/assets/{c4Diagram-LMCZKHZV-DC1WBhdn.js → c4Diagram-LMCZKHZV-KVGiN7-8.js} +2 -2
- package/dist/assets/channel-DnRo5F27.js +2 -0
- package/dist/assets/{chunk-2Q5K7J3B-FD83BpPx.js → chunk-2Q5K7J3B-VapwT0JN.js} +2 -2
- package/dist/assets/{chunk-32BRIVSS-BrKBHXQ6.js → chunk-32BRIVSS-lDdX6pLQ.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-To7S9vNc.js → chunk-5VM5RSS4-B4EYfcyP.js} +2 -2
- package/dist/assets/{chunk-EX3LRPZG-Dr6L7oiU.js → chunk-EX3LRPZG-CkX30FB7.js} +2 -2
- package/dist/assets/{chunk-JWPE2WC7-C78aXoZl.js → chunk-JWPE2WC7-aale1p0b.js} +2 -2
- package/dist/assets/{chunk-MOJQB5TN-D04wvpZ5.js → chunk-MOJQB5TN-AtJSVmmp.js} +2 -2
- package/dist/assets/{chunk-RYQCIY6F-B9HpEoLO.js → chunk-RYQCIY6F-gd1rrizj.js} +2 -2
- package/dist/assets/{chunk-V7JOEXUC-D1YS3AkP.js → chunk-V7JOEXUC-DUM2S8Ty.js} +2 -2
- package/dist/assets/{chunk-VR4S4FIN-B0XKLu7Q.js → chunk-VR4S4FIN-DPXtkl52.js} +2 -2
- package/dist/assets/{chunk-XXDRQBXY-BSmR9xpR.js → chunk-XXDRQBXY-Cpu8msQm.js} +2 -2
- package/dist/assets/classDiagram-OUVF2IWQ-ZsLIK-GL.js +2 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-ZsLIK-GL.js +2 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-BRC6sZSK.js → cose-bilkent-JH36ORCC-BhZP7fgR.js} +2 -2
- package/dist/assets/{cynefin-VYW2F7L2-DCI_ftnY.js → cynefin-VYW2F7L2-CuFt8mHZ.js} +2 -2
- package/dist/assets/{cynefinDiagram-TSTJHNR4-B_fUZmsm.js → cynefinDiagram-TSTJHNR4-DFcMrQSL.js} +2 -2
- package/dist/assets/{dagre-VKFMJZFB-D2vzXqvc.js → dagre-VKFMJZFB-D5P6mdzW.js} +2 -2
- package/dist/assets/{diagram-FQU43EPY-k22__739.js → diagram-FQU43EPY-Dcjl1DQv.js} +2 -2
- package/dist/assets/{diagram-G47NLZAW-qIAyR3g6.js → diagram-G47NLZAW-Cap-Hu_d.js} +2 -2
- package/dist/assets/{diagram-NH7WQ7WH-CqYc6C-1.js → diagram-NH7WQ7WH-DtfzA0EP.js} +2 -2
- package/dist/assets/{diagram-OA4YK3LP-ClvUU4Oz.js → diagram-OA4YK3LP-DQfGDg74.js} +2 -2
- package/dist/assets/{diagram-WEI45ONY-Dwfe5scN.js → diagram-WEI45ONY-BHAvqjQv.js} +2 -2
- package/dist/assets/{ebnfDiagram-CCIWWBDH-qeVlMNNO.js → ebnfDiagram-CCIWWBDH-wq5_TTLu.js} +2 -2
- package/dist/assets/{erDiagram-Q63AITRT-VQSxGy1d.js → erDiagram-Q63AITRT-Bffq8UJ-.js} +2 -2
- package/dist/assets/{flowDiagram-23GEKE2U-CrUWUtEA.js → flowDiagram-23GEKE2U-DlVwDhRY.js} +2 -2
- package/dist/assets/{ganttDiagram-NO4QXBWP-BeW1BT38.js → ganttDiagram-NO4QXBWP-CGR0SF0f.js} +2 -2
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-CZrBthK2.js → gitGraphDiagram-IHSO6WYX-jYOFJY6Z.js} +2 -2
- package/dist/assets/{index-Ch-VsdCx.js → index-C0g0JOTU.js} +3 -3
- package/dist/assets/{infoDiagram-FWYZ7A6U-k5E2Y1NB.js → infoDiagram-FWYZ7A6U-CyTfKefu.js} +2 -2
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-_pOT8SrK.js → ishikawaDiagram-FXEZZL3T-DpLmqcUC.js} +2 -2
- package/dist/assets/{journeyDiagram-5HDEW3XC-B5ibtG8Q.js → journeyDiagram-5HDEW3XC-BykEx4tC.js} +2 -2
- package/dist/assets/{kanban-definition-HUTT4EX6-R_xaO3iL.js → kanban-definition-HUTT4EX6-wEYGWpj9.js} +2 -2
- package/dist/assets/{linear-C4dqJlI0.js → linear-FCcD1Axy.js} +2 -2
- package/dist/assets/{mermaid.core-D_NnzgT8.js → mermaid.core-bzPoIo7V.js} +5 -5
- package/dist/assets/{mindmap-definition-LN4V7U3C--3BnqJ8n.js → mindmap-definition-LN4V7U3C-CGFPDyi5.js} +2 -2
- package/dist/assets/{pegDiagram-2B236MQR-D6BwP364.js → pegDiagram-2B236MQR-DLsxP-na.js} +2 -2
- package/dist/assets/{pieDiagram-ENE6RG2P-CAFAbCWt.js → pieDiagram-ENE6RG2P-YIsM6jpc.js} +2 -2
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-BuPmA6rb.js → quadrantDiagram-ABIIQ3AL-BFvs-F4N.js} +2 -2
- package/dist/assets/{railroadDiagram-RFXS5EU6-DCJdJgeB.js → railroadDiagram-RFXS5EU6-BrckCS3_.js} +2 -2
- package/dist/assets/{requirementDiagram-TGXJPOKE-Dg1zYbvc.js → requirementDiagram-TGXJPOKE-BPGFh2mJ.js} +2 -2
- package/dist/assets/{sankeyDiagram-HTMAVEWB-B-17wIdc.js → sankeyDiagram-HTMAVEWB-BtSsdF_g.js} +2 -2
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-B3AlB7Ru.js → sequenceDiagram-DBY2YBRQ-hU5wxk5v.js} +2 -2
- package/dist/assets/{sizeCapture-X5ZJPWSS-CQnhH2hk.js → sizeCapture-X5ZJPWSS-BL0o93Fj.js} +2 -2
- package/dist/assets/{stateDiagram-2N3HPSRC-Cw2qLt2I.js → stateDiagram-2N3HPSRC-CmZcl2Nm.js} +2 -2
- package/dist/assets/stateDiagram-v2-6OUMAXLB-D7MdluiK.js +2 -0
- package/dist/assets/{swimlanes-5IMT3BWC-BSKNWRuz.js → swimlanes-5IMT3BWC-DrexK-MP.js} +3 -3
- package/dist/assets/swimlanesDiagram-G3AALYLV-Ct4T6xDn.js +9 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-ddhjbuT9.js → timeline-definition-FHXFAJF6-Cub8uONj.js} +2 -2
- package/dist/assets/{vennDiagram-L72KCM5P-BSR-CfIx.js → vennDiagram-L72KCM5P-DojAwmHY.js} +2 -2
- package/dist/assets/{wardleyDiagram-EHGQE667-6Q-tq6rz.js → wardleyDiagram-EHGQE667-BL5-lbEM.js} +2 -2
- package/dist/assets/{xychartDiagram-FW5EYKEG-rMtivydi.js → xychartDiagram-FW5EYKEG-C9XxQJ78.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/llms.txt +1 -1
- package/package.json +2 -2
- package/dist/assets/channel-jMst8SyH.js +0 -2
- package/dist/assets/classDiagram-OUVF2IWQ-CIncecVh.js +0 -2
- package/dist/assets/classDiagram-v2-EOCWNBFH-CIncecVh.js +0 -2
- package/dist/assets/stateDiagram-v2-6OUMAXLB-Bruu3L--.js +0 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-BqamcIRP.js +0 -9
|
@@ -57,7 +57,7 @@ ${d}`:A:d,onClick:O,children:[e.jsx("span",{className:"af-switch__track","aria-h
|
|
|
57
57
|
`))w.startsWith("event:")?v=w.slice(6).trim():w.startsWith("data:")&&g.push(w.slice(5).replace(/^ /,""));g.length&&(yield{event:v,data:g.join(`
|
|
58
58
|
`)}),h=l.indexOf(`
|
|
59
59
|
|
|
60
|
-
`)}}}finally{n==null||n.removeEventListener("abort",u)}}function wx(s,n){return new Promise((r,i)=>{if(n.aborted)return i(new DOMException("Aborted","AbortError"));const l=setTimeout(()=>{n.removeEventListener("abort",u),r()},s),u=()=>{clearTimeout(l),i(new DOMException("Aborted","AbortError"))};n.addEventListener("abort",u,{once:!0})})}async function Za(s,n){if(!s.ok)throw await Lp(s,n);return s.json()}function jx(s){const n=s.pollMs??1e3,r=s.timeoutMs??18e4;let i=null;return async(l,u)=>{var A;const{fetchGateway:m,source:d}=s;if(i===null){const $=await m(yx(d.app),{signal:u.signal,headers:{Accept:"application/json"}}),T=await Za($,`The ${d.name} documentation could not be read, so nothing was asked`),B=typeof(T==null?void 0:T.text)=="string"?T.text:"";if(!B.trim())throw new Error(`The gateway returned an empty ${d.name} documentation corpus, so nothing was asked.`);i=B}const h=String(i),x=[];for(const $ of u.files||[]){const T=new FormData;T.append("session_id",u.sessionId),T.append("file",$,$.name||"upload.bin"),T.append("filename",$.name||"upload.bin"),$.type&&T.append("content_type",$.type);const B=await Za(await m(Cs("attachments/upload"),{method:"POST",body:T,signal:u.signal}),`"${$.name}" could not be attached`),O=B==null?void 0:B.attachment;if(!O||typeof O.$artifact!="string"||!O.$artifact)throw new Error(`"${$.name}" could not be attached: the gateway returned no attachment reference.`);x.push(O)}const v=await Za(await m(Cs("runs/start"),{method:"POST",signal:u.signal,headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(vx({question:l,docs:h,appName:d.name,sessionId:u.sessionId,attachments:x}))}),"The docs-qa workflow could not start"),g=String((v==null?void 0:v.run_id)||"");if(!g)throw new Error("The gateway did not return a run id for the docs-qa workflow.");const w=new AbortController,L=()=>w.abort();u.signal.addEventListener("abort",L,{once:!0}),u.onText&&(async()=>{var $;try{const T=await m(Cs(`runs/${encodeURIComponent(g)}/ledger/stream?after=0`),{signal:w.signal,headers:{Accept:"text/event-stream"}});if(!T.ok||!T.body)return;let B="",O="";for await(const M of bx(T.body,w.signal)){const P=_x(M.event,M.data);!P||hx(P)||P.channel!=="content"||P.run_id!==g||(P.call_id!==B&&(B=P.call_id,O=""),O=P.snapshot?P.text:O+P.text,($=u.onText)==null||$.call(u,O))}}catch{}})();try{const $=Date.now()+r;for(;;){await wx(n,u.signal);const T=await Za(await m(Cs(`runs/${encodeURIComponent(g)}`),{signal:u.signal}),"The docs-qa run could not be read"),B=String((T==null?void 0:T.status)||"").toLowerCase();if(B==="completed"){(A=u.onHistory)==null||A.call(u,(T==null?void 0:T.session_history)??null);const O=Rp(T);if(!O)throw new Error(`The docs-qa run ${g} completed without an answer.`);return O}if(B==="failed"||B==="cancelled"){const O=T==null?void 0:T.error,M=typeof O=="string"?O:typeof(O==null?void 0:O.message)=="string"?O.message:"";throw new Error(`The docs-qa run ${B}${M?`: ${M}`:""}.`)}if(B==="waiting")throw new Error(`The docs-qa run ${g} is waiting for input it should never need. Inspect it in Observer.`);if(Date.now()>=$)throw new Error(`The docs-qa run ${g} is still running after ${Math.round(r/1e3)} s. It stays in the gateway's history.`)}}finally{u.signal.removeEventListener("abort",L),w.abort()}}}async function kx(s,n,r={}){const i=new URLSearchParams({root_only:"true",kind:Mp,limit:"500",include_ledger_len:"false"}),l=await Za(await s(Cs(`runs?${i}`),{signal:r.signal}),"The docs assistant history could not be read"),u=`${String(n||"app")}-docs-assistant:`,m=new Map;for(const h of Array.isArray(l==null?void 0:l.items)?l.items:[]){const x=String((h==null?void 0:h.session_id)||"");if(!x.startsWith(u)||!(h!=null&&h.run_id))continue;const v=m.get(x)||{runs:[],updatedAt:""};v.runs.push({id:String(h.run_id),created:String(h.created_at||"")});const g=String(h.updated_at||h.created_at||"");g>v.updatedAt&&(v.updatedAt=g),m.set(x,v)}const d=[...m.entries()].sort((h,x)=>h[1].updatedAt<x[1].updatedAt?1:-1).slice(0,r.max??20);return Promise.all(d.map(async([h,x])=>{var w;const v=x.runs.sort((L,A)=>L.created<A.created?-1:1).map(L=>L.id);let g="";try{const L=await Za(await s(Cs(`runs/${encodeURIComponent(v[0])}/input_data`),{signal:r.signal}),"");g=String(((w=L==null?void 0:L.input_data)==null?void 0:w.prompt)||"").trim()}catch{g=""}return{sessionId:h,title:g||"Untitled question",updatedAt:x.updatedAt,runIds:v}}))}async function Sx(s,n,r,i){var u;const l=[];for(const m of n.runIds){const[d,h]=await Promise.all([Za(await s(Cs(`runs/${encodeURIComponent(m)}/input_data`),{signal:i}),"A past question could not be read"),Za(await s(Cs(`runs/${encodeURIComponent(m)}`),{signal:i}),"A past answer could not be read")]),x=String(((u=d==null?void 0:d.input_data)==null?void 0:u.prompt)||"").trim();x&&l.push({id:`u-${m}`,role:"user",content:x,ts:String((h==null?void 0:h.created_at)||"")||void 0});const v=Rp(h),g=String((h==null?void 0:h.status)||"").toLowerCase();l.push(v?{id:`a-${m}`,role:"assistant",title:r,content:v,ts:String((h==null?void 0:h.updated_at)||"")||void 0}:{id:`a-${m}`,role:"assistant",title:r,level:"warn",content:g==="completed"?"This answer was empty.":`No answer: the run is ${g||"unknown"}.`})}return l}function Nx(s){const[n,r]=f.useState(null);return s.state==="loading"?e.jsx("div",{className:"pc-docs-history__note",role:"status",children:"Loading past conversations…"}):s.state==="error"?e.jsx("div",{className:"pc-docs-history__note pc-docs-history__note--error",role:"alert",children:s.error||"The history could not be read."}):s.items.length?e.jsx("ul",{className:"pc-docs-history","aria-label":"Past conversations",children:s.items.map(i=>e.jsx("li",{className:`pc-docs-history__row${i.sessionId===s.activeSessionId?" is-active":""}`,children:n===i.sessionId?e.jsxs("div",{className:"pc-docs-history__confirm",children:[e.jsx("span",{children:"Archive this conversation? It stays in the gateway; it leaves this list."}),e.jsx("button",{type:"button",className:"pc-docs-history__btn pc-docs-history__btn--danger",onClick:()=>{r(null),s.onArchive(i)},children:"Archive"}),e.jsx("button",{type:"button",className:"pc-docs-history__btn",onClick:()=>r(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"pc-docs-history__open",onClick:()=>s.onOpen(i),title:i.title,children:[e.jsx("span",{className:"pc-docs-history__title",children:i.title}),e.jsxs("span",{className:"pc-docs-history__meta",children:[pp(i.updatedAt,s.nowMs),i.runIds.length>1?` · ${i.runIds.length} questions`:""]})]}),e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":`Archive "${i.title}"`,"data-af-tip":`Archive "${i.title}" (kept, hidden)`,onClick:()=>r(i.sessionId),children:e.jsx(Ue,{name:"archive",size:16})})]})},i.sessionId))}):e.jsx("div",{className:"pc-docs-history__note",children:"No past conversations yet."})}const Cx=/^image\/(png|jpe?g|gif|webp|avif|bmp|svg\+xml)$/i;function $x(s){const n=f.useRef(null),[r,i]=f.useState(!1),l=!!s.blockedNotice,u=!!s.busy,m=s.files||[],d=typeof s.onAddFiles=="function"&&!l,h=e.jsxs("div",{className:"pc-docs-assistant__empty",children:[e.jsxs("p",{className:"pc-docs-assistant__empty-text",children:["Ask anything about ",s.source.name,"."]}),s.suggestions&&s.suggestions.length?e.jsx("div",{className:"pc-docs-assistant__suggestions",children:s.suggestions.map(x=>e.jsx("button",{type:"button",className:"pc-docs-assistant__suggestion",disabled:u||l,onClick:()=>{var v;return(v=s.onSuggestion)==null?void 0:v.call(s,x)},children:x},x))}):null]});return e.jsxs("div",{className:`pc-docs-assistant${r?" is-dragging":""}`,onDragOver:x=>{var v;!d||!ox((v=x.dataTransfer)==null?void 0:v.types)||(x.preventDefault(),i(!0))},onDragLeave:()=>i(!1),onDrop:x=>{var g,w;if(!d)return;x.preventDefault(),i(!1);const v=Ap(x.dataTransfer);v.files.length&&((g=s.onAddFiles)==null||g.call(s,v.files)),v.folders.length&&((w=s.onNotice)==null||w.call(s,lx(v.folders)))},children:[e.jsx(Rc,{className:"pc-docs-assistant__thread",messages:s.messages,autoScroll:!0,empty:h,messageProps:{showCopy:!0}}),l?e.jsx("div",{className:"pc-docs-assistant__blocked",role:"status",children:s.blockedNotice}):null,s.notice?e.jsx("div",{className:"pc-docs-assistant__notice",role:"status",children:s.notice}):null,e.jsx("div",{className:"pc-docs-assistant__composer",children:e.jsx(ol,{value:s.draft,onChange:s.onDraftChange,onSubmit:s.onSend,placeholder:s.placeholder||`Ask about ${s.source.name}…`,ariaLabel:`Question about ${s.source.name}`,disabled:l,busy:u,rows:1,sendLabel:"Send",busyLabel:"Answering…",onPaste:x=>{var g;if(!d)return;const v=dx(x.clipboardData);v.length&&(x.preventDefault(),(g=s.onAddFiles)==null||g.call(s,v))},leading:m.length?e.jsx("div",{className:"pc-chat-attachments pc-docs-assistant__files",role:"list","aria-label":"Attached files",children:m.map(x=>e.jsxs("span",{role:"listitem",className:"pc-chat-attachment-chip",children:[e.jsx(Ue,{name:"paperclip",size:14}),e.jsx("span",{className:"pc-chat-attachment-name",children:x.name}),s.onRemoveFile&&!u?e.jsx("button",{type:"button",className:"pc-docs-assistant__file-remove","aria-label":`Remove ${x.name}`,"data-af-tip":`Remove ${x.name}`,onClick:()=>{var v;return(v=s.onRemoveFile)==null?void 0:v.call(s,x.id)},children:e.jsx(Ue,{name:"x",size:12})}):null]},x.id))}):null,actions:e.jsxs(e.Fragment,{children:[d?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"Attach files","data-af-tip":"Attach files to your question",disabled:u,onClick:()=>{var x;return(x=n.current)==null?void 0:x.click()},children:e.jsx(Ue,{name:"paperclip",size:16})}),e.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:x=>{var g;const v=Array.from(x.currentTarget.files||[]);x.currentTarget.value="",v.length&&((g=s.onAddFiles)==null||g.call(s,v))}})]}):null,u&&s.onStop?e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"Stop","data-af-tip":"Stop the answer",onClick:s.onStop,children:e.jsx(Ue,{name:"stop",size:14})}):null]})})}),e.jsxs("div",{className:"pc-docs-assistant__footer",title:`Answers come from ${s.source.name}'s documentation (llms.txt) through the gateway's docs-qa workflow.`,children:["Grounded on ",s.source.name,"’s documentation (llms.txt) · docs-qa"]})]})}function vc(){return new Date().toISOString()}function Ex(s){Ud();const{source:n}=s,r=f.useRef(s.fetchGateway);r.current=s.fetchGateway;const i=f.useMemo(()=>s.ask||jx({fetchGateway:(H,X)=>r.current(H,X),source:n}),[s.ask,n.app,n.name]),l=f.useRef(rd(n.app)),[u,m]=f.useState([]),d=f.useRef(u);d.current=u;const[h,x]=f.useState(""),[v,g]=f.useState([]),[w,L]=f.useState(!1),[A,$]=f.useState(""),T=f.useRef(null),[B,O]=f.useState(!1),[M,P]=f.useState({state:"loading",items:[]});f.useEffect(()=>()=>{var H;return(H=T.current)==null?void 0:H.abort()},[]);const E=f.useCallback(async()=>{P(H=>({...H,state:"loading"}));try{const H=await kx((X,Z)=>r.current(X,Z),n.app);P({state:"ready",items:H})}catch(H){P({state:"error",items:[],error:String((H==null?void 0:H.message)||H)})}},[n.app]),Q=f.useCallback(async H=>{var X;(X=T.current)==null||X.abort(),P(Z=>({...Z,state:"loading"}));try{const Z=await Sx((U,Y)=>r.current(U,Y),H,n.name);l.current=H.sessionId,m(Z),$(""),O(!1),P(U=>({...U,state:"ready"}))}catch(Z){P(U=>({...U,state:"error",error:String((Z==null?void 0:Z.message)||Z)}))}},[n.name]),oe=f.useCallback(async H=>{try{const X=await r.current(Cs(`sessions/${encodeURIComponent(H.sessionId)}/archive`),{method:"POST"});if(!X.ok)throw await Lp(X,"The conversation could not be archived");l.current===H.sessionId&&(l.current=rd(n.app),m([])),P(Z=>({...Z,items:Z.items.filter(U=>U.sessionId!==H.sessionId)}))}catch(X){P(Z=>({...Z,state:"error",error:String((X==null?void 0:X.message)||X)}))}},[n.app]);f.useEffect(()=>{var H;s.connected||(H=T.current)==null||H.abort()},[s.connected]),f.useEffect(()=>()=>{for(const H of v)H.preview&&URL.revokeObjectURL(H.preview)},[]);const G=f.useCallback(H=>{$(""),g(X=>[...X,...H.map(Z=>({id:Yo(),file:Z,preview:Cx.test(Z.type)&&typeof URL<"u"&&typeof URL.createObjectURL=="function"?URL.createObjectURL(Z):void 0}))])},[]),Ne=f.useCallback(async H=>{const X=String(H||"").trim();if(!X||w||!s.connected)return;const Z=v;x(""),g([]),$("");const U=Z.filter(he=>he.preview).map(he=>({kind:"image",src:he.preview,label:he.file.name})),Y=Z.map(he=>({id:he.id,label:he.file.name,title:he.file.name,disabled:!0})),I={id:`u-${Yo()}`,role:"user",content:X,ts:vc(),...U.length?{media:U}:{},...Y.length?{attachments:Y}:{}},te=`a-${Yo()}`,ae=[...d.current,I],k={id:te,role:"assistant",title:n.name,content:"",ts:vc(),live:{callId:te,reasoning:"",label:"answering"}};m([...ae,k]),L(!0);const C=new AbortController;T.current=C;const re=he=>m([...ae,he]);try{const he=await i(X,{signal:C.signal,sessionId:l.current,files:Z.map(le=>le.file),onText:le=>{C.signal.aborted||re({...k,content:le,live:{callId:te,reasoning:"",label:"streaming"}})},onHistory:le=>$(xx(le))});C.signal.aborted||re({id:te,role:"assistant",title:n.name,content:he,ts:vc()})}catch(he){const le=C.signal.aborted;re({id:te,role:"assistant",title:n.name,level:le?"warn":"error",content:le?"Stopped. Nothing more will be shown for this question.":String((he==null?void 0:he.message)||he||"The docs assistant failed."),ts:vc()})}finally{T.current===C&&(T.current=null),L(!1)}},[i,w,v,s.connected,n.name]),je=()=>{var H;(H=T.current)==null||H.abort(),l.current=rd(n.app),m([]),g([]),x(""),$("")},we=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:`pc-docs-assistant__icon-btn${B?" is-active":""}`,"aria-label":"Past conversations","data-af-tip":"Past conversations","aria-pressed":B,disabled:!s.connected||w,onClick:()=>{const H=!B;O(H),H&&E()},children:e.jsx(Ue,{name:"history",size:16})}),e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"New conversation","data-af-tip":"Start a new conversation",disabled:!u.length&&!h&&!v.length&&!B,onClick:()=>{je(),O(!1)},children:e.jsx(Ue,{name:"compose",size:16})})]}),ve=e.jsxs(e.Fragment,{children:[B?e.jsx("div",{className:"pc-docs-assistant pc-docs-assistant--history",children:e.jsx(Nx,{items:M.items,state:M.state,error:M.error,nowMs:Date.now(),activeSessionId:l.current,onOpen:H=>void Q(H),onArchive:H=>void oe(H)})}):null,e.jsx("div",{hidden:B,style:{display:B?"none":"contents"},children:e.jsx($x,{source:n,messages:u,draft:h,onDraftChange:x,onSend:()=>void Ne(h),onStop:()=>{var H;return(H=T.current)==null?void 0:H.abort()},busy:w,blockedNotice:s.connected?void 0:"Connect to the gateway to use the docs assistant.",files:v.map(H=>({id:H.id,name:H.file.name})),onAddFiles:G,onNotice:$,onRemoveFile:H=>g(X=>{const Z=X.find(U=>U.id===H);return Z!=null&&Z.preview&&URL.revokeObjectURL(Z.preview),X.filter(U=>U.id!==H)}),notice:A,suggestions:s.suggestions,onSuggestion:H=>void Ne(H),placeholder:s.placeholder})})]});return{headerActions:we,body:ve}}function Tx(s){const{headerActions:n,body:r}=Ex(s);return e.jsx(Nd,{open:s.open,onClose:s.onClose,label:"Docs assistant",title:e.jsxs("span",{className:"pc-docs-assistant__title",children:[e.jsx(Ue,{name:"book",size:16}),"Docs assistant"]}),width:s.width||420,topOffset:s.topOffset,manageFocus:s.manageFocus===!0,className:`pc-docs-assistant-drawer${s.className?` ${s.className}`:""}`,headerActions:n,children:r})}function Ax(s){const n=s.trim();if(!n)throw new Error("AbstractContinuum was built without __APP_VERSION__ (see vite.config.ts define)");return n}const Lx=Ax("0.7.1");function xc(s){return s?s.value!==void 0&&s.value!==null?!!s.value:s.enabled!==void 0?!!s.enabled:s.configured!==void 0?!!s.configured:s.path!==void 0?!!s.path:null:null}function Do(s){if(!s)return"";const n=s.value!==void 0&&s.value!==null?s.value:s.id??s.path??"";return typeof n=="string"?n.trim():""}const lh="abstractcontinuum_gateway_csrf",Mx="x-abstractcontinuum-csrf",Rx="x-abstract-csrf";function id(s){var i;const n=(s||"").trim(),r={};n&&(r.Authorization=`Bearer ${n}`);try{const l=(i=document.cookie.split(";").map(u=>u.trim()).find(u=>u.startsWith(`${lh}=`)))==null?void 0:i.slice(`${lh}=`.length);if(l){const u=decodeURIComponent(l);r[Mx]=u,r[Rx]=u}}catch{}return r}function ch(s){const n={},r=(i,l)=>{const u=String(l||"").trim();u&&(n[i]=u)};return r("provider",s==null?void 0:s.provider),r("model",s==null?void 0:s.model),r("profile",s==null?void 0:s.profile),r("voice",s==null?void 0:s.voice),r("quality_preset",s==null?void 0:s.quality_preset),n}async function Px(s){try{const n=await s.text();return n!=null&&n.trim()?n.trim():`${s.status}`}catch{return`${s.status}`}}class Pp extends Error{constructor(r,i,l){super(r);Ka(this,"status");Ka(this,"body");this.name="GatewayRequestError",this.status=i,this.body=l}}const od=[15,30,60,120];class zx{constructor(n){Ka(this,"_cfg");Ka(this,"_backoff_until",0);Ka(this,"_backoff_step",0);Ka(this,"fetch_gateway",(n,r)=>{const i=new Headers((r==null?void 0:r.headers)||{});for(const[l,u]of Object.entries(id(this._cfg.auth_token)))i.set(l,u);return fetch(Yu(this._cfg.base_url,n),{...r,headers:i})});this._cfg={...n,base_url:(n.base_url||"").trim()}}is_backing_off(){return Date.now()<this._backoff_until}backoff_until(){return this.is_backing_off()?this._backoff_until:0}async _fetch(n,r,i){const l=await fetch(Yu(this._cfg.base_url,r),{...i,headers:{...i==null?void 0:i.headers,...id(this._cfg.auth_token)}});if(l.ok)return this._backoff_step=0,this._backoff_until=0,l;const u=await Px(l);let m=null;try{m=JSON.parse(u)}catch{}let d=u;if(m&&typeof m=="object"&&m.detail!==void 0&&(d=typeof m.detail=="string"?m.detail:JSON.stringify(m.detail)),l.status===429||/too many requests|auth lockout|locked/i.test(d)){const x=od[Math.min(this._backoff_step,od.length-1)];this._backoff_until=Date.now()+x*1e3,this._backoff_step<od.length-1&&(this._backoff_step+=1)}throw new Pp(`${n} failed: ${d}`,l.status,m)}async _get_json(n,r){return await(await this._fetch(n,r)).json()}async _post_json(n,r,i){return await(await this._fetch(n,r,{method:"POST",headers:i===void 0?void 0:{"Content-Type":"application/json"},body:i===void 0?void 0:JSON.stringify(i)})).json()}async _post_form(n,r,i){return await(await this._fetch(n,r,{method:"POST",body:i})).json()}async list_runs(n){const r=new URLSearchParams;r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"?n.limit:50));const i=String((n==null?void 0:n.status)||"").trim();i&&r.set("status",i);const l=String((n==null?void 0:n.session_id)||"").trim();return l&&r.set("session_id",l),(n==null?void 0:n.root_only)===!0&&r.set("root_only","true"),await this._get_json("list_runs",`api/gateway/runs?${r.toString()}`)}async download_run_artifact_content(n,r,i){const l=String(n||"").trim(),u=String(r||"").trim();if(!l)throw new Error("download_run_artifact_content: run_id is required");if(!u)throw new Error("download_run_artifact_content: artifact_id is required");const m=String((i==null?void 0:i.access)||"").trim(),d=m?`?access=${encodeURIComponent(m)}`:"";return await(await this._fetch("download_run_artifact_content",`api/gateway/runs/${encodeURIComponent(l)}/artifacts/${encodeURIComponent(u)}/content${d}`)).blob()}async attachments_upload(n,r,i){const l=String(n||"").trim();if(!l)throw new Error("attachments_upload: session_id is required");if(!r)throw new Error("attachments_upload: file is required");const u=String((i==null?void 0:i.filename)||"").trim()||String((r==null?void 0:r.name)||"").trim()||"upload.bin",m=String((i==null?void 0:i.content_type)||"").trim()||String((r==null?void 0:r.type)||"").trim(),d=new FormData;d.append("session_id",l),d.append("file",r,u),d.append("filename",u),m&&d.append("content_type",m);const h=await this._post_form("attachments_upload","api/gateway/attachments/upload",d),x=h==null?void 0:h.attachment;if(!x||typeof x!="object")throw new Error("attachments_upload: missing attachment");if(!String(x.$artifact||"").trim())throw new Error("attachments_upload: missing attachment.$artifact");return x}async audio_transcribe(n,r){const i=String(n||"").trim();if(!i)throw new Error("audio_transcribe: run_id is required");const l=r==null?void 0:r.audio_artifact;if(!l||typeof l!="object")throw new Error("audio_transcribe: audio_artifact is required");if(!String(l.$artifact||"").trim())throw new Error("audio_transcribe: audio_artifact.$artifact is required");const m={audio_artifact:l},d=String((r==null?void 0:r.language)||"").trim();d&&(m.language=d);const h=String((r==null?void 0:r.request_id)||"").trim();h&&(m.request_id=h);const x=await this._post_json("audio_transcribe",`api/gateway/runs/${encodeURIComponent(i)}/audio/transcribe`,m);return{ok:!!(x!=null&&x.ok),run_id:String((x==null?void 0:x.run_id)||""),request_id:String((x==null?void 0:x.request_id)||""),text:String((x==null?void 0:x.text)||""),transcript_artifact:x==null?void 0:x.transcript_artifact}}async voice_tts(n,r){const i=String(n||"").trim();if(!i)throw new Error("voice_tts: run_id is required");const l=String((r==null?void 0:r.text)||"").trim();if(!l)throw new Error("voice_tts: text is required");const u={text:l,...ch(r)},m=String((r==null?void 0:r.format)||"").trim();m&&(u.format=m),typeof(r==null?void 0:r.timeout_s)=="number"&&r.timeout_s>0&&(u.timeout_s=r.timeout_s);const d=String((r==null?void 0:r.request_id)||"").trim();d&&(u.request_id=d);const h=await this._post_json("voice_tts",`api/gateway/runs/${encodeURIComponent(i)}/voice/tts`,u);return{ok:!!(h!=null&&h.ok),run_id:String((h==null?void 0:h.run_id)||""),request_id:String((h==null?void 0:h.request_id)||""),audio_artifact:h==null?void 0:h.audio_artifact}}async capability_defaults(){return await this._get_json("capability_defaults","api/gateway/config/capability-defaults")}async voice_voices(n){const r=new URLSearchParams({compact:"true"}),i=String((n==null?void 0:n.provider)||"").trim(),l=String((n==null?void 0:n.model)||"").trim();return i&&r.set("provider",i),l&&r.set("model",l),n!=null&&n.providers_only&&r.set("providers_only","true"),await this._get_json("voice_voices",`api/gateway/voice/voices?${r.toString()}`)}voice_stream_transport(n,r){const i=String(n||"").trim();if(!i)throw new Error("voice_stream_transport: run_id is required");return{path:Yu(this._cfg.base_url,`api/gateway/runs/${encodeURIComponent(i)}/voice/tts/stream`),body:{text:String((r==null?void 0:r.text)||""),format:"wav",...ch(r)},headers:id(this._cfg.auth_token)}}async list_bug_reports(){return await this._get_json("list_bug_reports","api/gateway/reports/bugs")}async list_feature_requests(){return await this._get_json("list_feature_requests","api/gateway/reports/features")}async get_bug_report_content(n){const r=String(n||"").trim();if(!r)throw new Error("get_bug_report_content: filename is required");return await this._get_json("get_bug_report_content",`api/gateway/reports/bugs/${encodeURIComponent(r)}/content`)}async get_feature_request_content(n){const r=String(n||"").trim();if(!r)throw new Error("get_feature_request_content: filename is required");return await this._get_json("get_feature_request_content",`api/gateway/reports/features/${encodeURIComponent(r)}/content`)}async bug_report_create(n){return await this._post_json("bug_report_create","api/gateway/bugs/report",uh(n,"bug_report_create"))}async feature_report_create(n){return await this._post_json("feature_report_create","api/gateway/features/report",uh(n,"feature_report_create"))}async email_list_accounts(){return await this._get_json("email_list_accounts","api/gateway/email/accounts")}async email_list_messages(n){const r=new URLSearchParams,i=String((n==null?void 0:n.account)||"").trim();i&&r.set("account",i);const l=String((n==null?void 0:n.mailbox)||"").trim();l&&r.set("mailbox",l);const u=String((n==null?void 0:n.since)||"").trim();u&&r.set("since",u);const m=String((n==null?void 0:n.status)||"").trim();return m&&r.set("status",m),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):20)),await this._get_json("email_list_messages",`api/gateway/email/messages?${r.toString()}`)}async email_read_message(n,r){const i=String(n||"").trim();if(!i)throw new Error("email_read_message: uid is required");const l=new URLSearchParams,u=String((r==null?void 0:r.account)||"").trim();u&&l.set("account",u);const m=String((r==null?void 0:r.mailbox)||"").trim();m&&l.set("mailbox",m);const d=typeof(r==null?void 0:r.max_body_chars)=="number"&&Number.isFinite(r.max_body_chars)?Number(r.max_body_chars):2e4;return l.set("max_body_chars",String(d)),await this._get_json("email_read_message",`api/gateway/email/messages/${encodeURIComponent(i)}?${l.toString()}`)}async email_send(n){if(!String((n==null?void 0:n.subject)||"").trim())throw new Error("email_send: subject is required");return await this._post_json("email_send","api/gateway/email/send",n||{})}async triage_run(n){const r={};return typeof(n==null?void 0:n.write_drafts)=="boolean"&&(r.write_drafts=!!n.write_drafts),typeof(n==null?void 0:n.enable_llm)=="boolean"&&(r.enable_llm=!!n.enable_llm),await this._post_json("triage_run","api/gateway/triage/run",r)}async list_triage_decisions(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):200)),await this._get_json("list_triage_decisions",`api/gateway/triage/decisions?${r.toString()}`)}async apply_triage_decision(n,r){const i=String(n||"").trim();if(!i)throw new Error("apply_triage_decision: decision_id is required");const l=String((r==null?void 0:r.action)||"").trim();if(!l)throw new Error("apply_triage_decision: action is required");const u={action:l};if(l==="defer"){const m=r==null?void 0:r.defer_days;typeof m=="number"&&Number.isFinite(m)&&m>0&&(u.defer_days=Number(m))}return await this._post_json("apply_triage_decision",`api/gateway/triage/decisions/${encodeURIComponent(i)}/apply`,u)}async backlog_list(n){const r=String(n||"").trim();if(!r)throw new Error("backlog_list: kind is required");return await this._get_json("backlog_list",`api/gateway/backlog/${encodeURIComponent(r)}`)}async backlog_content(n,r){const i=String(n||"").trim(),l=String(r||"").trim();if(!i)throw new Error("backlog_content: kind is required");if(!l)throw new Error("backlog_content: filename is required");return await this._get_json("backlog_content",`api/gateway/backlog/${encodeURIComponent(i)}/${encodeURIComponent(l)}/content`)}async backlog_template(){return await this._get_json("backlog_template","api/gateway/backlog/template")}async backlog_status(){return await this._get_json("backlog_status","api/gateway/backlog/status")}async backlog_move(n){const r=String((n==null?void 0:n.from_kind)||"").trim(),i=String((n==null?void 0:n.to_kind)||"").trim(),l=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_move: from_kind is required");if(!i)throw new Error("backlog_move: to_kind is required");if(!l)throw new Error("backlog_move: filename is required");return await this._post_json("backlog_move","api/gateway/backlog/move",{from_kind:r,to_kind:i,filename:l})}async backlog_update(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_update: kind is required");if(!i)throw new Error("backlog_update: filename is required");const l={content:String((n==null?void 0:n.content)??"")},u=String((n==null?void 0:n.expected_sha256)||"").trim();return u&&(l.expected_sha256=u),await this._post_json("backlog_update",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/update`,l)}async backlog_create(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_create: kind is required");if(!i)throw new Error("backlog_create: package is required");if(!l)throw new Error("backlog_create: title is required");const u={kind:r,package:i,title:l},m=String((n==null?void 0:n.task_type)||"").trim();m&&(u.task_type=m);const d=String((n==null?void 0:n.summary)||"").trim();d&&(u.summary=d);const h=(n==null?void 0:n.content)==null?"":String((n==null?void 0:n.content)??"");return h.trim()&&(u.content=h),await this._post_json("backlog_create","api/gateway/backlog/create",u)}async backlog_merge(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim(),u=Array.isArray(n==null?void 0:n.items)?n.items:[];if(!r)throw new Error("backlog_merge: kind is required");if(!i)throw new Error("backlog_merge: package is required");if(!l)throw new Error("backlog_merge: title is required");if(u.length<2)throw new Error("backlog_merge: at least 2 items are required");const m={kind:r,package:i,title:l,items:u.map(x=>({kind:String((x==null?void 0:x.kind)||"").trim(),filename:String((x==null?void 0:x.filename)||"").trim()}))},d=String((n==null?void 0:n.task_type)||"").trim();d&&(m.task_type=d);const h=String((n==null?void 0:n.summary)||"").trim();return h&&(m.summary=h),await this._post_json("backlog_merge","api/gateway/backlog/merge",m)}async backlog_upload_attachment(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim(),l=n==null?void 0:n.file;if(!r)throw new Error("backlog_upload_attachment: kind is required");if(!i)throw new Error("backlog_upload_attachment: filename is required");if(!l)throw new Error("backlog_upload_attachment: file is required");const u=new FormData;return u.set("overwrite",(n==null?void 0:n.overwrite)===!0?"true":"false"),u.set("file",l,l.name||"attachment"),await this._post_form("backlog_upload_attachment",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/attachments/upload`,u)}async backlog_assist(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_assist: kind is required");if(!i)throw new Error("backlog_assist: package is required");if(!l)throw new Error("backlog_assist: title is required");const u={kind:r,package:i,title:l,messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},m=String((n==null?void 0:n.summary)||"").trim();m&&(u.summary=m);const d=(n==null?void 0:n.draft_markdown)==null?"":String(n.draft_markdown??"");d.trim()&&(u.draft_markdown=d);const h=String((n==null?void 0:n.provider)||"").trim();h&&(u.provider=h);const x=String((n==null?void 0:n.model)||"").trim();x&&(u.model=x);const v=String((n==null?void 0:n.thinking)||"").trim();return v&&(u.thinking=v),await this._post_json("backlog_assist","api/gateway/backlog/assist",u)}async backlog_maintain(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim(),l=String((n==null?void 0:n.package)||"").trim(),u=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_maintain: kind is required");if(!i)throw new Error("backlog_maintain: filename is required");if(!l)throw new Error("backlog_maintain: package is required");if(!u)throw new Error("backlog_maintain: title is required");const m={kind:r,filename:i,package:l,title:u,messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},d=String((n==null?void 0:n.summary)||"").trim();d&&(m.summary=d);const h=(n==null?void 0:n.draft_markdown)==null?"":String(n.draft_markdown??"");h.trim()&&(m.draft_markdown=h);const x=String((n==null?void 0:n.provider)||"").trim();x&&(m.provider=x);const v=String((n==null?void 0:n.model)||"").trim();return v&&(m.model=v),await this._post_json("backlog_maintain","api/gateway/backlog/maintain",m)}async backlog_advisor(n){const r={messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},i=String((n==null?void 0:n.provider)||"").trim();i&&(r.provider=i);const l=String((n==null?void 0:n.model)||"").trim();l&&(r.model=l);const u=String((n==null?void 0:n.thinking)||"").trim();u&&(r.thinking=u);const m=String((n==null?void 0:n.agent)||"").trim();m&&(r.agent=m),(n==null?void 0:n.include_trace)===!0&&(r.include_trace=!0);const d=String((n==null?void 0:n.focus_kind)||"").trim();d&&(r.focus_kind=d);const h=String((n==null?void 0:n.focus_type)||"").trim();return h&&(r.focus_type=h),await this._post_json("backlog_advisor","api/gateway/backlog/advisor",r)}async backlog_execute(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_execute: kind is required");if(!i)throw new Error("backlog_execute: filename is required");const l=new URLSearchParams,u=String((n==null?void 0:n.execution_mode)||"").trim();u&&l.set("execution_mode",u);const m=String((n==null?void 0:n.executor)||"").trim();m&&l.set("executor",m);const d=String((n==null?void 0:n.target_model)||"").trim();d&&l.set("target_model",d);const h=String((n==null?void 0:n.target_reasoning_effort)||"").trim();return h&&l.set("target_reasoning_effort",h),(n==null?void 0:n.dor)==="check"&&l.set("dor","check"),(n==null?void 0:n.override)===!0&&l.set("override","true"),await(await this._fetch("backlog_execute",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/execute${l.toString()?`?${l.toString()}`:""}`,{method:"POST"})).json()}async backlog_execute_batch(n){const r=Array.isArray(n==null?void 0:n.items)?n.items:[];if(!r.length)throw new Error("backlog_execute_batch: items are required");const i={items:r.map(h=>({kind:String((h==null?void 0:h.kind)||"").trim(),filename:String((h==null?void 0:h.filename)||"").trim()}))},l=String((n==null?void 0:n.execution_mode)||"").trim();l&&(i.execution_mode=l);const u=String((n==null?void 0:n.executor)||"").trim();u&&(i.executor=u);const m=String((n==null?void 0:n.target_model)||"").trim();m&&(i.target_model=m);const d=String((n==null?void 0:n.target_reasoning_effort)||"").trim();return d&&(i.target_reasoning_effort=d),(n==null?void 0:n.dor)==="check"&&(i.dor="check"),(n==null?void 0:n.override)===!0&&(i.override=!0),await this._post_json("backlog_execute_batch","api/gateway/backlog/execute_batch",i)}async backlog_exec_config(){return await this._get_json("backlog_exec_config","api/gateway/backlog/exec/config")}async backlog_exec_requests(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):200)),await this._get_json("backlog_exec_requests",`api/gateway/backlog/exec/requests?${r.toString()}`)}async backlog_exec_request(n,r){const i=String(n||"").trim();if(!i)throw new Error("backlog_exec_request: request_id is required");const l=new URLSearchParams;return(r==null?void 0:r.include_prompt)===!0&&l.set("include_prompt","true"),await this._get_json("backlog_exec_request",`api/gateway/backlog/exec/requests/${encodeURIComponent(i)}?${l.toString()}`)}async backlog_exec_feedback(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_feedback: request_id is required");const i=String((n==null?void 0:n.feedback)??"");if(!i.trim())throw new Error("backlog_exec_feedback: feedback is required");return await this._post_json("backlog_exec_feedback",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/feedback`,{feedback:i})}async backlog_exec_promote(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_promote: request_id is required");const i={};return(n==null?void 0:n.redeploy)===!0&&(i.redeploy=!0),await this._post_json("backlog_exec_promote",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/promote`,i)}async backlog_exec_deploy_uat(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_deploy_uat: request_id is required");return await this._post_json("backlog_exec_deploy_uat",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/uat/deploy`,{})}async backlog_exec_log_tail(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_log_tail: request_id is required");const i=new URLSearchParams,l=String((n==null?void 0:n.name)||"").trim();l&&i.set("name",l);const u=typeof(n==null?void 0:n.max_bytes)=="number"&&Number.isFinite(n.max_bytes)?Number(n.max_bytes):0;u>0&&i.set("max_bytes",String(Math.floor(u)));const m=typeof(n==null?void 0:n.after_bytes)=="number"&&Number.isFinite(n.after_bytes)?Math.max(0,Math.floor(n.after_bytes)):null;return m!==null&&i.set("after_bytes",String(m)),await this._get_json("backlog_exec_log_tail",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/logs/tail?${i.toString()}`)}async backlog_exec_active_items(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):600)),await this._get_json("backlog_exec_active_items",`api/gateway/backlog/exec/active_items?${r.toString()}`)}async discovery_providers(){return await(await this._fetch("discovery_providers","api/gateway/discovery/providers")).json()}async discovery_model_capabilities(n){const r=String(n||"").trim();if(!r)throw new Error("discovery_model_capabilities: model_name is required");return await(await this._fetch("discovery_model_capabilities",`api/gateway/discovery/models/capabilities?model_name=${encodeURIComponent(r)}`)).json()}async discovery_provider_models(n){const r=String(n||"").trim();if(!r)throw new Error("discovery_provider_models: provider is required");return await(await this._fetch("discovery_provider_models",`api/gateway/discovery/providers/${encodeURIComponent(r)}/models`)).json()}async list_entities(){return await(await this._fetch("list_entities","api/gateway/entities")).json()}async admin_runtime_config(){return await(await this._fetch("admin_runtime_config","api/gateway/admin/runtime-config")).json()}async admin_executors(){return await(await this._fetch("admin_executors","api/gateway/admin/executors")).json()}async admin_runtime_config_update(n){return await(await this._fetch("admin_runtime_config_update","api/gateway/admin/runtime-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})})).json()}async entity_state(n,r){return await(await this._fetch("entity_state",`api/gateway/entities/${encodeURIComponent(n)}/state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()}async entity_skills(n){return await(await this._fetch("entity_skills",`api/gateway/entities/${encodeURIComponent(n)}/skills`)).json()}async put_entity_skills(n,r){return await(await this._fetch("put_entity_skills",`api/gateway/entities/${encodeURIComponent(n)}/skills`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({skills:r})})).json()}async list_bundles(){return await(await this._fetch("list_bundles","api/gateway/bundles")).json()}async admin_data_homes(){return await(await this._fetch("admin_data_homes","api/gateway/admin/data-homes")).json()}async gateway_about(){return await this._get_json("gateway_about","api/gateway/about")}async list_processes(){return await this._get_json("list_processes","api/gateway/processes")}async list_process_env_vars(){return await this._get_json("list_process_env_vars","api/gateway/processes/env")}async update_process_env_vars(n){const r={},i=n!=null&&n.set&&typeof n.set=="object"?n.set:{},l=Array.isArray(n==null?void 0:n.unset)?n==null?void 0:n.unset:[];return i&&Object.keys(i).length&&(r.set=i),l&&l.length&&(r.unset=l),await this._post_json("update_process_env_vars","api/gateway/processes/env",r)}async start_process(n){const r=String(n||"").trim();return await this._post_json("start_process",`api/gateway/processes/${encodeURIComponent(r)}/start`)}async stop_process(n){const r=String(n||"").trim();return await this._post_json("stop_process",`api/gateway/processes/${encodeURIComponent(r)}/stop`)}async restart_process(n){const r=String(n||"").trim();return await this._post_json("restart_process",`api/gateway/processes/${encodeURIComponent(r)}/restart`)}async redeploy_process(n){const r=String(n||"").trim();return await this._post_json("redeploy_process",`api/gateway/processes/${encodeURIComponent(r)}/redeploy`)}async process_log_tail(n,r){const i=String(n||"").trim(),l=typeof(r==null?void 0:r.max_bytes)=="number"?Math.max(1024,Math.min(4e5,Math.floor(r.max_bytes))):8e4;return await this._get_json("process_log_tail",`api/gateway/processes/${encodeURIComponent(i)}/logs/tail?max_bytes=${encodeURIComponent(String(l))}`)}}function uh(s,n){const r=String((s==null?void 0:s.session_id)||"").trim();if(!r)throw new Error(`${n}: session_id is required`);const i=String((s==null?void 0:s.description)||"").trim();if(!i)throw new Error(`${n}: description is required`);const l={session_id:r,description:i};for(const m of["active_run_id","workflow_id","client","client_version","user_agent","url","provider","model","template"]){const d=String((s==null?void 0:s[m])||"").trim();d&&(l[m]=d)}const u=s==null?void 0:s.context;return u&&typeof u=="object"&&(l.context=u),l}const dh={framework:null,gateway:null,gatewayNote:"checking…"};function Ix(s){if(s instanceof Pp){const r=s.message.replace(/^gateway_about failed:\s*/,"").trim();return`HTTP ${s.status}${r&&r!==String(s.status)?`: ${r}`:""}`}return(s instanceof Error?s.message:String(s))||"request failed"}async function Dx(s){let n;try{n=await s.gateway_about()}catch(r){return Xo(null,Ix(r))}return Xo(n)}const mh=Hd("voice and camera")??"Voice and camera are not supported in this browser (getUserMedia unavailable).",Ox="Copy failed — select and copy";function fh(){var n;const s=globalThis.navigator;return typeof((n=s==null?void 0:s.mediaDevices)==null?void 0:n.getUserMedia)=="function"}function Fx(s){var l;const n=globalThis.document;if(!n||!n.body||typeof n.execCommand!="function")return!1;const r=n.createElement("textarea");r.value=s,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="0",r.style.left="-9999px",r.style.opacity="0";const i=n.activeElement;n.body.appendChild(r);try{return r.select(),r.setSelectionRange(0,s.length),n.execCommand("copy")===!0}catch{return!1}finally{n.body.removeChild(r);try{(l=i==null?void 0:i.focus)==null||l.call(i)}catch{}}}async function qx(s){var i;const n=String(s??""),r=globalThis.navigator;if(typeof((i=r==null?void 0:r.clipboard)==null?void 0:i.writeText)=="function")try{return await r.clipboard.writeText(n),!0}catch{}return Fx(n)}const Bx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Ux(s){const n=s.length,r=new Uint8Array(n+9+63>>6<<6);r.set(s),r[n]=128;const i=new DataView(r.buffer);i.setUint32(r.length-8,Math.floor(n/536870912),!1),i.setUint32(r.length-4,n<<3>>>0,!1);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),m=(d,h)=>d>>>h|d<<32-h;for(let d=0;d<r.length;d+=64){for(let T=0;T<16;T++)u[T]=i.getUint32(d+T*4,!1);for(let T=16;T<64;T++){const B=m(u[T-15],7)^m(u[T-15],18)^u[T-15]>>>3,O=m(u[T-2],17)^m(u[T-2],19)^u[T-2]>>>10;u[T]=u[T-16]+B+u[T-7]+O>>>0}let[h,x,v,g,w,L,A,$]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let T=0;T<64;T++){const B=m(w,6)^m(w,11)^m(w,25),O=w&L^~w&A,M=$+B+O+Bx[T]+u[T]>>>0,P=m(h,2)^m(h,13)^m(h,22),E=h&x^h&v^x&v,Q=P+E>>>0;$=A,A=L,L=w,w=g+M>>>0,g=v,v=x,x=h,h=M+Q>>>0}l[0]=l[0]+h>>>0,l[1]=l[1]+x>>>0,l[2]=l[2]+v>>>0,l[3]=l[3]+g>>>0,l[4]=l[4]+w>>>0,l[5]=l[5]+L>>>0,l[6]=l[6]+A>>>0,l[7]=l[7]+$>>>0}return Array.from(l,d=>d.toString(16).padStart(8,"0")).join("")}async function zp(s){var i;const n=new TextEncoder().encode(String(s??"")),r=(i=globalThis.crypto)==null?void 0:i.subtle;if(r&&typeof r.digest=="function"){const l=await r.digest("SHA-256",n);return Array.from(new Uint8Array(l),u=>u.toString(16).padStart(2,"0")).join("")}return Ux(n)}const Wx=/^[a-zA-Z0-9_-]+$/;function hh(s){return Wx.test(String(s||"").trim())}async function Hx(s){const n=String(s||""),r=new TextEncoder().encode(n),i=globalThis.crypto;if(!i||!i.subtle||typeof i.subtle.digest!="function")return"";const l=await i.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(l)).map(u=>u.toString(16).padStart(2,"0")).join("")}async function Gd(s){const n=String(s||"").trim();if(!n)throw new Error("session_id is required");if(hh(n)){const i=`session_memory_${n}`;if(hh(i))return i}return`session_memory_sha_${(await Hx(n)).slice(0,32)}`}const er=["bug","feature","improvement","task"];function tl(s){return String(s||"").trim().toLowerCase()}function Ip(s){return er.includes(tl(s))}function Dp(s){const n=tl(s);return Ip(n)?n:"task"}function Op(s){return s.toUpperCase()}function Fp(s){return s==="bug"?"danger":s==="feature"?"ok":s==="improvement"?"info":s==="task"?"task":"muted"}function qp(s){return Ip(s)?void 0:`"${s}" is not in the ruled type vocabulary (${er.join(" / ")})`}function Bp(s){const n=String(s||"").trim();return n.replace(/^\[(bug|feature|improvement|task)\]\s*/i,"").trim()||n}function _a(s,n){const r=String(s||"");return r.length<=n?r:`${r.slice(0,Math.max(0,n-1))}…`}function $d(s=new Date){const n=d=>String(d).padStart(2,"0"),r=-s.getTimezoneOffset(),i=r>=0?"+":"-",l=Math.abs(r),u=n(Math.floor(l/60)),m=n(l%60);return`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())} ${n(s.getHours())}:${n(s.getMinutes())}:${n(s.getSeconds())} ${i}${u}${m}`}function Vx(s){try{return JSON.parse(s)}catch{return null}}function ph(s,n){return s.scrollHeight-s.scrollTop-s.clientHeight<=n}function ld(s){const n=typeof s=="string"?s.trim():"";if(!n)return null;const r=n.replace(/(\.\d{3})\d+/,"$1"),i=Date.parse(r);return Number.isFinite(i)?i:null}function Hs(s){if(!Number.isFinite(s))return"";const n=Math.max(0,Math.floor(s/1e3)),r=n%60,i=Math.floor(n/60),l=i%60,u=Math.floor(i/60),m=u%24,d=Math.floor(u/24);return d>0?`${d}d ${m}h`:u>0?`${u}h ${l}m`:i>0?`${i}m ${r}s`:`${n}s`}async function Ed(s){return zp(String(s||""))}function Zo(s){const n=String(s||"").trim().toLowerCase();return n==="completed"||n==="promoted"?"ok":n==="failed"?"danger":n==="running"?"info":n==="queued"||n==="awaiting_qa"?"warn":"muted"}function Gx(s,n){return s==="processing"?"queued,running,awaiting_qa":s==="failed"?"failed":s==="completed"&&n==="runs"?"completed,promoted":""}function Oo(s,n){const r=s&&typeof s=="object"?s:{},i=r.backlog&&typeof r.backlog=="object"?r.backlog:{},l=r.result&&typeof r.result=="object"?r.result:{},u=r.executor&&typeof r.executor=="object"?r.executor:{},m=String(l.last_message||"").trim(),d=String(r.target_model||u.model||"").trim(),h=String(r.target_reasoning_effort||u.reasoning_effort||"").trim();return{request_id:n,status:String(r.status||"unknown"),created_at:r.created_at??null,started_at:r.started_at??null,finished_at:r.finished_at??null,backlog_relpath:i.relpath??null,backlog_kind:i.kind??null,backlog_filename:i.filename??null,target_agent:r.target_agent??null,target_model:d||null,target_reasoning_effort:h||null,executor_type:u.type??null,ok:typeof l.ok=="boolean"?l.ok:null,exit_code:typeof l.exit_code=="number"?l.exit_code:l.exit_code??null,error:typeof l.error=="string"?l.error:l.error??null,run_dir_relpath:r.run_dir_relpath??null,last_message:Kx(m)}}const cd=1200;function Kx(s){const n=String(s||"");return n?n.length<=cd?n:`${n.slice(0,cd)}
|
|
60
|
+
`)}}}finally{n==null||n.removeEventListener("abort",u)}}function wx(s,n){return new Promise((r,i)=>{if(n.aborted)return i(new DOMException("Aborted","AbortError"));const l=setTimeout(()=>{n.removeEventListener("abort",u),r()},s),u=()=>{clearTimeout(l),i(new DOMException("Aborted","AbortError"))};n.addEventListener("abort",u,{once:!0})})}async function Za(s,n){if(!s.ok)throw await Lp(s,n);return s.json()}function jx(s){const n=s.pollMs??1e3,r=s.timeoutMs??18e4;let i=null;return async(l,u)=>{var A;const{fetchGateway:m,source:d}=s;if(i===null){const $=await m(yx(d.app),{signal:u.signal,headers:{Accept:"application/json"}}),T=await Za($,`The ${d.name} documentation could not be read, so nothing was asked`),B=typeof(T==null?void 0:T.text)=="string"?T.text:"";if(!B.trim())throw new Error(`The gateway returned an empty ${d.name} documentation corpus, so nothing was asked.`);i=B}const h=String(i),x=[];for(const $ of u.files||[]){const T=new FormData;T.append("session_id",u.sessionId),T.append("file",$,$.name||"upload.bin"),T.append("filename",$.name||"upload.bin"),$.type&&T.append("content_type",$.type);const B=await Za(await m(Cs("attachments/upload"),{method:"POST",body:T,signal:u.signal}),`"${$.name}" could not be attached`),O=B==null?void 0:B.attachment;if(!O||typeof O.$artifact!="string"||!O.$artifact)throw new Error(`"${$.name}" could not be attached: the gateway returned no attachment reference.`);x.push(O)}const v=await Za(await m(Cs("runs/start"),{method:"POST",signal:u.signal,headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(vx({question:l,docs:h,appName:d.name,sessionId:u.sessionId,attachments:x}))}),"The docs-qa workflow could not start"),g=String((v==null?void 0:v.run_id)||"");if(!g)throw new Error("The gateway did not return a run id for the docs-qa workflow.");const w=new AbortController,L=()=>w.abort();u.signal.addEventListener("abort",L,{once:!0}),u.onText&&(async()=>{var $;try{const T=await m(Cs(`runs/${encodeURIComponent(g)}/ledger/stream?after=0`),{signal:w.signal,headers:{Accept:"text/event-stream"}});if(!T.ok||!T.body)return;let B="",O="";for await(const M of bx(T.body,w.signal)){const P=_x(M.event,M.data);!P||hx(P)||P.channel!=="content"||P.run_id!==g||(P.call_id!==B&&(B=P.call_id,O=""),O=P.snapshot?P.text:O+P.text,($=u.onText)==null||$.call(u,O))}}catch{}})();try{const $=Date.now()+r;for(;;){await wx(n,u.signal);const T=await Za(await m(Cs(`runs/${encodeURIComponent(g)}`),{signal:u.signal}),"The docs-qa run could not be read"),B=String((T==null?void 0:T.status)||"").toLowerCase();if(B==="completed"){(A=u.onHistory)==null||A.call(u,(T==null?void 0:T.session_history)??null);const O=Rp(T);if(!O)throw new Error(`The docs-qa run ${g} completed without an answer.`);return O}if(B==="failed"||B==="cancelled"){const O=T==null?void 0:T.error,M=typeof O=="string"?O:typeof(O==null?void 0:O.message)=="string"?O.message:"";throw new Error(`The docs-qa run ${B}${M?`: ${M}`:""}.`)}if(B==="waiting")throw new Error(`The docs-qa run ${g} is waiting for input it should never need. Inspect it in Observer.`);if(Date.now()>=$)throw new Error(`The docs-qa run ${g} is still running after ${Math.round(r/1e3)} s. It stays in the gateway's history.`)}}finally{u.signal.removeEventListener("abort",L),w.abort()}}}async function kx(s,n,r={}){const i=new URLSearchParams({root_only:"true",kind:Mp,limit:"500",include_ledger_len:"false"}),l=await Za(await s(Cs(`runs?${i}`),{signal:r.signal}),"The docs assistant history could not be read"),u=`${String(n||"app")}-docs-assistant:`,m=new Map;for(const h of Array.isArray(l==null?void 0:l.items)?l.items:[]){const x=String((h==null?void 0:h.session_id)||"");if(!x.startsWith(u)||!(h!=null&&h.run_id))continue;const v=m.get(x)||{runs:[],updatedAt:""};v.runs.push({id:String(h.run_id),created:String(h.created_at||"")});const g=String(h.updated_at||h.created_at||"");g>v.updatedAt&&(v.updatedAt=g),m.set(x,v)}const d=[...m.entries()].sort((h,x)=>h[1].updatedAt<x[1].updatedAt?1:-1).slice(0,r.max??20);return Promise.all(d.map(async([h,x])=>{var w;const v=x.runs.sort((L,A)=>L.created<A.created?-1:1).map(L=>L.id);let g="";try{const L=await Za(await s(Cs(`runs/${encodeURIComponent(v[0])}/input_data`),{signal:r.signal}),"");g=String(((w=L==null?void 0:L.input_data)==null?void 0:w.prompt)||"").trim()}catch{g=""}return{sessionId:h,title:g||"Untitled question",updatedAt:x.updatedAt,runIds:v}}))}async function Sx(s,n,r,i){var u;const l=[];for(const m of n.runIds){const[d,h]=await Promise.all([Za(await s(Cs(`runs/${encodeURIComponent(m)}/input_data`),{signal:i}),"A past question could not be read"),Za(await s(Cs(`runs/${encodeURIComponent(m)}`),{signal:i}),"A past answer could not be read")]),x=String(((u=d==null?void 0:d.input_data)==null?void 0:u.prompt)||"").trim();x&&l.push({id:`u-${m}`,role:"user",content:x,ts:String((h==null?void 0:h.created_at)||"")||void 0});const v=Rp(h),g=String((h==null?void 0:h.status)||"").toLowerCase();l.push(v?{id:`a-${m}`,role:"assistant",title:r,content:v,ts:String((h==null?void 0:h.updated_at)||"")||void 0}:{id:`a-${m}`,role:"assistant",title:r,level:"warn",content:g==="completed"?"This answer was empty.":`No answer: the run is ${g||"unknown"}.`})}return l}function Nx(s){const[n,r]=f.useState(null);return s.state==="loading"?e.jsx("div",{className:"pc-docs-history__note",role:"status",children:"Loading past conversations…"}):s.state==="error"?e.jsx("div",{className:"pc-docs-history__note pc-docs-history__note--error",role:"alert",children:s.error||"The history could not be read."}):s.items.length?e.jsx("ul",{className:"pc-docs-history","aria-label":"Past conversations",children:s.items.map(i=>e.jsx("li",{className:`pc-docs-history__row${i.sessionId===s.activeSessionId?" is-active":""}`,children:n===i.sessionId?e.jsxs("div",{className:"pc-docs-history__confirm",children:[e.jsx("span",{children:"Archive this conversation? It stays in the gateway; it leaves this list."}),e.jsx("button",{type:"button",className:"pc-docs-history__btn pc-docs-history__btn--danger",onClick:()=>{r(null),s.onArchive(i)},children:"Archive"}),e.jsx("button",{type:"button",className:"pc-docs-history__btn",onClick:()=>r(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"pc-docs-history__open",onClick:()=>s.onOpen(i),title:i.title,children:[e.jsx("span",{className:"pc-docs-history__title",children:i.title}),e.jsxs("span",{className:"pc-docs-history__meta",children:[pp(i.updatedAt,s.nowMs),i.runIds.length>1?` · ${i.runIds.length} questions`:""]})]}),e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":`Archive "${i.title}"`,"data-af-tip":`Archive "${i.title}" (kept, hidden)`,onClick:()=>r(i.sessionId),children:e.jsx(Ue,{name:"archive",size:16})})]})},i.sessionId))}):e.jsx("div",{className:"pc-docs-history__note",children:"No past conversations yet."})}const Cx=/^image\/(png|jpe?g|gif|webp|avif|bmp|svg\+xml)$/i;function $x(s){const n=f.useRef(null),[r,i]=f.useState(!1),l=!!s.blockedNotice,u=!!s.busy,m=s.files||[],d=typeof s.onAddFiles=="function"&&!l,h=e.jsxs("div",{className:"pc-docs-assistant__empty",children:[e.jsxs("p",{className:"pc-docs-assistant__empty-text",children:["Ask anything about ",s.source.name,"."]}),s.suggestions&&s.suggestions.length?e.jsx("div",{className:"pc-docs-assistant__suggestions",children:s.suggestions.map(x=>e.jsx("button",{type:"button",className:"pc-docs-assistant__suggestion",disabled:u||l,onClick:()=>{var v;return(v=s.onSuggestion)==null?void 0:v.call(s,x)},children:x},x))}):null]});return e.jsxs("div",{className:`pc-docs-assistant${r?" is-dragging":""}`,onDragOver:x=>{var v;!d||!ox((v=x.dataTransfer)==null?void 0:v.types)||(x.preventDefault(),i(!0))},onDragLeave:()=>i(!1),onDrop:x=>{var g,w;if(!d)return;x.preventDefault(),i(!1);const v=Ap(x.dataTransfer);v.files.length&&((g=s.onAddFiles)==null||g.call(s,v.files)),v.folders.length&&((w=s.onNotice)==null||w.call(s,lx(v.folders)))},children:[e.jsx(Rc,{className:"pc-docs-assistant__thread",messages:s.messages,autoScroll:!0,empty:h,messageProps:{showCopy:!0}}),l?e.jsx("div",{className:"pc-docs-assistant__blocked",role:"status",children:s.blockedNotice}):null,s.notice?e.jsx("div",{className:"pc-docs-assistant__notice",role:"status",children:s.notice}):null,e.jsx("div",{className:"pc-docs-assistant__composer",children:e.jsx(ol,{value:s.draft,onChange:s.onDraftChange,onSubmit:s.onSend,placeholder:s.placeholder||`Ask about ${s.source.name}…`,ariaLabel:`Question about ${s.source.name}`,disabled:l,busy:u,rows:1,sendLabel:"Send",busyLabel:"Answering…",onPaste:x=>{var g;if(!d)return;const v=dx(x.clipboardData);v.length&&(x.preventDefault(),(g=s.onAddFiles)==null||g.call(s,v))},leading:m.length?e.jsx("div",{className:"pc-chat-attachments pc-docs-assistant__files",role:"list","aria-label":"Attached files",children:m.map(x=>e.jsxs("span",{role:"listitem",className:"pc-chat-attachment-chip",children:[e.jsx(Ue,{name:"paperclip",size:14}),e.jsx("span",{className:"pc-chat-attachment-name",children:x.name}),s.onRemoveFile&&!u?e.jsx("button",{type:"button",className:"pc-docs-assistant__file-remove","aria-label":`Remove ${x.name}`,"data-af-tip":`Remove ${x.name}`,onClick:()=>{var v;return(v=s.onRemoveFile)==null?void 0:v.call(s,x.id)},children:e.jsx(Ue,{name:"x",size:12})}):null]},x.id))}):null,actions:e.jsxs(e.Fragment,{children:[d?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"Attach files","data-af-tip":"Attach files to your question",disabled:u,onClick:()=>{var x;return(x=n.current)==null?void 0:x.click()},children:e.jsx(Ue,{name:"paperclip",size:16})}),e.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:x=>{var g;const v=Array.from(x.currentTarget.files||[]);x.currentTarget.value="",v.length&&((g=s.onAddFiles)==null||g.call(s,v))}})]}):null,u&&s.onStop?e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"Stop","data-af-tip":"Stop the answer",onClick:s.onStop,children:e.jsx(Ue,{name:"stop",size:14})}):null]})})}),e.jsxs("div",{className:"pc-docs-assistant__footer",title:`Answers come from ${s.source.name}'s documentation (llms.txt) through the gateway's docs-qa workflow.`,children:["Grounded on ",s.source.name,"’s documentation (llms.txt) · docs-qa"]})]})}function vc(){return new Date().toISOString()}function Ex(s){Ud();const{source:n}=s,r=f.useRef(s.fetchGateway);r.current=s.fetchGateway;const i=f.useMemo(()=>s.ask||jx({fetchGateway:(H,X)=>r.current(H,X),source:n}),[s.ask,n.app,n.name]),l=f.useRef(rd(n.app)),[u,m]=f.useState([]),d=f.useRef(u);d.current=u;const[h,x]=f.useState(""),[v,g]=f.useState([]),[w,L]=f.useState(!1),[A,$]=f.useState(""),T=f.useRef(null),[B,O]=f.useState(!1),[M,P]=f.useState({state:"loading",items:[]});f.useEffect(()=>()=>{var H;return(H=T.current)==null?void 0:H.abort()},[]);const E=f.useCallback(async()=>{P(H=>({...H,state:"loading"}));try{const H=await kx((X,Z)=>r.current(X,Z),n.app);P({state:"ready",items:H})}catch(H){P({state:"error",items:[],error:String((H==null?void 0:H.message)||H)})}},[n.app]),Q=f.useCallback(async H=>{var X;(X=T.current)==null||X.abort(),P(Z=>({...Z,state:"loading"}));try{const Z=await Sx((U,Y)=>r.current(U,Y),H,n.name);l.current=H.sessionId,m(Z),$(""),O(!1),P(U=>({...U,state:"ready"}))}catch(Z){P(U=>({...U,state:"error",error:String((Z==null?void 0:Z.message)||Z)}))}},[n.name]),oe=f.useCallback(async H=>{try{const X=await r.current(Cs(`sessions/${encodeURIComponent(H.sessionId)}/archive`),{method:"POST"});if(!X.ok)throw await Lp(X,"The conversation could not be archived");l.current===H.sessionId&&(l.current=rd(n.app),m([])),P(Z=>({...Z,items:Z.items.filter(U=>U.sessionId!==H.sessionId)}))}catch(X){P(Z=>({...Z,state:"error",error:String((X==null?void 0:X.message)||X)}))}},[n.app]);f.useEffect(()=>{var H;s.connected||(H=T.current)==null||H.abort()},[s.connected]),f.useEffect(()=>()=>{for(const H of v)H.preview&&URL.revokeObjectURL(H.preview)},[]);const G=f.useCallback(H=>{$(""),g(X=>[...X,...H.map(Z=>({id:Yo(),file:Z,preview:Cx.test(Z.type)&&typeof URL<"u"&&typeof URL.createObjectURL=="function"?URL.createObjectURL(Z):void 0}))])},[]),Ne=f.useCallback(async H=>{const X=String(H||"").trim();if(!X||w||!s.connected)return;const Z=v;x(""),g([]),$("");const U=Z.filter(he=>he.preview).map(he=>({kind:"image",src:he.preview,label:he.file.name})),Y=Z.map(he=>({id:he.id,label:he.file.name,title:he.file.name,disabled:!0})),I={id:`u-${Yo()}`,role:"user",content:X,ts:vc(),...U.length?{media:U}:{},...Y.length?{attachments:Y}:{}},te=`a-${Yo()}`,ae=[...d.current,I],k={id:te,role:"assistant",title:n.name,content:"",ts:vc(),live:{callId:te,reasoning:"",label:"answering"}};m([...ae,k]),L(!0);const C=new AbortController;T.current=C;const re=he=>m([...ae,he]);try{const he=await i(X,{signal:C.signal,sessionId:l.current,files:Z.map(le=>le.file),onText:le=>{C.signal.aborted||re({...k,content:le,live:{callId:te,reasoning:"",label:"streaming"}})},onHistory:le=>$(xx(le))});C.signal.aborted||re({id:te,role:"assistant",title:n.name,content:he,ts:vc()})}catch(he){const le=C.signal.aborted;re({id:te,role:"assistant",title:n.name,level:le?"warn":"error",content:le?"Stopped. Nothing more will be shown for this question.":String((he==null?void 0:he.message)||he||"The docs assistant failed."),ts:vc()})}finally{T.current===C&&(T.current=null),L(!1)}},[i,w,v,s.connected,n.name]),je=()=>{var H;(H=T.current)==null||H.abort(),l.current=rd(n.app),m([]),g([]),x(""),$("")},we=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:`pc-docs-assistant__icon-btn${B?" is-active":""}`,"aria-label":"Past conversations","data-af-tip":"Past conversations","aria-pressed":B,disabled:!s.connected||w,onClick:()=>{const H=!B;O(H),H&&E()},children:e.jsx(Ue,{name:"history",size:16})}),e.jsx("button",{type:"button",className:"pc-docs-assistant__icon-btn","aria-label":"New conversation","data-af-tip":"Start a new conversation",disabled:!u.length&&!h&&!v.length&&!B,onClick:()=>{je(),O(!1)},children:e.jsx(Ue,{name:"compose",size:16})})]}),ve=e.jsxs(e.Fragment,{children:[B?e.jsx("div",{className:"pc-docs-assistant pc-docs-assistant--history",children:e.jsx(Nx,{items:M.items,state:M.state,error:M.error,nowMs:Date.now(),activeSessionId:l.current,onOpen:H=>void Q(H),onArchive:H=>void oe(H)})}):null,e.jsx("div",{hidden:B,style:{display:B?"none":"contents"},children:e.jsx($x,{source:n,messages:u,draft:h,onDraftChange:x,onSend:()=>void Ne(h),onStop:()=>{var H;return(H=T.current)==null?void 0:H.abort()},busy:w,blockedNotice:s.connected?void 0:"Connect to the gateway to use the docs assistant.",files:v.map(H=>({id:H.id,name:H.file.name})),onAddFiles:G,onNotice:$,onRemoveFile:H=>g(X=>{const Z=X.find(U=>U.id===H);return Z!=null&&Z.preview&&URL.revokeObjectURL(Z.preview),X.filter(U=>U.id!==H)}),notice:A,suggestions:s.suggestions,onSuggestion:H=>void Ne(H),placeholder:s.placeholder})})]});return{headerActions:we,body:ve}}function Tx(s){const{headerActions:n,body:r}=Ex(s);return e.jsx(Nd,{open:s.open,onClose:s.onClose,label:"Docs assistant",title:e.jsxs("span",{className:"pc-docs-assistant__title",children:[e.jsx(Ue,{name:"book",size:16}),"Docs assistant"]}),width:s.width||420,topOffset:s.topOffset,manageFocus:s.manageFocus===!0,className:`pc-docs-assistant-drawer${s.className?` ${s.className}`:""}`,headerActions:n,children:r})}function Ax(s){const n=s.trim();if(!n)throw new Error("AbstractContinuum was built without __APP_VERSION__ (see vite.config.ts define)");return n}const Lx=Ax("0.7.2");function xc(s){return s?s.value!==void 0&&s.value!==null?!!s.value:s.enabled!==void 0?!!s.enabled:s.configured!==void 0?!!s.configured:s.path!==void 0?!!s.path:null:null}function Do(s){if(!s)return"";const n=s.value!==void 0&&s.value!==null?s.value:s.id??s.path??"";return typeof n=="string"?n.trim():""}const lh="abstractcontinuum_gateway_csrf",Mx="x-abstractcontinuum-csrf",Rx="x-abstract-csrf";function id(s){var i;const n=(s||"").trim(),r={};n&&(r.Authorization=`Bearer ${n}`);try{const l=(i=document.cookie.split(";").map(u=>u.trim()).find(u=>u.startsWith(`${lh}=`)))==null?void 0:i.slice(`${lh}=`.length);if(l){const u=decodeURIComponent(l);r[Mx]=u,r[Rx]=u}}catch{}return r}function ch(s){const n={},r=(i,l)=>{const u=String(l||"").trim();u&&(n[i]=u)};return r("provider",s==null?void 0:s.provider),r("model",s==null?void 0:s.model),r("profile",s==null?void 0:s.profile),r("voice",s==null?void 0:s.voice),r("quality_preset",s==null?void 0:s.quality_preset),n}async function Px(s){try{const n=await s.text();return n!=null&&n.trim()?n.trim():`${s.status}`}catch{return`${s.status}`}}class Pp extends Error{constructor(r,i,l){super(r);Ka(this,"status");Ka(this,"body");this.name="GatewayRequestError",this.status=i,this.body=l}}const od=[15,30,60,120];class zx{constructor(n){Ka(this,"_cfg");Ka(this,"_backoff_until",0);Ka(this,"_backoff_step",0);Ka(this,"fetch_gateway",(n,r)=>{const i=new Headers((r==null?void 0:r.headers)||{});for(const[l,u]of Object.entries(id(this._cfg.auth_token)))i.set(l,u);return fetch(Yu(this._cfg.base_url,n),{...r,headers:i})});this._cfg={...n,base_url:(n.base_url||"").trim()}}is_backing_off(){return Date.now()<this._backoff_until}backoff_until(){return this.is_backing_off()?this._backoff_until:0}async _fetch(n,r,i){const l=await fetch(Yu(this._cfg.base_url,r),{...i,headers:{...i==null?void 0:i.headers,...id(this._cfg.auth_token)}});if(l.ok)return this._backoff_step=0,this._backoff_until=0,l;const u=await Px(l);let m=null;try{m=JSON.parse(u)}catch{}let d=u;if(m&&typeof m=="object"&&m.detail!==void 0&&(d=typeof m.detail=="string"?m.detail:JSON.stringify(m.detail)),l.status===429||/too many requests|auth lockout|locked/i.test(d)){const x=od[Math.min(this._backoff_step,od.length-1)];this._backoff_until=Date.now()+x*1e3,this._backoff_step<od.length-1&&(this._backoff_step+=1)}throw new Pp(`${n} failed: ${d}`,l.status,m)}async _get_json(n,r){return await(await this._fetch(n,r)).json()}async _post_json(n,r,i){return await(await this._fetch(n,r,{method:"POST",headers:i===void 0?void 0:{"Content-Type":"application/json"},body:i===void 0?void 0:JSON.stringify(i)})).json()}async _post_form(n,r,i){return await(await this._fetch(n,r,{method:"POST",body:i})).json()}async list_runs(n){const r=new URLSearchParams;r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"?n.limit:50));const i=String((n==null?void 0:n.status)||"").trim();i&&r.set("status",i);const l=String((n==null?void 0:n.session_id)||"").trim();return l&&r.set("session_id",l),(n==null?void 0:n.root_only)===!0&&r.set("root_only","true"),await this._get_json("list_runs",`api/gateway/runs?${r.toString()}`)}async download_run_artifact_content(n,r,i){const l=String(n||"").trim(),u=String(r||"").trim();if(!l)throw new Error("download_run_artifact_content: run_id is required");if(!u)throw new Error("download_run_artifact_content: artifact_id is required");const m=String((i==null?void 0:i.access)||"").trim(),d=m?`?access=${encodeURIComponent(m)}`:"";return await(await this._fetch("download_run_artifact_content",`api/gateway/runs/${encodeURIComponent(l)}/artifacts/${encodeURIComponent(u)}/content${d}`)).blob()}async attachments_upload(n,r,i){const l=String(n||"").trim();if(!l)throw new Error("attachments_upload: session_id is required");if(!r)throw new Error("attachments_upload: file is required");const u=String((i==null?void 0:i.filename)||"").trim()||String((r==null?void 0:r.name)||"").trim()||"upload.bin",m=String((i==null?void 0:i.content_type)||"").trim()||String((r==null?void 0:r.type)||"").trim(),d=new FormData;d.append("session_id",l),d.append("file",r,u),d.append("filename",u),m&&d.append("content_type",m);const h=await this._post_form("attachments_upload","api/gateway/attachments/upload",d),x=h==null?void 0:h.attachment;if(!x||typeof x!="object")throw new Error("attachments_upload: missing attachment");if(!String(x.$artifact||"").trim())throw new Error("attachments_upload: missing attachment.$artifact");return x}async audio_transcribe(n,r){const i=String(n||"").trim();if(!i)throw new Error("audio_transcribe: run_id is required");const l=r==null?void 0:r.audio_artifact;if(!l||typeof l!="object")throw new Error("audio_transcribe: audio_artifact is required");if(!String(l.$artifact||"").trim())throw new Error("audio_transcribe: audio_artifact.$artifact is required");const m={audio_artifact:l},d=String((r==null?void 0:r.language)||"").trim();d&&(m.language=d);const h=String((r==null?void 0:r.request_id)||"").trim();h&&(m.request_id=h);const x=await this._post_json("audio_transcribe",`api/gateway/runs/${encodeURIComponent(i)}/audio/transcribe`,m);return{ok:!!(x!=null&&x.ok),run_id:String((x==null?void 0:x.run_id)||""),request_id:String((x==null?void 0:x.request_id)||""),text:String((x==null?void 0:x.text)||""),transcript_artifact:x==null?void 0:x.transcript_artifact}}async voice_tts(n,r){const i=String(n||"").trim();if(!i)throw new Error("voice_tts: run_id is required");const l=String((r==null?void 0:r.text)||"").trim();if(!l)throw new Error("voice_tts: text is required");const u={text:l,...ch(r)},m=String((r==null?void 0:r.format)||"").trim();m&&(u.format=m),typeof(r==null?void 0:r.timeout_s)=="number"&&r.timeout_s>0&&(u.timeout_s=r.timeout_s);const d=String((r==null?void 0:r.request_id)||"").trim();d&&(u.request_id=d);const h=await this._post_json("voice_tts",`api/gateway/runs/${encodeURIComponent(i)}/voice/tts`,u);return{ok:!!(h!=null&&h.ok),run_id:String((h==null?void 0:h.run_id)||""),request_id:String((h==null?void 0:h.request_id)||""),audio_artifact:h==null?void 0:h.audio_artifact}}async capability_defaults(){return await this._get_json("capability_defaults","api/gateway/config/capability-defaults")}async voice_voices(n){const r=new URLSearchParams({compact:"true"}),i=String((n==null?void 0:n.provider)||"").trim(),l=String((n==null?void 0:n.model)||"").trim();return i&&r.set("provider",i),l&&r.set("model",l),n!=null&&n.providers_only&&r.set("providers_only","true"),await this._get_json("voice_voices",`api/gateway/voice/voices?${r.toString()}`)}voice_stream_transport(n,r){const i=String(n||"").trim();if(!i)throw new Error("voice_stream_transport: run_id is required");return{path:Yu(this._cfg.base_url,`api/gateway/runs/${encodeURIComponent(i)}/voice/tts/stream`),body:{text:String((r==null?void 0:r.text)||""),format:"wav",...ch(r)},headers:id(this._cfg.auth_token)}}async list_bug_reports(){return await this._get_json("list_bug_reports","api/gateway/reports/bugs")}async list_feature_requests(){return await this._get_json("list_feature_requests","api/gateway/reports/features")}async get_bug_report_content(n){const r=String(n||"").trim();if(!r)throw new Error("get_bug_report_content: filename is required");return await this._get_json("get_bug_report_content",`api/gateway/reports/bugs/${encodeURIComponent(r)}/content`)}async get_feature_request_content(n){const r=String(n||"").trim();if(!r)throw new Error("get_feature_request_content: filename is required");return await this._get_json("get_feature_request_content",`api/gateway/reports/features/${encodeURIComponent(r)}/content`)}async bug_report_create(n){return await this._post_json("bug_report_create","api/gateway/bugs/report",uh(n,"bug_report_create"))}async feature_report_create(n){return await this._post_json("feature_report_create","api/gateway/features/report",uh(n,"feature_report_create"))}async email_list_accounts(){return await this._get_json("email_list_accounts","api/gateway/email/accounts")}async email_list_messages(n){const r=new URLSearchParams,i=String((n==null?void 0:n.account)||"").trim();i&&r.set("account",i);const l=String((n==null?void 0:n.mailbox)||"").trim();l&&r.set("mailbox",l);const u=String((n==null?void 0:n.since)||"").trim();u&&r.set("since",u);const m=String((n==null?void 0:n.status)||"").trim();return m&&r.set("status",m),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):20)),await this._get_json("email_list_messages",`api/gateway/email/messages?${r.toString()}`)}async email_read_message(n,r){const i=String(n||"").trim();if(!i)throw new Error("email_read_message: uid is required");const l=new URLSearchParams,u=String((r==null?void 0:r.account)||"").trim();u&&l.set("account",u);const m=String((r==null?void 0:r.mailbox)||"").trim();m&&l.set("mailbox",m);const d=typeof(r==null?void 0:r.max_body_chars)=="number"&&Number.isFinite(r.max_body_chars)?Number(r.max_body_chars):2e4;return l.set("max_body_chars",String(d)),await this._get_json("email_read_message",`api/gateway/email/messages/${encodeURIComponent(i)}?${l.toString()}`)}async email_send(n){if(!String((n==null?void 0:n.subject)||"").trim())throw new Error("email_send: subject is required");return await this._post_json("email_send","api/gateway/email/send",n||{})}async triage_run(n){const r={};return typeof(n==null?void 0:n.write_drafts)=="boolean"&&(r.write_drafts=!!n.write_drafts),typeof(n==null?void 0:n.enable_llm)=="boolean"&&(r.enable_llm=!!n.enable_llm),await this._post_json("triage_run","api/gateway/triage/run",r)}async list_triage_decisions(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):200)),await this._get_json("list_triage_decisions",`api/gateway/triage/decisions?${r.toString()}`)}async apply_triage_decision(n,r){const i=String(n||"").trim();if(!i)throw new Error("apply_triage_decision: decision_id is required");const l=String((r==null?void 0:r.action)||"").trim();if(!l)throw new Error("apply_triage_decision: action is required");const u={action:l};if(l==="defer"){const m=r==null?void 0:r.defer_days;typeof m=="number"&&Number.isFinite(m)&&m>0&&(u.defer_days=Number(m))}return await this._post_json("apply_triage_decision",`api/gateway/triage/decisions/${encodeURIComponent(i)}/apply`,u)}async backlog_list(n){const r=String(n||"").trim();if(!r)throw new Error("backlog_list: kind is required");return await this._get_json("backlog_list",`api/gateway/backlog/${encodeURIComponent(r)}`)}async backlog_content(n,r){const i=String(n||"").trim(),l=String(r||"").trim();if(!i)throw new Error("backlog_content: kind is required");if(!l)throw new Error("backlog_content: filename is required");return await this._get_json("backlog_content",`api/gateway/backlog/${encodeURIComponent(i)}/${encodeURIComponent(l)}/content`)}async backlog_template(){return await this._get_json("backlog_template","api/gateway/backlog/template")}async backlog_status(){return await this._get_json("backlog_status","api/gateway/backlog/status")}async backlog_move(n){const r=String((n==null?void 0:n.from_kind)||"").trim(),i=String((n==null?void 0:n.to_kind)||"").trim(),l=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_move: from_kind is required");if(!i)throw new Error("backlog_move: to_kind is required");if(!l)throw new Error("backlog_move: filename is required");return await this._post_json("backlog_move","api/gateway/backlog/move",{from_kind:r,to_kind:i,filename:l})}async backlog_update(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_update: kind is required");if(!i)throw new Error("backlog_update: filename is required");const l={content:String((n==null?void 0:n.content)??"")},u=String((n==null?void 0:n.expected_sha256)||"").trim();return u&&(l.expected_sha256=u),await this._post_json("backlog_update",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/update`,l)}async backlog_create(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_create: kind is required");if(!i)throw new Error("backlog_create: package is required");if(!l)throw new Error("backlog_create: title is required");const u={kind:r,package:i,title:l},m=String((n==null?void 0:n.task_type)||"").trim();m&&(u.task_type=m);const d=String((n==null?void 0:n.summary)||"").trim();d&&(u.summary=d);const h=(n==null?void 0:n.content)==null?"":String((n==null?void 0:n.content)??"");return h.trim()&&(u.content=h),await this._post_json("backlog_create","api/gateway/backlog/create",u)}async backlog_merge(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim(),u=Array.isArray(n==null?void 0:n.items)?n.items:[];if(!r)throw new Error("backlog_merge: kind is required");if(!i)throw new Error("backlog_merge: package is required");if(!l)throw new Error("backlog_merge: title is required");if(u.length<2)throw new Error("backlog_merge: at least 2 items are required");const m={kind:r,package:i,title:l,items:u.map(x=>({kind:String((x==null?void 0:x.kind)||"").trim(),filename:String((x==null?void 0:x.filename)||"").trim()}))},d=String((n==null?void 0:n.task_type)||"").trim();d&&(m.task_type=d);const h=String((n==null?void 0:n.summary)||"").trim();return h&&(m.summary=h),await this._post_json("backlog_merge","api/gateway/backlog/merge",m)}async backlog_upload_attachment(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim(),l=n==null?void 0:n.file;if(!r)throw new Error("backlog_upload_attachment: kind is required");if(!i)throw new Error("backlog_upload_attachment: filename is required");if(!l)throw new Error("backlog_upload_attachment: file is required");const u=new FormData;return u.set("overwrite",(n==null?void 0:n.overwrite)===!0?"true":"false"),u.set("file",l,l.name||"attachment"),await this._post_form("backlog_upload_attachment",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/attachments/upload`,u)}async backlog_assist(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.package)||"").trim(),l=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_assist: kind is required");if(!i)throw new Error("backlog_assist: package is required");if(!l)throw new Error("backlog_assist: title is required");const u={kind:r,package:i,title:l,messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},m=String((n==null?void 0:n.summary)||"").trim();m&&(u.summary=m);const d=(n==null?void 0:n.draft_markdown)==null?"":String(n.draft_markdown??"");d.trim()&&(u.draft_markdown=d);const h=String((n==null?void 0:n.provider)||"").trim();h&&(u.provider=h);const x=String((n==null?void 0:n.model)||"").trim();x&&(u.model=x);const v=String((n==null?void 0:n.thinking)||"").trim();return v&&(u.thinking=v),await this._post_json("backlog_assist","api/gateway/backlog/assist",u)}async backlog_maintain(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim(),l=String((n==null?void 0:n.package)||"").trim(),u=String((n==null?void 0:n.title)||"").trim();if(!r)throw new Error("backlog_maintain: kind is required");if(!i)throw new Error("backlog_maintain: filename is required");if(!l)throw new Error("backlog_maintain: package is required");if(!u)throw new Error("backlog_maintain: title is required");const m={kind:r,filename:i,package:l,title:u,messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},d=String((n==null?void 0:n.summary)||"").trim();d&&(m.summary=d);const h=(n==null?void 0:n.draft_markdown)==null?"":String(n.draft_markdown??"");h.trim()&&(m.draft_markdown=h);const x=String((n==null?void 0:n.provider)||"").trim();x&&(m.provider=x);const v=String((n==null?void 0:n.model)||"").trim();return v&&(m.model=v),await this._post_json("backlog_maintain","api/gateway/backlog/maintain",m)}async backlog_advisor(n){const r={messages:Array.isArray(n==null?void 0:n.messages)?n.messages:[]},i=String((n==null?void 0:n.provider)||"").trim();i&&(r.provider=i);const l=String((n==null?void 0:n.model)||"").trim();l&&(r.model=l);const u=String((n==null?void 0:n.thinking)||"").trim();u&&(r.thinking=u);const m=String((n==null?void 0:n.agent)||"").trim();m&&(r.agent=m),(n==null?void 0:n.include_trace)===!0&&(r.include_trace=!0);const d=String((n==null?void 0:n.focus_kind)||"").trim();d&&(r.focus_kind=d);const h=String((n==null?void 0:n.focus_type)||"").trim();return h&&(r.focus_type=h),await this._post_json("backlog_advisor","api/gateway/backlog/advisor",r)}async backlog_execute(n){const r=String((n==null?void 0:n.kind)||"").trim(),i=String((n==null?void 0:n.filename)||"").trim();if(!r)throw new Error("backlog_execute: kind is required");if(!i)throw new Error("backlog_execute: filename is required");const l=new URLSearchParams,u=String((n==null?void 0:n.execution_mode)||"").trim();u&&l.set("execution_mode",u);const m=String((n==null?void 0:n.executor)||"").trim();m&&l.set("executor",m);const d=String((n==null?void 0:n.target_model)||"").trim();d&&l.set("target_model",d);const h=String((n==null?void 0:n.target_reasoning_effort)||"").trim();return h&&l.set("target_reasoning_effort",h),(n==null?void 0:n.dor)==="check"&&l.set("dor","check"),(n==null?void 0:n.override)===!0&&l.set("override","true"),await(await this._fetch("backlog_execute",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(i)}/execute${l.toString()?`?${l.toString()}`:""}`,{method:"POST"})).json()}async backlog_execute_batch(n){const r=Array.isArray(n==null?void 0:n.items)?n.items:[];if(!r.length)throw new Error("backlog_execute_batch: items are required");const i={items:r.map(h=>({kind:String((h==null?void 0:h.kind)||"").trim(),filename:String((h==null?void 0:h.filename)||"").trim()}))},l=String((n==null?void 0:n.execution_mode)||"").trim();l&&(i.execution_mode=l);const u=String((n==null?void 0:n.executor)||"").trim();u&&(i.executor=u);const m=String((n==null?void 0:n.target_model)||"").trim();m&&(i.target_model=m);const d=String((n==null?void 0:n.target_reasoning_effort)||"").trim();return d&&(i.target_reasoning_effort=d),(n==null?void 0:n.dor)==="check"&&(i.dor="check"),(n==null?void 0:n.override)===!0&&(i.override=!0),await this._post_json("backlog_execute_batch","api/gateway/backlog/execute_batch",i)}async backlog_exec_config(){return await this._get_json("backlog_exec_config","api/gateway/backlog/exec/config")}async backlog_exec_requests(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):200)),await this._get_json("backlog_exec_requests",`api/gateway/backlog/exec/requests?${r.toString()}`)}async backlog_exec_request(n,r){const i=String(n||"").trim();if(!i)throw new Error("backlog_exec_request: request_id is required");const l=new URLSearchParams;return(r==null?void 0:r.include_prompt)===!0&&l.set("include_prompt","true"),await this._get_json("backlog_exec_request",`api/gateway/backlog/exec/requests/${encodeURIComponent(i)}?${l.toString()}`)}async backlog_exec_feedback(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_feedback: request_id is required");const i=String((n==null?void 0:n.feedback)??"");if(!i.trim())throw new Error("backlog_exec_feedback: feedback is required");return await this._post_json("backlog_exec_feedback",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/feedback`,{feedback:i})}async backlog_exec_promote(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_promote: request_id is required");const i={};return(n==null?void 0:n.redeploy)===!0&&(i.redeploy=!0),await this._post_json("backlog_exec_promote",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/promote`,i)}async backlog_exec_deploy_uat(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_deploy_uat: request_id is required");return await this._post_json("backlog_exec_deploy_uat",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/uat/deploy`,{})}async backlog_exec_log_tail(n){const r=String((n==null?void 0:n.request_id)||"").trim();if(!r)throw new Error("backlog_exec_log_tail: request_id is required");const i=new URLSearchParams,l=String((n==null?void 0:n.name)||"").trim();l&&i.set("name",l);const u=typeof(n==null?void 0:n.max_bytes)=="number"&&Number.isFinite(n.max_bytes)?Number(n.max_bytes):0;u>0&&i.set("max_bytes",String(Math.floor(u)));const m=typeof(n==null?void 0:n.after_bytes)=="number"&&Number.isFinite(n.after_bytes)?Math.max(0,Math.floor(n.after_bytes)):null;return m!==null&&i.set("after_bytes",String(m)),await this._get_json("backlog_exec_log_tail",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/logs/tail?${i.toString()}`)}async backlog_exec_active_items(n){const r=new URLSearchParams,i=String((n==null?void 0:n.status)||"").trim();return i&&r.set("status",i),r.set("limit",String(typeof(n==null?void 0:n.limit)=="number"&&Number.isFinite(n.limit)?Number(n.limit):600)),await this._get_json("backlog_exec_active_items",`api/gateway/backlog/exec/active_items?${r.toString()}`)}async discovery_providers(){return await(await this._fetch("discovery_providers","api/gateway/discovery/providers")).json()}async discovery_model_capabilities(n){const r=String(n||"").trim();if(!r)throw new Error("discovery_model_capabilities: model_name is required");return await(await this._fetch("discovery_model_capabilities",`api/gateway/discovery/models/capabilities?model_name=${encodeURIComponent(r)}`)).json()}async discovery_provider_models(n){const r=String(n||"").trim();if(!r)throw new Error("discovery_provider_models: provider is required");return await(await this._fetch("discovery_provider_models",`api/gateway/discovery/providers/${encodeURIComponent(r)}/models`)).json()}async list_entities(){return await(await this._fetch("list_entities","api/gateway/entities")).json()}async admin_runtime_config(){return await(await this._fetch("admin_runtime_config","api/gateway/admin/runtime-config")).json()}async admin_executors(){return await(await this._fetch("admin_executors","api/gateway/admin/executors")).json()}async admin_runtime_config_update(n){return await(await this._fetch("admin_runtime_config_update","api/gateway/admin/runtime-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})})).json()}async entity_state(n,r){return await(await this._fetch("entity_state",`api/gateway/entities/${encodeURIComponent(n)}/state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()}async entity_skills(n){return await(await this._fetch("entity_skills",`api/gateway/entities/${encodeURIComponent(n)}/skills`)).json()}async put_entity_skills(n,r){return await(await this._fetch("put_entity_skills",`api/gateway/entities/${encodeURIComponent(n)}/skills`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({skills:r})})).json()}async list_bundles(){return await(await this._fetch("list_bundles","api/gateway/bundles")).json()}async admin_data_homes(){return await(await this._fetch("admin_data_homes","api/gateway/admin/data-homes")).json()}async gateway_about(){return await this._get_json("gateway_about","api/gateway/about")}async list_processes(){return await this._get_json("list_processes","api/gateway/processes")}async list_process_env_vars(){return await this._get_json("list_process_env_vars","api/gateway/processes/env")}async update_process_env_vars(n){const r={},i=n!=null&&n.set&&typeof n.set=="object"?n.set:{},l=Array.isArray(n==null?void 0:n.unset)?n==null?void 0:n.unset:[];return i&&Object.keys(i).length&&(r.set=i),l&&l.length&&(r.unset=l),await this._post_json("update_process_env_vars","api/gateway/processes/env",r)}async start_process(n){const r=String(n||"").trim();return await this._post_json("start_process",`api/gateway/processes/${encodeURIComponent(r)}/start`)}async stop_process(n){const r=String(n||"").trim();return await this._post_json("stop_process",`api/gateway/processes/${encodeURIComponent(r)}/stop`)}async restart_process(n){const r=String(n||"").trim();return await this._post_json("restart_process",`api/gateway/processes/${encodeURIComponent(r)}/restart`)}async redeploy_process(n){const r=String(n||"").trim();return await this._post_json("redeploy_process",`api/gateway/processes/${encodeURIComponent(r)}/redeploy`)}async process_log_tail(n,r){const i=String(n||"").trim(),l=typeof(r==null?void 0:r.max_bytes)=="number"?Math.max(1024,Math.min(4e5,Math.floor(r.max_bytes))):8e4;return await this._get_json("process_log_tail",`api/gateway/processes/${encodeURIComponent(i)}/logs/tail?max_bytes=${encodeURIComponent(String(l))}`)}}function uh(s,n){const r=String((s==null?void 0:s.session_id)||"").trim();if(!r)throw new Error(`${n}: session_id is required`);const i=String((s==null?void 0:s.description)||"").trim();if(!i)throw new Error(`${n}: description is required`);const l={session_id:r,description:i};for(const m of["active_run_id","workflow_id","client","client_version","user_agent","url","provider","model","template"]){const d=String((s==null?void 0:s[m])||"").trim();d&&(l[m]=d)}const u=s==null?void 0:s.context;return u&&typeof u=="object"&&(l.context=u),l}const dh={framework:null,gateway:null,gatewayNote:"checking…"};function Ix(s){if(s instanceof Pp){const r=s.message.replace(/^gateway_about failed:\s*/,"").trim();return`HTTP ${s.status}${r&&r!==String(s.status)?`: ${r}`:""}`}return(s instanceof Error?s.message:String(s))||"request failed"}async function Dx(s){let n;try{n=await s.gateway_about()}catch(r){return Xo(null,Ix(r))}return Xo(n)}const mh=Hd("voice and camera")??"Voice and camera are not supported in this browser (getUserMedia unavailable).",Ox="Copy failed — select and copy";function fh(){var n;const s=globalThis.navigator;return typeof((n=s==null?void 0:s.mediaDevices)==null?void 0:n.getUserMedia)=="function"}function Fx(s){var l;const n=globalThis.document;if(!n||!n.body||typeof n.execCommand!="function")return!1;const r=n.createElement("textarea");r.value=s,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="0",r.style.left="-9999px",r.style.opacity="0";const i=n.activeElement;n.body.appendChild(r);try{return r.select(),r.setSelectionRange(0,s.length),n.execCommand("copy")===!0}catch{return!1}finally{n.body.removeChild(r);try{(l=i==null?void 0:i.focus)==null||l.call(i)}catch{}}}async function qx(s){var i;const n=String(s??""),r=globalThis.navigator;if(typeof((i=r==null?void 0:r.clipboard)==null?void 0:i.writeText)=="function")try{return await r.clipboard.writeText(n),!0}catch{}return Fx(n)}const Bx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Ux(s){const n=s.length,r=new Uint8Array(n+9+63>>6<<6);r.set(s),r[n]=128;const i=new DataView(r.buffer);i.setUint32(r.length-8,Math.floor(n/536870912),!1),i.setUint32(r.length-4,n<<3>>>0,!1);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),m=(d,h)=>d>>>h|d<<32-h;for(let d=0;d<r.length;d+=64){for(let T=0;T<16;T++)u[T]=i.getUint32(d+T*4,!1);for(let T=16;T<64;T++){const B=m(u[T-15],7)^m(u[T-15],18)^u[T-15]>>>3,O=m(u[T-2],17)^m(u[T-2],19)^u[T-2]>>>10;u[T]=u[T-16]+B+u[T-7]+O>>>0}let[h,x,v,g,w,L,A,$]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let T=0;T<64;T++){const B=m(w,6)^m(w,11)^m(w,25),O=w&L^~w&A,M=$+B+O+Bx[T]+u[T]>>>0,P=m(h,2)^m(h,13)^m(h,22),E=h&x^h&v^x&v,Q=P+E>>>0;$=A,A=L,L=w,w=g+M>>>0,g=v,v=x,x=h,h=M+Q>>>0}l[0]=l[0]+h>>>0,l[1]=l[1]+x>>>0,l[2]=l[2]+v>>>0,l[3]=l[3]+g>>>0,l[4]=l[4]+w>>>0,l[5]=l[5]+L>>>0,l[6]=l[6]+A>>>0,l[7]=l[7]+$>>>0}return Array.from(l,d=>d.toString(16).padStart(8,"0")).join("")}async function zp(s){var i;const n=new TextEncoder().encode(String(s??"")),r=(i=globalThis.crypto)==null?void 0:i.subtle;if(r&&typeof r.digest=="function"){const l=await r.digest("SHA-256",n);return Array.from(new Uint8Array(l),u=>u.toString(16).padStart(2,"0")).join("")}return Ux(n)}const Wx=/^[a-zA-Z0-9_-]+$/;function hh(s){return Wx.test(String(s||"").trim())}async function Hx(s){const n=String(s||""),r=new TextEncoder().encode(n),i=globalThis.crypto;if(!i||!i.subtle||typeof i.subtle.digest!="function")return"";const l=await i.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(l)).map(u=>u.toString(16).padStart(2,"0")).join("")}async function Gd(s){const n=String(s||"").trim();if(!n)throw new Error("session_id is required");if(hh(n)){const i=`session_memory_${n}`;if(hh(i))return i}return`session_memory_sha_${(await Hx(n)).slice(0,32)}`}const er=["bug","feature","improvement","task"];function tl(s){return String(s||"").trim().toLowerCase()}function Ip(s){return er.includes(tl(s))}function Dp(s){const n=tl(s);return Ip(n)?n:"task"}function Op(s){return s.toUpperCase()}function Fp(s){return s==="bug"?"danger":s==="feature"?"ok":s==="improvement"?"info":s==="task"?"task":"muted"}function qp(s){return Ip(s)?void 0:`"${s}" is not in the ruled type vocabulary (${er.join(" / ")})`}function Bp(s){const n=String(s||"").trim();return n.replace(/^\[(bug|feature|improvement|task)\]\s*/i,"").trim()||n}function _a(s,n){const r=String(s||"");return r.length<=n?r:`${r.slice(0,Math.max(0,n-1))}…`}function $d(s=new Date){const n=d=>String(d).padStart(2,"0"),r=-s.getTimezoneOffset(),i=r>=0?"+":"-",l=Math.abs(r),u=n(Math.floor(l/60)),m=n(l%60);return`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())} ${n(s.getHours())}:${n(s.getMinutes())}:${n(s.getSeconds())} ${i}${u}${m}`}function Vx(s){try{return JSON.parse(s)}catch{return null}}function ph(s,n){return s.scrollHeight-s.scrollTop-s.clientHeight<=n}function ld(s){const n=typeof s=="string"?s.trim():"";if(!n)return null;const r=n.replace(/(\.\d{3})\d+/,"$1"),i=Date.parse(r);return Number.isFinite(i)?i:null}function Hs(s){if(!Number.isFinite(s))return"";const n=Math.max(0,Math.floor(s/1e3)),r=n%60,i=Math.floor(n/60),l=i%60,u=Math.floor(i/60),m=u%24,d=Math.floor(u/24);return d>0?`${d}d ${m}h`:u>0?`${u}h ${l}m`:i>0?`${i}m ${r}s`:`${n}s`}async function Ed(s){return zp(String(s||""))}function Zo(s){const n=String(s||"").trim().toLowerCase();return n==="completed"||n==="promoted"?"ok":n==="failed"?"danger":n==="running"?"info":n==="queued"||n==="awaiting_qa"?"warn":"muted"}function Gx(s,n){return s==="processing"?"queued,running,awaiting_qa":s==="failed"?"failed":s==="completed"&&n==="runs"?"completed,promoted":""}function Oo(s,n){const r=s&&typeof s=="object"?s:{},i=r.backlog&&typeof r.backlog=="object"?r.backlog:{},l=r.result&&typeof r.result=="object"?r.result:{},u=r.executor&&typeof r.executor=="object"?r.executor:{},m=String(l.last_message||"").trim(),d=String(r.target_model||u.model||"").trim(),h=String(r.target_reasoning_effort||u.reasoning_effort||"").trim();return{request_id:n,status:String(r.status||"unknown"),created_at:r.created_at??null,started_at:r.started_at??null,finished_at:r.finished_at??null,backlog_relpath:i.relpath??null,backlog_kind:i.kind??null,backlog_filename:i.filename??null,target_agent:r.target_agent??null,target_model:d||null,target_reasoning_effort:h||null,executor_type:u.type??null,ok:typeof l.ok=="boolean"?l.ok:null,exit_code:typeof l.exit_code=="number"?l.exit_code:l.exit_code??null,error:typeof l.error=="string"?l.error:l.error??null,run_dir_relpath:r.run_dir_relpath??null,last_message:Kx(m)}}const cd=1200;function Kx(s){const n=String(s||"");return n?n.length<=cd?n:`${n.slice(0,cd)}
|
|
61
61
|
… [#TRUNCATION: ${cd} of ${n.length} chars; the full last_message is in the run directory]`:null}function Jx(s){const n=String(s||""),r=n.split(/\r?\n/).filter(u=>String(u||"").trim().length>0),i=[];let l=0;for(let u=0;u<r.length;u+=1){const m=String(r[u]||"").trim(),d=Vx(m);if(!d||typeof d!="object"){l+=1,i.push({idx:u,type:"raw",payload:null,raw:m});continue}const h=String(d.type||d.event||"event");i.push({idx:u,type:h,payload:d,raw:m})}return{total:r.length,bad:l,events:i,raw:n}}function Qx(s){if(!s)return null;let n=0,r=0,i=0,l=0,u=0;for(const d of s.events){const h=d.payload,x=h&&typeof h.usage=="object"?h.usage:null;x&&(Number.isFinite(Number(x.input_tokens))&&(n+=Number(x.input_tokens)),Number.isFinite(Number(x.cached_input_tokens))&&(r+=Number(x.cached_input_tokens)),Number.isFinite(Number(x.output_tokens))&&(i+=Number(x.output_tokens)));const v=h&&typeof h.item=="object"?h.item:null;v&&String(v.type||"").trim()==="command_execution"&&(l+=1,String(v.status||"").trim().toLowerCase()==="failed"&&(u+=1))}return{has_tokens:n>0||i>0||r>0,input_tokens:n,cached_input_tokens:r,output_tokens:i,total_tokens:n+i,command_count:l,command_fail_count:u}}function nl(s,n=Date.now()){const r=ld(s==null?void 0:s.created_at),i=ld(s==null?void 0:s.started_at),l=ld(s==null?void 0:s.finished_at),u=String((s==null?void 0:s.status)||"").trim().toLowerCase(),m=l??(u==="running"?n:null),d=l!=null,h=r!=null&&i!=null?Math.max(0,i-r):null,x=i!=null&&m!=null?Math.max(0,m-i):null,v=r!=null&&m!=null?Math.max(0,m-r):null,g=!d&&r!=null?Math.max(0,n-r):null;return{is_done:d,queue_delay_ms:h,run_ms:x,total_ms:v,age_ms:g}}function Yx(s,n){const r=String(n.package_name).trim()||"{Package}",i=Bp(String(n.title||"").trim()||"{Title}"),l=String(n.summary||"").trim(),u=Dp(n.task_type),m=`# {ID}-${r}: [${Op(u)}] ${i}`.trim();let d=String(s||"");d=d.split("{Package}").join(r).split("{Title}").join(i);const h=d.split(/\r?\n/);let x=!1;for(let A=0;A<h.length;A+=1){const $=String(h[A]||"");if($.trim().startsWith("# ")){h[A]=m,x=!0;break}if($.trim())break}x||(h.unshift("",m),h.shift());const v=`> Created: ${String(n.created_at||"").trim()}`.trim();let g=!1;for(let A=0;A<Math.min(h.length,40);A+=1)if(String(h[A]||"").trim().toLowerCase().startsWith("> created:")){h[A]=v,g=!0;break}if(!g){const A=h.length>1&&!String(h[1]||"").trim()?2:1;h.splice(A,0,v,"")}const w=`> Type: ${u}`.trim();let L=!1;for(let A=0;A<Math.min(h.length,60);A+=1)if(String(h[A]||"").trim().toLowerCase().startsWith("> type:")){h[A]=w,L=!0;break}if(!L){let A=-1;for(let $=0;$<Math.min(h.length,60);$+=1)if(String(h[$]||"").trim().toLowerCase().startsWith("> created:")){A=$;break}if(A>=0){const $=A+1;$<h.length&&!String(h[$]||"").trim()?h.splice($,0,w):h.splice($,0,w,"")}else{const $=h.length>1&&!String(h[1]||"").trim()?2:1;h.splice($,0,w,"")}}if(l){for(let A=0;A<h.length;A+=1)if(String(h[A]||"").trim().toLowerCase()==="## summary"){let $=A+1;for(;$<h.length&&!String(h[$]||"").trim();)$+=1;($<h.length?String(h[$]||""):"").trim().toLowerCase().startsWith("one paragraph describing")?h[$]=l:h.splice(A+1,0,l,"");break}}return d=h.join(`
|
|
62
62
|
`),d.endsWith(`
|
|
63
63
|
`)||(d+=`
|
|
@@ -103,7 +103,7 @@ ${Fe}`;F({to:R,subject:Pe,body:Xe})}async function ye(){if(!et||je)return;const
|
|
|
103
103
|
`),r=[];let i=[],l=0;for(;l<n.length;){const u=n[l].match(jw);if(!u){i.push(n[l]),l+=1;continue}const m=u[1];let d=-1;for(let h=l+1;h<n.length;h++){const x=n[h].trimEnd();if(x.startsWith(m[0].repeat(3))&&/^(`{3,}|~{3,})\s*$/.test(x)&&x[0]===m[0]){d=h;break}}if(d===-1){i.push(n[l]),l+=1;continue}i.length&&(r.push({kind:"md",text:i.join(`
|
|
104
104
|
`)}),i=[]),r.push({kind:"mermaid",text:n.slice(l+1,d).join(`
|
|
105
105
|
`)}),l=d+1}return i.length&&r.push({kind:"md",text:i.join(`
|
|
106
|
-
`)}),r}const Sw="modulepreload",Nw=function(s,n){return new URL(s,n).href},Th={},Cw=function(n,r,i){let l=Promise.resolve();if(r&&r.length>0){let m=function(v){return Promise.all(v.map(g=>Promise.resolve(g).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};const d=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));l=m(r.map(v=>{if(v=Nw(v,i),v in Th)return;Th[v]=!0;const g=v.endsWith(".css"),w=g?'[rel="stylesheet"]':"";if(!!i)for(let $=d.length-1;$>=0;$--){const T=d[$];if(T.href===v&&(!g||T.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${v}"]${w}`))return;const A=document.createElement("link");if(A.rel=g?"stylesheet":Sw,g||(A.as="script"),A.crossOrigin="",A.href=v,x&&A.setAttribute("nonce",x),document.head.appendChild(A),g)return new Promise(($,T)=>{A.addEventListener("load",$),A.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${v}`)))})}))}function u(m){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=m,window.dispatchEvent(d),!d.defaultPrevented)throw m}return l.then(m=>{for(const d of m||[])d.status==="rejected"&&u(d.reason);return n().catch(u)})};let _d=null;function $w(){return _d||(_d=Cw(()=>import("./mermaid.core-
|
|
106
|
+
`)}),r}const Sw="modulepreload",Nw=function(s,n){return new URL(s,n).href},Th={},Cw=function(n,r,i){let l=Promise.resolve();if(r&&r.length>0){let m=function(v){return Promise.all(v.map(g=>Promise.resolve(g).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};const d=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));l=m(r.map(v=>{if(v=Nw(v,i),v in Th)return;Th[v]=!0;const g=v.endsWith(".css"),w=g?'[rel="stylesheet"]':"";if(!!i)for(let $=d.length-1;$>=0;$--){const T=d[$];if(T.href===v&&(!g||T.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${v}"]${w}`))return;const A=document.createElement("link");if(A.rel=g?"stylesheet":Sw,g||(A.as="script"),A.crossOrigin="",A.href=v,x&&A.setAttribute("nonce",x),document.head.appendChild(A),g)return new Promise(($,T)=>{A.addEventListener("load",$),A.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${v}`)))})}))}function u(m){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=m,window.dispatchEvent(d),!d.defaultPrevented)throw m}return l.then(m=>{for(const d of m||[])d.status==="rejected"&&u(d.reason);return n().catch(u)})};let _d=null;function $w(){return _d||(_d=Cw(()=>import("./mermaid.core-bzPoIo7V.js").then(s=>s.bp),[],import.meta.url).then(s=>{const n=s.default||s;return n.initialize({startOnLoad:!1,securityLevel:"strict",theme:"dark"}),n})),_d}let Ew=0;function Tw(s){const n=f.useRef(null),[r,i]=f.useState("");return f.useEffect(()=>{let l=!0;return i(""),$w().then(async u=>{const m=`af_mermaid_${Ew+=1}`,{svg:d}=await u.render(m,s.text);l&&n.current&&(n.current.innerHTML=d)}).catch(u=>{l&&i(String((u==null?void 0:u.message)||u||"mermaid render failed"))}),()=>{l=!1}},[s.text]),r?e.jsxs("div",{className:"team_mermaid_error",children:[e.jsxs("div",{className:"muted team_note",children:["#FALLBACK diagram did not render (",r.slice(0,120),") — source below:"]}),e.jsx("pre",{className:"team_mermaid_src",children:s.text})]}):e.jsx("div",{className:"team_mermaid",ref:n})}const u_=5e4,Aw="abstractcontinuum history_window.estimate_tokens (~4 chars per token)";function Lw(s){const n=String(s??"");return n?Math.max(1,Math.floor(n.length/4)):0}function Mw(s,n,r=u_){if(!Number.isInteger(r)||r<=0)throw new Error(`history window max_tokens must be a positive integer, got ${r}`);const i=s.map(h=>({item:h,tokens:n(h)}));let l=0,u=i.length,m=!1;for(let h=i.length-1;h>=0;h--){const x=i[h].tokens;if(l+x>r){u===i.length&&(m=!0,l+=x,u=h);break}l+=x,u=h}const d=i.slice(0,u);return{kept:i.slice(u).map(h=>h.item),report:{policy:"newest_whole_messages",max_tokens:r,token_estimator:Aw,total_messages:i.length,replayed_messages:i.length-u,replayed_tokens:l,dropped_messages:d.length,dropped_tokens:d.reduce((h,x)=>h+x.tokens,0),oversize_message_kept:m}}}const Rw=400;function Pw(s){const n=new Map;for(const l of s)n.set(l.id,l);const r=l=>{let u=l,m=!1;const d=new Set([u.id]);for(let h=0;h<Rw;h++){const x=String(u.reply_to||"");if(!x)break;const v=n.get(x);if(!v){m=u.id===l.id||m;break}if(d.has(v.id))break;d.add(v.id),u=v}return{root:u,orphan:m&&u.id===l.id}},i=new Map;for(const l of[...s].sort((u,m)=>(u.seq||0)-(m.seq||0))){const{root:u,orphan:m}=r(l);let d=i.get(u.id);d||(d={root:u,replies:[],orphan:u.id===l.id?m:!1,last_seq:u.seq||0},i.set(u.id,d)),l.id!==u.id&&(d.replies.push(l),d.last_seq=Math.max(d.last_seq,l.seq||0))}return[...i.values()].sort((l,u)=>l.last_seq-u.last_seq||(l.root.seq||0)-(u.root.seq||0))}const Ah=[{id:"all",label:"All",title:"Every message in the window"},{id:"unread",label:"Unread",title:"Unread MESSAGES (same number as the blue channel badge); the list shows the threads containing them"},{id:"asks",label:"Asks",title:"Threads with open/blocked messages — something expects an answer"},{id:"vigilance",label:"Needs vigilance",title:"Threads with unanswered asks, critical messages, or messages addressed to your seat"},{id:"fyi",label:"FYI",title:"Threads of fyi/system traffic"},{id:"resolved",label:"Resolved",title:"Threads closed by a resolved reply (the ✓ Resolve act) or a resolved root"},{id:"to_me",label:"@me",title:"Threads with messages addressed to your seat"}];function d_(s,n,r){var l,u,m,d,h;if(s.retracted===!0)return n==="all"?!0:n==="unread"?!!((l=r.unread_seqs)!=null&&l.has(s.seq)||(u=r.unread_snapshot_seqs)!=null&&u.has(s.seq)):!1;const i=String(s.status||"").toLowerCase();switch(n){case"all":return!0;case"unread":return!!((m=r.unread_seqs)!=null&&m.has(s.seq)||(d=r.unread_snapshot_seqs)!=null&&d.has(s.seq));case"asks":return i==="open"||i==="blocked";case"fyi":return i==="fyi";case"resolved":return i==="resolved";case"to_me":return Array.isArray(s.to)&&s.to.includes(r.seat);case"vigilance":{const x=(i==="open"||i==="blocked")&&s.has_resolved_reply!==!0,v=s.critical===!0,g=Array.isArray(s.to)&&s.to.includes(r.seat),w=!!((h=r.escalated_seqs)!=null&&h.has(s.seq));return x||v||g||w}}}function Lh(s,n,r){return n==="all"?s:s.filter(i=>[i.root,...i.replies].some(l=>d_(l,n,r)))}function zw(s,n,r){return d_(s,n,r)}function Iw(s){const n={},r={};for(const i of s){const l=String(i.channel||"");if(!l)continue;const u=Number(i.seq);if(Number.isFinite(u)){const m=n[l]||(n[l]=new Set);if(m.has(u))continue;m.add(u)}r[l]=(r[l]||0)+1}return r}function Dw(s){const n={};for(const r of s){const i=String(r.channel||""),l=Number(r.seq);!i||!Number.isFinite(l)||(n[i]||(n[i]=new Set)).add(l)}return n}function Ow(s,n){const r={};for(const i of s){const l=String(i.channel||""),u=Number(i.seq);if(!l||!Number.isFinite(u))continue;const m=String(i.status||"").toLowerCase(),d=Array.isArray(i.to)&&n?i.to.includes(n):!1;(m==="open"||m==="blocked"||(m==="reply"||m==="fyi")&&d)&&(r[l]||(r[l]=new Set)).add(u)}return r}function Fw(s){const n={};for(const r of s){const i=String(r.channel||""),l=Number(r.seq);if(!i||!Number.isFinite(l))continue;const u=String(r.effective_urgency||"").toLowerCase();(r.escalated===!0||u==="interrupt")&&(n[i]||(n[i]=new Set)).add(l)}return n}function qw(s,n){const r=n?n.replace(/\/+$/,"")+"/":"",i=new Map,l=[];for(const u of s){const m=String(u.path||"");if(!m.startsWith(r))continue;const d=m.slice(r.length);if(!d)continue;const h=d.indexOf("/");if(h===-1)l.push(u);else{const x=d.slice(0,h);i.set(x,(i.get(x)||0)+1)}}return{dirs:[...i.entries()].map(([u,m])=>({name:u,path:r+u,count:m})).sort((u,m)=>u.name.localeCompare(m.name)),leaves:l.sort((u,m)=>u.path.localeCompare(m.path))}}function Mh(s,n){const r=String(s||"");if(!r.startsWith("dm:")||!n)return"";const i=r.slice(3);return i.startsWith(`${n}--`)?i.slice(n.length+2):i.endsWith(`--${n}`)?i.slice(0,i.length-n.length-2):""}function Bw(s){return s.is_reply?"reply":s.in_dm||s.kind==="ask"?"open":"fyi"}function Uw(s){const n=new Map;for(const i of s)i.id&&n.set(i.id,String(i.sender||""));const r=new Set;for(const i of s){const l=i.reply_to?String(i.reply_to):"";if(!l)continue;const u=n.get(l);(u===void 0||u!==String(i.sender||""))&&r.add(l)}return r}const Ww=/(?:^|[\s("'`])((?:[A-Za-z0-9_][A-Za-z0-9_.-]*\/)+[A-Za-z0-9_][A-Za-z0-9_.-]*\.(?:md|markdown|txt|json|yaml|yml|csv|log))\b/g,Hw=4;function Vw(s){const n=[];for(const r of String(s||"").matchAll(Ww)){const i=r[1],l=r.index===void 0?-1:r.index,u=l>=0?String(s).slice(Math.max(0,l-12),l+1):"";if(!(u.includes("://")||/\/api\//.test(u))&&(n.includes(i)||n.push(i),n.length>=Hw))break}return n}function Gw(s,n,r){var l,u;const i=s.split("/").pop()||s;if(n!=null&&n.has(s))return{kind:"fs",path:s,rewritten:!1};for(let m=0;m<r.length;m++)if(String(((l=r[m])==null?void 0:l.filename)||"")===s)return{kind:"attachment",attachment_index:m};if(n){const m=[];for(const d of n)(d===i||d.endsWith(`/${i}`))&&m.push(d);if(m.length===1)return{kind:"fs",path:m[0],rewritten:m[0]!==s}}for(let m=0;m<r.length;m++){const d=String(((u=r[m])==null?void 0:u.filename)||"");if(d&&(d===i||d.split("/").pop()===i))return{kind:"attachment",attachment_index:m}}return null}const Rh=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g;function gd(s){const n=[];for(const i of s.matchAll(Rh)){const l=i[1].toLowerCase();n.includes(l)||n.push(l)}return{title:s.replace(Rh," ").split(/\s+/).join(" ").trim().replace(/^[\s,;:-]+|[\s,;:-]+$/g,""),members:n}}function yd(s){const n=[];for(const r of String(s||"").split(/[\s,;]+/)){const i=r.replace(/^@/,"").toLowerCase();!i||!/^[a-z0-9][a-z0-9_.-]*$/.test(i)||n.includes(i)||n.push(i)}return n}function vd(s,n){let r=s.toLowerCase().replace(/[^a-z0-9_.-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"");r||(r="group"),r=r.slice(0,40).replace(/[-.]+$/g,"");let i=r,l=1;for(;n.has(i);)l+=1,i=`${r}-${l}`;return i}const Ph=400,zh=/([.;:!?…]["')\]]*) +(\((?:\d{1,2}|[a-z])\)|\[\d{1,2}\]) (?=["'([{]?[A-Za-z0-9])/g,Ih=/([.;:!?…]["')\]]*) +(?=[A-Z][A-Z'-]+(?: [A-Z][A-Z'-]*)+)/g;function Kw(s){if(!s||s.length<Ph)return s;const n=s.split(/(```[\s\S]*?(?:```|$))/),r=[];for(const i of n){if(i.startsWith("```")){r.push(i);continue}const l=i.split(/(\n{2,})/);for(const u of l){if(/\n/.test(u)||u.length<Ph){r.push(u);continue}const m=u.split(/(`[^`\n]*`)/);let d=0;for(const h of m)h.startsWith("`")||(d+=(h.match(zh)||[]).length+(h.match(Ih)||[]).length);if(d<2){r.push(u);continue}r.push(m.map(h=>h.startsWith("`")?h:h.replace(zh,`$1
|
|
107
107
|
|
|
108
108
|
$2 `).replace(Ih,`$1
|
|
109
109
|
|
|
@@ -132,4 +132,4 @@ QUESTION: ${b}`,de=await ao(z,zs);if(N!==R.current)return;qi(V=>[...V,{role:"ass
|
|
|
132
132
|
`)[0])==null?void 0:Lt.trim())||"",zt=Ve&&(Ve===S.trim()||Ve===$t),jn=(ot==null?void 0:ot.id)===p.id;return e.jsxs("div",{className:`team_row ${p.sender===vt?"own":""} ${Be?"hit":""} ${jn?"replying":""} ${Ie?"unread":""} ${p.retracted?"retracted":""}`,id:`hubmsg-${p.id}`,onClick:()=>Ic(p),title:de?void 0:p.critical?"Click to record the read (critical unpins on it)":void 0,children:[e.jsx("span",{className:"team_avatar",style:Qa(p.sender),"aria-hidden":"true",children:(p.sender[0]||"?").toUpperCase()}),e.jsxs("div",{className:"team_row_main",children:[e.jsxs("div",{className:"team_row_head",children:[(gt=H[p.channel])!=null&>.has(p.seq)?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_chip_debt",title:"Pinned by the hub until answered: this is an open ask or a directive addressed to you — reading is not answering; reply, Decline, or Resolve the thread to clear it",children:"needs reply"}),e.jsx("button",{className:`team_chip_decline ${ta===p.id?"armed":""}`,title:ta===p.id?"Click again to decline on the record (posts a closing reply)":"Decline: close this ask without answering — posts an on-the-record reply so it stops showing everywhere",onClick:We=>{We.stopPropagation(),Ea(p)},children:ta===p.id?"sure? declines on the record":"decline"})]}):Ie?e.jsx("span",{className:"team_chip_new",title:"Unread — your seat has not read past this message yet; clicking the row records the read",children:"new"}):p.read===!1&&b.is_root?e.jsx("span",{className:"team_chip_seen",title:"Swept read by the cursor but never opened — you caught the tail of a burst and this one was marked read without being seen. Click to actually read it.",children:"missed?"}):null,e.jsx("span",{className:"team_row_sender",style:Vh(p.sender),children:p.sender}),Vc(p,b.is_root),(()=>{const We=Zi(p);return!We||!We.up&&!We.down?null:e.jsxs("span",{className:`team_reaction_tally mono ${We.mine>0?"pos":We.mine<0?"neg":""}`,title:"±1 ratings feed the sender's reputation (one system). Green/red tint = YOUR standing vote on this message; counts refresh with the poll.",children:[We.up?`▲${We.up}`:"",We.up&&We.down?" ":"",We.down?`▼${We.down}`:""]})})(),e.jsxs("span",{className:"team_row_meta mono",title:Ho(p.created_at),children:["#",p.seq," · ",Wo(p.created_at)]})]}),Ve&&!zt?e.jsx("div",{className:"team_row_title",children:Ve}):null,e.jsx("div",{className:`team_row_body ${V?b.is_root?"clamp_root":"clamp_reply":""}`,children:e.jsx(oj,{className:"md_doc",text:Qo(Xw(Kw(S),{hub_base:M}))})}),Hc(p),(()=>{var Zt;const We=Vw(`${String(p.title||"")}
|
|
133
133
|
${S}`),St=((Zt=p.data)==null?void 0:Zt.attachments)||p.attachments||[],Ot=We.map(Mt=>({mention:Mt,res:Gw(Mt,ri,St)})).filter(Mt=>Mt.res!==null).filter(Mt=>{var Qt;return!(Mt.res.kind==="attachment"&&String(((Qt=St[Mt.res.attachment_index])==null?void 0:Qt.filename)||"")===Mt.mention)}),Ut=s.on_open_board?lb(`${String(p.title||"")}
|
|
134
134
|
${S}`):[];return!Ot.length&&!Ut.length?null:e.jsxs("div",{className:"team_fs_chips",children:[Ot.map(({mention:Mt,res:Qt})=>e.jsxs("button",{className:"team_attach_chip team_fs_chip",title:Qt.kind==="fs"?Qt.rewritten?`Opens ${Qt.path} (the mention's path moved — matched by name in #${D}'s files)`:`Open ${Qt.path} from #${D}'s virtual filesystem`:"Opens the file attached to this message (the path in the text belongs to the sender's workspace)",onClick:un=>{un.stopPropagation(),Qt.kind==="fs"?no(Qt.path):Ta(p.channel,St[Qt.attachment_index])},children:[e.jsx(Hh,{}),e.jsx("span",{className:"team_attach_name",children:Mt}),Qt.kind==="attachment"?e.jsx("span",{className:"team_fs_chip_note",children:"attached"}):Qt.rewritten?e.jsx("span",{className:"team_fs_chip_note",children:"moved"}):null]},Mt)),Ut.map(Mt=>e.jsxs("button",{className:"team_attach_chip team_fs_chip team_work_chip",title:`Work item ${Mt} — open the Board filtered to it`,onClick:Qt=>{var un;Qt.stopPropagation(),(un=s.on_open_board)==null||un.call(s,Mt)},children:[e.jsx("span",{className:"team_work_glyph","aria-hidden":!0,children:"⛭"}),e.jsx("span",{className:"team_attach_name mono",children:Mt})]},`w:${Mt}`))]})})(),Se.length?e.jsx("div",{className:"team_row_asks",children:Se.map(We=>e.jsxs("span",{className:"team_ask",title:We.text,children:["ask ",We.id,": ",We.text.length>90?We.text.slice(0,90)+"…":We.text]},We.id))}):null,de?e.jsx("button",{className:"team_row_expand",onClick:We=>{We.stopPropagation(),vl(p)},children:N?"collapse":"show more"}):null]}),En?e.jsxs("div",{className:"team_row_rail",children:[p.id&&p.sender!==vt&&p.sender!=="hub"&&!p.retracted?(()=>{const We=Zi(p);return We?e.jsxs("span",{className:"team_vote_thumbs",children:[e.jsxs("button",{className:`btn btn_icon team_thumb ${We.mine>0?"up_on":""}`,title:We.mine>0?"Withdraw your +1 on this message":"+1 this message",disabled:!!si,onClick:St=>{St.stopPropagation(),xl(p.id,1)},children:[e.jsx(Ue,{name:We.mine>0?"thumbsUpFilled":"thumbsUp",size:13}),We.up?e.jsx("span",{className:"team_thumb_count",children:We.up}):null]}),e.jsxs("button",{className:`btn btn_icon team_thumb ${We.mine<0?"down_on":""}`,title:We.mine<0?"Withdraw your −1 on this message":"−1 this message",disabled:!!si,onClick:St=>{St.stopPropagation(),xl(p.id,-1)},children:[e.jsx(Ue,{name:We.mine<0?"thumbsDownFilled":"thumbsDown",size:13}),We.down?e.jsx("span",{className:"team_thumb_count",children:We.down}):null]})]}):null})():null,$.tts_supported&&p.id?(()=>{const We=$.tts_playback.key===p.id&&$.tts_playback.status==="playing",St=$.tts_playback.key===p.id&&$.tts_playback.status==="loading";return e.jsx("button",{className:`btn btn_icon ${We||St?"team_speak_on":""}`,title:We?"Pause":St?"Synthesizing…":h.enabled?"Read aloud (your voice override)":"Read aloud (gateway voice)","aria-label":We?"Pause reading":"Read this message aloud",onClick:Ot=>{Ot.stopPropagation();const Ut=hw(p.body||p.title||"");Ut?$.toggle_tts(p.id,Ut):W("Nothing readable to speak in this message (code/markup only).")},children:e.jsx(Ue,{name:We?"pause":St?"refresh":"speaker",size:13})})})():null,e.jsx("button",{className:"btn btn_icon",title:Se.length?"Reply and discharge this message's asks":"Reply in this trail (status=reply, linked to this message)",onClick:We=>{We.stopPropagation(),di(p)},children:"↩ Reply"}),p.sender===vt&&!p.retracted?e.jsx("button",{className:`btn btn_icon ${ps===p.id?"team_danger":""}`,title:ps===p.id?"Click again to retract: the words are redacted for every reader and the message stops demanding anything":"Retract this message (agents and entities will never read the words; two clicks)",onClick:We=>{We.stopPropagation(),ps===p.id?xr(p):ui(p.id)},children:ps===p.id?"⌫ confirm retract":"⌫ Retract"}):null,b.is_root&&(String(p.status||"").toLowerCase()==="open"||String(p.status||"").toLowerCase()==="blocked")?e.jsx("button",{className:`btn btn_icon ${ci===p.id?"team_danger":""}`,title:ci===p.id?"Click again to close this topic (posts a resolved reply)":"Mark this topic resolved — closes the thread on the hub (two clicks)",onClick:We=>{We.stopPropagation(),ci===p.id?ro(p):Cl(p.id)},children:ci===p.id?"✓ confirm resolve":"✓ Resolve"}):null]}):null]},p.id)}function Da(p){const b=p.replies.length,N=!!xe[p.root.id],S=!!ue[p.root.id],z=N?[]:S||Ge!=="all"||b<=Uh+1?p.replies:p.replies.slice(b-Uh),de=N?b:b-z.length,V=Pc[p.root.id];return e.jsxs("div",{className:`team_thread_group ${b?"has_replies":""}`,children:[p.orphan?e.jsx("div",{className:"team_orphan mono",title:"The parent message is older than the fetched window — the trail starts mid-flight.",children:"↩ reply to an earlier message (outside the window)"}):null,vs(p.root,{is_root:!0}),de>0||b>0||String(p.root.body||"").length>kc?e.jsxs("div",{className:"team_trail_bar",children:[b>0?e.jsx("button",{className:"team_replies_more",onClick:()=>ke(Se=>({...Se,[p.root.id]:!Se[p.root.id]})),children:N?`show ${b} repl${b===1?"y":"ies"}`:"fold thread"}):null,!N&&de>0?e.jsxs("button",{className:"team_replies_more",onClick:()=>ye(Se=>({...Se,[p.root.id]:!0})),children:["↓ ",de," earlier repl",de===1?"y":"ies"]}):null,!N&&u&&(b>0||String(p.root.body||"").length>kc)?e.jsx("button",{className:"team_replies_more team_summarize",disabled:!!(V!=null&&V.busy),title:"LLM summary of this trail (root + replies) — read-only, never posts",onClick:()=>void Nl(p),children:V!=null&&V.busy?"✦ summarizing…":`✦ Summarize (${b+1})`}):null]}):null,!N&&b>0?e.jsx("div",{className:"team_replies",children:z.map(Se=>vs(Se,{is_root:!1}))}):null,!N&&(V!=null&&V.text)?e.jsxs("div",{className:"team_summary",children:[e.jsxs("div",{className:"team_summary_head",children:[e.jsxs("span",{children:["AI summary — ",V.window||`${V.count} message${V.count===1?"":"s"}`]}),e.jsx("button",{className:"team_row_expand",onClick:()=>xa(Se=>({...Se,[p.root.id]:{busy:!1,text:"",error:"",count:0}})),children:"dismiss"})]}),e.jsx(ns,{className:"md_doc",text:Qo(V.text)})]}):null,V!=null&&V.error?e.jsx("div",{className:"page_error mono",children:V.error}):null]},p.root.id)}const hi=qe.length?qe[qe.length-1].seq:0,go=Math.max(hi,((Tt=oe.find(p=>p.name===D))==null?void 0:Tt.last_seq)||0),oa=((bs=oe.find(p=>p.name===D))==null?void 0:bs.member_count)||0,xs=((an=(bn||[]).find(p=>String(p.role||"")==="owner"))==null?void 0:an.agent_id)||"",At=!!vt&&xs===vt;return e.jsxs("div",{className:"page page_pad team_page",onDragOver:p=>{var b;Array.from(((b=p.dataTransfer)==null?void 0:b.types)||[]).includes("Files")&&(p.preventDefault(),En&&!Le&&wt(!0))},onDragLeave:p=>{p.currentTarget.contains(p.relatedTarget)||wt(!1)},onDrop:p=>{var b,N;(N=(b=p.dataTransfer)==null?void 0:b.files)!=null&&N.length&&(p.preventDefault(),wt(!1),!(!En||Le)&&io(p.dataTransfer.files))},children:[Pt?e.jsx("div",{className:"team_drop_overlay",children:e.jsxs("div",{className:"team_drop_overlay_card",children:["Drop to attach to ",Jt?wr:`#${D}`]})}):null,E!=null&&E.protocol&&E.protocol!==Nc||E!=null&&E.paused||se||In||Ur||T&&!T.seat_key_present?e.jsxs("div",{className:"team_statusstrip",children:[T&&!T.seat_key_present?e.jsx("span",{className:"chip mono warn",title:"No hub key for this seat — read-only until Continuum can read one (the seat's entry in ~/.agora/keys.json, or --hub-token-file at launch). The seat itself is set in Settings.",children:"read-only (no seat key)"}):null,E!=null&&E.protocol&&E.protocol!==Nc?e.jsxs("span",{className:"chip mono warn",title:`The hub advertises ${E.protocol}; this page was written against ${Nc}. Meaning may have shifted — rendering continues (protocol.md: warn, never refuse).`,children:["protocol ",E.protocol," ≠ ",Nc]}):null,E!=null&&E.paused?e.jsx("span",{className:"chip mono warn",title:"The operator paused the hub — posting resumes when it does.",children:"hub paused"}):null,se?e.jsx("span",{className:"page_error mono",children:se}):null,In?e.jsxs("span",{className:"page_error mono",children:["±1 failed: ",In]}):null,Ur?e.jsx("span",{className:"chip mono ok",children:Ur}):null]}):null,e.jsxs("div",{className:`team_layout ${Et?"with_drawer":""} ${Et==="leaderboard"?"drawer_wide":""} team_mobile_${$e} ${Re?"team_tools_open":""}`,children:[e.jsxs("div",{className:"pane team_channels_pane",onClickCapture:p=>{var b,N;(N=(b=p.target)==null?void 0:b.closest)!=null&&N.call(b,".team_channel")&&Oe("thread")},children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Channels"}),e.jsx("span",{className:"pane_count",children:oe.filter(p=>!p.name.startsWith("dm:")).length}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",title:"Create a channel (you become its owner)","aria-label":"New channel",onClick:()=>Ps(p=>({...p,open:!p.open})),children:e.jsx(Ue,{name:"plus",size:14})})})]}),$n.open?e.jsxs("div",{className:"team_new_channel",children:[e.jsx("input",{value:$n.name,onChange:p=>Ps(b=>({...b,name:p.target.value})),placeholder:"channel-name (simple slug)",onKeyDown:p=>{p.key==="Enter"&&so()}}),e.jsx(Li,{variant:"sm",label:"Private",hint:"Private channels need invites; public ones are joinable by any registered agent.",action:"new-channel-private",checked:$n.is_private,onChange:p=>Ps(b=>({...b,is_private:p}))}),e.jsx("button",{className:"btn primary",disabled:!$n.name.trim()||cn,onClick:()=>void so(),children:cn?"Creating…":"Create"})]}):null,e.jsxs("div",{className:"pane_body pane_body_list",children:[oe.length?null:e.jsx("div",{className:"muted team_note team_rail_degraded",children:se?"Channels unavailable — the hub is unreachable. Retrying automatically; check that the hub is running if this persists.":"Loading channels…"}),oe.filter(p=>!p.name.startsWith("dm:")).map(p=>{const b=Ne[p.name],N=Yn===p.name;return e.jsxs("div",{className:`team_channel team_dm_row ${D===p.name?"selected":""}`,role:"button",tabIndex:0,onClick:()=>be(p.name),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&be(p.name)},children:[e.jsxs("span",{className:"team_channel_line",children:[e.jsxs("span",{className:`team_channel_name ${b!=null&&b.unread?"has_unread":""}`,children:["#",p.name]}),e.jsxs("span",{className:"team_channel_badges",children:[b!=null&&b.unread?e.jsx("span",{className:"team_badge unread",role:"button",tabIndex:0,title:`${b.unread>=100?"100 or more":b.unread} unread message(s) for your seat — the Unread tab shows the same number. Click to open with the Unread filter.`,onClick:S=>{S.stopPropagation(),p.name!==D&&(et.current="unread"),be(p.name),ct("unread")},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.stopPropagation(),p.name!==D&&(et.current="unread"),be(p.name),ct("unread"))},children:b.unread>=100?"99+":b.unread}):null,b!=null&&b.open_questions?e.jsx("span",{className:"team_badge asks",role:"button",tabIndex:0,title:`${b.open_questions} open question(s) in this room still awaiting answers (channel digest) — click to open with the Asks filter`,onClick:S=>{S.stopPropagation(),p.name!==D&&(et.current="asks"),be(p.name),ct("asks")},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.stopPropagation(),p.name!==D&&(et.current="asks"),be(p.name),ct("asks"))},children:b.open_questions}):null,e.jsx("button",{className:`team_dm_trash ${N?"arming":""}`,title:N?"Click again to archive this channel (evicts members; history preserved)":"Archive this channel — evicts everyone and drops it off rails; messages are preserved (owner/operator)","aria-label":N?"Confirm archive channel":"Archive channel",disabled:cn,onClick:S=>{S.stopPropagation(),N?Sl(p.name):na(p.name)},children:e.jsx(Ue,{name:N?"x":"trash",size:12})})]})]}),e.jsx("span",{className:"team_channel_meta mono",children:N?"archive? click ✕":`${p.member_count} seats · ${Wo(p.last_at)}`})]},p.name)}),(()=>{const p=oe.filter(b=>b.name.startsWith("dm:"));return p.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"team_rail_section",children:"Direct messages"}),p.map(b=>{const N=Ne[b.name],S=b.name.replace(/^dm:/,"").split("--").filter(de=>de!==vt).join("")||b.name,z=Fc===b.name;return e.jsxs("div",{className:`team_channel team_dm_row ${D===b.name?"selected":""}`,role:"button",tabIndex:0,onClick:()=>be(b.name),onKeyDown:de=>{(de.key==="Enter"||de.key===" ")&&be(b.name)},children:[e.jsxs("span",{className:"team_channel_line",children:[e.jsxs("span",{className:`team_channel_name ${N!=null&&N.unread?"has_unread":""}`,children:["@",S]}),e.jsxs("span",{className:"team_channel_badges",children:[N!=null&&N.unread?e.jsx("span",{className:"team_badge unread",title:`${N.unread>=100?"100 or more":N.unread} unread message(s)`,children:N.unread>=100?"99+":N.unread}):null,e.jsx("button",{className:`team_dm_trash ${z?"arming":""}`,title:z?"Click again to remove this DM from your list":"Remove this DM from your list (history is kept; it reopens if they message you)","aria-label":z?"Confirm remove direct message":"Remove direct message",disabled:cn,onClick:de=>{de.stopPropagation(),z?qc(b.name):kl(b.name)},children:e.jsx(Ue,{name:z?"x":"trash",size:12})})]})]}),e.jsx("span",{className:"team_channel_meta mono",children:z?"remove? click ✕":Wo(b.last_at)})]},b.name)})]}):null})()]})]}),e.jsxs("div",{className:"pane team_thread_pane",children:[e.jsxs("div",{className:"pane_header team_thread_header",children:[e.jsx("button",{type:"button",className:"btn team_back_btn",onClick:()=>{Oe("channels"),rt(!1),Et&&Jn("")},"aria-label":"Back to channels",title:"Back to channels",children:"← Channels"}),e.jsx("button",{type:"button",className:"btn team_tools_btn",onClick:()=>rt(p=>!p),"aria-expanded":Re,"aria-label":Re?"Hide thread tools":"Show thread tools (filters, search, panels)",title:"Filters, search, panels and actions",children:Re?"Less":"More"}),e.jsx("span",{className:"pane_title team_pane_title",children:D?Jt?`@${wr} — direct`:`#${D}`:"Select a channel"}),D&&oa?e.jsxs("button",{className:"chip team_members_chip",onClick:()=>{Et!=="members"&&ss("members")},title:"View the channel members (opens the Members drawer, roster + moderation)",children:[oa," members"]}):null,ie?e.jsx("span",{className:"muted team_note",children:"loading…"}):null,e.jsxs("span",{className:"pane_header_actions",children:[$.tts_playback.status!=="idle"?e.jsx("button",{className:"btn team_speak_stop",title:"Stop reading aloud",onClick:()=>$.stop_tts(),children:"◼ Stop reading"}):null,(()=>{const p=Ge==="all"?go:Nr;return e.jsx("button",{className:"btn",onClick:()=>void Tl(p),disabled:!D||!qe.length||!p||Pi||ie,title:Ge==="all"?"Moves your inbox cursor for this channel to the latest message in the window. The ONE explicit 'I have seen this' act (nothing acks on render).":"Moves your inbox cursor to the last message VISIBLE under this filter — messages newer than it stay unread. (The cursor is a single high-water mark: hidden rows BELOW it are cleared too.)",children:Pi?"Marking…":`Mark read → #${p||"…"}`})})(),e.jsx("button",{className:"btn btn_icon",onClick:()=>{hs(),ea(D)},title:"Refresh channels, badges, and the thread window (the page also polls every 5s)","aria-label":"Refresh",children:e.jsx(Ue,{name:"refresh",size:14})}),Ht&&Ht!=="running"&&typeof Ht=="object"&&"ok"in Ht?Ht.ok?e.jsxs(Hn,{tone:"success",size:"sm",title:`Hash chain recomputed client-side over ${Ht.hashed} hashed turns (${Ht.legacy} pre-ledger); served head matches.`,children:["transcript intact (",Ht.hashed,")"]}):e.jsxs(Hn,{tone:"error",size:"sm",title:Ht.broken_at!==null?`Recomputed chain diverges at seq ${Ht.broken_at} — a hashed turn was edited, inserted, or reordered.`:"Chain internally consistent but the served head does not match the last turn — the hub is presenting a different commitment.",children:["TAMPERED",Ht.broken_at!==null?` at #${Ht.broken_at}`:" (head mismatch)"]}):null,Ht&&typeof Ht=="object"&&"error"in Ht?e.jsx(Hn,{tone:"warning",size:"sm",title:Ht.error,children:"verify failed"}):null,e.jsx("button",{className:"btn btn_icon",onClick:()=>void Dc(),disabled:!D||Ht==="running",title:"Fetch the channel's verbatim ledger and recompute the sha256 hash chain in this browser — independent of the hub's own verified flag.",children:Ht==="running"?"Verifying…":"Verify transcript"})]})]}),e.jsxs("div",{className:"team_filterbar",children:[e.jsx("div",{className:"seg seg_scroll",role:"group","aria-label":"Message filters",children:Ah.map(p=>{const b=Ge===p.id,N=ys[p.id];return e.jsxs("button",{className:`seg_btn ${b?"active":""}`,"aria-pressed":b,title:p.title,onClick:()=>ct(p.id),children:[p.label,typeof N=="number"&&N>0?e.jsx("span",{className:"team_filter_count",children:N}):null]},p.id)})}),e.jsxs("form",{className:"team_search_bar",onSubmit:p=>{p.preventDefault();const b=ia.trim();if(!b&&!Tn){Pa("down"),fi("",Ra,"down");return}Al(b)},children:[e.jsx("input",{className:"team_search_input",type:"search",placeholder:"Search the hub…",value:ia,onChange:p=>fo(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(An&&ho(),fo(""))},title:"Search everything your seat can read (Enter). Served as a grouped report: decisions, open threads, work, people, files, messages. Enter on an empty box browses rated messages (most-downvoted first).","aria-label":"Search the hub"}),An?e.jsx("button",{type:"button",className:"btn btn_icon team_search_close",onClick:ho,title:"Close search results (Esc)","aria-label":"Close search results",children:"✕"}):null]}),e.jsxs("div",{className:"seg",role:"group","aria-label":"Sort order",children:[e.jsx("button",{className:`seg_btn ${Aa==="recency"?"active":""}`,"aria-pressed":Aa==="recency",title:"Threads by last activity (default)",onClick:()=>Ct("recency"),children:"Recency"}),e.jsx("button",{className:`seg_btn ${Aa==="votes"?"active":""}`,"aria-pressed":Aa==="votes",title:"The channel's most-voted messages — whole channel, ranked by net standing ±1 (hub-served order)",onClick:()=>{Ct("votes"),kr()},children:"Top voted"})]}),e.jsxs("span",{className:"team_filterbar_meta",children:[e.jsx("span",{className:`team_live_dot ${Hi?"on":""}`,title:Hi?"Live: agents' posts push instantly over a websocket. Your own posts from OTHER windows arrive with the 5s poll (the hub skips echoing your seat's frames back).":"Polling every 5s — the live socket is down (it reconnects automatically).",children:Hi?"● live":"◌ polling"})," · ",aa.length!==_s.length?`${aa.length} of ${_s.length} threads`:_s.length?`${_s.length} threads`:"",T!=null&&T.seat_key_present?e.jsxs("span",{title:"Posts are authored under this hub seat — your own identity, key held server-side.",children:[" · as ",T.seat]}):null]})]}),e.jsx("div",{className:"pane_body team_thread",ref:ni,children:An?(()=>{const p=An;if(p.error)return e.jsx("div",{className:"muted team_note",children:p.error});if(p.busy||!p.report)return e.jsx("div",{className:"muted team_note",children:p.q?`Searching “${p.q}”…`:"Browsing rated messages…"});const b=p.report;if(Sr){const z=Sr;return e.jsxs("div",{className:"team_search_results",children:[e.jsxs("div",{className:"team_search_meta",children:[e.jsx("button",{className:"team_replies_more",onClick:()=>Xn(null),children:"← All results"}),e.jsxs("span",{className:"muted",children:[z.label," matching “",p.q,"” — newest first",z.total?` · ${z.hits.length} of ${z.total}`:""]})]}),z.error?e.jsx("div",{className:"muted team_note",children:z.error}):null,z.hits.map(de=>Zn(de)),z.busy?e.jsx("div",{className:"muted team_note",children:"Loading…"}):null,!z.busy&&z.cursor?e.jsx("button",{className:"team_replies_more team_search_more",onClick:po,children:"Load more"}):null,!z.busy&&!z.hits.length&&!z.error?e.jsxs("div",{className:"muted team_note",children:["Nothing in ",z.label.toLowerCase()," matches “",p.q,"”."]}):null]})}const N=jc.filter(z=>{var de;return!((((de=b[z.id])==null?void 0:de.total)??0)>0)}),S=N.length<jc.length;return e.jsxs("div",{className:"team_search_results",children:[b.relaxed&&(!b.mode_used||b.mode_used==="lexical")?e.jsx("div",{className:"team_search_relaxed",title:"The strict query (all terms) found nothing, so the hub re-ran it as ANY-term (OR). Matches below are looser than what you typed.",children:"No exact matches — showing loosened (any-term) matches instead."}):null,b.notice?e.jsx("div",{className:"team_search_notice",title:"Served by the hub while search is degraded — quote this text in anything you conclude from these results.",children:b.notice}):null,e.jsxs("div",{className:"team_search_meta",children:[e.jsxs("span",{className:"muted",children:[p.q?`“${p.q}”`:`rated messages${Tn?` (${Tn==="down"?"↓ downvoted":"↑ upvoted"}, net-vote order)`:""}`," · ",b.channels_searched??0," channel",(b.channels_searched??0)===1?"":"s"," searched",b.mode_used?e.jsxs("span",{className:"team_search_mode mono",title:"Which search engine answered: fused = word + meaning matches blended; lexical = words only; semantic = meaning only. Served verbatim by the hub.",children:[" ","· ",b.mode_used,typeof b.semantic_coverage=="number"?` (${Math.round(b.semantic_coverage*100)}% embedded)`:""]}):null]}),e.jsx("span",{className:"seg team_search_rated",role:"group","aria-label":"Rated filter",children:["up","down"].map(z=>e.jsx("button",{className:`seg_btn ${Tn===z?"active":""}`,"aria-pressed":Tn===z,title:z==="up"?"Only messages with net-positive standing ratings (toggle re-runs)":"Only messages with net-negative standing ratings — where displeasure lives (toggle re-runs)",onClick:()=>{const de=Tn===z?"":z;Pa(de),fi(p.q,Ra,de)},children:z==="up"?"▲ rated":"▼ rated"},z))}),e.jsxs("label",{className:"team_search_scope",title:"Limit the search to the channel currently open in the rail (re-runs the query)",children:[e.jsx("input",{type:"checkbox",checked:Ra==="channel",onChange:z=>{const de=z.target.checked?"channel":"all";Uc(de),fi(p.q,de,Tn)}}),"this channel only"]})]}),jc.map(z=>{const de=b[z.id],V=(de==null?void 0:de.shown)??0,Se=(de==null?void 0:de.total)??0,Ie=(de==null?void 0:de.hits)??[];return!de||!Se&&!Ie.length?null:e.jsxs("div",{className:"team_search_section",children:[e.jsxs("div",{className:"team_search_section_head",children:[e.jsx("span",{className:"team_search_section_label",children:z.label}),e.jsx("span",{className:"muted mono",children:V<Se?`showing ${V} of ${Se}`:`${Se}`}),V<Se&&z.kind?e.jsx("button",{className:"team_replies_more",onClick:()=>Wc(z.label,z.kind),title:`All ${Se} ${z.label.toLowerCase()} matches, newest first (paged)`,children:"view all →"}):null]}),Ie.map(Be=>Zn(Be))]},z.id)}),S?N.length?e.jsxs("div",{className:"muted team_search_empties",children:["nothing in ",N.map(z=>z.label.toLowerCase()).join(", ")]}):null:e.jsx("div",{className:"muted team_note",children:p.q?`Nothing matches “${p.q}” in the channels this seat can read.`:"No rated messages match this lens."})]})})():Aa==="votes"?mo?e.jsx("div",{className:"muted team_note",children:mo}):ra===null?e.jsx("div",{className:"muted team_note",children:"Loading the channel's top-voted messages…"}):ra.length?ra.map((p,b)=>e.jsxs("div",{className:"team_top_row",children:[e.jsxs("div",{className:"team_top_rank_line",children:[e.jsxs("span",{className:"team_top_rank mono",title:"Rank by net standing rating (hub-served order)",children:["#",b+1]}),e.jsx("button",{className:"team_replies_more",onClick:()=>mi(p),title:"Switch back to recency and scroll to this message in its thread",children:"view in thread"})]}),vs(p,{is_root:!0})]},p.id)):e.jsx("div",{className:"muted team_note",children:"No rated messages in this channel yet — cast the first ±1 from any message's thumbs."}):e.jsxs(e.Fragment,{children:[(()=>{const p=[];let b="";for(const N of aa){const S=N.replies.length?N.replies[N.replies.length-1]:N.root,z=xj(S.created_at);z&&z!==b&&(b=z,p.push(e.jsx("div",{className:"team_day_divider",children:e.jsx("span",{children:z})},`day:${z}:${N.root.id}`))),p.push(Da(N))}return p})(),!aa.length&&D&&!ie?e.jsx("div",{className:"muted team_note",children:_s.length?e.jsxs(e.Fragment,{children:["Nothing matches the ",e.jsx("strong",{children:((gn=Ah.find(p=>p.id===Ge))==null?void 0:gn.label)||Ge})," filter in this channel — the messages exist under All."," ",e.jsx("button",{className:"team_replies_more",onClick:()=>ct("all"),children:"Show all"})]}):"No messages in the window."}):null]})}),e.jsxs("div",{className:"team_composer",onKeyDown:p=>{p.key==="Escape"&&ot&&sa()},children:[ot?e.jsxs("div",{className:"team_reply_banner",children:[e.jsxs("button",{className:"team_reply_target",title:"Jump to the message you are replying to",onClick:()=>{var p;(p=document.getElementById(`hubmsg-${ot.id}`))==null||p.scrollIntoView({block:"center"})},children:["↩ #",ot.seq," (",ot.sender,") —"," ",(String(ot.title||"").trim()||String(ot.body||"").trim()).slice(0,80)||"(no text)"]}),(((Fs=ot.data)==null?void 0:Fs.asks)||[]).length?e.jsx("span",{className:"team_reply_asks",children:(((la=ot.data)==null?void 0:la.asks)||[]).map(p=>e.jsxs("label",{title:p.text,children:[e.jsx("input",{type:"checkbox",checked:!!$s[p.id],onChange:b=>nr(N=>({...N,[p.id]:b.target.checked}))}),e.jsxs("span",{className:"team_reply_ask_text",children:["ask ",p.id,": ",p.text.length>70?p.text.slice(0,70)+"…":p.text]})]},p.id))}):null,e.jsx("button",{className:"team_row_expand",onClick:sa,children:"cancel (Esc)"})]}):null,Es==="void_reply"?e.jsxs("div",{className:"team_nudge",children:["This reply discharges NO asks — the parent stays formally open on the hub. Check an ask above, or press ",ot?"Reply":"Post"," again to send as-is."]}):null,Es==="untitled_open"?e.jsxs("div",{className:"team_nudge",children:["An ",e.jsx("code",{children:"open"})," post without a title — receivers triage by headline (hub etiquette). Add one, or press Ask again to send untitled."]}):null,On?e.jsx("div",{className:"team_group_preview",title:"Creates a private room, DMs invites to the mentioned seats, posts the topic as the opening open message, and switches you in",children:On.members.length?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_group_label",children:"group room"}),e.jsxs("span",{className:"mono team_group_name",children:["#",On.name]}),e.jsxs("span",{className:"team_group_invites",children:["invites: ",On.members.map(p=>`@${p}`).join(" ")]})]}):e.jsx("span",{className:"muted",children:On.source==="kind"?"Add members below — write their names like @entity @assistant":"/group needs @mentions — e.g. /group fix the voice outage @gateway @core"})}):null,!ot&&!Jt&&(ge==="ask"||ge==="group")?e.jsx("input",{className:"team_ask_title",value:Fe,onChange:p=>Xe(p.target.value),placeholder:ge==="group"?"Group topic — names the room (e.g. fix the voice outage)":"Title — receivers triage asks by headline",disabled:!En}):null,!ot&&!Jt&&ge==="group"?e.jsx("input",{className:"team_ask_title team_group_members",value:_t,onChange:p=>jt(p.target.value),placeholder:"Members — write their names: @entity @assistant @gateway",disabled:!En,list:"team_roster_options"}):null,!ot&&!Jt&&ge==="group"&&Rs.length?e.jsx("datalist",{id:"team_roster_options",children:Rs.map(p=>e.jsx("option",{value:`@${p}`},p))}):null,ut.length?e.jsx("div",{className:"team_attach_pending",children:ut.map(p=>e.jsxs("span",{className:"team_attach_chip",title:`${p.content_type} · ${Vn(p.size)} — click to preview`,children:[e.jsxs("button",{className:"team_attach_open",onClick:()=>void Ta(D,p),"aria-label":`Preview ${p.filename}`,children:[e.jsx(Ue,{name:"paperclip",size:11}),e.jsx("span",{className:"team_attach_name",children:p.filename}),e.jsx("span",{className:"muted",children:Vn(p.size)})]}),e.jsx("button",{className:"team_attach_x","aria-label":`Remove ${p.filename}`,title:"Remove this attachment",onClick:()=>mt(b=>b.filter(N=>N.id!==p.id)),children:e.jsx(Ue,{name:"x",size:10})})]},p.id))}):null,e.jsxs("div",{className:"team_compose_row",children:[!ot&&!Jt?e.jsxs("select",{className:"team_compose_control team_kind_select",value:ge,onChange:p=>{const b=p.target.value,N=b==="ask"?"ask":b==="dm"?"dm":b==="group"?"group":"fyi";Te(N),N!=="ask"&&N!=="group"&&Xe(""),N!=="group"&&jt("")},disabled:!En,title:"fyi = informational · ask = expects replies (posts as status=open) · dm = private direct message · group = focused private room with invited members",children:[e.jsx("option",{value:"fyi",children:"fyi"}),e.jsx("option",{value:"ask",children:"ask"}),e.jsx("option",{value:"dm",children:"dm"}),e.jsx("option",{value:"group",children:"group"})]}):null,!ot&&!Jt&&ge==="dm"?Rs.length?e.jsxs("select",{className:"team_compose_control team_dm_peer",value:Ye,onChange:p=>yt(p.target.value),disabled:!En,title:"Recipient — every agent on the hub you share a channel with, connected or not",children:[e.jsx("option",{value:"",children:"to: member…"}),Rs.map(p=>e.jsx("option",{value:p,children:p},p))]}):e.jsx("input",{className:"team_compose_control team_dm_peer",value:Ye,onChange:p=>yt(p.target.value),placeholder:"to: agent id",disabled:!En,title:"Recipient agent id (roster unavailable — type it; #FALLBACK)"}):null,e.jsx("textarea",{ref:tn,className:"team_compose_text",rows:2,value:ee,onChange:p=>Pe(p.target.value),placeholder:En?ot?`Reply to #${ot.seq} in #${D}…`:Jt?`Message ${wr}…`:ge==="dm"?`Direct message${Ye.trim()?` to ${Ye.trim()}`:""}…`:u?`Message #${D||"…"} as ${(T==null?void 0:T.seat)||"operator"} — or /assistant <question>`:`Message #${D||"…"} as ${(T==null?void 0:T.seat)||"operator"}`:E!=null&&E.paused?"The hub is paused by the operator — posting resumes when it does.":"Read-only: the proxy has no operator seat key.",disabled:!En,onKeyDown:p=>{p.key!=="Enter"||p.shiftKey||p.nativeEvent.isComposing||p.keyCode===229||(p.preventDefault(),!Ks&&(ee.trim()||ut.length)&&uo())}}),e.jsx("input",{ref:ht,type:"file",multiple:!0,style:{display:"none"},onChange:p=>void io(p.target.files)}),e.jsx("button",{className:"btn team_attach_btn",disabled:!En||Le||ut.length>=Bo,title:ut.length>=Bo?`Attachment limit (${Bo}) reached`:"Attach a file or image (delivered to every recipient)","aria-label":"Attach a file",onClick:()=>{var p;return(p=ht.current)==null?void 0:p.click()},children:e.jsx(Ue,{name:"paperclip",size:14})}),e.jsxs("button",{className:"btn primary team_send",disabled:!En||Ks||!ee.trim()&&!ut.length&&!(ge==="group"&&!ot&&!Jt&&yd(_t).length>0),onClick:()=>void uo(),"aria-label":Ks?"Sending":void 0,children:[e.jsx("span",{className:"team_send_icon","aria-hidden":"true",children:e.jsx(Ue,{name:"send",size:16})}),e.jsx("span",{className:"team_send_label",children:Ks?"Sending…":On!=null&&On.members.length||!ot&&!Jt&&ge==="group"?"Create room":ot?"Reply":Jt||ge==="dm"?"Send DM":ge==="ask"?"Ask":"Send"})]})]})]})]}),Et==="assistant"?e.jsxs("div",{className:"pane team_drawer team_ai_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Assistant"}),e.jsxs("span",{className:"pane_count",children:["#",D]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>Jn(""),title:"Close",children:"✕"})})]}),e.jsxs("div",{className:"pane_body team_ai_thread",children:[zs.length?null:e.jsxs("div",{className:"muted team_note",children:["Ask anything about #",D," — strategies used, deviations, who owes what, how a decision was reached. The model reads the current channel window (",qe.length," messages) and cites seqs. It never posts to the room."]}),zs.map((p,b)=>e.jsxs("div",{className:`team_ai_turn ${p.role}`,children:[e.jsx("div",{className:"team_ai_role mono",children:p.role==="user"?"you":"analyst"}),e.jsx(ns,{className:"md_doc",text:Qo(p.content)})]},b)),zs.length&&fl?e.jsxs("div",{className:"muted team_note",children:["Last answer read ",fl,"."]}):null,Zs?e.jsx("div",{className:"muted team_note",children:"thinking…"}):null,Bi?e.jsx("div",{className:"page_error mono",children:Bi}):null]}),e.jsx("div",{className:"team_composer",children:e.jsx(ol,{value:ti,onChange:fr,onSubmit:()=>{const p=ti;fr(""),li(p)},placeholder:u?`Ask about #${D}…`:"AI advisor is not configured for this shell.",disabled:!u,busy:Zs,rows:2,sendLabel:"Ask",busyLabel:"Asking…"})})]}):null,Et==="members"?e.jsxs("div",{className:"pane team_drawer team_members_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Members"}),e.jsxs("span",{className:"pane_count",children:["#",D]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>Jn(""),title:"Close",children:"✕"})})]}),e.jsx("div",{className:"pane_body team_members_body",children:_o()})]}):null,Et==="files"?e.jsxs("div",{className:"pane team_drawer team_files_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Files"}),e.jsxs("span",{className:"pane_count",children:["#",D]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>Jn(""),title:"Close",children:"✕"})})]}),e.jsxs("div",{className:"team_fs_crumbs",children:[e.jsxs("button",{className:`team_fs_crumb ${Xs===""?"active":""}`,onClick:()=>sn(""),title:"Channel root",children:["#",D||"…"]}),Xs?Xs.split("/").map((p,b,N)=>{const S=N.slice(0,b+1).join("/");return e.jsxs(Bt.Fragment,{children:[e.jsx("span",{className:"team_fs_crumb_sep",children:"/"}),e.jsx("button",{className:`team_fs_crumb ${b===N.length-1?"active":""}`,onClick:()=>sn(S),children:p})]},S)}):null]}),e.jsx("div",{className:"pane_body pane_body_list",children:Ys===null&&!ja?e.jsx("div",{className:"muted team_note",children:"Loading files…"}):ja?e.jsx("div",{className:"page_error mono",children:ja}):Ys&&Ys.length?(()=>{const{dirs:p,leaves:b}=qw(Ys,Xs);return!p.length&&!b.length?e.jsx("div",{className:"muted team_note",children:"Empty folder."}):e.jsxs(e.Fragment,{children:[p.map(N=>e.jsxs("button",{className:"team_file_row team_fs_dir",onClick:()=>sn(N.path),title:`${N.count} file(s) inside`,children:[e.jsx("span",{className:"team_fs_icon",children:e.jsx(gj,{})}),e.jsx("span",{className:"team_file_path",children:N.name}),e.jsx("span",{className:"team_file_meta mono",children:N.count})]},N.path)),b.map(N=>e.jsxs("button",{className:"team_file_row",onClick:()=>void gr(N),title:`${N.updated_by||"?"} · ${Ho(N.updated_at)} · v${N.version} · ${Vn(N.size)}`,children:[e.jsx("span",{className:"team_fs_icon",children:e.jsx(Hh,{})}),e.jsxs("span",{className:"team_file_name_wrap",children:[e.jsx("span",{className:"team_file_path",children:N.path.slice(Xs?Xs.length+1:0)}),N.description?e.jsx("span",{className:"team_file_desc muted",children:N.description}):null]}),e.jsxs("span",{className:"team_file_meta mono",children:[Vn(N.size)," · ",Wo(N.updated_at)]})]},N.path))]})})():e.jsx("div",{className:"muted team_note",children:"No files in this channel's virtual filesystem yet."})})]}):null,Et==="leaderboard"?e.jsxs("div",{className:"pane team_drawer team_lb_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Leaderboard"}),e.jsx("span",{className:"pane_count",children:wn==="hub"?"hub-wide":`#${D}`}),e.jsxs("span",{className:"pane_header_actions",children:[e.jsxs("span",{className:"team_lb_scope",role:"tablist","aria-label":"Leaderboard scope",children:[e.jsx("button",{className:`team_lb_scope_btn ${wn==="channel"?"active":""}`,onClick:()=>{wa("channel"),Qi("channel")},disabled:!D,title:`This channel's board (#${D||"…"})`,children:"Channel"}),e.jsx("button",{className:`team_lb_scope_btn ${wn==="hub"?"active":""}`,onClick:()=>{wa("hub"),Qi("hub")},title:"Hub-wide: the sum of every channel's scores",children:"Hub"})]}),e.jsx("button",{className:"btn btn_icon",onClick:()=>Jn(""),title:"Close",children:"✕"})]})]}),e.jsx("div",{className:"pane_body pane_body_list team_lb_body",children:zn===null&&!Xr?e.jsx("div",{className:"muted team_note",children:"Loading leaderboard…"}):Xr?e.jsx("div",{className:"muted team_note",children:Xr}):!zn||zn.leaderboard.length===0?e.jsx("div",{className:"muted team_note",children:Array.isArray(zn==null?void 0:zn.categories)?`No reputation yet${wn==="channel"?" in this channel":""}. Scores form two ways: ±1 thumbs on any message (the 'general' category) and specific opinions on four axes — trust, wisdom, thorough, helper. Every standing vote counts: score = upvotes − downvotes. Be the first to rate.`:`No reputation votes yet${wn==="channel"?" in this channel":""}. Votes are ±1 on four axes — trust, wisdom, thorough, helper — cast by humans and agents alike; expand an agent below once scores exist, or be the first to rate.`}):e.jsx(e.Fragment,{children:(()=>{var S;const p=Array.isArray(zn.categories)||zn.leaderboard.some(z=>z.breakdown!=null||typeof z.score=="number"),b=p?(S=zn.categories)!=null&&S.length?zn.categories:["general",...Ti.map(z=>z.id)]:[],N=p&&b.length!==5?{gridTemplateColumns:`20px 22px minmax(70px, 1.5fr) minmax(40px, 0.7fr) repeat(${b.length}, minmax(40px, 0.8fr))`}:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"team_lb_legend","aria-hidden":"true",style:N,children:[e.jsx("span",{className:"team_lb_legend_rank",children:"#"}),e.jsx("span",{className:"team_lb_legend_avatar"}),e.jsx("span",{className:"team_lb_legend_agent",children:"Agent"}),p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_lb_legend_total",title:"THE reputation score (operator ruling dm#129): one number — sum of every category's score. Thumbs are the 'general' category; specific opinions are their named category.",children:"Score"}),b.map(z=>e.jsx("span",{className:"team_lb_legend_axis",title:Gh[z]||`${Vo(z)} — reputation category.`,children:Vo(z)},z))]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_lb_legend_total",title:"Sum of all axis scores",children:"Total"}),Ti.map(z=>e.jsx("span",{className:"team_lb_legend_axis",title:z.help,children:z.label},z.id)),e.jsx("span",{className:"team_lb_legend_axis",title:"Message ratings, collapsed per rater (agora-0122): each rater contributes ONE net sign across the agent's messages — flips cancel, farming doesn't count. ▲ raters up · ▼ raters down.",children:"Msgs"})]})]}),zn.leaderboard.map((z,de)=>e.jsxs(Bt.Fragment,{children:[e.jsxs("div",{className:`team_lb_row ${ms===z.target?"open":""}`,style:N,onClick:()=>Yi(z.target),role:"button",tabIndex:0,onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),Yi(z.target))},title:wn==="hub"?`${z.target}: rated in ${z.channels||0} channel(s) by ${z.raters} rater(s)`:p?`${z.target}: ${z.raters} rater(s) — click for attributed OPINION votes (general/thumbs live on the messages themselves)`:`${z.target}: ${z.raters} rater(s) — click for the votes behind the score`,children:[e.jsx("span",{className:`team_lb_rank ${de<3?`top${de+1}`:""}`,"aria-hidden":"true",children:de<3?"●":de+1}),e.jsx("span",{className:"team_avatar",style:Qa(z.target),"aria-hidden":"true",children:z.target.slice(0,1).toUpperCase()}),e.jsx("span",{className:"team_lb_agent",children:z.target}),p?e.jsxs(e.Fragment,{children:[(()=>{const V=Number(z.score||0),Se=z.votes;return e.jsxs("span",{className:`team_lb_total ${V>0?"pos":V<0?"neg":""}`,title:(()=>{const Ie=Object.entries(z.breakdown||{}).filter(([,Be])=>Be&&Number(Be.score||0)!==0).map(([Be,Ve])=>`${Vo(Be)} ${Number(Ve.score)>0?"+":""}${Number(Ve.score)}`).join(" · ");return`${z.target}: score ${V>0?"+":""}${V} = ${Ie||"no standing voices"} (categories sum; every standing vote counts — operator ruling dm#161)${Se?` — total: ${Se.up} up, ${Se.down} down`:""}`})(),children:[V>0?`+${V}`:V,Se&&(Se.up||Se.down)?e.jsxs("span",{className:"team_lb_rawvotes mono",children:[" ",e.jsxs("span",{className:"rv_up",children:[Se.up,"↑"]}),e.jsxs("span",{className:Se.down>0?"rv_down_hot":"rv_down",children:[Se.down,"↓"]})]}):null]})})(),b.map(V=>{var Ve;const Se=(Ve=z.breakdown)==null?void 0:Ve[V],Ie=Number((Se==null?void 0:Se.score)||0),Be=!!(Se&&(Se.up||Se.down||Se.raters));return e.jsx("span",{className:`team_lb_axis ${Ie>0?"pos":Ie<0?"neg":""}`,title:Be?`${Vo(V)}: ${Ie>0?"+":""}${Ie} (▲${Se.up} ▼${Se.down} voices · ${Se.raters} engaged colleague${Se.raters===1?"":"s"}) — ${Gh[V]||"reputation category"}`:`${Vo(V)}: no standing input`,children:Be?Ie>0?`+${Ie}`:Ie:"·"},V)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`team_lb_total ${(z.total||0)>0?"pos":(z.total||0)<0?"neg":""}`,children:(z.total||0)>0?`+${z.total}`:z.total||0}),Ti.map(V=>{var Be;const Se=(Be=z.axes)==null?void 0:Be[V.id],Ie=(Se==null?void 0:Se.score)||0;return e.jsx("span",{className:`team_lb_axis ${Ie>0?"pos":Ie<0?"neg":""}`,title:Se?`${V.label}: ${Se.up} up, ${Se.down} down`:`${V.label}: no votes`,children:Se?Ie>0?`+${Ie}`:Ie:"·"},V.id)}),(()=>{const V=z.messages,Se=V?V.up-V.down:0;return e.jsx("span",{className:`team_lb_axis ${Se>0?"pos":Se<0?"neg":""}`,title:V&&(V.up||V.down)?`Message ratings: ${V.up} rater(s) net-up, ${V.down} net-down (per-rater collapse — flips cancel)`:"Message ratings: none standing",children:V&&(V.up||V.down)?`▲${V.up}${V.down?` ▼${V.down}`:""}`:"·"})})()]})]}),ms===z.target&&wn==="channel"?e.jsxs("div",{className:"team_lb_detail",children:[e.jsxs("div",{className:"team_lb_cast",children:[e.jsxs("span",{className:"team_lb_cast_label",title:`Your standing vote as ${vt} — one live ±1 per axis; casting again revises, never stacks`,children:["rate as ",vt||"operator",":"]}),Ti.map(V=>e.jsxs("span",{className:"team_lb_cast_axis",title:V.help,children:[e.jsx("span",{className:"team_lb_cast_axis_name",children:V.label}),e.jsx("button",{className:"btn btn_icon team_lb_vote up",disabled:!!mr||z.target===vt,onClick:Se=>{Se.stopPropagation(),eo(z.target,V.id,1)},title:`+1 ${V.label} for ${z.target}`,children:e.jsx(Ue,{name:"thumbsUp",size:12})}),e.jsx("button",{className:"btn btn_icon team_lb_vote down",disabled:!!mr||z.target===vt,onClick:Se=>{Se.stopPropagation(),eo(z.target,V.id,-1)},title:`-1 ${V.label} for ${z.target}`,children:e.jsx(Ue,{name:"thumbsDown",size:12})})]},V.id))]}),e.jsx("input",{className:"team_lb_note",placeholder:"why — one line, on the record (optional, applies to your next vote)",value:Zr,maxLength:280,onChange:V=>dr(V.target.value),onClick:V=>V.stopPropagation()}),In?e.jsx("div",{className:"team_lb_error",children:In}):null,Oi===null?e.jsx("div",{className:"muted team_note",children:"Loading votes…"}):Oi.length===0?e.jsx("div",{className:"muted team_note",children:p?"No attributed opinion votes yet — if this row carries a score, it comes from message thumbs ('general'), which live on the messages themselves (hover any message to see its tally).":"No attributed votes yet."}):Oi.map(V=>e.jsxs("div",{className:"team_lb_vote_row",children:[e.jsx("span",{className:"team_avatar team_avatar_sm",style:Qa(V.rater),"aria-hidden":"true",children:V.rater.slice(0,1).toUpperCase()}),e.jsx("span",{className:"team_lb_vote_rater",children:V.rater}),e.jsx("span",{className:"team_lb_vote_axis",children:V.axis}),e.jsx(Ue,{name:V.value>0?"thumbsUpFilled":"thumbsDownFilled",size:12,className:`team_lb_vote_val ${V.value>0?"pos":"neg"}`,title:V.value>0?"+1":"-1"}),e.jsx("span",{className:"team_lb_vote_note",title:V.note,children:V.note||e.jsx("span",{className:"muted",children:"no note"})})]},`${V.rater}:${V.axis}`))]}):null,ms===z.target&&wn==="hub"?e.jsx("div",{className:"team_lb_detail",children:e.jsx("div",{className:"muted team_note",children:p?"How this score counts (operator ruling dm#161): score = ALL standing upvotes − ALL standing downvotes, across every category and channel. A flip revises its own vote; withdrawing removes it. Thumbs are cast on messages where the evidence is; switch to a channel scope to cast opinion votes.":"Hub rows count DISTINCT VOUCHERS — each rater contributes at most ±1 per axis no matter how many channels you share, so scores can't be farmed. Switch to a channel scope to see attributed votes and cast yours."})}):null]},z.target)),e.jsx("div",{className:"muted team_lb_footnote",children:p?"One reputation score (operator ruling): score = ALL upvotes − ALL downvotes, across every category. Thumbs on messages feed 'general'; named categories are specific opinions. Expand a row to cast opinions; self-votes refused.":"Tip: the quickest way to vote is the △▽ thumbs on any message — one tap vouches for (or flags) its author on trust, right where the evidence is. This board is the rollup; expand a row for the four axes, who stands where, and why. ±1 per rater per axis, revising replaces, self-votes refused."})]})})()})})]}):null,Et==="desk"?e.jsxs("div",{className:"pane team_drawer_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Operator desk"}),e.jsxs("span",{className:"pane_header_actions",style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[e.jsx("button",{className:"btn",onClick:()=>void le(),title:"Reload",children:"Refresh"}),e.jsx("button",{className:"btn btn_icon",onClick:()=>Jn(""),title:"Close",children:"✕"})]})]}),e.jsxs("div",{className:"pane_body pane_body_list",children:[Y==="loading"?e.jsx("div",{className:"muted team_note",children:"Loading…"}):null,Y===null&&te?e.jsx("div",{className:"muted team_note",children:te}):null,Y!==null&&Y!=="loading"?e.jsxs(e.Fragment,{children:[Y.rows.length?null:e.jsx("div",{className:"muted team_note",children:"Nothing waits on you. Clear desk."}),Y.rows.map((p,b)=>{const N=Number(p.age_minutes),S=Number.isFinite(N)?N<60?`${Math.max(1,Math.round(N))}m`:N<2880?`${Math.round(N/60)}h`:`${Math.round(N/1440)}d`:"";return e.jsxs("div",{className:"team_desk_row",children:[e.jsxs("div",{className:"team_desk_row_head",children:[e.jsx("span",{className:`chip mono ${String(p.kind)==="ask"?"warn":""}`,children:String(p.kind||"ask")}),e.jsx("span",{className:"mono muted",children:String(p.who_waits||"?")}),e.jsx("span",{className:"muted",style:{marginLeft:"auto"},title:"Waiting since (oldest first)",children:S})]}),e.jsx("div",{className:"team_desk_row_what",children:String(p.what||"")}),p.one_action?e.jsxs("div",{className:"team_desk_row_needed muted",children:["→ ",String(p.one_action)]}):null,p.channel?e.jsx("button",{className:"team_row_expand",onClick:()=>{Qn.current={message_id:p.id?String(p.id):void 0,seq:Number(p.seq)||void 0},String(p.channel)===D?yr():be(String(p.channel)),Jn("")},title:"Open the message that waits on you",children:"open ↗"}):null]},String(p.id||p.key||b))}),Y.satisfied.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"muted team_note team_desk_satisfied_head",children:"Satisfied — the hub observed each item's done-condition; these clear themselves:"}),Y.satisfied.map((p,b)=>e.jsxs("div",{className:"team_desk_row satisfied",children:[e.jsxs("div",{className:"team_desk_row_head",children:[e.jsx("span",{className:"chip mono ok",children:"done"}),e.jsx("span",{className:"mono muted",children:String(p.who_waits||"")})]}),e.jsx("div",{className:"team_desk_row_what muted",children:String(p.what||"")})]},String(p.key||b)))]}):null]}):null]})]}):null,e.jsxs("div",{className:"team_drawer_rail",children:[u?e.jsx("button",{className:`team_drawer_tab ${Et==="assistant"?"active":""}`,onClick:()=>ss("assistant"),disabled:!D,"aria-pressed":Et==="assistant",title:"Channel assistant — ask an LLM about this channel (also: type /assistant in the composer)",children:"Assistant"}):null,e.jsx("button",{className:`team_drawer_tab ${Et==="members"?"active":""}`,onClick:()=>ss("members"),disabled:!D,"aria-pressed":Et==="members","aria-label":"Open channel members drawer",title:"Channel members — roster, moderation, and channel lifecycle",children:"Members"}),e.jsx("button",{className:`team_drawer_tab ${Et==="files"?"active":""}`,onClick:()=>ss("files"),disabled:!D,"aria-pressed":Et==="files","aria-label":"Open channel files drawer",title:"Channel files — browse this channel's virtual filesystem (/fs)",children:"Files"}),e.jsx("button",{className:`team_drawer_tab ${Et==="leaderboard"?"active":""}`,onClick:()=>ss("leaderboard"),disabled:!D,"aria-pressed":Et==="leaderboard","aria-label":"Open reputation leaderboard drawer",title:"Reputation leaderboard — trust, wisdom, thorough, helper; per-channel and hub-wide",children:"Leaderboard"}),(()=>{const p=Y!==null&&Y!=="loading"?Y:null,b=p?p.rows.length:0,N=p?p.satisfied.length:0;return e.jsxs("button",{className:`team_drawer_tab ${Et==="desk"?"active":""}`,onClick:()=>ss("desk"),"aria-pressed":Et==="desk","aria-label":b?`Open the operator desk — ${b} item(s) wait on you`:"Open the operator desk",title:"Operator desk — everything blocked on YOU, with age (asks addressed to you, queue items, escalations)",children:["Desk",b?e.jsx("span",{className:"team_desk_tab_badge",children:b>99?"99+":b}):null,!b&&N?e.jsx("span",{className:"team_desk_tab_badge ok",title:"Satisfied queue items — waits you can close",children:N>99?"99+":N}):null]})})()]})]}),e.jsx(ij,{view:Sa,onClose:()=>Kt(null)})]})}const Kh=[{id:"board",label:"Board",icon:"board"},{id:"executions",label:"Executions",icon:"playCircle"},{id:"backlog",label:"Backlog",icon:"list"},{id:"agents",label:"Agents & Entities",icon:"agent"},{id:"team",label:"Team",icon:"chat"},{id:"inbox",label:"Inbox",icon:"inbox"},{id:"services",label:"Services",icon:"server"},{id:"settings",label:"Settings",icon:"gear"}],qd="abstractcontinuum_settings_v1";function wj(){try{const s=window.localStorage.getItem(qd)||"{}",n=JSON.parse(s);if(n&&(n.auth_token||n.gateway_url)){delete n.auth_token,delete n.gateway_url;try{window.localStorage.setItem(qd,JSON.stringify(n))}catch{}}return{maintenance_ai_provider:String((n==null?void 0:n.maintenance_ai_provider)||""),maintenance_ai_model:String((n==null?void 0:n.maintenance_ai_model)||""),maintenance_ai_reasoning:String((n==null?void 0:n.maintenance_ai_reasoning)||""),backlog_advisor_agent:String((n==null?void 0:n.backlog_advisor_agent)||""),default_execution_mode:(n==null?void 0:n.default_execution_mode)==="inplace"?"inplace":"uat"}}catch{return{maintenance_ai_provider:"",maintenance_ai_model:"",maintenance_ai_reasoning:"",backlog_advisor_agent:"",default_execution_mode:"uat"}}}const jj={app:"continuum",name:"AbstractContinuum"},kj=["How do I create a backlog task?","What does the Team page show?","How do managed processes work?"];function Sj(){var fe;const[s,n]=f.useState("board"),r=ug("(max-width: 1023.98px)"),[i,l]=f.useState(!1),u=f.useRef(null),m=f.useRef(null),d=f.useRef(!1);f.useEffect(()=>{r||l(!1)},[r]),f.useEffect(()=>{var ce,Ee;if(r){if(i){const se=window.setTimeout(()=>{var ie;const W=(ie=m.current)==null?void 0:ie.querySelector(".shell_nav_item.active, .shell_nav_item");W==null||W.focus()},0);return()=>window.clearTimeout(se)}d.current&&(document.activeElement===document.body||!document.activeElement||(ce=m.current)!=null&&ce.contains(document.activeElement))&&((Ee=u.current)==null||Ee.focus())}},[i,r]),f.useEffect(()=>{d.current=i},[i]);function h(ce){n(ce),l(!1)}const[x,v]=f.useState(null),[g,w]=f.useState(null),[L,A]=f.useState(()=>wj()),[$,T]=f.useState(!1),[B,O]=f.useState(!1),[M,P]=f.useState(0),[E,Q]=f.useState(!1),[oe,G]=f.useState(!1),[Ne,je]=f.useState(!1),[we,ve]=Ty("continuum"),[H,X]=f.useState(0),[Z,U]=f.useState(null),[Y,I]=f.useState("");f.useEffect(()=>{if(!Z)return;const ce=setTimeout(()=>U(null),8e3);return()=>clearTimeout(ce)},[Z]);const[te,ae]=f.useState(!1);f.useEffect(()=>{var Ce;const ce=((Ce=document.querySelector('script[type="module"][src*="assets/"]'))==null?void 0:Ce.getAttribute("src"))||"";if(!ce)return;let Ee=!1;async function se(){try{const Je=await fetch("./",{cache:"no-store",signal:AbortSignal.timeout(8e3)});if(!Je.ok)return;const ue=(await Je.text()).match(/<script[^>]+type="module"[^>]+src="([^"]+)"/),ye=(ue==null?void 0:ue[1])||"";!Ee&&ye&&ce&&ye!==ce&&ae(!0)}catch{}}const W=()=>void se();window.addEventListener("focus",W);const ie=setInterval(()=>void se(),300*1e3);return se(),()=>{Ee=!0,window.removeEventListener("focus",W),clearInterval(ie)}},[]);function k(ce){I(String(ce||"")),n("executions")}f.useEffect(()=>{const ce=Ee=>{var se;Array.from(((se=Ee.dataTransfer)==null?void 0:se.types)||[]).includes("Files")&&Ee.preventDefault()};return window.addEventListener("dragover",ce),window.addEventListener("drop",ce),()=>{window.removeEventListener("dragover",ce),window.removeEventListener("drop",ce)}},[]);const[C,re]=f.useState(!1);f.useEffect(()=>{s==="team"&&re(!0)},[s]);function he(ce){var ie;const Ee=ce.target,se=(ie=Ee==null?void 0:Ee.closest)==null?void 0:ie.call(Ee,"a[href]");if(!se||se.target==="_blank"||se.hasAttribute("download"))return;const W=se.getAttribute("href")||"";W.startsWith("/")&&(ce.preventDefault(),window.open(W,"_blank","noopener"))}f.useEffect(()=>{try{window.localStorage.setItem(qd,JSON.stringify(L))}catch{}},[L]);const le=f.useMemo(()=>new zx({base_url:""}),[]),D=ny({appName:"AbstractContinuum",connectionPath:Ri,onStatusChange:()=>P(ce=>ce+1)}),be=D.status,$e=f.useMemo(()=>vy("abstractcontinuum",Lx),[]),[Oe,Re]=f.useState(dh),rt=f.useRef(0);function qe(){const ce=++rt.current;Re(dh),Dx(le).then(Ee=>{ce===rt.current&&Re(Ee)})}const it=f.useRef(0);f.useEffect(()=>{let ce=!1,Ee;return(async()=>{try{await le.list_processes(),ce||(it.current=0,T(!0))}catch{if(ce)return;it.current+=1,it.current>=2?T(!1):Ee=window.setTimeout(()=>{ce||P(se=>se+1)},2e3)}})(),()=>{ce=!0,Ee!==void 0&&window.clearTimeout(Ee)}},[le,s,M]);const Ge=f.useRef($);f.useEffect(()=>{Ge.current&&!$&&(be!=null&&be.has_session)&&D.refresh(),Ge.current=$},[$,be==null?void 0:be.has_session]);async function ct(ce,Ee){const se=[...Ee.history.map(ie=>({role:ie.role,content:ie.content})),{role:"user",content:ce}],W=await le.backlog_advisor({messages:se,agent:L.backlog_advisor_agent||null});return String((W==null?void 0:W.reply)||"").trim()||"(the advisor returned an empty reply)"}const et=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shell_brand",title:"AbstractContinuum — continuous development console",children:[e.jsx("span",{className:"shell_brand_mark",children:"∞"}),e.jsx("span",{className:"shell_brand_name",children:"Continuum"})]}),e.jsx("nav",{className:"shell_nav","aria-label":"Pages",children:Kh.map(ce=>e.jsxs("button",{className:`shell_nav_item ${s===ce.id?"active":""}`,onClick:()=>h(ce.id),title:ce.label,"aria-current":s===ce.id?"page":void 0,children:[e.jsx("span",{className:"shell_nav_icon",children:e.jsx(Ue,{name:ce.icon,size:16})}),e.jsx("span",{className:"shell_nav_label",children:ce.label})]},ce.id))})]});return e.jsxs("div",{className:"shell",onClickCapture:he,children:[r?null:e.jsx("aside",{className:"shell_sidebar",children:et}),e.jsxs("div",{className:"shell_main",...r&&i?{inert:""}:{},children:[e.jsxs("header",{className:"shell_header",children:[r?e.jsx("button",{ref:u,type:"button",className:"btn btn_icon shell_menu_btn","aria-label":"Open navigation","aria-expanded":i,title:"Pages",onClick:()=>l(ce=>!ce),children:e.jsx(Ue,{name:"list",size:18})}):null,e.jsx("div",{className:"shell_header_title",children:((fe=Kh.find(ce=>ce.id===s))==null?void 0:fe.label)||""}),e.jsx("div",{className:"shell_header_actions",children:e.jsx(Oy,{docs:{open:oe,onToggle:()=>{G(ce=>!ce),Q(!1)},label:"Docs assistant"},assistant:{open:E,onToggle:()=>{Q(ce=>!ce),G(!1)}},appearance:{onOpen:()=>je(!0)},about:{identity:$e,versions:Oe,onOpen:qe},extraActions:e.jsxs("button",{className:"btn primary shell_newtask_btn",onClick:()=>O(!0),disabled:!$,"aria-label":"+ New task",title:"New task",children:["+",e.jsx("span",{className:"shell_newtask_label",children:" New task"})]}),connection:{phase:D.phase,signingOut:D.signingOut,onConnect:D.openModal,onDisconnect:()=>void D.signOut()}})})]}),!$&&s!=="settings"?e.jsxs("div",{className:"shell_banner",children:[e.jsx("span",{children:"Gateway unreachable or not signed in."}),e.jsx("button",{className:"btn",onClick:D.openModal,children:"Connect"})]}):null,D.signOutError?e.jsx("div",{className:"shell_banner",children:e.jsxs("span",{children:["Sign-out failed: ",D.signOutError," — the session may still be live."]})}):null,Z?e.jsxs("div",{className:`shell_banner ${Z.tone==="warn"?"":"shell_banner_ok"}`,children:[e.jsx("span",{children:Z.text}),e.jsx("button",{className:"btn",onClick:()=>U(null),children:"Dismiss"})]}):null,te?e.jsxs("div",{className:"shell_banner",children:[e.jsx("span",{children:"This tab is running an older build of the console — features may render wrong until you reload."}),e.jsx("button",{className:"btn",onClick:()=>window.location.reload(),children:"Reload now"})]}):null,e.jsxs("main",{className:"shell_content",children:[s==="board"?e.jsx(Ub,{gateway:le,gateway_connected:$,data_nonce:H,on_mutated:()=>X(ce=>ce+1),on_open_executions:k,default_execution_mode:L.default_execution_mode,query_preset:x,on_query_preset_consumed:()=>v(null),on_open_team:ce=>{w(ce),n("team")},on_new_task:()=>O(!0)}):null,s==="executions"?e.jsx(aw,{gateway:le,gateway_connected:$,focus_request_id:Y,on_focus_consumed:()=>I(""),on_open_settings:()=>n("settings")}):null,s==="backlog"?e.jsx(Eb,{gateway:le,gateway_connected:$,maintenance_ai_provider:L.maintenance_ai_provider,maintenance_ai_model:L.maintenance_ai_model,maintenance_ai_reasoning:L.maintenance_ai_reasoning,backlog_advisor_agent:L.backlog_advisor_agent,default_execution_mode:L.default_execution_mode,on_open_executions:k}):null,s==="agents"?e.jsx(sb,{gateway:le,gateway_connected:$,backlog_advisor_agent:L.backlog_advisor_agent,on_open_assistant:()=>Q(!0),on_open_team:()=>n("team"),on_open_executions:()=>k()}):null,C?e.jsx("div",{style:{display:s==="team"?"contents":"none"},children:e.jsx(t_,{fallback:ce=>e.jsx("div",{className:"page page_pad",children:e.jsxs("div",{className:"callout callout_warn",children:[e.jsx("strong",{children:"The Team view hit a render error."}),e.jsx("div",{className:"muted",style:{margin:"6px 0"},children:String(ce.message||ce)}),e.jsx("button",{className:"btn",onClick:()=>window.location.reload(),children:"Reload"})]})}),children:e.jsx(bj,{gateway:le,gateway_connected:$,advisor:$?async(ce,Ee)=>{const se=[...Ee.map(ie=>({role:ie.role,content:ie.content})),{role:"user",content:ce}],W=await le.backlog_advisor({messages:se,agent:L.backlog_advisor_agent||null});return String((W==null?void 0:W.reply)||"").trim()||"(the model returned an empty reply)"}:void 0,advisor_agent:L.backlog_advisor_agent,on_open_board:ce=>{v(ce||null),n("board")},focus:g,on_focus_consumed:()=>w(null)})})}):null,s==="inbox"?e.jsx(cw,{gateway:le,gateway_connected:$,enable_triage:!0}):null,s==="services"?e.jsx(ow,{gateway:le,gateway_connected:$}):null,s==="settings"?e.jsx(ww,{gateway:le,gateway_connected:$,settings:L,set_settings:A,connection:be}):null]})]}),e.jsx(ty,{...D.modalProps}),r?e.jsx(Nd,{open:i,onClose:()=>l(!1),label:"Navigation",side:"left",backdrop:!0,width:260,className:"shell_nav_drawer",children:e.jsxs("div",{ref:m,className:"shell_nav_drawer_body",children:[et,e.jsx("button",{type:"button",className:"btn shell_nav_close",onClick:()=>l(!1),children:"Close menu"})]})}):null,e.jsx(Nd,{open:E,onClose:()=>Q(!1),label:"Assistant",title:"Continuum assistant",children:e.jsx(ix,{ask:ct,assistantName:"Continuum advisor",blockedNotice:$?void 0:"Connect to the gateway to use the assistant."})}),e.jsx(Tx,{open:oe,onClose:()=>G(!1),source:jj,fetchGateway:le.fetch_gateway,connected:$,placeholder:"Ask about AbstractContinuum…",suggestions:kj,className:"continuum-docs-assistant"}),e.jsx(ap,{open:Ne,onClose:()=>je(!1),value:we,onChange:ve}),e.jsx(Tb,{open:B,gateway:le,can_use_gateway:$,maint_provider:L.maintenance_ai_provider,maint_model:L.maintenance_ai_model,maint_reasoning:L.maintenance_ai_reasoning,on_close:()=>O(!1),on_created:async(ce,Ee,se)=>{X(ie=>ie+1);const W=String(ce||"");n(W==="recurrent"?"backlog":"board"),U(se?{text:`Task created (${Ee}), but attachments failed: ${se}`,tone:"warn"}:{text:`Task created: ${Ee} (${W||"?"})${W==="recurrent"?" — recurrent items live on the Backlog page":""}`,tone:"ok"})}})]})}mg();const h_=document.getElementById("root");if(!h_)throw new Error("root element missing");rg.createRoot(h_).render(e.jsx(Bt.StrictMode,{children:e.jsx(Sj,{})}));export{Cw as _,Y_ as g};
|
|
135
|
-
//# sourceMappingURL=index-
|
|
135
|
+
//# sourceMappingURL=index-C0g0JOTU.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as a,l as s,D as o,e as i}from"./mermaid.core-
|
|
1
|
+
import{_ as a,l as s,D as o,e as i}from"./mermaid.core-bzPoIo7V.js";import{p as g}from"./cynefin-VYW2F7L2-CuFt8mHZ.js";import"./index-C0g0JOTU.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.16.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=o(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
|
|
3
|
-
//# sourceMappingURL=infoDiagram-FWYZ7A6U-
|
|
3
|
+
//# sourceMappingURL=infoDiagram-FWYZ7A6U-CyTfKefu.js.map
|
package/dist/assets/{ishikawaDiagram-FXEZZL3T-_pOT8SrK.js → ishikawaDiagram-FXEZZL3T-DpLmqcUC.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as o,c as ot,K as ut,D as dt,al as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,e as bt}from"./mermaid.core-
|
|
1
|
+
import{_ as o,c as ot,K as ut,D as dt,al as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,e as bt}from"./mermaid.core-bzPoIo7V.js";import"./index-C0g0JOTU.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},K,V,et,X;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";X=[];for(K in v[W])this.terminals_[K]&&K>L&&X.push("'"+this.terminals_[K]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
3
|
Expecting `+X.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:X})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),q=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof q<"u")return q;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
|
@@ -68,4 +68,4 @@ Expecting `+X.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on
|
|
|
68
68
|
dominant-baseline: hanging;
|
|
69
69
|
}
|
|
70
70
|
`,"getStyles"),Ot=Dt,Vt={parser:xt,get db(){return new vt},renderer:Nt,styles:Ot};export{Vt as diagram};
|
|
71
|
-
//# sourceMappingURL=ishikawaDiagram-FXEZZL3T-
|
|
71
|
+
//# sourceMappingURL=ishikawaDiagram-FXEZZL3T-DpLmqcUC.js.map
|