@seele00/seele-work 0.1.155 → 0.1.156
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/libexec/seele-server +0 -0
- package/libexec/seele-worker +0 -0
- package/libexec/seele-workspace-observe +0 -0
- package/package.json +1 -1
- package/release-manifest.json +130 -130
- package/web/dist/assets/{abnfDiagram-VRR7QNED-BELbh5Sn.js → abnfDiagram-VRR7QNED-CQbS4QgZ.js} +1 -1
- package/web/dist/assets/{arc-CCh6dpeU.js → arc-C6DyM-Gl.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZJ3FMSHR-DpmL2fa4.js → architectureDiagram-ZJ3FMSHR-BVhAm-cy.js} +1 -1
- package/web/dist/assets/{blockDiagram-677ZJIJ3-Dd4K57h3.js → blockDiagram-677ZJIJ3-C40p2ypI.js} +1 -1
- package/web/dist/assets/{c4Diagram-LMCZKHZV-Bc5r4Wxn.js → c4Diagram-LMCZKHZV-BfPW4T_8.js} +1 -1
- package/web/dist/assets/channel-DsPqkrZz.js +1 -0
- package/web/dist/assets/{chunk-2Q5K7J3B-CwrUGXML.js → chunk-2Q5K7J3B-DHmileVr.js} +1 -1
- package/web/dist/assets/{chunk-32BRIVSS-6DGMS8sc.js → chunk-32BRIVSS-DYoaYDqg.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4-C1RLNcp7.js → chunk-5VM5RSS4-D1gRFZYR.js} +1 -1
- package/web/dist/assets/{chunk-EX3LRPZG-C4Nd4NHI.js → chunk-EX3LRPZG-DEc-monR.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-BHc5P1n0.js → chunk-JWPE2WC7-DGfzaRQB.js} +1 -1
- package/web/dist/assets/{chunk-MOJQB5TN-BZFFwlr_.js → chunk-MOJQB5TN-Dbe1V2jM.js} +1 -1
- package/web/dist/assets/{chunk-RYQCIY6F-CLBiz9b1.js → chunk-RYQCIY6F-t2bGNzpd.js} +1 -1
- package/web/dist/assets/{chunk-V7JOEXUC-DbsvjQ0m.js → chunk-V7JOEXUC-Ca9dwsB1.js} +1 -1
- package/web/dist/assets/{chunk-VR4S4FIN-DWHvb1nf.js → chunk-VR4S4FIN-1Ucx7wt_.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-CoimE7rS.js → chunk-XXDRQBXY-CMthq2eA.js} +1 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-rwZ2hWwQ.js +1 -0
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-rwZ2hWwQ.js +1 -0
- package/web/dist/assets/{core-DWyZ49Ti.js → core-CRtYwguc.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-BBYMyRWf.js → cose-bilkent-JH36ORCC-A28KgaEF.js} +1 -1
- package/web/dist/assets/{cynefin-VYW2F7L2-BCazxNq_.js → cynefin-VYW2F7L2-Cu5a6hsJ.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-TSTJHNR4-BEalNAZO.js → cynefinDiagram-TSTJHNR4-Cc0ZWFtt.js} +1 -1
- package/web/dist/assets/{dagre-VKFMJZFB-vMNTRSRd.js → dagre-VKFMJZFB-CdBoH6Zj.js} +1 -1
- package/web/dist/assets/{diagram-FQU43EPY-DVTaJX85.js → diagram-FQU43EPY-BOYVs_mG.js} +1 -1
- package/web/dist/assets/{diagram-G47NLZAW-CqvENgNT.js → diagram-G47NLZAW-BLE9KkUT.js} +1 -1
- package/web/dist/assets/{diagram-NH7WQ7WH-DJuYPMoV.js → diagram-NH7WQ7WH-Cl-SpLib.js} +1 -1
- package/web/dist/assets/{diagram-OA4YK3LP-5VXeRPJj.js → diagram-OA4YK3LP-V13ixabq.js} +1 -1
- package/web/dist/assets/{diagram-WEI45ONY-DMiA44J3.js → diagram-WEI45ONY-Cqo35BGH.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-CCIWWBDH-CvmTzq3c.js → ebnfDiagram-CCIWWBDH-Ra9uZ7NR.js} +1 -1
- package/web/dist/assets/{elk.bundled-CBD3aDyG.js → elk.bundled-aAdTYMwi.js} +1 -1
- package/web/dist/assets/{erDiagram-Q63AITRT-BUOyR9-r.js → erDiagram-Q63AITRT-D4YUB1zH.js} +1 -1
- package/web/dist/assets/{flowDiagram-23GEKE2U-C_fM3ujD.js → flowDiagram-23GEKE2U-DHxQIrAU.js} +1 -1
- package/web/dist/assets/{ganttDiagram-NO4QXBWP-DSD0gu0R.js → ganttDiagram-NO4QXBWP-CTSQsgmU.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-IHSO6WYX-Ds-hySP4.js → gitGraphDiagram-IHSO6WYX-CBrViCdf.js} +1 -1
- package/web/dist/assets/{index-BrRNrz6R.css → index-14bWelKG.css} +1 -1
- package/web/dist/assets/{index-Df7mLFeJ.js → index-keWFGz-g.js} +3 -3
- package/web/dist/assets/{infoDiagram-FWYZ7A6U-DzTy9QwI.js → infoDiagram-FWYZ7A6U-COvgMXzz.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-FXEZZL3T-BtErEWKk.js → ishikawaDiagram-FXEZZL3T-ErU8we0C.js} +1 -1
- package/web/dist/assets/{journeyDiagram-5HDEW3XC-BPf4l3LC.js → journeyDiagram-5HDEW3XC-B6CLZv4f.js} +1 -1
- package/web/dist/assets/{kanban-definition-HUTT4EX6-uYhsLZU_.js → kanban-definition-HUTT4EX6-Caszk80p.js} +1 -1
- package/web/dist/assets/{linear-YIp6Lu3Y.js → linear-B67_RxRA.js} +1 -1
- package/web/dist/assets/{mermaid.core--xzQFgll.js → mermaid.core-DjDkv1TP.js} +5 -5
- package/web/dist/assets/{mindmap-definition-LN4V7U3C-DjRQnpcQ.js → mindmap-definition-LN4V7U3C-BHICRE_L.js} +1 -1
- package/web/dist/assets/{pegDiagram-2B236MQR-BvpwaoXB.js → pegDiagram-2B236MQR-CU6EDpny.js} +1 -1
- package/web/dist/assets/{pieDiagram-ENE6RG2P-D2O_A5w3.js → pieDiagram-ENE6RG2P-CYVMaEah.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-ABIIQ3AL-CGNt1OET.js → quadrantDiagram-ABIIQ3AL-C0K0cnZp.js} +1 -1
- package/web/dist/assets/{railroadDiagram-RFXS5EU6-DyUgF-Nb.js → railroadDiagram-RFXS5EU6-D03OgJf9.js} +1 -1
- package/web/dist/assets/{requirementDiagram-TGXJPOKE-CqYuFtqp.js → requirementDiagram-TGXJPOKE-BmQM7-gg.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-HTMAVEWB-CSGar9B7.js → sankeyDiagram-HTMAVEWB-B6cseND8.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-DBY2YBRQ-DSqrtP_D.js → sequenceDiagram-DBY2YBRQ-883YJv-b.js} +1 -1
- package/web/dist/assets/{sizeCapture-X5ZJPWSS-D41Tth_7.js → sizeCapture-X5ZJPWSS-Cxdgyuhm.js} +1 -1
- package/web/dist/assets/{stateDiagram-2N3HPSRC-Dc7i4GZr.js → stateDiagram-2N3HPSRC-y-eGEp4i.js} +1 -1
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB-Bg41lhiX.js +1 -0
- package/web/dist/assets/{swimlanes-5IMT3BWC-BQ6Nw9Qx.js → swimlanes-5IMT3BWC-7Wr03sN8.js} +2 -2
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-CbvyR7Yx.js +8 -0
- package/web/dist/assets/{timeline-definition-FHXFAJF6-v4qUamwH.js → timeline-definition-FHXFAJF6-DujNu2Bc.js} +1 -1
- package/web/dist/assets/{vennDiagram-L72KCM5P-BLUzR3gV.js → vennDiagram-L72KCM5P-BfTNiPPH.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-EHGQE667-CmKiZSMy.js → wardleyDiagram-EHGQE667-BKPpBJhK.js} +1 -1
- package/web/dist/assets/{xychartDiagram-FW5EYKEG-BNvgEsBH.js → xychartDiagram-FW5EYKEG-BPCwuwgH.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/channel-DnETxHT7.js +0 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-TgMHYe-h.js +0 -1
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-TgMHYe-h.js +0 -1
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB-BDRzEU9y.js +0 -1
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-CRnmw1di.js +0 -8
|
@@ -343,7 +343,7 @@ $$
|
|
|
343
343
|
|
|
344
344
|
`:t)}const E3=/[#.]/g;function rA(e,t){const n=e||"",a={};let l=0,u,c;for(;l<n.length;){E3.lastIndex=l;const f=E3.exec(n),h=n.slice(l,f?f.index:n.length);h&&(u?u==="#"?a.id=h:Array.isArray(a.className)?a.className.push(h):a.className=[h]:c=h,l+=h.length),f&&(u=f[0],l++)}return{type:"element",tagName:c||t||"div",properties:a,children:[]}}function X6(e,t,n){const a=n?sA(n):void 0;function l(u,c,...f){let h;if(u==null){h={type:"root",children:[]};const m=c;f.unshift(m)}else{h=rA(u,t);const m=h.tagName.toLowerCase(),g=a?a.get(m):void 0;if(h.tagName=g||m,aA(c))f.unshift(c);else for(const[y,k]of Object.entries(c))iA(e,h.properties,y,k)}for(const m of f)Vp(h.children,m);return h.type==="element"&&h.tagName==="template"&&(h.content={type:"root",children:h.children},h.children=[]),h}return l}function aA(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const a of n){const l=t[a];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const u=l;for(const c of u)if(typeof c!="number"&&typeof c!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function iA(e,t,n,a){const l=Wv(e,n);let u;if(a!=null){if(typeof a=="number"){if(Number.isNaN(a))return;u=a}else typeof a=="boolean"?u=a:typeof a=="string"?l.spaceSeparated?u=r2(a):l.commaSeparated?u=Qy(a):l.commaOrSpaceSeparated?u=r2(Qy(a).join(" ")):u=N3(l,l.property,a):Array.isArray(a)?u=[...a]:u=l.property==="style"?lA(a):String(a);if(Array.isArray(u)){const c=[];for(const f of u)c.push(N3(l,l.property,f));u=c}l.property==="className"&&Array.isArray(t.className)&&(u=t.className.concat(u)),t[l.property]=u}}function Vp(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)Vp(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Vp(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function N3(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Kc(n)===Kc(t)))return!0}return n}function lA(e){const t=[];for(const[n,a]of Object.entries(e))t.push([n,a].join(": "));return t.join("; ")}function sA(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const oA=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],uA=X6(Kv,"div"),cA=X6(yf,"g",oA),tp={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function dA(e,t){return Z6(e,{})||{type:"root",children:[]}}function Z6(e,t){const n=fA(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function fA(e,t){switch(e.nodeType){case 1:return gA(e,t);case 3:return mA(e);case 8:return pA(e);case 9:return M3(e,t);case 10:return hA();case 11:return M3(e,t);default:return}}function M3(e,t){return{type:"root",children:Q6(e,t)}}function hA(){return{type:"doctype"}}function mA(e){return{type:"text",value:e.nodeValue||""}}function pA(e){return{type:"comment",value:e.nodeValue||""}}function gA(e,t){const n=e.namespaceURI,a=n===tp.svg?cA:uA,l=n===tp.html?e.tagName.toLowerCase():e.tagName,u=n===tp.html&&l==="template"?e.content:e,c=e.getAttributeNames(),f={};let h=-1;for(;++h<c.length;)f[c[h]]=e.getAttribute(c[h])||"";return a(l,f,Q6(u,t))}function Q6(e,t){const n=e.childNodes,a=[];let l=-1;for(;++l<n.length;){const u=Z6(n[l],t);u!==void 0&&a.push(u)}return a}new DOMParser;function yA(e,t){const n=vA(e);return dA(n)}function vA(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const D3=(function(e,t,n){const a=a0(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(a(e.children[t],t,e))return e.children[t]}),Zs=(function(e){if(e==null)return wA;if(typeof e=="string")return bA(e);if(typeof e=="object")return xA(e);if(typeof e=="function")return P1(e);throw new Error("Expected function, string, or array as `test`")});function xA(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Zs(e[n]);return P1(a);function a(...l){let u=-1;for(;++u<t.length;)if(t[u].apply(this,l))return!0;return!1}}function bA(e){return P1(t);function t(n){return n.tagName===e}}function P1(e){return t;function t(n,a,l){return!!(kA(n)&&e.call(this,n,typeof a=="number"?a:void 0,l||void 0))}}function wA(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function kA(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const z3=/\n/g,R3=/[\t ]+/g,Yp=Zs("br"),O3=Zs(MA),SA=Zs("p"),I3=Zs("tr"),jA=Zs(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",NA,DA]),J6=Zs(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function CA(e,t){const n=t||{},a="children"in e?e.children:[],l=J6(e),u=nx(e,{whitespace:n.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...tx(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<a.length;)c.push(...ex(a[f],e,{whitespace:u,breakBefore:f?void 0:l,breakAfter:f<a.length-1?Yp(a[f+1]):l}));const h=[];let m;for(f=-1;++f<c.length;){const g=c[f];typeof g=="number"?m!==void 0&&g>m&&(m=g):g&&(m!==void 0&&m>-1&&h.push(`
|
|
345
345
|
`.repeat(m)||" "),m=-1,h.push(g))}return h.join("")}function ex(e,t,n){return e.type==="element"?TA(e,t,n):e.type==="text"?n.whitespace==="normal"?tx(e,n):AA(e):[]}function TA(e,t,n){const a=nx(e,n),l=e.children||[];let u=-1,c=[];if(jA(e))return c;let f,h;for(Yp(e)||I3(e)&&D3(t,e,I3)?h=`
|
|
346
|
-
`:SA(e)?(f=2,h=2):J6(e)&&(f=1,h=1);++u<l.length;)c=c.concat(ex(l[u],e,{whitespace:a,breakBefore:u?void 0:f,breakAfter:u<l.length-1?Yp(l[u+1]):h}));return O3(e)&&D3(t,e,O3)&&c.push(" "),f&&c.unshift(f),h&&c.push(h),c}function tx(e,t){const n=String(e.value),a=[],l=[];let u=0;for(;u<=n.length;){z3.lastIndex=u;const h=z3.exec(n),m=h&&"index"in h?h.index:n.length;a.push(EA(n.slice(u,m).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,m===n.length?t.breakAfter:!0)),u=m+1}let c=-1,f;for(;++c<a.length;)a[c].charCodeAt(a[c].length-1)===8203||c<a.length-1&&a[c+1].charCodeAt(0)===8203?(l.push(a[c]),f=void 0):a[c]?(typeof f=="number"&&l.push(f),l.push(a[c]),f=0):(c===0||c===a.length-1)&&l.push(0);return l}function AA(e){return[String(e.value)]}function EA(e,t,n){const a=[];let l=0,u;for(;l<e.length;){R3.lastIndex=l;const c=R3.exec(e);u=c?c.index:e.length,!l&&!u&&c&&!t&&a.push(""),l!==u&&a.push(e.slice(l,u)),l=c?u+c[0].length:u}return l!==u&&!n&&a.push(""),a.join(" ")}function nx(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function NA(e){return!!(e.properties||{}).hidden}function MA(e){return e.tagName==="td"||e.tagName==="th"}function DA(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const zA={},RA=[];function OA(e){const t=e||zA;return function(n,a){k1(n,"element",function(l,u){const c=Array.isArray(l.properties.className)?l.properties.className:RA,f=c.includes("language-math"),h=c.includes("math-display"),m=c.includes("math-inline");let g=h;if(!f&&!h&&!m)return;let y=u[u.length-1],k=l;if(l.tagName==="code"&&f&&y&&y.type==="element"&&y.tagName==="pre"&&(k=y,y=u[u.length-2],g=!0),!y)return;const b=CA(k,{whitespace:"pre"});let C;try{C=Gp.renderToString(b,{...t,displayMode:g,throwOnError:!0})}catch(_){const z=_,N=z.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...u,l],cause:z,place:l.position,ruleId:N,source:"rehype-katex"});try{C=Gp.renderToString(b,{...t,displayMode:g,strict:"ignore",throwOnError:!1})}catch{C=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(_)},children:[{type:"text",value:b}]}]}}typeof C=="string"&&(C=yA(C).children);const D=y.children.indexOf(k);return y.children.splice(D,1,...C),k5})}}function IA(e,t,n){return e?t?n==="delta"?e+t:t.startsWith(e)?t:e:e:t}function _A(e,t,n){if(e.kind||e.status!=="pending")return e.status;const a=[...t].reverse().find(l=>l.nodeId===e.id);return a?a.status==="completed"?n.some(l=>l.executionId===a.id&&l.type==="result")?"delivered":"awaiting_review":["accepted","running","failed","cancelled"].includes(a.status)?a.status:e.status:e.status}function LA(e,t){var l;if(!["input:cotask_report","input:cotask_execution"].includes(e.subtype))return null;const n=Date.parse(e.createdAt);return((l=t.filter(u=>(!e.turnId||e.turnId===u.id)&&Date.parse(u.startedAt)<n&&(!u.finishedAt||n<=Date.parse(u.finishedAt))).sort((u,c)=>Date.parse(c.startedAt)-Date.parse(u.startedAt))[0])==null?void 0:l.id)??null}const cu=224,_f=100,_3=e=>`${e.x},${e.y}`,np=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),BA=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});function Wp(e,t,n=0){const a=Math.min(...e.map(g=>g.x)),l=Math.max(...e.map(g=>g.x)),u=Math.min(...e.map(g=>g.y)),c=Math.max(...e.map(g=>g.y));if(l<t.x-4||a>t.x+cu+4||c<t.y-4||u>t.y+_f+4)return!1;if(n>=16||Math.max(l-a,c-u)<.25)return!0;const f=[e[0]],h=[e[e.length-1]];let m=e;for(;m.length>1;)m=m.slice(1).map((g,y)=>BA(m[y],g)),f.push(m[0]),h.unshift(m[m.length-1]);return Wp(f,t,n+1)||Wp(h,t,n+1)}function L3(e,t){return e.every(n=>t.every(a=>!Wp(n,a)))}function qA(e,t){const n=[];let a=e[0];const l=(u,c,f)=>{const h=f/np(u,c);return{x:u.x+(c.x-u.x)*h,y:u.y+(c.y-u.y)*h}};for(let u=1;u<e.length-1;u++){const c=e[u],f=e[u-1],h=e[u+1],m=Math.min(t,np(c,f)/2,np(c,h)/2);if(m<.001){n.push([a,c]),a=c;continue}const g=l(c,f,m),y=l(c,h,m);n.push([a,g],[g,c,y]),a=y}return n.push([a,e[e.length-1]]),n}function B3(e){return`M ${_3(e[0][0])} `+e.map(t=>`${t.length===4?"C":t.length===3?"Q":"L"} ${t.slice(1).map(_3).join(" ")}`).join(" ")}function rx(e,t){const n=e[0],a=e[e.length-1],l=(n.y+a.y)/2,u=[[n,{x:n.x,y:l},{x:a.x,y:l},a]];if(a.y>n.y&&L3(u,t))return{path:B3(u),segments:u};for(const c of[64,40,24,12,6,2,0]){const f=qA(e,c);if(L3(f,t))return{path:B3(f),segments:f}}throw new Error("No unobstructed CoTask route")}function UA(e){return JSON.stringify(e.map(t=>({id:t.id,dependencies:[...t.dependencies].sort()})).sort((t,n)=>t.id.localeCompare(n.id)))}function ax(e){const t=new Map,n=new Map,a=new Map(e.map(m=>[m.id,m])),l=[];for(;a.size;){const m=[...a.values()].filter(y=>y.dependencies.every(k=>n.has(k)||!a.has(k))),g=m.length?m:[...a.values()];l.push(g);for(const y of g)a.delete(y.id),n.set(y.id,l.length-1)}const u=Math.max(1,...l.map(m=>m.length))*296+24;l.forEach((m,g)=>m.forEach((y,k)=>t.set(y.id,{x:(u-(m.length*296-72))/2+k*296,y:48+g*200})));const c=[...t].map(([m,g])=>({id:m,...g})),f=[];let h=u;for(const m of e)for(const g of m.dependencies){const y=t.get(g),k=t.get(m.id);if(!y||!k)continue;const b={x:y.x+cu/2,y:y.y+_f},C={x:k.x+cu/2,y:k.y};h+=18;const D=[b,{x:b.x,y:b.y+25},{x:h,y:b.y+25},{x:h,y:C.y-25},{x:C.x,y:C.y-25},C],_=c.filter(z=>z.id!==g&&z.id!==m.id);f.push({source:g,target:m.id,path:rx(D,_).path})}return{positions:t,edges:f,width:h+48,height:Math.max(196,96+l.length*200-100)}}async function HA(e){var m;if(!e.length)return ax(e);const{default:t}=await an(async()=>{const{default:g}=await import("./elk.bundled-CBD3aDyG.js").then(y=>y.e);return{default:g}},[],import.meta.url),n=new Set(e.map(g=>g.id)),a=e.flatMap(g=>g.dependencies.filter(y=>n.has(y)).map(y=>({source:y,target:g.id}))),u=await new t().layout({id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.spacing.nodeNode":"40","elk.layered.spacing.nodeNodeBetweenLayers":"80","elk.layered.spacing.edgeNodeBetweenLayers":"18","elk.padding":"[top=48,left=48,bottom=48,right=48]","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX"},children:e.map(g=>({id:g.id,width:cu,height:_f})),edges:a.map((g,y)=>({id:`edge-${y}`,sources:[g.source],targets:[g.target]}))}),c=(u.children??[]).map(g=>({id:g.id,x:g.x??0,y:g.y??0})),f=new Map((m=u.edges)==null?void 0:m.map(g=>[g.id,g])),h=a.map((g,y)=>{var C,D;const k=(D=(C=f.get(`edge-${y}`))==null?void 0:C.sections)==null?void 0:D[0];if(!k)throw new Error("Missing CoTask dependency route");const b=[k.startPoint,...k.bendPoints??[],k.endPoint];return{...g,path:rx(b,c.filter(_=>_.id!==g.source&&_.id!==g.target)).path}});return{positions:new Map(c.map(g=>[g.id,g])),edges:h,width:u.width??320,height:u.height??196}}const q3={pending:"待开始",completed:"已确认完成",blocked:"已阻塞",cancelled:"已取消",running:"执行中",accepted:"等待执行",failed:"执行失败",delivered:"已交付,待确认",awaiting_review:"执行已结束,待确认"};function $A({nodes:e,members:t,executions:n,reports:a,selectedId:l,onSelect:u,onDismiss:c,detail:f,finalCheckpointId:h}){const m=e.some(ge=>ge.kind!==void 0),g=(ge,Ue)=>ge.kind==="checkpoint"?{pending:"等待前置完成",waiting:"等待 Owner 继续",completed:"已继续"}[Ue]??q3[Ue]??Ue:ge.kind&&Ue==="completed"?"已完成":q3[Ue]??Ue,y=UA(e),k=E.useMemo(()=>ax(JSON.parse(y)),[y]),[b,C]=E.useState(null),[D,_]=E.useState(!1),z=(b==null?void 0:b.topology)===y?b.graph:k;E.useEffect(()=>{let ge=!0;return _(!1),HA(JSON.parse(y)).then(Ue=>{ge&&C({topology:y,graph:Ue})}).catch(()=>{ge&&_(!0)}),()=>{ge=!1}},[y]);const N=E.useRef(null),[q,B]=E.useState({width:900,height:560}),[K,G]=E.useState(null),[U,X]=E.useState({left:0,top:0}),[ee,F]=E.useState(!1),[pe,de]=E.useState(!1),Oe=E.useRef(!1),we=E.useRef(null);E.useEffect(()=>{F(!1)},[l]);const fe=E.useId().replace(/:/g,"");E.useEffect(()=>{if(!N.current)return;const ge=new ResizeObserver(([Ue])=>B({width:Ue.contentRect.width,height:Ue.contentRect.height}));return ge.observe(N.current),()=>ge.disconnect()},[]);const J=Math.min(1,Math.max(.15,Math.min((q.width-32)/z.width,(q.height-32)/z.height))),Z=K??J,le=new Map(e.map(ge=>[ge.id,_A(ge,n,a)])),je=e.find(ge=>ge.id===l),$=l?z.positions.get(l):void 0,I=Math.min(320,Math.max(0,q.width-24)),ae=Math.min(420,Math.max(0,q.height-24)),R=$?Math.max(0,(q.width-z.width*Z)/2)+$.x*Z-U.left:0,ne=$?Math.max(0,(q.height-z.height*Z)/2)+$.y*Z-U.top:0,Te=R+cu*Z+12,Ie=Math.max(12,Math.min(q.width-I-12,Te+I<=q.width-12?Te:R-I-12)),Fe=Math.max(12,Math.min(q.height-ae-12,ne));return o.jsxs("section",{className:"cotask-graph","aria-label":"Task dependency graph",children:[o.jsxs("div",{className:"cotask-graph-toolbar",children:[o.jsxs("span",{children:["Arrows show dependencies ",o.jsxs("span",{className:"cotask-graph-count",children:["· ",e.length," nodes / ",z.edges.length," dependencies"]}),D&&o.jsx("small",{role:"status",children:" · 自动布局暂不可用,已显示基础布局"})]}),o.jsxs("div",{children:[o.jsx("button",{"aria-label":"Zoom out",onClick:()=>G(Math.max(.15,Z-.15)),children:"−"}),o.jsxs("span",{children:[Math.round(Z*100),"%"]}),o.jsx("button",{"aria-label":"Zoom in",onClick:()=>G(Math.min(2,Z+.15)),children:"+"}),o.jsx("button",{onClick:()=>G(null),children:"Fit to view"})]})]}),o.jsxs("div",{className:"cotask-graph-stage",children:[o.jsx("div",{className:`cotask-graph-viewport${pe?" dragging":""}`,ref:N,"data-layout":(b==null?void 0:b.topology)===y?"adaptive":"fallback",onScroll:ge=>X({left:ge.currentTarget.scrollLeft,top:ge.currentTarget.scrollTop}),onClickCapture:ge=>{Oe.current&&(ge.preventDefault(),ge.stopPropagation())},onClick:ge=>{ge.target.closest("button")||c()},onPointerDown:ge=>{if(ge.button!==0||ge.target.closest(".cotask-node-text"))return;Oe.current=!1;const Ue=ge.currentTarget;we.current={id:ge.pointerId,x:ge.clientX,y:ge.clientY,left:Ue.scrollLeft,top:Ue.scrollTop,moved:!1}},onPointerMove:ge=>{if(!we.current||we.current.id!==ge.pointerId)return;const Ue=ge.clientX-we.current.x,me=ge.clientY-we.current.y;Math.abs(Ue)+Math.abs(me)>4&&(we.current.moved=!0,de(!0),ge.currentTarget.setPointerCapture(ge.pointerId),ge.preventDefault()),we.current.moved&&(ge.currentTarget.scrollLeft=we.current.left-Ue,ge.currentTarget.scrollTop=we.current.top-me)},onPointerUp:ge=>{we.current&&(Oe.current=we.current.moved,we.current=null,de(!1),ge.currentTarget.hasPointerCapture(ge.pointerId)&&ge.currentTarget.releasePointerCapture(ge.pointerId),window.setTimeout(()=>{Oe.current=!1},0))},onPointerCancel:()=>{we.current=null,de(!1)},onLostPointerCapture:()=>{we.current=null,de(!1)},children:o.jsx("div",{className:"cotask-graph-scroll",style:{width:Math.max(q.width,z.width*Z),height:Math.max(q.height,z.height*Z)},children:o.jsxs("div",{className:"cotask-graph-canvas",style:{width:z.width,height:z.height,transform:`scale(${Z})`,left:Math.max(0,(q.width-z.width*Z)/2),top:Math.max(0,(q.height-z.height*Z)/2)},children:[o.jsxs("svg",{width:z.width,height:z.height,className:"cotask-graph-edges","aria-hidden":"true",children:[o.jsx("defs",{children:["default","complete","selected"].map(ge=>o.jsx("marker",{id:`${fe}-${ge}`,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"userSpaceOnUse",children:o.jsx("path",{d:"M 1 1 L 7 4 L 1 7 Z",className:`cotask-arrow-${ge}`})},ge))}),z.edges.map(ge=>{const Ue=l&&[ge.source,ge.target].includes(l)?"selected":le.get(ge.source)==="completed"?"complete":"default";return o.jsx("path",{"data-source":ge.source,"data-target":ge.target,d:ge.path,className:`cotask-edge ${Ue}`,markerEnd:`url(#${fe}-${Ue})`},`${ge.source}:${ge.target}`)})]}),e.map(ge=>{var We;const Ue=z.positions.get(ge.id),me=le.get(ge.id);return o.jsxs("button",{className:`cotask-graph-node ${me}${ge.kind==="checkpoint"?" checkpoint":""}${l===ge.id?" selected":""}`,style:{left:Ue.x,top:Ue.y,width:cu,height:_f},"aria-pressed":l===ge.id,onClick:()=>u(ge),title:ge.dependencies.length?`Depends on: ${ge.dependencies.map(qe=>{var nt;return((nt=e.find(Ze=>Ze.id===qe))==null?void 0:nt.name)??qe}).join(", ")}`:"No dependencies",children:[ge.dependencies.length>0&&o.jsx("i",{className:"cotask-node-port input"}),o.jsxs("span",{className:"cotask-graph-node-status",children:[o.jsx("i",{}),o.jsx("span",{className:"cotask-node-text",children:g(ge,me)})]}),o.jsx("strong",{className:"cotask-node-text",children:ge.name}),o.jsx("span",{className:"cotask-graph-node-member cotask-node-text",children:ge.kind==="checkpoint"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"cotask-checkpoint-type",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M6 1 11 6 6 11 1 6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})}),ge.id===h?"最终检查点":"检查点"]}),o.jsx("span",{className:"cotask-checkpoint-owner",children:"Owner 检查"})]}):((We=t.find(qe=>qe.id===ge.memberId))==null?void 0:We.name)??ge.memberId}),z.edges.some(qe=>qe.source===ge.id)&&o.jsx("i",{className:"cotask-node-port output"})]},ge.id)})]})})}),je&&$&&o.jsxs("aside",{className:`cotask-node-popover${ee?" expanded":""}`,"aria-label":`Node details: ${je.name}`,style:ee?void 0:{left:Ie,top:Fe,width:I,maxHeight:ae},onKeyDown:ge=>{ge.key==="Escape"&&(ge.stopPropagation(),c())},children:[o.jsxs("header",{children:[o.jsx("strong",{children:je.name}),o.jsx("button",{onClick:()=>F(!ee),"aria-label":ee?"Collapse node details":"Expand node details",children:ee?"Collapse":"Expand"}),o.jsx("button",{onClick:c,"aria-label":"Close node details",children:"×"})]}),o.jsx("div",{className:"cotask-node-popover-content",children:f})]})]}),o.jsxs("div",{className:"cotask-graph-legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"running"}),"执行中"]}),o.jsxs("span",{children:[o.jsx("i",{className:"delivered"}),m?"检查点等待继续":"待 Owner 确认"]}),o.jsxs("span",{children:[o.jsx("i",{className:"completed"}),m?"已完成 / 已继续":"已确认完成"]}),o.jsxs("span",{children:[o.jsx("i",{className:"pending"}),"待开始"]}),o.jsx("span",{children:m?"执行节点报告结果并正常结束后自动完成;检查点由 Owner 检查后继续":"点击节点查看上下文与报告;成员执行结束不等于节点已确认完成"})]})]})}const Kp=e=>({draft:"草稿",running:"运行中",pausing:"正在暂停",paused:"已暂停",waiting:"等待继续",finished:"已结束",pending:"Pending",completed:"Completed",blocked:"Blocked",cancelled:"Cancelled",accepted:"Accepted",failed:"Failed"})[e]??e;function U3({task:e}){const t=e.phase??e.status,n={running:["active","进行中","M8 5l10 7-10 7Z"],finished:["done","已结束","m6 12 4 4 8-8"],completed:["done","已结束","m6 12 4 4 8-8"],paused:["attention","已暂停","M9 7v10M15 7v10"],pausing:["attention","正在暂停","M9 7v10M15 7v10"],waiting:["attention","等待继续","M12 6v6l4 2"],blocked:["danger","已阻塞","M12 6v7m0 3v1"],failed:["danger","失败","M12 6v7m0 3v1"],cancelled:["neutral","已取消","m8 8 8 8m0-8-8 8"],draft:["neutral","草稿","M8 8h8M8 12h8M8 16h5"]},[a,l,u]=n[t]??["neutral",Kp(t),"M12 6v6l4 2"];return o.jsxs("span",{className:`cotask-task-status ${a}`,children:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:u})]}),l]})}function FA({ownerId:e,ownerName:t,request:n,onExpanded:a,renderMember:l,renderMarkdown:u}){const[c,f]=E.useState([]),[h,m]=E.useState(null),[g,y]=E.useState(null),[k,b]=E.useState("graph"),[C,D]=E.useState(null),[_,z]=E.useState(null),[N,q]=E.useState(null),[B,K]=E.useState([]),[G,U]=E.useState(null),[X,ee]=E.useState(null),[F,pe]=E.useState([]),[de,Oe]=E.useState(""),we=E.useRef(null),fe=E.useRef(0),J=E.useRef("");J.current=`${h}:${g==null?void 0:g.task.revision}`;const Z=E.useRef(C);Z.current=C;const le=`conversations/${encodeURIComponent(e)}/cotasks`;E.useEffect(()=>{let me=!0;const We=async()=>{try{const nt=await n(le);me&&f(nt.tasks)}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),5e3);return()=>{me=!1,window.clearInterval(qe)}},[le,n]),E.useEffect(()=>(a(h!==null),()=>a(!1)),[h,a]),E.useEffect(()=>{if(!h)return;let me=!0;const We=async()=>{try{const nt=await n(`${le}/${encodeURIComponent(h)}`);if(me&&(y(nt),Oe("")),k==="operations"){const Ze=await n(`${le}/${encodeURIComponent(h)}`,{operations:!0});me&&pe(Ze.operations)}}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),3e3);return()=>{me=!1,window.clearInterval(qe)}},[h,le,n,k]),E.useEffect(()=>{var me;h&&((me=we.current)==null||me.focus())},[h]),E.useEffect(()=>{fe.current++,U(null),ee(null),K([])},[g==null?void 0:g.task.revision]);const je=JSON.stringify(g==null?void 0:g.reports.map(me=>me.id)),$=JSON.stringify(g==null?void 0:g.nodes.map(me=>[me.id,me.status,me.reason]));E.useEffect(()=>{if(!h||!_||!g)return;let me=!0;if(!g.nodes.some(We=>We.id===_)){z(null),q(null);return}return n(`${le}/${encodeURIComponent(h)}`,{nodeIds:[_]}).then(We=>{me&&q(We.nodes[0]??null)}).catch(We=>{me&&Oe(String(We))}),()=>{me=!1}},[h,_,g==null?void 0:g.task.revision,je,$,le,n]);const I=me=>{z(null),fe.current++,U(null),ee(null),pe([]),Oe(""),y(null),m(me),b("graph"),D(null),q(null),K([])},ae=()=>{fe.current++,z(null),q(null),K([])},R=()=>{fe.current++,m(null)},ne=c.find(me=>me.status==="running")??c.find(me=>me.status==="draft")??c[0];if(!h)return ne?o.jsxs("div",{className:"cotask-launcher",children:[o.jsxs("button",{className:"cotask-launch-primary",onClick:()=>I(ne.id),children:[o.jsxs("span",{className:"cotask-launch-heading",children:[o.jsx("span",{children:"CoTask"}),o.jsx(U3,{task:ne})]}),o.jsx("strong",{children:ne.name}),o.jsxs("small",{children:[ne.nodeCount," 个节点 ↗"]})]}),c.length>1&&o.jsxs("details",{className:"cotask-task-list",children:[o.jsxs("summary",{children:["其他任务(",c.length-1,")"]}),c.filter(me=>me.id!==ne.id).map(me=>o.jsxs("button",{onClick:()=>I(me.id),children:[o.jsx("strong",{children:me.name}),o.jsx(U3,{task:me})]},me.id))]})]}):null;const Te=me=>{_!==me.id&&(fe.current++,Oe(""),q(null),K([]),z(me.id))},Ie=async me=>{const We=++fe.current;try{const qe=await n(`${le}/${h}`,{reportIds:[me.id]});We===fe.current&&K(qe.reports)}catch(qe){Oe(String(qe))}},Fe=g==null?void 0:g.bindings.find(me=>me.memberId===C),ge=g==null?void 0:g.members.find(me=>me.id===C),Ue=(me,We=e)=>o.jsx("div",{className:"cotask-markdown",children:u(me??"",We)});return o.jsx("div",{className:"context-panel-overlay settings-overlay cotask-overlay",children:o.jsxs("section",{className:"context-panel settings-panel cotask-frame",role:"dialog","aria-modal":"true","aria-label":"CoTask",tabIndex:-1,ref:we,onKeyDown:me=>{var We;if(me.stopPropagation(),me.key==="Escape"&&(me.preventDefault(),k==="graph"&&_?ae():R()),me.key==="Tab"){const qe=(We=we.current)==null?void 0:We.querySelectorAll('button:not(:disabled),select,input,a[href],textarea,[tabindex="0"]');if(!(qe!=null&&qe.length))return;const nt=qe[0],Ze=qe[qe.length-1];me.shiftKey&&(document.activeElement===nt||document.activeElement===we.current)?(me.preventDefault(),Ze.focus()):!me.shiftKey&&document.activeElement===Ze&&(me.preventDefault(),nt.focus())}},children:[o.jsxs("header",{className:"cotask-header settings-panel-header",children:[o.jsxs("div",{children:[o.jsxs("p",{children:["CoTask · ",t]}),o.jsx("h1",{children:(g==null?void 0:g.task.name)??"Loading task…"})]}),o.jsx("span",{children:g&&Kp(g.task.phase??g.task.status)}),o.jsxs("button",{className:"cotask-back",onClick:R,title:`返回 ${t}`,children:[o.jsx("span",{"aria-hidden":"true",children:"← "}),"返回"]})]}),o.jsxs("aside",{className:"cotask-nav",children:[o.jsxs("section",{className:"workspace-group","aria-label":"Task navigation",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Task"}),o.jsx("nav",{className:"workspace-group-items",children:[["graph","Task graph"],["operations","Activity"],["settings","Settings"]].map(([me,We])=>o.jsx("button",{className:`session-item${k===me?" active":""}`,"aria-current":k===me?"page":void 0,onClick:()=>{b(me),D(null)},children:o.jsx("span",{className:"session-title",children:We})},me))})]}),o.jsxs("section",{className:"workspace-group","aria-label":"Task members",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Members"}),o.jsx("div",{className:"workspace-group-items cotask-member-list",children:g==null?void 0:g.members.map(me=>{const We=g.executions.some(nt=>nt.memberId===me.id&&["accepted","running"].includes(nt.status)),qe=We?"Running":g.bindings.some(nt=>nt.memberId===me.id&&nt.workspaceId)?"Idle":"Not created";return o.jsx("button",{className:`session-item${k==="member"&&C===me.id?" active":""}`,title:`${me.name} · ${qe}`,"aria-label":`${me.name} · ${qe}`,"aria-current":k==="member"&&C===me.id?"page":void 0,onClick:()=>{D(me.id),b("member")},children:o.jsxs("span",{className:"session-heading",children:[o.jsx("span",{className:`session-status${We?" running":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"session-title",children:me.name})]})},me.id)})})]}),o.jsxs("button",{className:"cotask-return",onClick:R,children:["← Back to ",t]})]}),o.jsxs("section",{className:"cotask-main",children:[de&&o.jsx("div",{className:"cotask-error",role:"alert",children:de}),o.jsx("div",{className:`cotask-body${k==="graph"?" cotask-graph-body":""}`,children:g?o.jsxs(o.Fragment,{children:[g.warnings.length>0&&o.jsx("div",{className:"cotask-warning",children:g.warnings.map((me,We)=>o.jsxs("p",{children:[me.id?`${me.id}: `:"Common context: ","Context may exceed the injection limit. (estimated ",me.estimatedTokens," tokens)"]},We))}),k==="graph"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:"Task graph"}),o.jsxs("span",{children:[g.nodes.filter(me=>me.status==="completed").length," / ",g.nodes.length," Completed"]})]}),!g.nodes.length&&o.jsx("p",{children:"No nodes yet. Discuss the plan with the initiating agent to define the graph."}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&G===null){const We=J.current;n(`${le}/${h}`,{view:"definition"}).then(qe=>{J.current===We&&U(qe.definition.commonContext)}).catch(qe=>{J.current===We&&Oe(String(qe))})}},children:[o.jsx("summary",{children:"Common context"}),G===null?o.jsx("p",{children:"Loading…"}):Ue(G)]},g.task.revision),g.nodes.length>0&&o.jsx($A,{finalCheckpointId:g.finalCheckpointId,nodes:g.nodes,members:g.members,executions:g.executions,reports:g.reports,selectedId:_??void 0,onSelect:me=>void Te(me),onDismiss:ae,detail:(N==null?void 0:N.definition.id)===_?o.jsxs("div",{className:"cotask-node-detail",children:[N.runtime&&o.jsxs("p",{children:[Kp(N.runtime.status),N.runtime.reason&&o.jsxs(o.Fragment,{children:[" · ",N.runtime.reason]})]}),Ue(N.definition.context),o.jsx("h4",{children:N.definition.kind==="checkpoint"?"检查点":"Reports"}),N.reports.length?N.reports.map(me=>o.jsxs("button",{onClick:()=>void Ie(me),children:[me.type," · ",me.summary]},me.id)):o.jsx("p",{children:N.definition.kind==="checkpoint"?"此节点不启动成员执行,也不生成成员报告。Owner 按上下文检查交付内容后继续。":"No reports yet."}),B.map(me=>{var We;return o.jsxs("article",{children:[o.jsx("h4",{children:me.summary}),Ue(me.content,((We=g.executions.find(qe=>qe.id===me.executionId))==null?void 0:We.workspaceId)??"")]},me.id)})]}):o.jsx("p",{children:"Loading node…"})}),g.task.conclusion&&o.jsxs("details",{className:"cotask-conclusion",children:[o.jsx("summary",{children:"Conclusion"}),Ue(g.task.conclusion)]})]}),k==="operations"&&o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Activity"}),o.jsx("p",{children:"Changes are saved immediately and retained if a turn fails."}),F.length?F.map((me,We)=>o.jsxs("details",{className:"cotask-operation",children:[o.jsxs("summary",{children:[String(me.action)," · ",String(me.status)," · Turn ",String(me.turnStatus)]}),o.jsx("pre",{children:JSON.stringify(me,null,2)})]},We)):o.jsx("p",{children:"No activity yet."})]}),k==="settings"&&o.jsx(PA,{task:g.task,path:`${le}/${h}/settings`,request:n,onSaved:me=>y({...g,task:me})},h),k==="member"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:ge==null?void 0:ge.name}),o.jsx("span",{children:"CoTask member"})]}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&C&&(X==null?void 0:X.id)!==C){const We=C,qe=J.current;n(`${le}/${h}`,{memberIds:[We]}).then(nt=>{var Ze;J.current===qe&&Z.current===We&&ee({id:We,context:((Ze=nt.members[0])==null?void 0:Ze.context)??""})}).catch(nt=>{J.current===qe&&Z.current===We&&Oe(String(nt))})}},children:[o.jsx("summary",{children:"Member context"}),(X==null?void 0:X.id)===C?Ue(X.context):o.jsx("p",{children:"Loading…"})]},`${C}:${g.task.revision}`),Fe!=null&&Fe.workspaceId?l(Fe.workspaceId):o.jsx("p",{children:g.executions.some(me=>me.memberId===C)?"This member instance was removed. Execution history is retained.":g.task.executionMode==="self_driving"?"首次符合执行条件时,平台自动创建此成员实例。":"This member will be created when its first node is driven."})]})]}):o.jsx("p",{children:"Loading task…"})})]})]})})}function PA({task:e,path:t,request:n,onSaved:a}){var N,q;const[l,u]=E.useState({...e.runtimeSettings,mode:e.runtimeSettings.mode??"custom",fastMode:e.runtimeSettings.fastMode??!1}),[c,f]=E.useState(e.revision),[h,m]=E.useState([]),[g,y]=E.useState([]),[k,b]=E.useState(!1),[C,D]=E.useState("");E.useEffect(()=>{let B=!0;return Promise.all([n("settings/runtime/models?refresh=0"),n("settings/model-providers/options")]).then(([K,G])=>{B&&(m(K.models),y(G.channels))}).catch(K=>{B&&D(String(K))}),()=>{B=!1}},[n]);const _=h.find(B=>B.model===l.model||B.id===l.model),z=((N=_==null?void 0:_.supportedReasoningEfforts)==null?void 0:N.map(B=>B.reasoningEffort))??["none","minimal","low","medium","high","xhigh","max"];return o.jsxs("section",{className:"cotask-settings",children:[o.jsx("h2",{children:"Settings"}),o.jsx("p",{children:"Settings apply to the whole CoTask and take effect on each member’s next turn."}),o.jsxs("label",{children:["配置模式",o.jsxs("select",{value:l.mode,onChange:B=>u({...l,mode:B.target.value}),children:[o.jsx("option",{value:"global",children:"沿用 CoTask 默认配置"}),o.jsx("option",{value:"custom",children:"CoTask 自定义配置"})]})]}),l.mode==="global"?o.jsx("p",{children:"每个成员在下一次 turn 读取最新 CoTask 默认模型、推理强度和倍速设置;正在运行的 turn 不受影响。"}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model source",o.jsxs("select",{value:l.modelSource.type==="codex"?"codex":l.modelSource.channelId,onChange:B=>u({...l,modelSource:B.target.value==="codex"?{type:"codex"}:{type:"custom",channelId:B.target.value}}),children:[o.jsx("option",{value:"codex",children:"Codex"}),l.modelSource.type==="custom"&&!g.some(B=>B.id===l.modelSource.channelId)&&o.jsx("option",{value:l.modelSource.channelId,children:"Current channel unavailable"}),g.map(B=>o.jsx("option",{value:B.id,children:B.name},B.id))]})]}),l.modelSource.type==="codex"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"1.5 倍速(Fast mode)"}),o.jsx("input",{type:"checkbox",checked:l.fastMode,onChange:B=>u({...l,fastMode:B.target.checked})})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:l.model,onChange:B=>u({...l,model:B.target.value}),children:[o.jsx("option",{value:"",children:"Default model"}),l.model&&!h.some(B=>B.model===l.model)&&o.jsx("option",{children:l.model}),h.map(B=>o.jsx("option",{value:B.model,children:B.displayName},B.id))]})]}),o.jsxs("label",{children:["Reasoning effort",o.jsxs("select",{value:l.reasoningEffort,onChange:B=>u({...l,reasoningEffort:B.target.value}),children:[o.jsx("option",{value:"",children:"Default"}),l.reasoningEffort&&!z.includes(l.reasoningEffort)&&o.jsx("option",{children:l.reasoningEffort}),z.map(B=>o.jsx("option",{children:B},B))]})]})]}):o.jsxs("p",{children:["Channel model: ",((q=g.find(B=>B.id===l.modelSource.channelId))==null?void 0:q.model)??"Channel unavailable",". Codex reasoning effort does not apply to custom channels."]})]}),o.jsx("button",{disabled:k,onClick:async()=>{b(!0),D("");try{const B=await n(t,{expectedRevision:c,runtimeSettings:l},"PUT");f(B.task.revision),a(B.task),D("Saved. Changes take effect on the next turn.")}catch(B){D(`${String(B)}. If the task changed, reopen Settings before saving.`)}finally{b(!1)}},children:k?"Saving…":"Save settings"}),C&&o.jsx("p",{role:"status",children:C})]})}function GA(e,t=new Date){if(e==null||!Number.isInteger(e)||e<1||e>31)return null;const n=new Date(t.getTime()+480*60*1e3),a=n.getUTCFullYear(),l=n.getUTCMonth(),u=Date.UTC(a,l,n.getUTCDate()),c=h=>Date.UTC(a,l+h,Math.min(e,new Date(Date.UTC(a,l+h+1,0)).getUTCDate()));let f=c(0);return f<u&&(f=c(1)),{date:new Date(f).toISOString().slice(0,10),days:(f-u)/864e5}}function VA({content:e,streaming:t}){const[n,a]=E.useState(!1),l=E.useId();return o.jsxs("section",{className:`message reasoning${t?" is-streaming":""}${n?" is-expanded":""}`,children:[o.jsxs("button",{className:"reasoning-toggle",type:"button","aria-expanded":n,"aria-controls":l,onClick:()=>a(u=>!u),children:[o.jsx("span",{className:"reasoning-indicator","aria-hidden":"true"}),o.jsx("span",{children:t?"思考中":"思考过程"}),o.jsx("span",{className:"reasoning-action",children:n?"收起":"展开"}),o.jsx("svg",{className:"reasoning-chevron",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4 2 4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4"})})]}),o.jsx("div",{id:l,hidden:!n&&!t,className:`reasoning-content${n?"":" reasoning-preview"}`,children:o.jsx("div",{className:"message-body",children:n?e:e.slice(-600)})})]})}function YA(e,t){if(!t||typeof t!="object")return null;const{method:n,params:a}=t;if(!a)return null;if(n==="item/completed"){const m=a.item;if((m==null?void 0:m.type)!=="reasoning"||typeof m.id!="string")return null;const g=e.get(m.id)??{itemId:m.id,text:new Map,summary:new Map,completed:!1};for(const y of["text","summary"]){const k=m[y];Array.isArray(k)&&k.forEach((b,C)=>{typeof b=="string"&&b&&g[y].set(C,b)})}return g.completed=!0,e.set(m.id,g),g}const l=/^item\/reasoning\/(text|summaryText)(Delta|Snapshot)$/.exec(n??"");if(!l||typeof a.itemId!="string")return null;const u=l[1]==="text"?"text":"summary",c=a[u==="text"?"contentIndex":"summaryIndex"],f=a[l[2]==="Delta"?"delta":"text"];if(typeof c!="number"||!Number.isSafeInteger(c)||c<0||typeof f!="string")return null;const h=e.get(a.itemId)??{itemId:a.itemId,text:new Map,summary:new Map,completed:!1};return h[u].set(c,l[2]==="Snapshot"?f:(h[u].get(c)??"")+f),e.set(a.itemId,h),h}function WA(e){return[...e.text.size?e.text:e.summary].sort(([n],[a])=>n-a).map(([,n])=>n).join(`
|
|
346
|
+
`:SA(e)?(f=2,h=2):J6(e)&&(f=1,h=1);++u<l.length;)c=c.concat(ex(l[u],e,{whitespace:a,breakBefore:u?void 0:f,breakAfter:u<l.length-1?Yp(l[u+1]):h}));return O3(e)&&D3(t,e,O3)&&c.push(" "),f&&c.unshift(f),h&&c.push(h),c}function tx(e,t){const n=String(e.value),a=[],l=[];let u=0;for(;u<=n.length;){z3.lastIndex=u;const h=z3.exec(n),m=h&&"index"in h?h.index:n.length;a.push(EA(n.slice(u,m).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,m===n.length?t.breakAfter:!0)),u=m+1}let c=-1,f;for(;++c<a.length;)a[c].charCodeAt(a[c].length-1)===8203||c<a.length-1&&a[c+1].charCodeAt(0)===8203?(l.push(a[c]),f=void 0):a[c]?(typeof f=="number"&&l.push(f),l.push(a[c]),f=0):(c===0||c===a.length-1)&&l.push(0);return l}function AA(e){return[String(e.value)]}function EA(e,t,n){const a=[];let l=0,u;for(;l<e.length;){R3.lastIndex=l;const c=R3.exec(e);u=c?c.index:e.length,!l&&!u&&c&&!t&&a.push(""),l!==u&&a.push(e.slice(l,u)),l=c?u+c[0].length:u}return l!==u&&!n&&a.push(""),a.join(" ")}function nx(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function NA(e){return!!(e.properties||{}).hidden}function MA(e){return e.tagName==="td"||e.tagName==="th"}function DA(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const zA={},RA=[];function OA(e){const t=e||zA;return function(n,a){k1(n,"element",function(l,u){const c=Array.isArray(l.properties.className)?l.properties.className:RA,f=c.includes("language-math"),h=c.includes("math-display"),m=c.includes("math-inline");let g=h;if(!f&&!h&&!m)return;let y=u[u.length-1],k=l;if(l.tagName==="code"&&f&&y&&y.type==="element"&&y.tagName==="pre"&&(k=y,y=u[u.length-2],g=!0),!y)return;const b=CA(k,{whitespace:"pre"});let C;try{C=Gp.renderToString(b,{...t,displayMode:g,throwOnError:!0})}catch(_){const z=_,N=z.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...u,l],cause:z,place:l.position,ruleId:N,source:"rehype-katex"});try{C=Gp.renderToString(b,{...t,displayMode:g,strict:"ignore",throwOnError:!1})}catch{C=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(_)},children:[{type:"text",value:b}]}]}}typeof C=="string"&&(C=yA(C).children);const D=y.children.indexOf(k);return y.children.splice(D,1,...C),k5})}}function IA(e,t,n){return e?t?n==="delta"?e+t:t.startsWith(e)?t:e:e:t}function _A(e,t,n){if(e.kind||e.status!=="pending")return e.status;const a=[...t].reverse().find(l=>l.nodeId===e.id);return a?a.status==="completed"?n.some(l=>l.executionId===a.id&&l.type==="result")?"delivered":"awaiting_review":["accepted","running","failed","cancelled"].includes(a.status)?a.status:e.status:e.status}function LA(e,t){var l;if(!["input:cotask_report","input:cotask_execution"].includes(e.subtype))return null;const n=Date.parse(e.createdAt);return((l=t.filter(u=>(!e.turnId||e.turnId===u.id)&&Date.parse(u.startedAt)<n&&(!u.finishedAt||n<=Date.parse(u.finishedAt))).sort((u,c)=>Date.parse(c.startedAt)-Date.parse(u.startedAt))[0])==null?void 0:l.id)??null}const cu=224,_f=100,_3=e=>`${e.x},${e.y}`,np=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),BA=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});function Wp(e,t,n=0){const a=Math.min(...e.map(g=>g.x)),l=Math.max(...e.map(g=>g.x)),u=Math.min(...e.map(g=>g.y)),c=Math.max(...e.map(g=>g.y));if(l<t.x-4||a>t.x+cu+4||c<t.y-4||u>t.y+_f+4)return!1;if(n>=16||Math.max(l-a,c-u)<.25)return!0;const f=[e[0]],h=[e[e.length-1]];let m=e;for(;m.length>1;)m=m.slice(1).map((g,y)=>BA(m[y],g)),f.push(m[0]),h.unshift(m[m.length-1]);return Wp(f,t,n+1)||Wp(h,t,n+1)}function L3(e,t){return e.every(n=>t.every(a=>!Wp(n,a)))}function qA(e,t){const n=[];let a=e[0];const l=(u,c,f)=>{const h=f/np(u,c);return{x:u.x+(c.x-u.x)*h,y:u.y+(c.y-u.y)*h}};for(let u=1;u<e.length-1;u++){const c=e[u],f=e[u-1],h=e[u+1],m=Math.min(t,np(c,f)/2,np(c,h)/2);if(m<.001){n.push([a,c]),a=c;continue}const g=l(c,f,m),y=l(c,h,m);n.push([a,g],[g,c,y]),a=y}return n.push([a,e[e.length-1]]),n}function B3(e){return`M ${_3(e[0][0])} `+e.map(t=>`${t.length===4?"C":t.length===3?"Q":"L"} ${t.slice(1).map(_3).join(" ")}`).join(" ")}function rx(e,t){const n=e[0],a=e[e.length-1],l=(n.y+a.y)/2,u=[[n,{x:n.x,y:l},{x:a.x,y:l},a]];if(a.y>n.y&&L3(u,t))return{path:B3(u),segments:u};for(const c of[64,40,24,12,6,2,0]){const f=qA(e,c);if(L3(f,t))return{path:B3(f),segments:f}}throw new Error("No unobstructed CoTask route")}function UA(e){return JSON.stringify(e.map(t=>({id:t.id,dependencies:[...t.dependencies].sort()})).sort((t,n)=>t.id.localeCompare(n.id)))}function ax(e){const t=new Map,n=new Map,a=new Map(e.map(m=>[m.id,m])),l=[];for(;a.size;){const m=[...a.values()].filter(y=>y.dependencies.every(k=>n.has(k)||!a.has(k))),g=m.length?m:[...a.values()];l.push(g);for(const y of g)a.delete(y.id),n.set(y.id,l.length-1)}const u=Math.max(1,...l.map(m=>m.length))*296+24;l.forEach((m,g)=>m.forEach((y,k)=>t.set(y.id,{x:(u-(m.length*296-72))/2+k*296,y:48+g*200})));const c=[...t].map(([m,g])=>({id:m,...g})),f=[];let h=u;for(const m of e)for(const g of m.dependencies){const y=t.get(g),k=t.get(m.id);if(!y||!k)continue;const b={x:y.x+cu/2,y:y.y+_f},C={x:k.x+cu/2,y:k.y};h+=18;const D=[b,{x:b.x,y:b.y+25},{x:h,y:b.y+25},{x:h,y:C.y-25},{x:C.x,y:C.y-25},C],_=c.filter(z=>z.id!==g&&z.id!==m.id);f.push({source:g,target:m.id,path:rx(D,_).path})}return{positions:t,edges:f,width:h+48,height:Math.max(196,96+l.length*200-100)}}async function HA(e){var m;if(!e.length)return ax(e);const{default:t}=await an(async()=>{const{default:g}=await import("./elk.bundled-aAdTYMwi.js").then(y=>y.e);return{default:g}},[],import.meta.url),n=new Set(e.map(g=>g.id)),a=e.flatMap(g=>g.dependencies.filter(y=>n.has(y)).map(y=>({source:y,target:g.id}))),u=await new t().layout({id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.spacing.nodeNode":"40","elk.layered.spacing.nodeNodeBetweenLayers":"80","elk.layered.spacing.edgeNodeBetweenLayers":"18","elk.padding":"[top=48,left=48,bottom=48,right=48]","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX"},children:e.map(g=>({id:g.id,width:cu,height:_f})),edges:a.map((g,y)=>({id:`edge-${y}`,sources:[g.source],targets:[g.target]}))}),c=(u.children??[]).map(g=>({id:g.id,x:g.x??0,y:g.y??0})),f=new Map((m=u.edges)==null?void 0:m.map(g=>[g.id,g])),h=a.map((g,y)=>{var C,D;const k=(D=(C=f.get(`edge-${y}`))==null?void 0:C.sections)==null?void 0:D[0];if(!k)throw new Error("Missing CoTask dependency route");const b=[k.startPoint,...k.bendPoints??[],k.endPoint];return{...g,path:rx(b,c.filter(_=>_.id!==g.source&&_.id!==g.target)).path}});return{positions:new Map(c.map(g=>[g.id,g])),edges:h,width:u.width??320,height:u.height??196}}const q3={pending:"待开始",completed:"已确认完成",blocked:"已阻塞",cancelled:"已取消",running:"执行中",accepted:"等待执行",failed:"执行失败",delivered:"已交付,待确认",awaiting_review:"执行已结束,待确认"};function $A({nodes:e,members:t,executions:n,reports:a,selectedId:l,onSelect:u,onDismiss:c,detail:f,finalCheckpointId:h}){const m=e.some(ge=>ge.kind!==void 0),g=(ge,Ue)=>ge.kind==="checkpoint"?{pending:"等待前置完成",waiting:"等待 Owner 继续",completed:"已继续"}[Ue]??q3[Ue]??Ue:ge.kind&&Ue==="completed"?"已完成":q3[Ue]??Ue,y=UA(e),k=E.useMemo(()=>ax(JSON.parse(y)),[y]),[b,C]=E.useState(null),[D,_]=E.useState(!1),z=(b==null?void 0:b.topology)===y?b.graph:k;E.useEffect(()=>{let ge=!0;return _(!1),HA(JSON.parse(y)).then(Ue=>{ge&&C({topology:y,graph:Ue})}).catch(()=>{ge&&_(!0)}),()=>{ge=!1}},[y]);const N=E.useRef(null),[q,B]=E.useState({width:900,height:560}),[K,G]=E.useState(null),[U,X]=E.useState({left:0,top:0}),[ee,F]=E.useState(!1),[pe,de]=E.useState(!1),Oe=E.useRef(!1),we=E.useRef(null);E.useEffect(()=>{F(!1)},[l]);const fe=E.useId().replace(/:/g,"");E.useEffect(()=>{if(!N.current)return;const ge=new ResizeObserver(([Ue])=>B({width:Ue.contentRect.width,height:Ue.contentRect.height}));return ge.observe(N.current),()=>ge.disconnect()},[]);const J=Math.min(1,Math.max(.15,Math.min((q.width-32)/z.width,(q.height-32)/z.height))),Z=K??J,le=new Map(e.map(ge=>[ge.id,_A(ge,n,a)])),je=e.find(ge=>ge.id===l),$=l?z.positions.get(l):void 0,I=Math.min(320,Math.max(0,q.width-24)),ae=Math.min(420,Math.max(0,q.height-24)),R=$?Math.max(0,(q.width-z.width*Z)/2)+$.x*Z-U.left:0,ne=$?Math.max(0,(q.height-z.height*Z)/2)+$.y*Z-U.top:0,Te=R+cu*Z+12,Ie=Math.max(12,Math.min(q.width-I-12,Te+I<=q.width-12?Te:R-I-12)),Fe=Math.max(12,Math.min(q.height-ae-12,ne));return o.jsxs("section",{className:"cotask-graph","aria-label":"Task dependency graph",children:[o.jsxs("div",{className:"cotask-graph-toolbar",children:[o.jsxs("span",{children:["Arrows show dependencies ",o.jsxs("span",{className:"cotask-graph-count",children:["· ",e.length," nodes / ",z.edges.length," dependencies"]}),D&&o.jsx("small",{role:"status",children:" · 自动布局暂不可用,已显示基础布局"})]}),o.jsxs("div",{children:[o.jsx("button",{"aria-label":"Zoom out",onClick:()=>G(Math.max(.15,Z-.15)),children:"−"}),o.jsxs("span",{children:[Math.round(Z*100),"%"]}),o.jsx("button",{"aria-label":"Zoom in",onClick:()=>G(Math.min(2,Z+.15)),children:"+"}),o.jsx("button",{onClick:()=>G(null),children:"Fit to view"})]})]}),o.jsxs("div",{className:"cotask-graph-stage",children:[o.jsx("div",{className:`cotask-graph-viewport${pe?" dragging":""}`,ref:N,"data-layout":(b==null?void 0:b.topology)===y?"adaptive":"fallback",onScroll:ge=>X({left:ge.currentTarget.scrollLeft,top:ge.currentTarget.scrollTop}),onClickCapture:ge=>{Oe.current&&(ge.preventDefault(),ge.stopPropagation())},onClick:ge=>{ge.target.closest("button")||c()},onPointerDown:ge=>{if(ge.button!==0||ge.target.closest(".cotask-node-text"))return;Oe.current=!1;const Ue=ge.currentTarget;we.current={id:ge.pointerId,x:ge.clientX,y:ge.clientY,left:Ue.scrollLeft,top:Ue.scrollTop,moved:!1}},onPointerMove:ge=>{if(!we.current||we.current.id!==ge.pointerId)return;const Ue=ge.clientX-we.current.x,me=ge.clientY-we.current.y;Math.abs(Ue)+Math.abs(me)>4&&(we.current.moved=!0,de(!0),ge.currentTarget.setPointerCapture(ge.pointerId),ge.preventDefault()),we.current.moved&&(ge.currentTarget.scrollLeft=we.current.left-Ue,ge.currentTarget.scrollTop=we.current.top-me)},onPointerUp:ge=>{we.current&&(Oe.current=we.current.moved,we.current=null,de(!1),ge.currentTarget.hasPointerCapture(ge.pointerId)&&ge.currentTarget.releasePointerCapture(ge.pointerId),window.setTimeout(()=>{Oe.current=!1},0))},onPointerCancel:()=>{we.current=null,de(!1)},onLostPointerCapture:()=>{we.current=null,de(!1)},children:o.jsx("div",{className:"cotask-graph-scroll",style:{width:Math.max(q.width,z.width*Z),height:Math.max(q.height,z.height*Z)},children:o.jsxs("div",{className:"cotask-graph-canvas",style:{width:z.width,height:z.height,transform:`scale(${Z})`,left:Math.max(0,(q.width-z.width*Z)/2),top:Math.max(0,(q.height-z.height*Z)/2)},children:[o.jsxs("svg",{width:z.width,height:z.height,className:"cotask-graph-edges","aria-hidden":"true",children:[o.jsx("defs",{children:["default","complete","selected"].map(ge=>o.jsx("marker",{id:`${fe}-${ge}`,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"userSpaceOnUse",children:o.jsx("path",{d:"M 1 1 L 7 4 L 1 7 Z",className:`cotask-arrow-${ge}`})},ge))}),z.edges.map(ge=>{const Ue=l&&[ge.source,ge.target].includes(l)?"selected":le.get(ge.source)==="completed"?"complete":"default";return o.jsx("path",{"data-source":ge.source,"data-target":ge.target,d:ge.path,className:`cotask-edge ${Ue}`,markerEnd:`url(#${fe}-${Ue})`},`${ge.source}:${ge.target}`)})]}),e.map(ge=>{var We;const Ue=z.positions.get(ge.id),me=le.get(ge.id);return o.jsxs("button",{className:`cotask-graph-node ${me}${ge.kind==="checkpoint"?" checkpoint":""}${l===ge.id?" selected":""}`,style:{left:Ue.x,top:Ue.y,width:cu,height:_f},"aria-pressed":l===ge.id,onClick:()=>u(ge),title:ge.dependencies.length?`Depends on: ${ge.dependencies.map(qe=>{var nt;return((nt=e.find(Ze=>Ze.id===qe))==null?void 0:nt.name)??qe}).join(", ")}`:"No dependencies",children:[ge.dependencies.length>0&&o.jsx("i",{className:"cotask-node-port input"}),o.jsxs("span",{className:"cotask-graph-node-status",children:[o.jsx("i",{}),o.jsx("span",{className:"cotask-node-text",children:g(ge,me)})]}),o.jsx("strong",{className:"cotask-node-text",children:ge.name}),o.jsx("span",{className:"cotask-graph-node-member cotask-node-text",children:ge.kind==="checkpoint"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"cotask-checkpoint-type",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M6 1 11 6 6 11 1 6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})}),ge.id===h?"最终检查点":"检查点"]}),o.jsx("span",{className:"cotask-checkpoint-owner",children:"Owner 检查"})]}):((We=t.find(qe=>qe.id===ge.memberId))==null?void 0:We.name)??ge.memberId}),z.edges.some(qe=>qe.source===ge.id)&&o.jsx("i",{className:"cotask-node-port output"})]},ge.id)})]})})}),je&&$&&o.jsxs("aside",{className:`cotask-node-popover${ee?" expanded":""}`,"aria-label":`Node details: ${je.name}`,style:ee?void 0:{left:Ie,top:Fe,width:I,maxHeight:ae},onKeyDown:ge=>{ge.key==="Escape"&&(ge.stopPropagation(),c())},children:[o.jsxs("header",{children:[o.jsx("strong",{children:je.name}),o.jsx("button",{onClick:()=>F(!ee),"aria-label":ee?"Collapse node details":"Expand node details",children:ee?"Collapse":"Expand"}),o.jsx("button",{onClick:c,"aria-label":"Close node details",children:"×"})]}),o.jsx("div",{className:"cotask-node-popover-content",children:f})]})]}),o.jsxs("div",{className:"cotask-graph-legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"running"}),"执行中"]}),o.jsxs("span",{children:[o.jsx("i",{className:"delivered"}),m?"检查点等待继续":"待 Owner 确认"]}),o.jsxs("span",{children:[o.jsx("i",{className:"completed"}),m?"已完成 / 已继续":"已确认完成"]}),o.jsxs("span",{children:[o.jsx("i",{className:"pending"}),"待开始"]}),o.jsx("span",{children:m?"执行节点报告结果并正常结束后自动完成;检查点由 Owner 检查后继续":"点击节点查看上下文与报告;成员执行结束不等于节点已确认完成"})]})]})}const Kp=e=>({draft:"草稿",running:"运行中",pausing:"正在暂停",paused:"已暂停",waiting:"等待继续",finished:"已结束",pending:"Pending",completed:"Completed",blocked:"Blocked",cancelled:"Cancelled",accepted:"Accepted",failed:"Failed"})[e]??e;function U3({task:e}){const t=e.phase??e.status,n={running:["active","进行中","M8 5l10 7-10 7Z"],finished:["done","已结束","m6 12 4 4 8-8"],completed:["done","已结束","m6 12 4 4 8-8"],paused:["attention","已暂停","M9 7v10M15 7v10"],pausing:["attention","正在暂停","M9 7v10M15 7v10"],waiting:["attention","等待继续","M12 6v6l4 2"],blocked:["danger","已阻塞","M12 6v7m0 3v1"],failed:["danger","失败","M12 6v7m0 3v1"],cancelled:["neutral","已取消","m8 8 8 8m0-8-8 8"],draft:["neutral","草稿","M8 8h8M8 12h8M8 16h5"]},[a,l,u]=n[t]??["neutral",Kp(t),"M12 6v6l4 2"];return o.jsxs("span",{className:`cotask-task-status ${a}`,children:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:u})]}),l]})}function FA({ownerId:e,ownerName:t,request:n,onExpanded:a,renderMember:l,renderMarkdown:u}){const[c,f]=E.useState([]),[h,m]=E.useState(null),[g,y]=E.useState(null),[k,b]=E.useState("graph"),[C,D]=E.useState(null),[_,z]=E.useState(null),[N,q]=E.useState(null),[B,K]=E.useState([]),[G,U]=E.useState(null),[X,ee]=E.useState(null),[F,pe]=E.useState([]),[de,Oe]=E.useState(""),we=E.useRef(null),fe=E.useRef(0),J=E.useRef("");J.current=`${h}:${g==null?void 0:g.task.revision}`;const Z=E.useRef(C);Z.current=C;const le=`conversations/${encodeURIComponent(e)}/cotasks`;E.useEffect(()=>{let me=!0;const We=async()=>{try{const nt=await n(le);me&&f(nt.tasks)}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),5e3);return()=>{me=!1,window.clearInterval(qe)}},[le,n]),E.useEffect(()=>(a(h!==null),()=>a(!1)),[h,a]),E.useEffect(()=>{if(!h)return;let me=!0;const We=async()=>{try{const nt=await n(`${le}/${encodeURIComponent(h)}`);if(me&&(y(nt),Oe("")),k==="operations"){const Ze=await n(`${le}/${encodeURIComponent(h)}`,{operations:!0});me&&pe(Ze.operations)}}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),3e3);return()=>{me=!1,window.clearInterval(qe)}},[h,le,n,k]),E.useEffect(()=>{var me;h&&((me=we.current)==null||me.focus())},[h]),E.useEffect(()=>{fe.current++,U(null),ee(null),K([])},[g==null?void 0:g.task.revision]);const je=JSON.stringify(g==null?void 0:g.reports.map(me=>me.id)),$=JSON.stringify(g==null?void 0:g.nodes.map(me=>[me.id,me.status,me.reason]));E.useEffect(()=>{if(!h||!_||!g)return;let me=!0;if(!g.nodes.some(We=>We.id===_)){z(null),q(null);return}return n(`${le}/${encodeURIComponent(h)}`,{nodeIds:[_]}).then(We=>{me&&q(We.nodes[0]??null)}).catch(We=>{me&&Oe(String(We))}),()=>{me=!1}},[h,_,g==null?void 0:g.task.revision,je,$,le,n]);const I=me=>{z(null),fe.current++,U(null),ee(null),pe([]),Oe(""),y(null),m(me),b("graph"),D(null),q(null),K([])},ae=()=>{fe.current++,z(null),q(null),K([])},R=()=>{fe.current++,m(null)},ne=c.find(me=>me.status==="running")??c.find(me=>me.status==="draft")??c[0];if(!h)return ne?o.jsxs("div",{className:"cotask-launcher",children:[o.jsxs("button",{className:"cotask-launch-primary",onClick:()=>I(ne.id),children:[o.jsxs("span",{className:"cotask-launch-heading",children:[o.jsx("span",{children:"CoTask"}),o.jsx(U3,{task:ne})]}),o.jsx("strong",{children:ne.name}),o.jsxs("small",{children:[ne.nodeCount," 个节点 ↗"]})]}),c.length>1&&o.jsxs("details",{className:"cotask-task-list",children:[o.jsxs("summary",{children:["其他任务(",c.length-1,")"]}),c.filter(me=>me.id!==ne.id).map(me=>o.jsxs("button",{onClick:()=>I(me.id),children:[o.jsx("strong",{children:me.name}),o.jsx(U3,{task:me})]},me.id))]})]}):null;const Te=me=>{_!==me.id&&(fe.current++,Oe(""),q(null),K([]),z(me.id))},Ie=async me=>{const We=++fe.current;try{const qe=await n(`${le}/${h}`,{reportIds:[me.id]});We===fe.current&&K(qe.reports)}catch(qe){Oe(String(qe))}},Fe=g==null?void 0:g.bindings.find(me=>me.memberId===C),ge=g==null?void 0:g.members.find(me=>me.id===C),Ue=(me,We=e)=>o.jsx("div",{className:"cotask-markdown",children:u(me??"",We)});return o.jsx("div",{className:"context-panel-overlay settings-overlay cotask-overlay",children:o.jsxs("section",{className:"context-panel settings-panel cotask-frame",role:"dialog","aria-modal":"true","aria-label":"CoTask",tabIndex:-1,ref:we,onKeyDown:me=>{var We;if(me.stopPropagation(),me.key==="Escape"&&(me.preventDefault(),k==="graph"&&_?ae():R()),me.key==="Tab"){const qe=(We=we.current)==null?void 0:We.querySelectorAll('button:not(:disabled),select,input,a[href],textarea,[tabindex="0"]');if(!(qe!=null&&qe.length))return;const nt=qe[0],Ze=qe[qe.length-1];me.shiftKey&&(document.activeElement===nt||document.activeElement===we.current)?(me.preventDefault(),Ze.focus()):!me.shiftKey&&document.activeElement===Ze&&(me.preventDefault(),nt.focus())}},children:[o.jsxs("header",{className:"cotask-header settings-panel-header",children:[o.jsxs("div",{children:[o.jsxs("p",{children:["CoTask · ",t]}),o.jsx("h1",{children:(g==null?void 0:g.task.name)??"Loading task…"})]}),o.jsx("span",{children:g&&Kp(g.task.phase??g.task.status)}),o.jsxs("button",{className:"cotask-back",onClick:R,title:`返回 ${t}`,children:[o.jsx("span",{"aria-hidden":"true",children:"← "}),"返回"]})]}),o.jsxs("aside",{className:"cotask-nav",children:[o.jsxs("section",{className:"workspace-group","aria-label":"Task navigation",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Task"}),o.jsx("nav",{className:"workspace-group-items",children:[["graph","Task graph"],["operations","Activity"],["settings","Settings"]].map(([me,We])=>o.jsx("button",{className:`session-item${k===me?" active":""}`,"aria-current":k===me?"page":void 0,onClick:()=>{b(me),D(null)},children:o.jsx("span",{className:"session-title",children:We})},me))})]}),o.jsxs("section",{className:"workspace-group","aria-label":"Task members",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Members"}),o.jsx("div",{className:"workspace-group-items cotask-member-list",children:g==null?void 0:g.members.map(me=>{const We=g.executions.some(nt=>nt.memberId===me.id&&["accepted","running"].includes(nt.status)),qe=We?"Running":g.bindings.some(nt=>nt.memberId===me.id&&nt.workspaceId)?"Idle":"Not created";return o.jsx("button",{className:`session-item${k==="member"&&C===me.id?" active":""}`,title:`${me.name} · ${qe}`,"aria-label":`${me.name} · ${qe}`,"aria-current":k==="member"&&C===me.id?"page":void 0,onClick:()=>{D(me.id),b("member")},children:o.jsxs("span",{className:"session-heading",children:[o.jsx("span",{className:`session-status${We?" running":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"session-title",children:me.name})]})},me.id)})})]}),o.jsxs("button",{className:"cotask-return",onClick:R,children:["← Back to ",t]})]}),o.jsxs("section",{className:"cotask-main",children:[de&&o.jsx("div",{className:"cotask-error",role:"alert",children:de}),o.jsx("div",{className:`cotask-body${k==="graph"?" cotask-graph-body":""}`,children:g?o.jsxs(o.Fragment,{children:[g.warnings.length>0&&o.jsx("div",{className:"cotask-warning",children:g.warnings.map((me,We)=>o.jsxs("p",{children:[me.id?`${me.id}: `:"Common context: ","Context may exceed the injection limit. (estimated ",me.estimatedTokens," tokens)"]},We))}),k==="graph"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:"Task graph"}),o.jsxs("span",{children:[g.nodes.filter(me=>me.status==="completed").length," / ",g.nodes.length," Completed"]})]}),!g.nodes.length&&o.jsx("p",{children:"No nodes yet. Discuss the plan with the initiating agent to define the graph."}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&G===null){const We=J.current;n(`${le}/${h}`,{view:"definition"}).then(qe=>{J.current===We&&U(qe.definition.commonContext)}).catch(qe=>{J.current===We&&Oe(String(qe))})}},children:[o.jsx("summary",{children:"Common context"}),G===null?o.jsx("p",{children:"Loading…"}):Ue(G)]},g.task.revision),g.nodes.length>0&&o.jsx($A,{finalCheckpointId:g.finalCheckpointId,nodes:g.nodes,members:g.members,executions:g.executions,reports:g.reports,selectedId:_??void 0,onSelect:me=>void Te(me),onDismiss:ae,detail:(N==null?void 0:N.definition.id)===_?o.jsxs("div",{className:"cotask-node-detail",children:[N.runtime&&o.jsxs("p",{children:[Kp(N.runtime.status),N.runtime.reason&&o.jsxs(o.Fragment,{children:[" · ",N.runtime.reason]})]}),Ue(N.definition.context),o.jsx("h4",{children:N.definition.kind==="checkpoint"?"检查点":"Reports"}),N.reports.length?N.reports.map(me=>o.jsxs("button",{onClick:()=>void Ie(me),children:[me.type," · ",me.summary]},me.id)):o.jsx("p",{children:N.definition.kind==="checkpoint"?"此节点不启动成员执行,也不生成成员报告。Owner 按上下文检查交付内容后继续。":"No reports yet."}),B.map(me=>{var We;return o.jsxs("article",{children:[o.jsx("h4",{children:me.summary}),Ue(me.content,((We=g.executions.find(qe=>qe.id===me.executionId))==null?void 0:We.workspaceId)??"")]},me.id)})]}):o.jsx("p",{children:"Loading node…"})}),g.task.conclusion&&o.jsxs("details",{className:"cotask-conclusion",children:[o.jsx("summary",{children:"Conclusion"}),Ue(g.task.conclusion)]})]}),k==="operations"&&o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Activity"}),o.jsx("p",{children:"Changes are saved immediately and retained if a turn fails."}),F.length?F.map((me,We)=>o.jsxs("details",{className:"cotask-operation",children:[o.jsxs("summary",{children:[String(me.action)," · ",String(me.status)," · Turn ",String(me.turnStatus)]}),o.jsx("pre",{children:JSON.stringify(me,null,2)})]},We)):o.jsx("p",{children:"No activity yet."})]}),k==="settings"&&o.jsx(PA,{task:g.task,path:`${le}/${h}/settings`,request:n,onSaved:me=>y({...g,task:me})},h),k==="member"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:ge==null?void 0:ge.name}),o.jsx("span",{children:"CoTask member"})]}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&C&&(X==null?void 0:X.id)!==C){const We=C,qe=J.current;n(`${le}/${h}`,{memberIds:[We]}).then(nt=>{var Ze;J.current===qe&&Z.current===We&&ee({id:We,context:((Ze=nt.members[0])==null?void 0:Ze.context)??""})}).catch(nt=>{J.current===qe&&Z.current===We&&Oe(String(nt))})}},children:[o.jsx("summary",{children:"Member context"}),(X==null?void 0:X.id)===C?Ue(X.context):o.jsx("p",{children:"Loading…"})]},`${C}:${g.task.revision}`),Fe!=null&&Fe.workspaceId?l(Fe.workspaceId):o.jsx("p",{children:g.executions.some(me=>me.memberId===C)?"This member instance was removed. Execution history is retained.":g.task.executionMode==="self_driving"?"首次符合执行条件时,平台自动创建此成员实例。":"This member will be created when its first node is driven."})]})]}):o.jsx("p",{children:"Loading task…"})})]})]})})}function PA({task:e,path:t,request:n,onSaved:a}){var N,q;const[l,u]=E.useState({...e.runtimeSettings,mode:e.runtimeSettings.mode??"custom",fastMode:e.runtimeSettings.fastMode??!1}),[c,f]=E.useState(e.revision),[h,m]=E.useState([]),[g,y]=E.useState([]),[k,b]=E.useState(!1),[C,D]=E.useState("");E.useEffect(()=>{let B=!0;return Promise.all([n("settings/runtime/models?refresh=0"),n("settings/model-providers/options")]).then(([K,G])=>{B&&(m(K.models),y(G.channels))}).catch(K=>{B&&D(String(K))}),()=>{B=!1}},[n]);const _=h.find(B=>B.model===l.model||B.id===l.model),z=((N=_==null?void 0:_.supportedReasoningEfforts)==null?void 0:N.map(B=>B.reasoningEffort))??["none","minimal","low","medium","high","xhigh","max"];return o.jsxs("section",{className:"cotask-settings",children:[o.jsx("h2",{children:"Settings"}),o.jsx("p",{children:"Settings apply to the whole CoTask and take effect on each member’s next turn."}),o.jsxs("label",{children:["配置模式",o.jsxs("select",{value:l.mode,onChange:B=>u({...l,mode:B.target.value}),children:[o.jsx("option",{value:"global",children:"沿用 CoTask 默认配置"}),o.jsx("option",{value:"custom",children:"CoTask 自定义配置"})]})]}),l.mode==="global"?o.jsx("p",{children:"每个成员在下一次 turn 读取最新 CoTask 默认模型、推理强度和倍速设置;正在运行的 turn 不受影响。"}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model source",o.jsxs("select",{value:l.modelSource.type==="codex"?"codex":l.modelSource.channelId,onChange:B=>u({...l,modelSource:B.target.value==="codex"?{type:"codex"}:{type:"custom",channelId:B.target.value}}),children:[o.jsx("option",{value:"codex",children:"Codex"}),l.modelSource.type==="custom"&&!g.some(B=>B.id===l.modelSource.channelId)&&o.jsx("option",{value:l.modelSource.channelId,children:"Current channel unavailable"}),g.map(B=>o.jsx("option",{value:B.id,children:B.name},B.id))]})]}),l.modelSource.type==="codex"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"1.5 倍速(Fast mode)"}),o.jsx("input",{type:"checkbox",checked:l.fastMode,onChange:B=>u({...l,fastMode:B.target.checked})})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:l.model,onChange:B=>u({...l,model:B.target.value}),children:[o.jsx("option",{value:"",children:"Default model"}),l.model&&!h.some(B=>B.model===l.model)&&o.jsx("option",{children:l.model}),h.map(B=>o.jsx("option",{value:B.model,children:B.displayName},B.id))]})]}),o.jsxs("label",{children:["Reasoning effort",o.jsxs("select",{value:l.reasoningEffort,onChange:B=>u({...l,reasoningEffort:B.target.value}),children:[o.jsx("option",{value:"",children:"Default"}),l.reasoningEffort&&!z.includes(l.reasoningEffort)&&o.jsx("option",{children:l.reasoningEffort}),z.map(B=>o.jsx("option",{children:B},B))]})]})]}):o.jsxs("p",{children:["Channel model: ",((q=g.find(B=>B.id===l.modelSource.channelId))==null?void 0:q.model)??"Channel unavailable",". Codex reasoning effort does not apply to custom channels."]})]}),o.jsx("button",{disabled:k,onClick:async()=>{b(!0),D("");try{const B=await n(t,{expectedRevision:c,runtimeSettings:l},"PUT");f(B.task.revision),a(B.task),D("Saved. Changes take effect on the next turn.")}catch(B){D(`${String(B)}. If the task changed, reopen Settings before saving.`)}finally{b(!1)}},children:k?"Saving…":"Save settings"}),C&&o.jsx("p",{role:"status",children:C})]})}function GA(e,t=new Date){if(e==null||!Number.isInteger(e)||e<1||e>31)return null;const n=new Date(t.getTime()+480*60*1e3),a=n.getUTCFullYear(),l=n.getUTCMonth(),u=Date.UTC(a,l,n.getUTCDate()),c=h=>Date.UTC(a,l+h,Math.min(e,new Date(Date.UTC(a,l+h+1,0)).getUTCDate()));let f=c(0);return f<u&&(f=c(1)),{date:new Date(f).toISOString().slice(0,10),days:(f-u)/864e5}}function VA({content:e,streaming:t}){const[n,a]=E.useState(!1),l=E.useId();return o.jsxs("section",{className:`message reasoning${t?" is-streaming":""}${n?" is-expanded":""}`,children:[o.jsxs("button",{className:"reasoning-toggle",type:"button","aria-expanded":n,"aria-controls":l,onClick:()=>a(u=>!u),children:[o.jsx("span",{className:"reasoning-indicator","aria-hidden":"true"}),o.jsx("span",{children:t?"思考中":"思考过程"}),o.jsx("span",{className:"reasoning-action",children:n?"收起":"展开"}),o.jsx("svg",{className:"reasoning-chevron",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4 2 4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4"})})]}),o.jsx("div",{id:l,hidden:!n&&!t,className:`reasoning-content${n?"":" reasoning-preview"}`,children:o.jsx("div",{className:"message-body",children:n?e:e.slice(-600)})})]})}function YA(e,t){if(!t||typeof t!="object")return null;const{method:n,params:a}=t;if(!a)return null;if(n==="item/completed"){const m=a.item;if((m==null?void 0:m.type)!=="reasoning"||typeof m.id!="string")return null;const g=e.get(m.id)??{itemId:m.id,text:new Map,summary:new Map,completed:!1};for(const y of["text","summary"]){const k=m[y];Array.isArray(k)&&k.forEach((b,C)=>{typeof b=="string"&&b&&g[y].set(C,b)})}return g.completed=!0,e.set(m.id,g),g}const l=/^item\/reasoning\/(text|summaryText)(Delta|Snapshot)$/.exec(n??"");if(!l||typeof a.itemId!="string")return null;const u=l[1]==="text"?"text":"summary",c=a[u==="text"?"contentIndex":"summaryIndex"],f=a[l[2]==="Delta"?"delta":"text"];if(typeof c!="number"||!Number.isSafeInteger(c)||c<0||typeof f!="string")return null;const h=e.get(a.itemId)??{itemId:a.itemId,text:new Map,summary:new Map,completed:!1};return h[u].set(c,l[2]==="Snapshot"?f:(h[u].get(c)??"")+f),e.set(a.itemId,h),h}function WA(e){return[...e.text.size?e.text:e.summary].sort(([n],[a])=>n-a).map(([,n])=>n).join(`
|
|
347
347
|
|
|
348
348
|
`)}function KA({id:e,baseUrl:t,query:n}){var g;const[a,l]=E.useState(null),[u,c]=E.useState(!1),[f,h]=E.useState(!1),m=async()=>{c(!0),h(!1);try{const y=await n(e);y.status==="ok"||y.status==="unsupported"?l(y):(h(!0),l(k=>(k==null?void 0:k.status)==="ok"?k:y))}catch{h(!0)}finally{c(!1)}};return E.useEffect(()=>{let y=!1;return c(!0),n(e).then(k=>{y||l(k)}).catch(()=>{y||h(!0)}).finally(()=>{y||c(!1)}),()=>{y=!0}},[e,n]),o.jsxs("div",{className:"channel-balance-inline",children:[o.jsx("span",{className:"channel-balance-total",title:"Available balance",children:(a==null?void 0:a.status)==="ok"&&a.balance?a.balance.balance_infos.map(y=>`${y.currency} ${y.total_balance}`).join(" / "):u?"Checking…":(a==null?void 0:a.status)==="unsupported"?"Balance —":"Balance unavailable"}),f?o.jsx("span",{className:"channel-balance-warning",title:"Refresh failed; the displayed amount may be stale",role:"status",children:"Stale"}):null,a!=null&&a.balance&&!a.balance.is_available?o.jsx("span",{className:"channel-balance-warning",children:"Insufficient"}):null,o.jsx("button",{type:"button","aria-label":"Refresh balance",title:"Refresh balance",disabled:u,onClick:()=>void m(),children:"↻"}),o.jsxs("details",{className:"channel-balance-details",children:[o.jsx("summary",{children:"Details"}),o.jsxs("div",{children:[o.jsxs("p",{className:"channel-endpoint",children:[t," · Responses API"]}),(g=a==null?void 0:a.balance)==null?void 0:g.balance_infos.map(y=>o.jsxs("p",{children:[y.currency," · Granted ",y.granted_balance," · Topped up ",y.topped_up_balance]},y.currency)),a?o.jsxs("small",{children:["Checked ",new Date(a.checkedAt).toLocaleString()]}):null,f?o.jsx("small",{children:"Refresh failed. Any amount shown is the last successful result."}):null,(a==null?void 0:a.status)==="unsupported"?o.jsx("small",{children:"This channel does not support balance queries."}):null,o.jsx("small",{children:"Uses saved credentials; unsaved edits are not queried."})]})]})]})}function ix(e,t){const n=e??{type:"codex"},a=t??{type:"codex"};return n.type===a.type&&(n.type!=="custom"||a.type==="custom"&&n.channelId===a.channelId)}function XA({load:e,save:t,queryBalance:n}){const[a,l]=E.useState(null),[u,c]=E.useState([]),[f,h]=E.useState(!1),[m,g]=E.useState(""),[y,k]=E.useState(!1),[b,C]=E.useState(null),D=JSON.stringify(u)!==JSON.stringify((a==null?void 0:a.channels.map(N=>({channel:N})))??[]);E.useEffect(()=>{let N=!1;return e().then(q=>{N||(l(q),c(q.channels.map(B=>({channel:B}))))}).catch(()=>{N||g("Unable to load channels. Reopen this panel to retry.")}),()=>{N=!0}},[e]);const _=(N,q)=>{k(!1),c(B=>B.map((K,G)=>G===N?{...K,channel:{...K.channel,...q}}:K))},z=async N=>{if(N.preventDefault(),!(!a||f)){h(!0),g(""),k(!1);try{const q=await t({expectedRevision:a.revision,channels:u.map(B=>({channel:B.channel,...B.apiKey?{apiKey:B.apiKey}:{}}))});l(q),c(q.channels.map(B=>({channel:B}))),k(!0),C(null)}catch{g("Channels were not saved. Check the fields. If another administrator changed them, reopen this panel to load the latest version.")}finally{h(!1)}}};return o.jsxs("section",{children:[o.jsx("header",{className:"settings-section-header",children:o.jsxs("div",{children:[o.jsx("h3",{children:"Custom model channels"}),o.jsx("p",{children:"Select a configured channel in Runtime."})]})}),o.jsxs("form",{className:"settings-form",onSubmit:N=>void z(N),children:[!a&&!m?o.jsx("p",{children:"Loading channels…"}):null,o.jsxs("div",{className:"settings-field-wide channel-summary-list",children:[u.map(N=>o.jsxs("article",{className:"channel-summary-card",children:[o.jsxs("div",{className:"channel-summary-identity",children:[o.jsx("h4",{children:N.channel.name||"New channel"}),o.jsx("p",{children:N.channel.model||"Model not configured"})]}),n&&(a!=null&&a.channels.some(q=>q.id===N.channel.id))?o.jsx(KA,{id:N.channel.id,baseUrl:a.channels.find(q=>q.id===N.channel.id).baseUrl,query:n},`${N.channel.id}:${a.revision}`):o.jsx("small",{children:"Not saved"}),o.jsx("button",{type:"button",disabled:f||b!==null&&b!==N.channel.id,onClick:()=>{C(N.channel.id),k(!1)},children:"Edit channel"})]},N.channel.id)),a&&u.length===0?o.jsx("p",{children:"No custom channels yet. Add a channel to get started."}):null]}),u.map((N,q)=>b===N.channel.id?o.jsxs("fieldset",{disabled:f,className:"settings-field-wide model-channel-card",children:[o.jsx("legend",{children:a!=null&&a.channels.some(B=>B.id===N.channel.id)?"Edit channel":"Add channel"}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{"aria-label":`Channel ${q+1} name`,required:!0,maxLength:128,value:N.channel.name,onChange:B=>_(q,{name:B.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Type"}),o.jsx("select",{"aria-label":`Channel ${q+1} type`,value:N.channel.kind,onChange:()=>{},children:o.jsx("option",{value:"responses",children:"Responses API"})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Base URL"}),o.jsx("input",{"aria-label":`Channel ${q+1} URL`,type:"url",required:!0,placeholder:"https://api.example.com/v1",value:N.channel.baseUrl,onChange:B=>_(q,{baseUrl:B.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Model ID"}),o.jsx("input",{"aria-label":`Channel ${q+1} model`,required:!0,maxLength:256,placeholder:"Model ID from your service",value:N.channel.model,onChange:B=>_(q,{model:B.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"API key"}),o.jsx("input",{"aria-label":`Channel ${q+1} API key`,type:"password",autoComplete:"new-password",required:!(a!=null&&a.channels.some(B=>B.id===N.channel.id)),value:N.apiKey??"",placeholder:a!=null&&a.channels.some(B=>B.id===N.channel.id)?"Configured · leave blank to keep":"Enter API key",onChange:B=>{const K=B.target.value;k(!1),c(G=>G.map((U,X)=>X===q?{...U,apiKey:K}:U))}})]}),o.jsx("button",{type:"button",onClick:()=>{c(B=>B.filter((K,G)=>G!==q)),k(!1),C(null)},children:"Remove channel on save"}),o.jsx("small",{children:"Changes take effect only after Save channels. Leave the API key blank to keep the saved key."})]},N.channel.id):null),m?o.jsx("p",{role:"alert",children:m}):null,y?o.jsx("p",{role:"status",children:"Channels saved. New executions use the updated configuration."}):null,o.jsxs("div",{className:"settings-form-actions",children:[o.jsx("button",{type:"button",disabled:!a||f||b!==null||u.length>=100,onClick:()=>{const N=crypto.randomUUID().replaceAll("-","");C(N),k(!1),c(q=>[...q,{channel:{id:N,name:"",kind:"responses",baseUrl:"",model:""}}])},children:"Add channel"}),b||JSON.stringify(u)!==JSON.stringify(a==null?void 0:a.channels.map(N=>({channel:N})))?o.jsx("button",{type:"button",disabled:f,onClick:()=>{c((a==null?void 0:a.channels.map(N=>({channel:N})))??[]),C(null),g("")},children:"Discard changes"}):null,b||D?o.jsx("button",{type:"submit",disabled:!a||f,children:f?"Saving…":"Save channels"}):null]})]})]})}function ZA(e){const t=new Map;for(const n of e){if(!n.turnId)continue;if(n.event==="server.wakeup.started"){t.set(n.turnId,"wakeup");continue}if(n.event!=="server.turn")continue;const a=JA(n.data);t.set(n.turnId,typeof a.source=="string"?a.source:"web")}return t}function Gc(e,t){return!!(t&&e.includes(t))}function QA(e){var n;if((e==null?void 0:e.status)!=="failed")return null;const t=(n=e.error)==null?void 0:n.trim();return t?{turnId:e.id,content:t,createdAt:e.finishedAt??e.startedAt}:null}function JA(e){return e&&typeof e=="object"?e:{}}const eE=["summary","message","status","instruction","description","reason","error","text"],H3=96,tE=new Set(["codex.dynamic_tool_request","codex.process_exited","codex.protocol_error"]),nE=new Set(["server.item.snapshot","server.status","runtime.worker_stderr","codex.dynamic_tool_request"]),rE=new Set(["agentMessage","commandExecution","contextCompaction","fileChange","mcpToolCall","reasoning","userMessage","webSearch"]),lx=new Set(["item/commandExecution/terminalInteraction"]),aE=new Map([["server.wakeup.retry_scheduled","Wakeup retry scheduled"],["runtime.worker_exit","Runtime worker exited"]]);function iE(e){if(e.event!=="codex.notification")return!1;const t=oi(e.data);return typeof t.method=="string"&&lx.has(t.method)}function lE(e){if(nE.has(e.event))return null;if(e.event.startsWith("server.")||e.event.startsWith("runtime.")||tE.has(e.event))return e.event;if(e.event!=="codex.notification")return null;const t=oi(e.data),n=typeof t.method=="string"?t.method:"",a=oi(t.params),l=oi(a.item),u=typeof l.type=="string"?l.type:"";return!n.startsWith("item/")||lx.has(n)||/(?:\/delta|Delta)$/.test(n)||rE.has(u)?null:n}function sx(e,t){const n=t.replace(/^input:/,""),a=(e==null?void 0:e.trim())??"";return!a||a===t||a===n?aE.get(n)??ox(n):a}function Ys(e,t=[]){const n=oi(e),l=[...t,...eE.map(u=>Vc(n[u]))].map(u=>(u==null?void 0:u.replace(/\s+/g," ").trim())??"").find(Boolean);return l?l.length<=H3?l:`${l.slice(0,H3-3)}...`:"查看详情"}function Xp(e,t=new Map){const n=oi(e),a=typeof n.unreadCount=="number"&&n.unreadCount>0?Math.floor(n.unreadCount):0,u=(Array.isArray(n.senderWorkspaceIds)?Array.from(new Set(n.senderWorkspaceIds.filter(h=>typeof h=="string").map(h=>h.trim()).filter(Boolean))):[]).map(h=>t.get(h)??h),c="Messages",f=[a>0?String(a):"",u.length>0?`from ${u.join(", ")}`:""].filter(Boolean).join(" ");return{title:c,detail:Ys({},[f])}}function sE(e){const t=oi(e),n=Array.isArray(t.offers)?t.offers.map(oi).filter(u=>Object.keys(u).length>0):[],a=n.map(u=>{var c;return(c=Vc(u.previewText))==null?void 0:c.trim()}).filter(u=>!!u),l=n.length;return{title:l===1?"New input available":`${l} new inputs available`,detail:Ys({},a.slice(0,2)),meta:l===1?"preview":`${l} previews`}}function oE(e){const t=oi(e),n=Vc(t.actionType)??"",a=oi(t.payload);return n==="seele_wakeup"||n==="seele_workspace_schedule_wakeup"?{title:(Vc(a.action)??"schedule")==="cancel"?"Wakeup cancellation requested":"Wakeup requested",detail:Ys(a,[Vc(a.instruction)]),meta:"after turn"}:{title:"Action requested",detail:Ys(a,[ox(n||"agent action")]),meta:"after turn"}}function ox(e){const n=(e.split(/[./]/).filter(Boolean).pop()??e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):"System event"}function Vc(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e)}function oi(e){return e&&typeof e=="object"?e:{}}function Zp(e){const t=Qp(e);return(Array.isArray(t.changes)?t.changes:[]).flatMap(a=>{const l=Qp(a);if(typeof l.path!="string"||!l.path.trim())return[];const u=fE(l.kind),c=typeof l.diff=="string"?l.diff:"",f=dE(c,u);return[{path:l.path,kind:u,additions:f.additions,deletions:f.deletions}]})}function ux(e,t){const n=F3(e),a=F3(t??"").replace(/\/+$/,"");return a&&(n===a||n.startsWith(`${a}/`))?n.slice(a.length+1)||".":n}function uE(e,t){if(e.length===0)return"File changed";const n=ux(e[0].path,t);return e.length===1?n:`${n} +${e.length-1}`}function cE(e){return e.reduce((t,n)=>({additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{additions:0,deletions:0})}function dE(e,t){if(!e)return{additions:0,deletions:0};if(t==="add")return{additions:$3(e),deletions:0};if(t==="delete")return{additions:0,deletions:$3(e)};let n=0,a=0;for(const l of e.split(`
|
|
349
349
|
`))l.startsWith("+")&&!l.startsWith("+++")?n+=1:l.startsWith("-")&&!l.startsWith("---")&&(a+=1);return{additions:n,deletions:a}}function $3(e){const t=e.split(`
|
|
@@ -372,7 +372,7 @@ ${e.content}`:e.type==="system"?[e.title,e.fullDetail??e.detail].filter(t=>!!(t!
|
|
|
372
372
|
|
|
373
373
|
`):""}function lM(e){return e.map(Uc).filter(t=>t.trim()).join(`
|
|
374
374
|
|
|
375
|
-
`)}function sM(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.type!=="tool")return n.createdAt}return new Date().toISOString()}function oM({usage:e}){return
|
|
375
|
+
`)}function sM(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.type!=="tool")return n.createdAt}return new Date().toISOString()}function oM({usage:e}){if(!e)return o.jsx("span",{"aria-label":"Usage pending",className:"usage-indicator muted","data-tooltip":"Usage pending",role:"status",tabIndex:0,children:o.jsx("strong",{children:"--"})});const t=[e.accountName??"Codex",e.updatedAt?`更新于 ${ot(e.updatedAt)}`:"尚无额度数据",e.stale?"数据待更新":"",e.syncPending?`正在同步到 ${e.selectedAccountName??"新账户"}`:"",e.error?`最近一次刷新失败:${e.error}`:""].filter(Boolean).join(" · ");return o.jsxs("div",{className:"usage-indicators","aria-label":"Seele usage",children:[e.windows.length===0&&o.jsx("span",{className:"usage-indicator muted",role:"status",tabIndex:0,"aria-label":t,"data-tooltip":t,children:"--"}),e.windows.map(n=>o.jsx(uM,{label:Ax(n.windowDurationMins),window:n,accountTooltip:t},`${n.windowDurationMins}:${n.resetsAt}`))]})}function Ax(e){return e%10080===0?`${e/10080}w`:e%1440===0?`${e/1440}d`:e%60===0?`${e/60}h`:`${e}m`}function uM({label:e,window:t,accountTooltip:n}){const a=Bf(t.usedPercent),l=rg(a),u=`${n?`${n} · `:""}${e} usage ${ib(a)} · resets ${lb(t.resetsAt)}`;return o.jsx("span",{"aria-label":u,className:`usage-indicator ${l}`,"data-tooltip":u,role:"status",style:{"--usage-level":`${a}%`},tabIndex:0,children:o.jsxs("strong",{children:[Math.round(a),"%"]})})}function Ex(e,t,n,a,l,u){const c=[...e].sort(Yc),f=new Map(a.filter(U=>U.parentId===null&&U.nodeType==="agent_turn"&&U.turnId!==null).map(U=>[U.turnId,U.sequence])),h=new Map(a.filter(U=>U.parentId===null&&U.nodeType==="agent_turn"&&U.turnId!==null).map(U=>[U.turnId,U.timelineAt])),m=new Map(a.filter(U=>U.nodeType==="user_message"&&U.entityId!==null).map(U=>[U.entityId,U.sequence])),g=new Map(a.filter(U=>U.nodeType==="user_message"&&U.entityId!==null).map(U=>[U.entityId,U.timelineAt])),y=a.filter(U=>U.parentId===null&&U.nodeType==="system_event"),k=new Map(y.flatMap(U=>{const X=LA(U,n);return X&&f.has(X)?[[U.id,X]]:[]})),b=y.filter(U=>!k.has(U.id)&&U.turnId!==null&&U.subtype.startsWith("input:")),C=y.filter(U=>!k.has(U.id)&&!b.includes(U)),D=new Set(y.flatMap(U=>U.turnId?[U.turnId]:[])),_=ZA(t),z=new Map(n.map(U=>[U.id,U])),N=a.filter(U=>U.parentId===null&&U.nodeType==="agent_turn"&&U.turnId!==null).map(U=>U.turnId),B=[...new Set(a.length>0?[...N,...l?[l]:[]]:[...n.map(U=>U.id),...c.flatMap(U=>U.turnId?[U.turnId]:[]),...t.flatMap(U=>U.turnId?[U.turnId]:[])])].map(U=>{var ge,Ue,me,We;const X=z.get(U),ee=c.filter(qe=>qe.turnId===U),F=ee.filter(qe=>qe.role==="user").sort((qe,nt)=>{const Ze=g.get(qe.id)??qe.createdAt,Mt=g.get(nt.id)??nt.createdAt;return Ze.localeCompare(Mt)||Yc(qe,nt)}),pe=ee.filter(qe=>qe.role==="assistant"),de=t.filter(qe=>qe.turnId===U).sort(Yc),Oe=`turn:${U}`,we=a.filter(qe=>qe.parentId===Oe).sort((qe,nt)=>qe.sequence-nt.sequence),fe=(X==null?void 0:X.origin)??_.get(U),J=b.filter(qe=>qe.turnId===U).sort((qe,nt)=>qe.timelineAt.localeCompare(nt.timelineAt)||qe.sequence-nt.sequence).map(qe=>cp(qe,void 0,u)),Z=fe==="timeline_event"?[]:a.length>0?yM(we,de,Gc([U],l),u):Mx(de,Gc([U],l),u),le=pe.map(Ic),je=gM(Z,le),$=QA(X);$&&je.push({id:`turn-error-${$.turnId}`,type:"turnError",createdAt:$.createdAt,content:$.content});const I=de.find(qe=>qe.event==="server.wakeup.started"),ae=$e(I==null?void 0:I.data),R=typeof ae.instruction=="string"?ae.instruction.trim():"",ne=fe==="timeline_event"?de[0]:void 0,Te=D.has(U)?null:ne?Nx(ne,(X==null?void 0:X.startedAt)??new Date(0).toISOString()):hM(fe)?{id:`system-${U}`,type:"system",createdAt:(X==null?void 0:X.startedAt)??((ge=de[0])==null?void 0:ge.createdAt)??new Date(0).toISOString(),title:mM(fe??"system"),detail:pM(fe??"system",R),fullDetail:R||void 0}:null,Ie=zM(de),Fe=(F[0]?g.get(F[0].id):(Ue=b.find(qe=>qe.turnId===U))==null?void 0:Ue.timelineAt)??h.get(U)??(X==null?void 0:X.startedAt)??((me=ee[0])==null?void 0:me.createdAt)??((We=de[0])==null?void 0:We.createdAt)??new Date(0).toISOString();return{id:`turn-${U}`,turnIds:[U],user:Te??(F[0]?Ic(F[0]):null),followupUsers:F.slice(1).map(Ic),acceptedSystemInputs:J,cotaskNotices:y.filter(qe=>k.get(qe.id)===U).map(qe=>cp(qe,void 0,u)),agentItems:je,activity:Ie??(Gc([U],l)?{id:-1,title:je.some(qe=>qe.type==="assistantText"&&qe.streaming)?"Writing response":"Working",createdAt:Fe,tone:"running"}:null),notificationFailure:DM(de),stopped:(X==null?void 0:X.status)==="cancelled"||de.some(zx),trailingSystemItems:[],sortAt:Fe,sortSequence:f.get(U)??null}}),K=c.filter(U=>!U.turnId);B.push(...K.map(U=>({id:`message-${U.id}`,turnIds:[],user:U.role==="user"?Ic(U):null,followupUsers:[],agentItems:U.role==="assistant"?[Ic(U)]:[],activity:null,notificationFailure:null,stopped:!1,sortAt:g.get(U.id)??U.createdAt,sortSequence:m.get(U.id)??null})));const G=new Map(t.map(U=>[String(U.id),U]));return B.push(...C.map(U=>({id:U.id,turnIds:[],user:cp(U,U.entityType==="event"&&U.entityId?G.get(U.entityId):void 0,u),followupUsers:[],agentItems:[],activity:null,notificationFailure:null,stopped:!1,trailingSystemItems:[],sortAt:U.timelineAt,sortSequence:U.sequence}))),B.sort((U,X)=>{const ee=U.sortAt.localeCompare(X.sortAt);return ee!==0?ee:U.sortSequence!==null||X.sortSequence!==null?(U.sortSequence??Number.MAX_SAFE_INTEGER)-(X.sortSequence??Number.MAX_SAFE_INTEGER):0}).map(({sortAt:U,...X})=>X)}function cp(e,t,n){var f,h;if(t||e.entityType==="event")return Nx(t??r1(e),e.createdAt);const a=$e(e.detail);if(e.subtype==="input:collaboration_notice"||e.subtype==="input:topic_message"){const m=Xp(a,n),g=cM(a.messages,n),y=Array.isArray(a.senderWorkspaceIds)?a.senderWorkspaceIds.filter(b=>typeof b=="string"&&b.trim().length>0):[],k=typeof a.unreadCount=="number"?a.unreadCount:0;return{id:e.id,type:"system",createdAt:e.createdAt,title:m.title,detail:m.detail,visualKind:"topic",topicMessages:g,fullDetail:[`## ${m.title}`,"","**Unread**","",String(k),"","**From**","",y.length>0?y.map(b=>{const C=n.get(b)??b;return`${Ps(C)} (\`${b}\`)`}).join(", "):"Unknown"].join(`
|
|
376
376
|
`)}}const l=sx(e.title,e.subtype),u=Ys(a,[e.summary,e.contentMarkdown]),c=[`## ${Ps(l)}`,"",((f=e.contentMarkdown)==null?void 0:f.trim())||((h=e.summary)==null?void 0:h.trim())||"",Object.keys(a).length>0?["","```json",JSON.stringify(a,null,2),"```"].join(`
|
|
377
377
|
`):""].filter(Boolean).join(`
|
|
378
378
|
`);return{id:e.id,type:"system",createdAt:e.createdAt,title:l,detail:u,fullDetail:c||void 0}}function cM(e,t){if(!Array.isArray(e))return[];const n=new Set,a=[];for(const l of e){const u=$e(l),c=Je(u.id),f=Je(u.senderWorkspaceId),h=Je(u.contentMarkdown).trim(),m=Je(u.createdAt);!c||n.has(c)||!f||!h||!m||(n.add(c),a.push({id:c,senderWorkspaceId:f,senderName:t.get(f)??(Je(u.senderTitleSnapshot)||f),contentMarkdown:h,createdAt:m}))}return a}function Nx(e,t){return e.event==="server.collaboration.topic_created"?dM(e,t):fM(e,t)}function dM(e,t){const n=$e($e(e.data).topic),a=Je(n.title).trim()||"Untitled Topic",l=Je(n.publicDescription).trim()||"未填写描述",u=Array.isArray(n.members)?n.members.map($e):[],c=Je(n.ownerWorkspaceId),f=u.find(y=>Je(y.role)==="owner"||Je(y.workspaceId)===c),h=Je(f==null?void 0:f.workspaceTitleSnapshot).trim()||"Unknown workspace",m=u.filter(y=>Je(y.role)!=="owner"&&Je(y.status)==="active"),g=m.length?m.map(y=>{const k=Je(y.workspaceTitleSnapshot).trim()||"Unknown workspace";return`- ${Ps(k)} (\`${Je(y.workspaceId)}\`)`}):["无"];return{id:`collaboration-topic-created-${e.id}`,type:"system",createdAt:e.createdAt??t,title:"Created",detail:a,visualKind:"topic",fullDetail:["## Topic 已创建","","**名称**","",Ps(a),"","**描述**","",Ps(l),"","**Owner Workspace**","",`${Ps(h)} (\`${c}\`)`,"","**协作 Workspace**","",...g].join(`
|
|
@@ -381,7 +381,7 @@ ${e.content}`:e.type==="system"?[e.title,e.fullDetail??e.detail].filter(t=>!!(t!
|
|
|
381
381
|
`);if(t<0)return 0;const n=[0];for(let l=0;l<e.length;l+=1)e[l]===`
|
|
382
382
|
`&&l+1<e.length&&n.push(l+1);let a=-1;for(const l of n){const u=e.indexOf(`
|
|
383
383
|
`,l),c=e.slice(l,u===-1?e.length:u);/^\s*(```|~~~)/.test(c)&&(a=a===-1?l:-1)}return a>=0?a:t+1}function $M({artifact:e,onPreview:t,onCopyUrl:n,copied:a}){return e?o.jsxs("figure",{className:"artifact-preview",children:[o.jsx("button",{className:"artifact-preview-media",onClick:()=>t(e),type:"button",children:o.jsx("img",{alt:e.name,src:e.url})}),o.jsxs("figcaption",{children:[o.jsx("span",{children:e.name}),o.jsxs("div",{className:"artifact-preview-actions",children:[o.jsx("button",{onClick:()=>t(e),type:"button",children:"Preview"}),o.jsx("a",{href:e.url,rel:"noreferrer",target:"_blank",children:"Open"}),o.jsx("button",{onClick:()=>n(e),type:"button",children:a?"Copied":"Copy"})]})]})]}):null}function FM(e,t){const n=new Map;for(const a of PM(e)){const l=_x(a);if(l){const u=Lx(l).toLowerCase(),c=n.get(u);(!c||YM(l,c))&&n.set(u,l)}}return Array.from(n.values()).map(a=>GM(a,t)).filter(a=>a!==null)}function PM(e){const t=[],n=/!\[[^\]]*]\(([^)]+)\)/g,a=/\[[^\]]+]\(([^)]+)\)/g,l=/(?:artifact|preview|image|file)\s*:\s*(`?[^`\n]+?\.(?:svg|png|jpe?g|webp|gif)`?)/gim;for(const u of[n,a,l]){let c;for(;(c=u.exec(e))!==null;)t.push(c[1])}return t}function GM(e,t){const n=_x(e);if(!n||!VM(n))return null;const a=fx(n,t.workspacePath);return{id:`${t.id}:${a}`,path:a,name:Lx(a),url:Ae(`conversations/${t.id}/files?path=${encodeURIComponent(a)}`)}}function _x(e){const t=e.trim().replace(/^`+|`+$/g,"").replace(/[),.;:,。;:]+$/g,"");return t||null}function VM(e){return/\.(?:svg|png|jpe?g|webp|gif)$/i.test(e)}function Lx(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).pop()??e}function YM(e,t){return e.startsWith("/")&&!t.startsWith("/")?!0:e.length>t.length}function t0(e){return e.trim()}function Bx(e){return e.trim()}function xv(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function WM(e){return{a({children:t,href:n}){if(!n)return o.jsx(o.Fragment,{children:t});const a=/^[a-z][a-z\d+.-]*:/i.test(n),l=dx(n);if(n.startsWith("seele-public:")&&!l)return o.jsxs("span",{title:"无效的 Seele Public URL 地址",children:[t,"(地址格式无效)"]});const u=!a&&e?KM(n,e):null,c=l?Ae(`deployment/public-link?path=${encodeURIComponent(l)}`):u??n,f=a||!!u;return o.jsx("a",{className:"markdown-link",href:c,rel:f?"noreferrer":void 0,target:f?"_blank":void 0,children:t})},img(){return null},pre({children:t}){const n=ZM(t);return n?Q1(n.language)==="mermaid"?o.jsx(QM,{code:n.code}):o.jsx(tD,{code:n.code,language:n.language}):o.jsx("pre",{children:t})},table({children:t}){return o.jsx("div",{className:"markdown-table-wrap",children:o.jsx("table",{className:"markdown-table",children:t})})},td({align:t,children:n}){return o.jsx("td",{style:bv(t),children:n})},th({align:t,children:n}){return o.jsx("th",{style:bv(t),children:n})}}}function KM(e,t){if(!e||e.startsWith("#")||e.startsWith("/api/")||e.startsWith("?"))return null;const n=IE(e,t.workspacePath);if(!n)return null;const a=n.line?`#L${n.line}${n.column?`C${n.column}`:""}`:"";return`${Ae(`conversations/${t.id}/files?path=${encodeURIComponent(n.path)}`)}${a}`}function bv(e){return e&&e!=="char"?{textAlign:e}:void 0}function Zl(e,t){const n=nA(XM(e));return o.jsx($k,{urlTransform:a=>dx(a)?a:j5(a),components:WM(t),remarkPlugins:[Jj,tA],rehypePlugins:[[OA,{trust:!1,strict:"ignore"}]],skipHtml:!0,children:n})}function XM(e){return e.replace(/([^\n])(```[^\n`]*(?:\r?\n|$))/g,`$1
|
|
384
|
-
$2`)}function ZM(e){var u;const t=E.Children.toArray(e),n=t.length===1&&E.isValidElement(t[0])?t[0]:null;if(!n||n.type!=="code")return null;const l=((u=(n.props.className??"").match(/(?:^|\s)language-([^\s]+)/))==null?void 0:u[1])??"";return{code:a1(n.props.children).replace(/\n$/,""),language:l}}function a1(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(a1).join(""):E.isValidElement(e)?a1(e.props.children):""}const qx="github-light",dp=new Map,fp=new Map;let hp=null,mp=null;const Ux=new Set(["bash","css","diff","dockerfile","html","java","javascript","json","jsonc","jsx","markdown","python","shellscript","sql","toml","tsx","typescript","xml","yaml"]);function Q1(e){const t=e.trim().toLowerCase().replace(/^\./,"");return{bash:"bash",cjs:"javascript",console:"shellscript",htm:"html",js:"javascript",jsx:"jsx",md:"markdown",mjs:"javascript",py:"python",rb:"ruby",shell:"bash",ts:"typescript",tsx:"tsx",yml:"yaml",zsh:"bash"}[t]??t}function Hx(e){const t=Q1(e);return!t||t==="text"||t==="txt"?"text":Ux.has(t)?t:"text"}function QM({code:e}){const n=`seele-mermaid-${E.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,[a,l]=E.useState(!1),[u,c]=E.useState(()=>fp.get(e)??null),[f,h]=E.useState(null);E.useEffect(()=>{let g=!1,y;const k=fp.get(e);return k?(c(k),h(null),()=>{g=!0}):(h(null),c(null),JM(n,e).then(b=>{g||(y!==void 0&&window.clearTimeout(y),fp.set(e,b),c(b),h(null))},b=>{if(!g){const C=b instanceof Error?b.message:String(b);y=window.setTimeout(()=>{g||h(C)},VE)}}),()=>{g=!0,y!==void 0&&window.clearTimeout(y)})},[e,n]);async function m(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:`mermaid-block${f?" error":""}`,children:[o.jsx("span",{className:"code-block-kind",children:"mermaid"}),o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied Mermaid source":"Copy Mermaid source",className:a?"copied":"",onClick:()=>void m(),title:a?"Copied":"Copy",type:"button",children:o.jsx(J1,{})})}),u?o.jsx("div",{className:"mermaid-diagram",dangerouslySetInnerHTML:{__html:u}}):f?o.jsxs("div",{className:"mermaid-error",children:[o.jsx("strong",{children:"Mermaid render failed"}),o.jsx("pre",{children:f}),o.jsx("code",{children:e})]}):o.jsx("div",{className:"mermaid-loading",children:"Rendering diagram..."})]})}async function JM(e,t){return(await(await eD()).render(e,t)).svg}function eD(){return mp||(mp=an(()=>import("./mermaid.core--xzQFgll.js").then(e=>e.bp),[],import.meta.url).then(e=>{const t=e.default;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#f9fafa",primaryBorderColor:"#d8d9e8",primaryTextColor:"#0b0f16",lineColor:"#7a8294",secondaryColor:"#f5f5fb",tertiaryColor:"#ffffff",fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'}}),t})),mp}function tD({code:e,language:t,reserveHeight:n=!1}){const[a,l]=E.useState(!1),[u,c]=E.useState(()=>{if(!Sv(t))return null;const m=kv(e,t);return dp.get(m)??null}),f=n?{"--code-block-min-height":`${rN(e)}px`}:void 0;E.useEffect(()=>{let m=!1;if(!Sv(t))return c(null),()=>{m=!0};const g=kv(e,t),y=dp.get(g);return y?(c(y),()=>{m=!0}):(c(null),oD(e,t).then(k=>{dp.set(g,k),m||c(k)}).catch(k=>{console.warn("Failed to highlight code block",k),m||c(null)}),()=>{m=!0})},[e,t]);async function h(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:"code-block",style:f,children:[t?o.jsx("span",{className:"code-block-kind",children:t}):null,o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied code block":"Copy code block",className:a?"copied":"",onClick:()=>void h(),title:a?"Copied":"Copy",type:"button",children:o.jsx(J1,{})})}),u?o.jsx("div",{className:"code-block-shiki",dangerouslySetInnerHTML:{__html:u}}):o.jsx("pre",{children:o.jsx("code",{children:e})})]})}function J1(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("rect",{height:"14",rx:"2",stroke:"currentColor",strokeWidth:"2",width:"14",x:"8",y:"8"}),o.jsx("path",{d:"M4 16V6a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function $x(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 24 24",width:"16",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"18",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M6 7v1a6 6 0 0 0 6 6v3M18 7v1a6 6 0 0 1-6 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function eg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"12",viewBox:"0 0 24 24",width:"12",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.2"}),o.jsx("path",{d:"M12 7v6",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"}),o.jsx("circle",{cx:"12",cy:"17",fill:"currentColor",r:"1.25"})]})}function nD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 24 24",width:"18",children:o.jsx("path",{d:"M4 7h16M4 12h16M4 17h16",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})}function rD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M7 7h10M7 12h10M7 17h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"4",cy:"7",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"12",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"17",fill:"currentColor",r:"1.4"})]})}function wv(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M19 12a7.8 7.8 0 0 0-.1-1l2-1.5-2-3.4-2.4 1a8 8 0 0 0-1.8-1l-.3-2.6h-4l-.3 2.6a8 8 0 0 0-1.8 1l-2.4-1-2 3.4 2 1.5a7.8 7.8 0 0 0 0 2l-2 1.5 2 3.4 2.4-1a8 8 0 0 0 1.8 1l.3 2.6h4l.3-2.6a8 8 0 0 0 1.8-1l2.4 1 2-3.4-2-1.5c.1-.3.1-.7.1-1Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.7"})]})}function aD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("rect",{height:"16",rx:"2.6",stroke:"currentColor",strokeWidth:"1.8",width:"18",x:"3",y:"4"}),o.jsx("path",{d:"m7 9 3 3-3 3M12.5 15h4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})]})}function Xd(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"17",viewBox:"0 0 24 24",width:"17",children:[o.jsx("circle",{cx:"7",cy:"12",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("path",{d:"m9.2 10.9 5.6-2.8M9.2 13.1l5.6 2.8",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})]})}function Lf(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("path",{d:"m4 16-.8 4 4-.8L18.4 8 15.2 4.8 4 16Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("path",{d:"m13.8 6.2 3.2 3.2",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function iD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:o.jsx("path",{d:"M5 8v11h14V8M4 4h16v4H4zM9 12h6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function lD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function sD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M3 3l18 18",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("path",{d:"M9.9 5.4A9.8 9.8 0 0 1 12 5c6 0 9.5 7 9.5 7a15.5 15.5 0 0 1-3 3.8M6.2 6.8C3.8 8.4 2.5 12 2.5 12s3.5 7 9.5 7a9.7 9.7 0 0 0 4-.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function kv(e,t){return`${qx}:${Hx(t)}:${e}`}function Sv(e){const t=Q1(e);return!!t&&Ux.has(t)}async function oD(e,t){return(await uD()).codeToHtml(e,{lang:Hx(t),theme:qx})}function uD(){return hp||(hp=cD()),hp}async function cD(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t},{default:n},{default:a},{default:l},{default:u},{default:c},{default:f},{default:h},{default:m},{default:g},{default:y},{default:k},{default:b},{default:C},{default:D},{default:_},{default:z},{default:N},{default:q},{default:B},{default:K}]=await Promise.all([an(()=>import("./core-DWyZ49Ti.js"),[],import.meta.url),an(()=>import("./engine-javascript-DBd1bXLz.js"),[],import.meta.url),an(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),an(()=>import("./bash-BELqPA7S.js").then(G=>G.b),[],import.meta.url),an(()=>import("./css-CLj8gQPS.js"),[],import.meta.url),an(()=>import("./diff-D97Zzqfu.js"),[],import.meta.url),an(()=>import("./dockerfile-BcOcwvcX.js"),[],import.meta.url),an(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2]),import.meta.url),an(()=>import("./java-CylS5w8V.js"),[],import.meta.url),an(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),an(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),an(()=>import("./jsonc-Des-eS-w.js"),[],import.meta.url),an(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),an(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),an(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),an(()=>import("./bash-BELqPA7S.js").then(G=>G.s),[],import.meta.url),an(()=>import("./sql-CRqJ_cUM.js"),[],import.meta.url),an(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),an(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),an(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),an(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([3,4]),import.meta.url),an(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url)]);return e({engine:t(),themes:[n],langs:[a,l,u,c,f,h,m,g,y,k,b,C,D,_,z,N,q,B,K]})}async function jv(){const e=Ae("conversations"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).conversations}async function dD(){const e=Ae("workspace-states"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).workspaces}async function Cv(){const e=Ae("collaboration/topics"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).topics}async function Hd(e){const t=Ae(`collaboration/topics/${e}/messages?limit=100`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).messages}async function fD(e){const t=Ae("collaboration/topics"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"POST",url:t}),(await n.json()).topic}async function hD(e,t){const n=Ae(`collaboration/topics/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PATCH",url:n}),(await a.json()).topic}async function mD(e,t){const n=Ae(`collaboration/topics/${e}/archive`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedVersion:t})});return await Ge(a,{method:"POST",url:n}),(await a.json()).topic}async function pD(e){const t=Ae(`conversations/${e}/read`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t})}async function Tv(){const e=Ae("workspace-groups"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).groups}async function gD(e){const t=Ae("workspace-groups"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e})});return await Ge(n,{method:"POST",url:t}),(await n.json()).group}async function yD(e,t){const n=Ae(`workspace-groups/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PATCH",url:n}),(await a.json()).group}async function vD(e){const t=Ae(`workspace-groups/${e}`),n=await fetch(t,{method:"DELETE"});return await Ge(n,{method:"DELETE",url:t}),await n.json()}async function xD(){const e=Ae("settings/environment"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).variables}async function bD(e){const t=Ae(`conversations/${e}/settings/environment`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).variables}async function wD(e){const t=Ae(`conversations/${e}/knowledge`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).items}async function kD(){const e=Ae("settings/model-providers"),t=await fetch(e);return await Ge(t,{url:e}),t.json()}async function SD(){const e=Ae("settings/model-providers/options"),t=await fetch(e);return await Ge(t,{url:e}),t.json()}async function jD(e){const t=Ae(`settings/model-providers/${encodeURIComponent(e)}/balance`),n=await fetch(t);return await Ge(n,{url:t}),n.json()}async function CD(e){const t=Ae("settings/model-providers"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{url:t,method:"PUT"}),n.json()}async function TD(){const e=Ae("settings/runtime"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).settings}async function AD(){const e=Ae("settings/deployment"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).settings}async function ED(){const e=Ae("diagnostics"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function ND(){const e=Ae("settings/runtime/codex"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function Zd(){const e=Ae("settings/runtime/accounts"),t=await fetch(e);await Ge(t,{url:e});const n=await t.json();return Qs(),n}async function Av(e=!1){const t=Ae(`settings/runtime/accounts/refresh${e?"?force=1":""}`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t});const a=await n.json();return Qs(),a}async function MD(e){const t=Ae("settings/runtime/accounts"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});await Ge(n,{method:"POST",url:t});const a=await n.json();return a.login.status==="succeeded"&&Qs(),a.login}async function DD(e){const t=Ae(`settings/runtime/accounts/login/${e}`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).login}async function zD(e){const t=Ae(`settings/runtime/accounts/login/${e}/cancel`),n=await fetch(t,{method:"POST"});return await Ge(n,{method:"POST",url:t}),(await n.json()).login}async function RD(e,t,n){const a=Ae(`settings/runtime/accounts/${e}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,renewalDay:n})});await Ge(l,{method:"PATCH",url:a});const u=await l.json();return Qs(),u.account}async function OD(e){const t=Ae(`settings/runtime/accounts/${e}`),n=await fetch(t,{method:"DELETE"});await Ge(n,{method:"DELETE",url:t}),Qs()}async function ID(e){const t=Ae(`settings/runtime/accounts/${e}/switch`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t});const a=await n.json();return Qs(),a}async function _D(e=!0){const t=Ae(`settings/runtime/models?refresh=${e?"1":"0"}`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function LD(e=!1){const t=Ae(`settings/runtime/codex/update${e?"?refreshLatest=1":""}`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function BD(){const e=Ae("settings/runtime/codex/update"),t=await fetch(e,{method:"POST"});return await Ge(t,{method:"POST",url:e}),(await t.json()).job}async function qD(e){const t=Ae(`conversations/${e}/settings/runtime`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).settings}async function UD(){const e=Ae("settings/memory"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function HD(e){const t=Ae("settings/runtime"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"PUT",url:t}),(await n.json()).settings}async function $D(e){const t=Ae("settings/deployment"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"PUT",url:t}),(await n.json()).settings}async function Ev(e,t){const n=Ae(`conversations/${e}/settings/runtime`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PUT",url:n}),await a.json()}async function Nv(e,t){const n=Ae(`conversations/${e}/runtime/reset`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"POST",url:n}),(await a.json()).job}async function Mv(e){const t=Ae(`conversations/${e}/runtime/reset-preview`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function FD(e,t){const n=Ae(`conversations/${e}/runtime/reset-selection`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await Ge(a,{method:"PUT",url:n})}async function PD(e){const t=Ae(`conversations/${e}/runtime/thread-read`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).result}async function GD(e){const t=Ae(`conversations/${e}/runtime/token-usage`),n=await fetch(t);await Ge(n,{url:t});const a=await n.json();return a.event?tb(a.event):null}async function VD(e){const t=Ae(`conversations/${e}/runtime/additional-context`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function YD(e){const t=Ae(`conversations/${e}/runtime/compactions`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).compactions}function WD(e,t,n){return{modelSource:ix(e.modelSource,t.modelSource)&&(n==null?void 0:n.sources.modelSource)!=="workspace"?null:e.modelSource??{type:"codex"},model:e.model===t.model?null:e.model,reasoningEffort:gE(e.reasoningEffort,t.reasoningEffort,(n==null?void 0:n.sources.reasoningEffort)==="workspace"),fastMode:e.fastMode===t.fastMode?null:e.fastMode,sandbox:e.sandbox===t.sandbox?null:e.sandbox}}function KD(e){return{kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceClues:ZD(e.sourceCluesText),requiredEnv:QD(e.requiredEnvText)}}function XD(e){return{id:e.id,kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceCluesText:e.sourceClues.map(t=>`${t.type}: ${t.value}`).join(`
|
|
384
|
+
$2`)}function ZM(e){var u;const t=E.Children.toArray(e),n=t.length===1&&E.isValidElement(t[0])?t[0]:null;if(!n||n.type!=="code")return null;const l=((u=(n.props.className??"").match(/(?:^|\s)language-([^\s]+)/))==null?void 0:u[1])??"";return{code:a1(n.props.children).replace(/\n$/,""),language:l}}function a1(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(a1).join(""):E.isValidElement(e)?a1(e.props.children):""}const qx="github-light",dp=new Map,fp=new Map;let hp=null,mp=null;const Ux=new Set(["bash","css","diff","dockerfile","html","java","javascript","json","jsonc","jsx","markdown","python","shellscript","sql","toml","tsx","typescript","xml","yaml"]);function Q1(e){const t=e.trim().toLowerCase().replace(/^\./,"");return{bash:"bash",cjs:"javascript",console:"shellscript",htm:"html",js:"javascript",jsx:"jsx",md:"markdown",mjs:"javascript",py:"python",rb:"ruby",shell:"bash",ts:"typescript",tsx:"tsx",yml:"yaml",zsh:"bash"}[t]??t}function Hx(e){const t=Q1(e);return!t||t==="text"||t==="txt"?"text":Ux.has(t)?t:"text"}function QM({code:e}){const n=`seele-mermaid-${E.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,[a,l]=E.useState(!1),[u,c]=E.useState(()=>fp.get(e)??null),[f,h]=E.useState(null);E.useEffect(()=>{let g=!1,y;const k=fp.get(e);return k?(c(k),h(null),()=>{g=!0}):(h(null),c(null),JM(n,e).then(b=>{g||(y!==void 0&&window.clearTimeout(y),fp.set(e,b),c(b),h(null))},b=>{if(!g){const C=b instanceof Error?b.message:String(b);y=window.setTimeout(()=>{g||h(C)},VE)}}),()=>{g=!0,y!==void 0&&window.clearTimeout(y)})},[e,n]);async function m(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:`mermaid-block${f?" error":""}`,children:[o.jsx("span",{className:"code-block-kind",children:"mermaid"}),o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied Mermaid source":"Copy Mermaid source",className:a?"copied":"",onClick:()=>void m(),title:a?"Copied":"Copy",type:"button",children:o.jsx(J1,{})})}),u?o.jsx("div",{className:"mermaid-diagram",dangerouslySetInnerHTML:{__html:u}}):f?o.jsxs("div",{className:"mermaid-error",children:[o.jsx("strong",{children:"Mermaid render failed"}),o.jsx("pre",{children:f}),o.jsx("code",{children:e})]}):o.jsx("div",{className:"mermaid-loading",children:"Rendering diagram..."})]})}async function JM(e,t){return(await(await eD()).render(e,t)).svg}function eD(){return mp||(mp=an(()=>import("./mermaid.core-DjDkv1TP.js").then(e=>e.bp),[],import.meta.url).then(e=>{const t=e.default;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#f9fafa",primaryBorderColor:"#d8d9e8",primaryTextColor:"#0b0f16",lineColor:"#7a8294",secondaryColor:"#f5f5fb",tertiaryColor:"#ffffff",fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'}}),t})),mp}function tD({code:e,language:t,reserveHeight:n=!1}){const[a,l]=E.useState(!1),[u,c]=E.useState(()=>{if(!Sv(t))return null;const m=kv(e,t);return dp.get(m)??null}),f=n?{"--code-block-min-height":`${rN(e)}px`}:void 0;E.useEffect(()=>{let m=!1;if(!Sv(t))return c(null),()=>{m=!0};const g=kv(e,t),y=dp.get(g);return y?(c(y),()=>{m=!0}):(c(null),oD(e,t).then(k=>{dp.set(g,k),m||c(k)}).catch(k=>{console.warn("Failed to highlight code block",k),m||c(null)}),()=>{m=!0})},[e,t]);async function h(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:"code-block",style:f,children:[t?o.jsx("span",{className:"code-block-kind",children:t}):null,o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied code block":"Copy code block",className:a?"copied":"",onClick:()=>void h(),title:a?"Copied":"Copy",type:"button",children:o.jsx(J1,{})})}),u?o.jsx("div",{className:"code-block-shiki",dangerouslySetInnerHTML:{__html:u}}):o.jsx("pre",{children:o.jsx("code",{children:e})})]})}function J1(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("rect",{height:"14",rx:"2",stroke:"currentColor",strokeWidth:"2",width:"14",x:"8",y:"8"}),o.jsx("path",{d:"M4 16V6a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function $x(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 24 24",width:"16",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"18",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M6 7v1a6 6 0 0 0 6 6v3M18 7v1a6 6 0 0 1-6 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function eg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"12",viewBox:"0 0 24 24",width:"12",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.2"}),o.jsx("path",{d:"M12 7v6",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"}),o.jsx("circle",{cx:"12",cy:"17",fill:"currentColor",r:"1.25"})]})}function nD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 24 24",width:"18",children:o.jsx("path",{d:"M4 7h16M4 12h16M4 17h16",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})}function rD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M7 7h10M7 12h10M7 17h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"4",cy:"7",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"12",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"17",fill:"currentColor",r:"1.4"})]})}function wv(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M19 12a7.8 7.8 0 0 0-.1-1l2-1.5-2-3.4-2.4 1a8 8 0 0 0-1.8-1l-.3-2.6h-4l-.3 2.6a8 8 0 0 0-1.8 1l-2.4-1-2 3.4 2 1.5a7.8 7.8 0 0 0 0 2l-2 1.5 2 3.4 2.4-1a8 8 0 0 0 1.8 1l.3 2.6h4l.3-2.6a8 8 0 0 0 1.8-1l2.4 1 2-3.4-2-1.5c.1-.3.1-.7.1-1Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.7"})]})}function aD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("rect",{height:"16",rx:"2.6",stroke:"currentColor",strokeWidth:"1.8",width:"18",x:"3",y:"4"}),o.jsx("path",{d:"m7 9 3 3-3 3M12.5 15h4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})]})}function Xd(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"17",viewBox:"0 0 24 24",width:"17",children:[o.jsx("circle",{cx:"7",cy:"12",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("path",{d:"m9.2 10.9 5.6-2.8M9.2 13.1l5.6 2.8",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})]})}function Lf(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("path",{d:"m4 16-.8 4 4-.8L18.4 8 15.2 4.8 4 16Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("path",{d:"m13.8 6.2 3.2 3.2",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function iD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:o.jsx("path",{d:"M5 8v11h14V8M4 4h16v4H4zM9 12h6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function lD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function sD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M3 3l18 18",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("path",{d:"M9.9 5.4A9.8 9.8 0 0 1 12 5c6 0 9.5 7 9.5 7a15.5 15.5 0 0 1-3 3.8M6.2 6.8C3.8 8.4 2.5 12 2.5 12s3.5 7 9.5 7a9.7 9.7 0 0 0 4-.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function kv(e,t){return`${qx}:${Hx(t)}:${e}`}function Sv(e){const t=Q1(e);return!!t&&Ux.has(t)}async function oD(e,t){return(await uD()).codeToHtml(e,{lang:Hx(t),theme:qx})}function uD(){return hp||(hp=cD()),hp}async function cD(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t},{default:n},{default:a},{default:l},{default:u},{default:c},{default:f},{default:h},{default:m},{default:g},{default:y},{default:k},{default:b},{default:C},{default:D},{default:_},{default:z},{default:N},{default:q},{default:B},{default:K}]=await Promise.all([an(()=>import("./core-CRtYwguc.js"),[],import.meta.url),an(()=>import("./engine-javascript-DBd1bXLz.js"),[],import.meta.url),an(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),an(()=>import("./bash-BELqPA7S.js").then(G=>G.b),[],import.meta.url),an(()=>import("./css-CLj8gQPS.js"),[],import.meta.url),an(()=>import("./diff-D97Zzqfu.js"),[],import.meta.url),an(()=>import("./dockerfile-BcOcwvcX.js"),[],import.meta.url),an(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2]),import.meta.url),an(()=>import("./java-CylS5w8V.js"),[],import.meta.url),an(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),an(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),an(()=>import("./jsonc-Des-eS-w.js"),[],import.meta.url),an(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),an(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),an(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),an(()=>import("./bash-BELqPA7S.js").then(G=>G.s),[],import.meta.url),an(()=>import("./sql-CRqJ_cUM.js"),[],import.meta.url),an(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),an(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),an(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),an(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([3,4]),import.meta.url),an(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url)]);return e({engine:t(),themes:[n],langs:[a,l,u,c,f,h,m,g,y,k,b,C,D,_,z,N,q,B,K]})}async function jv(){const e=Ae("conversations"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).conversations}async function dD(){const e=Ae("workspace-states"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).workspaces}async function Cv(){const e=Ae("collaboration/topics"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).topics}async function Hd(e){const t=Ae(`collaboration/topics/${e}/messages?limit=100`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).messages}async function fD(e){const t=Ae("collaboration/topics"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"POST",url:t}),(await n.json()).topic}async function hD(e,t){const n=Ae(`collaboration/topics/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PATCH",url:n}),(await a.json()).topic}async function mD(e,t){const n=Ae(`collaboration/topics/${e}/archive`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedVersion:t})});return await Ge(a,{method:"POST",url:n}),(await a.json()).topic}async function pD(e){const t=Ae(`conversations/${e}/read`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t})}async function Tv(){const e=Ae("workspace-groups"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).groups}async function gD(e){const t=Ae("workspace-groups"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e})});return await Ge(n,{method:"POST",url:t}),(await n.json()).group}async function yD(e,t){const n=Ae(`workspace-groups/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PATCH",url:n}),(await a.json()).group}async function vD(e){const t=Ae(`workspace-groups/${e}`),n=await fetch(t,{method:"DELETE"});return await Ge(n,{method:"DELETE",url:t}),await n.json()}async function xD(){const e=Ae("settings/environment"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).variables}async function bD(e){const t=Ae(`conversations/${e}/settings/environment`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).variables}async function wD(e){const t=Ae(`conversations/${e}/knowledge`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).items}async function kD(){const e=Ae("settings/model-providers"),t=await fetch(e);return await Ge(t,{url:e}),t.json()}async function SD(){const e=Ae("settings/model-providers/options"),t=await fetch(e);return await Ge(t,{url:e}),t.json()}async function jD(e){const t=Ae(`settings/model-providers/${encodeURIComponent(e)}/balance`),n=await fetch(t);return await Ge(n,{url:t}),n.json()}async function CD(e){const t=Ae("settings/model-providers"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{url:t,method:"PUT"}),n.json()}async function TD(){const e=Ae("settings/runtime"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).settings}async function AD(){const e=Ae("settings/deployment"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).settings}async function ED(){const e=Ae("diagnostics"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function ND(){const e=Ae("settings/runtime/codex"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function Zd(){const e=Ae("settings/runtime/accounts"),t=await fetch(e);await Ge(t,{url:e});const n=await t.json();return Qs(),n}async function Av(e=!1){const t=Ae(`settings/runtime/accounts/refresh${e?"?force=1":""}`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t});const a=await n.json();return Qs(),a}async function MD(e){const t=Ae("settings/runtime/accounts"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});await Ge(n,{method:"POST",url:t});const a=await n.json();return a.login.status==="succeeded"&&Qs(),a.login}async function DD(e){const t=Ae(`settings/runtime/accounts/login/${e}`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).login}async function zD(e){const t=Ae(`settings/runtime/accounts/login/${e}/cancel`),n=await fetch(t,{method:"POST"});return await Ge(n,{method:"POST",url:t}),(await n.json()).login}async function RD(e,t,n){const a=Ae(`settings/runtime/accounts/${e}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,renewalDay:n})});await Ge(l,{method:"PATCH",url:a});const u=await l.json();return Qs(),u.account}async function OD(e){const t=Ae(`settings/runtime/accounts/${e}`),n=await fetch(t,{method:"DELETE"});await Ge(n,{method:"DELETE",url:t}),Qs()}async function ID(e){const t=Ae(`settings/runtime/accounts/${e}/switch`),n=await fetch(t,{method:"POST"});await Ge(n,{method:"POST",url:t});const a=await n.json();return Qs(),a}async function _D(e=!0){const t=Ae(`settings/runtime/models?refresh=${e?"1":"0"}`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function LD(e=!1){const t=Ae(`settings/runtime/codex/update${e?"?refreshLatest=1":""}`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function BD(){const e=Ae("settings/runtime/codex/update"),t=await fetch(e,{method:"POST"});return await Ge(t,{method:"POST",url:e}),(await t.json()).job}async function qD(e){const t=Ae(`conversations/${e}/settings/runtime`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).settings}async function UD(){const e=Ae("settings/memory"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function HD(e){const t=Ae("settings/runtime"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"PUT",url:t}),(await n.json()).settings}async function $D(e){const t=Ae("settings/deployment"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"PUT",url:t}),(await n.json()).settings}async function Ev(e,t){const n=Ae(`conversations/${e}/settings/runtime`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PUT",url:n}),await a.json()}async function Nv(e,t){const n=Ae(`conversations/${e}/runtime/reset`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"POST",url:n}),(await a.json()).job}async function Mv(e){const t=Ae(`conversations/${e}/runtime/reset-preview`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function FD(e,t){const n=Ae(`conversations/${e}/runtime/reset-selection`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await Ge(a,{method:"PUT",url:n})}async function PD(e){const t=Ae(`conversations/${e}/runtime/thread-read`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).result}async function GD(e){const t=Ae(`conversations/${e}/runtime/token-usage`),n=await fetch(t);await Ge(n,{url:t});const a=await n.json();return a.event?tb(a.event):null}async function VD(e){const t=Ae(`conversations/${e}/runtime/additional-context`),n=await fetch(t);return await Ge(n,{url:t}),await n.json()}async function YD(e){const t=Ae(`conversations/${e}/runtime/compactions`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).compactions}function WD(e,t,n){return{modelSource:ix(e.modelSource,t.modelSource)&&(n==null?void 0:n.sources.modelSource)!=="workspace"?null:e.modelSource??{type:"codex"},model:e.model===t.model?null:e.model,reasoningEffort:gE(e.reasoningEffort,t.reasoningEffort,(n==null?void 0:n.sources.reasoningEffort)==="workspace"),fastMode:e.fastMode===t.fastMode?null:e.fastMode,sandbox:e.sandbox===t.sandbox?null:e.sandbox}}function KD(e){return{kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceClues:ZD(e.sourceCluesText),requiredEnv:QD(e.requiredEnvText)}}function XD(e){return{id:e.id,kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceCluesText:e.sourceClues.map(t=>`${t.type}: ${t.value}`).join(`
|
|
385
385
|
`),requiredEnvText:e.fetch.requiredEnv.map(t=>t.description?`${t.key} - ${t.description}`:t.key).join(`
|
|
386
386
|
`)}}function ZD(e){const t=new Date().toISOString();return e.split(/\r?\n/).map(n=>n.trim()).filter(Boolean).map(n=>{const a=n.match(/^([a-zA-Z][\w-]{0,31})\s*:\s*(.+)$/);return{type:a?a[1].toLowerCase():"text",value:a?a[2].trim():n,providedBy:"user",providedAt:t}})}function QD(e){return e.split(/\r?\n/).map(t=>t.trim()).filter(Boolean).map(t=>{const[n,...a]=t.split(/\s+-\s+/);return{key:n.trim().toUpperCase(),description:a.join(" - ").trim()}}).filter(t=>/^[A-Z_][A-Z0-9_]*$/.test(t.key))}function Dv(e,t){const n=zv(t.attention)-zv(e.attention);return n!==0?n:t.updatedAt.localeCompare(e.updatedAt)}function zv(e){return e==="watch"?2:e==="tracked"?1:0}function Wc(e){return e.map(t=>({key:t.key??"",value:t.value??"",updatedAt:t.updatedAt}))}function JD(e){return e?/^[a-z_][a-z0-9_.-]*$/.test(e)?null:"Key must start with a lowercase English letter or underscore, and may contain lowercase letters, numbers, dots, underscores, and hyphens.":"Key is required."}function ez(e){return Wc(e).filter(t=>t.key.trim()&&t.value.trim()).map(t=>`${t.key.trim()}: ${t.value.trim()}`).join(`
|
|
387
387
|
`)}async function tz(e){const t=Ae("settings/memory"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Ge(n,{method:"PUT",url:t}),await n.json()}async function nz(e,t,n){const a=Ae("settings/environment"),l=await fetch(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n,key:e,value:t})});return await Ge(l,{method:"PUT",url:a}),(await l.json()).variable}async function rz(e,t,n,a){const l=Ae(`conversations/${e}/settings/environment`),u=await fetch(l,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:a,key:t,value:n})});return await Ge(u,{method:"PUT",url:l}),await u.json()}async function az(e){const t=Ae(`settings/environment/${encodeURIComponent(e)}/reveal`),n=await fetch(t);return await Ge(n,{url:t}),(await n.json()).variable.value}async function iz(e,t){const n=Ae(`conversations/${e}/settings/environment/${encodeURIComponent(t)}/reveal`),a=await fetch(n);return await Ge(a,{url:n}),(await a.json()).variable.value}async function lz(e){const t=Ae(`settings/environment/${encodeURIComponent(e)}`),n=await fetch(t,{method:"DELETE"});await Ge(n,{method:"DELETE",url:t})}async function sz(e,t){const n=Ae(`conversations/${e}/settings/environment/${encodeURIComponent(t)}`),a=await fetch(n,{method:"DELETE"});return await Ge(a,{method:"DELETE",url:n}),(await a.json()).conversation}async function oz(e,t){const n=Ae(`conversations/${e}/knowledge`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"POST",url:n}),(await a.json()).item}async function uz(e,t,n){const a=Ae(`conversations/${e}/knowledge/${encodeURIComponent(t)}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await Ge(l,{method:"PATCH",url:a}),(await l.json()).item}async function cz(e,t){const n=Ae(`conversations/${e}/knowledge/${encodeURIComponent(t)}`),a=await fetch(n,{method:"DELETE"});await Ge(a,{method:"DELETE",url:n})}async function dz(){const e=Ae("meta"),t=await fetch(e);return await Ge(t,{url:e}),await t.json()}async function fz(){const e=Ae("settings/runtime/rate-limits"),t=await fetch(e);return await Ge(t,{url:e}),(await t.json()).usage??null}async function hz(e,t){const n=Ae("conversations"),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e,groupId:t})});return await Ge(a,{method:"POST",url:n}),(await a.json()).conversation}function mz(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}async function pz(e,t,n,a,l){const u=Ae(`conversations/${e}/clone`),c=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,groupId:n,excludeTopicHistory:a,requestId:l})});return await Ge(c,{method:"POST",url:u}),await c.json()}async function gz(e){const t=Ae(`conversations/${e}/clone/retry`),n=await fetch(t,{method:"POST"});return await Ge(n,{method:"POST",url:t}),await n.json()}async function au(e,t={}){const n=new URLSearchParams;n.set("limit",String(t.limit??hx)),t.before&&n.set("before",t.before);const a=Ae(`conversations/${e}?${n}`),l=await fetch(a);return await Ge(l,{url:a}),(await l.json()).conversation}async function Fx(e,t){const n=Ae(`conversations/${e}/turns/${t}/history-events`),a=await fetch(n);return await Ge(a,{url:n}),(await a.json()).events}async function $d(e,t){const n=Ae(`conversations/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Ge(a,{method:"PATCH",url:n}),(await a.json()).conversation}async function yz(e){const t=Ae(`conversations/${e}`),n=await fetch(t,{method:"DELETE"});await Ge(n,{method:"DELETE",url:t})}function vz(e){return e.title==="Phase boundary recommended"||e.title==="Long run in progress"}function Px(e){return e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} +${e.length-3}`}function xz(e,t){if(e.event==="server.error"||e.event==="client.error")return{id:e.id,kind:"error",title:"Error",body:Lz(e.data),createdAt:e.createdAt??new Date().toISOString()};if(e.event==="server.collaboration.message_staged"||e.event==="server.collaboration.message_sent"||e.event==="server.collaboration.message_rejected"){const u=$e(e.data),c=Je(u.toolCallId),f=typeof u.controlIndex=="number"?u.controlIndex:null;if(c||f!==null){const h=e.event==="server.collaboration.message_staged",m=e.event==="server.collaboration.message_sent",g=Je(u.audience),y=Je(u.recipientWorkspaceId),k=y?[y]:Array.isArray(u.recipientWorkspaceIds)?u.recipientWorkspaceIds.filter(_=>typeof _=="string"):Array.isArray(u.recipients)?u.recipients.filter(_=>typeof _=="string"):[],b=k.filter(_=>_!=="ALL").map(_=>t.get(_)).filter(_=>!!_);let C="Topic";b.length>0?C=Px(b):k.length===1?C=k[0]==="ALL"?"Topic participants":Jl(k[0]):k.length>1?C=`${k.length} workspaces`:g==="public"||g==="all"?C="Topic participants":g==="owner"&&(C="Topic owner");const D=Je(u.topicId);return{id:e.id,kind:"collaboration",title:`Send to ${C}`,body:D?`Topic ${Jl(D)}`:"Topic",createdAt:e.createdAt??new Date().toISOString(),itemId:c||`legacy-topic-message:${f}`,meta:h?"pending send":m?"done":"failed",output:h||m?Je(u.contentMarkdown)||void 0:Je(u.reason)||void 0,topicAction:"send",topicRecipientLabel:C,topicMessageContent:(h||m)&&Je(u.contentMarkdown)||void 0}}}if(e.event==="codex.input_request"||e.event==="codex.input_or_approval_request"){const u=$e(e.data);if(e.event==="codex.input_request"||u.method==="item/tool/requestUserInput"){const c=$e(u.params),h=(Array.isArray(c.questions)?c.questions:[]).map(m=>{const g=$e(m),y=typeof g.question=="string"?g.question:"Please provide the missing information.",k=Array.isArray(g.options)?g.options.map(b=>{const C=$e(b);return typeof C.label=="string"?`- ${C.label}${typeof C.description=="string"?`: ${C.description}`:""}`:""}).filter(Boolean).join(`
|
package/web/dist/assets/{infoDiagram-FWYZ7A6U-DzTy9QwI.js → infoDiagram-FWYZ7A6U-COvgMXzz.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
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-DjDkv1TP.js";import{p as g}from"./cynefin-VYW2F7L2-Cu5a6hsJ.js";import"./index-keWFGz-g.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as o,c as ot,a1 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,a1 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-DjDkv1TP.js";import"./index-keWFGz-g.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={},X,V,et,Y;;){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="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
3
|
Expecting `+Y.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:Y})}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()+`
|
package/web/dist/assets/{journeyDiagram-5HDEW3XC-BPf4l3LC.js → journeyDiagram-5HDEW3XC-B6CLZv4f.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./chunk-5VM5RSS4-
|
|
1
|
+
import{g as gt}from"./chunk-5VM5RSS4-D1gRFZYR.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-32BRIVSS-DYoaYDqg.js";import{g as _t,s as vt,a as bt,b as wt,o as Tt,n as St,_ as s,c as R,d as X,e as $t,p as Mt}from"./mermaid.core-DjDkv1TP.js";import{d as it}from"./arc-C6DyM-Gl.js";import"./index-keWFGz-g.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,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:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=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),l.length-1&&(this.yylineno-=l.length-1);var d=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:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(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:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as c,l as te,c as W,D as fe,af as ye,ag as be,ah as me,ad as _e,B as K,i as G,Y as ke,Z as Ee,aa as Se,ab as le,ac as ce}from"./mermaid.core
|
|
1
|
+
import{_ as c,l as te,c as W,D as fe,af as ye,ag as be,ah as me,ad as _e,B as K,i as G,Y as ke,Z as Ee,aa as Se,ab as le,ac as ce}from"./mermaid.core-DjDkv1TP.js";import{g as Ne}from"./chunk-5VM5RSS4-D1gRFZYR.js";import"./index-keWFGz-g.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],M=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],U=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],B={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},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,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,V){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:M}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:U,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:M}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:U,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],V=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Z=m.yylloc;e.push(Z);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,q,F={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=V[R]&&V[R][E]),typeof v>"u"||!v.length||!v[0]){var Q="";Y=[];for(X in V[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");m.showPosition?Q="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+Y.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Q="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Q,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Z,expected:Y})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,Z=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof q<"u")return q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=V[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,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:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=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),a.length-1&&(this.yylineno-=a.length-1);var u=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:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(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:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core
|
|
1
|
+
import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core-DjDkv1TP.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=N(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=N(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function N(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function d(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=d(u,e),f=t(a,f)):(e=d(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=d(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=N,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
|