@seqyuan/annovibe 0.8.116 → 0.8.117
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +10 -10
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/runtime/route.js +1 -1
- package/.next/server/app/api/internal/runtime/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/page.js +5 -5
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke.html +1 -1
- package/.next/server/app/smoke.rsc +1 -1
- package/.next/server/app/smoke.segments/_full.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_head.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_index.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/smoke/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/smoke.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +10 -10
- package/.next/server/chunks/1494.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/{page-ee4dab99ca5f71cb.js → page-a74120967e734f3c.js} +3 -3
- package/package.json +1 -1
- /package/.next/static/{hQTnz6QdxSVUqvmtyqdvk → ecITilT-OsECM8-4m-CTu}/_buildManifest.js +0 -0
- /package/.next/static/{hQTnz6QdxSVUqvmtyqdvk → ecITilT-OsECM8-4m-CTu}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
exports.id=1494,exports.ids=[1494],exports.modules={129:(a,b,c)=>{"use strict";c.d(b,{O7:()=>q,eR:()=>r,qb:()=>s,qn:()=>n,h5:()=>l,Xz:()=>o,Ln:()=>p});var d=c(48249),e=c(67484);function f({imageData:a,mimeType:b,width:c,height:g,replayToken:h,saveTargetKind:i,saveDefaults:j}){let[k,l]=(0,e.useState)(j??{format:"pdf",dpi:300,width:800,height:600}),[m,n]=(0,e.useState)(k.format),[o,p]=(0,e.useState)(k.dpi),[q,r]=(0,e.useState)(k.width),[s,t]=(0,e.useState)(k.height),[u,v]=(0,e.useState)("idle"),[w,x]=(0,e.useState)(null),y=h&&"object"===i,z=async()=>{if(h){v("saving"),x(null);try{let a=await fetch("/api/plot-kernels/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({replayToken:h,format:m,dpi:o,width:q,height:s})});if(410===a.status)return void v("expired");if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error??`HTTP ${a.status}`)}v("saved")}catch(a){v("error"),x(a instanceof Error?a.message:String(a))}}};return(0,d.jsxs)("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%"},children:[(0,d.jsx)("img",{src:`data:${b};base64,${a}`,alt:"rendered plot",style:{maxWidth:"100%",height:"auto",borderRadius:6,border:"1px solid var(--border)"},width:c??void 0,height:g??void 0}),y&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"rgba(0,0,0,0.65)",padding:"6px 10px",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",borderRadius:"0 0 6px 6px",fontSize:11,color:"#e5e7eb",opacity:0,transition:"opacity 0.15s"},className:"workbench-save-bar",onMouseEnter:a=>{a.currentTarget.style.opacity="1"},children:["saved"===u?(0,d.jsx)("span",{style:{color:"#34d399",fontWeight:600},children:"✓ Saved"}):"expired"===u?(0,d.jsx)("span",{style:{color:"#fbbf24"},children:"Save session expired. Re-render plot."}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("select",{value:m,onChange:a=>n(a.target.value),style:{background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4,padding:"2px 4px",fontSize:11,height:24},children:[(0,d.jsx)("option",{value:"pdf",children:"PDF"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"svg",children:"SVG"})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["DPI",(0,d.jsx)("input",{type:"number",value:o,onChange:a=>p(Number(a.target.value)||300),min:72,max:1200,style:{width:50,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["W",(0,d.jsx)("input",{type:"number",value:q,onChange:a=>r(Number(a.target.value)||800),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["H",(0,d.jsx)("input",{type:"number",value:s,onChange:a=>t(Number(a.target.value)||600),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsx)("button",{type:"button",onClick:z,disabled:"saving"===u,style:{height:24,padding:"0 12px",borderRadius:4,background:"rgba(37,99,235,0.4)",border:"1px solid rgba(37,99,235,0.6)",color:"#fff",cursor:"pointer",fontSize:11,fontWeight:600,opacity:"saving"===u?.6:1},children:"saving"===u?"Saving...":"Save"})]}),"error"===u&&w&&(0,d.jsx)("span",{style:{color:"#f87171",marginLeft:4},children:w})]})]})}var g=c(1453),h=c(31343);let i=/(?:file:\/\/)?(?:(?:[A-Za-z]:[\\/])|\/|~\/|\.{1,2}[\\/]|[A-Za-z0-9_.-]+[\\/])[^`"'<>|\s{}\[\]]+?\.(?:png|jpe?g|webp|gif|svg|bmp|avif|pdf)(?=$|[\s`"'<>|{}\[\]),.;:!?])/gi,j=/\.(?:png|jpe?g|webp|gif|svg|bmp|avif)$/i,k=/\.pdf$/i;function l(a){return a.path?m(a.path):a.source?.type==="base64"&&a.source.data?`data:${a.source.media_type??"image/png"};base64,${a.source.data}`:a.source?.type==="url"&&a.source.url?a.source.url:a.data?`data:${a.mimeType??"image/png"};base64,${a.data}`:null}function m(a){return`/api/files/${(0,h.HG)(a)}?type=read`}function n(a,b){if(!a)return[];let c=[],d=new Set,e=new Set;for(let b of a.matchAll(/!\[[^\]]*]\(([^)]+)\)/g))b[1]&&e.add(b[1].trim());let f=a=>{!a||d.has(a)||c.length>=24||(d.add(a),c.push(a))};for(let c of(i.lastIndex=0,a.matchAll(i))){let d=c[0];if(/^[a-z][a-z\d+.-]*:\/\//i.test(d)&&!/^file:\/\//i.test(d))continue;let g=a.slice(Math.max(0,c.index-12),c.index);if(/[A-Za-z][A-Za-z\d+.-]*:\/?$/.test(g)||d.startsWith("//")||e.has(d))continue;let i=(0,h.HR)(d,b);i&&(j.test(i)?f(i):k.test(i)&&f(i.replace(k,".png")))}return c}function o(a){let b=new Set,c=[];for(let d of a)b.has(d)||(b.add(d),c.push(d));return c}function p(a,b){return a&&b?a.replace(/\n?\[Current model does not support images\. The image will be omitted from this request\.\]\s*/g,"").trim():a}function q({images:a,maxHeight:b=360}){return 0===a.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===a.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:a.map((a,c)=>{let e=l(a);return e?(0,d.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",title:"Open image",style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:(0,d.jsx)("img",{src:e,alt:"",loading:"lazy",style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}})},c):null})})}function r({imagePaths:a,maxHeight:b=360}){let[c,f]=(0,e.useState)(()=>new Set),g=(0,e.useRef)(new Map);a.join("\0");let i=a.filter(a=>!c.has(a));return 0===i.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===i.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:i.map(a=>{let c=m(a),e=(0,h.WP)(a);return(0,d.jsxs)("a",{href:c,target:"_blank",rel:"noreferrer",title:a,style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:[(0,d.jsx)("img",{src:c,alt:e,loading:"lazy",onError:()=>{g.current.set(a,(g.current.get(a)??0)+1),f(b=>{let c=new Set(b);return c.add(a),c})},style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}}),(0,d.jsx)("div",{style:{padding:"4px 6px",borderTop:"1px solid var(--border)",color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]},a)})})}function s({text:a,isEmpty:b,isError:c,images:e,imagePaths:h,toolDetails:i}){let j=!b||a.trim().length>0;return(0,d.jsxs)("div",{style:{borderTop:`1px solid ${c?"rgba(248,113,113,0.3)":"rgba(34,197,94,0.15)"}`,background:c?"rgba(248,113,113,0.04)":"var(--bg-subtle)"},children:[e.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:i?.schema==="kernel-plot.render.v1"?(0,d.jsx)(f,{imageData:e[0].data??e[0].source?.data??"",mimeType:e[0].mimeType??e[0].source?.media_type??"image/png",width:null,height:null,replayToken:i.replayToken??null,saveTargetKind:i.saveTargetKind??null}):(0,d.jsx)(q,{images:e})}),h.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:(0,d.jsx)(r,{imagePaths:h})}),j&&(0,d.jsx)(g.m,{text:b?"(no output)":a,maxHeight:400,collapsible:!0,textColor:c?"#f87171":b?"var(--text-dim)":"var(--text-muted)",background:"var(--bg)",empty:b})]})}},1453:(a,b,c)=>{"use strict";c.d(b,{m:()=>i});var d=c(48249),e=c(40805),f=c.n(e);let g=/\x1B\[[0-?]*[ -/]*[@-~]/;var h=c(19581);function i({text:a,maxHeight:b=400,collapsible:c=!0,textColor:e="var(--text-muted)",background:j="var(--bg)",empty:k=!1}){let l=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),m=l.split("\n"),n=g.test(a)?(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",overflowX:"auto",padding:"8px 10px",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,color:e,opacity:k?.6:1,fontStyle:k?"italic":"normal"},children:(0,d.jsx)(f(),{children:a})}):(0,d.jsx)("pre",{style:{margin:0,padding:"8px 10px",fontSize:12,lineHeight:1.5,overflowX:"auto",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,whiteSpace:"pre-wrap",wordBreak:"break-all",fontFamily:"var(--font-mono)",opacity:k?.6:1,fontStyle:k?"italic":"normal",color:e},children:l});return!c||m.length<=20?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(h.oG,{totalLines:m.length,expandedMaxHeight:b,overlayBackground:j,footerBackground:j,children:n})}},2857:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484);let e=new Set;function f(a){return e.add(a),()=>{e.delete(a)}}function g(){return"u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function h(){return"light"}function i(){let a=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,toggleTheme:(0,d.useCallback)(a=>{let b="dark"===g()?"light":"dark",c=()=>{"dark"===b?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");try{localStorage.setItem("pi-theme",b)}catch{}e.forEach(a=>a())},d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if("function"!=typeof document.startViewTransition||d)return void c();let f=a?.x??window.innerWidth/2,h=a?.y??window.innerHeight/2,i=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(h,window.innerHeight-h));document.startViewTransition(c).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${h}px)`,`circle(${i}px at ${f}px ${h}px)`]},{duration:450,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",pseudoElement:"::view-transition-new(root)"})}).catch(()=>{})},[]),isDark:"dark"===a}}},4093:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,90929,23))},7952:(a,b,c)=>{"use strict";function d(a){let b,c=[],d=/`{1,3}show-widget`{0,3}\s*(?:\n\s*`{3}(?:json|html)?\s*)?\n?/g,g=0,h=!1;for(;null!==(b=d.exec(a));){h=!0;let i=a.slice(g,b.index).trim();i&&c.push({type:"text",content:i});let j=b.index+b[0].length,k=a.indexOf("```",j),l=a.indexOf("{",j);if(-1!==l&&l<=j+200&&(-1===k||l<k)){let b=function(a,b){let c=0,d=!1,e=!1;for(let f=b;f<a.length;f++){let b=a[f];if(e){e=!1;continue}if("\\"===b&&d){e=!0;continue}if('"'===b){d=!d;continue}if(!d&&("{"===b&&c++,"}"===b)&&0==--c)return f}return -1}(a,l);if(-1===b){let b=function(a){try{let b=e(a);if(b)return b}catch{}let b=a.indexOf('"widget_code"');if(-1===b)return null;let c=a.indexOf(":",b+13);if(-1===c)return null;let d=a.indexOf('"',c+1);if(-1===d)return null;let g=a.slice(d+1);(g=g.replace(/"\s*\}\s*$/,"")).endsWith("\\")&&(g=g.slice(0,-1));let h=a.match(/"title"\s*:\s*"([^"]*?)"/)?.[1],i=f(g.replace(/\\\\/g,"\0BACKSLASH\0").replace(/\\n/g,"\n").replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\u([0-9a-fA-F]{4})/g,(a,b)=>String.fromCharCode(parseInt(b,16))).replace(/\x00BACKSLASH\x00/g,"\\"));return i.code.trim()?{title:h,code:i.code,showOverlay:i.truncated}:null}(a.slice(l));b&&c.push({type:"widget",...b,partial:!0}),g=a.length;break}let h=e(a.slice(l,b+1).trim());h&&c.push({type:"widget",...h});let i=b+1,j=a.slice(i,i+16).match(/^\s*\n?`{1,3}\s*/);j&&(i+=j[0].length),g=i,d.lastIndex=i;continue}if(-1!==k){let b=a.slice(j,k).trim(),f=e(b);f?c.push({type:"widget",...f}):b&&c.push({type:"text",content:b}),d.lastIndex=g=k+3}else{let b=e(a.slice(j).trim());if(b){let a=f(b.code);c.push({type:"widget",title:b.title,code:a.code,partial:!0,showOverlay:a.truncated})}g=a.length;break}}let i=a.slice(g).trim();return i&&c.push({type:"text",content:i}),!h&&0===c.length&&a.trim()&&c.push({type:"text",content:a}),c}function e(a){if(a.startsWith("{")){if(!a.endsWith("}"))return null;try{let b=JSON.parse(a),c=b.widget_code??b.code;if(c)return{title:b.title,code:c}}catch{return null}}return/<(!DOCTYPE|html|svg|canvas|script|style|div)/i.test(a)?{code:a}:null}function f(a){let b=a.lastIndexOf("<script");if(-1===b)return{code:a,truncated:!1};let c=a.slice(b);return/<script[\s\S]*?<\/script>/i.test(c)?{code:a,truncated:!1}:{code:a.slice(0,b).trim(),truncated:!0}}function g(a){return/`{1,3}show-widget/.test(a)}function h(a){return l(a)}function i(a){return l(a).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>"']*)/gi,"").replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']*))/gi,(a,b,c,d,e)=>{let f=(c??d??e??"").trim();return/^\s*(javascript|data)\s*:/i.test(f)?"":a})}c.d(b,{L$:()=>h,SR:()=>n,Xw:()=>i,aH:()=>d,f7:()=>o,qk:()=>g,sM:()=>p});let j=/<(iframe|object|embed|meta|link|base|form)[\s>][\s\S]*?<\/\1>/gi,k=/<(iframe|object|embed|meta|link|base)\b[^>]*\/?>/gi;function l(a){return a.replace(j,"").replace(k,"")}let m=["--bg","--bg-panel","--bg-hover","--bg-selected","--border","--text","--text-muted","--text-dim","--accent","--accent-hover"];function n(){if("u"<typeof document)return{};let a=getComputedStyle(document.documentElement),b={};for(let c of m){let d=a.getPropertyValue(c).trim();d&&(b[c]=d)}return b}function o(a){let b=Object.entries({"--bg":"#ffffff","--bg-panel":"#f5f5f5","--bg-hover":"#eeeeee","--bg-selected":"#e8e8e8","--border":"#e0e0e0","--text":"#1a1a1a","--text-muted":"#6b7280","--text-dim":"#9ca3af","--accent":"#2563eb","--accent-hover":"#1d4ed8",...a,"--font-mono":"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"}).map(([a,b])=>` ${a}: ${b};`).join("\n");return`
|
|
1
|
+
exports.id=1494,exports.ids=[1494],exports.modules={129:(a,b,c)=>{"use strict";c.d(b,{O7:()=>q,eR:()=>r,qb:()=>s,qn:()=>n,h5:()=>l,Xz:()=>o,Ln:()=>p});var d=c(48249),e=c(67484);function f({imageData:a,mimeType:b,width:c,height:g,replayToken:h,saveTargetKind:i,saveDefaults:j}){let[k,l]=(0,e.useState)(j??{format:"pdf",dpi:300,width:800,height:600}),[m,n]=(0,e.useState)(k.format),[o,p]=(0,e.useState)(k.dpi),[q,r]=(0,e.useState)(k.width),[s,t]=(0,e.useState)(k.height),[u,v]=(0,e.useState)("idle"),[w,x]=(0,e.useState)(null),y=h&&"object"===i,z=async()=>{if(h){v("saving"),x(null);try{let a=await fetch("/api/plot-kernels/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({replayToken:h,format:m,dpi:o,width:q,height:s})});if(410===a.status)return void v("expired");if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error??`HTTP ${a.status}`)}v("saved")}catch(a){v("error"),x(a instanceof Error?a.message:String(a))}}};return(0,d.jsxs)("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%"},children:[(0,d.jsx)("img",{src:`data:${b};base64,${a}`,alt:"rendered plot",style:{maxWidth:"100%",height:"auto",borderRadius:6,border:"1px solid var(--border)"},width:c??void 0,height:g??void 0}),y&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"rgba(0,0,0,0.65)",padding:"6px 10px",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",borderRadius:"0 0 6px 6px",fontSize:11,color:"#e5e7eb",opacity:0,transition:"opacity 0.15s"},className:"workbench-save-bar",onMouseEnter:a=>{a.currentTarget.style.opacity="1"},children:["saved"===u?(0,d.jsx)("span",{style:{color:"#34d399",fontWeight:600},children:"✓ Saved"}):"expired"===u?(0,d.jsx)("span",{style:{color:"#fbbf24"},children:"Save session expired. Re-render plot."}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("select",{value:m,onChange:a=>n(a.target.value),style:{background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4,padding:"2px 4px",fontSize:11,height:24},children:[(0,d.jsx)("option",{value:"pdf",children:"PDF"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"svg",children:"SVG"})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["DPI",(0,d.jsx)("input",{type:"number",value:o,onChange:a=>p(Number(a.target.value)||300),min:72,max:1200,style:{width:50,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["W",(0,d.jsx)("input",{type:"number",value:q,onChange:a=>r(Number(a.target.value)||800),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["H",(0,d.jsx)("input",{type:"number",value:s,onChange:a=>t(Number(a.target.value)||600),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsx)("button",{type:"button",onClick:z,disabled:"saving"===u,style:{height:24,padding:"0 12px",borderRadius:4,background:"rgba(37,99,235,0.4)",border:"1px solid rgba(37,99,235,0.6)",color:"#fff",cursor:"pointer",fontSize:11,fontWeight:600,opacity:"saving"===u?.6:1},children:"saving"===u?"Saving...":"Save"})]}),"error"===u&&w&&(0,d.jsx)("span",{style:{color:"#f87171",marginLeft:4},children:w})]})]})}var g=c(1453),h=c(31343);let i=/(?:file:\/\/)?(?:(?:[A-Za-z]:[\\/])|\/|~\/|\.{1,2}[\\/]|[A-Za-z0-9_.-]+[\\/])[^`"'<>|\s{}\[\]]+?\.(?:png|jpe?g|webp|gif|svg|bmp|avif|pdf)(?=$|[\s`"'<>|{}\[\]),.;:!?])/gi,j=/\.(?:png|jpe?g|webp|gif|svg|bmp|avif)$/i,k=/\.pdf$/i;function l(a){return a.path?m(a.path):a.source?.type==="base64"&&a.source.data?`data:${a.source.media_type??"image/png"};base64,${a.source.data}`:a.source?.type==="url"&&a.source.url?a.source.url:a.data?`data:${a.mimeType??"image/png"};base64,${a.data}`:null}function m(a){return`/api/files/${(0,h.HG)(a)}?type=read`}function n(a,b){if(!a)return[];let c=[],d=new Set,e=new Set;for(let b of a.matchAll(/!\[[^\]]*]\(([^)]+)\)/g))b[1]&&e.add(b[1].trim());let f=a=>{!a||d.has(a)||c.length>=24||(d.add(a),c.push(a))};for(let c of(i.lastIndex=0,a.matchAll(i))){let d=c[0];if(/^[a-z][a-z\d+.-]*:\/\//i.test(d)&&!/^file:\/\//i.test(d))continue;let g=a.slice(Math.max(0,c.index-12),c.index);if(/[A-Za-z][A-Za-z\d+.-]*:\/?$/.test(g)||d.startsWith("//")||e.has(d))continue;let i=(0,h.HR)(d,b);i&&(j.test(i)?f(i):k.test(i)&&f(i.replace(k,".png")))}return c}function o(a){let b=new Set,c=[];for(let d of a)b.has(d)||(b.add(d),c.push(d));return c}function p(a,b){return a&&b?a.replace(/\n?\[Current model does not support images\. The image will be omitted from this request\.\]\s*/g,"").trim():a}function q({images:a,maxHeight:b=360}){return 0===a.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===a.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:a.map((a,c)=>{let e=l(a);return e?(0,d.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",title:"Open image",style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:(0,d.jsx)("img",{src:e,alt:"",loading:"lazy",style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}})},c):null})})}function r({imagePaths:a,maxHeight:b=360}){let[c,f]=(0,e.useState)(()=>new Set),g=(0,e.useRef)(new Map);a.join("\0");let i=a.filter(a=>!c.has(a));return 0===i.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===i.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:i.map(a=>{let c=m(a),e=(0,h.WP)(a);return(0,d.jsxs)("a",{href:c,target:"_blank",rel:"noreferrer",title:a,style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:[(0,d.jsx)("img",{src:c,alt:e,loading:"lazy",onError:()=>{g.current.set(a,(g.current.get(a)??0)+1),f(b=>{let c=new Set(b);return c.add(a),c})},style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}}),(0,d.jsx)("div",{style:{padding:"4px 6px",borderTop:"1px solid var(--border)",color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]},a)})})}function s({text:a,isEmpty:b,isError:c,images:e,imagePaths:h,toolDetails:i}){let j=!b||a.trim().length>0;return(0,d.jsxs)("div",{style:{borderTop:`1px solid ${c?"rgba(248,113,113,0.3)":"rgba(34,197,94,0.15)"}`,background:c?"rgba(248,113,113,0.04)":"var(--bg-subtle)"},children:[e.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:i?.schema==="kernel-plot.render.v1"?(0,d.jsx)(f,{imageData:e[0].data??e[0].source?.data??"",mimeType:e[0].mimeType??e[0].source?.media_type??"image/png",width:null,height:null,replayToken:i.replayToken??null,saveTargetKind:i.saveTargetKind??null}):(0,d.jsx)(q,{images:e})}),h.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:(0,d.jsx)(r,{imagePaths:h})}),j&&(0,d.jsx)(g.m,{text:b?"(no output)":a,maxHeight:400,collapsible:!0,textColor:c?"#f87171":b?"var(--text-dim)":"var(--text-muted)",background:"var(--bg)",empty:b})]})}},1453:(a,b,c)=>{"use strict";c.d(b,{m:()=>i});var d=c(48249),e=c(40805),f=c.n(e);let g=/\x1B\[[0-?]*[ -/]*[@-~]/;var h=c(19581);function i({text:a,maxHeight:b=400,collapsible:c=!0,textColor:e="var(--text-muted)",background:j="var(--bg)",empty:k=!1}){let l=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),m=l.split("\n"),n=g.test(a)?(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",overflowX:"auto",padding:"8px 10px",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,color:e,opacity:k?.6:1,fontStyle:k?"italic":"normal"},children:(0,d.jsx)(f(),{children:a})}):(0,d.jsx)("pre",{style:{margin:0,padding:"8px 10px",fontSize:12,lineHeight:1.5,overflowX:"auto",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,whiteSpace:"pre-wrap",wordBreak:"break-all",fontFamily:"var(--font-mono)",opacity:k?.6:1,fontStyle:k?"italic":"normal",color:e},children:l});return!c||m.length<=20?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(h.oG,{totalLines:m.length,expandedMaxHeight:b,overlayBackground:j,footerBackground:j,children:n})}},2857:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484);let e=new Set;function f(a){return e.add(a),()=>{e.delete(a)}}function g(){return"u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function h(){return"light"}function i(){let a=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,toggleTheme:(0,d.useCallback)(a=>{let b="dark"===g()?"light":"dark",c=()=>{"dark"===b?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");try{localStorage.setItem("pi-theme",b)}catch{}e.forEach(a=>a())},d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if("function"!=typeof document.startViewTransition||d)return void c();let f=a?.x??window.innerWidth/2,h=a?.y??window.innerHeight/2,i=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(h,window.innerHeight-h));document.startViewTransition(c).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${h}px)`,`circle(${i}px at ${f}px ${h}px)`]},{duration:450,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",pseudoElement:"::view-transition-new(root)"})}).catch(()=>{})},[]),isDark:"dark"===a}}},4093:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,90929,23))},6954:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(48249);function e({expanded:a,onToggle:b,children:c,title:f,buttonStyle:g,chevronColor:h="var(--text-dim)",chevronStyle:i}){return(0,d.jsxs)("button",{type:"button",onClick:b,"aria-expanded":a,title:f,style:g,children:[c,(0,d.jsx)("span",{style:{display:"inline-flex",color:h,transform:a?"rotate(180deg)":"none",transition:"transform 0.15s",flexShrink:0,...i},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})})]})}},7952:(a,b,c)=>{"use strict";function d(a){let b,c=[],d=/`{1,3}show-widget`{0,3}\s*(?:\n\s*`{3}(?:json|html)?\s*)?\n?/g,g=0,h=!1;for(;null!==(b=d.exec(a));){h=!0;let i=a.slice(g,b.index).trim();i&&c.push({type:"text",content:i});let j=b.index+b[0].length,k=a.indexOf("```",j),l=a.indexOf("{",j);if(-1!==l&&l<=j+200&&(-1===k||l<k)){let b=function(a,b){let c=0,d=!1,e=!1;for(let f=b;f<a.length;f++){let b=a[f];if(e){e=!1;continue}if("\\"===b&&d){e=!0;continue}if('"'===b){d=!d;continue}if(!d&&("{"===b&&c++,"}"===b)&&0==--c)return f}return -1}(a,l);if(-1===b){let b=function(a){try{let b=e(a);if(b)return b}catch{}let b=a.indexOf('"widget_code"');if(-1===b)return null;let c=a.indexOf(":",b+13);if(-1===c)return null;let d=a.indexOf('"',c+1);if(-1===d)return null;let g=a.slice(d+1);(g=g.replace(/"\s*\}\s*$/,"")).endsWith("\\")&&(g=g.slice(0,-1));let h=a.match(/"title"\s*:\s*"([^"]*?)"/)?.[1],i=f(g.replace(/\\\\/g,"\0BACKSLASH\0").replace(/\\n/g,"\n").replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\u([0-9a-fA-F]{4})/g,(a,b)=>String.fromCharCode(parseInt(b,16))).replace(/\x00BACKSLASH\x00/g,"\\"));return i.code.trim()?{title:h,code:i.code,showOverlay:i.truncated}:null}(a.slice(l));b&&c.push({type:"widget",...b,partial:!0}),g=a.length;break}let h=e(a.slice(l,b+1).trim());h&&c.push({type:"widget",...h});let i=b+1,j=a.slice(i,i+16).match(/^\s*\n?`{1,3}\s*/);j&&(i+=j[0].length),g=i,d.lastIndex=i;continue}if(-1!==k){let b=a.slice(j,k).trim(),f=e(b);f?c.push({type:"widget",...f}):b&&c.push({type:"text",content:b}),d.lastIndex=g=k+3}else{let b=e(a.slice(j).trim());if(b){let a=f(b.code);c.push({type:"widget",title:b.title,code:a.code,partial:!0,showOverlay:a.truncated})}g=a.length;break}}let i=a.slice(g).trim();return i&&c.push({type:"text",content:i}),!h&&0===c.length&&a.trim()&&c.push({type:"text",content:a}),c}function e(a){if(a.startsWith("{")){if(!a.endsWith("}"))return null;try{let b=JSON.parse(a),c=b.widget_code??b.code;if(c)return{title:b.title,code:c}}catch{return null}}return/<(!DOCTYPE|html|svg|canvas|script|style|div)/i.test(a)?{code:a}:null}function f(a){let b=a.lastIndexOf("<script");if(-1===b)return{code:a,truncated:!1};let c=a.slice(b);return/<script[\s\S]*?<\/script>/i.test(c)?{code:a,truncated:!1}:{code:a.slice(0,b).trim(),truncated:!0}}function g(a){return/`{1,3}show-widget/.test(a)}function h(a){return l(a)}function i(a){return l(a).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>"']*)/gi,"").replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']*))/gi,(a,b,c,d,e)=>{let f=(c??d??e??"").trim();return/^\s*(javascript|data)\s*:/i.test(f)?"":a})}c.d(b,{L$:()=>h,SR:()=>n,Xw:()=>i,aH:()=>d,f7:()=>o,qk:()=>g,sM:()=>p});let j=/<(iframe|object|embed|meta|link|base|form)[\s>][\s\S]*?<\/\1>/gi,k=/<(iframe|object|embed|meta|link|base)\b[^>]*\/?>/gi;function l(a){return a.replace(j,"").replace(k,"")}let m=["--bg","--bg-panel","--bg-hover","--bg-selected","--border","--text","--text-muted","--text-dim","--accent","--accent-hover"];function n(){if("u"<typeof document)return{};let a=getComputedStyle(document.documentElement),b={};for(let c of m){let d=a.getPropertyValue(c).trim();d&&(b[c]=d)}return b}function o(a){let b=Object.entries({"--bg":"#ffffff","--bg-panel":"#f5f5f5","--bg-hover":"#eeeeee","--bg-selected":"#e8e8e8","--border":"#e0e0e0","--text":"#1a1a1a","--text-muted":"#6b7280","--text-dim":"#9ca3af","--accent":"#2563eb","--accent-hover":"#1d4ed8",...a,"--font-mono":"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"}).map(([a,b])=>` ${a}: ${b};`).join("\n");return`
|
|
2
2
|
:root {
|
|
3
3
|
${b}
|
|
4
4
|
}
|
|
@@ -257,7 +257,7 @@ ${a}
|
|
|
257
257
|
${a}
|
|
258
258
|
${d}`;(0,p.D)(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},title:"Copy as Markdown fence",ariaLabel:"Copy as Markdown fence",label:"markdown",activeLabel:"md copied",active:r}),(0,d.jsx)(m.Mi,{onClick:()=>{(0,p.D)(a).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},ariaLabel:"Copy code",label:"copy",activeLabel:"copied",active:l})]})}),(0,d.jsx)(m.oG,{totalLines:u,children:w})]})}function r({chart:a}){let{isDark:b}=(0,l.D)(),[c,f]=(0,e.useState)(null),[g,h]=(0,e.useState)(null);return((0,e.useRef)(`mermaid-${Math.random().toString(36).slice(2)}`),g)?(0,d.jsxs)("div",{className:"mermaid-diagram mermaid-diagram-error",children:[(0,d.jsx)("div",{className:"mermaid-diagram-error-title",children:"Mermaid render failed"}),(0,d.jsx)("div",{className:"mermaid-diagram-error-message",children:g}),(0,d.jsx)("pre",{children:a})]}):(0,d.jsx)("div",{className:"mermaid-diagram",children:c?(0,d.jsx)("div",{className:"mermaid-diagram-canvas",dangerouslySetInnerHTML:{__html:c}}):(0,d.jsx)("div",{className:"mermaid-diagram-loading",children:"Rendering diagram..."})})}var s=c(31218),t=c(52515);function u({code:a,onAcceptDiff:b,agentRunning:c}){let f=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=1;for(let a of b){let b=/^\+\+\+ [ab]\/(.+)/.exec(a);if(b){d=b[1];continue}if(/^@@ /.test(a)){let b=/@@ -\d+(?:,\d+)? \+(\d+)/.exec(a);b&&(e=parseInt(b[1],10));continue}/^--- /.test(a)||(a.startsWith("+")&&!a.startsWith("+++")?c.push({type:"added",text:a.slice(1),lineNo:e++}):a.startsWith("-")&&!a.startsWith("---")?c.push({type:"removed",text:a.slice(1),lineNo:0}):a.startsWith(" ")?c.push({type:"unchanged",text:a.slice(1),lineNo:e++}):c.push({type:"unchanged",text:a,lineNo:e++}))}return{lines:c,filePath:d}})(a),[a]),g=(0,e.useMemo)(()=>(function(a){let b=0,c=0;for(let d of a)"added"===d.type&&b++,"removed"===d.type&&c++;return{added:b,removed:c}})(f.lines),[f.lines]);return(0,d.jsxs)(m.NG,{className:"markdown-code-block markdown-code-block-chat",style:{marginTop:4,marginBottom:4},children:[(0,d.jsx)(m.iO,{title:(0,d.jsxs)("span",{children:["diff ",f.filePath&&(0,d.jsx)("span",{style:{opacity:.7},children:f.filePath})," ",(0,d.jsxs)("span",{style:{color:"var(--text-dim)",fontWeight:400},children:["(",(0,d.jsxs)("span",{style:{color:"#16a34a"},children:["+",g.added]})," /"," ",(0,d.jsxs)("span",{style:{color:"#dc2626"},children:["-",g.removed]}),")"]})]}),actions:b&&!c?(0,d.jsx)(m.Mi,{onClick:()=>b(a,f.filePath),title:"Ask the agent to apply this diff",ariaLabel:"Ask the agent to apply this diff",label:"apply",activeLabel:"apply",active:!1}):void 0}),(0,d.jsx)(t.pg,{diff:f.lines,emptyLabel:"No changes detected"})]})}let v=new Set,w=new Map,x=null;function y(){return x||(x=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===v.size){for(let b of Object.keys(a.bundledLanguages??{}))v.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])w.set(c.toLowerCase(),a)}}return a})),x}var z=c(7952),A=c(31343);function B(a){return a?.replace(/^language-/,"").trim()??""}function C(a){return/^[a-z][a-z\d+.-]*:/i.test(a)||a.startsWith("//")}function D(a,b,c){let d;if(!c||c.startsWith("#")||C(c))return null;let e=(d=/^([^?#]*)(.*)$/.exec(c),d?.[1]??c);if(!e)return null;let f=function(a){try{return decodeURI(a)}catch{return a}}(e);return(0,A.HR)(f,b,a)}function E(a){return`/api/files/${(0,A.HG)(a)}?type=read`}function F({value:a,baseFilePath:b,cwd:c,onOpenLocalFile:e,onOpenFileAtLine:f}){let g=(0,d.jsx)("code",{style:{background:"var(--bg-selected)",padding:"1px 4px",borderRadius:3,fontFamily:"var(--font-mono)",fontSize:"0.9em"},children:a});return/^(?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+$/.test(a.trim())?(0,d.jsx)(I,{href:a,baseFilePath:b,cwd:c,onOpenLocalFile:e,onOpenFileAtLine:f,style:{textDecoration:"none"},children:g}):g}function G(a){let b=/^\s*!\[([^\]]*)\]\((.+)\)\s*$/.exec(a);if(!b)return null;let c=b[2]?.trim()??"";if(!c)return null;let d=/^(.+?)\s+(?:"[^"]*"|'[^']*')\s*$/.exec(c);return{alt:b[1]?.trim()||void 0,src:(d?.[1]??c).trim()}}function H({items:a,baseFilePath:b,cwd:c,onOpenLocalFile:e}){let f=1===a.length;return(0,d.jsx)("div",{className:"report-image-gallery",style:{display:"grid",gridTemplateColumns:f?"minmax(0, 1fr)":"repeat(auto-fit, minmax(min(100%, 240px), 1fr))",gap:12,margin:"16px 0"},children:a.map((a,g)=>{let h=D(b,c,a.src),i=h?E(h):a.src,j=a.alt??a.caption??`Figure ${g+1}`,k=(0,d.jsx)("img",{src:i,alt:j,loading:"lazy",title:h??a.src,style:{display:"block",width:"100%",maxHeight:f?520:340,objectFit:"contain",border:"1px solid var(--border)",borderRadius:6,background:"var(--bg-panel)"}});return(0,d.jsxs)("figure",{style:{margin:0,minWidth:0},children:[h&&e?(0,d.jsx)("button",{type:"button",onClick:()=>e(h,(0,A.WP)(h)),title:`Open ${h}`,style:{display:"block",width:"100%",padding:0,border:"none",background:"none",cursor:"zoom-in"},children:k}):k,a.caption&&(0,d.jsx)("figcaption",{style:{marginTop:6,color:"var(--text-muted)",fontSize:12,lineHeight:1.45},children:a.caption})]},`${a.src}-${g}`)})})}function I({href:a,children:b,baseFilePath:c,cwd:e,onOpenLocalFile:f,onOpenFileAtLine:g,title:h,...i}){let j=a?/^(.*):(\d+)$/.exec(a.replace(/[?#].*$/,"")):null,k=j?j[1]:a,l=j?parseInt(j[2],10):void 0,m=D(c,e,k),n=!!m,o=!!a&&C(a),p=m&&l?`${E(m)}#L${l}`:n?E(m):a;return(0,d.jsx)("a",{...i,href:p,target:o?"_blank":void 0,rel:o?"noreferrer":void 0,onClick:a=>{if(!m)return;a.preventDefault();let b=(0,A.WP)(m);g?g(m,b,l):f&&f(m,b)},title:n?m:h,children:b})}function J({src:a,alt:b,title:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,...h}){let i="string"==typeof a?a:void 0,j=D(e,f,i),k=j?E(j):i,l=(0,d.jsx)("img",{...h,src:k,alt:b??"",loading:"lazy",title:j??c,style:{...h.style??{},cursor:k?"zoom-in":h.style?.cursor}});return k?(0,d.jsx)("a",{href:k,target:"_blank",rel:"noreferrer",title:j??c??"Open image",style:{display:"inline-block",maxWidth:"100%"},onClick:a=>{j&&g&&(a.preventDefault(),g(j,(0,A.WP)(j)))},children:l}):l}function K({code:a,language:b,variant:c,isStreaming:e=!1,baseFilePath:f,cwd:g,onOpenLocalFile:h,onWidgetSendMessage:i,renderVisualCodeBlocks:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:p}){let t,v,w,x;if("mermaid"===(t=b.trim().toLowerCase())||"mmd"===t)return(0,d.jsx)(r,{chart:a});if("diff"===(v=b.trim().toLowerCase())||"patch"===v||"unified-diff"===v)return(0,d.jsx)(u,{code:a,onAcceptDiff:p,agentRunning:m});if("show-widget"===b.trim().toLowerCase()){let b,c=(b=(0,z.aH)(`\`\`\`show-widget
|
|
259
259
|
${a}
|
|
260
|
-
\`\`\``).find(a=>"widget"===a.type),b?.type==="widget"?{title:b.title,code:b.code}:null);if(c)return(0,d.jsx)(s.u,{code:c.code,isStreaming:!1,title:c.title,onSendMessage:i})}if("report-gallery"===b.trim().toLowerCase()){let b=function(a){try{let b=JSON.parse(a);if(!Array.isArray(b))return null;let c=b.flatMap(a=>a&&"object"==typeof a&&"string"==typeof a.src&&a.src.trim()?[{src:a.src.trim(),alt:"string"==typeof a.alt&&a.alt.trim()?a.alt.trim():void 0,caption:"string"==typeof a.caption&&a.caption.trim()?a.caption.trim():void 0}]:[]);return c.length>0?c.slice(0,12):null}catch{return null}}(a);if(b)return(0,d.jsx)(H,{items:b,baseFilePath:f,cwd:g,onOpenLocalFile:h})}return j&&(w=b.trim().toLowerCase(),(x=a.trim())&&("svg"===w||"xml"===w&&/^<svg[\s>]/i.test(x)?/^<svg[\s>]/i.test(x):!("html"!==w||/<!doctype|<html[\s>]|<head[\s>]|<body[\s>]/i.test(x))&&/^<(style|svg|div|section|article|main|figure|canvas)\b/i.test(x)))?(0,d.jsx)(s.u,{code:a,isStreaming:!1,title:`${b||"visual"} preview`,onSendMessage:i}):(0,d.jsx)(q,{code:a,language:b,variant:c,isStreaming:e,testAsyncDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o})}function L({children:a,className:b,node:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i=!1,isStreaming:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onOpenFileAtLine:p,onAcceptDiff:q,...r}){let s=("string"==typeof a?a:Array.isArray(a)?a.map(a=>"string"==typeof a?a:"").join(""):"").replace(/\n$/,""),t=B(b);return"data-block"in r?(0,d.jsx)(K,{code:s,language:t,variant:"chat",isStreaming:j||!!r["data-incomplete"],baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i,testAsyncCodeDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:q}):(0,d.jsx)(F,{value:s,baseFilePath:e,cwd:f,onOpenLocalFile:g,onOpenFileAtLine:p})}function M({content:a,className:b="markdown-body",style:c,codeBlockVariant:m="chat",baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s=!1,enableImageGallery:t=!1,isStreaming:u=!1,renderer:x="react-markdown",testAsyncCodeDelayMs:z=0,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N}){let O,P,{isDark:Q}=(0,l.D)(),R=t?function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){if(!G(b[d])){c.push(b[d]),d+=1;continue}let a=[],e=d;for(;e<b.length;){let c=G(b[e]);if(!c)break;let d=e+1,f=d;for(;f<b.length&&!b[f].trim();)f+=1;let g=f<b.length?function(a){let b=/^\s*(?:_([^_]+)_|\*([^*]+)\*)\s*$/.exec(a);return(b?.[1]??b?.[2]??"").trim()||null}(b[f]):null;g&&(c.caption=g,d=f+1),a.push(c);let h=d;for(;h<b.length&&!b[h].trim();)h+=1;if(!G(b[h])){e=d;break}e=h}if(a.length>1||a.some(a=>a.caption)){c.push(["```report-gallery",JSON.stringify(a,null,2),"```"].join("\n")),d=e;continue}c.push(b[d]),d+=1}return c.join("\n")}(a):a,S=H?(O=R.split("\n"),P=!1,O.map(a=>/^\s*(```|~~~)/.test(a)?(P=!P,a):P||/\]\([^)]*$/.test(a)?a:a.replace(/(^|[\s([{"'])((?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+)\b/g,(a,b,c)=>`${b}[${c}](${c})`)).join("\n")):R,T=(0,e.useMemo)(()=>u?{cjk:i.h,math:j.D,mermaid:k.a}:{cjk:i.h,math:j.D,mermaid:k.a,code:function(a,b=[n.cx,n.aU]){return y(),{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>[...v],getThemes:()=>b,supportsLanguage(a){let b;return 0===v.size||null!==((b=a.trim().toLowerCase())?v.has(b)?b:w.get(b)??null:null)},highlight(b,c){let d=b.language,e=(0,n.wY)(b.code,d,a,a=>{c?.({tokens:a.tokens,bg:a.bg,fg:a.fg})});return e?{tokens:e.tokens,bg:e.bg,fg:e.fg}:(y(),null)}}}(Q)},[Q,u]);return"streamdown"!==x||o||t?(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(f.oz,{remarkPlugins:[g.A],components:{code({className:a,children:b,node:c}){let e=B(a),f=String(b),g=f.replace(/\n$/,"");return a?.includes("language-")||f.includes("\n")?(0,d.jsx)(K,{code:g,language:e,variant:m,isStreaming:u,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onAcceptDiff:N}):(0,d.jsx)(F,{value:g,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H})},pre:({children:a})=>(0,d.jsx)(d.Fragment,{children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})}):(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(h.jH,{mode:u?"streaming":"static",isAnimating:!!u,plugins:T,components:{code:({children:a,className:b,node:c,...e})=>(0,d.jsx)(L,{...e,node:c,className:b,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,isStreaming:u,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})})}},51810:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},52515:(a,b,c)=>{"use strict";c.d(b,{K$:()=>h,Ph:()=>g,Tg:()=>m,fj:()=>f,mK:()=>i,ml:()=>j,nG:()=>k,pg:()=>l,v7:()=>e});var d=c(48249);function e(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function f({children:a,style:b}){return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",...b},children:a})}function g({children:a,style:b}){return(0,d.jsx)("div",{style:{flex:1,overflow:"auto",background:"var(--bg)",...b},children:a})}function h({pathLabel:a,title:b,trailing:c,style:e}){return(0,d.jsxs)("div",{"data-file-viewer-surface":"status-bar",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 16px",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",background:"var(--bg)",flexShrink:0,...e},children:[(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},title:b??a,children:a}),c]})}function i({watching:a}){return(0,d.jsxs)("span",{title:a?"Live sync active":"Not watching",style:{display:"flex",alignItems:"center",gap:4,color:a?"#4ade80":"var(--text-dim)"},children:[(0,d.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:a?"#4ade80":"var(--border)",display:"inline-block",boxShadow:a?"0 0 4px #4ade80":"none"}}),a?"live":"static"]})}function j({children:a,onClick:b,title:c,disabled:e=!1,active:f=!1,emphasis:g="default",style:h}){let i="primary"==g,k="danger"==g;return(0,d.jsx)("button",{"data-file-viewer-surface":"toolbar-button",onClick:b,disabled:e,title:c,style:{padding:"2px 10px",fontSize:11,cursor:e?"not-allowed":"pointer",background:i?"var(--accent)":k?"rgba(239,68,68,0.1)":f?"var(--bg-selected)":"var(--bg-hover)",color:i?"#fff":k?"#ef4444":f?"var(--text)":"var(--text-muted)",border:`1px solid ${i?"var(--accent)":k?"rgba(239,68,68,0.3)":"var(--border)"}`,borderRadius:5,fontWeight:f||i||k?600:400,opacity:e?.6:1,...h},children:a})}function k({children:a,tone:b="muted",style:c}){return(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",padding:24,color:"error"===b?"#f87171":"var(--text-muted)",fontSize:13,textAlign:"center",...c},children:a})}function l({diff:a,emptyLabel:b="No changes"}){if(!a.some(a=>"unchanged"!==a.type))return(0,d.jsx)("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)"},children:b});let c=new Set(a.flatMap((a,b)=>"unchanged"!==a.type?[b]:[])),e=new Set;for(let b of c)for(let c=Math.max(0,b-3);c<=Math.min(a.length-1,b+3);c++)e.add(c);let f=[],g=0;for(;g<a.length;)if(e.has(g)){let b=[];for(;g<a.length&&e.has(g);)b.push(a[g]),g++;f.push({hidden:!1,lines:b})}else{let b=0;for(;g<a.length&&!e.has(g);)b++,g++;f.push({hidden:!0,count:b})}let h=[],i=1;for(let b of a)"removed"===b.type?h.push(0):h.push(i++);let j=0;return(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.6},children:f.map((a,b)=>{if(a.hidden){let c=(0,d.jsxs)("div",{style:{padding:"2px 16px",color:"var(--text-dim)",background:"var(--bg-panel)",fontSize:11,borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},children:["... ",a.count," unchanged lines ..."]},b);return j+=a.count,c}let c=a.lines.map((a,b)=>{let c=h[j+b],e="added"===a.type?"rgba(0,200,80,0.12)":"removed"===a.type?"rgba(240,60,60,0.14)":"transparent",f="added"===a.type?"+":"removed"===a.type?"-":" ",g="added"===a.type?"#4ade80":"removed"===a.type?"#f87171":"var(--text-dim)";return(0,d.jsxs)("div",{style:{display:"flex",background:e,borderLeft:"added"===a.type?"3px solid #4ade80":"removed"===a.type?"3px solid #f87171":"3px solid transparent"},children:[(0,d.jsx)("span",{style:{minWidth:44,padding:"0 8px 0 16px",textAlign:"right",color:"var(--text-dim)",userSelect:"none",fontSize:11,lineHeight:1.6,borderRight:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:"removed"===a.type?a.lineNo:c||""}),(0,d.jsx)("span",{style:{minWidth:16,padding:"0 6px",color:g,userSelect:"none",flexShrink:0,fontWeight:600},children:f}),(0,d.jsx)("span",{style:{flex:1,padding:"0 8px 0 0",whiteSpace:"pre",color:"var(--text)",overflowX:"auto"},children:a.text||"\xa0"})]},b)});return j+=a.lines.length,(0,d.jsx)("div",{children:c},b)})})}function m({options:a}){return(0,d.jsx)("div",{"data-file-viewer-surface":"segmented-toggle",style:{display:"flex",borderRadius:5,overflow:"hidden",border:"1px solid var(--border)"},children:a.map((a,b)=>(0,d.jsx)("button",{onClick:a.onClick,style:{padding:"2px 8px",fontSize:11,border:"none",borderLeft:0===b?"none":"1px solid var(--border)",cursor:"pointer",background:a.active?"var(--bg-selected)":"var(--bg-hover)",color:a.active?"var(--text)":"var(--text-muted)",fontWeight:a.active?600:400},children:a.label},a.key))})}},54097:(a,b,c)=>{"use strict";c.d(b,{p:()=>f,t:()=>e});var d=c(48249);function e({children:a,style:b,kind:c}){return(0,d.jsx)("div",{"data-disclosure-surface":"panel","data-disclosure-kind":c,style:{border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg-panel)",...b},children:a})}function f({children:a,style:b}){return(0,d.jsx)("div",{"data-disclosure-surface":"body",style:{borderTop:"1px solid var(--border)",...b},children:a})}},57703:(a,b,c)=>{"use strict";c.d(b,{V:()=>h});var d=c(48249),e=c(84573),f=c(40648),g=c(41044);function h({expanded:a,onToggle:b,status:c,title:i,summary:j,durationLabel:k,leading:l,titleTooltip:m,summaryTooltip:n,buttonStyle:o,titleStyle:p,summaryStyle:q,durationStyle:r}){return(0,d.jsxs)(e.R,{expanded:a,onToggle:b,buttonStyle:o,children:[l,(0,d.jsx)("span",{title:m??i,style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:+!j,minWidth:0,flex:j?void 0:1,...p},children:"running"===c?(0,d.jsx)(f.n,{children:i}):i}),j?(0,d.jsx)("span",{title:n??j,style:{color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,...q},children:"running"===c?(0,d.jsx)(f.n,{children:j}):j}):(0,d.jsx)("span",{style:{flex:1,minWidth:0}}),(0,d.jsx)(g.U1,{status:c}),k?(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...r},children:k}):null]})}},60125:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,33071,23))},62418:(a,b,c)=>{"use strict";c.d(b,{D:()=>O});var d=c(48249),e=c(67484),f=c(51415),g=c(40648),h=c(73383),i=c(8033),j=c(41044),k=c(129),l=c(31218),m=c(7952);function n({block:a,toolResults:b,isStreaming:c,streamingDuration:e,toolCallDurations:f,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t}){if("text"===a.type)return(0,d.jsx)(o,{block:a,isStreaming:c,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t});if("image"===a.type)return(0,d.jsx)(k.O7,{images:[a]});if("thinking"===a.type)return(0,d.jsx)(r,{block:a,duration:e,isStreaming:c});let u=b?.get(a.toolCallId),v=f?.get(a.toolCallId);return(0,d.jsx)(s,{block:a,result:u,duration:v,isStreaming:c,cwd:i})}function o({block:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}){let r=a.text,s=(0,m.aH)(r);if(!s.some(a=>"widget"===a.type)){if(b&&(0,m.qk)(r)){let a=s.filter(a=>"text"===a.type).map(a=>a.content).join("\n\n");return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(p,{text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}),(0,d.jsx)(q,{})]})}return(0,d.jsx)(p,{text:r,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n})}return(0,d.jsx)(d.Fragment,{children:s.map((a,m)=>"text"===a.type?(0,d.jsx)(p,{text:a.content,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n},m):(0,d.jsx)(l.u,{code:a.code,isStreaming:!!a.partial,title:a.title,showOverlay:a.showOverlay,onSendMessage:c},m))})}function p({text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:g,cwd:h,activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}){let q=(0,e.useMemo)(()=>(0,k.qn)(a,h),[h,a]);return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8*(q.length>0)},children:[(0,d.jsx)(f.T,{content:a,cwd:h,onWidgetSendMessage:c,renderVisualCodeBlocks:g,isStreaming:b,renderer:"streamdown",activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}),q.length>0&&(0,d.jsx)(k.eR,{imagePaths:q})]})}function q(){return(0,d.jsx)(g.r,{height:88,style:{border:"1px solid var(--border)"}})}function r({block:a,duration:b,isStreaming:c}){return(0,d.jsx)(h.pm,{content:a.thinking,durationLabel:void 0!==b?`${b}s`:null,isStreaming:c,buttonStyle:{width:"100%",padding:"6px 10px",fontSize:12},containerStyle:{fontSize:13},contentStyle:{background:"var(--bg-panel)"}})}function s({block:a,result:b,duration:c,isStreaming:e,cwd:f}){let g=(0,j.s2)(b,e),h=(0,j.Gb)(g),k="bash"===a.toolName;return(0,d.jsx)(i.Dm,{tool:a,result:b,status:g,durationLabel:void 0!==c?`${c}s`:null,cwd:f,titleStyle:{color:h},collapsedPreviewBackground:`color-mix(in srgb, ${h} 5%, transparent)`,buttonStyle:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"6px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",minWidth:0},containerStyle:{border:`1px solid color-mix(in srgb, ${h} 38%, transparent)`,background:`color-mix(in srgb, ${h} 8%, transparent)`},notebookStyle:k})}var t=c(39868);function u(a=768){let[b,c]=(0,e.useState)(!1);return b}function v({children:a,hovered:b,onHoverChange:c,style:e}){return(0,d.jsx)("div",{style:e,onMouseEnter:()=>c?.(!0),onMouseLeave:()=>c?.(!1),"data-message-hovered":b?"true":"false",children:a})}function w({children:a,justify:b="flex-start",style:c}){let e=u();return(0,d.jsx)("div",{"data-message-surface":"footer",style:{display:"flex",alignItems:"center",justifyContent:b,gap:e?4:6,marginTop:4,...c},children:a})}function x({children:a,alignEnd:b=!1,style:c}){return(0,d.jsx)("span",{"data-message-surface":"timestamp",style:{fontSize:10,color:"var(--text-dim)",marginLeft:b?"auto":void 0,...c},children:a})}function y({children:a,visible:b,style:c}){return(0,d.jsx)("div",{style:{display:"flex",gap:3,opacity:+!!b,pointerEvents:b?"auto":"none",transition:"opacity 0.12s",...c},children:a})}function z({children:a,onClick:b,disabled:c=!1,title:e,active:f=!1,style:g,onMouseEnterColor:h="var(--accent)",onMouseLeaveColor:i="var(--text-dim)",iconOnlyOnMobile:j=!1}){let k=u();return(0,d.jsx)("button",{onClick:b,disabled:c,title:e,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:c?"not-allowed":"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...g},onMouseEnter:a=>{c||(a.currentTarget.style.color=h)},onMouseLeave:a=>{c||(a.currentTarget.style.color=i)},children:j&&k&&Array.isArray(a)?a[0]:a})}function A({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16,display:"flex",flexDirection:"column",alignItems:"flex-end"},children:a})}function B({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:b?4:6,maxWidth:b?"92%":"85%"},children:(0,d.jsx)("div",{style:{flex:1,minWidth:0,background:"var(--user-bg)",border:"1px solid rgba(59,130,246,0.2)",borderRadius:12,padding:b?"7px 10px":"8px 12px",fontSize:14,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})})}function C({children:a,hasBody:b=!1}){let c=u();return(0,d.jsx)("div",{style:{display:"flex",gap:c?4:6,flexWrap:"wrap",marginBottom:b?c?6:8:0},children:a})}function D({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16},children:a})}function E({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:b?6:8},children:a})}function F({children:a,accent:b="default"}){let c="subagent"===b;return(0,d.jsx)("div",{"data-message-surface":"custom-card","data-message-accent":b,style:{padding:"8px 14px",borderRadius:8,border:`1px solid ${c?"rgba(99,102,241,0.25)":"var(--border)"}`,background:c?"rgba(99,102,241,0.05)":"var(--bg-panel)",fontSize:13,lineHeight:1.6,color:"var(--text-muted)"},children:a})}function G({icon:a,children:b}){return(0,d.jsxs)("div",{"data-message-surface":"custom-icon-row",style:{display:"flex",alignItems:"flex-start",gap:8},children:[(0,d.jsx)("span",{style:{flexShrink:0,fontSize:14},children:a}),(0,d.jsx)("div",{style:{flex:1,minWidth:0},children:b})]})}function H({text:a,title:b="Copy message",style:c}){let[f,g]=(0,e.useState)(!1),h=u();return(0,d.jsxs)("button",{onClick:()=>{(0,t.D)(a).then(()=>{g(!0),setTimeout(()=>g(!1),1500)})},title:b,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...c},onMouseEnter:a=>{f||(a.currentTarget.style.color="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.color="var(--text-dim)")},children:[f?(0,d.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,d.jsx)("span",{style:h?{display:"none"}:void 0,children:f?"Copied":"Copy"})]})}function I({provider:a,model:b,modelNames:c,isStreaming:e=!1,estimatedTokens:f=0,tps:g=null}){let h=a&&b?c?.[`${a}:${b}`]??c?.[b]??b:null;return(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:4,display:"flex",alignItems:"center",gap:6},children:[h&&(0,d.jsx)("span",{children:h}),e&&f>0&&(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:"var(--text)"},title:"预估 token 数(流式接收中)",children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11,fontWeight:400},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,d.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),f]}),null!==g&&(0,d.jsxs)("span",{style:{marginLeft:6,padding:"1px 6px",borderRadius:4,background:g>=50?"#53b3cb":g>=30?"#9bc53d":g>=15?"#f9c22e":"#e01a4f",color:"#fff",fontSize:11,fontWeight:400},children:[g.toFixed(1)," t/s"]})]})]})}var J=c(27563);let K=[],L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(a){return a.toString().padStart(2,"0")}function N(a){if(!a)return null;let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear()&&b.getMonth()===c.getMonth()&&b.getDate()===c.getDate(),e=`${M(b.getHours())}:${M(b.getMinutes())}`;if(d)return e;let f=[`${L[b.getMonth()]} ${b.getDate()}`];b.getFullYear()!==c.getFullYear()&&f.push(String(b.getFullYear()));let g=f.join(", ");return`${g} ${e}`}function O({message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,onFork:g,forking:h,onNavigate:i,prevAssistantEntryId:j,onEditContent:k,onSendMessage:l,showTimestamp:m,prevTimestamp:n,renderVisualCodeBlocks:o,cwd:p,onOpenImage:q,activeFilePath:r,agentRunning:s,onApplyToFile:t,onRunCode:u,onOpenFileAtLine:v,onAcceptDiff:w}){return"user"===a.role?(0,d.jsx)(P,{message:a,entryId:f,onFork:g,forking:h,onNavigate:i,prevAssistantEntryId:j,onEditContent:k,onOpenImage:q}):"assistant"===a.role?(0,d.jsx)(Q,{message:a,isStreaming:b,toolResults:c,modelNames:e,onSendMessage:l,showTimestamp:m,prevTimestamp:n,renderVisualCodeBlocks:o,cwd:p,activeFilePath:r,agentRunning:s,onApplyToFile:t,onRunCode:u,onOpenFileAtLine:v,onAcceptDiff:w}):"toolResult"===a.role?null:"custom"===a.role?(0,d.jsx)(R,{message:a,showTimestamp:m}):null}function P({message:a,entryId:b,onFork:c,forking:f,onNavigate:g,prevAssistantEntryId:h,onEditContent:i,onOpenImage:j}){let[l,m]=(0,e.useState)(!1),n="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),o="string"==typeof a.content?[]:a.content.filter(a=>"image"===a.type),p=o.flatMap(a=>{let b=(0,k.h5)(a);return b?[{src:b}]:[]}),q=N(a.timestamp),r=!!b&&!!c,s=!!h&&!!g;return(0,d.jsxs)(A,{hovered:l,onHoverChange:m,children:[(0,d.jsxs)(B,{children:[o.length>0&&(0,d.jsx)(C,{hasBody:!!n,children:o.map((a,b)=>{let c=(0,k.h5)(a);if(!c)return null;let e=a.path&&c.startsWith("/api/files/");return(0,d.jsx)("a",{href:c,target:e||!j?"_blank":void 0,rel:e||!j?"noreferrer":void 0,title:"Open image",style:{display:"block",cursor:"zoom-in"},onClick:a=>{j&&(a.preventDefault(),j(c,void 0,p))},children:(0,d.jsx)("img",{src:c,alt:"",style:{maxWidth:240,maxHeight:240,borderRadius:6,objectFit:"contain",display:"block",border:"1px solid rgba(59,130,246,0.15)"}})},b)})}),n]}),(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[(0,d.jsx)(y,{visible:l,children:(0,d.jsx)(H,{text:n})}),(r||s)&&(0,d.jsxs)(y,{visible:l||!!f,children:[s&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{g(h),i?.(n)},title:"Edit from here — branches within this session",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("polyline",{points:"15 10 20 15 15 20"}),(0,d.jsx)("path",{d:"M4 4v7a4 4 0 0 0 4 4h12"})]}),"Edit from here"]}),r&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{c(b)},disabled:f,active:!!f,title:f?"Creating new session…":"New session — creates an independent copy from here",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),f?"Creating…":"New session"]})]}),q&&(0,d.jsx)(x,{children:q})]})]})}function Q({message:a,isStreaming:b,toolResults:c,modelNames:f,onSendMessage:g,showTimestamp:h,prevTimestamp:i,renderVisualCodeBlocks:j,cwd:k,activeFilePath:l,agentRunning:m,onApplyToFile:o,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:r}){var s;let t,u=h?N(a.timestamp):null,v=a.content??K,[z,A]=(0,e.useState)(!1);(0,e.useRef)(null),(0,e.useRef)(new Map);let B=(0,e.useRef)(v),[C,F]=(0,e.useState)(null),[G,L]=(0,e.useState)(new Map);B.current=v;let M=(0,e.useMemo)(()=>{if(!a.timestamp||!i)return;let b=Math.round((a.timestamp-i)/1e3);return b>0?b:void 0},[a.timestamp,i]),O=(0,e.useMemo)(()=>(function(a,b){let c=new Map;if(!a||!b)return c;for(let[d,e]of a){if(!e.timestamp)continue;let a=Math.round((e.timestamp-b)/1e3);a>0&&c.set(d,a)}return c})(c,a.timestamp),[c,a.timestamp]),P=(0,e.useMemo)(()=>(function(a,b,c){let d=[],e=[],f=[];for(let[g,h]of a.entries()){if("thinking"===h.type){e.push({content:h.thinking,duration:b.get(g)??c});continue}if("toolCall"===h.type){d.push(h);continue}f.push(h)}return{tools:d,thinkingBlocks:e,visibleBlocks:f}})(v,G,M),[v,G,M]),R=(0,e.useMemo)(()=>v.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),[v]),S=(0,e.useMemo)(()=>Math.round(function(a){let b=0;for(let c of a){if("text"===c.type){b+=c.text.length;continue}if("thinking"===c.type){b+=c.thinking.length;continue}"toolCall"===c.type&&(b+=JSON.stringify(c.input??{}).length)}return b}(v)/4),[v]);return(0,d.jsxs)(D,{hovered:z,onHoverChange:A,children:[(0,d.jsx)(I,{provider:a.provider,model:a.model,modelNames:f,isStreaming:b,estimatedTokens:S,tps:C}),(0,d.jsxs)(E,{children:[(P.tools.length>0||P.thinkingBlocks.length>0)&&(0,d.jsx)(J.kD,{tools:P.tools,results:c,durations:O,thinkingBlocks:P.thinkingBlocks,isStreaming:b,cwd:k}),P.visibleBlocks.map((a,e)=>(0,d.jsx)(n,{block:a,toolResults:c,isStreaming:b,toolCallDurations:O,onSendMessage:g,renderVisualCodeBlocks:j,cwd:k,activeFilePath:l,agentRunning:m,onApplyToFile:o,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:r},e))]}),(0,d.jsxs)(w,{style:{gap:8},children:[a.usage&&!b&&(0,d.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:(s=a.usage,t=[],s.input&&t.push(`${s.input.toLocaleString()} in`),s.output&&t.push(`${s.output.toLocaleString()} out`),s.cacheRead&&t.push(`${s.cacheRead.toLocaleString()} cache`),s.cost?.total&&t.push(`$${s.cost.total.toFixed(4)}`),t.join(" \xb7 "))}),R&&!b&&(0,d.jsx)(y,{visible:z,children:(0,d.jsx)(H,{text:R})}),u&&(0,d.jsx)(x,{alignEnd:!0,children:u})]})]})}function R({message:a,showTimestamp:b}){if(!a.display)return null;let c=b?N(a.timestamp):null,e="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),g="subagent-notify"===a.customType,h=e.match(/^Background task (completed|failed|paused):\s*\*\*(.+?)\*\*/),i=h?"completed"===h[1]?"✅":"failed"===h[1]?"❌":"⏸":g?"\uD83E\uDD16":"ℹ";return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsx)(F,{accent:g?"subagent":"default",children:(0,d.jsx)(G,{icon:i,children:(0,d.jsx)("div",{"data-message-surface":"custom-body",children:(0,d.jsx)(f.T,{content:e,style:{fontSize:13}})})})}),(c||h)&&(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[h&&(0,d.jsx)(x,{children:h[2]}),c&&(0,d.jsx)(x,{children:c})]})]})}},63956:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},65950:(a,b,c)=>{"use strict";c.d(b,{aU:()=>f,cx:()=>e,nS:()=>r,Rd:()=>q,wY:()=>p,tG:()=>m});class d{#a;#b;constructor(a){this.#b=new Map,this.#a=a}get(a){if(!this.#b.has(a))return;let b=this.#b.get(a);return this.#b.delete(a),this.#b.set(a,b),b}set(a,b){for(this.#b.has(a)&&this.#b.delete(a);this.#b.size>=this.#a;){let a=this.#b.keys().next().value;if(void 0===a)break;this.#b.delete(a)}this.#b.set(a,b)}delete(a){this.#b.delete(a)}get size(){return this.#b.size}}let e="github-light",f="github-dark",g=new d(10),h=new d(200),i=new Set,j=new Map,k=null;function l(a,b,c){let d=a.slice(0,100),e=a.length>100?a.slice(-100):"";return`${b}:${c}:${a.length}:${d}:${e}`}function m(a){return void 0===a||0===a?{}:{fontStyle:1&a?"italic":void 0,fontWeight:2&a?700:void 0,textDecorationLine:4&a?"underline":void 0}}function n(){return k||(k=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===i.size){for(let b of Object.keys(a.bundledLanguages??{}))i.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])j.set(c.toLowerCase(),a)}}return a})),k}async function o(a,b=e,c=f){let d=`${a}:${b}:${c}`,h=g.get(d);if(h)return h;let i=n().then(({createHighlighter:d})=>d({langs:[a],themes:[b,c]})).catch(a=>{throw g.delete(d),a});return g.set(d,i),i}function p(a,b,c,d){let g=q(a,b,c);if(g)return g;let k=c?f:e,m=b.trim().toLowerCase();if(!m)return null;let p=l(a,m,k);return n().then(()=>{let c,g=(c=b.trim().toLowerCase())?i.has(c)?c:j.get(c)??null:null;return g?o(g,e,f).then(b=>{let c=b.codeToTokens(a,{lang:g,theme:k}),e={bg:c.bg??"transparent",fg:c.fg??"inherit",tokens:c.tokens};return h.set(p,e),d(e),e}):null}).catch(a=>{console.warn("[Shiki] highlight failed:",a)}),null}function q(a,b,c){let d=b.trim().toLowerCase();if(!d)return null;let g=l(a,d,c?f:e);return h.get(g)??null}function r(a){return{bg:"transparent",fg:"inherit",tokens:a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(a=>""===a?[]:[{color:"inherit",content:a}])}}},73383:(a,b,c)=>{"use strict";c.d(b,{pm:()=>k});var d=c(48249),e=c(67484),f=c(54097),g=c(84573),h=c(40648);function i({expanded:a,onToggle:b,durationLabel:c,isStreaming:e=!1,leading:f,label:j="Thinking",buttonStyle:k,labelStyle:l,durationStyle:m}){return(0,d.jsxs)(g.R,{expanded:a,onToggle:b,buttonStyle:{width:"100%",display:"flex",alignItems:"center",gap:7,minWidth:0,textAlign:"left",cursor:"pointer",border:"none",background:"transparent",color:"var(--text-muted)",...k},children:[f,(0,d.jsx)("span",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1,...l},children:e?(0,d.jsx)(h.n,{children:j}):j}),c&&(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...m},children:c})]})}function j({content:a,contentStyle:b}){return(0,d.jsx)(f.p,{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",...b},children:(0,d.jsx)("div",{style:{padding:"8px 10px"},children:a})})}function k({content:a,durationLabel:b,isStreaming:c=!1,leading:g,label:h="Thinking",containerStyle:l,buttonStyle:m,labelStyle:n,durationStyle:o,contentStyle:p}){let[q,r]=(0,e.useState)(!1);return(0,d.jsxs)(f.t,{kind:"thinking",style:l,children:[(0,d.jsx)(i,{expanded:q,onToggle:()=>r(a=>!a),durationLabel:b,isStreaming:c,leading:g,label:h,buttonStyle:m,labelStyle:n,durationStyle:o}),q&&(0,d.jsx)(j,{content:a,contentStyle:p})]})}},78335:()=>{},80251:(a,b,c)=>{"use strict";function d(a,b){for(let c of b){let b=a[c];if(null!=b&&""!==b)return String(b)}return null}function e(a,b=60){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function f(a){let b=a.toLowerCase().split("__").filter(Boolean);return b[b.length-1]??a.toLowerCase()}function g(a,b=120){let c=Object.keys(a);return 0===c.length?"":"command"in a?String(a.command).slice(0,b):"cmd"in a?String(a.cmd).slice(0,b):"path"in a?String(a.path).slice(0,b):"file_path"in a?String(a.file_path).slice(0,b):"pattern"in a?String(a.pattern).slice(0,b):"query"in a?String(a.query).slice(0,b):String(a[c[0]]).slice(0,b)}function h(a){let b=a.toolName||"tool",c=f(b),g=a.input??{};if(["bash","execute","run","shell","exec_command","execute_command"].includes(c))return{canonicalName:c,kind:"terminal",label:"Shell",summary:e(d(g,["command","cmd"])??b,60)};if(["read","readfile","read_file"].includes(c))return{canonicalName:c,kind:"read",label:"Read",summary:e(d(g,["file_path","path"])??b,60)};if(["write","edit","write_file","create_file","notebook_edit"].includes(c)){let a,f=d(g,["file_path","path","notebook_path","filename"]);return{canonicalName:c,kind:"edit",label:"Edit",summary:e(f?(a=f.split(/[\\/]/).filter(Boolean))[a.length-1]??f:b,60)}}if(["search","grep","glob","find","find_files","websearch"].includes(c))return{canonicalName:c,kind:"search",label:"Search",summary:e(d(g,["pattern","query","glob"])??b,60)};if(["subagent","agent"].includes(c))return{canonicalName:c,kind:"agent",label:"Agent",summary:e([d(g,["agent","name","agentName"]),d(g,["prompt","task","message"])].filter(Boolean).join(": ")||b,60)};let h=d(g,["command","cmd","path","file_path","pattern","query","glob","prompt","description"])??function(a){try{return JSON.stringify(a)}catch{return String(a)}}(g)??b;return{canonicalName:c,kind:"tool",label:e(b,60),summary:e(h,60)}}c.d(b,{WI:()=>f,Wm:()=>g,wS:()=>h})},82704:()=>{},84573:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(48249);function e({expanded:a,onToggle:b,children:c,title:f,buttonStyle:g,chevronColor:h="var(--text-dim)",chevronStyle:i}){return(0,d.jsxs)("button",{type:"button",onClick:b,"aria-expanded":a,title:f,style:g,children:[c,(0,d.jsx)("span",{style:{display:"inline-flex",color:h,transform:a?"rotate(180deg)":"none",transition:"transform 0.15s",flexShrink:0,...i},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})})]})}},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg",!0)+"?6eceb6fbd1a5bb90"}]},90707:(a,b,c)=>{"use strict";c.d(b,{h:()=>N});var d=c(48249),e=c(67484),f=c(52515),g=c(32492);function h({dir:a}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:"asc"===a?(0,d.jsx)("polyline",{points:"2 6 5 3 8 6"}):(0,d.jsx)("polyline",{points:"2 4 5 7 8 4"})})}function i(a,b,c){let d=new Blob([a],{type:c}),e=URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.download=b,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(e),1e3)}function j({content:a,delimiter:b,fileName:c="table"}){let[f,g]=(0,e.useState)(null),[k,l]=(0,e.useState)("asc"),{header:m,rows:n}=(0,e.useMemo)(()=>(function(a,b){let c=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=[],e=[],f="",g=!1;for(let a=0;a<c.length;a+=1){let h=c[a];if('"'===h){g&&'"'===c[a+1]?(f+='"',a+=1):g=!g;continue}if(h===b&&!g){e.push(f),f="";continue}if("\n"===h&&!g){e.push(f),e.some(a=>a.length>0)&&d.push(e),e=[],f="";continue}f+=h}e.push(f),e.some(a=>a.length>0)&&d.push(e);let h=d[0]??[],i=h.length;return{header:h,rows:d.slice(1).map(a=>{let b=[...a];for(;b.length<i;)b.push("");return b.slice(0,i)})}})(a,b),[a,b]),o=(0,e.useMemo)(()=>{if(null===f)return n;let a=[...n];return a.sort((a,b)=>{let c=a[f]??"",d=b[f]??"",e=Number(c),g=Number(d),h=""===c||""===d||Number.isNaN(e)||Number.isNaN(g)?c.localeCompare(d):e-g;return"asc"===k?h:-h}),a},[n,k,f]);return 0===m.length&&0===n.length?(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:"No tabular data to display"}):(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:[(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:[n.length," rows, ",m.length," columns"]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,d.jsxs)("button",{onClick:()=>{i(a,c," "===b?"text/tab-separated-values;charset=utf-8":"text/csv;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:["Export "," "===b?"TSV":"CSV"]}),(0,d.jsx)("button",{onClick:()=>{i(JSON.stringify(o.map(a=>Object.fromEntries(m.map((b,c)=>[b||`column_${c+1}`,a[c]??""]))),null,2),c.replace(/\.[^.]+$/,"")+".json","application/json;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:"Export JSON"})]})]}),(0,d.jsx)("div",{style:{minHeight:0,flex:1,overflow:"auto",background:"var(--bg)"},children:(0,d.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:12},children:[(0,d.jsx)("thead",{style:{position:"sticky",top:0,zIndex:1,background:"var(--bg-panel)"},children:(0,d.jsx)("tr",{children:m.map((a,b)=>(0,d.jsx)("th",{onClick:()=>{f===b?l(a=>"asc"===a?"desc":"asc"):(g(b),l("asc"))},title:a,style:{padding:"8px 10px",borderBottom:"1px solid var(--border)",textAlign:"left",color:"var(--text-muted)",fontWeight:600,cursor:"pointer",userSelect:"none",fontSize:11,whiteSpace:"nowrap"},children:(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a||`column_${b+1}`}),f===b&&(0,d.jsx)("span",{style:{color:"var(--accent)",display:"inline-flex",flexShrink:0},children:(0,d.jsx)(h,{dir:k})})]})},`${a}-${b}`))})}),(0,d.jsx)("tbody",{children:o.map((a,b)=>(0,d.jsx)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.14)",background:b%2==1?"var(--bg-subtle)":"transparent"},children:m.map((c,e)=>(0,d.jsx)("td",{title:a[e]??"",style:{padding:"6px 10px",color:"var(--text)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:0},children:a[e]??""},`${c}-${b}-${e}`))},b))})]})})]})}var k=c(19581),l=c(39868),m=c(65950);let n={display:"inline-block",minWidth:"3em",paddingRight:"1em",textAlign:"right",color:"var(--text-dim)",fontStyle:"normal",userSelect:"none"};function o({code:a,language:b,isDark:c,wrapLines:f=!1,scrollToLine:g}){let h="text"===b||"csv"===b||"tsv"===b?"plaintext":b||"plaintext",i=a.split("\n").length,j=(0,e.useRef)(new Map),p=(0,e.useMemo)(()=>(0,m.Rd)(a,h,c),[a,c,h]),[q,r]=(0,e.useState)(()=>p?.tokens??null);(0,e.useRef)("");let s=(0,e.useMemo)(()=>(0,m.nS)(a).tokens,[a]),t=q??p?.tokens??s;return(0,d.jsxs)(k.NG,{style:{border:"none",borderRadius:0,minHeight:"100%"},children:[(0,d.jsx)(k.iO,{title:`${h} \xb7 ${i} lines`,actions:(0,d.jsx)(k.Mi,{onClick:()=>{(0,l.D)(a)},ariaLabel:"Copy file contents",title:"Copy file contents",label:"copy"}),style:{padding:"4px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"}}),(0,d.jsx)("pre",{style:{margin:0,padding:"12px 0",background:"var(--bg)",fontSize:13,lineHeight:1.6,fontFamily:"var(--font-mono)",minHeight:"100%",overflow:"auto",whiteSpace:f?"pre-wrap":"pre",wordBreak:f?"break-word":void 0},children:(0,d.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:t.map((a,b)=>{let c=b+1,e=g===c;return(0,d.jsxs)("span",{ref:a=>{a?j.current.set(c,a):j.current.delete(c)},style:{display:"block",background:e?"color-mix(in srgb, var(--accent) 14%, transparent)":void 0},children:[(0,d.jsx)("span",{style:n,children:c}),0===a.length?"\n":a.map((a,b)=>{let c=(0,m.tG)(a.fontStyle);return(0,d.jsx)("span",{style:{color:a.color??"inherit",...c},children:a.content},b)})]},b)})})})]})}var p=c(51415),q=c(31343);function r(a){return`/api/files/${(0,q.HG)(a)}?type=read&raw=1`}async function s(a){let b=await fetch(r(a),{method:"HEAD"});if(!b.ok){let a=`HTTP ${b.status}`;try{let c=await b.json().catch(()=>null);c?.error&&(a=c.error)}catch{}throw Error(a)}let c=document.createElement("a");c.href=r(a),c.download=(0,q.WP)(a),c.style.display="none",document.body.appendChild(c),c.click(),document.body.removeChild(c)}function t({filePath:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(null);return(0,d.jsx)("button",{onClick:()=>{g(null),c(!0),s(a).catch(a=>g(a instanceof Error?a.message:String(a))).finally(()=>c(!1))},disabled:b,title:f??"Download original file",style:{padding:"2px 10px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5,fontWeight:600,opacity:b?.7:1,...f?{borderColor:"#ef4444",color:"#ef4444"}:{}},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--accent)",a.currentTarget.style.color="#fff",a.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.background="var(--bg-hover)",a.currentTarget.style.color="var(--text-muted)",a.currentTarget.style.borderColor="var(--border)")},children:b?"Downloading…":"Download"})}var u=c(2857);function v(a){let b=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".",c=(0,q.HG)(b);return`/api/files/${c}/?type=read&raw=1`}function w({oldContent:a,newContent:b,language:c}){let e=function(a,b){let c=a.length,d=b.length,e=c+d,f=Array(2*e+1).fill(0),g=[];for(let h=0;h<=e;h++){g.push([...f]);for(let i=-h;i<=h;i+=2){let j,k=(j=i===-h||i!==h&&f[i-1+e]<f[i+1+e]?f[i+1+e]:f[i-1+e]+1)-i;for(;j<c&&k<d&&a[j]===b[k];)j++,k++;if(f[i+e]=j,j>=c&&k>=d){let f=[],i=c,j=d;for(let c=h;c>0;c--){let d,h=g[c-1],k=i-j;d=k===-c||k!==c&&h[k-1+e]<h[k+1+e]?k+1:k-1;let l=h[d+e],m=l-d;for(;i>l&&j>m;)i--,j--,f.unshift({type:"unchanged",text:a[i],lineNo:i+1});c>0&&(i>l?(i--,f.unshift({type:"removed",text:a[i],lineNo:i+1})):(j--,f.unshift({type:"added",text:b[j],lineNo:j+1})))}for(;i>0&&j>0;)i--,j--,f.unshift({type:"unchanged",text:a[i],lineNo:i+1});return f}}}return[...a.map((a,b)=>({type:"removed",text:a,lineNo:b+1})),...b.map((a,b)=>({type:"added",text:a,lineNo:b+1}))]}(a.split("\n"),b.split("\n"));return(0,d.jsx)(f.pg,{diff:e})}function x({filePath:a,cwd:b,onOpenFile:c,scrollToLine:h}){let i,{isDark:k}=(0,u.D)(),[l,m]=(0,e.useState)(null),[n,r]=(0,e.useState)(null),[s,y]=(0,e.useState)(!0),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)("source"),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(0),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(0),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null);(0,e.useRef)(null),(0,e.useRef)(!1).current=P;let _=(0,e.useCallback)((a,b=!1)=>{let c=(0,q.HG)(a);return fetch(`/api/files/${c}?type=read`).then(a=>a.json()).then(a=>a.error?(A(a.error),null):(b?(m(b=>(b&&r(b.content),a)),O(a=>a+1)):m(a),A(null),a)).catch(a=>(A(String(a)),null))},[]),aa=(0,e.useCallback)(()=>{l&&(Q(!0),S(l.content),$(l.mtime??null),Y(!1),C(null),W(!1),E(!1),G("source"))},[l]),ab=(0,e.useCallback)(async(b=!1)=>{let c=(0,q.HG)(a);U(!0),Y(!1),C(null);try{let d=await fetch(`/api/files/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:R,...b||!Z?{}:{baseMtime:Z}})});if(409===d.status){let a=await d.json().catch(()=>({error:"File changed on disk since it was opened"}));throw Y(!0),W(!0),Error(a.error??"File changed on disk since it was opened")}if(!d.ok){let a=await d.json().catch(()=>({error:String(d.status)}));throw Error(a.error??`HTTP ${d.status}`)}let e=await _(a,!0);$(e?.mtime??null),Q(!1),W(!1),Y(!1)}catch(a){C(a instanceof Error?a.message:String(a))}finally{U(!1)}},[Z,R,_,a]),ac=(0,e.useCallback)(()=>{Q(!1),W(!1),Y(!1),C(null),$(null)},[]),ad=(0,e.useCallback)(()=>{K(a=>a+1)},[]),ae=(0,e.useCallback)(async()=>{let b=await _(a,!0);b&&(S(b.content),$(b.mtime??null),W(!1),Y(!1),C(null),A(null))},[_,a]),af=l?.content??"",ag=l?.language??"",ah="html"===ag,ai="markdown"===ag,aj="csv"===(i=(0,q.WP)(a).toLowerCase().split(".").pop()??"")?",":"tsv"===i?" ":null,ak=null!==aj,al=af.split("\n"),am=null!==l&&null!==n&&n!==af,an=(0,e.useMemo)(()=>{let b,c,d;return ah?(b=v(a),c=`<base href="${b}">`,d=af,(d=/<head(\s[^>]*)?>/i.test(d)?d.replace(/<head(\s[^>]*)?>/i,a=>`${a}${c}`):/<html(\s[^>]*)?>/i.test(d)?d.replace(/<html(\s[^>]*)?>/i,a=>`${a}<head>${c}</head>`):`<!doctype html><html><head>${c}</head><body>${d}</body></html>`).replace(/<script\b/gi,'<script data-annovibe-disabled="true" type="application/json"').replace(/\s(?:on[a-z]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"")):""},[af,a,ah]),ao=!ah&&!ai&&!ak&&al.length>5e4,ap=ak&&(al.length>5e3||al.slice(0,25).reduce((a,b)=>Math.max(a,b.split(aj??",").length),0)>100),aq=(0,e.useMemo)(()=>{if(!ah)return"";let b=v(a).includes("?")?"&":"?";return`${v(a)}${encodeURIComponent((0,q.WP)(a))}${b}v=${J}`},[a,J,ah]);return s?(0,d.jsx)(f.nG,{children:"Loading..."}):z?(0,d.jsx)(f.nG,{tone:"error",children:z}):l?(0,d.jsxs)(f.fj,{children:[(0,d.jsx)(f.K$,{pathLabel:(0,q.qP)(a,b),title:a,trailing:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:l.language}),"source"===F&&(0,d.jsxs)("span",{children:[al.length," lines"]}),(0,d.jsx)("span",{children:(0,f.v7)(l.size)}),(0,d.jsx)(t,{filePath:a}),(0,d.jsx)(f.mK,{watching:L}),P?(0,d.jsxs)(d.Fragment,{children:[(V||X||B)&&(0,d.jsxs)("span",{title:"File changed on disk while editing",style:{padding:"2px 8px",fontSize:11,background:"rgba(234,179,8,0.1)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:5,display:"flex",alignItems:"center",gap:4},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,d.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),B??"External change",(V||X)&&(0,d.jsx)(f.ml,{onClick:ae,style:{marginLeft:4,fontSize:10,background:"rgba(234,179,8,0.2)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:3,fontWeight:600},children:"Reload"}),X&&(0,d.jsx)(f.ml,{onClick:()=>void ab(!0),disabled:T,emphasis:"danger",style:{marginLeft:4,fontSize:10,borderRadius:3,fontWeight:600},children:"Overwrite"})]}),(0,d.jsx)(f.ml,{onClick:()=>void ab(),disabled:T,title:"Save file (Ctrl+S)",emphasis:"primary",style:{fontWeight:600},children:T?"Saving…":"Save"}),(0,d.jsx)(f.ml,{onClick:ac,title:"Cancel editing",emphasis:"danger",style:{fontWeight:600},children:"Cancel"})]}):(0,d.jsx)(f.ml,{onClick:aa,title:"Edit file",style:{fontWeight:600},children:"Edit"}),am&&(0,d.jsx)(f.Tg,{options:[{key:"source",label:"Source",active:"source"===F,onClick:()=>G("source")},{key:"diff",label:(0,d.jsxs)(d.Fragment,{children:["Diff ",N>0&&(0,d.jsxs)("span",{style:{color:"#4ade80",marginLeft:2},children:["+",N]})]}),active:"diff"===F,onClick:()=>G("diff")}]}),"source"===F&&!D&&(0,d.jsx)(f.ml,{onClick:()=>I(a=>!a),title:H?"Disable word wrap":"Enable word wrap",active:H,children:"wrap"}),ah&&D&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.ml,{onClick:ad,title:"Reload the HTML preview",children:"Refresh preview"}),aq&&(0,d.jsx)(f.ml,{onClick:()=>window.open(aq,"_blank","noopener,noreferrer"),title:"Open HTML preview in a new tab",children:"Open in new tab"})]}),ah&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"code",label:"Code",active:!D,onClick:()=>E(!1)},{key:"preview",label:"Preview",active:D,onClick:()=>E(!0)}]}),ai&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"preview",label:"Preview",active:D,onClick:()=>E(!0)},{key:"raw",label:P?"Edit":"Raw",active:!D,onClick:()=>E(!1)}]}),ak&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"table",label:"Table",active:D,onClick:()=>E(!0)},{key:"raw",label:"Raw",active:!D,onClick:()=>E(!1)}]})]})}),(0,d.jsx)(f.Ph,{children:P&&!(ai&&D)?(0,d.jsx)(g.g,{initialContent:R,language:l.language,isDark:k,onChange:S,onSave:()=>void ab(),scrollToLine:h}):P&&ai&&D?(0,d.jsx)(p.T,{content:R,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:b,baseFilePath:a,onOpenLocalFile:c,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):"diff"===F&&am?(0,d.jsx)(w,{oldContent:n,newContent:l.content,language:l.language}):ah&&D?(0,d.jsx)("iframe",{srcDoc:an,sandbox:"",style:{width:"100%",height:"100%",border:"none",background:"var(--bg)"},title:"HTML preview"},J):ai&&D?(0,d.jsx)(p.T,{content:l.content,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:b,baseFilePath:a,onOpenLocalFile:c,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):ak&&D&&aj?ap?(0,d.jsx)(f.nG,{children:"Table preview disabled for very large files. Switch to Raw mode or export the file."}):(0,d.jsx)(j,{content:l.content,delimiter:aj,fileName:(0,q.WP)(a)}):ao?(0,d.jsx)(f.nG,{children:"Text preview is too large for the rich viewer. Use Edit/Raw workflows instead."}):(0,d.jsx)(o,{code:l.content,language:l.language,isDark:k,wrapLines:H,scrollToLine:h})})]}):null}var y=c(92002),z=c(12440);function A({arrayBuffer:a,fileName:b,toolbarExtra:c}){let g=(0,e.useRef)(null),[h,i]=(0,e.useState)(!0),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(0),[n,o]=(0,e.useState)(1),[p,q]=(0,e.useState)(1);return(0,e.useRef)(p).current=p,(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useCallback)(async a=>{},[]),(0,d.jsx)(z.B,{fileName:b,pageInfo:l>0?`Page ${n} / ${l}`:void 0,zoom:p,onZoomIn:()=>q(a=>Math.min(a+.25,3)),onZoomOut:()=>q(a=>Math.max(a-.25,.25)),loading:h,loadingLabel:"Loading PDF...",error:j,bodyStyle:{background:"#525659",display:"flex",justifyContent:"center",padding:16},extra:(0,d.jsxs)(d.Fragment,{children:[c,l>1&&(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,d.jsx)(f.ml,{onClick:()=>o(a=>Math.max(a-1,1)),title:"Previous page",disabled:n<=1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,d.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,d.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[n,"/",l]}),(0,d.jsx)(f.ml,{onClick:()=>o(a=>Math.min(a+1,l)),title:"Next page",disabled:n>=l,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,d.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!h&&!j&&(0,d.jsx)(y.QG,{style:{minWidth:"100%"},children:(0,d.jsx)("div",{ref:g})})})}function B({arrayBuffer:a,fileName:b,toolbarExtra:c}){let f=(0,e.useRef)(null),[g,h]=(0,e.useState)(!0),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(""),m=(0,e.useMemo)(()=>`<!doctype html>
|
|
260
|
+
\`\`\``).find(a=>"widget"===a.type),b?.type==="widget"?{title:b.title,code:b.code}:null);if(c)return(0,d.jsx)(s.u,{code:c.code,isStreaming:!1,title:c.title,onSendMessage:i})}if("report-gallery"===b.trim().toLowerCase()){let b=function(a){try{let b=JSON.parse(a);if(!Array.isArray(b))return null;let c=b.flatMap(a=>a&&"object"==typeof a&&"string"==typeof a.src&&a.src.trim()?[{src:a.src.trim(),alt:"string"==typeof a.alt&&a.alt.trim()?a.alt.trim():void 0,caption:"string"==typeof a.caption&&a.caption.trim()?a.caption.trim():void 0}]:[]);return c.length>0?c.slice(0,12):null}catch{return null}}(a);if(b)return(0,d.jsx)(H,{items:b,baseFilePath:f,cwd:g,onOpenLocalFile:h})}return j&&(w=b.trim().toLowerCase(),(x=a.trim())&&("svg"===w||"xml"===w&&/^<svg[\s>]/i.test(x)?/^<svg[\s>]/i.test(x):!("html"!==w||/<!doctype|<html[\s>]|<head[\s>]|<body[\s>]/i.test(x))&&/^<(style|svg|div|section|article|main|figure|canvas)\b/i.test(x)))?(0,d.jsx)(s.u,{code:a,isStreaming:!1,title:`${b||"visual"} preview`,onSendMessage:i}):(0,d.jsx)(q,{code:a,language:b,variant:c,isStreaming:e,testAsyncDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o})}function L({children:a,className:b,node:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i=!1,isStreaming:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onOpenFileAtLine:p,onAcceptDiff:q,...r}){let s=("string"==typeof a?a:Array.isArray(a)?a.map(a=>"string"==typeof a?a:"").join(""):"").replace(/\n$/,""),t=B(b);return"data-block"in r?(0,d.jsx)(K,{code:s,language:t,variant:"chat",isStreaming:j||!!r["data-incomplete"],baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i,testAsyncCodeDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:q}):(0,d.jsx)(F,{value:s,baseFilePath:e,cwd:f,onOpenLocalFile:g,onOpenFileAtLine:p})}function M({content:a,className:b="markdown-body",style:c,codeBlockVariant:m="chat",baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s=!1,enableImageGallery:t=!1,isStreaming:u=!1,renderer:x="react-markdown",testAsyncCodeDelayMs:z=0,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N}){let O,P,{isDark:Q}=(0,l.D)(),R=t?function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){if(!G(b[d])){c.push(b[d]),d+=1;continue}let a=[],e=d;for(;e<b.length;){let c=G(b[e]);if(!c)break;let d=e+1,f=d;for(;f<b.length&&!b[f].trim();)f+=1;let g=f<b.length?function(a){let b=/^\s*(?:_([^_]+)_|\*([^*]+)\*)\s*$/.exec(a);return(b?.[1]??b?.[2]??"").trim()||null}(b[f]):null;g&&(c.caption=g,d=f+1),a.push(c);let h=d;for(;h<b.length&&!b[h].trim();)h+=1;if(!G(b[h])){e=d;break}e=h}if(a.length>1||a.some(a=>a.caption)){c.push(["```report-gallery",JSON.stringify(a,null,2),"```"].join("\n")),d=e;continue}c.push(b[d]),d+=1}return c.join("\n")}(a):a,S=H?(O=R.split("\n"),P=!1,O.map(a=>/^\s*(```|~~~)/.test(a)?(P=!P,a):P||/\]\([^)]*$/.test(a)?a:a.replace(/(^|[\s([{"'])((?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+)\b/g,(a,b,c)=>`${b}[${c}](${c})`)).join("\n")):R,T=(0,e.useMemo)(()=>u?{cjk:i.h,math:j.D,mermaid:k.a}:{cjk:i.h,math:j.D,mermaid:k.a,code:function(a,b=[n.cx,n.aU]){return y(),{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>[...v],getThemes:()=>b,supportsLanguage(a){let b;return 0===v.size||null!==((b=a.trim().toLowerCase())?v.has(b)?b:w.get(b)??null:null)},highlight(b,c){let d=b.language,e=(0,n.wY)(b.code,d,a,a=>{c?.({tokens:a.tokens,bg:a.bg,fg:a.fg})});return e?{tokens:e.tokens,bg:e.bg,fg:e.fg}:(y(),null)}}}(Q)},[Q,u]);return"streamdown"!==x||o||t?(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(f.oz,{remarkPlugins:[g.A],components:{code({className:a,children:b,node:c}){let e=B(a),f=String(b),g=f.replace(/\n$/,"");return a?.includes("language-")||f.includes("\n")?(0,d.jsx)(K,{code:g,language:e,variant:m,isStreaming:u,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onAcceptDiff:N}):(0,d.jsx)(F,{value:g,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H})},pre:({children:a})=>(0,d.jsx)(d.Fragment,{children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})}):(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(h.jH,{mode:u?"streaming":"static",isAnimating:!!u,plugins:T,components:{code:({children:a,className:b,node:c,...e})=>(0,d.jsx)(L,{...e,node:c,className:b,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,isStreaming:u,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})})}},51810:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},52515:(a,b,c)=>{"use strict";c.d(b,{K$:()=>h,Ph:()=>g,Tg:()=>m,fj:()=>f,mK:()=>i,ml:()=>j,nG:()=>k,pg:()=>l,v7:()=>e});var d=c(48249);function e(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function f({children:a,style:b}){return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",...b},children:a})}function g({children:a,style:b}){return(0,d.jsx)("div",{style:{flex:1,overflow:"auto",background:"var(--bg)",...b},children:a})}function h({pathLabel:a,title:b,trailing:c,style:e}){return(0,d.jsxs)("div",{"data-file-viewer-surface":"status-bar",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 16px",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",background:"var(--bg)",flexShrink:0,...e},children:[(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},title:b??a,children:a}),c]})}function i({watching:a}){return(0,d.jsxs)("span",{title:a?"Live sync active":"Not watching",style:{display:"flex",alignItems:"center",gap:4,color:a?"#4ade80":"var(--text-dim)"},children:[(0,d.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:a?"#4ade80":"var(--border)",display:"inline-block",boxShadow:a?"0 0 4px #4ade80":"none"}}),a?"live":"static"]})}function j({children:a,onClick:b,title:c,disabled:e=!1,active:f=!1,emphasis:g="default",style:h}){let i="primary"==g,k="danger"==g;return(0,d.jsx)("button",{"data-file-viewer-surface":"toolbar-button",onClick:b,disabled:e,title:c,style:{padding:"2px 10px",fontSize:11,cursor:e?"not-allowed":"pointer",background:i?"var(--accent)":k?"rgba(239,68,68,0.1)":f?"var(--bg-selected)":"var(--bg-hover)",color:i?"#fff":k?"#ef4444":f?"var(--text)":"var(--text-muted)",border:`1px solid ${i?"var(--accent)":k?"rgba(239,68,68,0.3)":"var(--border)"}`,borderRadius:5,fontWeight:f||i||k?600:400,opacity:e?.6:1,...h},children:a})}function k({children:a,tone:b="muted",style:c}){return(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",padding:24,color:"error"===b?"#f87171":"var(--text-muted)",fontSize:13,textAlign:"center",...c},children:a})}function l({diff:a,emptyLabel:b="No changes"}){if(!a.some(a=>"unchanged"!==a.type))return(0,d.jsx)("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)"},children:b});let c=new Set(a.flatMap((a,b)=>"unchanged"!==a.type?[b]:[])),e=new Set;for(let b of c)for(let c=Math.max(0,b-3);c<=Math.min(a.length-1,b+3);c++)e.add(c);let f=[],g=0;for(;g<a.length;)if(e.has(g)){let b=[];for(;g<a.length&&e.has(g);)b.push(a[g]),g++;f.push({hidden:!1,lines:b})}else{let b=0;for(;g<a.length&&!e.has(g);)b++,g++;f.push({hidden:!0,count:b})}let h=[],i=1;for(let b of a)"removed"===b.type?h.push(0):h.push(i++);let j=0;return(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.6},children:f.map((a,b)=>{if(a.hidden){let c=(0,d.jsxs)("div",{style:{padding:"2px 16px",color:"var(--text-dim)",background:"var(--bg-panel)",fontSize:11,borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},children:["... ",a.count," unchanged lines ..."]},b);return j+=a.count,c}let c=a.lines.map((a,b)=>{let c=h[j+b],e="added"===a.type?"rgba(0,200,80,0.12)":"removed"===a.type?"rgba(240,60,60,0.14)":"transparent",f="added"===a.type?"+":"removed"===a.type?"-":" ",g="added"===a.type?"#4ade80":"removed"===a.type?"#f87171":"var(--text-dim)";return(0,d.jsxs)("div",{style:{display:"flex",background:e,borderLeft:"added"===a.type?"3px solid #4ade80":"removed"===a.type?"3px solid #f87171":"3px solid transparent"},children:[(0,d.jsx)("span",{style:{minWidth:44,padding:"0 8px 0 16px",textAlign:"right",color:"var(--text-dim)",userSelect:"none",fontSize:11,lineHeight:1.6,borderRight:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:"removed"===a.type?a.lineNo:c||""}),(0,d.jsx)("span",{style:{minWidth:16,padding:"0 6px",color:g,userSelect:"none",flexShrink:0,fontWeight:600},children:f}),(0,d.jsx)("span",{style:{flex:1,padding:"0 8px 0 0",whiteSpace:"pre",color:"var(--text)",overflowX:"auto"},children:a.text||"\xa0"})]},b)});return j+=a.lines.length,(0,d.jsx)("div",{children:c},b)})})}function m({options:a}){return(0,d.jsx)("div",{"data-file-viewer-surface":"segmented-toggle",style:{display:"flex",borderRadius:5,overflow:"hidden",border:"1px solid var(--border)"},children:a.map((a,b)=>(0,d.jsx)("button",{onClick:a.onClick,style:{padding:"2px 8px",fontSize:11,border:"none",borderLeft:0===b?"none":"1px solid var(--border)",cursor:"pointer",background:a.active?"var(--bg-selected)":"var(--bg-hover)",color:a.active?"var(--text)":"var(--text-muted)",fontWeight:a.active?600:400},children:a.label},a.key))})}},54097:(a,b,c)=>{"use strict";c.d(b,{p:()=>f,t:()=>e});var d=c(48249);function e({children:a,style:b,kind:c}){return(0,d.jsx)("div",{"data-disclosure-surface":"panel","data-disclosure-kind":c,style:{border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg-panel)",...b},children:a})}function f({children:a,style:b}){return(0,d.jsx)("div",{"data-disclosure-surface":"body",style:{borderTop:"1px solid var(--border)",...b},children:a})}},57703:(a,b,c)=>{"use strict";c.d(b,{V:()=>h});var d=c(48249),e=c(6954),f=c(40648),g=c(41044);function h({expanded:a,onToggle:b,status:c,title:i,summary:j,durationLabel:k,leading:l,titleTooltip:m,summaryTooltip:n,buttonStyle:o,titleStyle:p,summaryStyle:q,durationStyle:r}){return(0,d.jsxs)(e.R,{expanded:a,onToggle:b,buttonStyle:o,children:[l,(0,d.jsx)("span",{title:m??i,style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:+!j,minWidth:0,flex:j?void 0:1,...p},children:"running"===c?(0,d.jsx)(f.n,{children:i}):i}),j?(0,d.jsx)("span",{title:n??j,style:{color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,...q},children:"running"===c?(0,d.jsx)(f.n,{children:j}):j}):(0,d.jsx)("span",{style:{flex:1,minWidth:0}}),(0,d.jsx)(g.U1,{status:c}),k?(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...r},children:k}):null]})}},60125:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,33071,23))},62418:(a,b,c)=>{"use strict";c.d(b,{D:()=>O});var d=c(48249),e=c(67484),f=c(51415),g=c(40648),h=c(73383),i=c(8033),j=c(41044),k=c(129),l=c(31218),m=c(7952);function n({block:a,toolResults:b,isStreaming:c,streamingDuration:e,toolCallDurations:f,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t}){if("text"===a.type)return(0,d.jsx)(o,{block:a,isStreaming:c,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t});if("image"===a.type)return(0,d.jsx)(k.O7,{images:[a]});if("thinking"===a.type)return(0,d.jsx)(r,{block:a,duration:e,isStreaming:c});let u=b?.get(a.toolCallId),v=f?.get(a.toolCallId);return(0,d.jsx)(s,{block:a,result:u,duration:v,isStreaming:c,cwd:i})}function o({block:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}){let r=a.text,s=(0,m.aH)(r);if(!s.some(a=>"widget"===a.type)){if(b&&(0,m.qk)(r)){let a=s.filter(a=>"text"===a.type).map(a=>a.content).join("\n\n");return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(p,{text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}),(0,d.jsx)(q,{})]})}return(0,d.jsx)(p,{text:r,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n})}return(0,d.jsx)(d.Fragment,{children:s.map((a,m)=>"text"===a.type?(0,d.jsx)(p,{text:a.content,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n},m):(0,d.jsx)(l.u,{code:a.code,isStreaming:!!a.partial,title:a.title,showOverlay:a.showOverlay,onSendMessage:c},m))})}function p({text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:g,cwd:h,activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}){let q=(0,e.useMemo)(()=>(0,k.qn)(a,h),[h,a]);return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8*(q.length>0)},children:[(0,d.jsx)(f.T,{content:a,cwd:h,onWidgetSendMessage:c,renderVisualCodeBlocks:g,isStreaming:b,renderer:"streamdown",activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}),q.length>0&&(0,d.jsx)(k.eR,{imagePaths:q})]})}function q(){return(0,d.jsx)(g.r,{height:88,style:{border:"1px solid var(--border)"}})}function r({block:a,duration:b,isStreaming:c}){return(0,d.jsx)(h.pm,{content:a.thinking,durationLabel:void 0!==b?`${b}s`:null,isStreaming:c,buttonStyle:{width:"100%",padding:"6px 10px",fontSize:12},containerStyle:{fontSize:13},contentStyle:{background:"var(--bg-panel)"}})}function s({block:a,result:b,duration:c,isStreaming:e,cwd:f}){let g=(0,j.s2)(b,e),h=(0,j.Gb)(g),k="bash"===a.toolName;return(0,d.jsx)(i.Dm,{tool:a,result:b,status:g,durationLabel:void 0!==c?`${c}s`:null,cwd:f,titleStyle:{color:h},collapsedPreviewBackground:`color-mix(in srgb, ${h} 5%, transparent)`,buttonStyle:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"6px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",minWidth:0},containerStyle:{border:`1px solid color-mix(in srgb, ${h} 38%, transparent)`,background:`color-mix(in srgb, ${h} 8%, transparent)`},notebookStyle:k})}var t=c(39868);function u(a=768){let[b,c]=(0,e.useState)(!1);return b}function v({children:a,hovered:b,onHoverChange:c,style:e}){return(0,d.jsx)("div",{style:e,onMouseEnter:()=>c?.(!0),onMouseLeave:()=>c?.(!1),"data-message-hovered":b?"true":"false",children:a})}function w({children:a,justify:b="flex-start",style:c}){let e=u();return(0,d.jsx)("div",{"data-message-surface":"footer",style:{display:"flex",alignItems:"center",justifyContent:b,gap:e?4:6,marginTop:4,...c},children:a})}function x({children:a,alignEnd:b=!1,style:c}){return(0,d.jsx)("span",{"data-message-surface":"timestamp",style:{fontSize:10,color:"var(--text-dim)",marginLeft:b?"auto":void 0,...c},children:a})}function y({children:a,visible:b,style:c}){return(0,d.jsx)("div",{style:{display:"flex",gap:3,opacity:+!!b,pointerEvents:b?"auto":"none",transition:"opacity 0.12s",...c},children:a})}function z({children:a,onClick:b,disabled:c=!1,title:e,active:f=!1,style:g,onMouseEnterColor:h="var(--accent)",onMouseLeaveColor:i="var(--text-dim)",iconOnlyOnMobile:j=!1}){let k=u();return(0,d.jsx)("button",{onClick:b,disabled:c,title:e,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:c?"not-allowed":"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...g},onMouseEnter:a=>{c||(a.currentTarget.style.color=h)},onMouseLeave:a=>{c||(a.currentTarget.style.color=i)},children:j&&k&&Array.isArray(a)?a[0]:a})}function A({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16,display:"flex",flexDirection:"column",alignItems:"flex-end"},children:a})}function B({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:b?4:6,maxWidth:b?"92%":"85%"},children:(0,d.jsx)("div",{style:{flex:1,minWidth:0,background:"var(--user-bg)",border:"1px solid rgba(59,130,246,0.2)",borderRadius:12,padding:b?"7px 10px":"8px 12px",fontSize:14,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})})}function C({children:a,hasBody:b=!1}){let c=u();return(0,d.jsx)("div",{style:{display:"flex",gap:c?4:6,flexWrap:"wrap",marginBottom:b?c?6:8:0},children:a})}function D({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16},children:a})}function E({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:b?6:8},children:a})}function F({children:a,accent:b="default"}){let c="subagent"===b;return(0,d.jsx)("div",{"data-message-surface":"custom-card","data-message-accent":b,style:{padding:"8px 14px",borderRadius:8,border:`1px solid ${c?"rgba(99,102,241,0.25)":"var(--border)"}`,background:c?"rgba(99,102,241,0.05)":"var(--bg-panel)",fontSize:13,lineHeight:1.6,color:"var(--text-muted)"},children:a})}function G({icon:a,children:b}){return(0,d.jsxs)("div",{"data-message-surface":"custom-icon-row",style:{display:"flex",alignItems:"flex-start",gap:8},children:[(0,d.jsx)("span",{style:{flexShrink:0,fontSize:14},children:a}),(0,d.jsx)("div",{style:{flex:1,minWidth:0},children:b})]})}function H({text:a,title:b="Copy message",style:c}){let[f,g]=(0,e.useState)(!1),h=u();return(0,d.jsxs)("button",{onClick:()=>{(0,t.D)(a).then(()=>{g(!0),setTimeout(()=>g(!1),1500)})},title:b,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...c},onMouseEnter:a=>{f||(a.currentTarget.style.color="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.color="var(--text-dim)")},children:[f?(0,d.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,d.jsx)("span",{style:h?{display:"none"}:void 0,children:f?"Copied":"Copy"})]})}function I({provider:a,model:b,modelNames:c,isStreaming:e=!1,estimatedTokens:f=0,tps:g=null}){let h=a&&b?c?.[`${a}:${b}`]??c?.[b]??b:null;return(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:4,display:"flex",alignItems:"center",gap:6},children:[h&&(0,d.jsx)("span",{children:h}),e&&f>0&&(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:"var(--text)"},title:"预估 token 数(流式接收中)",children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11,fontWeight:400},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,d.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),f]}),null!==g&&(0,d.jsxs)("span",{style:{marginLeft:6,padding:"1px 6px",borderRadius:4,background:g>=50?"#53b3cb":g>=30?"#9bc53d":g>=15?"#f9c22e":"#e01a4f",color:"#fff",fontSize:11,fontWeight:400},children:[g.toFixed(1)," t/s"]})]})]})}var J=c(27563);let K=[],L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(a){return a.toString().padStart(2,"0")}function N(a){if(!a)return null;let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear()&&b.getMonth()===c.getMonth()&&b.getDate()===c.getDate(),e=`${M(b.getHours())}:${M(b.getMinutes())}`;if(d)return e;let f=[`${L[b.getMonth()]} ${b.getDate()}`];b.getFullYear()!==c.getFullYear()&&f.push(String(b.getFullYear()));let g=f.join(", ");return`${g} ${e}`}function O({message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,onFork:g,forking:h,onNavigate:i,prevAssistantEntryId:j,onEditContent:k,onSendMessage:l,showTimestamp:m,prevTimestamp:n,renderVisualCodeBlocks:o,cwd:p,onOpenImage:q,activeFilePath:r,agentRunning:s,onApplyToFile:t,onRunCode:u,onOpenFileAtLine:v,onAcceptDiff:w}){return"user"===a.role?(0,d.jsx)(P,{message:a,entryId:f,onFork:g,forking:h,onNavigate:i,prevAssistantEntryId:j,onEditContent:k,onOpenImage:q}):"assistant"===a.role?(0,d.jsx)(Q,{message:a,isStreaming:b,toolResults:c,modelNames:e,onSendMessage:l,showTimestamp:m,prevTimestamp:n,renderVisualCodeBlocks:o,cwd:p,activeFilePath:r,agentRunning:s,onApplyToFile:t,onRunCode:u,onOpenFileAtLine:v,onAcceptDiff:w}):"toolResult"===a.role?null:"custom"===a.role?(0,d.jsx)(R,{message:a,showTimestamp:m}):null}function P({message:a,entryId:b,onFork:c,forking:f,onNavigate:g,prevAssistantEntryId:h,onEditContent:i,onOpenImage:j}){let[l,m]=(0,e.useState)(!1),n="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),o="string"==typeof a.content?[]:a.content.filter(a=>"image"===a.type),p=o.flatMap(a=>{let b=(0,k.h5)(a);return b?[{src:b}]:[]}),q=N(a.timestamp),r=!!b&&!!c,s=!!h&&!!g;return(0,d.jsxs)(A,{hovered:l,onHoverChange:m,children:[(0,d.jsxs)(B,{children:[o.length>0&&(0,d.jsx)(C,{hasBody:!!n,children:o.map((a,b)=>{let c=(0,k.h5)(a);if(!c)return null;let e=a.path&&c.startsWith("/api/files/");return(0,d.jsx)("a",{href:c,target:e||!j?"_blank":void 0,rel:e||!j?"noreferrer":void 0,title:"Open image",style:{display:"block",cursor:"zoom-in"},onClick:a=>{j&&(a.preventDefault(),j(c,void 0,p))},children:(0,d.jsx)("img",{src:c,alt:"",style:{maxWidth:240,maxHeight:240,borderRadius:6,objectFit:"contain",display:"block",border:"1px solid rgba(59,130,246,0.15)"}})},b)})}),n]}),(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[(0,d.jsx)(y,{visible:l,children:(0,d.jsx)(H,{text:n})}),(r||s)&&(0,d.jsxs)(y,{visible:l||!!f,children:[s&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{g(h),i?.(n)},title:"Edit from here — branches within this session",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("polyline",{points:"15 10 20 15 15 20"}),(0,d.jsx)("path",{d:"M4 4v7a4 4 0 0 0 4 4h12"})]}),"Edit from here"]}),r&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{c(b)},disabled:f,active:!!f,title:f?"Creating new session…":"New session — creates an independent copy from here",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),f?"Creating…":"New session"]})]}),q&&(0,d.jsx)(x,{children:q})]})]})}function Q({message:a,isStreaming:b,toolResults:c,modelNames:f,onSendMessage:g,showTimestamp:h,prevTimestamp:i,renderVisualCodeBlocks:j,cwd:k,activeFilePath:l,agentRunning:m,onApplyToFile:o,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:r}){var s;let t,u=h?N(a.timestamp):null,v=a.content??K,[z,A]=(0,e.useState)(!1);(0,e.useRef)(null),(0,e.useRef)(new Map);let B=(0,e.useRef)(v),[C,F]=(0,e.useState)(null),[G,L]=(0,e.useState)(new Map);B.current=v;let M=(0,e.useMemo)(()=>{if(!a.timestamp||!i)return;let b=Math.round((a.timestamp-i)/1e3);return b>0?b:void 0},[a.timestamp,i]),O=(0,e.useMemo)(()=>(function(a,b){let c=new Map;if(!a||!b)return c;for(let[d,e]of a){if(!e.timestamp)continue;let a=Math.round((e.timestamp-b)/1e3);a>0&&c.set(d,a)}return c})(c,a.timestamp),[c,a.timestamp]),P=(0,e.useMemo)(()=>(function(a,b,c){let d=[],e=[],f=[];for(let[g,h]of a.entries()){if("thinking"===h.type){e.push({content:h.thinking,duration:b.get(g)??c});continue}if("toolCall"===h.type){d.push(h);continue}f.push(h)}return{tools:d,thinkingBlocks:e,visibleBlocks:f}})(v,G,M),[v,G,M]),R=(0,e.useMemo)(()=>v.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),[v]),S=(0,e.useMemo)(()=>Math.round(function(a){let b=0;for(let c of a){if("text"===c.type){b+=c.text.length;continue}if("thinking"===c.type){b+=c.thinking.length;continue}"toolCall"===c.type&&(b+=JSON.stringify(c.input??{}).length)}return b}(v)/4),[v]);return(0,d.jsxs)(D,{hovered:z,onHoverChange:A,children:[(0,d.jsx)(I,{provider:a.provider,model:a.model,modelNames:f,isStreaming:b,estimatedTokens:S,tps:C}),(0,d.jsxs)(E,{children:[(P.tools.length>0||P.thinkingBlocks.length>0)&&(0,d.jsx)(J.kD,{tools:P.tools,results:c,durations:O,thinkingBlocks:P.thinkingBlocks,isStreaming:b,cwd:k}),P.visibleBlocks.map((a,e)=>(0,d.jsx)(n,{block:a,toolResults:c,isStreaming:b,toolCallDurations:O,onSendMessage:g,renderVisualCodeBlocks:j,cwd:k,activeFilePath:l,agentRunning:m,onApplyToFile:o,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:r},e))]}),(0,d.jsxs)(w,{style:{gap:8},children:[a.usage&&!b&&(0,d.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:(s=a.usage,t=[],s.input&&t.push(`${s.input.toLocaleString()} in`),s.output&&t.push(`${s.output.toLocaleString()} out`),s.cacheRead&&t.push(`${s.cacheRead.toLocaleString()} cache`),s.cost?.total&&t.push(`$${s.cost.total.toFixed(4)}`),t.join(" \xb7 "))}),R&&!b&&(0,d.jsx)(y,{visible:z,children:(0,d.jsx)(H,{text:R})}),u&&(0,d.jsx)(x,{alignEnd:!0,children:u})]})]})}function R({message:a,showTimestamp:b}){if(!a.display)return null;let c=b?N(a.timestamp):null,e="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),g="subagent-notify"===a.customType,h=e.match(/^Background task (completed|failed|paused):\s*\*\*(.+?)\*\*/),i=h?"completed"===h[1]?"✅":"failed"===h[1]?"❌":"⏸":g?"\uD83E\uDD16":"ℹ";return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsx)(F,{accent:g?"subagent":"default",children:(0,d.jsx)(G,{icon:i,children:(0,d.jsx)("div",{"data-message-surface":"custom-body",children:(0,d.jsx)(f.T,{content:e,style:{fontSize:13}})})})}),(c||h)&&(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[h&&(0,d.jsx)(x,{children:h[2]}),c&&(0,d.jsx)(x,{children:c})]})]})}},63956:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},65950:(a,b,c)=>{"use strict";c.d(b,{aU:()=>f,cx:()=>e,nS:()=>r,Rd:()=>q,wY:()=>p,tG:()=>m});class d{#a;#b;constructor(a){this.#b=new Map,this.#a=a}get(a){if(!this.#b.has(a))return;let b=this.#b.get(a);return this.#b.delete(a),this.#b.set(a,b),b}set(a,b){for(this.#b.has(a)&&this.#b.delete(a);this.#b.size>=this.#a;){let a=this.#b.keys().next().value;if(void 0===a)break;this.#b.delete(a)}this.#b.set(a,b)}delete(a){this.#b.delete(a)}get size(){return this.#b.size}}let e="github-light",f="github-dark",g=new d(10),h=new d(200),i=new Set,j=new Map,k=null;function l(a,b,c){let d=a.slice(0,100),e=a.length>100?a.slice(-100):"";return`${b}:${c}:${a.length}:${d}:${e}`}function m(a){return void 0===a||0===a?{}:{fontStyle:1&a?"italic":void 0,fontWeight:2&a?700:void 0,textDecorationLine:4&a?"underline":void 0}}function n(){return k||(k=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===i.size){for(let b of Object.keys(a.bundledLanguages??{}))i.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])j.set(c.toLowerCase(),a)}}return a})),k}async function o(a,b=e,c=f){let d=`${a}:${b}:${c}`,h=g.get(d);if(h)return h;let i=n().then(({createHighlighter:d})=>d({langs:[a],themes:[b,c]})).catch(a=>{throw g.delete(d),a});return g.set(d,i),i}function p(a,b,c,d){let g=q(a,b,c);if(g)return g;let k=c?f:e,m=b.trim().toLowerCase();if(!m)return null;let p=l(a,m,k);return n().then(()=>{let c,g=(c=b.trim().toLowerCase())?i.has(c)?c:j.get(c)??null:null;return g?o(g,e,f).then(b=>{let c=b.codeToTokens(a,{lang:g,theme:k}),e={bg:c.bg??"transparent",fg:c.fg??"inherit",tokens:c.tokens};return h.set(p,e),d(e),e}):null}).catch(a=>{console.warn("[Shiki] highlight failed:",a)}),null}function q(a,b,c){let d=b.trim().toLowerCase();if(!d)return null;let g=l(a,d,c?f:e);return h.get(g)??null}function r(a){return{bg:"transparent",fg:"inherit",tokens:a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(a=>""===a?[]:[{color:"inherit",content:a}])}}},73383:(a,b,c)=>{"use strict";c.d(b,{pm:()=>k});var d=c(48249),e=c(67484),f=c(54097),g=c(6954),h=c(40648);function i({expanded:a,onToggle:b,durationLabel:c,isStreaming:e=!1,leading:f,label:j="Thinking",buttonStyle:k,labelStyle:l,durationStyle:m}){return(0,d.jsxs)(g.R,{expanded:a,onToggle:b,buttonStyle:{width:"100%",display:"flex",alignItems:"center",gap:7,minWidth:0,textAlign:"left",cursor:"pointer",border:"none",background:"transparent",color:"var(--text-muted)",...k},children:[f,(0,d.jsx)("span",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1,...l},children:e?(0,d.jsx)(h.n,{children:j}):j}),c&&(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...m},children:c})]})}function j({content:a,contentStyle:b}){return(0,d.jsx)(f.p,{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",...b},children:(0,d.jsx)("div",{style:{padding:"8px 10px"},children:a})})}function k({content:a,durationLabel:b,isStreaming:c=!1,leading:g,label:h="Thinking",containerStyle:l,buttonStyle:m,labelStyle:n,durationStyle:o,contentStyle:p}){let[q,r]=(0,e.useState)(!1);return(0,d.jsxs)(f.t,{kind:"thinking",style:l,children:[(0,d.jsx)(i,{expanded:q,onToggle:()=>r(a=>!a),durationLabel:b,isStreaming:c,leading:g,label:h,buttonStyle:m,labelStyle:n,durationStyle:o}),q&&(0,d.jsx)(j,{content:a,contentStyle:p})]})}},78335:()=>{},80251:(a,b,c)=>{"use strict";function d(a,b){for(let c of b){let b=a[c];if(null!=b&&""!==b)return String(b)}return null}function e(a,b=60){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function f(a){let b=a.toLowerCase().split("__").filter(Boolean);return b[b.length-1]??a.toLowerCase()}function g(a,b=120){let c=Object.keys(a);return 0===c.length?"":"command"in a?String(a.command).slice(0,b):"cmd"in a?String(a.cmd).slice(0,b):"path"in a?String(a.path).slice(0,b):"file_path"in a?String(a.file_path).slice(0,b):"pattern"in a?String(a.pattern).slice(0,b):"query"in a?String(a.query).slice(0,b):String(a[c[0]]).slice(0,b)}function h(a){let b=a.toolName||"tool",c=f(b),g=a.input??{};if(["bash","execute","run","shell","exec_command","execute_command"].includes(c))return{canonicalName:c,kind:"terminal",label:"Shell",summary:e(d(g,["command","cmd"])??b,60)};if(["read","readfile","read_file"].includes(c))return{canonicalName:c,kind:"read",label:"Read",summary:e(d(g,["file_path","path"])??b,60)};if(["write","edit","write_file","create_file","notebook_edit"].includes(c)){let a,f=d(g,["file_path","path","notebook_path","filename"]);return{canonicalName:c,kind:"edit",label:"Edit",summary:e(f?(a=f.split(/[\\/]/).filter(Boolean))[a.length-1]??f:b,60)}}if(["search","grep","glob","find","find_files","websearch"].includes(c))return{canonicalName:c,kind:"search",label:"Search",summary:e(d(g,["pattern","query","glob"])??b,60)};if(["subagent","agent"].includes(c))return{canonicalName:c,kind:"agent",label:"Agent",summary:e([d(g,["agent","name","agentName"]),d(g,["prompt","task","message"])].filter(Boolean).join(": ")||b,60)};let h=d(g,["command","cmd","path","file_path","pattern","query","glob","prompt","description"])??function(a){try{return JSON.stringify(a)}catch{return String(a)}}(g)??b;return{canonicalName:c,kind:"tool",label:e(b,60),summary:e(h,60)}}c.d(b,{WI:()=>f,Wm:()=>g,wS:()=>h})},82704:()=>{},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg",!0)+"?6eceb6fbd1a5bb90"}]},90707:(a,b,c)=>{"use strict";c.d(b,{h:()=>N});var d=c(48249),e=c(67484),f=c(52515),g=c(32492);function h({dir:a}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:"asc"===a?(0,d.jsx)("polyline",{points:"2 6 5 3 8 6"}):(0,d.jsx)("polyline",{points:"2 4 5 7 8 4"})})}function i(a,b,c){let d=new Blob([a],{type:c}),e=URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.download=b,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(e),1e3)}function j({content:a,delimiter:b,fileName:c="table"}){let[f,g]=(0,e.useState)(null),[k,l]=(0,e.useState)("asc"),{header:m,rows:n}=(0,e.useMemo)(()=>(function(a,b){let c=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=[],e=[],f="",g=!1;for(let a=0;a<c.length;a+=1){let h=c[a];if('"'===h){g&&'"'===c[a+1]?(f+='"',a+=1):g=!g;continue}if(h===b&&!g){e.push(f),f="";continue}if("\n"===h&&!g){e.push(f),e.some(a=>a.length>0)&&d.push(e),e=[],f="";continue}f+=h}e.push(f),e.some(a=>a.length>0)&&d.push(e);let h=d[0]??[],i=h.length;return{header:h,rows:d.slice(1).map(a=>{let b=[...a];for(;b.length<i;)b.push("");return b.slice(0,i)})}})(a,b),[a,b]),o=(0,e.useMemo)(()=>{if(null===f)return n;let a=[...n];return a.sort((a,b)=>{let c=a[f]??"",d=b[f]??"",e=Number(c),g=Number(d),h=""===c||""===d||Number.isNaN(e)||Number.isNaN(g)?c.localeCompare(d):e-g;return"asc"===k?h:-h}),a},[n,k,f]);return 0===m.length&&0===n.length?(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:"No tabular data to display"}):(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:[(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:[n.length," rows, ",m.length," columns"]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,d.jsxs)("button",{onClick:()=>{i(a,c," "===b?"text/tab-separated-values;charset=utf-8":"text/csv;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:["Export "," "===b?"TSV":"CSV"]}),(0,d.jsx)("button",{onClick:()=>{i(JSON.stringify(o.map(a=>Object.fromEntries(m.map((b,c)=>[b||`column_${c+1}`,a[c]??""]))),null,2),c.replace(/\.[^.]+$/,"")+".json","application/json;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:"Export JSON"})]})]}),(0,d.jsx)("div",{style:{minHeight:0,flex:1,overflow:"auto",background:"var(--bg)"},children:(0,d.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:12},children:[(0,d.jsx)("thead",{style:{position:"sticky",top:0,zIndex:1,background:"var(--bg-panel)"},children:(0,d.jsx)("tr",{children:m.map((a,b)=>(0,d.jsx)("th",{onClick:()=>{f===b?l(a=>"asc"===a?"desc":"asc"):(g(b),l("asc"))},title:a,style:{padding:"8px 10px",borderBottom:"1px solid var(--border)",textAlign:"left",color:"var(--text-muted)",fontWeight:600,cursor:"pointer",userSelect:"none",fontSize:11,whiteSpace:"nowrap"},children:(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a||`column_${b+1}`}),f===b&&(0,d.jsx)("span",{style:{color:"var(--accent)",display:"inline-flex",flexShrink:0},children:(0,d.jsx)(h,{dir:k})})]})},`${a}-${b}`))})}),(0,d.jsx)("tbody",{children:o.map((a,b)=>(0,d.jsx)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.14)",background:b%2==1?"var(--bg-subtle)":"transparent"},children:m.map((c,e)=>(0,d.jsx)("td",{title:a[e]??"",style:{padding:"6px 10px",color:"var(--text)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:0},children:a[e]??""},`${c}-${b}-${e}`))},b))})]})})]})}var k=c(19581),l=c(39868),m=c(65950);let n={display:"inline-block",minWidth:"3em",paddingRight:"1em",textAlign:"right",color:"var(--text-dim)",fontStyle:"normal",userSelect:"none"};function o({code:a,language:b,isDark:c,wrapLines:f=!1,scrollToLine:g}){let h="text"===b||"csv"===b||"tsv"===b?"plaintext":b||"plaintext",i=a.split("\n").length,j=(0,e.useRef)(new Map),p=(0,e.useMemo)(()=>(0,m.Rd)(a,h,c),[a,c,h]),[q,r]=(0,e.useState)(()=>p?.tokens??null);(0,e.useRef)("");let s=(0,e.useMemo)(()=>(0,m.nS)(a).tokens,[a]),t=q??p?.tokens??s;return(0,d.jsxs)(k.NG,{style:{border:"none",borderRadius:0,minHeight:"100%"},children:[(0,d.jsx)(k.iO,{title:`${h} \xb7 ${i} lines`,actions:(0,d.jsx)(k.Mi,{onClick:()=>{(0,l.D)(a)},ariaLabel:"Copy file contents",title:"Copy file contents",label:"copy"}),style:{padding:"4px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"}}),(0,d.jsx)("pre",{style:{margin:0,padding:"12px 0",background:"var(--bg)",fontSize:13,lineHeight:1.6,fontFamily:"var(--font-mono)",minHeight:"100%",overflow:"auto",whiteSpace:f?"pre-wrap":"pre",wordBreak:f?"break-word":void 0},children:(0,d.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:t.map((a,b)=>{let c=b+1,e=g===c;return(0,d.jsxs)("span",{ref:a=>{a?j.current.set(c,a):j.current.delete(c)},style:{display:"block",background:e?"color-mix(in srgb, var(--accent) 14%, transparent)":void 0},children:[(0,d.jsx)("span",{style:n,children:c}),0===a.length?"\n":a.map((a,b)=>{let c=(0,m.tG)(a.fontStyle);return(0,d.jsx)("span",{style:{color:a.color??"inherit",...c},children:a.content},b)})]},b)})})})]})}var p=c(51415),q=c(31343);function r(a){return`/api/files/${(0,q.HG)(a)}?type=read&raw=1`}async function s(a){let b=await fetch(r(a),{method:"HEAD"});if(!b.ok){let a=`HTTP ${b.status}`;try{let c=await b.json().catch(()=>null);c?.error&&(a=c.error)}catch{}throw Error(a)}let c=document.createElement("a");c.href=r(a),c.download=(0,q.WP)(a),c.style.display="none",document.body.appendChild(c),c.click(),document.body.removeChild(c)}function t({filePath:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(null);return(0,d.jsx)("button",{onClick:()=>{g(null),c(!0),s(a).catch(a=>g(a instanceof Error?a.message:String(a))).finally(()=>c(!1))},disabled:b,title:f??"Download original file",style:{padding:"2px 10px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5,fontWeight:600,opacity:b?.7:1,...f?{borderColor:"#ef4444",color:"#ef4444"}:{}},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--accent)",a.currentTarget.style.color="#fff",a.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.background="var(--bg-hover)",a.currentTarget.style.color="var(--text-muted)",a.currentTarget.style.borderColor="var(--border)")},children:b?"Downloading…":"Download"})}var u=c(2857);function v(a){let b=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".",c=(0,q.HG)(b);return`/api/files/${c}/?type=read&raw=1`}function w({oldContent:a,newContent:b,language:c}){let e=function(a,b){let c=a.length,d=b.length,e=c+d,f=Array(2*e+1).fill(0),g=[];for(let h=0;h<=e;h++){g.push([...f]);for(let i=-h;i<=h;i+=2){let j,k=(j=i===-h||i!==h&&f[i-1+e]<f[i+1+e]?f[i+1+e]:f[i-1+e]+1)-i;for(;j<c&&k<d&&a[j]===b[k];)j++,k++;if(f[i+e]=j,j>=c&&k>=d){let f=[],i=c,j=d;for(let c=h;c>0;c--){let d,h=g[c-1],k=i-j;d=k===-c||k!==c&&h[k-1+e]<h[k+1+e]?k+1:k-1;let l=h[d+e],m=l-d;for(;i>l&&j>m;)i--,j--,f.unshift({type:"unchanged",text:a[i],lineNo:i+1});c>0&&(i>l?(i--,f.unshift({type:"removed",text:a[i],lineNo:i+1})):(j--,f.unshift({type:"added",text:b[j],lineNo:j+1})))}for(;i>0&&j>0;)i--,j--,f.unshift({type:"unchanged",text:a[i],lineNo:i+1});return f}}}return[...a.map((a,b)=>({type:"removed",text:a,lineNo:b+1})),...b.map((a,b)=>({type:"added",text:a,lineNo:b+1}))]}(a.split("\n"),b.split("\n"));return(0,d.jsx)(f.pg,{diff:e})}function x({filePath:a,cwd:b,onOpenFile:c,scrollToLine:h}){let i,{isDark:k}=(0,u.D)(),[l,m]=(0,e.useState)(null),[n,r]=(0,e.useState)(null),[s,y]=(0,e.useState)(!0),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)("source"),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(0),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(0),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null);(0,e.useRef)(null),(0,e.useRef)(!1).current=P;let _=(0,e.useCallback)((a,b=!1)=>{let c=(0,q.HG)(a);return fetch(`/api/files/${c}?type=read`).then(a=>a.json()).then(a=>a.error?(A(a.error),null):(b?(m(b=>(b&&r(b.content),a)),O(a=>a+1)):m(a),A(null),a)).catch(a=>(A(String(a)),null))},[]),aa=(0,e.useCallback)(()=>{l&&(Q(!0),S(l.content),$(l.mtime??null),Y(!1),C(null),W(!1),E(!1),G("source"))},[l]),ab=(0,e.useCallback)(async(b=!1)=>{let c=(0,q.HG)(a);U(!0),Y(!1),C(null);try{let d=await fetch(`/api/files/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:R,...b||!Z?{}:{baseMtime:Z}})});if(409===d.status){let a=await d.json().catch(()=>({error:"File changed on disk since it was opened"}));throw Y(!0),W(!0),Error(a.error??"File changed on disk since it was opened")}if(!d.ok){let a=await d.json().catch(()=>({error:String(d.status)}));throw Error(a.error??`HTTP ${d.status}`)}let e=await _(a,!0);$(e?.mtime??null),Q(!1),W(!1),Y(!1)}catch(a){C(a instanceof Error?a.message:String(a))}finally{U(!1)}},[Z,R,_,a]),ac=(0,e.useCallback)(()=>{Q(!1),W(!1),Y(!1),C(null),$(null)},[]),ad=(0,e.useCallback)(()=>{K(a=>a+1)},[]),ae=(0,e.useCallback)(async()=>{let b=await _(a,!0);b&&(S(b.content),$(b.mtime??null),W(!1),Y(!1),C(null),A(null))},[_,a]),af=l?.content??"",ag=l?.language??"",ah="html"===ag,ai="markdown"===ag,aj="csv"===(i=(0,q.WP)(a).toLowerCase().split(".").pop()??"")?",":"tsv"===i?" ":null,ak=null!==aj,al=af.split("\n"),am=null!==l&&null!==n&&n!==af,an=(0,e.useMemo)(()=>{let b,c,d;return ah?(b=v(a),c=`<base href="${b}">`,d=af,(d=/<head(\s[^>]*)?>/i.test(d)?d.replace(/<head(\s[^>]*)?>/i,a=>`${a}${c}`):/<html(\s[^>]*)?>/i.test(d)?d.replace(/<html(\s[^>]*)?>/i,a=>`${a}<head>${c}</head>`):`<!doctype html><html><head>${c}</head><body>${d}</body></html>`).replace(/<script\b/gi,'<script data-annovibe-disabled="true" type="application/json"').replace(/\s(?:on[a-z]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"")):""},[af,a,ah]),ao=!ah&&!ai&&!ak&&al.length>5e4,ap=ak&&(al.length>5e3||al.slice(0,25).reduce((a,b)=>Math.max(a,b.split(aj??",").length),0)>100),aq=(0,e.useMemo)(()=>{if(!ah)return"";let b=v(a).includes("?")?"&":"?";return`${v(a)}${encodeURIComponent((0,q.WP)(a))}${b}v=${J}`},[a,J,ah]);return s?(0,d.jsx)(f.nG,{children:"Loading..."}):z?(0,d.jsx)(f.nG,{tone:"error",children:z}):l?(0,d.jsxs)(f.fj,{children:[(0,d.jsx)(f.K$,{pathLabel:(0,q.qP)(a,b),title:a,trailing:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:l.language}),"source"===F&&(0,d.jsxs)("span",{children:[al.length," lines"]}),(0,d.jsx)("span",{children:(0,f.v7)(l.size)}),(0,d.jsx)(t,{filePath:a}),(0,d.jsx)(f.mK,{watching:L}),P?(0,d.jsxs)(d.Fragment,{children:[(V||X||B)&&(0,d.jsxs)("span",{title:"File changed on disk while editing",style:{padding:"2px 8px",fontSize:11,background:"rgba(234,179,8,0.1)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:5,display:"flex",alignItems:"center",gap:4},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,d.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),B??"External change",(V||X)&&(0,d.jsx)(f.ml,{onClick:ae,style:{marginLeft:4,fontSize:10,background:"rgba(234,179,8,0.2)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:3,fontWeight:600},children:"Reload"}),X&&(0,d.jsx)(f.ml,{onClick:()=>void ab(!0),disabled:T,emphasis:"danger",style:{marginLeft:4,fontSize:10,borderRadius:3,fontWeight:600},children:"Overwrite"})]}),(0,d.jsx)(f.ml,{onClick:()=>void ab(),disabled:T,title:"Save file (Ctrl+S)",emphasis:"primary",style:{fontWeight:600},children:T?"Saving…":"Save"}),(0,d.jsx)(f.ml,{onClick:ac,title:"Cancel editing",emphasis:"danger",style:{fontWeight:600},children:"Cancel"})]}):(0,d.jsx)(f.ml,{onClick:aa,title:"Edit file",style:{fontWeight:600},children:"Edit"}),am&&(0,d.jsx)(f.Tg,{options:[{key:"source",label:"Source",active:"source"===F,onClick:()=>G("source")},{key:"diff",label:(0,d.jsxs)(d.Fragment,{children:["Diff ",N>0&&(0,d.jsxs)("span",{style:{color:"#4ade80",marginLeft:2},children:["+",N]})]}),active:"diff"===F,onClick:()=>G("diff")}]}),"source"===F&&!D&&(0,d.jsx)(f.ml,{onClick:()=>I(a=>!a),title:H?"Disable word wrap":"Enable word wrap",active:H,children:"wrap"}),ah&&D&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.ml,{onClick:ad,title:"Reload the HTML preview",children:"Refresh preview"}),aq&&(0,d.jsx)(f.ml,{onClick:()=>window.open(aq,"_blank","noopener,noreferrer"),title:"Open HTML preview in a new tab",children:"Open in new tab"})]}),ah&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"code",label:"Code",active:!D,onClick:()=>E(!1)},{key:"preview",label:"Preview",active:D,onClick:()=>E(!0)}]}),ai&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"preview",label:"Preview",active:D,onClick:()=>E(!0)},{key:"raw",label:P?"Edit":"Raw",active:!D,onClick:()=>E(!1)}]}),ak&&"source"===F&&(0,d.jsx)(f.Tg,{options:[{key:"table",label:"Table",active:D,onClick:()=>E(!0)},{key:"raw",label:"Raw",active:!D,onClick:()=>E(!1)}]})]})}),(0,d.jsx)(f.Ph,{children:P&&!(ai&&D)?(0,d.jsx)(g.g,{initialContent:R,language:l.language,isDark:k,onChange:S,onSave:()=>void ab(),scrollToLine:h}):P&&ai&&D?(0,d.jsx)(p.T,{content:R,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:b,baseFilePath:a,onOpenLocalFile:c,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):"diff"===F&&am?(0,d.jsx)(w,{oldContent:n,newContent:l.content,language:l.language}):ah&&D?(0,d.jsx)("iframe",{srcDoc:an,sandbox:"",style:{width:"100%",height:"100%",border:"none",background:"var(--bg)"},title:"HTML preview"},J):ai&&D?(0,d.jsx)(p.T,{content:l.content,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:b,baseFilePath:a,onOpenLocalFile:c,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):ak&&D&&aj?ap?(0,d.jsx)(f.nG,{children:"Table preview disabled for very large files. Switch to Raw mode or export the file."}):(0,d.jsx)(j,{content:l.content,delimiter:aj,fileName:(0,q.WP)(a)}):ao?(0,d.jsx)(f.nG,{children:"Text preview is too large for the rich viewer. Use Edit/Raw workflows instead."}):(0,d.jsx)(o,{code:l.content,language:l.language,isDark:k,wrapLines:H,scrollToLine:h})})]}):null}var y=c(92002),z=c(12440);function A({arrayBuffer:a,fileName:b,toolbarExtra:c}){let g=(0,e.useRef)(null),[h,i]=(0,e.useState)(!0),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(0),[n,o]=(0,e.useState)(1),[p,q]=(0,e.useState)(1);return(0,e.useRef)(p).current=p,(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useCallback)(async a=>{},[]),(0,d.jsx)(z.B,{fileName:b,pageInfo:l>0?`Page ${n} / ${l}`:void 0,zoom:p,onZoomIn:()=>q(a=>Math.min(a+.25,3)),onZoomOut:()=>q(a=>Math.max(a-.25,.25)),loading:h,loadingLabel:"Loading PDF...",error:j,bodyStyle:{background:"#525659",display:"flex",justifyContent:"center",padding:16},extra:(0,d.jsxs)(d.Fragment,{children:[c,l>1&&(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,d.jsx)(f.ml,{onClick:()=>o(a=>Math.max(a-1,1)),title:"Previous page",disabled:n<=1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,d.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,d.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[n,"/",l]}),(0,d.jsx)(f.ml,{onClick:()=>o(a=>Math.min(a+1,l)),title:"Next page",disabled:n>=l,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,d.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!h&&!j&&(0,d.jsx)(y.QG,{style:{minWidth:"100%"},children:(0,d.jsx)("div",{ref:g})})})}function B({arrayBuffer:a,fileName:b,toolbarExtra:c}){let f=(0,e.useRef)(null),[g,h]=(0,e.useState)(!0),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(""),m=(0,e.useMemo)(()=>`<!doctype html>
|
|
261
261
|
<html>
|
|
262
262
|
<head>
|
|
263
263
|
<meta charset="utf-8" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/ecITilT-OsECM8-4m-CTu/_buildManifest.js","static/ecITilT-OsECM8-4m-CTu/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-b13282f72690ef5e.js","static/chunks/4bd1b696-e356ca5ba0218e27.js","static/chunks/3794-123fdf632563f469.js","static/chunks/main-app-8d81a93b58bb990f.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|