@vantaloom/runtime-linux-x64 0.1.23 → 0.1.24

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.
@@ -17,7 +17,7 @@ ${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:n
17
17
  ${d}
18
18
  </style>`}),t=await H8(t,/<script\b([^>]*?)\bsrc=(["'])([^"']+)\2([^>]*)>\s*<\/script>/gi,async(t,i,a,o,l)=>{let s,c=await H2(r,e.machine.id,n,o),d=(s=`${i} ${l}`.replace(/\b(defer|async|integrity|crossorigin|nonce)(=(["']).*?\3|\s+[^\s>]*)?/gi,"").replace(/\s+/g," ").trim())?` ${s}`:"";return void 0===c?t:`<script${d} data-vantaloom-inline-asset="${H7(o)}">
19
19
  ${c}
20
- </script>`})}async function H2(e,t,n,r){let i=await H5(e,t,n,r);return i?.encoding!=="utf-8"||i.truncated?void 0:i.content}async function H5(e,t,n,r){let i;if(!(""!==(i=r.trim())&&!i.startsWith("#")&&!i.startsWith("//")&&!/^[a-z][a-z0-9+.-]*:/i.test(i)))return;let a=H6(n,r),o=`${t}\0${a}`;if(e.has(o))return e.get(o);try{let n=await bf(t,a),r=n.truncated?void 0:n;return e.set(o,r),r}catch{e.set(o,void 0);return}}async function H4(e,t,n,r){return H8(e,/url\(\s*(["']?)([^"')]+)\1\s*\)/gi,async(e,i,a)=>{var o;let l,s=await H5(t,n,r,a),c=s?(l=(o=s).mimeType||"application/octet-stream","base64"===o.encoding?`data:${l};base64,${o.content}`:"utf-8"===o.encoding?`data:${l};charset=utf-8,${encodeURIComponent(o.content)}`:void 0):void 0;return c?`url("${c}")`:e})}function H3(e){let t=e.replace(/\\/g,"/"),n=t.lastIndexOf("/");return n>=0?t.slice(0,n):""}function H6(e,t){let n=`${e}/${t}`.replace(/\\/g,"/").split("/").filter(Boolean),r=[];for(let e of n)if("."!==e){if(".."===e){r.pop();continue}r.push(e)}let i=/^[A-Za-z]:/.test(e)?"":e.startsWith("/")?"/":"";return`${i}${r.join("/")}`}async function H8(e,t,n){let r=Array.from(e.matchAll(t)),i=await Promise.all(r.map(e=>n(...e.map(e=>e??"")))),a=0;return e.replace(t,()=>i[a++]??"")}function H7(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}async function H9(){return Wa("/api/local/terminals/machines")}async function We(e){let t=new URLSearchParams;e&&t.set("scopeId",e);let n=t.toString();return Wa(`/api/local/terminals/sessions${n?`?${n}`:""}`)}async function Wt(e){return Wa("/api/local/terminals/sessions",{method:"POST",body:JSON.stringify(e)})}async function Wn(e){await Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Wr(e,t){await Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify({data:t})})}async function Wi(e,t){return Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify(t)})}async function Wa(e,t){let n=await fetch(e,{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error("string"==typeof r?.error?r.error:"terminal api failed");return r}let Wo=eN("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function Wl({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(a){case"%":r=i/100*e;break;case"px":r=i;break;case"rem":r=i*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=i/100*window.innerHeight;break;case"vw":r=i/100*window.innerWidth}return r}function Ws(e){return parseFloat(e.toFixed(3))}function Wc({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function Wd(e){let{panels:t}=e,n=Wc({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:i}=e,a=0;void 0!==i.collapsedSize&&(a=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.collapsedSize})/n*100)),void 0!==i.defaultSize&&(t=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.defaultSize})/n*100));let o=0;void 0!==i.minSize&&(o=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.minSize})/n*100));let l=100;return void 0!==i.maxSize&&(l=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.maxSize})/n*100)),{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsible:!0===i.collapsible,defaultSize:t,disabled:i.disabled,minSize:o,maxSize:l,panelId:e.id}})}function Wu(e,t="Assertion error"){if(!e)throw Error(t)}function Wf(e,t){return Array.from(t).sort("horizontal"===e?Wh:Wp)}function Wh(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function Wp(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function Wm(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Wg(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Wv(e){let{element:t,orientation:r,panels:i,separators:a}=e,o=Wf(r,Array.from(t.children).filter(Wm).map(e=>({element:e}))).map(({element:e})=>e),l=[],s=!1,c=!1,d=-1,u=-1,f=0,h,p=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(f++,-1===d&&(d=e),u=e))}if(f>1){let t=-1;for(let f of o)if(f.hasAttribute("data-panel")){t++;let a=i.find(e=>e.element===f);if(a){if(h){let i,o=h.element.getBoundingClientRect(),m=f.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===r?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(p.length){case 0:i=[e,t];break;case 1:{let n=p[0],a=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Wg(r,n),l="horizontal"===e?t:o;l<a&&(a=l,i=n)}return Wu(i,"No rect found"),i}({orientation:r,rects:[o,m],targetRect:n.element.getBoundingClientRect()});i=[n,a===o?t:e];break}default:i=p}}else i=p.length?p:["horizontal"===r?new DOMRect(o.right,m.top,m.left-o.right,m.height):new DOMRect(m.left,o.bottom,m.width,m.top-o.bottom)];for(let r of i){let i="width"in r?r:r.element.getBoundingClientRect(),o=(void 0===n&&(n="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),n)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(i.width<o){let e=o-i.width;i=new DOMRect(i.x-e/2,i.y,i.width+e,i.height)}if(i.height<o){let e=o-i.height;i=new DOMRect(i.x,i.y-e/2,i.width,i.height+e)}let c=t<=d||t>u;s||c||l.push({group:e,groupSize:Wc({group:e}),panels:[h,a],separator:"width"in r?void 0:r,rect:i}),s=!1}}c=!1,h=a,p=[]}}else if(f.hasAttribute("data-separator")){null!==f.ariaDisabled&&(s=!0);let e=a.find(e=>e.element===f);e?p.push(e):(h=void 0,p=[])}else c=!0}return l}class Wx{#t={};addListener(e,t){let n=this.#t[e];return void 0===n?this.#t[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#t[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#t={}}removeListener(e,t){let n=this.#t[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let Wy=new Map,Wb=new Wx;function Ww(e,t){for(let[t]of Wy)if(t.id===e)return t}function Wj(e,t){for(let[t,n]of Wy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Wk(e,t){return Wb.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function WS(e,t){let n=Wy.get(e);(Wy=new Map(Wy)).set(e,t),Wb.emit("groupChange",{group:e,prev:n,next:t})}let WC=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function WN(e){let t=e.length;for(;t--;){let n=e[t];if(Wu(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(WO(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||WC.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function WM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function WE(e){let t=[];for(;e;)t.push(e),e=WO(e);return t}function WO(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function WP(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Wv(r),a=function(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Wg(n,a.rect);switch(e){case"horizontal":t.x<=i.x&&(r=a,i=t);break;case"vertical":t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wm(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:WE(e),b:WE(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();Wu(n,"Stacking order can only be calculated for elements with a common ancestor");let i={a:WM(WN(r.a)),b:WM(WN(r.b))};if(i.a===i.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(i.a-i.b)}(n,e)>0){let i=n;for(;i;){var r;if(i.contains(e))break;if(r=i.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;i=i.parentElement}}return!0}({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function WA(e,t,n=0){return Math.abs(Ws(e)-Ws(t))<=n}function Wz(e,t){return WA(e,t)?0:e>t?1:-1}function WI({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:l=100,minSize:s=0}=t;return o&&!e?n:(0>Wz(r,s)&&(r=a&&0>Wz(r,(i+s)/2)?i:s),Ws(r=Math.min(l,r)))}function W_({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(WA(e,0))return t;let o="imperative-api"===a,l=Object.values(t),s=Object.values(i),c=[...l],[d,u]=r;Wu(null!=d,"Invalid first pivot index"),Wu(null!=u,"Invalid second pivot index");let f=0;if("keyboard"===a){{let t=e<0?u:d,r=n[t];Wu(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(Wu(null!=n,`Previous layout not found for panel index ${t}`),WA(n,i)){let t=o-n;Wz(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];Wu(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(Wu(null!=n,`Previous layout not found for panel index ${t}`),WA(n,o)){let t=n-i;Wz(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];Wu(r,`Panel constraints not found for index ${t}`);let i=l[t],{collapsible:a,collapsedSize:o,minSize:s}=r;if(a&&0>Wz(i,s))if(e>0){let t=s-o;0>Wz(i+e,s)&&(e=0>=Wz(e,t/2)?0:t)}else{let t=s-o;0>Wz(i-e,s)&&(e=Wz(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,i=0;for(;;){let e=l[r];if(Wu(null!=e,`Previous layout not found for panel index ${r}`),i+=WI({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=l[t];Wu(null!=i,`Previous layout not found for panel index ${t}`);let a=i-r,s=WI({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!WA(i,s)&&(f+=i-s,c[t]=s,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(s,c))return i;{let t=e<0?u:d,r=l[t];Wu(null!=r,`Previous layout not found for panel index ${t}`);let i=r+f,a=WI({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(c[t]=a,!WA(a,i)){let t=i-a,r=e<0?u:d;for(;r>=0&&r<n.length;){let i=c[r];Wu(null!=i,`Previous layout not found for panel index ${r}`);let a=i+t,l=WI({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(WA(i,l)||(t-=l-i,c[r]=l),WA(t,0))break;e>0?r--:r++}}}if(!WA(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let h=Object.keys(i);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function WD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==Wz(e[n],t[n]))return!1;return!0}function WT({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!WA(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Wu(null!=t,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Wu(null!=i,`No layout data found for index ${e}`);let o=r[e];Wu(null!=o,`No layout data found for index ${e}`);let l=WI({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=l&&(a+=o-l,r[e]=l)}if(!WA(a,0))for(let e=0;e<t.length;e++){let n=r[e];Wu(null!=n,`No layout data found for index ${e}`);let i=n+a,o=WI({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,WA(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function WR({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:i,groupSize:a,separatorToPanels:o}]of Wy)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:a,layout:i,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{if(e===a())return;let{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:o,groupSize:l,layout:s,separatorToPanels:c}=n(),d=WT({layout:(({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),l=n.findIndex(e=>e.id===t),s=0===l,c=l===n.length-1;if(c&&e<o&&(s||n.slice(0,l).every((e,t)=>{let n=i[t];return n?.collapsible&&WA(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,l).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Ws(100-e)}}return W_({delta:c?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:c?[l-1,l]:[l,l+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,panels:o.panels,prevLayout:s,derivedPanelConstraints:i}),panelConstraints:i});WD(s,d)||WS(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),l=a();e&&l!==t&&(n.expandToSize=l,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=i(),s=a();if(e&&s===t){let e=l.expandToSize??n;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&WA(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Wc({group:t});o(Ws(Wl({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function WL(e){e.defaultPrevented||WP(e,Wy).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,i=WR({groupId:t.group.id,panelId:n.id});i&&void 0!==r&&(i.resize(r),e.preventDefault())}}})}function W$(e){for(let[t]of Wy)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function WF({groupId:e}){let t=()=>{for(let[t,n]of Wy)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:l}=t(),s=WT({layout:e,panelConstraints:r});return n?o:(WD(o,s)||WS(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:s,separatorToPanels:l}),s)}}}function WV(e,t){let n=W$(e),r=Wj(n.id,!0),i=n.separators.find(t=>t.element===e);Wu(i,"Matching separator not found");let a=r.separatorToPanels.get(i);Wu(a,"Matching panels not found");let o=a.map(e=>n.panels.indexOf(e)),l=WF({groupId:n.id}).getLayout(),s=WT({layout:W_({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});WD(l,s)||WS(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:s,separatorToPanels:r.separatorToPanels})}function WB(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=W$(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&WV(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&WV(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&WV(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&WV(t,-5);break;case"End":e.preventDefault(),WV(t,100);break;case"Enter":{e.preventDefault();let n=W$(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Wj(n.id,!0),o=n.separators.find(e=>e.element===t);Wu(o,"Matching separator not found");let l=a.get(o);Wu(l,"Matching panels not found");let s=l[0],c=r.find(e=>e.panelId===s.id);if(Wu(c,"Panel metadata not found"),c.collapsible){let e=i[s.id];WV(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[s.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=W$(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Wu(null!==r,"Index not found");let i=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[i].focus({preventScroll:!0});break}case"Home":e.preventDefault(),WV(t,-100)}}let WH={cursorFlags:0,state:"inactive"},WW=new Wx;function WU(e){let t=WH;WH=e,WW.emit("change",{prev:t,next:e})}function Wq(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=Wy,n=WP(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WU({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let WK=e=>e,WG=()=>{};function WY(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let WX=new WeakMap;function WZ(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=WX.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=WH;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":i++}})}if(0!==r||0!==i){if("active"===n&&e&&WY()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return WY()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?0===n.cssRules.length?n.insertRule(i):n.replaceSync(i):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}WX.set(e,{prevStyle:t,styleSheet:n})}function WJ({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){var l;let s,c,d=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:l,panels:s}=n,{disableCursor:c}=n.mutableState,u=0;u=a?"horizontal"===l?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),h=i.get(n);if(!f||!h)return;let{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:v,separatorToPanels:x}=h;if(m&&v&&x){let t=W_({delta:u,initialLayout:f,panelConstraints:m,pivotIndices:e.panels.map(e=>s.indexOf(e)),prevLayout:v,trigger:"mouse-or-touch"});if(WD(t,v)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else WS(e.group,{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:t,separatorToPanels:x})}});let u=0;0===t.movementX?u|=3&o:u|=3&d,0===t.movementY?u|=12&o:u|=12&d,l=u,s=WH,(c={...WH}).cursorFlags=l,WH=c,WW.emit("change",{prev:s,next:c}),WZ(e)}function WQ(e){let t=Wy,n=WH;"active"===n.state&&WJ({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function W0(e){if(e.defaultPrevented)return;let t=WH,n=Wy;if("active"===t.state){if(0===e.buttons){WU({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=Wj(e.group.id,!0);WS(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}WJ({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=WP(e,n);0===r.length?"inactive"!==t.state&&WU({cursorFlags:0,state:"inactive"}):WU({cursorFlags:0,hitRegions:r,state:"hover"}),WZ(e.currentTarget)}}function W1(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===WH.state&&WU({cursorFlags:0,state:"inactive"})}function W2(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=WH;"active"===t.state&&(WU({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(WZ(e.currentTarget),t.hitRegions.forEach(e=>{let t=Wj(e.group.id,!0);WS(e.group,t)}),e.preventDefault()))}function W5(e){let t=0,n=0,r={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=Ws(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(0!==i){let t=Ws((100-n)/i);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let W4=new Map;function W3(e){let t=(0,ew.useId)();return`${e??t}`}let W6="u">typeof window?ew.useLayoutEffect:ew.useEffect;function W8(e){let t=(0,ew.useRef)(e);return W6(()=>{t.current=e},[e]),(0,ew.useCallback)((...e)=>t.current?.(...e),[t])}function W7(...e){return W8(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function W9(e){let t=(0,ew.useRef)({...e});return W6(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let Ue=(0,ew.createContext)(null);function Ut({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:l,onLayoutChange:s,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...h}){let p,m=(0,ew.useRef)({onLayoutChange:{},onLayoutChanged:{}}),g=W8(e=>{WD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,s?.(e))}),v=W8(e=>{WD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,c?.(e))}),x=W3(l),y=(0,ew.useRef)(null),[b,w]=function(){let[e,t]=(0,ew.useState)({});return[e,(0,ew.useCallback)(()=>t({}),[])]}(),j=(0,ew.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=W7(y,a);p=(0,ew.useRef)({getLayout:()=>({}),setLayout:WK}),(0,ew.useImperativeHandle)(o,()=>p.current,[]),W6(()=>{Object.assign(p.current,WF({groupId:x}))});let S=W8((e,t)=>{let r=WH,i=Ww(e),a=Wj(e);if(a){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),C=W9({defaultLayout:n,disableCursor:r}),N=(0,ew.useMemo)(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:S,id:x,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=Wf(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=Wf(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},updatePanelProps:(e,{disabled:t})=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Ww(x),i=Wj(x);r&&i&&WS(r,{...i,derivedPanelConstraints:Wd(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=j.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[S,x,w,d,C]),M=(0,ew.useRef)(null);return W6(()=>{let e,t,n,r,a,o,l,s,c,u,f,h,p,m=y.current;if(null===m)return;let b=j.current;if(void 0!==C.defaultLayout&&Object.keys(C.defaultLayout).length===b.panels.length)for(let t of(e={},b.panels)){let n=C.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!i,element:m,id:x,mutableState:{defaultLayout:e,disableCursor:!!C.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:b.panels,resizeTargetMinimumSize:b.resizeTargetMinimumSize,separators:b.separators};M.current=w;let k=(t=!0,Wu(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,(o=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=Wc({group:w});if(0===e)return;let t=Wj(w.id);if(!t)return;let n=Wd(w),r=t.defaultLayoutDeferred?W5(n):t.layout,i=WT({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,l=new Map,s=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){o=!0;let r=Ws(e/100*n/t*100);l.set(c.id,r),i+=r}else s.push(c.id),a+=e}if(!o||0===s.length)return r;let c=100-i,d={...r};if(l.forEach((e,t)=>{d[t]=e}),a>0)for(let e of s){let t=r[e]??0;d[e]=Ws(t/a*c)}else{let e=Ws(c/s.length);for(let t of s)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&WD(t.layout,i)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;WS(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:i,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Wc({group:e}),a="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,l={asPercentage:Ws(a/i*100),inPixels:a};r.mutableValues.prevSize=l,r.onResize(l,r.id,o)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{Wu(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&o.observe(e.element)}),l=Wc({group:w}),s=Wd(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),f=WT({layout:w.mutableState.layouts[c]??u??W5(s),panelConstraints:s}),h=w.element.ownerDocument,W4.set(h,(W4.get(h)??0)+1),p=new Map,Wv(w).forEach(e=>{e.separator&&p.set(e.separator,e.panels)}),WS(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:s,groupSize:l,layout:f,separatorToPanels:p}),w.separators.forEach(e=>{Wu(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",WB)}),1===W4.get(h)&&(h.addEventListener("dblclick",WL,!0),h.addEventListener("pointerdown",Wq,!0),h.addEventListener("pointerleave",WQ),h.addEventListener("pointermove",W0),h.addEventListener("pointerout",W1),h.addEventListener("pointerup",W2,!0)),function(){t=!1,W4.set(h,Math.max(0,(W4.get(h)??0)-1)),(Wy=new Map(Wy)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",WB)}),W4.get(h)||(h.removeEventListener("dblclick",WL,!0),h.removeEventListener("pointerdown",Wq,!0),h.removeEventListener("pointerleave",WQ),h.removeEventListener("pointermove",W0),h.removeEventListener("pointerout",W1),h.removeEventListener("pointerup",W2,!0)),o.disconnect()}),{defaultLayoutDeferred:S,derivedPanelConstraints:N,layout:E}=Wj(w.id,!0);!S&&N.length>0&&(g(E),v(E));let O=Wk(x,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let i=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[i]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=WA(t.collapsedSize,r[t.panelId]),i=WA(t.collapsedSize,n[t.panelId]);e&&!i&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let a="active"!==WH.state;g(r),a&&v(r)});return()=>{M.current=null,k(),O()}},[i,x,v,g,d,b,C]),(0,ew.useEffect)(()=>{let e=M.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,eb.jsx)(Ue.Provider,{value:N,children:(0,eb.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function Un(){let e=(0,ew.useContext)(Ue);return Wu(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ur({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:l="preserve-relative-size",id:s,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:f,style:h,...p}){let m,g=!!s,v=W3(s),x=W9({disabled:a}),y=(0,ew.useRef)(null),b=W7(y,o),{getPanelStyles:w,id:j,orientation:k,registerPanel:S,updatePanelProps:C}=Un(),N=null!==u,M=W8((e,t,n)=>{u?.(e,s,n)});W6(()=>{let e=y.current;if(null!==e)return S({element:e,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?M:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:d}})},[l,n,r,i,N,v,g,c,d,M,S,x]),(0,ew.useEffect)(()=>{C(v,{disabled:a})},[a,v,C]),function(e,t){let{id:n}=Un(),r=(0,ew.useRef)({collapse:WG,expand:WG,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:WG});(0,ew.useImperativeHandle)(t,()=>r.current,[]),W6(()=>{Object.assign(r.current,WR({groupId:n,panelId:e}))})}(v,f);let E=()=>{let e=w(j,v);if(e)return JSON.stringify(e)},O=(0,ew.useSyncExternalStore)(e=>Wk(j,e),E,E);return m=O?JSON.parse(O):void 0!==i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,eb.jsx)("div",{...p,"data-disabled":a||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...Ui,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...m},children:(0,eb.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}Ut.displayName="Group",Ur.displayName="Panel";let Ui={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ua({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...l}){let s,c,d=W3(a),u=W9({disabled:n,disableDoubleClick:r}),[f,h]=(0,ew.useState)({}),[p,m]=(0,ew.useState)("inactive"),[g,v]=(0,ew.useState)(!1),x=(0,ew.useRef)(null),y=W7(x,i),{disableCursor:b,id:w,orientation:j,registerSeparator:k,updateSeparatorProps:S}=Un();return W6(()=>{let e=x.current;if(null!==e){var t;let n={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:e,id:d},r=k(n),i=(t=e=>{m("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},WW.addListener("change",t)),a=Wk(w,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:i}=e.next,a=i.get(n);if(a){let e=a[0],n=a.indexOf(e);h(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],l=t.find(e=>e.panelId===n);if(l){let s=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];a=WT({layout:W_({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],i=WT({layout:W_({delta:s-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{i(),a(),r()}}},[w,d,k,u]),(0,ew.useEffect)(()=>{S(d,{disabled:n,disableDoubleClick:r})},[n,r,d,S]),n&&!b&&(s="not-allowed"),c=n?"disabled":"active"===p?"active":g?"focus":p,(0,eb.jsx)("div",{...l,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===j?"vertical":"horizontal","aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":c,"data-testid":d,id:d,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:s,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}function Uo({className:e,direction:t,orientation:n,...r}){let i=n??t;return(0,eb.jsx)(Ut,{"data-slot":"resizable-panel-group","data-orientation":i??"horizontal",orientation:i,className:tK("flex h-full w-full data-[orientation=vertical]:flex-col",e),...r})}function Ul({...e}){return(0,eb.jsx)(Ur,{"data-slot":"resizable-panel",...e})}function Us({withHandle:e,className:t,...n}){return(0,eb.jsx)(Ua,{"data-slot":"resizable-handle",className:tK("relative flex w-px items-center justify-center bg-border outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&(0,eb.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-background",children:(0,eb.jsx)(Wo,{className:"size-2.5"})})})}Ua.displayName="Separator";let Uc=eN("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Ud=eN("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Uu=eN("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Uf=eN("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var Uh=e.i(21957);let Up=Array(12).fill(0),Um=({visible:e,className:t})=>ew.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ew.default.createElement("div",{className:"sonner-spinner"},Up.map((e,t)=>ew.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),Ug=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Uv=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Ux=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Uy=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ub=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ew.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ew.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Uw=1,Uj=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Uw++,a=this.toasts.find(e=>e.id===i),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(t=>t.id===i?(this.publish({...t,...e,id:i,title:n}),{...t,...e,id:i,dismissible:o,title:n}):t):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n,r;if(!t)return;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let i=Promise.resolve(e instanceof Function?e():e),a=void 0!==r,o=i.then(async e=>{if(n=["resolve",e],ew.default.isValidElement(e))a=!1,this.create({id:r,type:"default",message:e});else if(Uk(e)&&!e.ok){a=!1;let n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,i="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(e instanceof Error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(void 0!==t.success){a=!1;let n="function"==typeof t.success?await t.success(e):t.success,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:i,...o})}}).catch(async e=>{if(n=["reject",e],void 0!==t.error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),l=()=>new Promise((e,t)=>o.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||Uw++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Uk=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,US=Object.assign((e,t)=>{let n=(null==t?void 0:t.id)||Uw++;return Uj.addToast({title:e,...t,id:n}),n},{success:Uj.success,info:Uj.info,warning:Uj.warning,error:Uj.error,custom:Uj.custom,message:Uj.message,promise:Uj.promise,dismiss:Uj.dismiss,loading:Uj.loading},{getHistory:()=>Uj.toasts,getToasts:()=>Uj.getActiveToasts()});function UC(e){return void 0!==e.label}function UN(...e){return e.filter(Boolean).join(" ")}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let UM=e=>{var t,n,r,i,a,o,l,s,c,d,u,f,h;let{invert:p,toast:m,unstyled:g,interacting:v,setHeights:x,visibleToasts:y,heights:b,index:w,toasts:j,expanded:k,removeToast:S,defaultRichColors:C,closeButton:N,style:M,cancelButtonStyle:E,actionButtonStyle:O,className:P="",descriptionClassName:A="",duration:z,position:I,gap:_,expandByDefault:D,classNames:T,icons:R,closeButtonAriaLabel:L="Close toast"}=e,[$,F]=ew.default.useState(null),[V,B]=ew.default.useState(null),[H,W]=ew.default.useState(!1),[U,q]=ew.default.useState(!1),[K,G]=ew.default.useState(!1),[Y,X]=ew.default.useState(!1),[Z,J]=ew.default.useState(!1),[Q,ee]=ew.default.useState(0),[et,en]=ew.default.useState(0),er=ew.default.useRef(m.duration||z||4e3),ei=ew.default.useRef(null),ea=ew.default.useRef(null),eo=0===w,el=w+1<=y,es=m.type,ec=!1!==m.dismissible,ed=m.className||"",eu=m.descriptionClassName||"",ef=ew.default.useMemo(()=>b.findIndex(e=>e.toastId===m.id)||0,[b,m.id]),eh=ew.default.useMemo(()=>{var e;return null!=(e=m.closeButton)?e:N},[m.closeButton,N]),ep=ew.default.useMemo(()=>m.duration||z||4e3,[m.duration,z]),em=ew.default.useRef(0),eg=ew.default.useRef(0),ev=ew.default.useRef(0),ex=ew.default.useRef(null),[ey,eb]=I.split("-"),ej=ew.default.useMemo(()=>b.reduce((e,t,n)=>n>=ef?e:e+t.height,0),[b,ef]),ek=(()=>{let[e,t]=ew.default.useState(document.hidden);return ew.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),eS=m.invert||p,eC="loading"===es;eg.current=ew.default.useMemo(()=>ef*_+ej,[ef,ej]),ew.default.useEffect(()=>{er.current=ep},[ep]),ew.default.useEffect(()=>{W(!0)},[]),ew.default.useEffect(()=>{let e=ea.current;if(e){let t=e.getBoundingClientRect().height;return en(t),x(e=>[{toastId:m.id,height:t,position:m.position},...e]),()=>x(e=>e.filter(e=>e.toastId!==m.id))}},[x,m.id]),ew.default.useLayoutEffect(()=>{if(!H)return;let e=ea.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,en(n),x(e=>e.find(e=>e.toastId===m.id)?e.map(e=>e.toastId===m.id?{...e,height:n}:e):[{toastId:m.id,height:n,position:m.position},...e])},[H,m.title,m.description,x,m.id,m.jsx,m.action,m.cancel]);let eN=ew.default.useCallback(()=>{q(!0),ee(eg.current),x(e=>e.filter(e=>e.toastId!==m.id)),setTimeout(()=>{S(m)},200)},[m,S,x,eg]);ew.default.useEffect(()=>{let e;if((!m.promise||"loading"!==es)&&m.duration!==1/0&&"loading"!==m.type){if(k||v||ek){if(ev.current<em.current){let e=new Date().getTime()-em.current;er.current=er.current-e}ev.current=new Date().getTime()}else er.current!==1/0&&(em.current=new Date().getTime(),e=setTimeout(()=>{null==m.onAutoClose||m.onAutoClose.call(m,m),eN()},er.current));return()=>clearTimeout(e)}},[k,v,m,es,ek,eN]),ew.default.useEffect(()=>{m.delete&&(eN(),null==m.onDismiss||m.onDismiss.call(m,m))},[eN,m.delete]);let eM=m.icon||(null==R?void 0:R[es])||(e=>{switch(e){case"success":return Ug;case"info":return Ux;case"warning":return Uv;case"error":return Uy;default:return null}})(es);return ew.default.createElement("li",{tabIndex:0,ref:ea,className:UN(P,ed,null==T?void 0:T.toast,null==m||null==(t=m.classNames)?void 0:t.toast,null==T?void 0:T.default,null==T?void 0:T[es],null==m||null==(n=m.classNames)?void 0:n[es]),"data-sonner-toast":"","data-rich-colors":null!=(d=m.richColors)?d:C,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":H,"data-promise":!!m.promise,"data-swiped":Z,"data-removed":U,"data-visible":el,"data-y-position":ey,"data-x-position":eb,"data-index":w,"data-front":eo,"data-swiping":K,"data-dismissible":ec,"data-type":es,"data-invert":eS,"data-swipe-out":Y,"data-swipe-direction":V,"data-expanded":!!(k||D&&H),"data-testid":m.testId,style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${U?Q:eg.current}px`,"--initial-height":D?"auto":`${et}px`,...M,...m.style},onDragEnd:()=>{G(!1),F(null),ex.current=null},onPointerDown:e=>{2===e.button||eC||!ec||(ei.current=new Date,ee(eg.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(G(!0),ex.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r,i;if(Y||!ec)return;ex.current=null;let a=Number((null==(e=ea.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ea.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),l=new Date().getTime()-(null==(n=ei.current)?void 0:n.getTime()),s="x"===$?a:o,c=Math.abs(s)/l;if(Math.abs(s)>=45||c>.11){ee(eg.current),null==m.onDismiss||m.onDismiss.call(m,m),"x"===$?B(a>0?"right":"left"):B(o>0?"down":"up"),eN(),X(!0);return}null==(r=ea.current)||r.style.setProperty("--swipe-amount-x","0px"),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y","0px"),J(!1),G(!1),F(null)},onPointerMove:t=>{var n,r,i,a;if(!ex.current||!ec||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let o=t.clientY-ex.current.y,l=t.clientX-ex.current.x,s=null!=(a=e.swipeDirections)?a:function(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(I);!$&&(Math.abs(l)>1||Math.abs(o)>1)&&F(Math.abs(l)>Math.abs(o)?"x":"y");let c={x:0,y:0},d=e=>1/(1.5+Math.abs(e)/20);if("y"===$){if(s.includes("top")||s.includes("bottom"))if(s.includes("top")&&o<0||s.includes("bottom")&&o>0)c.y=o;else{let e=o*d(o);c.y=Math.abs(e)<Math.abs(o)?e:o}}else if("x"===$&&(s.includes("left")||s.includes("right")))if(s.includes("left")&&l<0||s.includes("right")&&l>0)c.x=l;else{let e=l*d(l);c.x=Math.abs(e)<Math.abs(l)?e:l}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(r=ea.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y",`${c.y}px`)}},eh&&!m.jsx&&"loading"!==es?ew.default.createElement("button",{"aria-label":L,"data-disabled":eC,"data-close-button":!0,onClick:eC||!ec?()=>{}:()=>{eN(),null==m.onDismiss||m.onDismiss.call(m,m)},className:UN(null==T?void 0:T.closeButton,null==m||null==(r=m.classNames)?void 0:r.closeButton)},null!=(u=null==R?void 0:R.close)?u:Ub):null,(es||m.icon||m.promise)&&null!==m.icon&&((null==R?void 0:R[es])!==null||m.icon)?ew.default.createElement("div",{"data-icon":"",className:UN(null==T?void 0:T.icon,null==m||null==(i=m.classNames)?void 0:i.icon)},m.promise||"loading"===m.type&&!m.icon?m.icon||((null==R?void 0:R.loading)?ew.default.createElement("div",{className:UN(null==T?void 0:T.loader,null==m||null==(h=m.classNames)?void 0:h.loader,"sonner-loader"),"data-visible":"loading"===es},R.loading):ew.default.createElement(Um,{className:UN(null==T?void 0:T.loader,null==m||null==(f=m.classNames)?void 0:f.loader),visible:"loading"===es})):null,"loading"!==m.type?eM:null):null,ew.default.createElement("div",{"data-content":"",className:UN(null==T?void 0:T.content,null==m||null==(a=m.classNames)?void 0:a.content)},ew.default.createElement("div",{"data-title":"",className:UN(null==T?void 0:T.title,null==m||null==(o=m.classNames)?void 0:o.title)},m.jsx?m.jsx:"function"==typeof m.title?m.title():m.title),m.description?ew.default.createElement("div",{"data-description":"",className:UN(A,eu,null==T?void 0:T.description,null==m||null==(l=m.classNames)?void 0:l.description)},"function"==typeof m.description?m.description():m.description):null),ew.default.isValidElement(m.cancel)?m.cancel:m.cancel&&UC(m.cancel)?ew.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||E,onClick:e=>{!UC(m.cancel)||ec&&(null==m.cancel.onClick||m.cancel.onClick.call(m.cancel,e),eN())},className:UN(null==T?void 0:T.cancelButton,null==m||null==(s=m.classNames)?void 0:s.cancelButton)},m.cancel.label):null,ew.default.isValidElement(m.action)?m.action:m.action&&UC(m.action)?ew.default.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||O,onClick:e=>{!UC(m.action)||(null==m.action.onClick||m.action.onClick.call(m.action,e),e.defaultPrevented||eN())},className:UN(null==T?void 0:T.actionButton,null==m||null==(c=m.classNames)?void 0:c.actionButton)},m.action.label):null)};function UE(){if("u"<typeof window||"u"<typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}let UO=ew.default.forwardRef(function(e,t){let{id:n,invert:r,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:s,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:h,style:p,visibleToasts:m=3,toastOptions:g,dir:v=UE(),gap:x=14,icons:y,containerAriaLabel:b="Notifications"}=e,[w,j]=ew.default.useState([]),k=ew.default.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),S=ew.default.useMemo(()=>Array.from(new Set([i].concat(k.filter(e=>e.position).map(e=>e.position)))),[k,i]),[C,N]=ew.default.useState([]),[M,E]=ew.default.useState(!1),[O,P]=ew.default.useState(!1),[A,z]=ew.default.useState("system"!==u?u:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=ew.default.useRef(null),_=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=ew.default.useRef(null),T=ew.default.useRef(!1),R=ew.default.useCallback(e=>{j(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||Uj.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return ew.default.useEffect(()=>Uj.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{j(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{t3.default.flushSync(()=>{j(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),ew.default.useEffect(()=>{if("system"!==u)return void z(u);if("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),"u"<typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{e?z("dark"):z("light")})}catch(t){e.addListener(({matches:e})=>{try{e?z("dark"):z("light")}catch(e){console.error(e)}})}},[u]),ew.default.useEffect(()=>{w.length<=1&&E(!1)},[w]),ew.default.useEffect(()=>{let e=e=>{var t,n;a.every(t=>e[t]||e.code===t)&&(E(!0),null==(n=I.current)||n.focus()),"Escape"===e.code&&(document.activeElement===I.current||(null==(t=I.current)?void 0:t.contains(document.activeElement)))&&E(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),ew.default.useEffect(()=>{if(I.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,T.current=!1)}},[I.current]),ew.default.createElement("section",{ref:t,"aria-label":`${b} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((t,n)=>{var i;let a,[u,b]=t.split("-");return k.length?ew.default.createElement("ol",{key:t,dir:"auto"===v?UE():v,tabIndex:-1,ref:I,className:s,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":u,"data-x-position":b,style:{"--front-toast-height":`${(null==(i=C[0])?void 0:i.height)||0}px`,"--width":"356px","--gap":`${x}px`,...p,...(a={},[c,d].forEach((e,t)=>{let n=1===t,r=n?"--mobile-offset":"--offset",i=n?"16px":"24px";function o(e){["top","right","bottom","left"].forEach(t=>{a[`${r}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?a[`${r}-${t}`]=i:a[`${r}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(i)}),a)},onBlur:e=>{T.current&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:e=>{!(e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible)&&(T.current||(T.current=!0,D.current=e.relatedTarget))},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{O||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||P(!0)},onPointerUp:()=>P(!1)},k.filter(e=>!e.position&&0===n||e.position===t).map((n,i)=>{var a,s;return ew.default.createElement(UM,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:h,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(s=null==g?void 0:g.closeButton)?s:l,interacting:O,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:R,toasts:k.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:N,expandByDefault:o,gap:x,expanded:M,swipeDirections:e.swipeDirections})})):null}))});function UP({className:e,position:t="top-right",closeButton:n=!0,richColors:r=!1,visibleToasts:i=4,toastOptions:a,...o}){let{theme:l="system"}=(0,Uh.useTheme)();return(0,eb.jsx)(UO,{theme:l,position:t,closeButton:n,richColors:r,visibleToasts:i,className:tK("toaster group",e),icons:{success:(0,eb.jsx)(Uc,{className:"size-4"}),info:(0,eb.jsx)(vj,{className:"size-4"}),warning:(0,eb.jsx)(Uf,{className:"size-4"}),error:(0,eb.jsx)(Uu,{className:"size-4"}),loading:(0,eb.jsx)(Ud,{className:"size-4 animate-spin"})},toastOptions:{...a,classNames:{toast:"vtl-surface-popover group toast group-[.toaster]:rounded-[var(--surface-popover-radius)] group-[.toaster]:border group-[.toaster]:gap-3 group-[.toaster]:p-3",title:"group-[.toast]:text-sm group-[.toast]:font-medium",description:"group-[.toast]:text-sm group-[.toast]:text-muted-foreground",icon:"group-[.toast]:text-foreground",actionButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:bg-primary group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-foreground",closeButton:"group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:text-muted-foreground",success:"group-[.toast]:text-foreground",info:"group-[.toast]:text-foreground",warning:"group-[.toast]:text-foreground",error:"group-[.toast]:text-foreground",loading:"group-[.toast]:text-foreground",...a?.classNames}},style:{"--normal-bg":"var(--surface-popover)","--normal-text":"var(--surface-popover-foreground)","--normal-border":"var(--surface-popover-border)","--border-radius":"var(--surface-popover-radius)"},...o})}var UA="Tabs",[Uz,UI]=tX(UA,[vH]),U_=vH(),[UD,UT]=Uz(UA),UR=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:s="automatic",...c}=e,d=fb(l),[u,f]=t0({prop:r,onChange:i,defaultProp:a??"",caller:UA});return(0,eb.jsx)(UD,{scope:n,baseId:cR(),value:u,onValueChange:f,orientation:o,dir:d,activationMode:s,children:(0,eb.jsx)(ne.div,{dir:d,"data-orientation":o,...c,ref:t})})});UR.displayName=UA;var UL="TabsList",U$=ew.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=UT(UL,n),o=U_(n);return(0,eb.jsx)(vq,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,eb.jsx)(ne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});U$.displayName=UL;var UF="TabsTrigger",UV=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=UT(UF,n),l=U_(n),s=UW(o.baseId,r),c=UU(o.baseId,r),d=r===o.value;return(0,eb.jsx)(vY,{asChild:!0,...l,focusable:!i,active:d,children:(0,eb.jsx)(ne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:s,...a,ref:t,onMouseDown:tZ(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(r)}),onKeyDown:tZ(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(r)}),onFocus:tZ(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(r)})})})});UV.displayName=UF;var UB="TabsContent",UH=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,l=UT(UB,n),s=UW(l.baseId,r),c=UU(l.baseId,r),d=r===l.value,u=ew.useRef(d);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,eb.jsx)(t5,{present:i||d,children:({present:n})=>(0,eb.jsx)(ne.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":s,hidden:!n,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:n&&a})})});function UW(e,t){return`${e}-trigger-${t}`}function UU(e,t){return`${e}-content-${t}`}function Uq({className:e,...t}){return(0,eb.jsx)(U$,{"data-slot":"tabs-list",className:tK("inline-flex h-8 items-center justify-center gap-0.5 rounded-lg bg-muted p-1 text-muted-foreground",e),...t})}function UK({className:e,...t}){return(0,eb.jsx)(UV,{"data-slot":"tabs-trigger",className:tK("inline-flex h-6 shrink-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",e),...t})}function UG({className:e,...t}){return(0,eb.jsx)(UH,{"data-slot":"tabs-content",className:tK("mt-3 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),...t})}UH.displayName=UB;let UY=HB.map(e=>({id:e.id,title:e.title,description:e.description,icon:e.icon,keywords:e.keywords}));function UX(e){return UY.find(t=>t.id===e)}function UZ(e){return"subagent-conversation-panel"!==e.kind}let UJ="application/vnd.vantaloom.agent-panel";function UQ(e){let t=UZ(e)?UX(e.kind):void 0,n={content:e};return{id:`agent-panel-${e.id}`,title:e.title,description:t?.description??("subagent-conversation-panel"===e.kind?"子代理运行信息流。":"来自 Agent 工作区的面板。"),meta:"Agent panel",icon:t?.icon,dragData:{"application/vnd.vantaloom.clip-kind":"agent-panel",[UJ]:JSON.stringify(n)},payloads:{[UJ]:n}}}let U0=eN("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),U1=eN("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),U2=eN("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),U5=eN("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var U4=e=>e.graphicalItems.polarItems,U3=jJ([M2,M5],A_),U6=jJ([U4,AA,U3],AR),U8=jJ([U6],AB),U7=jJ([U8,MP],AU),U9=jJ([U7,AA,U6],AK);jJ([U7,AA,U6],(e,t,n)=>n.length>0?e.flatMap(e=>n.flatMap(n=>{var r;return{value:k8(e,null!=(r=t.dataKey)?r:n.dataKey),errorDomain:[]}})).filter(Boolean):(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:k8(e,t.dataKey),errorDomain:[]})):e.map(e=>({value:e,errorDomain:[]})));var qe=()=>void 0,qt=jJ([U7,AA,U6,zr,M2,M_],za),qn=jJ([AA,ze,zt,qe,qt,qe,SY,M2],zj),qr=jJ([AA,SY,U7,U9,MX,M2,qn],zC),qi=jJ([qr,Az,zM],zE),qa=jJ([AA,qr,qi,M2],zP);function qo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qo(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}jJ([zM,qa],Et);var qs=jJ([U4,(e,t)=>t],(e,t)=>e.filter(e=>"pie"===e.type).find(e=>e.id===t)),qc=[],qd=(e,t,n)=>(null==n?void 0:n.length)===0?qc:n,qu=jJ([MP,qs,qd],(e,t,n)=>{var r,{chartData:i}=e;if(null!=t&&((r=(null==t?void 0:t.data)!=null&&t.data.length>0?t.data:i)&&r.length||null==n||(r=n.map(e=>ql(ql({},t.presentationProps),e.props))),null!=r))return r}),qf=jJ([qu,qs,qd],(e,t,n)=>{if(null!=e&&null!=t)return e.map((e,r)=>{var i,a,o=k8(e,t.nameKey,t.name);return a=null!=n&&null!=(i=n[r])&&null!=(i=i.props)&&i.fill?n[r].props.fill:"object"==typeof e&&null!=e&&"fill"in e?e.fill:t.fill,{value:Sc(o,t.dataKey),color:a,payload:e,type:t.legendType}})}),qh=jJ([qu,qs,qd,Sb],(e,t,n,r)=>{if(null!=t&&null!=e)return function(e){var t,n,r,{pieSettings:i,displayedData:a,cells:o,offset:l}=e,{cornerRadius:s,startAngle:c,endAngle:d,dataKey:u,nameKey:f,tooltipType:h}=i,p=Math.abs(i.minAngle),m=wu(d-c)*Math.min(Math.abs(d-c),360),g=Math.abs(m),v=a.length<=1?0:null!=(t=i.paddingAngle)?t:0,x=a.filter(e=>0!==k8(e,u,0)).length,y=a.reduce((e,t)=>{var n=k8(t,u,0);return e+(wp(n)?n:0)},0),b=p>0&&y>0&&a.some(e=>{var t=k8(e,u,0),n=(wp(t)?t:0)/y;return 0!==t&&n*g<p})?p:0,w=g-x*b-(g>=360?x:x-1)*v;return y>0&&(n=a.map((e,t)=>{var n,a=k8(e,u,0),d=k8(e,f,t),p=((e,t,n)=>{var r,{top:i,left:a,width:o,height:l}=t,s=CF(o,l),c=a+wx(e.cx,o,o/2),d=i+wx(e.cy,l,l/2),u=wx(e.innerRadius,s,0);return{cx:c,cy:d,innerRadius:u,outerRadius:(r=e.outerRadius,"function"==typeof r?wx(r(n),s,.8*s):wx(r,s,.8*s)),maxRadius:e.maxRadius||Math.sqrt(o*o+l*l)/2}})(i,l,e),g=(wp(a)?a:0)/y,x=qw(qw({},e),o&&o[t]&&o[t].props),j=null!=x&&"fill"in x&&"string"==typeof x.fill?x.fill:i.fill,k=(n=t?r.endAngle+wu(m)*v*(0!==a):c)+wu(m)*((0!==a?b:0)+g*w),S=(n+k)/2,C=(p.innerRadius+p.outerRadius)/2,N=[{name:d,value:a,payload:x,dataKey:u,type:h,color:j,fill:j,graphicalItemId:i.id}],M=C$(p.cx,p.cy,C,S);return r=qw(qw(qw(qw({},i.presentationProps),{},{percent:g,cornerRadius:"string"==typeof s?parseFloat(s):s,name:d,tooltipPayload:N,midAngle:S,middleRadius:C,tooltipPosition:M},x),p),{},{value:a,dataKey:u,startAngle:n,endAngle:k,payload:x,paddingAngle:0!==a?wu(m)*v:0})})),n}({offset:r,pieSettings:t,displayedData:e,cells:n})}),qp=["key"],qm=["onMouseEnter","onClick","onMouseLeave"],qg=["id"],qv=["id"];function qx(){return(qx=Object.assign.bind()).apply(null,arguments)}function qy(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qj(e){var t=(0,ew.useMemo)(()=>Mb(e.children,F0),[e.children]),n=wL(n=>qf(n,e.id,t));return null==n?null:ew.createElement(Dp,{legendPayload:n})}var qk=ew.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:s,tooltipType:c,id:d,activeShape:u}=e,f=function(e){if(null!=e&&"boolean"!=typeof e&&"function"!=typeof e){if(ew.isValidElement(e)){var t,n=null==(t=e.props)?void 0:t.fill;return"string"==typeof n?n:void 0}var{fill:r}=e;return"string"==typeof r?r:void 0}}(u),h={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return null==f||null==t?t:t.map(e=>qw(qw({},e),{},{color:f,fill:f}))}),getPosition:e=>{var t;return null==(t=r[Number(e)])?void 0:t.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Sc(l,t),hide:s,type:c,color:o,unit:"",graphicalItemId:d}};return ew.createElement(_V,{tooltipEntrySettings:h})});function qS(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=wP(n),s=wA(i),c=wA(a),d="object"==typeof i&&"offsetRadius"in i&&"number"==typeof i.offsetRadius&&i.offsetRadius||20,u=t.map((e,t)=>{var n,r,u=(e.startAngle+e.endAngle)/2,f=C$(e.cx,e.cy,e.outerRadius+d,u),h=qw(qw(qw(qw({},l),e),{},{stroke:"none"},s),{},{index:t,textAnchor:(n=f.x)>(r=e.cx)?"start":n<r?"end":"middle"},f),p=qw(qw(qw(qw({},l),e),{},{fill:"none",stroke:e.fill},c),{},{index:t,points:[C$(e.cx,e.cy,e.outerRadius,u),f],key:"line"});return ew.createElement(NG,{zIndex:CV.label,key:"label-".concat(e.startAngle,"-").concat(e.endAngle,"-").concat(e.midAngle,"-").concat(t)},ew.createElement(Ct,null,a&&((e,t)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);if("function"==typeof e)return e(t);var n=eH("recharts-pie-label-line","boolean"!=typeof e?e.className:""),{key:r}=t,i=qy(t,qp);return ew.createElement(S8,qx({},i,{type:"linear",className:n}))})(a,p),((e,t,n)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);var r=n;if("function"==typeof e&&(r=e(t),ew.isValidElement(r)))return r;var i=eH("recharts-pie-label-text",Lk(e));return ew.createElement(CD,qx({},t,{alignmentBaseline:"middle",className:i}),r)})(i,h,k8(e,o))))});return ew.createElement(Ct,{className:"recharts-pie-labels"},u)}function qC(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return"object"==typeof i&&null!=i&&"position"in i?ew.createElement(Mf,{label:i}):ew.createElement(qS,{sectors:t,props:n,showLabels:r})}function qN(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=wL(_u),s=wL(_h),c=wL(_p),{onMouseEnter:d,onClick:u,onMouseLeave:f}=i,h=qy(i,qm),p=Vl(d,i.dataKey,o),m=Vs(f),g=Vc(u,i.dataKey,o);return null==t||0===t.length?null:ew.createElement(ew.Fragment,null,t.map((e,d)=>{if((null==e?void 0:e.startAngle)===0&&(null==e?void 0:e.endAngle)===0&&1!==t.length)return null;var u=null==c||c===o,f=String(d)===l&&(null==s||i.dataKey===s)&&u,v=n&&f?n:l?r:null,x=qw(qw({},e),{},{stroke:e.stroke,tabIndex:-1,[Sg]:d,[Sv]:o});return ew.createElement(Ct,qx({key:"sector-".concat(null==e?void 0:e.startAngle,"-").concat(null==e?void 0:e.endAngle,"-").concat(e.midAngle,"-").concat(d),tabIndex:-1,className:"recharts-pie-sector"},wl(h,e,d),{onMouseEnter:p(e,d),onMouseLeave:m(e,d),onClick:g(e,d)}),ew.createElement(Vr,qx({option:null!=a?a:v,index:d,shapeType:"sector",isActive:f},x)))}))}function qM(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,ew.useMemo)(()=>t&&n?n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})):[],[n,t]);return ew.createElement(Md,{value:t?i:void 0},r)}function qE(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,activeShape:c,inactiveShape:d,onAnimationStart:u,onAnimationEnd:f}=t,h=Dm(t,"recharts-pie-"),p=n.current,[m,g]=(0,ew.useState)(!1),v=(0,ew.useCallback)(()=>{"function"==typeof f&&f(),g(!1)},[f]),x=(0,ew.useCallback)(()=>{"function"==typeof u&&u(),g(!0)},[u]);return ew.createElement(qM,{showLabels:!m,sectors:i},ew.createElement(DX,{animationId:h,begin:o,duration:l,isActive:a,easing:s,onAnimationStart:x,onAnimationEnd:v,key:h},e=>{var a,o=[],l=i&&i[0],s=null!=(a=null==l?void 0:l.startAngle)?a:0;return null==i||i.forEach((t,n)=>{var r=p&&p[n],i=n>0?(0,ws.default)(t,"paddingAngle",0):0;if(r){var a=wb(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),l=qw(qw({},t),{},{startAngle:s+i,endAngle:s+a+i});o.push(l),s=l.endAngle}else{var{endAngle:c,startAngle:d}=t,u=wb(0,c-d,e),f=qw(qw({},t),{},{startAngle:s+i,endAngle:s+u+i});o.push(f),s=f.endAngle}}),n.current=o,ew.createElement(Ct,null,ew.createElement(qN,{sectors:o,activeShape:c,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),ew.createElement(qC,{showLabels:!m,sectors:i,props:t}),t.children)}var qO={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:CV.area};function qP(e){var{id:t}=e,n=qy(e,qg),{hide:r,className:i,rootTabIndex:a}=e,o=(0,ew.useMemo)(()=>Mb(e.children,F0),[e.children]),l=wL(e=>qh(e,t,o)),s=(0,ew.useRef)(null),c=eH("recharts-pie",i);return r||null==l?(s.current=null,ew.createElement(Ct,{tabIndex:a,className:c})):ew.createElement(NG,{zIndex:e.zIndex},ew.createElement(qk,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),ew.createElement(Ct,{tabIndex:a,className:c},ew.createElement(qE,{props:qw(qw({},n),{},{sectors:l}),previousSectorsRef:s,id:t})))}var qA=function(e){var t=Cw(e,qO),{id:n}=t,r=qy(t,qv),i=wP(r);return ew.createElement(Dx,{id:n,type:"pie"},e=>ew.createElement(ew.Fragment,null,ew.createElement(DE,{type:"pie",id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),ew.createElement(qj,qx({},r,{id:e})),ew.createElement(qP,qx({},r,{id:e}))))};function qz(e){var t=w_();return(0,ew.useEffect)(()=>{t(T9(e))},[t,e]),null}qA.displayName="Pie";var qI=["layout"];function q_(){return(q_=Object.assign.bind()).apply(null,arguments)}function qD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var qT=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qD(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},RM),qR=(0,ew.forwardRef)(function(e,t){var n,r=Cw(e.categoricalChartProps,qT),{layout:i}=r,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(r,qI),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c}=e;return ew.createElement(RT,{preloadedState:{options:{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0}},reduxStoreName:null!=(n=r.id)?n:o},ew.createElement(RR,{chartData:r.data}),ew.createElement(RL,{layout:i,margin:r.margin}),ew.createElement(RF,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement(R$,{baseValue:void 0,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),ew.createElement(qz,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),ew.createElement(Ld,q_({},a,{ref:t})))});function qL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qL(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var qF=["item"],qV=q$(q$({},qT),{},{layout:"centric",startAngle:0,endAngle:360}),qB=(0,ew.forwardRef)((e,t)=>{var n=Cw(e,qV);return ew.createElement(qR,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:qF,tooltipPayloadSearcher:Tw,categoricalChartProps:n,ref:t})});let qH={placeholder:"Ask the agent to inspect, change, or explain this workspace...",mode:"Mode",model:"Model",attach:"Attach context",removeChip:"Remove context",queuedMessage:"Queued message",guideQueuedMessage:"Guide",removeQueuedMessage:"Remove queued message",moreQueuedMessageActions:"More queued message actions",contextUsage:"Context usage",contextUsed:"used",contextTokenSummary:"used {used} / {total}",toolCalls:"Tool calls",userMessages:"User messages",otherContext:"Other context",compressContext:"Compress context",send:"Run",stop:"Stop"},qW=[{id:"agent",label:"Agent",description:"Use tools and make changes.",icon:(0,eb.jsx)(ye,{className:"fill-current"})},{id:"planner",label:"Planner",description:"Plan before changing files.",icon:(0,eb.jsx)(B8,{})},{id:"reviewer",label:"Reviewer",description:"Inspect risks and regressions.",icon:(0,eb.jsx)(mR,{})}],qU=[{id:"gpt-5.5",label:"GPT-5.5",description:"Highest quality coding agent."},{id:"gpt-5.4",label:"GPT-5.4",description:"Balanced everyday work."},{id:"gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Fast lightweight passes."}];function qq(e){if(e)return"string"==typeof e.label||"number"==typeof e.label?String(e.label):e.id}function qK({value:e,defaultValue:t,onValueChange:n,modes:r=qW,modeId:i,defaultModeId:a,onModeChange:o,models:l=qU,modelId:s,defaultModelId:c,onModelChange:d,queuedMessages:u,defaultQueuedMessages:f=[],onQueuedMessagesChange:h,onQueueMessage:p,onRemoveQueuedMessage:m,queueOnTab:g=!0,renderQueuedMessageActions:v,contextUsage:x,chips:y=[],actions:b,footer:w,running:j=!1,disabled:k=!1,submitOnEnter:S=!0,minRows:C=2,maxRows:N=7,onSubmit:M,onStop:E,onAttach:O,labels:P,className:A,textareaClassName:z,toolbarClassName:I}){let _={...qH,...P},D=ew.useRef(null),T=ew.useId(),R=ew.useRef(0),[L,$]=function({value:e,defaultValue:t="",onChange:n}){let[r,i]=ew.useState(t);return[e??r,ew.useCallback(t=>{void 0===e&&i(t),n?.(t)},[n,e])]}({value:e,defaultValue:t,onChange:n}),[F,V]=ew.useState(f),[B,H]=ew.useState(a??r[0]?.id),[W,U]=ew.useState(c??l[0]?.id),q=i??B,K=s??W,G=r.find(e=>e.id===q)??r[0],Y=l.find(e=>e.id===K)??l[0],X=u??F,Z=L.trim().length>0&&!k;function J(){Z&&(M?.({value:L,modeId:G?.id,modelId:Y?.id}),$(""))}function Q(e){void 0===u&&V(e),h?.(e)}return ew.useLayoutEffect(()=>{let e=D.current;if(!e)return;e.style.height="0px";let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)?t*N:160;e.style.height=`${Math.min(e.scrollHeight,n)}px`,e.style.overflowY=e.scrollHeight>n?"auto":"hidden"},[N,L]),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer","data-running":j,className:tK("relative grid w-full",A),children:[X.length>0&&(0,eb.jsx)(qX,{messages:X,labels:_,renderActions:v,onRemove:function(e){let t=X.find(t=>t.id===e);if(!t)return;let n=X.filter(t=>t.id!==e);Q(n),m?.(e,t,n)}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-surface",className:tK("vtl-agent-input-composer-surface relative grid w-full gap-2 rounded-lg border border-border p-2 shadow-sm transition-colors"),children:[y.length>0&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-context",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:y.map(e=>(0,eb.jsx)(qZ,{chip:e,removeLabel:_.removeChip},e.id))}),(0,eb.jsx)("textarea",{ref:D,value:L,disabled:k,rows:C,placeholder:_.placeholder,"data-slot":"agent-input-composer-textarea",className:tK("min-h-10 w-full resize-none border-0 bg-transparent px-0.5 py-0 text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",z),onChange:e=>$(e.currentTarget.value),onKeyDown:e=>{g&&"Tab"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&function(){let e=L.trim();if(!e||k)return!1;R.current+=1;let t={id:`${T}-queued-${R.current}`,content:e},n=[...X,t];return Q(n),p?.(t,n),$(""),!0}()?e.preventDefault():!S||"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),J())}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-toolbar",className:tK("grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2",I),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,eb.jsx)(qJ,{label:_.mode,options:r,value:G?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"grid size-3.5 place-items-center text-muted-foreground [&_svg]:size-3",children:G?.icon??(0,eb.jsx)(ye,{className:"fill-current"})}),(0,eb.jsx)("span",{className:"truncate",children:qq(G)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===i&&H(e.id),o?.(e.id,e))}}),(0,eb.jsx)(qJ,{label:_.model,options:l,value:Y?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"truncate",children:qq(Y)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===s&&U(e.id),d?.(e.id,e))}}),O&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":_.attach,title:_.attach,onClick:O,disabled:k,children:(0,eb.jsx)(U2,{})}),b]}),(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,eb.jsx)(qY,{usage:x,labels:_}),(0,eb.jsx)(tY,{type:"button",size:"icon-xs",variant:j?"outline":"default","aria-label":j?_.stop:_.send,title:j?_.stop:_.send,disabled:!j&&!Z,className:"rounded-full",onClick:j?E:J,children:j?(0,eb.jsx)(U5,{className:"size-3 fill-current"}):(0,eb.jsx)(U0,{className:"size-3.5"})})]})]}),w&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-footer",className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:w})]})]})}function qG(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}function qY({usage:e,labels:t}){let[n,r]=ew.useState(!1),i=Math.max(0,e.used),a=Math.max(0,e.total),o=a>0?Math.min(100,Math.round(i/a*100)):0,l=Math.max(0,e.toolCalls),s=Math.max(0,e.userMessages),c=Math.max(0,e.other??Math.max(0,i-l-s)),d=[{name:"toolCalls",value:l,fill:"var(--color-toolCalls)"},{name:"userMessages",value:s,fill:"var(--color-userMessages)"},{name:"other",value:c,fill:"var(--color-other)"},{name:"unused",value:Math.max(0,a-i),fill:"var(--muted)"}].filter(e=>e.value>0),u=t.contextTokenSummary.replace("{used}",qG(i)).replace("{total}",qG(a)),f={toolCalls:{label:t.toolCalls,color:"var(--chart-1)"},userMessages:{label:t.userMessages,color:"var(--chart-3)"},other:{label:t.otherContext,color:"var(--chart-5)"}};return(0,eb.jsxs)(gN,{children:[(0,eb.jsx)(gP,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":`${t.contextUsage}: ${o}% ${t.contextUsed}`,title:`${t.contextUsage}: ${o}% ${t.contextUsed}`,children:(0,eb.jsx)("span",{"aria-hidden":"true",className:"grid size-4 place-items-center rounded-full",style:{background:`conic-gradient(var(--foreground) ${3.6*o}deg, var(--border) 0deg)`},children:(0,eb.jsx)("span",{className:"size-3 rounded-full bg-background dark:bg-popover"})})})}),(0,eb.jsxs)(gH,{side:"top",align:"center",sideOffset:8,className:"w-44 gap-2 p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-0.5 text-center",children:[(0,eb.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:e.label??t.contextUsage}),(0,eb.jsxs)("div",{className:"text-sm text-muted-foreground",children:[o,"% ",t.contextUsed]}),(0,eb.jsx)("div",{className:"text-sm font-medium",children:u})]}),(0,eb.jsx)("div",{className:"grid justify-center",children:(0,eb.jsx)(FI,{config:f,className:"h-20 w-20",initialDimension:{width:80,height:80},onMouseMove:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,eb.jsxs)(qB,{children:[(0,eb.jsx)(FD,{active:n,content:(0,eb.jsx)(FT,{hideLabel:!0})}),(0,eb.jsx)(qA,{data:d.length>0?d:[{name:"other",value:1,fill:"var(--muted)"}],dataKey:"value",nameKey:"name",innerRadius:25,outerRadius:35,isAnimationActive:!1,strokeWidth:0})]})})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:e.onCompress,disabled:!e.onCompress,children:t.compressContext})]})]})}function qX({messages:e,labels:t,renderActions:n,onRemove:r}){return(0,eb.jsx)("div",{"data-slot":"agent-input-composer-queue",className:"vtl-agent-input-composer-queue z-10 mx-5 mb-[-1px] grid gap-1.5 rounded-t-lg rounded-b-none border border-border p-1.5 shadow-xs",children:e.map((e,i)=>(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-queue-item",className:tK("group/queue flex min-h-8 min-w-0 items-center gap-2 rounded-md px-2 text-sm transition-colors",e.disabled?"text-muted-foreground opacity-60":"text-foreground hover:bg-muted/60"),children:[(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(U1,{})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",title:String(e.content),children:e.content}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover/queue:opacity-100",children:[n?.(e),(0,eb.jsxs)(tY,{type:"button",variant:"ghost",size:"xs",className:"h-6 gap-1 px-1.5 text-muted-foreground","aria-label":`${t.guideQueuedMessage} ${i+1}`,children:[(0,eb.jsx)(U1,{className:"size-3.5"}),t.guideQueuedMessage]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.removeQueuedMessage} ${i+1}`,onClick:()=>r(e.id),children:(0,eb.jsx)(m0,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.moreQueuedMessageActions} ${i+1}`,children:(0,eb.jsx)(s6,{})})]})]},e.id))})}function qZ({chip:e,removeLabel:t}){return(0,eb.jsxs)(c_,{variant:"secondary","data-tone":e.tone,className:tK("h-6 max-w-full gap-1 rounded-md border border-border bg-muted/70 px-1.5 text-muted-foreground","success"===e.tone&&"border-primary/25 bg-primary/10 text-foreground","warning"===e.tone&&"border-destructive/25 bg-destructive/10 text-foreground"),children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-3.5 shrink-0 place-items-center [&_svg]:size-3",children:e.icon}),(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.onRemove&&(0,eb.jsx)("button",{type:"button",className:"-mr-0.5 grid size-4 shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none","aria-label":`${t} ${e.id}`,onClick:()=>e.onRemove?.(e.id),children:(0,eb.jsx)(p6,{className:"size-3"})})]})}function qJ({label:e,options:t,value:n,trigger:r,triggerClassName:i,onSelect:a}){return(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"xs",className:tK("h-6 max-w-40 gap-1 rounded-md px-1.5 text-xs font-medium",i),children:r})}),(0,eb.jsx)(yj,{align:"start","aria-label":"string"==typeof e?e:void 0,className:"min-w-40 p-1",children:t.map(e=>(0,eb.jsxs)(yk,{disabled:e.disabled,className:"h-8 gap-2 px-2 text-sm",onSelect:()=>a(e),children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),(0,eb.jsx)(nv,{className:tK("ml-auto size-4 text-foreground",n===e.id?"opacity-100":"opacity-0")})]},e.id))})]})}function qQ(e,t,n,r){return[{id:`${t}-task-${e}`,kind:"user",title:n},...r.map(n=>({...n,id:`${t}-${n.id}-${e}`}))]}function q0(e){return[{id:`read-materials-${e}`,kind:"read",actionLabel:"读取",title:"AgentWorkspace.tsx, styles.css, i18n.json",files:[{id:`workspace-${e}`,name:"AgentWorkspace.tsx",lines:"1-480"},{id:`styles-${e}`,name:"styles.css",lines:"265-820"},{id:`i18n-${e}`,name:"i18n.json",lines:"245-292"}]},{id:`search-actions-${e}`,kind:"search",actionLabel:"搜索",title:"workspace creation, sidebar tree, streaming output",files:[{id:`workspace-search-${e}`,name:"AgentWorkspace.tsx",lines:"64-190"},{id:`style-search-a-${e}`,name:"styles.css",lines:"540-670"},{id:`style-search-b-${e}`,name:"styles.css",lines:"705-790"}]},{id:`subagents-${e}`,kind:"subagent",actionLabel:"召唤",title:"子代理",subagents:[{id:`reader-${e}`,title:"阅读子代理",activity:"阅读 package.json",toolActivities:["读取 package.json","检查 workspace 脚本","整理依赖信息"],status:"阅读 package.json",detail:"package.json 已读取,正在整理脚本与依赖信息。",isRunning:!0,events:qQ(e,"reader","阅读 package.json",[{id:"read-package",kind:"read",actionLabel:"读取",title:"package.json",files:[{id:"package-json",name:"package.json",lines:"1-96"}]},{id:"reader-note",kind:"done",title:"已读取 package.json。\n\n- 已记录 workspace 脚本\n- 已检查 UI 与 app 包依赖\n- 下一步等待主代理合并上下文"}])},{id:`searcher-${e}`,title:"搜索子代理",activity:"搜索 AgentWorkspace.tsx",toolActivities:["搜索 AgentWorkspace.tsx","筛选面板布局","定位事件流接入"],status:"搜索 AgentWorkspace.tsx",detail:"AgentWorkspace.tsx 命中 3 处候选区域,正在筛选可复用结构。",isRunning:!0,events:qQ(e,"searcher","搜索 AgentWorkspace.tsx",[{id:"search-workspace",kind:"search",actionLabel:"搜索",title:"AgentWorkspace.tsx",files:[{id:"agent-workspace-a",name:"AgentWorkspace.tsx",lines:"64-190"},{id:"agent-workspace-b",name:"AgentWorkspace.tsx",lines:"320-418"}]},{id:"searcher-note",kind:"done",title:"已定位 AgentWorkspace.tsx 的面板布局与事件流接入位置。"}])},{id:`verifier-${e}`,title:"验证子代理",activity:"验证工作流状态",toolActivities:["验证对话流","验证右侧面板","检查子代理切换"],status:"验证工作流状态",detail:"工作流状态正在校验,等待主代理提交最终结果。",isRunning:!0,events:qQ(e,"verifier","验证工作流状态",[{id:"verify-flow",kind:"verify",actionLabel:"验证",title:"对话流、右侧面板、子代理切换"},{id:"verifier-note",kind:"done",title:"验证队列已建立,等待主代理继续写入真实结果。"}])}]},{id:`think-structure-${e}`,kind:"thought",actionLabel:"思考",title:"8s",status:"done"},{id:`plan-${e}`,kind:"done",title:"**收到新的编织请求。**\n\n我会先保留当前工作台样式,只用占位文本演示真实任务流:读取、搜索、思考、编辑和验证都会按顺序进入同一条文字流。\n\n- 左侧织布机由真实创建动作产生\n- 编织物初始保持为空\n- 文件读取项仍然可以展开\n- 点击文件名会继续打开右侧标签页"},{id:`edit-workspace-${e}`,kind:"change",actionLabel:"编辑",title:"AgentWorkspace.tsx",additions:44,deletions:16},{id:`edit-style-${e}`,kind:"change",actionLabel:"编辑",title:"styles.css",additions:36,deletions:12},{id:`verify-flow-${e}`,kind:"verify",actionLabel:"验证",title:"empty sidebar, new loom creation, placeholder workflow"},{id:`done-${e}`,kind:"done",title:"演示工作流已完成。\n\n这只是前端占位演示,后续可以直接把事件流替换成真实 agent runtime。"}]}let q1=[{id:"user-1",kind:"user",title:"345"},...q0("1"),{id:"user-2",kind:"user",title:"234"}],q2=eN("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function q5({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"agent-message-actions",className:tK("flex items-center gap-1.5 text-muted-foreground",e),...t})}function q4({className:e,...t}){return(0,eb.jsx)(tY,{size:"icon-xs",variant:"ghost",className:e,...t})}function q3(e,t=1/0){let n=[],r=0;for(;r<e.length;){if(e.startsWith("**",r)){let i=e.indexOf("**",r+2),a=-1===i?e.slice(r+2):e.slice(r+2,i);a.length>0&&n.push((0,eb.jsx)("strong",{children:q3(a,t-r-2)},`strong-${r}`)),r=-1===i?e.length:i+2;continue}if("`"===e[r]){let i=e.indexOf("`",r+1),a=-1===i?e.slice(r+1):e.slice(r+1,i);a.length>0&&n.push((0,eb.jsx)("code",{children:q3(a,t-r-1)},`code-${r}`)),r=-1===i?e.length:i+1;continue}let i=[e.indexOf("**",r),e.indexOf("`",r)].filter(e=>e>=0).sort((e,t)=>e-t)[0]??e.length;!function(e,t,n,r,i){if(!t)return;let a=n+t.length;if(r<=n)return e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t},`${i}-fade-${n}`));if(r>=a)return e.push(t);let o=r-n;e.push(t.slice(0,o)),e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t.slice(o)},`${i}-fade-${n}`))}(n,e.slice(r,i),r,t,`text-${r}`),r=i}return n}function q6(e){return/^\s*[-*]\s+/.test(e)}function q8(e){return/^#{1,6}\s+/.test(e.trim())}function q7(e){return/^\s*([-*_])(?:\s*\1){2,}\s*$/.test(e)}function q9(e){return e.includes("|")&&e.trim().split("|").length>=3}function Ke(e){return/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(e)}function Kt(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Kn({content:e,isStreaming:t=!1}){let n=function(e){let t=e.replace(/\r\n/g,"\n").split("\n"),n=[],r=0;for(let e of t)n.push(r),r+=e.length+1;let i=[],a=0;for(;a<t.length;){let e=t[a]??"",r=e.trim(),o=n[a]??0;if(!r){a+=1;continue}if(r.startsWith("```")){let e=[];for(a+=1;a<t.length&&!(t[a]??"").trim().startsWith("```");)e.push(t[a]??""),a+=1;a<t.length&&(a+=1),i.push({kind:"code",text:e.join("\n"),start:o});continue}if(q7(e)){i.push({kind:"hr",start:o}),a+=1;continue}if(q8(e)){let e=/^(#{1,6})\s+(.+)$/.exec(r),t=e?.[1]??"##";i.push({kind:"heading",depth:t.length,text:e?.[2]??r,start:o}),a+=1;continue}if(q9(e)&&a+1<t.length&&Ke(t[a+1]??"")){let n=Kt(e),r=[];for(a+=2;a<t.length&&q9(t[a]??"");)r.push(Kt(t[a]??"")),a+=1;i.push({kind:"table",headers:n,rows:r,start:o});continue}if(q6(e)){let e=[];for(;a<t.length&&q6(t[a]??"");)e.push({text:(t[a]??"").replace(/^\s*[-*]\s+/,""),start:n[a]??0}),a+=1;i.push({kind:"list",items:e,start:o});continue}let l=[];for(;a<t.length;){let e=t[a]??"",n=t[a+1]??"";if(!e.trim()||e.trim().startsWith("```")||q7(e)||q8(e)||q6(e)||q9(e)&&Ke(n))break;l.push(e),a+=1}i.push({kind:"paragraph",lines:l,start:o})}return i}(e),r=t?Math.max(0,e.length-14):1/0;return(0,eb.jsx)("div",{className:"vtl-agent-markdown",children:n.map((e,t)=>{let n=r-e.start;return"code"===e.kind?(0,eb.jsx)("pre",{children:e.text},`block-${t}`):"hr"===e.kind?(0,eb.jsx)("hr",{},`block-${t}`):"heading"===e.kind?e.depth<=2?(0,eb.jsx)("h3",{children:q3(e.text,n)},`block-${t}`):(0,eb.jsx)("h4",{children:q3(e.text,n)},`block-${t}`):"list"===e.kind?(0,eb.jsx)("ul",{children:e.items.map((e,t)=>(0,eb.jsx)("li",{children:q3(e.text,r-e.start)},`${e.text}-${t}`))},`block-${t}`):"table"===e.kind?(0,eb.jsx)("div",{className:"vtl-agent-markdown-table",children:(0,eb.jsxs)("table",{children:[(0,eb.jsx)("thead",{children:(0,eb.jsx)("tr",{children:e.headers.map((e,t)=>(0,eb.jsx)("th",{children:q3(e,n)},`${e}-${t}`))})}),(0,eb.jsx)("tbody",{children:e.rows.map((t,r)=>(0,eb.jsx)("tr",{children:e.headers.map((e,i)=>(0,eb.jsx)("td",{children:q3(t[i]??"",n)},`cell-${r}-${i}`))},`row-${r}`))})]})},`block-${t}`):(0,eb.jsx)("p",{children:q3(e.lines.map(e=>e.trim()).join(" "),n)},`block-${t}`)})})}function Kr(e){return("assistant"===e.kind||"done"===e.kind)&&"模型没有返回内容。"===e.title.trim()&&!e.detail?.trim()}function Ki(e){return!Kr(e)}function Ka({events:e,labels:t,bottomInset:n=16,className:r,contentClassName:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s,onRetry:c}){let d=ew.useRef(null),u=ew.useRef(!0),[f,h]=ew.useState(0),[p,m]=ew.useState(0),[g,v]=ew.useState({}),x=ew.useMemo(()=>e.filter(Ki),[e]);ew.useLayoutEffect(()=>{let e=d.current;if(!e)return;function t(){m(e.clientHeight)}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let y=ew.useMemo(()=>x.reduce((e,t,n)=>{var r;let i=g[Ky(t,n)]??("user"===(r=t).kind?72:"assistant"===r.kind||"done"===r.kind?Math.max(42,Math.min(260,28+22*Math.ceil((r.title.length+(r.detail?.length??0))/68))):"read"===r.kind||"search"===r.kind?r.files?.length?28+26*Math.min(r.files.length,5):26:"subagent"===r.kind?r.subagents?.length?6+24*Math.min(r.subagents.length,6):42:"change"===r.kind?Math.max(42,Math.min(180,10+(r.files?.length??1)*43)):"error"===r.kind?88:r.detail?54:26);return e.rows.push({event:t,index:n,offset:e.totalHeight,height:i,autoOpen:"read"===t.kind&&!!t.isStreaming||"read"===t.kind&&!x.slice(n+1).some(e=>"read"!==e.kind)}),e.totalHeight+=i,e},{rows:[],totalHeight:0}),[g,x]),b=y.rows.filter(e=>e.offset+e.height>=f-360&&e.offset<=f+Math.max(p,520)+360),w=y.totalHeight+Math.max(0,n);ew.useLayoutEffect(()=>{let e=d.current;e&&x.length&&u.current&&(e.scrollTop=e.scrollHeight,h(e.scrollTop))},[n,x.length,w]);let j=ew.useCallback((e,t)=>{v(n=>1>Math.abs((n[e]??0)-t)?n:{...n,[e]:t})},[]);return(0,eb.jsx)("div",{ref:d,"data-slot":"agent-conversation-flow",className:tK("min-h-0 flex-1 overflow-auto px-4 pt-4 opacity-100 transition-opacity duration-180 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",r),onScroll:function(){let e=d.current;e&&(u.current=e.scrollHeight-e.scrollTop-e.clientHeight<96,h(e.scrollTop))},children:(0,eb.jsx)("div",{className:tK("relative mx-auto min-h-full w-full max-w-[48rem]",i),style:{height:w},children:b.map(e=>(0,eb.jsx)(Ko,{event:e.event,rowKey:Ky(e.event,e.index),offset:e.offset,autoOpen:e.autoOpen,labels:t,onMeasure:j,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s,onRetry:c},Ky(e.event,e.index)))})})}function Ko({event:e,rowKey:t,offset:n,autoOpen:r,labels:i,onMeasure:a,onOpenFile:o,onOpenSubagent:l,onRecallUserMessage:s,onBranchUserMessage:c,onRetry:d}){let u=ew.useRef(null);return ew.useLayoutEffect(()=>{let e=u.current;if(!e)return;function n(){a(t,Math.ceil(e.getBoundingClientRect().height))}n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e.id,a,t]),(0,eb.jsx)("div",{ref:u,"data-index":e.id,className:"absolute inset-x-0 top-0",style:{transform:`translateY(${n}px)`},children:(0,eb.jsx)(Kl,{event:e,autoOpen:r,labels:i,onOpenFile:o,onOpenSubagent:l,onRecallUserMessage:s,onBranchUserMessage:c,onRetry:d})})}function Kl({event:e,autoOpen:t,labels:n,onOpenFile:r,onOpenSubagent:i,onRecallUserMessage:a,onBranchUserMessage:o,onRetry:l}){return"user"===e.kind?(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsx)("div",{className:"vtl-agent-user-message-wrap",children:(0,eb.jsx)("div",{className:"vtl-agent-user-message",children:e.title})}),(a||o)&&(0,eb.jsxs)(q5,{className:"absolute top-1/2 right-2 opacity-0 transition-opacity focus-within:opacity-100 hover:opacity-100",children:[a&&(0,eb.jsx)(q4,{type:"button","aria-label":n?.recall??"召回",title:n?.recall??"召回",onClick:()=>a(e),children:(0,eb.jsx)(q2,{})}),o&&(0,eb.jsx)(q4,{type:"button","aria-label":n?.branch??"分支",title:n?.branch??"分支",onClick:()=>o(e),children:(0,eb.jsx)(F$,{})})]})]}):"assistant"===e.kind||"done"===e.kind?Kr(e)?null:(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)("div",{"data-streaming":e.isStreaming?"true":"false",children:(0,eb.jsx)(Kn,{content:e.detail?`${e.title}
20
+ </script>`})}async function H2(e,t,n,r){let i=await H5(e,t,n,r);return i?.encoding!=="utf-8"||i.truncated?void 0:i.content}async function H5(e,t,n,r){let i;if(!(""!==(i=r.trim())&&!i.startsWith("#")&&!i.startsWith("//")&&!/^[a-z][a-z0-9+.-]*:/i.test(i)))return;let a=H6(n,r),o=`${t}\0${a}`;if(e.has(o))return e.get(o);try{let n=await bf(t,a),r=n.truncated?void 0:n;return e.set(o,r),r}catch{e.set(o,void 0);return}}async function H4(e,t,n,r){return H8(e,/url\(\s*(["']?)([^"')]+)\1\s*\)/gi,async(e,i,a)=>{var o;let l,s=await H5(t,n,r,a),c=s?(l=(o=s).mimeType||"application/octet-stream","base64"===o.encoding?`data:${l};base64,${o.content}`:"utf-8"===o.encoding?`data:${l};charset=utf-8,${encodeURIComponent(o.content)}`:void 0):void 0;return c?`url("${c}")`:e})}function H3(e){let t=e.replace(/\\/g,"/"),n=t.lastIndexOf("/");return n>=0?t.slice(0,n):""}function H6(e,t){let n=`${e}/${t}`.replace(/\\/g,"/").split("/").filter(Boolean),r=[];for(let e of n)if("."!==e){if(".."===e){r.pop();continue}r.push(e)}let i=/^[A-Za-z]:/.test(e)?"":e.startsWith("/")?"/":"";return`${i}${r.join("/")}`}async function H8(e,t,n){let r=Array.from(e.matchAll(t)),i=await Promise.all(r.map(e=>n(...e.map(e=>e??"")))),a=0;return e.replace(t,()=>i[a++]??"")}function H7(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}async function H9(){return Wa("/api/local/terminals/machines")}async function We(e){let t=new URLSearchParams;e&&t.set("scopeId",e);let n=t.toString();return Wa(`/api/local/terminals/sessions${n?`?${n}`:""}`)}async function Wt(e){return Wa("/api/local/terminals/sessions",{method:"POST",body:JSON.stringify(e)})}async function Wn(e){await Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Wr(e,t){await Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify({data:t})})}async function Wi(e,t){return Wa(`/api/local/terminals/sessions/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify(t)})}async function Wa(e,t){let n=await fetch(e,{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error("string"==typeof r?.error?r.error:"terminal api failed");return r}let Wo=eN("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function Wl({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(a){case"%":r=i/100*e;break;case"px":r=i;break;case"rem":r=i*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=i/100*window.innerHeight;break;case"vw":r=i/100*window.innerWidth}return r}function Ws(e){return parseFloat(e.toFixed(3))}function Wc({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function Wd(e){let{panels:t}=e,n=Wc({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:i}=e,a=0;void 0!==i.collapsedSize&&(a=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.collapsedSize})/n*100)),void 0!==i.defaultSize&&(t=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.defaultSize})/n*100));let o=0;void 0!==i.minSize&&(o=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.minSize})/n*100));let l=100;return void 0!==i.maxSize&&(l=Ws(Wl({groupSize:n,panelElement:r,styleProp:i.maxSize})/n*100)),{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsible:!0===i.collapsible,defaultSize:t,disabled:i.disabled,minSize:o,maxSize:l,panelId:e.id}})}function Wu(e,t="Assertion error"){if(!e)throw Error(t)}function Wf(e,t){return Array.from(t).sort("horizontal"===e?Wh:Wp)}function Wh(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function Wp(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function Wm(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Wg(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Wv(e){let{element:t,orientation:r,panels:i,separators:a}=e,o=Wf(r,Array.from(t.children).filter(Wm).map(e=>({element:e}))).map(({element:e})=>e),l=[],s=!1,c=!1,d=-1,u=-1,f=0,h,p=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(f++,-1===d&&(d=e),u=e))}if(f>1){let t=-1;for(let f of o)if(f.hasAttribute("data-panel")){t++;let a=i.find(e=>e.element===f);if(a){if(h){let i,o=h.element.getBoundingClientRect(),m=f.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===r?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(p.length){case 0:i=[e,t];break;case 1:{let n=p[0],a=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Wg(r,n),l="horizontal"===e?t:o;l<a&&(a=l,i=n)}return Wu(i,"No rect found"),i}({orientation:r,rects:[o,m],targetRect:n.element.getBoundingClientRect()});i=[n,a===o?t:e];break}default:i=p}}else i=p.length?p:["horizontal"===r?new DOMRect(o.right,m.top,m.left-o.right,m.height):new DOMRect(m.left,o.bottom,m.width,m.top-o.bottom)];for(let r of i){let i="width"in r?r:r.element.getBoundingClientRect(),o=(void 0===n&&(n="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),n)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(i.width<o){let e=o-i.width;i=new DOMRect(i.x-e/2,i.y,i.width+e,i.height)}if(i.height<o){let e=o-i.height;i=new DOMRect(i.x,i.y-e/2,i.width,i.height+e)}let c=t<=d||t>u;s||c||l.push({group:e,groupSize:Wc({group:e}),panels:[h,a],separator:"width"in r?void 0:r,rect:i}),s=!1}}c=!1,h=a,p=[]}}else if(f.hasAttribute("data-separator")){null!==f.ariaDisabled&&(s=!0);let e=a.find(e=>e.element===f);e?p.push(e):(h=void 0,p=[])}else c=!0}return l}class Wx{#t={};addListener(e,t){let n=this.#t[e];return void 0===n?this.#t[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#t[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#t={}}removeListener(e,t){let n=this.#t[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let Wy=new Map,Wb=new Wx;function Ww(e,t){for(let[t]of Wy)if(t.id===e)return t}function Wj(e,t){for(let[t,n]of Wy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Wk(e,t){return Wb.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function WS(e,t){let n=Wy.get(e);(Wy=new Map(Wy)).set(e,t),Wb.emit("groupChange",{group:e,prev:n,next:t})}let WC=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function WN(e){let t=e.length;for(;t--;){let n=e[t];if(Wu(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(WO(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||WC.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function WM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function WE(e){let t=[];for(;e;)t.push(e),e=WO(e);return t}function WO(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function WP(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Wv(r),a=function(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Wg(n,a.rect);switch(e){case"horizontal":t.x<=i.x&&(r=a,i=t);break;case"vertical":t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wm(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:WE(e),b:WE(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();Wu(n,"Stacking order can only be calculated for elements with a common ancestor");let i={a:WM(WN(r.a)),b:WM(WN(r.b))};if(i.a===i.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(i.a-i.b)}(n,e)>0){let i=n;for(;i;){var r;if(i.contains(e))break;if(r=i.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;i=i.parentElement}}return!0}({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function WA(e,t,n=0){return Math.abs(Ws(e)-Ws(t))<=n}function Wz(e,t){return WA(e,t)?0:e>t?1:-1}function WI({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:l=100,minSize:s=0}=t;return o&&!e?n:(0>Wz(r,s)&&(r=a&&0>Wz(r,(i+s)/2)?i:s),Ws(r=Math.min(l,r)))}function W_({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(WA(e,0))return t;let o="imperative-api"===a,l=Object.values(t),s=Object.values(i),c=[...l],[d,u]=r;Wu(null!=d,"Invalid first pivot index"),Wu(null!=u,"Invalid second pivot index");let f=0;if("keyboard"===a){{let t=e<0?u:d,r=n[t];Wu(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(Wu(null!=n,`Previous layout not found for panel index ${t}`),WA(n,i)){let t=o-n;Wz(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];Wu(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(Wu(null!=n,`Previous layout not found for panel index ${t}`),WA(n,o)){let t=n-i;Wz(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];Wu(r,`Panel constraints not found for index ${t}`);let i=l[t],{collapsible:a,collapsedSize:o,minSize:s}=r;if(a&&0>Wz(i,s))if(e>0){let t=s-o;0>Wz(i+e,s)&&(e=0>=Wz(e,t/2)?0:t)}else{let t=s-o;0>Wz(i-e,s)&&(e=Wz(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,i=0;for(;;){let e=l[r];if(Wu(null!=e,`Previous layout not found for panel index ${r}`),i+=WI({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=l[t];Wu(null!=i,`Previous layout not found for panel index ${t}`);let a=i-r,s=WI({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!WA(i,s)&&(f+=i-s,c[t]=s,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(s,c))return i;{let t=e<0?u:d,r=l[t];Wu(null!=r,`Previous layout not found for panel index ${t}`);let i=r+f,a=WI({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(c[t]=a,!WA(a,i)){let t=i-a,r=e<0?u:d;for(;r>=0&&r<n.length;){let i=c[r];Wu(null!=i,`Previous layout not found for panel index ${r}`);let a=i+t,l=WI({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(WA(i,l)||(t-=l-i,c[r]=l),WA(t,0))break;e>0?r--:r++}}}if(!WA(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let h=Object.keys(i);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function WD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==Wz(e[n],t[n]))return!1;return!0}function WT({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!WA(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Wu(null!=t,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Wu(null!=i,`No layout data found for index ${e}`);let o=r[e];Wu(null!=o,`No layout data found for index ${e}`);let l=WI({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=l&&(a+=o-l,r[e]=l)}if(!WA(a,0))for(let e=0;e<t.length;e++){let n=r[e];Wu(null!=n,`No layout data found for index ${e}`);let i=n+a,o=WI({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,WA(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function WR({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:i,groupSize:a,separatorToPanels:o}]of Wy)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:a,layout:i,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{if(e===a())return;let{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:o,groupSize:l,layout:s,separatorToPanels:c}=n(),d=WT({layout:(({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),l=n.findIndex(e=>e.id===t),s=0===l,c=l===n.length-1;if(c&&e<o&&(s||n.slice(0,l).every((e,t)=>{let n=i[t];return n?.collapsible&&WA(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,l).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Ws(100-e)}}return W_({delta:c?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:c?[l-1,l]:[l,l+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,panels:o.panels,prevLayout:s,derivedPanelConstraints:i}),panelConstraints:i});WD(s,d)||WS(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),l=a();e&&l!==t&&(n.expandToSize=l,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=i(),s=a();if(e&&s===t){let e=l.expandToSize??n;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&WA(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Wc({group:t});o(Ws(Wl({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function WL(e){e.defaultPrevented||WP(e,Wy).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,i=WR({groupId:t.group.id,panelId:n.id});i&&void 0!==r&&(i.resize(r),e.preventDefault())}}})}function W$(e){for(let[t]of Wy)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function WF({groupId:e}){let t=()=>{for(let[t,n]of Wy)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:l}=t(),s=WT({layout:e,panelConstraints:r});return n?o:(WD(o,s)||WS(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:s,separatorToPanels:l}),s)}}}function WV(e,t){let n=W$(e),r=Wj(n.id,!0),i=n.separators.find(t=>t.element===e);Wu(i,"Matching separator not found");let a=r.separatorToPanels.get(i);Wu(a,"Matching panels not found");let o=a.map(e=>n.panels.indexOf(e)),l=WF({groupId:n.id}).getLayout(),s=WT({layout:W_({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});WD(l,s)||WS(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:s,separatorToPanels:r.separatorToPanels})}function WB(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=W$(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&WV(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&WV(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&WV(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&WV(t,-5);break;case"End":e.preventDefault(),WV(t,100);break;case"Enter":{e.preventDefault();let n=W$(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Wj(n.id,!0),o=n.separators.find(e=>e.element===t);Wu(o,"Matching separator not found");let l=a.get(o);Wu(l,"Matching panels not found");let s=l[0],c=r.find(e=>e.panelId===s.id);if(Wu(c,"Panel metadata not found"),c.collapsible){let e=i[s.id];WV(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[s.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=W$(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Wu(null!==r,"Index not found");let i=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[i].focus({preventScroll:!0});break}case"Home":e.preventDefault(),WV(t,-100)}}let WH={cursorFlags:0,state:"inactive"},WW=new Wx;function WU(e){let t=WH;WH=e,WW.emit("change",{prev:t,next:e})}function Wq(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=Wy,n=WP(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WU({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let WK=e=>e,WG=()=>{};function WY(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let WX=new WeakMap;function WZ(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=WX.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=WH;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":i++}})}if(0!==r||0!==i){if("active"===n&&e&&WY()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return WY()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?0===n.cssRules.length?n.insertRule(i):n.replaceSync(i):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}WX.set(e,{prevStyle:t,styleSheet:n})}function WJ({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){var l;let s,c,d=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:l,panels:s}=n,{disableCursor:c}=n.mutableState,u=0;u=a?"horizontal"===l?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),h=i.get(n);if(!f||!h)return;let{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:v,separatorToPanels:x}=h;if(m&&v&&x){let t=W_({delta:u,initialLayout:f,panelConstraints:m,pivotIndices:e.panels.map(e=>s.indexOf(e)),prevLayout:v,trigger:"mouse-or-touch"});if(WD(t,v)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else WS(e.group,{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:t,separatorToPanels:x})}});let u=0;0===t.movementX?u|=3&o:u|=3&d,0===t.movementY?u|=12&o:u|=12&d,l=u,s=WH,(c={...WH}).cursorFlags=l,WH=c,WW.emit("change",{prev:s,next:c}),WZ(e)}function WQ(e){let t=Wy,n=WH;"active"===n.state&&WJ({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function W0(e){if(e.defaultPrevented)return;let t=WH,n=Wy;if("active"===t.state){if(0===e.buttons){WU({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=Wj(e.group.id,!0);WS(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}WJ({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=WP(e,n);0===r.length?"inactive"!==t.state&&WU({cursorFlags:0,state:"inactive"}):WU({cursorFlags:0,hitRegions:r,state:"hover"}),WZ(e.currentTarget)}}function W1(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===WH.state&&WU({cursorFlags:0,state:"inactive"})}function W2(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=WH;"active"===t.state&&(WU({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(WZ(e.currentTarget),t.hitRegions.forEach(e=>{let t=Wj(e.group.id,!0);WS(e.group,t)}),e.preventDefault()))}function W5(e){let t=0,n=0,r={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=Ws(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(0!==i){let t=Ws((100-n)/i);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let W4=new Map;function W3(e){let t=(0,ew.useId)();return`${e??t}`}let W6="u">typeof window?ew.useLayoutEffect:ew.useEffect;function W8(e){let t=(0,ew.useRef)(e);return W6(()=>{t.current=e},[e]),(0,ew.useCallback)((...e)=>t.current?.(...e),[t])}function W7(...e){return W8(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function W9(e){let t=(0,ew.useRef)({...e});return W6(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let Ue=(0,ew.createContext)(null);function Ut({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:l,onLayoutChange:s,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...h}){let p,m=(0,ew.useRef)({onLayoutChange:{},onLayoutChanged:{}}),g=W8(e=>{WD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,s?.(e))}),v=W8(e=>{WD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,c?.(e))}),x=W3(l),y=(0,ew.useRef)(null),[b,w]=function(){let[e,t]=(0,ew.useState)({});return[e,(0,ew.useCallback)(()=>t({}),[])]}(),j=(0,ew.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=W7(y,a);p=(0,ew.useRef)({getLayout:()=>({}),setLayout:WK}),(0,ew.useImperativeHandle)(o,()=>p.current,[]),W6(()=>{Object.assign(p.current,WF({groupId:x}))});let S=W8((e,t)=>{let r=WH,i=Ww(e),a=Wj(e);if(a){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),C=W9({defaultLayout:n,disableCursor:r}),N=(0,ew.useMemo)(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:S,id:x,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=Wf(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=Wf(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},updatePanelProps:(e,{disabled:t})=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Ww(x),i=Wj(x);r&&i&&WS(r,{...i,derivedPanelConstraints:Wd(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=j.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[S,x,w,d,C]),M=(0,ew.useRef)(null);return W6(()=>{let e,t,n,r,a,o,l,s,c,u,f,h,p,m=y.current;if(null===m)return;let b=j.current;if(void 0!==C.defaultLayout&&Object.keys(C.defaultLayout).length===b.panels.length)for(let t of(e={},b.panels)){let n=C.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!i,element:m,id:x,mutableState:{defaultLayout:e,disableCursor:!!C.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:b.panels,resizeTargetMinimumSize:b.resizeTargetMinimumSize,separators:b.separators};M.current=w;let k=(t=!0,Wu(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,(o=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=Wc({group:w});if(0===e)return;let t=Wj(w.id);if(!t)return;let n=Wd(w),r=t.defaultLayoutDeferred?W5(n):t.layout,i=WT({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,l=new Map,s=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){o=!0;let r=Ws(e/100*n/t*100);l.set(c.id,r),i+=r}else s.push(c.id),a+=e}if(!o||0===s.length)return r;let c=100-i,d={...r};if(l.forEach((e,t)=>{d[t]=e}),a>0)for(let e of s){let t=r[e]??0;d[e]=Ws(t/a*c)}else{let e=Ws(c/s.length);for(let t of s)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&WD(t.layout,i)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;WS(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:i,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Wc({group:e}),a="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,l={asPercentage:Ws(a/i*100),inPixels:a};r.mutableValues.prevSize=l,r.onResize(l,r.id,o)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{Wu(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&o.observe(e.element)}),l=Wc({group:w}),s=Wd(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),f=WT({layout:w.mutableState.layouts[c]??u??W5(s),panelConstraints:s}),h=w.element.ownerDocument,W4.set(h,(W4.get(h)??0)+1),p=new Map,Wv(w).forEach(e=>{e.separator&&p.set(e.separator,e.panels)}),WS(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:s,groupSize:l,layout:f,separatorToPanels:p}),w.separators.forEach(e=>{Wu(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",WB)}),1===W4.get(h)&&(h.addEventListener("dblclick",WL,!0),h.addEventListener("pointerdown",Wq,!0),h.addEventListener("pointerleave",WQ),h.addEventListener("pointermove",W0),h.addEventListener("pointerout",W1),h.addEventListener("pointerup",W2,!0)),function(){t=!1,W4.set(h,Math.max(0,(W4.get(h)??0)-1)),(Wy=new Map(Wy)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",WB)}),W4.get(h)||(h.removeEventListener("dblclick",WL,!0),h.removeEventListener("pointerdown",Wq,!0),h.removeEventListener("pointerleave",WQ),h.removeEventListener("pointermove",W0),h.removeEventListener("pointerout",W1),h.removeEventListener("pointerup",W2,!0)),o.disconnect()}),{defaultLayoutDeferred:S,derivedPanelConstraints:N,layout:E}=Wj(w.id,!0);!S&&N.length>0&&(g(E),v(E));let O=Wk(x,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let i=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[i]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=WA(t.collapsedSize,r[t.panelId]),i=WA(t.collapsedSize,n[t.panelId]);e&&!i&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let a="active"!==WH.state;g(r),a&&v(r)});return()=>{M.current=null,k(),O()}},[i,x,v,g,d,b,C]),(0,ew.useEffect)(()=>{let e=M.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,eb.jsx)(Ue.Provider,{value:N,children:(0,eb.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function Un(){let e=(0,ew.useContext)(Ue);return Wu(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ur({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:l="preserve-relative-size",id:s,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:f,style:h,...p}){let m,g=!!s,v=W3(s),x=W9({disabled:a}),y=(0,ew.useRef)(null),b=W7(y,o),{getPanelStyles:w,id:j,orientation:k,registerPanel:S,updatePanelProps:C}=Un(),N=null!==u,M=W8((e,t,n)=>{u?.(e,s,n)});W6(()=>{let e=y.current;if(null!==e)return S({element:e,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?M:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:d}})},[l,n,r,i,N,v,g,c,d,M,S,x]),(0,ew.useEffect)(()=>{C(v,{disabled:a})},[a,v,C]),function(e,t){let{id:n}=Un(),r=(0,ew.useRef)({collapse:WG,expand:WG,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:WG});(0,ew.useImperativeHandle)(t,()=>r.current,[]),W6(()=>{Object.assign(r.current,WR({groupId:n,panelId:e}))})}(v,f);let E=()=>{let e=w(j,v);if(e)return JSON.stringify(e)},O=(0,ew.useSyncExternalStore)(e=>Wk(j,e),E,E);return m=O?JSON.parse(O):void 0!==i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,eb.jsx)("div",{...p,"data-disabled":a||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...Ui,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...m},children:(0,eb.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}Ut.displayName="Group",Ur.displayName="Panel";let Ui={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ua({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...l}){let s,c,d=W3(a),u=W9({disabled:n,disableDoubleClick:r}),[f,h]=(0,ew.useState)({}),[p,m]=(0,ew.useState)("inactive"),[g,v]=(0,ew.useState)(!1),x=(0,ew.useRef)(null),y=W7(x,i),{disableCursor:b,id:w,orientation:j,registerSeparator:k,updateSeparatorProps:S}=Un();return W6(()=>{let e=x.current;if(null!==e){var t;let n={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:e,id:d},r=k(n),i=(t=e=>{m("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},WW.addListener("change",t)),a=Wk(w,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:i}=e.next,a=i.get(n);if(a){let e=a[0],n=a.indexOf(e);h(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],l=t.find(e=>e.panelId===n);if(l){let s=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];a=WT({layout:W_({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],i=WT({layout:W_({delta:s-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{i(),a(),r()}}},[w,d,k,u]),(0,ew.useEffect)(()=>{S(d,{disabled:n,disableDoubleClick:r})},[n,r,d,S]),n&&!b&&(s="not-allowed"),c=n?"disabled":"active"===p?"active":g?"focus":p,(0,eb.jsx)("div",{...l,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===j?"vertical":"horizontal","aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":c,"data-testid":d,id:d,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:s,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}function Uo({className:e,direction:t,orientation:n,...r}){let i=n??t;return(0,eb.jsx)(Ut,{"data-slot":"resizable-panel-group","data-orientation":i??"horizontal",orientation:i,className:tK("flex h-full w-full data-[orientation=vertical]:flex-col",e),...r})}function Ul({...e}){return(0,eb.jsx)(Ur,{"data-slot":"resizable-panel",...e})}function Us({withHandle:e,className:t,...n}){return(0,eb.jsx)(Ua,{"data-slot":"resizable-handle",className:tK("relative flex w-px items-center justify-center bg-border outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&(0,eb.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-background",children:(0,eb.jsx)(Wo,{className:"size-2.5"})})})}Ua.displayName="Separator";let Uc=eN("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Ud=eN("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Uu=eN("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Uf=eN("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var Uh=e.i(21957);let Up=Array(12).fill(0),Um=({visible:e,className:t})=>ew.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ew.default.createElement("div",{className:"sonner-spinner"},Up.map((e,t)=>ew.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),Ug=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Uv=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Ux=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Uy=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ub=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ew.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ew.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Uw=1,Uj=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Uw++,a=this.toasts.find(e=>e.id===i),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(t=>t.id===i?(this.publish({...t,...e,id:i,title:n}),{...t,...e,id:i,dismissible:o,title:n}):t):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n,r;if(!t)return;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let i=Promise.resolve(e instanceof Function?e():e),a=void 0!==r,o=i.then(async e=>{if(n=["resolve",e],ew.default.isValidElement(e))a=!1,this.create({id:r,type:"default",message:e});else if(Uk(e)&&!e.ok){a=!1;let n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,i="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(e instanceof Error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(void 0!==t.success){a=!1;let n="function"==typeof t.success?await t.success(e):t.success,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:i,...o})}}).catch(async e=>{if(n=["reject",e],void 0!==t.error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),l=()=>new Promise((e,t)=>o.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||Uw++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Uk=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,US=Object.assign((e,t)=>{let n=(null==t?void 0:t.id)||Uw++;return Uj.addToast({title:e,...t,id:n}),n},{success:Uj.success,info:Uj.info,warning:Uj.warning,error:Uj.error,custom:Uj.custom,message:Uj.message,promise:Uj.promise,dismiss:Uj.dismiss,loading:Uj.loading},{getHistory:()=>Uj.toasts,getToasts:()=>Uj.getActiveToasts()});function UC(e){return void 0!==e.label}function UN(...e){return e.filter(Boolean).join(" ")}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let UM=e=>{var t,n,r,i,a,o,l,s,c,d,u,f,h;let{invert:p,toast:m,unstyled:g,interacting:v,setHeights:x,visibleToasts:y,heights:b,index:w,toasts:j,expanded:k,removeToast:S,defaultRichColors:C,closeButton:N,style:M,cancelButtonStyle:E,actionButtonStyle:O,className:P="",descriptionClassName:A="",duration:z,position:I,gap:_,expandByDefault:D,classNames:T,icons:R,closeButtonAriaLabel:L="Close toast"}=e,[$,F]=ew.default.useState(null),[V,B]=ew.default.useState(null),[H,W]=ew.default.useState(!1),[U,q]=ew.default.useState(!1),[K,G]=ew.default.useState(!1),[Y,X]=ew.default.useState(!1),[Z,J]=ew.default.useState(!1),[Q,ee]=ew.default.useState(0),[et,en]=ew.default.useState(0),er=ew.default.useRef(m.duration||z||4e3),ei=ew.default.useRef(null),ea=ew.default.useRef(null),eo=0===w,el=w+1<=y,es=m.type,ec=!1!==m.dismissible,ed=m.className||"",eu=m.descriptionClassName||"",ef=ew.default.useMemo(()=>b.findIndex(e=>e.toastId===m.id)||0,[b,m.id]),eh=ew.default.useMemo(()=>{var e;return null!=(e=m.closeButton)?e:N},[m.closeButton,N]),ep=ew.default.useMemo(()=>m.duration||z||4e3,[m.duration,z]),em=ew.default.useRef(0),eg=ew.default.useRef(0),ev=ew.default.useRef(0),ex=ew.default.useRef(null),[ey,eb]=I.split("-"),ej=ew.default.useMemo(()=>b.reduce((e,t,n)=>n>=ef?e:e+t.height,0),[b,ef]),ek=(()=>{let[e,t]=ew.default.useState(document.hidden);return ew.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),eS=m.invert||p,eC="loading"===es;eg.current=ew.default.useMemo(()=>ef*_+ej,[ef,ej]),ew.default.useEffect(()=>{er.current=ep},[ep]),ew.default.useEffect(()=>{W(!0)},[]),ew.default.useEffect(()=>{let e=ea.current;if(e){let t=e.getBoundingClientRect().height;return en(t),x(e=>[{toastId:m.id,height:t,position:m.position},...e]),()=>x(e=>e.filter(e=>e.toastId!==m.id))}},[x,m.id]),ew.default.useLayoutEffect(()=>{if(!H)return;let e=ea.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,en(n),x(e=>e.find(e=>e.toastId===m.id)?e.map(e=>e.toastId===m.id?{...e,height:n}:e):[{toastId:m.id,height:n,position:m.position},...e])},[H,m.title,m.description,x,m.id,m.jsx,m.action,m.cancel]);let eN=ew.default.useCallback(()=>{q(!0),ee(eg.current),x(e=>e.filter(e=>e.toastId!==m.id)),setTimeout(()=>{S(m)},200)},[m,S,x,eg]);ew.default.useEffect(()=>{let e;if((!m.promise||"loading"!==es)&&m.duration!==1/0&&"loading"!==m.type){if(k||v||ek){if(ev.current<em.current){let e=new Date().getTime()-em.current;er.current=er.current-e}ev.current=new Date().getTime()}else er.current!==1/0&&(em.current=new Date().getTime(),e=setTimeout(()=>{null==m.onAutoClose||m.onAutoClose.call(m,m),eN()},er.current));return()=>clearTimeout(e)}},[k,v,m,es,ek,eN]),ew.default.useEffect(()=>{m.delete&&(eN(),null==m.onDismiss||m.onDismiss.call(m,m))},[eN,m.delete]);let eM=m.icon||(null==R?void 0:R[es])||(e=>{switch(e){case"success":return Ug;case"info":return Ux;case"warning":return Uv;case"error":return Uy;default:return null}})(es);return ew.default.createElement("li",{tabIndex:0,ref:ea,className:UN(P,ed,null==T?void 0:T.toast,null==m||null==(t=m.classNames)?void 0:t.toast,null==T?void 0:T.default,null==T?void 0:T[es],null==m||null==(n=m.classNames)?void 0:n[es]),"data-sonner-toast":"","data-rich-colors":null!=(d=m.richColors)?d:C,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":H,"data-promise":!!m.promise,"data-swiped":Z,"data-removed":U,"data-visible":el,"data-y-position":ey,"data-x-position":eb,"data-index":w,"data-front":eo,"data-swiping":K,"data-dismissible":ec,"data-type":es,"data-invert":eS,"data-swipe-out":Y,"data-swipe-direction":V,"data-expanded":!!(k||D&&H),"data-testid":m.testId,style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${U?Q:eg.current}px`,"--initial-height":D?"auto":`${et}px`,...M,...m.style},onDragEnd:()=>{G(!1),F(null),ex.current=null},onPointerDown:e=>{2===e.button||eC||!ec||(ei.current=new Date,ee(eg.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(G(!0),ex.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r,i;if(Y||!ec)return;ex.current=null;let a=Number((null==(e=ea.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ea.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),l=new Date().getTime()-(null==(n=ei.current)?void 0:n.getTime()),s="x"===$?a:o,c=Math.abs(s)/l;if(Math.abs(s)>=45||c>.11){ee(eg.current),null==m.onDismiss||m.onDismiss.call(m,m),"x"===$?B(a>0?"right":"left"):B(o>0?"down":"up"),eN(),X(!0);return}null==(r=ea.current)||r.style.setProperty("--swipe-amount-x","0px"),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y","0px"),J(!1),G(!1),F(null)},onPointerMove:t=>{var n,r,i,a;if(!ex.current||!ec||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let o=t.clientY-ex.current.y,l=t.clientX-ex.current.x,s=null!=(a=e.swipeDirections)?a:function(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(I);!$&&(Math.abs(l)>1||Math.abs(o)>1)&&F(Math.abs(l)>Math.abs(o)?"x":"y");let c={x:0,y:0},d=e=>1/(1.5+Math.abs(e)/20);if("y"===$){if(s.includes("top")||s.includes("bottom"))if(s.includes("top")&&o<0||s.includes("bottom")&&o>0)c.y=o;else{let e=o*d(o);c.y=Math.abs(e)<Math.abs(o)?e:o}}else if("x"===$&&(s.includes("left")||s.includes("right")))if(s.includes("left")&&l<0||s.includes("right")&&l>0)c.x=l;else{let e=l*d(l);c.x=Math.abs(e)<Math.abs(l)?e:l}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(r=ea.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y",`${c.y}px`)}},eh&&!m.jsx&&"loading"!==es?ew.default.createElement("button",{"aria-label":L,"data-disabled":eC,"data-close-button":!0,onClick:eC||!ec?()=>{}:()=>{eN(),null==m.onDismiss||m.onDismiss.call(m,m)},className:UN(null==T?void 0:T.closeButton,null==m||null==(r=m.classNames)?void 0:r.closeButton)},null!=(u=null==R?void 0:R.close)?u:Ub):null,(es||m.icon||m.promise)&&null!==m.icon&&((null==R?void 0:R[es])!==null||m.icon)?ew.default.createElement("div",{"data-icon":"",className:UN(null==T?void 0:T.icon,null==m||null==(i=m.classNames)?void 0:i.icon)},m.promise||"loading"===m.type&&!m.icon?m.icon||((null==R?void 0:R.loading)?ew.default.createElement("div",{className:UN(null==T?void 0:T.loader,null==m||null==(h=m.classNames)?void 0:h.loader,"sonner-loader"),"data-visible":"loading"===es},R.loading):ew.default.createElement(Um,{className:UN(null==T?void 0:T.loader,null==m||null==(f=m.classNames)?void 0:f.loader),visible:"loading"===es})):null,"loading"!==m.type?eM:null):null,ew.default.createElement("div",{"data-content":"",className:UN(null==T?void 0:T.content,null==m||null==(a=m.classNames)?void 0:a.content)},ew.default.createElement("div",{"data-title":"",className:UN(null==T?void 0:T.title,null==m||null==(o=m.classNames)?void 0:o.title)},m.jsx?m.jsx:"function"==typeof m.title?m.title():m.title),m.description?ew.default.createElement("div",{"data-description":"",className:UN(A,eu,null==T?void 0:T.description,null==m||null==(l=m.classNames)?void 0:l.description)},"function"==typeof m.description?m.description():m.description):null),ew.default.isValidElement(m.cancel)?m.cancel:m.cancel&&UC(m.cancel)?ew.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||E,onClick:e=>{!UC(m.cancel)||ec&&(null==m.cancel.onClick||m.cancel.onClick.call(m.cancel,e),eN())},className:UN(null==T?void 0:T.cancelButton,null==m||null==(s=m.classNames)?void 0:s.cancelButton)},m.cancel.label):null,ew.default.isValidElement(m.action)?m.action:m.action&&UC(m.action)?ew.default.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||O,onClick:e=>{!UC(m.action)||(null==m.action.onClick||m.action.onClick.call(m.action,e),e.defaultPrevented||eN())},className:UN(null==T?void 0:T.actionButton,null==m||null==(c=m.classNames)?void 0:c.actionButton)},m.action.label):null)};function UE(){if("u"<typeof window||"u"<typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}let UO=ew.default.forwardRef(function(e,t){let{id:n,invert:r,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:s,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:h,style:p,visibleToasts:m=3,toastOptions:g,dir:v=UE(),gap:x=14,icons:y,containerAriaLabel:b="Notifications"}=e,[w,j]=ew.default.useState([]),k=ew.default.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),S=ew.default.useMemo(()=>Array.from(new Set([i].concat(k.filter(e=>e.position).map(e=>e.position)))),[k,i]),[C,N]=ew.default.useState([]),[M,E]=ew.default.useState(!1),[O,P]=ew.default.useState(!1),[A,z]=ew.default.useState("system"!==u?u:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=ew.default.useRef(null),_=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=ew.default.useRef(null),T=ew.default.useRef(!1),R=ew.default.useCallback(e=>{j(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||Uj.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return ew.default.useEffect(()=>Uj.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{j(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{t3.default.flushSync(()=>{j(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),ew.default.useEffect(()=>{if("system"!==u)return void z(u);if("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),"u"<typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{e?z("dark"):z("light")})}catch(t){e.addListener(({matches:e})=>{try{e?z("dark"):z("light")}catch(e){console.error(e)}})}},[u]),ew.default.useEffect(()=>{w.length<=1&&E(!1)},[w]),ew.default.useEffect(()=>{let e=e=>{var t,n;a.every(t=>e[t]||e.code===t)&&(E(!0),null==(n=I.current)||n.focus()),"Escape"===e.code&&(document.activeElement===I.current||(null==(t=I.current)?void 0:t.contains(document.activeElement)))&&E(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),ew.default.useEffect(()=>{if(I.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,T.current=!1)}},[I.current]),ew.default.createElement("section",{ref:t,"aria-label":`${b} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((t,n)=>{var i;let a,[u,b]=t.split("-");return k.length?ew.default.createElement("ol",{key:t,dir:"auto"===v?UE():v,tabIndex:-1,ref:I,className:s,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":u,"data-x-position":b,style:{"--front-toast-height":`${(null==(i=C[0])?void 0:i.height)||0}px`,"--width":"356px","--gap":`${x}px`,...p,...(a={},[c,d].forEach((e,t)=>{let n=1===t,r=n?"--mobile-offset":"--offset",i=n?"16px":"24px";function o(e){["top","right","bottom","left"].forEach(t=>{a[`${r}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?a[`${r}-${t}`]=i:a[`${r}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(i)}),a)},onBlur:e=>{T.current&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:e=>{!(e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible)&&(T.current||(T.current=!0,D.current=e.relatedTarget))},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{O||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||P(!0)},onPointerUp:()=>P(!1)},k.filter(e=>!e.position&&0===n||e.position===t).map((n,i)=>{var a,s;return ew.default.createElement(UM,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:h,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(s=null==g?void 0:g.closeButton)?s:l,interacting:O,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:R,toasts:k.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:N,expandByDefault:o,gap:x,expanded:M,swipeDirections:e.swipeDirections})})):null}))});function UP({className:e,position:t="top-right",closeButton:n=!0,richColors:r=!1,visibleToasts:i=4,toastOptions:a,...o}){let{theme:l="system"}=(0,Uh.useTheme)();return(0,eb.jsx)(UO,{theme:l,position:t,closeButton:n,richColors:r,visibleToasts:i,className:tK("toaster group",e),icons:{success:(0,eb.jsx)(Uc,{className:"size-4"}),info:(0,eb.jsx)(vj,{className:"size-4"}),warning:(0,eb.jsx)(Uf,{className:"size-4"}),error:(0,eb.jsx)(Uu,{className:"size-4"}),loading:(0,eb.jsx)(Ud,{className:"size-4 animate-spin"})},toastOptions:{...a,classNames:{toast:"vtl-surface-popover group toast group-[.toaster]:rounded-[var(--surface-popover-radius)] group-[.toaster]:border group-[.toaster]:gap-3 group-[.toaster]:p-3",title:"group-[.toast]:text-sm group-[.toast]:font-medium",description:"group-[.toast]:text-sm group-[.toast]:text-muted-foreground",icon:"group-[.toast]:text-foreground",actionButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:bg-primary group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-foreground",closeButton:"group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:text-muted-foreground",success:"group-[.toast]:text-foreground",info:"group-[.toast]:text-foreground",warning:"group-[.toast]:text-foreground",error:"group-[.toast]:text-foreground",loading:"group-[.toast]:text-foreground",...a?.classNames}},style:{"--normal-bg":"var(--surface-popover)","--normal-text":"var(--surface-popover-foreground)","--normal-border":"var(--surface-popover-border)","--border-radius":"var(--surface-popover-radius)"},...o})}var UA="Tabs",[Uz,UI]=tX(UA,[vH]),U_=vH(),[UD,UT]=Uz(UA),UR=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:s="automatic",...c}=e,d=fb(l),[u,f]=t0({prop:r,onChange:i,defaultProp:a??"",caller:UA});return(0,eb.jsx)(UD,{scope:n,baseId:cR(),value:u,onValueChange:f,orientation:o,dir:d,activationMode:s,children:(0,eb.jsx)(ne.div,{dir:d,"data-orientation":o,...c,ref:t})})});UR.displayName=UA;var UL="TabsList",U$=ew.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=UT(UL,n),o=U_(n);return(0,eb.jsx)(vq,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,eb.jsx)(ne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});U$.displayName=UL;var UF="TabsTrigger",UV=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=UT(UF,n),l=U_(n),s=UW(o.baseId,r),c=UU(o.baseId,r),d=r===o.value;return(0,eb.jsx)(vY,{asChild:!0,...l,focusable:!i,active:d,children:(0,eb.jsx)(ne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:s,...a,ref:t,onMouseDown:tZ(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(r)}),onKeyDown:tZ(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(r)}),onFocus:tZ(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(r)})})})});UV.displayName=UF;var UB="TabsContent",UH=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,l=UT(UB,n),s=UW(l.baseId,r),c=UU(l.baseId,r),d=r===l.value,u=ew.useRef(d);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,eb.jsx)(t5,{present:i||d,children:({present:n})=>(0,eb.jsx)(ne.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":s,hidden:!n,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:n&&a})})});function UW(e,t){return`${e}-trigger-${t}`}function UU(e,t){return`${e}-content-${t}`}function Uq({className:e,...t}){return(0,eb.jsx)(U$,{"data-slot":"tabs-list",className:tK("inline-flex h-8 items-center justify-center gap-0.5 rounded-lg bg-muted p-1 text-muted-foreground",e),...t})}function UK({className:e,...t}){return(0,eb.jsx)(UV,{"data-slot":"tabs-trigger",className:tK("inline-flex h-6 shrink-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",e),...t})}function UG({className:e,...t}){return(0,eb.jsx)(UH,{"data-slot":"tabs-content",className:tK("mt-3 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),...t})}UH.displayName=UB;let UY=HB.map(e=>({id:e.id,title:e.title,description:e.description,icon:e.icon,keywords:e.keywords}));function UX(e){return UY.find(t=>t.id===e)}function UZ(e){return"subagent-conversation-panel"!==e.kind}let UJ="application/vnd.vantaloom.agent-panel";function UQ(e){let t=UZ(e)?UX(e.kind):void 0,n={content:e};return{id:`agent-panel-${e.id}`,title:e.title,description:t?.description??("subagent-conversation-panel"===e.kind?"子代理运行信息流。":"来自 Agent 工作区的面板。"),meta:"Agent panel",icon:t?.icon,dragData:{"application/vnd.vantaloom.clip-kind":"agent-panel",[UJ]:JSON.stringify(n)},payloads:{[UJ]:n}}}let U0=eN("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),U1=eN("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),U2=eN("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),U5=eN("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var U4=e=>e.graphicalItems.polarItems,U3=jJ([M2,M5],A_),U6=jJ([U4,AA,U3],AR),U8=jJ([U6],AB),U7=jJ([U8,MP],AU),U9=jJ([U7,AA,U6],AK);jJ([U7,AA,U6],(e,t,n)=>n.length>0?e.flatMap(e=>n.flatMap(n=>{var r;return{value:k8(e,null!=(r=t.dataKey)?r:n.dataKey),errorDomain:[]}})).filter(Boolean):(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:k8(e,t.dataKey),errorDomain:[]})):e.map(e=>({value:e,errorDomain:[]})));var qe=()=>void 0,qt=jJ([U7,AA,U6,zr,M2,M_],za),qn=jJ([AA,ze,zt,qe,qt,qe,SY,M2],zj),qr=jJ([AA,SY,U7,U9,MX,M2,qn],zC),qi=jJ([qr,Az,zM],zE),qa=jJ([AA,qr,qi,M2],zP);function qo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qo(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}jJ([zM,qa],Et);var qs=jJ([U4,(e,t)=>t],(e,t)=>e.filter(e=>"pie"===e.type).find(e=>e.id===t)),qc=[],qd=(e,t,n)=>(null==n?void 0:n.length)===0?qc:n,qu=jJ([MP,qs,qd],(e,t,n)=>{var r,{chartData:i}=e;if(null!=t&&((r=(null==t?void 0:t.data)!=null&&t.data.length>0?t.data:i)&&r.length||null==n||(r=n.map(e=>ql(ql({},t.presentationProps),e.props))),null!=r))return r}),qf=jJ([qu,qs,qd],(e,t,n)=>{if(null!=e&&null!=t)return e.map((e,r)=>{var i,a,o=k8(e,t.nameKey,t.name);return a=null!=n&&null!=(i=n[r])&&null!=(i=i.props)&&i.fill?n[r].props.fill:"object"==typeof e&&null!=e&&"fill"in e?e.fill:t.fill,{value:Sc(o,t.dataKey),color:a,payload:e,type:t.legendType}})}),qh=jJ([qu,qs,qd,Sb],(e,t,n,r)=>{if(null!=t&&null!=e)return function(e){var t,n,r,{pieSettings:i,displayedData:a,cells:o,offset:l}=e,{cornerRadius:s,startAngle:c,endAngle:d,dataKey:u,nameKey:f,tooltipType:h}=i,p=Math.abs(i.minAngle),m=wu(d-c)*Math.min(Math.abs(d-c),360),g=Math.abs(m),v=a.length<=1?0:null!=(t=i.paddingAngle)?t:0,x=a.filter(e=>0!==k8(e,u,0)).length,y=a.reduce((e,t)=>{var n=k8(t,u,0);return e+(wp(n)?n:0)},0),b=p>0&&y>0&&a.some(e=>{var t=k8(e,u,0),n=(wp(t)?t:0)/y;return 0!==t&&n*g<p})?p:0,w=g-x*b-(g>=360?x:x-1)*v;return y>0&&(n=a.map((e,t)=>{var n,a=k8(e,u,0),d=k8(e,f,t),p=((e,t,n)=>{var r,{top:i,left:a,width:o,height:l}=t,s=CF(o,l),c=a+wx(e.cx,o,o/2),d=i+wx(e.cy,l,l/2),u=wx(e.innerRadius,s,0);return{cx:c,cy:d,innerRadius:u,outerRadius:(r=e.outerRadius,"function"==typeof r?wx(r(n),s,.8*s):wx(r,s,.8*s)),maxRadius:e.maxRadius||Math.sqrt(o*o+l*l)/2}})(i,l,e),g=(wp(a)?a:0)/y,x=qw(qw({},e),o&&o[t]&&o[t].props),j=null!=x&&"fill"in x&&"string"==typeof x.fill?x.fill:i.fill,k=(n=t?r.endAngle+wu(m)*v*(0!==a):c)+wu(m)*((0!==a?b:0)+g*w),S=(n+k)/2,C=(p.innerRadius+p.outerRadius)/2,N=[{name:d,value:a,payload:x,dataKey:u,type:h,color:j,fill:j,graphicalItemId:i.id}],M=C$(p.cx,p.cy,C,S);return r=qw(qw(qw(qw({},i.presentationProps),{},{percent:g,cornerRadius:"string"==typeof s?parseFloat(s):s,name:d,tooltipPayload:N,midAngle:S,middleRadius:C,tooltipPosition:M},x),p),{},{value:a,dataKey:u,startAngle:n,endAngle:k,payload:x,paddingAngle:0!==a?wu(m)*v:0})})),n}({offset:r,pieSettings:t,displayedData:e,cells:n})}),qp=["key"],qm=["onMouseEnter","onClick","onMouseLeave"],qg=["id"],qv=["id"];function qx(){return(qx=Object.assign.bind()).apply(null,arguments)}function qy(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qj(e){var t=(0,ew.useMemo)(()=>Mb(e.children,F0),[e.children]),n=wL(n=>qf(n,e.id,t));return null==n?null:ew.createElement(Dp,{legendPayload:n})}var qk=ew.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:s,tooltipType:c,id:d,activeShape:u}=e,f=function(e){if(null!=e&&"boolean"!=typeof e&&"function"!=typeof e){if(ew.isValidElement(e)){var t,n=null==(t=e.props)?void 0:t.fill;return"string"==typeof n?n:void 0}var{fill:r}=e;return"string"==typeof r?r:void 0}}(u),h={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return null==f||null==t?t:t.map(e=>qw(qw({},e),{},{color:f,fill:f}))}),getPosition:e=>{var t;return null==(t=r[Number(e)])?void 0:t.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Sc(l,t),hide:s,type:c,color:o,unit:"",graphicalItemId:d}};return ew.createElement(_V,{tooltipEntrySettings:h})});function qS(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=wP(n),s=wA(i),c=wA(a),d="object"==typeof i&&"offsetRadius"in i&&"number"==typeof i.offsetRadius&&i.offsetRadius||20,u=t.map((e,t)=>{var n,r,u=(e.startAngle+e.endAngle)/2,f=C$(e.cx,e.cy,e.outerRadius+d,u),h=qw(qw(qw(qw({},l),e),{},{stroke:"none"},s),{},{index:t,textAnchor:(n=f.x)>(r=e.cx)?"start":n<r?"end":"middle"},f),p=qw(qw(qw(qw({},l),e),{},{fill:"none",stroke:e.fill},c),{},{index:t,points:[C$(e.cx,e.cy,e.outerRadius,u),f],key:"line"});return ew.createElement(NG,{zIndex:CV.label,key:"label-".concat(e.startAngle,"-").concat(e.endAngle,"-").concat(e.midAngle,"-").concat(t)},ew.createElement(Ct,null,a&&((e,t)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);if("function"==typeof e)return e(t);var n=eH("recharts-pie-label-line","boolean"!=typeof e?e.className:""),{key:r}=t,i=qy(t,qp);return ew.createElement(S8,qx({},i,{type:"linear",className:n}))})(a,p),((e,t,n)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);var r=n;if("function"==typeof e&&(r=e(t),ew.isValidElement(r)))return r;var i=eH("recharts-pie-label-text",Lk(e));return ew.createElement(CD,qx({},t,{alignmentBaseline:"middle",className:i}),r)})(i,h,k8(e,o))))});return ew.createElement(Ct,{className:"recharts-pie-labels"},u)}function qC(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return"object"==typeof i&&null!=i&&"position"in i?ew.createElement(Mf,{label:i}):ew.createElement(qS,{sectors:t,props:n,showLabels:r})}function qN(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=wL(_u),s=wL(_h),c=wL(_p),{onMouseEnter:d,onClick:u,onMouseLeave:f}=i,h=qy(i,qm),p=Vl(d,i.dataKey,o),m=Vs(f),g=Vc(u,i.dataKey,o);return null==t||0===t.length?null:ew.createElement(ew.Fragment,null,t.map((e,d)=>{if((null==e?void 0:e.startAngle)===0&&(null==e?void 0:e.endAngle)===0&&1!==t.length)return null;var u=null==c||c===o,f=String(d)===l&&(null==s||i.dataKey===s)&&u,v=n&&f?n:l?r:null,x=qw(qw({},e),{},{stroke:e.stroke,tabIndex:-1,[Sg]:d,[Sv]:o});return ew.createElement(Ct,qx({key:"sector-".concat(null==e?void 0:e.startAngle,"-").concat(null==e?void 0:e.endAngle,"-").concat(e.midAngle,"-").concat(d),tabIndex:-1,className:"recharts-pie-sector"},wl(h,e,d),{onMouseEnter:p(e,d),onMouseLeave:m(e,d),onClick:g(e,d)}),ew.createElement(Vr,qx({option:null!=a?a:v,index:d,shapeType:"sector",isActive:f},x)))}))}function qM(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,ew.useMemo)(()=>t&&n?n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})):[],[n,t]);return ew.createElement(Md,{value:t?i:void 0},r)}function qE(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,activeShape:c,inactiveShape:d,onAnimationStart:u,onAnimationEnd:f}=t,h=Dm(t,"recharts-pie-"),p=n.current,[m,g]=(0,ew.useState)(!1),v=(0,ew.useCallback)(()=>{"function"==typeof f&&f(),g(!1)},[f]),x=(0,ew.useCallback)(()=>{"function"==typeof u&&u(),g(!0)},[u]);return ew.createElement(qM,{showLabels:!m,sectors:i},ew.createElement(DX,{animationId:h,begin:o,duration:l,isActive:a,easing:s,onAnimationStart:x,onAnimationEnd:v,key:h},e=>{var a,o=[],l=i&&i[0],s=null!=(a=null==l?void 0:l.startAngle)?a:0;return null==i||i.forEach((t,n)=>{var r=p&&p[n],i=n>0?(0,ws.default)(t,"paddingAngle",0):0;if(r){var a=wb(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),l=qw(qw({},t),{},{startAngle:s+i,endAngle:s+a+i});o.push(l),s=l.endAngle}else{var{endAngle:c,startAngle:d}=t,u=wb(0,c-d,e),f=qw(qw({},t),{},{startAngle:s+i,endAngle:s+u+i});o.push(f),s=f.endAngle}}),n.current=o,ew.createElement(Ct,null,ew.createElement(qN,{sectors:o,activeShape:c,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),ew.createElement(qC,{showLabels:!m,sectors:i,props:t}),t.children)}var qO={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:CV.area};function qP(e){var{id:t}=e,n=qy(e,qg),{hide:r,className:i,rootTabIndex:a}=e,o=(0,ew.useMemo)(()=>Mb(e.children,F0),[e.children]),l=wL(e=>qh(e,t,o)),s=(0,ew.useRef)(null),c=eH("recharts-pie",i);return r||null==l?(s.current=null,ew.createElement(Ct,{tabIndex:a,className:c})):ew.createElement(NG,{zIndex:e.zIndex},ew.createElement(qk,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),ew.createElement(Ct,{tabIndex:a,className:c},ew.createElement(qE,{props:qw(qw({},n),{},{sectors:l}),previousSectorsRef:s,id:t})))}var qA=function(e){var t=Cw(e,qO),{id:n}=t,r=qy(t,qv),i=wP(r);return ew.createElement(Dx,{id:n,type:"pie"},e=>ew.createElement(ew.Fragment,null,ew.createElement(DE,{type:"pie",id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),ew.createElement(qj,qx({},r,{id:e})),ew.createElement(qP,qx({},r,{id:e}))))};function qz(e){var t=w_();return(0,ew.useEffect)(()=>{t(T9(e))},[t,e]),null}qA.displayName="Pie";var qI=["layout"];function q_(){return(q_=Object.assign.bind()).apply(null,arguments)}function qD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var qT=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qD(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},RM),qR=(0,ew.forwardRef)(function(e,t){var n,r=Cw(e.categoricalChartProps,qT),{layout:i}=r,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(r,qI),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c}=e;return ew.createElement(RT,{preloadedState:{options:{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0}},reduxStoreName:null!=(n=r.id)?n:o},ew.createElement(RR,{chartData:r.data}),ew.createElement(RL,{layout:i,margin:r.margin}),ew.createElement(RF,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement(R$,{baseValue:void 0,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),ew.createElement(qz,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),ew.createElement(Ld,q_({},a,{ref:t})))});function qL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qL(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var qF=["item"],qV=q$(q$({},qT),{},{layout:"centric",startAngle:0,endAngle:360}),qB=(0,ew.forwardRef)((e,t)=>{var n=Cw(e,qV);return ew.createElement(qR,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:qF,tooltipPayloadSearcher:Tw,categoricalChartProps:n,ref:t})});let qH={placeholder:"Ask the agent to inspect, change, or explain this workspace...",mode:"Mode",model:"Model",attach:"Attach context",removeChip:"Remove context",queuedMessage:"Queued message",guideQueuedMessage:"Guide",removeQueuedMessage:"Remove queued message",moreQueuedMessageActions:"More queued message actions",contextUsage:"Context usage",contextUsed:"used",contextTokenSummary:"used {used} / {total}",toolCalls:"Tool calls",userMessages:"User messages",otherContext:"Other context",compressContext:"Compress context",send:"Run",stop:"Stop"},qW=[{id:"agent",label:"Agent",description:"Use tools and make changes.",icon:(0,eb.jsx)(ye,{className:"fill-current"})},{id:"planner",label:"Planner",description:"Plan before changing files.",icon:(0,eb.jsx)(B8,{})},{id:"reviewer",label:"Reviewer",description:"Inspect risks and regressions.",icon:(0,eb.jsx)(mR,{})}],qU=[{id:"gpt-5.5",label:"GPT-5.5",description:"Highest quality coding agent."},{id:"gpt-5.4",label:"GPT-5.4",description:"Balanced everyday work."},{id:"gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Fast lightweight passes."}];function qq(e){if(e)return"string"==typeof e.label||"number"==typeof e.label?String(e.label):e.id}function qK({value:e,defaultValue:t,onValueChange:n,modes:r=qW,modeId:i,defaultModeId:a,onModeChange:o,models:l=qU,modelId:s,defaultModelId:c,onModelChange:d,queuedMessages:u,defaultQueuedMessages:f=[],onQueuedMessagesChange:h,onQueueMessage:p,onRemoveQueuedMessage:m,queueOnTab:g=!0,renderQueuedMessageActions:v,contextUsage:x,chips:y=[],actions:b,footer:w,running:j=!1,disabled:k=!1,submitOnEnter:S=!0,minRows:C=2,maxRows:N=7,onSubmit:M,onStop:E,onAttach:O,labels:P,className:A,textareaClassName:z,toolbarClassName:I}){let _={...qH,...P},D=ew.useRef(null),T=ew.useId(),R=ew.useRef(0),[L,$]=function({value:e,defaultValue:t="",onChange:n}){let[r,i]=ew.useState(t);return[e??r,ew.useCallback(t=>{void 0===e&&i(t),n?.(t)},[n,e])]}({value:e,defaultValue:t,onChange:n}),[F,V]=ew.useState(f),[B,H]=ew.useState(a??r[0]?.id),[W,U]=ew.useState(c??l[0]?.id),q=i??B,K=s??W,G=r.find(e=>e.id===q)??r[0],Y=l.find(e=>e.id===K)??l[0],X=u??F,Z=L.trim().length>0&&!k;function J(){Z&&(M?.({value:L,modeId:G?.id,modelId:Y?.id}),$(""))}function Q(e){void 0===u&&V(e),h?.(e)}return ew.useLayoutEffect(()=>{let e=D.current;if(!e)return;e.style.height="0px";let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)?t*N:160;e.style.height=`${Math.min(e.scrollHeight,n)}px`,e.style.overflowY=e.scrollHeight>n?"auto":"hidden"},[N,L]),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer","data-running":j,className:tK("relative grid w-full",A),children:[X.length>0&&(0,eb.jsx)(qX,{messages:X,labels:_,renderActions:v,onRemove:function(e){let t=X.find(t=>t.id===e);if(!t)return;let n=X.filter(t=>t.id!==e);Q(n),m?.(e,t,n)}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-surface",className:tK("vtl-agent-input-composer-surface relative grid w-full gap-2 rounded-lg border border-border p-2 shadow-sm transition-colors"),children:[y.length>0&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-context",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:y.map(e=>(0,eb.jsx)(qZ,{chip:e,removeLabel:_.removeChip},e.id))}),(0,eb.jsx)("textarea",{ref:D,value:L,disabled:k,rows:C,placeholder:_.placeholder,"data-slot":"agent-input-composer-textarea",className:tK("min-h-10 w-full resize-none border-0 bg-transparent px-0.5 py-0 text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",z),onChange:e=>$(e.currentTarget.value),onKeyDown:e=>{g&&"Tab"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&function(){let e=L.trim();if(!e||k)return!1;R.current+=1;let t={id:`${T}-queued-${R.current}`,content:e},n=[...X,t];return Q(n),p?.(t,n),$(""),!0}()?e.preventDefault():!S||"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),J())}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-toolbar",className:tK("grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2",I),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,eb.jsx)(qJ,{label:_.mode,options:r,value:G?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"grid size-3.5 place-items-center text-muted-foreground [&_svg]:size-3",children:G?.icon??(0,eb.jsx)(ye,{className:"fill-current"})}),(0,eb.jsx)("span",{className:"truncate",children:qq(G)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===i&&H(e.id),o?.(e.id,e))}}),(0,eb.jsx)(qJ,{label:_.model,options:l,value:Y?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"truncate",children:qq(Y)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===s&&U(e.id),d?.(e.id,e))}}),O&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":_.attach,title:_.attach,onClick:O,disabled:k,children:(0,eb.jsx)(U2,{})}),b]}),(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,eb.jsx)(qY,{usage:x,labels:_}),(0,eb.jsx)(tY,{type:"button",size:"icon-xs",variant:j?"outline":"default","aria-label":j?_.stop:_.send,title:j?_.stop:_.send,disabled:!j&&!Z,className:"rounded-full",onClick:j?E:J,children:j?(0,eb.jsx)(U5,{className:"size-3 fill-current"}):(0,eb.jsx)(U0,{className:"size-3.5"})})]})]}),w&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-footer",className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:w})]})]})}function qG(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}function qY({usage:e,labels:t}){let[n,r]=ew.useState(!1),i=Math.max(0,e.used),a=Math.max(0,e.total),o=a>0?Math.min(100,Math.round(i/a*100)):0,l=Math.max(0,e.toolCalls),s=Math.max(0,e.userMessages),c=Math.max(0,e.other??Math.max(0,i-l-s)),d=[{name:"toolCalls",value:l,fill:"var(--color-toolCalls)"},{name:"userMessages",value:s,fill:"var(--color-userMessages)"},{name:"other",value:c,fill:"var(--color-other)"},{name:"unused",value:Math.max(0,a-i),fill:"var(--muted)"}].filter(e=>e.value>0),u=t.contextTokenSummary.replace("{used}",qG(i)).replace("{total}",qG(a)),f={toolCalls:{label:t.toolCalls,color:"var(--chart-1)"},userMessages:{label:t.userMessages,color:"var(--chart-3)"},other:{label:t.otherContext,color:"var(--chart-5)"}};return(0,eb.jsxs)(gN,{children:[(0,eb.jsx)(gP,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":`${t.contextUsage}: ${o}% ${t.contextUsed}`,title:`${t.contextUsage}: ${o}% ${t.contextUsed}`,children:(0,eb.jsx)("span",{"aria-hidden":"true",className:"grid size-4 place-items-center rounded-full",style:{background:`conic-gradient(var(--foreground) ${3.6*o}deg, var(--border) 0deg)`},children:(0,eb.jsx)("span",{className:"size-3 rounded-full bg-background dark:bg-popover"})})})}),(0,eb.jsxs)(gH,{side:"top",align:"center",sideOffset:8,className:"w-44 gap-2 p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-0.5 text-center",children:[(0,eb.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:e.label??t.contextUsage}),(0,eb.jsxs)("div",{className:"text-sm text-muted-foreground",children:[o,"% ",t.contextUsed]}),(0,eb.jsx)("div",{className:"text-sm font-medium",children:u})]}),(0,eb.jsx)("div",{className:"grid justify-center",children:(0,eb.jsx)(FI,{config:f,className:"h-20 w-20",initialDimension:{width:80,height:80},onMouseMove:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,eb.jsxs)(qB,{children:[(0,eb.jsx)(FD,{active:n,content:(0,eb.jsx)(FT,{hideLabel:!0})}),(0,eb.jsx)(qA,{data:d.length>0?d:[{name:"other",value:1,fill:"var(--muted)"}],dataKey:"value",nameKey:"name",innerRadius:25,outerRadius:35,isAnimationActive:!1,strokeWidth:0})]})})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:e.onCompress,disabled:!e.onCompress,children:t.compressContext})]})]})}function qX({messages:e,labels:t,renderActions:n,onRemove:r}){return(0,eb.jsx)("div",{"data-slot":"agent-input-composer-queue",className:"vtl-agent-input-composer-queue z-10 mx-5 mb-[-1px] grid gap-1.5 rounded-t-lg rounded-b-none border border-border p-1.5 shadow-xs",children:e.map((e,i)=>(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-queue-item",className:tK("group/queue flex min-h-8 min-w-0 items-center gap-2 rounded-md px-2 text-sm transition-colors",e.disabled?"text-muted-foreground opacity-60":"text-foreground hover:bg-muted/60"),children:[(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(U1,{})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",title:String(e.content),children:e.content}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover/queue:opacity-100",children:[n?.(e),(0,eb.jsxs)(tY,{type:"button",variant:"ghost",size:"xs",className:"h-6 gap-1 px-1.5 text-muted-foreground","aria-label":`${t.guideQueuedMessage} ${i+1}`,children:[(0,eb.jsx)(U1,{className:"size-3.5"}),t.guideQueuedMessage]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.removeQueuedMessage} ${i+1}`,onClick:()=>r(e.id),children:(0,eb.jsx)(m0,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.moreQueuedMessageActions} ${i+1}`,children:(0,eb.jsx)(s6,{})})]})]},e.id))})}function qZ({chip:e,removeLabel:t}){return(0,eb.jsxs)(c_,{variant:"secondary","data-tone":e.tone,className:tK("h-6 max-w-full gap-1 rounded-md border border-border bg-muted/70 px-1.5 text-muted-foreground","success"===e.tone&&"border-primary/25 bg-primary/10 text-foreground","warning"===e.tone&&"border-destructive/25 bg-destructive/10 text-foreground"),children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-3.5 shrink-0 place-items-center [&_svg]:size-3",children:e.icon}),(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.onRemove&&(0,eb.jsx)("button",{type:"button",className:"-mr-0.5 grid size-4 shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none","aria-label":`${t} ${e.id}`,onClick:()=>e.onRemove?.(e.id),children:(0,eb.jsx)(p6,{className:"size-3"})})]})}function qJ({label:e,options:t,value:n,trigger:r,triggerClassName:i,onSelect:a}){return(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"xs",className:tK("h-6 max-w-40 gap-1 rounded-md px-1.5 text-xs font-medium",i),children:r})}),(0,eb.jsx)(yj,{align:"start","aria-label":"string"==typeof e?e:void 0,className:"min-w-40 p-1",children:t.map(e=>(0,eb.jsxs)(yk,{disabled:e.disabled,className:"h-8 gap-2 px-2 text-sm",onSelect:()=>a(e),children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),(0,eb.jsx)(nv,{className:tK("ml-auto size-4 text-foreground",n===e.id?"opacity-100":"opacity-0")})]},e.id))})]})}function qQ(e,t,n,r){return[{id:`${t}-task-${e}`,kind:"user",title:n},...r.map(n=>({...n,id:`${t}-${n.id}-${e}`}))]}function q0(e){return[{id:`read-materials-${e}`,kind:"read",actionLabel:"读取",title:"AgentWorkspace.tsx, styles.css, i18n.json",files:[{id:`workspace-${e}`,name:"AgentWorkspace.tsx",lines:"1-480"},{id:`styles-${e}`,name:"styles.css",lines:"265-820"},{id:`i18n-${e}`,name:"i18n.json",lines:"245-292"}]},{id:`search-actions-${e}`,kind:"search",actionLabel:"搜索",title:"workspace creation, sidebar tree, streaming output",files:[{id:`workspace-search-${e}`,name:"AgentWorkspace.tsx",lines:"64-190"},{id:`style-search-a-${e}`,name:"styles.css",lines:"540-670"},{id:`style-search-b-${e}`,name:"styles.css",lines:"705-790"}]},{id:`subagents-${e}`,kind:"subagent",actionLabel:"召唤",title:"子代理",subagents:[{id:`reader-${e}`,title:"阅读子代理",activity:"阅读 package.json",toolActivities:["读取 package.json","检查 workspace 脚本","整理依赖信息"],status:"阅读 package.json",detail:"package.json 已读取,正在整理脚本与依赖信息。",isRunning:!0,events:qQ(e,"reader","阅读 package.json",[{id:"read-package",kind:"read",actionLabel:"读取",title:"package.json",files:[{id:"package-json",name:"package.json",lines:"1-96"}]},{id:"reader-note",kind:"done",title:"已读取 package.json。\n\n- 已记录 workspace 脚本\n- 已检查 UI 与 app 包依赖\n- 下一步等待主代理合并上下文"}])},{id:`searcher-${e}`,title:"搜索子代理",activity:"搜索 AgentWorkspace.tsx",toolActivities:["搜索 AgentWorkspace.tsx","筛选面板布局","定位事件流接入"],status:"搜索 AgentWorkspace.tsx",detail:"AgentWorkspace.tsx 命中 3 处候选区域,正在筛选可复用结构。",isRunning:!0,events:qQ(e,"searcher","搜索 AgentWorkspace.tsx",[{id:"search-workspace",kind:"search",actionLabel:"搜索",title:"AgentWorkspace.tsx",files:[{id:"agent-workspace-a",name:"AgentWorkspace.tsx",lines:"64-190"},{id:"agent-workspace-b",name:"AgentWorkspace.tsx",lines:"320-418"}]},{id:"searcher-note",kind:"done",title:"已定位 AgentWorkspace.tsx 的面板布局与事件流接入位置。"}])},{id:`verifier-${e}`,title:"验证子代理",activity:"验证工作流状态",toolActivities:["验证对话流","验证右侧面板","检查子代理切换"],status:"验证工作流状态",detail:"工作流状态正在校验,等待主代理提交最终结果。",isRunning:!0,events:qQ(e,"verifier","验证工作流状态",[{id:"verify-flow",kind:"verify",actionLabel:"验证",title:"对话流、右侧面板、子代理切换"},{id:"verifier-note",kind:"done",title:"验证队列已建立,等待主代理继续写入真实结果。"}])}]},{id:`think-structure-${e}`,kind:"thought",actionLabel:"思考",title:"8s",status:"done"},{id:`plan-${e}`,kind:"done",title:"**收到新的编织请求。**\n\n我会先保留当前工作台样式,只用占位文本演示真实任务流:读取、搜索、思考、编辑和验证都会按顺序进入同一条文字流。\n\n- 左侧织布机由真实创建动作产生\n- 编织物初始保持为空\n- 文件读取项仍然可以展开\n- 点击文件名会继续打开右侧标签页"},{id:`edit-workspace-${e}`,kind:"change",actionLabel:"编辑",title:"AgentWorkspace.tsx",additions:44,deletions:16},{id:`edit-style-${e}`,kind:"change",actionLabel:"编辑",title:"styles.css",additions:36,deletions:12},{id:`verify-flow-${e}`,kind:"verify",actionLabel:"验证",title:"empty sidebar, new loom creation, placeholder workflow"},{id:`done-${e}`,kind:"done",title:"演示工作流已完成。\n\n这只是前端占位演示,后续可以直接把事件流替换成真实 agent runtime。"}]}let q1=[{id:"user-1",kind:"user",title:"345"},...q0("1"),{id:"user-2",kind:"user",title:"234"}],q2=eN("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function q5({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"agent-message-actions",className:tK("flex items-center gap-1.5 text-muted-foreground",e),...t})}function q4({className:e,...t}){return(0,eb.jsx)(tY,{size:"icon-xs",variant:"ghost",className:e,...t})}function q3(e,t=1/0){let n=[],r=0;for(;r<e.length;){if(e.startsWith("**",r)){let i=e.indexOf("**",r+2),a=-1===i?e.slice(r+2):e.slice(r+2,i);a.length>0&&n.push((0,eb.jsx)("strong",{children:q3(a,t-r-2)},`strong-${r}`)),r=-1===i?e.length:i+2;continue}if("`"===e[r]){let i=e.indexOf("`",r+1),a=-1===i?e.slice(r+1):e.slice(r+1,i);a.length>0&&n.push((0,eb.jsx)("code",{children:q3(a,t-r-1)},`code-${r}`)),r=-1===i?e.length:i+1;continue}let i=[e.indexOf("**",r),e.indexOf("`",r)].filter(e=>e>=0).sort((e,t)=>e-t)[0]??e.length;!function(e,t,n,r,i){if(!t)return;let a=n+t.length;if(r<=n)return e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t},`${i}-fade-${n}`));if(r>=a)return e.push(t);let o=r-n;e.push(t.slice(0,o)),e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t.slice(o)},`${i}-fade-${n}`))}(n,e.slice(r,i),r,t,`text-${r}`),r=i}return n}function q6(e){return/^\s*[-*]\s+/.test(e)}function q8(e){return/^#{1,6}\s+/.test(e.trim())}function q7(e){return/^\s*([-*_])(?:\s*\1){2,}\s*$/.test(e)}function q9(e){return e.includes("|")&&e.trim().split("|").length>=3}function Ke(e){return/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(e)}function Kt(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Kn({content:e,isStreaming:t=!1}){let n=function(e){let t=e.replace(/\r\n/g,"\n").split("\n"),n=[],r=0;for(let e of t)n.push(r),r+=e.length+1;let i=[],a=0;for(;a<t.length;){let e=t[a]??"",r=e.trim(),o=n[a]??0;if(!r){a+=1;continue}if(r.startsWith("```")){let e=[];for(a+=1;a<t.length&&!(t[a]??"").trim().startsWith("```");)e.push(t[a]??""),a+=1;a<t.length&&(a+=1),i.push({kind:"code",text:e.join("\n"),start:o});continue}if(q7(e)){i.push({kind:"hr",start:o}),a+=1;continue}if(q8(e)){let e=/^(#{1,6})\s+(.+)$/.exec(r),t=e?.[1]??"##";i.push({kind:"heading",depth:t.length,text:e?.[2]??r,start:o}),a+=1;continue}if(q9(e)&&a+1<t.length&&Ke(t[a+1]??"")){let n=Kt(e),r=[];for(a+=2;a<t.length&&q9(t[a]??"");)r.push(Kt(t[a]??"")),a+=1;i.push({kind:"table",headers:n,rows:r,start:o});continue}if(q6(e)){let e=[];for(;a<t.length&&q6(t[a]??"");)e.push({text:(t[a]??"").replace(/^\s*[-*]\s+/,""),start:n[a]??0}),a+=1;i.push({kind:"list",items:e,start:o});continue}let l=[];for(;a<t.length;){let e=t[a]??"",n=t[a+1]??"";if(!e.trim()||e.trim().startsWith("```")||q7(e)||q8(e)||q6(e)||q9(e)&&Ke(n))break;l.push(e),a+=1}i.push({kind:"paragraph",lines:l,start:o})}return i}(e),r=t?Math.max(0,e.length-14):1/0;return(0,eb.jsx)("div",{className:"vtl-agent-markdown",children:n.map((e,t)=>{let n=r-e.start;return"code"===e.kind?(0,eb.jsx)("pre",{children:e.text},`block-${t}`):"hr"===e.kind?(0,eb.jsx)("hr",{},`block-${t}`):"heading"===e.kind?e.depth<=2?(0,eb.jsx)("h3",{children:q3(e.text,n)},`block-${t}`):(0,eb.jsx)("h4",{children:q3(e.text,n)},`block-${t}`):"list"===e.kind?(0,eb.jsx)("ul",{children:e.items.map((e,t)=>(0,eb.jsx)("li",{children:q3(e.text,r-e.start)},`${e.text}-${t}`))},`block-${t}`):"table"===e.kind?(0,eb.jsx)("div",{className:"vtl-agent-markdown-table",children:(0,eb.jsxs)("table",{children:[(0,eb.jsx)("thead",{children:(0,eb.jsx)("tr",{children:e.headers.map((e,t)=>(0,eb.jsx)("th",{children:q3(e,n)},`${e}-${t}`))})}),(0,eb.jsx)("tbody",{children:e.rows.map((t,r)=>(0,eb.jsx)("tr",{children:e.headers.map((e,i)=>(0,eb.jsx)("td",{children:q3(t[i]??"",n)},`cell-${r}-${i}`))},`row-${r}`))})]})},`block-${t}`):(0,eb.jsx)("p",{children:q3(e.lines.map(e=>e.trim()).join(" "),n)},`block-${t}`)})})}function Kr(e){return("assistant"===e.kind||"done"===e.kind)&&"模型没有返回内容。"===e.title.trim()&&!e.detail?.trim()}function Ki(e){return("error"!==e.kind||"retried"!==e.status)&&!Kr(e)}function Ka({events:e,labels:t,bottomInset:n=16,className:r,contentClassName:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s,onRetry:c}){let d=ew.useRef(null),u=ew.useRef(!0),[f,h]=ew.useState(0),[p,m]=ew.useState(0),[g,v]=ew.useState({}),x=ew.useMemo(()=>e.filter(Ki),[e]);ew.useLayoutEffect(()=>{let e=d.current;if(!e)return;function t(){m(e.clientHeight)}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let y=ew.useMemo(()=>x.reduce((e,t,n)=>{var r;let i=g[Ky(t,n)]??("user"===(r=t).kind?72:"assistant"===r.kind||"done"===r.kind?Math.max(42,Math.min(260,28+22*Math.ceil((r.title.length+(r.detail?.length??0))/68))):"read"===r.kind||"search"===r.kind?r.files?.length?28+26*Math.min(r.files.length,5):26:"subagent"===r.kind?r.subagents?.length?6+24*Math.min(r.subagents.length,6):42:"change"===r.kind?Math.max(42,Math.min(180,10+(r.files?.length??1)*43)):"error"===r.kind?88:r.detail?54:26);return e.rows.push({event:t,index:n,offset:e.totalHeight,height:i,autoOpen:"read"===t.kind&&!!t.isStreaming||"read"===t.kind&&!x.slice(n+1).some(e=>"read"!==e.kind)}),e.totalHeight+=i,e},{rows:[],totalHeight:0}),[g,x]),b=y.rows.filter(e=>e.offset+e.height>=f-360&&e.offset<=f+Math.max(p,520)+360),w=y.totalHeight+Math.max(0,n);ew.useLayoutEffect(()=>{let e=d.current;e&&x.length&&u.current&&(e.scrollTop=e.scrollHeight,h(e.scrollTop))},[n,x.length,w]);let j=ew.useCallback((e,t)=>{v(n=>1>Math.abs((n[e]??0)-t)?n:{...n,[e]:t})},[]);return(0,eb.jsx)("div",{ref:d,"data-slot":"agent-conversation-flow",className:tK("min-h-0 flex-1 overflow-auto px-4 pt-4 opacity-100 transition-opacity duration-180 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",r),onScroll:function(){let e=d.current;e&&(u.current=e.scrollHeight-e.scrollTop-e.clientHeight<96,h(e.scrollTop))},children:(0,eb.jsx)("div",{className:tK("relative mx-auto min-h-full w-full max-w-[48rem]",i),style:{height:w},children:b.map(e=>(0,eb.jsx)(Ko,{event:e.event,rowKey:Ky(e.event,e.index),offset:e.offset,autoOpen:e.autoOpen,labels:t,onMeasure:j,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s,onRetry:c},Ky(e.event,e.index)))})})}function Ko({event:e,rowKey:t,offset:n,autoOpen:r,labels:i,onMeasure:a,onOpenFile:o,onOpenSubagent:l,onRecallUserMessage:s,onBranchUserMessage:c,onRetry:d}){let u=ew.useRef(null);return ew.useLayoutEffect(()=>{let e=u.current;if(!e)return;function n(){a(t,Math.ceil(e.getBoundingClientRect().height))}n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e.id,a,t]),(0,eb.jsx)("div",{ref:u,"data-index":e.id,className:"absolute inset-x-0 top-0",style:{transform:`translateY(${n}px)`},children:(0,eb.jsx)(Kl,{event:e,autoOpen:r,labels:i,onOpenFile:o,onOpenSubagent:l,onRecallUserMessage:s,onBranchUserMessage:c,onRetry:d})})}function Kl({event:e,autoOpen:t,labels:n,onOpenFile:r,onOpenSubagent:i,onRecallUserMessage:a,onBranchUserMessage:o,onRetry:l}){return"user"===e.kind?(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsx)("div",{className:"vtl-agent-user-message-wrap",children:(0,eb.jsx)("div",{className:"vtl-agent-user-message",children:e.title})}),(a||o)&&(0,eb.jsxs)(q5,{className:"absolute top-1/2 right-2 opacity-0 transition-opacity focus-within:opacity-100 hover:opacity-100",children:[a&&(0,eb.jsx)(q4,{type:"button","aria-label":n?.recall??"召回",title:n?.recall??"召回",onClick:()=>a(e),children:(0,eb.jsx)(q2,{})}),o&&(0,eb.jsx)(q4,{type:"button","aria-label":n?.branch??"分支",title:n?.branch??"分支",onClick:()=>o(e),children:(0,eb.jsx)(F$,{})})]})]}):"assistant"===e.kind||"done"===e.kind?Kr(e)?null:(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)("div",{"data-streaming":e.isStreaming?"true":"false",children:(0,eb.jsx)(Kn,{content:e.detail?`${e.title}
21
21
 
22
22
  ${e.detail}`:e.title,isStreaming:e.isStreaming})})}):("read"===e.kind||"search"===e.kind)&&(e.files?.length||e.detail?.trim())?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)(Kg,{event:e,autoOpen:t,children:(0,eb.jsx)(Ks,{event:e,onOpenFile:r})})}):"subagent"===e.kind&&e.subagents?.length?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)(Kf,{event:e,onOpenSubagent:i})}):"change"===e.kind?(0,eb.jsx)(Kv,{event:e,onOpenFile:r}):"thought"===e.kind?(0,eb.jsx)(Km,{event:e,labels:n}):"error"===e.kind?(0,eb.jsx)(Kp,{event:e,onRetry:l}):(0,eb.jsx)(Kh,{event:e})}function Ks({event:e,onOpenFile:t}){let n=function(e){var t;let n=e.files?.map((t,n)=>{var r,i,a;let o,l;return r=e,i=t,a=n,o=r.actionLabel?.trim()==="探索"||i.meta?.toLowerCase().startsWith("depth")||/[\\/]$/.test(i.name)||!!(i.path&&/[\\/]$/.test(i.path)),l=Kx(i.name||i.path||"untitled"),{key:i.id??`file-${a}-${i.path??i.name}`,label:l,level:0,kind:o?"folder":"file",meta:i.lines??i.meta,file:i}})??[],r=e.detail?.trim()&&("read"!==e.kind||e.actionLabel?.trim()==="探索")?e.detail.replace(/\r\n/g,"\n").trimEnd():"";return r?e.actionLabel?.trim()==="探索"?(t=function(e,t){let n,r,i,a,o=(n=[],r=[],i=[],a=null,t.split("\n").forEach((e,t)=>{let o=e.trim();if(!o)return;if(o.startsWith("hint:"))return void i.push({key:`hint-${t}`,label:o.replace(/^hint:\s*/,""),level:0,kind:"hint"});let l=Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),s=/[\\/]$/.test(o),c={key:`detail-${t}-${o}`,label:o.replace(/[\\/]+$/,""),level:l,kind:s?"folder":"file"};if(0===l){a={root:c,children:[]},n.push(a);return}a?a.children.push(c):r.push(c)}),{sections:n,orphans:r,hints:i});if(!o.sections.length&&!o.orphans.length)return[...e,...o.hints];let l=new Set,s=[];return e.forEach(e=>{s.push(e);let t=o.sections.findIndex((t,n)=>!l.has(n)&&Kd(t.root.label)===Kd(e.label));t>=0&&(l.add(t),s.push(...function(e,t,n){if(!t)return e;let r=[];return e.map(e=>{var i,a;let o,l=Math.max(0,e.level-1);return(r.length=l,r[l]=e.label,"file"!==e.kind)?e:{...e,file:{id:e.key,name:e.label,machineId:n,path:(i=t,a=r.slice(0,l+1),o=i.includes("\\")?"\\":"/",[i.replace(/[\\/]+$/,""),...a.map(e=>e.replace(/^[\\/]+|[\\/]+$/g,""))].filter(Boolean).join(o))}}})}(o.sections[t]?.children??[],e.file?.path,e.file?.machineId)))}),o.sections.forEach((e,t)=>{l.has(t)||s.push(e.root,...e.children)}),s.push(...o.orphans,...o.hints),s}(n,r)).map((e,n)=>{if(e.level<=0)return e;let r=Array.from({length:e.level-1},(e,r)=>Ku(t,n,r+1));return{...e,branch:{ancestorLines:r,isLast:!Ku(t,n,e.level)}}}):[...n,...r.split("\n").map((e,t)=>{let n=e.trim();return n?n.startsWith("hint:")?{key:`detail-hint-${t}`,label:n.replace(/^hint:\s*/,""),level:0,kind:"hint"}:{key:`detail-plain-${t}`,label:n,level:Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),kind:"plain"}:null}).filter(e=>!!e)]:n}(e);return n.length?(0,eb.jsx)("div",{className:"vtl-agent-tool-result","data-kind":e.actionLabel?.trim()==="探索"?"tree":e.kind,children:n.map(e=>(0,eb.jsx)(Kc,{row:e,onOpenFile:t},e.key))}):null}function Kc({row:e,onOpenFile:t}){let n=(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)("span",{className:"vtl-agent-tool-row-tree","aria-hidden":"true","data-level":e.level,children:[e.branch?.ancestorLines.map((e,t)=>(0,eb.jsx)("span",{className:"vtl-agent-tool-row-tree-ancestor","data-active":e?"true":void 0},`ancestor-${t}`)),e.level>0?(0,eb.jsx)("span",{className:"vtl-agent-tool-row-tree-elbow","data-last":e.branch?.isLast?"true":void 0}):null,(0,eb.jsx)("span",{className:"vtl-agent-tool-row-icon",children:"folder"===e.kind?"▾":""})]}),(0,eb.jsx)("span",{className:"vtl-agent-tool-row-label",children:e.label}),e.meta?(0,eb.jsx)("em",{children:e.meta}):null]}),r={"--tool-tree-indent":`${13*Math.min(e.level,8)}px`,"--tool-tree-level":Math.min(e.level,8)};return e.file&&"file"===e.kind?(0,eb.jsx)("button",{type:"button",className:"vtl-agent-tool-row","data-kind":e.kind,style:r,onClick:()=>t?.(e.file),children:n}):(0,eb.jsx)("div",{className:"vtl-agent-tool-row","data-kind":e.kind,style:r,children:n})}function Kd(e){return Kx(e.replace(/[\\/]+$/,"")).toLowerCase()}function Ku(e,t,n){for(let r=t+1;r<e.length;r+=1){let t=e[r]?.level??0;if(t<n)break;if(t===n)return!0}return!1}function Kf({event:e,onOpenSubagent:t}){let[n,r]=ew.useState(()=>new Set);return(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-list",children:e.subagents?.map(i=>{let a=n.has(i.id),o=function(e){if(e.toolActivities?.length)return e.toolActivities;let t=e.events?.filter(e=>"read"===e.kind||"search"===e.kind||"verify"===e.kind||"change"===e.kind||"tool"===e.kind).map(e=>[e.actionLabel,e.title].filter(Boolean).join(" ").trim()).filter(Boolean)??[];return t.length?t:[e.activity??e.status??e.title]}(i),l=i.isRunning&&o.length>1?[...o,o[0]]:o;return(0,eb.jsxs)("section",{className:"vtl-agent-subagent-tool","data-expanded":a?"true":"false","data-running":i.isRunning?"true":void 0,children:[(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-trigger","aria-expanded":a,onClick:()=>{r(e=>{let t=new Set(e);return t.has(i.id)?t.delete(i.id):t.add(i.id),t})},children:(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-title",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,i.title,(0,eb.jsx)("i",{"aria-hidden":"true"})]})}),(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-detail",children:(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-info",style:{"--activity-count":o.length,"--activity-frame-count":l.length},onClick:()=>t?.(i,e),children:(0,eb.jsx)("span",{className:"vtl-agent-subagent-tool-info-stack",children:l.map((e,t)=>(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-info-line",children:["正在 ",e]},`${i.id}-${e}-${t}`))})})})]},i.id)})})}function Kh({event:e}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("p",{className:"vtl-agent-action-line",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,e.title,e.meta?(0,eb.jsx)("em",{children:e.meta}):null]})})}function Kp({event:e,onRetry:t}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("div",{className:"vtl-agent-error-card",children:[(0,eb.jsxs)("div",{className:"vtl-agent-error-card-body",children:[(0,eb.jsxs)("span",{children:[e.meta?(0,eb.jsx)("strong",{children:e.meta}):null,e.title]}),e.detail?(0,eb.jsx)("p",{children:e.detail}):null]}),e.retryable&&t?(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-error-retry",onClick:()=>t(e),children:[(0,eb.jsx)(vS,{className:"size-3.5"}),"重试"]}):null]})})}function Km({event:e,labels:t}){let[n,r]=ew.useState(!!e.isStreaming),i=!!e.detail?.trim(),a=e.title||t?.thinking||"思考中";return ew.useEffect(()=>{r(!!e.isStreaming)},[e.isStreaming]),(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-thought-line","data-streaming":e.isStreaming?"true":"false","aria-expanded":n,onClick:()=>i&&r(e=>!e),children:[(0,eb.jsx)("span",{children:a}),e.meta?(0,eb.jsx)("em",{children:e.meta}):null]}),i?(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,eb.jsx)("div",{className:"vtl-agent-thought-detail",children:(0,eb.jsx)(Kn,{content:e.detail??"",isStreaming:e.isStreaming})})})}):null]})}function Kg({event:e,autoOpen:t,children:n}){let[r,i]=ew.useState(t),a=ew.useRef(null);return ew.useEffect(()=>{i(t)},[t]),ew.useEffect(()=>{if(!r||!t||!a.current)return;let e=a.current.querySelector(".vtl-agent-tool-result");e&&(e.scrollTop=e.scrollHeight)},[t,n,e.detail,e.files?.length,r]),(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>i(e=>!e),"aria-expanded":r,children:[(0,eb.jsx)("span",{children:e.actionLabel?e.actionLabel:null}),e.title]}),(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",r?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{ref:a,className:"min-h-0 overflow-hidden",children:n})})]})}function Kv({event:e,onOpenFile:t}){let n=e.files?.length?e.files:[{id:e.id,name:e.title,diff:e.diff,kind:"diff",mutationId:e.mutationId,additions:e.additions,deletions:e.deletions}];return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)("div",{className:"vtl-agent-change-stack",children:n.map((r,i)=>{let a=r.additions??(1===n.length?e.additions:void 0),o=r.deletions??(1===n.length?e.deletions:void 0),l=!!(r.diff??e.diff);return(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-change-row","data-streaming":e.isStreaming?"true":void 0,disabled:!l,onClick:()=>{l&&t?.({...r,diff:r.diff??e.diff,kind:r.kind??"diff",mutationId:r.mutationId??e.mutationId})},children:[(0,eb.jsxs)("span",{children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,Kx(r.name||r.path||e.title)]}),"number"==typeof a||"number"==typeof o?(0,eb.jsxs)("em",{children:["number"==typeof a?(0,eb.jsxs)("b",{"data-kind":"add",children:["+",a]}):null,"number"==typeof o?(0,eb.jsxs)("b",{"data-kind":"delete",children:["-",o]}):null]}):e.meta?(0,eb.jsx)("em",{children:e.meta}):null]},r.id??`${e.id}-${r.path??r.name}-${i}`)})})})}function Kx(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function Ky(e,t){return`${e.id}-${t}`}eN("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),eU("vtl-dot-matrix-loader",{variants:{size:{xs:"[--vtl-dot-size:3px] [--vtl-dot-gap:3px]",sm:"[--vtl-dot-size:3.5px] [--vtl-dot-gap:3.5px]",default:"[--vtl-dot-size:4px] [--vtl-dot-gap:4px]",lg:"[--vtl-dot-size:5px] [--vtl-dot-gap:5px]",xl:"[--vtl-dot-size:6px] [--vtl-dot-gap:6px]"},tone:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary",inverse:"text-primary-foreground"},variant:{pulse:"vtl-dot-matrix-loader-pulse",wave:"vtl-dot-matrix-loader-wave",orbit:"vtl-dot-matrix-loader-orbit",binary:"vtl-dot-matrix-loader-binary"}},defaultVariants:{size:"default",tone:"default",variant:"pulse"}}),eU("animate-spin",{variants:{size:{xs:"size-3",sm:"size-3.5",default:"size-4",lg:"size-5",xl:"size-6"},variant:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary"}},defaultVariants:{size:"default",variant:"default"}});let Kb="max-w-[42.5rem]";function Kw({className:e,composerClassName:t,initialEvents:n,events:r,models:i,modelId:a,running:o,disabled:l,onEventsChange:s,onModelChange:c,onSubmit:d,onOpenFile:u,onOpenSubagent:f,onRetry:h}){let p=r??n??q1,[m,g]=ew.useState(p),v=ew.useRef(0),x=ew.useRef(p),y=ew.useRef([]),b=ew.useRef(null),[w,j]=ew.useState(168),k=ew.useId().replace(/[^a-zA-Z0-9_-]/g,""),S=r??m;function C(e){let t=e(x.current);x.current=t,void 0===r&&g(t),s?.(t)}function N(e,t){let n=window.setTimeout(t,e);y.current.push(n)}return ew.useLayoutEffect(()=>{let e=b.current;if(!e)return;function t(){j(Math.ceil(e.getBoundingClientRect().height))}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),ew.useEffect(()=>{x.current=S},[S]),ew.useEffect(()=>()=>{y.current.forEach(e=>window.clearTimeout(e)),y.current=[]},[]),(0,eb.jsxs)("section",{className:tK("vtl-agent-conversation-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-transparent",e),children:[(0,eb.jsx)(Ka,{events:S,bottomInset:w+16,contentClassName:tK(Kb,t),onOpenFile:u,onOpenSubagent:e=>f?.(e),onRetry:h,labels:{recall:"召回",branch:"分支",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"}}),(0,eb.jsx)("div",{ref:b,className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center px-4 pb-4",children:(0,eb.jsx)("div",{className:tK("vtl-agent-composer-dock pointer-events-auto relative w-full",Kb,t),children:(0,eb.jsx)(qK,{className:"relative z-10 w-full",submitOnEnter:!0,running:o,disabled:l,minRows:1,maxRows:8,modes:[{id:"agent",label:"Agent"},{id:"chat",label:"Chat"}],defaultModeId:"chat",models:i,modelId:a,onModelChange:e=>c?.(e),chips:[{id:"workspace",label:"Vantaloom-ui",tone:"success"},{id:"machine",label:"Studio-PC",tone:"muted"}],contextUsage:{used:139e3,total:258e3,toolCalls:52e3,userMessages:77e3,other:1e4},labels:{placeholder:"请问",mode:"模式",model:"模型",attach:"添加上下文",removeChip:"移除上下文",queuedMessage:"待发送消息",guideQueuedMessage:"引导",removeQueuedMessage:"移除待发送消息",moreQueuedMessageActions:"更多待发送消息操作",contextUsage:"上下文用量",contextUsed:"已用",contextTokenSummary:"已用 {used} / {total}",toolCalls:"工具调用",userMessages:"用户信息",otherContext:"系统/其他",compressContext:"压缩上下文",send:"发送",stop:"停止"},onSubmit:function(e){let t,n,r=e.value.trim();if(!r)return;if(d)return void d({value:r,modeId:e.modeId??"chat",modelId:e.modelId??a});v.current+=1;let i=`${k}-${v.current}`,o=`user-${i}`;C(e=>[...e,{id:o,kind:"user",title:r}]),t=q0(i),n=180,t.forEach(e=>{if("done"===e.kind){var t,r,i;let a,o,l=e.title;N(n,()=>{C(t=>[...t,{...e,title:"",isStreaming:!0,status:"running"}])}),t=e.id,r=l,i=n+120,a=Math.max(4,Math.ceil(r.length/36)),o=0,N(i,function e(){o=Math.min(r.length,o+a),C(e=>e.map(e=>e.id===t?{...e,title:r.slice(0,o),isStreaming:o<r.length,status:o<r.length?"running":"done"}:e)),o<r.length&&N(42,e)}),n+=Math.min(2200,Math.max(900,18*l.length))+260;return}N(n,()=>{C(t=>[...t,e])}),n+="thought"===e.kind?520:300})}})})})]})}let Kj=eN("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),Kk={title:"Explorer",search:"Search files...",newFile:"New file",newFolder:"New folder",refresh:"Refresh",collapseAll:"Collapse all",rename:"Rename",delete:"Delete",copyPath:"Copy path",open:"Open",empty:"No files yet.",noResults:"No matching files.",loading:"Loading..."};function KS(e){return"folder"===e.kind||!!e.children||!!e.hasChildren}function KC(e){return`${e.name} ${e.path}`.toLowerCase()}function KN(e,t){if(e&&t)return KM(e.children,t)}function KM(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?KM(n.children,t):void 0;if(e)return e}}function KE(e,t){return e?t.map(t=>KM(e.children,t)).filter(e=>!!e):[]}function KO(e,t){let n=e.includes("\\")?"\\":"/";return e.endsWith("\\")||e.endsWith("/")?`${e}${t}`:`${e}${n}${t}`}function KP(e,t,n){return e.map(e=>e.id===t?n(e):e.children?{...e,children:KP(e.children,t,n)}:e)}function KA(e,t){return e.filter(e=>!t.has(e.id)).map(e=>({...e,children:e.children?KA(e.children,t):void 0}))}function Kz(e,t){return e.some(e=>e.id===t||!!(e.children&&Kz(e.children,t)))}function KI(e,t){let n=KO(t,e.name);return{...e,path:n,children:e.children?.map(e=>KI(e,n))}}function K_(e,t,n){let[r,i]=ew.useState(t??n);return[e??r,i]}function KD({roots:e,defaultRoots:t,activeRootId:n,defaultActiveRootId:r,activeNodeId:i,defaultActiveNodeId:a,selectedIds:o,defaultSelectedIds:l,expandedIds:s,defaultExpandedIds:c,searchValue:d,defaultSearchValue:u,loadingIds:f,labels:h,allowMultiSelect:p=!0,allowCreateFile:m=!0,allowCreateFolder:g=!0,allowRename:v=!0,allowDelete:x=!0,allowDragAndDrop:y=!0,allowBoxSelect:b=!0,openFilesOnSingleClick:w=!0,showSearch:j=!0,showToolbar:k=!0,compact:S=!1,onActiveRootChange:C,onActiveNodeChange:N,onSelectionChange:M,onExpandedChange:E,onSearchValueChange:O,onOpenNode:P,onLoadChildren:A,onCreateNode:z,onRenameNode:I,onDeleteNodes:_,onMoveNodes:D,onCopyPath:T,onRefresh:R,className:L,sidebarClassName:$,style:F}){let V={...Kk,...h},B=ew.useRef(null),H=ew.useRef(void 0),W=ew.useRef([]),[U,q]=ew.useState(()=>(t??[]).map(e=>({...e,children:function e(t){return t.map(t=>({...t,children:t.children?e(t.children):void 0}))}(e.children)}))),K=e??U,G=K[0]?.id,[Y,X]=ew.useState(r??G),Z=n??Y??G,J=K.find(e=>e.id===Z)??K[0],[Q,ee]=ew.useState(a),et=i??Q,[en,er]=K_(o,l,a?[a]:[]),[ei,ea]=K_(s,c,G?[G]:[]),[eo,el]=ew.useState(u??""),es=d??eo,[ec,ed]=ew.useState(),[eu,ef]=ew.useState(""),[eh,ep]=ew.useState([]),[em,eg]=ew.useState(),[ev,ex]=ew.useState(),ey=ew.useRef(0),ej=ew.useMemo(()=>new Set(f),[f]),ek=ew.useMemo(()=>new Set(ei),[ei]),eS=ew.useMemo(()=>new Set(en),[en]),eC=KN(J,et),eN=es.trim().length>0;function eM(t){e||q(e=>t(e))}function eE(e){void 0===s&&ea(e),E?.(e)}function eO(e){void 0===o&&er(e),M?.({root:J,node:e.at(-1)?KN(J,e.at(-1)):void 0,nodes:KE(J,e)})}function eP(e){void 0===i&&ee(e?.id),N?.(e)}async function eA(e){if(KS(e)&&J){if(ek.has(e.id))return void eE(ei.filter(t=>t!==e.id));if(A&&e.hasChildren&&!e.children){let t=await A(e,J);eM(n=>n.map(n=>n.id===J.id?{...n,children:KP(n.children,e.id,e=>({...e,children:t}))}:n))}eE([...ei,e.id])}}function ez(e){var t;t=e.id,void 0===n&&X(t),C?.(t),ek.has(e.id)?eE(ei.filter(t=>t!==e.id)):eE([...ei,e.id])}function eI(e,t){if(e.disabled)return;let n=p&&(t?.metaKey||t?.ctrlKey)?eS.has(e.id)?en.filter(t=>t!==e.id):[...en,e.id]:[e.id];eP(e),eO(n)}function e_(e){J&&!e.disabled&&P?.(e,J)}function eD(e){if(!J)return;let t=eC&&KS(eC)?eC:J,n="folder"===e?"untitled-folder":"untitled.ts";ey.current+=1;let r={id:`created-${ey.current}`,name:n,path:KO(t.path,n),kind:"folder"===e?"folder":"code",children:"folder"===e?[]:void 0};z?.(t,e,n),eM(e=>e.map(e=>{var n,i;return e.id!==J.id?e:"children"in t&&"platform"in t?{...e,children:[r,...e.children]}:{...e,children:(n=e.children,i=t.id,KP(n,i,e=>({...e,children:[r,...e.children??[]],hasChildren:!0})))}})),eE([...new Set([...ei,t.id])]),eP(r),eO([r.id]),ed(r.id),ef(r.name)}function eT(e){!v||e.disabled||e.readonly||(ed(e.id),ef(e.name))}function eR(e){let t=eu.trim();ed(void 0),t&&t!==e.name&&(I?.(e,t),eM(n=>n.map(n=>n.id===J?.id?{...n,children:KP(n.children,e.id,e=>{let n,r,i;return{...e,name:t,path:KO((r=(n=e.path.replace(/[\\/]+$/,"")).includes("\\")?"\\":"/",(i=n.lastIndexOf(r))<=0?n:n.slice(0,i)),t)}})}:n)))}function eL(e,t){if(!J||!y||e.disabled||ev)return void t.preventDefault();let n=eS.has(e.id)?en:[e.id];eS.has(e.id)||(eO([e.id]),eP(e)),ep(n),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n.join(","))}function e$(e,t){if(!y||0===eh.length)return;t.preventDefault(),t.dataTransfer.dropEffect="move";let n=t.currentTarget.getBoundingClientRect(),r=(t.clientY-n.top)/n.height,i=r<.3?"before":r>.7?"after":KS(e)?"inside":"after";eg({targetId:e.id,position:i})}function eF(e,t){t.preventDefault(),em?.targetId===e.id&&function(e,t){let n;if(!J||0===eh.length||!y)return;let r=(n=new Set(eh),KE(J,eh).filter(e=>!Array.from(n).some(t=>{var n,r;let i;return t!==e.id&&(n=J.children,r=e.id,i=KM(n,t),!!(i?.children&&Kz(i.children,r)))})));if(0===r.length||r.some(t=>t.id===e.id||!!(t.children&&Kz(t.children,e.id))))return;let i=new Set(r.map(e=>e.id)),a="inside"!==t||KS(e)?t:"after";D?.({root:J,nodes:r,target:e,position:a}),eM(t=>t.map(t=>{if(t.id!==J.id)return t;let n=function e(t,n,r,i,a){let o=!1,l=[];for(let s of t){if(s.id===n){if("before"===r){l.push(...i.map(e=>KI(e,a))),l.push(s),o=!0;continue}if("after"===r){l.push(s),l.push(...i.map(e=>KI(e,a))),o=!0;continue}if("inside"===r){l.push({...s,children:[...i.map(e=>KI(e,s.path)),...s.children??[]],hasChildren:!0}),o=!0;continue}}if(s.children){let t=e(s.children,n,r,i,s.path);l.push({...s,children:t.nodes}),o=o||t.inserted}else l.push(s)}return{nodes:l,inserted:o}}(KA(t.children,i),e.id,a,r,t.path);return{...t,children:n.inserted?n.nodes:t.children}})),"inside"===a&&eE([...new Set([...ei,e.id])]),eO(r.map(e=>e.id)),eP(r[0])}(e,em.position),eg(void 0),ep([])}function eV(e){let t=B.current;if(!t||!J)return;let n=Math.min(e.startX,e.currentX),r=Math.max(e.startX,e.currentX),i=Math.min(e.startY,e.currentY),a=Math.max(e.startY,e.currentY),o=Array.from(t.querySelectorAll("[data-file-tree-node-id]")).filter(e=>{let t=e.getBoundingClientRect();return t.left<r&&t.right>n&&t.top<a&&t.bottom>i}).map(e=>e.dataset.fileTreeNodeId).filter(e=>!!e);if(o.length>0){eO(Array.from(new Set([...W.current,...o])));let e=KN(J,o.at(-1));e&&eP(e)}}return ew.useEffect(()=>{n||Y||!G||X(G)},[n,G,Y]),(0,eb.jsxs)("div",{ref:B,"data-slot":"file-tree-panel",className:tK("vtl-surface-panel relative flex min-h-[28rem] w-full max-w-sm flex-col overflow-hidden rounded-[var(--surface-panel-radius)] border",L),style:F,onPointerDown:function(e){let t=e.target;if(!b||!p||!e.ctrlKey||0!==e.button||t.closest("input, textarea, [data-file-tree-ignore-box]"))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();H.current=e.pointerId,W.current=en,e.currentTarget.setPointerCapture(e.pointerId),ex({startX:e.clientX,startY:e.clientY,currentX:e.clientX,currentY:e.clientY,panelLeft:n.left,panelTop:n.top})},onPointerMove:function(e){if(!ev||H.current!==e.pointerId)return;e.preventDefault();let t={...ev,currentX:e.clientX,currentY:e.clientY};ex(t),eV(t)},onPointerUp:function(e){ev&&H.current===e.pointerId&&(eV(ev),ex(void 0),W.current=[],H.current=void 0)},onPointerCancel:()=>{ex(void 0),W.current=[],H.current=void 0},children:[k&&(0,eb.jsxs)("div",{"data-file-tree-ignore-box":!0,className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[(0,eb.jsx)("div",{className:"mr-auto min-w-0 truncate px-1 text-sm font-medium",children:V.title}),m&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFile,onClick:()=>eD("file"),children:(0,eb.jsx)(s7,{})}),g&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFolder,onClick:()=>eD("folder"),children:(0,eb.jsx)(vx,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.refresh,onClick:()=>J&&R?.(J),children:(0,eb.jsx)(vS,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.collapseAll,onClick:function(){eE(J?[J.id]:[])},children:(0,eb.jsx)(p6,{})})]}),j&&(0,eb.jsx)("div",{"data-file-tree-ignore-box":!0,className:"shrink-0 border-b p-2",children:(0,eb.jsxs)(yE,{className:"h-7 rounded-md",children:[(0,eb.jsx)(yP,{align:"inline-start",className:"pl-2",children:(0,eb.jsx)(cz,{className:"size-3.5"})}),(0,eb.jsx)(yA,{value:es,onChange:e=>{var t;return t=e.target.value,void(void 0===d&&el(t),O?.(t))},placeholder:V.search,className:"h-7 text-xs"})]})}),(0,eb.jsx)(f1,{className:tK("min-h-0 flex-1",$),"data-slot":"file-tree-panel-scroll",children:(0,eb.jsxs)("div",{className:tK("py-1",S&&"py-0.5"),children:[0===K.length&&(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:V.empty}),K.map(e=>(0,eb.jsx)(KT,{root:e,activeRoot:J,labels:V,expandedSet:ek,selectedSet:eS,activeNodeId:et,searchValue:es,loadingSet:ej,compact:S,renamingId:ec,renamingName:eu,allowRename:v,allowDelete:x,allowDragAndDrop:y,openFilesOnSingleClick:w,draggingIds:eh,dropTarget:em,hasSearch:eN,onRootToggle:ez,onNodeToggle:e=>void eA(e),onNodeSelect:eI,onNodeOpen:e_,onStartRename:eT,onRenamingNameChange:ef,onCommitRename:eR,onCancelRename:()=>ed(void 0),onDelete:e=>(function(e){if(!x||0===e.length||!J)return;_?.(e);let t=new Set(e.map(e=>e.id));eM(e=>e.map(e=>e.id===J.id?{...e,children:KA(e.children,t)}:e)),eO(en.filter(e=>!t.has(e))),et&&t.has(et)&&eP(void 0)})(function(e){if(eS.has(e.id)){let t=KE(J,en);return t.length>0?t:[e]}return[e]}(e)),onCopyPath:e=>T?.(e),onDragStart:eL,onDragOver:e$,onDragEnd:()=>{ep([]),eg(void 0)},onDrop:eF},e.id))]})}),ev&&(0,eb.jsx)(KF,{box:ev})]})}function KT({root:e,activeRoot:t,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:o,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onRootToggle:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=r.has(e.id),I=o.trim().toLowerCase(),_=v?e.children.filter(e=>KH(e,I)):e.children;return(0,eb.jsxs)("section",{"data-slot":"file-tree-root",className:"min-w-0",children:[(0,eb.jsxs)("button",{type:"button",className:tK("group flex h-7 w-full items-center gap-1 px-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",t?.id===e.id&&"text-foreground"),onClick:()=>x(e),children:[(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:z?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(va,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(vv,{})}),(0,eb.jsx)("span",{className:"truncate uppercase tracking-wide",children:e.name})]}),(z||v)&&(0,eb.jsxs)("div",{children:[l.has(e.id)&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:n.loading}),!l.has(e.id)&&0===_.length&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:v?n.noResults:n.empty}),_.map(t=>(0,eb.jsx)(KR,{node:t,root:e,depth:0,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:I,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},t.id))]})]})}function KR({node:e,root:t,depth:n,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=KS(e),I=i.has(e.id),_=a.has(e.id),D=o===e.id,T=d===e.id,R=s.has(e.id),L=g.includes(e.id),$=v?.targetId===e.id&&"inside"!==v.position,F=v?.targetId===e.id&&"inside"===v.position,V=e.children??[],B=x?V.filter(e=>KH(e,l)):V,H=!x||KC(e).includes(l),W=(I||x)&&B.length>0,U=8+14*n;if(x&&!H&&0===B.length)return null;let q=(0,eb.jsxs)("div",{"data-slot":"file-tree-row","data-file-tree-node-id":e.id,"data-active":D?"true":void 0,"data-selected":_?"true":void 0,draggable:p&&!T&&!e.disabled,className:tK("group/tree-row relative flex w-full items-center gap-1 pr-1 text-left text-xs transition-colors",c?"h-6":"h-7",_||D?"bg-muted text-foreground":"text-foreground hover:bg-muted/60",F&&"bg-primary/10 ring-1 ring-inset ring-primary/35",L&&"opacity-45",e.disabled&&"pointer-events-none opacity-50"),style:{paddingLeft:U},onDragStart:t=>E(e,t),onDragOver:t=>O(e,t),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.dataset.dragLeave="true")},onDragEnd:P,onDrop:t=>A(e,t),onDoubleClick:()=>w(e),onKeyDown:t=>{"Enter"===t.key&&w(e),"F2"===t.key&&(t.preventDefault(),j(e)),("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),N(e)),"ArrowRight"===t.key&&z&&!I&&(t.preventDefault(),y(e)),"ArrowLeft"===t.key&&z&&I&&(t.preventDefault(),y(e))},children:[(0,eb.jsx)(KL,{depth:n}),$&&(0,eb.jsx)(K$,{position:v.position,depth:n}),e.recentlyModified&&(0,eb.jsx)("span",{className:"absolute top-1/2 left-1 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary"}),(0,eb.jsx)("button",{type:"button",tabIndex:-1,className:"flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground",onClick:t=>{t.stopPropagation(),y(e)},"aria-label":I?"Collapse":"Expand",children:z?I?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(va,{className:"size-3.5"}):null}),(0,eb.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:t=>{b(e,t),!z||t.metaKey||t.ctrlKey?!z&&m&&w(e):y(e)},children:[(0,eb.jsx)(KB,{node:e,open:I}),T?(0,eb.jsx)("input",{value:u,onChange:e=>k(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),S(e)),"Escape"===t.key&&(t.preventDefault(),C())},onBlur:()=>S(e),autoFocus:!0,className:"h-5 min-w-0 flex-1 rounded-sm border border-ring bg-background px-1 text-xs outline-none"}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.badge&&(0,eb.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.badge}),e.meta&&(0,eb.jsx)("span",{className:"hidden shrink-0 text-muted-foreground group-hover/tree-row:inline sm:inline",children:e.meta})]})]}),!T&&(0,eb.jsx)(KV,{node:e,root:t,labels:r,allowRename:f,allowDelete:h,onOpen:w,onRename:j,onDelete:N,onCopyPath:M}),R&&(0,eb.jsx)("span",{className:"absolute inset-y-0 right-8 flex items-center text-[10px] text-muted-foreground",children:r.loading})]});return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(x1,{children:[(0,eb.jsx)(x5,{asChild:!0,children:q}),(0,eb.jsxs)(yt,{className:"w-40",children:[(0,eb.jsxs)(yn,{onSelect:()=>w(e),children:[(0,eb.jsx)(vf,{}),r.open]}),(0,eb.jsxs)(yn,{onSelect:()=>M(e),children:[(0,eb.jsx)(s0,{}),r.copyPath]}),f&&!e.readonly&&(0,eb.jsxs)(yn,{onSelect:()=>j(e),children:[(0,eb.jsx)(mF,{}),r.rename]}),h&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yr,{}),(0,eb.jsxs)(yn,{variant:"destructive",onSelect:()=>N(e),children:[(0,eb.jsx)(m0,{}),r.delete]})]})]})]}),I&&z&&R&&(0,eb.jsx)("div",{className:"py-1 text-xs text-muted-foreground",style:{paddingLeft:U+40},children:r.loading}),W&&B.map(e=>(0,eb.jsx)(KR,{node:e,root:t,depth:n+1,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},e.id))]})}function KL({depth:e}){return e<=0?null:(0,eb.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0",children:Array.from({length:e}).map((e,t)=>(0,eb.jsx)("span",{className:"absolute inset-y-0 w-px bg-border/80 dark:bg-border/70",style:{left:17+14*t}},t))})}function K$({position:e,depth:t}){return(0,eb.jsxs)("span",{"aria-hidden":"true",className:tK("pointer-events-none absolute right-2 z-10 flex h-3 items-center text-primary","before"===e?"top-[-6px]":"bottom-[-6px]"),style:{left:28+14*t},children:[(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:">"}),(0,eb.jsx)("span",{className:"mx-0.5 h-px flex-1 bg-primary"}),(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:"<"})]})}function KF({box:e}){let t=Math.min(e.startX,e.currentX)-e.panelLeft,n=Math.min(e.startY,e.currentY)-e.panelTop,r=Math.abs(e.currentX-e.startX),i=Math.abs(e.currentY-e.startY);return(0,eb.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-50 rounded-sm border border-primary bg-primary/10 shadow-sm",style:{left:t,top:n,width:r,height:i}})}function KV({node:e,labels:t,allowRename:n,allowDelete:r,onOpen:i,onRename:a,onDelete:o,onCopyPath:l}){return(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button","data-file-tree-ignore-box":!0,variant:"ghost",size:"icon-xs",className:"size-6 opacity-0 group-hover/tree-row:opacity-100 data-[state=open]:opacity-100",onClick:e=>e.stopPropagation(),"aria-label":"More actions",children:(0,eb.jsx)(s6,{})})}),(0,eb.jsxs)(yj,{align:"end",className:"w-40",children:[(0,eb.jsxs)(yk,{onSelect:()=>i(e),children:[(0,eb.jsx)(vf,{}),t.open]}),(0,eb.jsxs)(yk,{onSelect:()=>l(e),children:[(0,eb.jsx)(s0,{}),t.copyPath]}),n&&!e.readonly&&(0,eb.jsxs)(yk,{onSelect:()=>a(e),children:[(0,eb.jsx)(mF,{}),t.rename]}),r&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yN,{}),(0,eb.jsxs)(yk,{variant:"destructive",onSelect:()=>o(e),children:[(0,eb.jsx)(m0,{}),t.delete]})]})]})]})}function KB({node:e,open:t}){let n=e.icon??function(e,t){if(KS(e))return t?(0,eb.jsx)(vv,{}):(0,eb.jsx)(vg,{});let n=e.name.toLowerCase();return"image"===e.kind||/\.(png|jpg|jpeg|gif|webp|svg|avif)$/.test(n)?(0,eb.jsx)(vh,{}):"archive"===e.kind||/\.(zip|rar|7z|tar|gz)$/.test(n)?(0,eb.jsx)(vc,{}):"code"===e.kind||/\.(ts|tsx|js|jsx|json|css|scss|html|py|rs|go|mdx)$/.test(n)?(0,eb.jsx)(vl,{}):"text"===e.kind||/\.(md|txt|log|yaml|yml)$/.test(n)?(0,eb.jsx)(vp,{}):(0,eb.jsx)(vf,{})}(e,t);return(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-3.5",children:n})}function KH(e,t){return!!(!t||KC(e).includes(t))||!!e.children?.some(e=>KH(e,t))}function KW(e){let t=e.trim(),n=/^vantaloom:\/\/([^/]+)\/(.+)$/i.exec(t);return n?{machineId:n[1]||"local",path:decodeURIComponent(n[2]||"").replace(/\//g,"/")}:{machineId:"local",path:t}}function KU(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function Kq(e){let t=e.map(KW).filter(e=>e.path);return await Promise.all(t.map(async(e,t)=>{let n,r,i=await bu(e.machineId,e.path);return{id:`agent-root-${e.machineId}-${t}-${i.path}`,machineId:e.machineId,name:(n=i.path.replace(/[\\/]+$/,""),r=/([^\\/]+)$/.exec(n),r?.[1]??(n||"workspace")),path:i.path,platform:i.machine.platform,children:KU(i.items)}}))}async function KK(e,t){let n=t.machineId||"local";return KU((await bu(n,e.path)).items)}function KG({folders:e,className:t,onOpenFile:n}){let[r,i]=ew.useState([]),[a,o]=ew.useState(!1),[l,s]=ew.useState(0),c=e.join("\0"),d=ew.useCallback(async()=>{o(!0);try{i(await Kq(e)),s(e=>e+1)}catch{i([]),s(e=>e+1)}finally{o(!1)}},[e]);return ew.useEffect(()=>{d()},[c,d]),ew.useEffect(()=>{function e(){d()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[d]),(0,eb.jsx)(KD,{className:t,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:r,defaultExpandedIds:r.map(e=>e.id),loadingIds:a?r.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:0===e.length?"未配置可访问文件夹":"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:KK,onOpenNode:(e,t)=>{"folder"!==e.kind&&n?.({machineId:t.machineId||"local",path:e.path})},onRefresh:()=>{d()}},l)}function KY({open:e,folders:t,onOpenChange:n,onSelectFile:r}){return(0,eb.jsx)(po,{open:e,onOpenChange:n,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"从当前 Agent 可访问的文件夹中选择文件。"}),(0,eb.jsx)(KG,{folders:t,className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{r(e),n(!1)}})]})})}function KX({className:e,onChooseFile:t}){return(0,eb.jsx)("div",{className:tK("grid size-full place-items-center rounded-[inherit] bg-background p-6",e),children:(0,eb.jsxs)("div",{className:"grid justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-muted/35 text-muted-foreground",children:(0,eb.jsx)(vv,{className:"size-4"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",variant:"outline",onClick:t,children:[(0,eb.jsx)(Kj,{className:"size-4"}),"选择文件"]})]})})}let KZ=eN("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),KJ=eN("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),KQ=eN("panel-bottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]),K0=eN("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),K1=eN("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),K2=eN("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),K5=eN("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),K4=eN("tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),K3=[{id:"phone",label:"Phone",width:390,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"tablet",label:"Tablet",width:820,userAgent:"Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"desktop",label:"Desktop",width:1200,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"}],K6=[{id:"adaptive",label:"自适应",adaptive:!0},{id:"16:9",label:"16:9",value:16/9},{id:"4:3",label:"4:3",value:4/3},{id:"3:2",label:"3:2",value:1.5},{id:"1:1",label:"1:1",value:1},{id:"9:16",label:"9:16",value:9/16}],K8={urlLabel:"URL",urlPlaceholder:"https://example.com",navigate:"Navigate",actions:"Browser view options",devices:"User agent",ratios:"Viewport ratio",back:"Back",forward:"Forward",reload:"Reload preview",previewTitle:"Browser preview"};function K7(e,t,n){return e.find(e=>e.id===t)??n}function K9({id:e}){return"phone"===e?(0,eb.jsx)(K5,{className:"size-4"}):"tablet"===e?(0,eb.jsx)(K4,{className:"size-4"}):(0,eb.jsx)(Fq,{className:"size-4"})}function Ge({url:e,defaultUrl:t="https://vantaloom.local/workspace",onUrlChange:n,onNavigate:r,onBack:i,onForward:a,device:o,defaultDevice:l="desktop",onDeviceChange:s,ratio:c,defaultRatio:d="adaptive",onRatioChange:u,devices:f=K3,ratios:h=K6,srcDoc:p,renderPreview:m,showHeader:g=!0,labels:v,className:x,headerClassName:y,previewClassName:b,...w}){let j=ew.useMemo(()=>({...K8,...v}),[v]),[k,S]=ew.useState(t),[C,N]=ew.useState(e??t),[M,E]=ew.useState(()=>[e??t]),[O,P]=ew.useState(0),[A,z]=ew.useState(l),[I,_]=ew.useState(d),[D,T]=ew.useState(!1),[R,L]=ew.useState(0),$=ew.useRef(null),F=ew.useId(),[V,B]=function(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(e){t&&n(e??{width:t.clientWidth,height:t.clientHeight})}r();let i=new ResizeObserver(e=>{let t=e[0];t?r({width:t.contentRect.width,height:t.contentRect.height}):r()});return i.observe(t),()=>i.disconnect()},[]),[e,t]}(),H=e??k,W=K7(f,o??A,f[0]??K3[0]),U=K7(h,c??I,h[0]??K6[0]),q=B.width>0&&B.height>0,K=U.adaptive||"adaptive"===U.id,G=U.value??16/9,Y=K&&B.width||W.width,X=K?B.height||W.width/G:Y/G,Z=(q?B.width/B.height:1)<=G,J=Math.max(1,Math.round(q?K||Z?B.width:B.height*G:Y)),Q=Math.max(1,Math.round(q?K?B.height:Z?B.width/G:B.height:X)),ee=J/Y,et=ew.useMemo(()=>({url:H,device:W,ratio:U,viewport:{width:J,height:Q,scale:ee}}),[W,U,H,ee,Q,J]);function en(t,i={history:"push"}){void 0===e&&S(t),"none"!==i.history&&E(e=>{let n=e.slice(0,O+1);return n[n.length-1]===t?n:(P(n.length),[...n,t])}),n?.(t),r?.(t)}return ew.useEffect(()=>{N(e??k)},[k,e]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||T(!1)}},[D]),(0,eb.jsxs)("div",{ref:$,"data-slot":"browser-tab-viewer","data-device":W.id,"data-ratio":U.id,className:tK("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",g?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",x),...w,children:[g&&(0,eb.jsxs)("div",{"data-slot":"browser-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",y),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(K2,{className:"size-3.5"})}),(0,eb.jsxs)("form",{onSubmit:function(e){let t;e.preventDefault();let n=(t=C.trim())?/^[a-z][a-z\d+\-.]*:\/\//i.test(t)?t:/^(localhost|127\.0\.0\.1|\[::1\])(?::\d+)?(?:\/|$)/i.test(t)?`http://${t}`:`https://${t}`:"";N(n),en(n)},className:"min-w-0 flex-1",children:[(0,eb.jsx)("label",{className:"sr-only",htmlFor:F,children:j.urlLabel}),(0,eb.jsx)(ny,{id:F,value:C,onChange:e=>N(e.target.value),placeholder:j.urlPlaceholder,className:"h-5 rounded-md border bg-background px-2 shadow-none ui-text-kbd",spellCheck:!1})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.back,disabled:O<=0,onClick:function(){if(O<=0)return;let e=O-1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),i?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(K1,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.forward,disabled:O>=M.length-1,onClick:function(){if(O>=M.length-1)return;let e=O+1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),a?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(eM,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.reload,onClick:()=>L(e=>e+1),className:"size-5 rounded-md",children:(0,eb.jsx)(vS,{className:"size-3.5"})})]}),(0,eb.jsx)("div",{ref:V,"data-slot":"browser-tab-viewer-stage",className:tK("grid min-h-0 place-items-center overflow-hidden bg-muted/20",b),children:(0,eb.jsx)("div",{"data-slot":"browser-tab-viewer-viewport",className:"overflow-hidden rounded-lg border bg-background shadow-sm",style:{width:J,height:Q},children:m?m(et):(0,eb.jsx)("iframe",{title:j.previewTitle,src:p?void 0:H,srcDoc:p,sandbox:"allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"size-full border-0 bg-background"},`${R}-${H}-${W.id}-${U.id}`)})}),(0,eb.jsxs)("div",{"data-slot":"browser-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:[(0,eb.jsxs)("div",{className:tK("vtl-surface-popover absolute right-0 bottom-10 grid w-56 gap-3 rounded-[var(--surface-popover-radius)] border p-3 transition-[opacity,transform] duration-150",D?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:[(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.devices}),(0,eb.jsx)("div",{className:"flex gap-1.5",children:f.map(e=>(0,eb.jsx)(tY,{type:"button",variant:W.id===e.id?"default":"outline",size:"icon-sm","aria-label":e.label,title:e.label,className:"rounded-full",onClick:()=>{let t;return t=K7(f,e.id,W),void(void 0===o&&z(t.id),s?.(t.id,t))},children:(0,eb.jsx)(K9,{id:e.id})},e.id))})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.ratios}),(0,eb.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,eb.jsx)(tY,{type:"button",variant:U.id===e.id?"default":"outline",size:"xs",className:"h-7 rounded-full px-2.5 ui-text-kbd",onClick:()=>{let t;return t=K7(h,e.id,U),void(void 0===c&&_(t.id),u?.(t.id,t))},children:e.label},e.id))})]})]}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":j.actions,"aria-expanded":D,onClick:()=>T(e=>!e),className:"rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",D&&"rotate-90")})})]})]})}function Gt(e,t){return"function"==typeof e?e(t):e}function Gn(e,t){return n=>{t.setState(t=>({...t,[e]:Gt(n,t[e])}))}}function Gr(e){return e instanceof Function}function Gi(e,t,n){let r,i=[];return a=>{let o,l;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==i.length||s.some((e,t)=>i[t]!==e)))return r;if(i=s,n.key&&n.debug&&(l=Date.now()),r=t(...s),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
23
23
  font-size: .6rem;
@@ -46,4 +46,4 @@ ${e.detail}`:e.title,isStreaming:e.isStreaming})})}):("read"===e.kind||"search"=
46
46
  border-radius: 9999px;
47
47
  background-clip: content-box;
48
48
  }
49
- </style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,eb.jsx)("iframe",{title:e,sandbox:"allow-scripts",srcDoc:i,className:tK("size-full border-0 bg-background",n)})}function Je({file:e,value:t,labels:n}){let r=ew.useMemo(()=>{let n=e.bytes??(t?new TextEncoder().encode(t):[]),r=Math.min(n.length,4096),i=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);i.push({offset:e.toString(16).padStart(8,"0"),hex:t.map(e=>e.toString(16).padStart(2,"0")).join(" "),ascii:t.map(e=>e>=32&&e<=126?String.fromCharCode(e):".").join("")})}return i},[e.bytes,t]);return 0===r.length?(0,eb.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:n.noContent}):(0,eb.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,eb.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,eb.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,eb.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function Jt({file:e,labels:t,onApprove:n}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,eb.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,eb.jsx)(ZG,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("h3",{className:"ui-text-body font-medium text-foreground",children:t.binaryTitle}),(0,eb.jsx)("p",{className:"ui-text-body text-muted-foreground",children:t.binaryDescription})]}),(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[Z5(e.size)&&(0,eb.jsx)(c_,{variant:"outline",children:Z5(e.size)}),(0,eb.jsx)(tY,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function Jn({labels:e}){return(0,eb.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:e.unsupportedPreview})}function Jr({file:e,value:t,labels:n,renderPreview:r,className:i}){let a=Z1(e),o=e.src?e.src:t&&"svg"===Z1(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,eb.jsx)("div",{"data-slot":"file-tab-custom-preview",className:tK("size-full",i),children:l}):"html"===a||"richtext"===a?(0,eb.jsx)(Z9,{title:e.name,value:e.previewContent??t,className:i}):"markdown"===a?(0,eb.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:tK("size-full overflow-auto bg-background",i),children:(0,eb.jsx)(Z7,{value:t})}):"svg"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-svg-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-image-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-video-preview",className:tK("grid size-full place-items-center bg-muted/20 p-6",i),children:(0,eb.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,eb.jsx)(Jn,{labels:n})}function Ji({open:e,labels:t,currentView:n,currentMode:r,saving:i,modified:a,canSwitchView:o,canSwitchMode:l,canSave:s,canOpenHistory:c,onOpenChange:d,onToggleView:u,onToggleMode:f,onSave:h,onHistory:p}){let m=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:u,icon:"code"===n?(0,eb.jsx)(K0,{className:"size-4"}):(0,eb.jsx)(vl,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:f,icon:"review"===r?(0,eb.jsx)(ZY,{className:"size-4"}):(0,eb.jsx)(eE,{className:"size-4"})}:void 0,s?{key:"save",label:i?t.saving:t.save,onClick:h,disabled:i||!a,icon:(0,eb.jsx)(ZJ,{className:"size-4"})}:void 0,c?{key:"history",label:t.history,onClick:p,icon:(0,eb.jsx)(B3,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===m.length?null:(0,eb.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[m.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.disabled&&"opacity-45"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>d(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function Ja({file:e,value:t,defaultValue:n,onValueChange:r,mode:i,defaultMode:a="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:d=!1,onSave:u,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,onHistory:v,labels:x,className:y,editorClassName:b,previewClassName:w,headerClassName:j,...k}){var S;let C,N,M=ew.useMemo(()=>({...ZQ,...x}),[x]),[E,O]=ew.useState(n??e.content??""),[P,A]=ew.useState(a),[z,I]=ew.useState(s),[_,D]=ew.useState(!1),[T,R]=ew.useState(!1),[L,$]=ew.useState(!1),F=ew.useRef(null),V=t??E,B=i??P,H=(S=l??z,(C=Z4(e)).includes(S)?S:C[0]),W=Z1(e),U=Z4(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(Z1(e)),K=!!u&&q&&"code"===H&&(d||L),G="review"===B||!0===e.readOnly,Y="binary"===(N=Z1(e))||"image"!==N&&"video"!==N&&!!(e.size&&e.size>h&&!e.content),X=(e.path??e.name).split(/[\\/]+/).filter(Boolean),Z=Z5(e.size??V.length);async function J(){if(u&&!L){$(!0);try{await u(V),R(!1)}catch(e){f?.(e)}finally{$(!1)}}}return ew.useEffect(()=>{void 0===t&&O(n??e.content??""),D(!1),R(!1)},[n,e,t]),ew.useEffect(()=>{if(T)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&F.current?.contains(t)||R(!1)}},[T]),(0,eb.jsxs)("div",{ref:F,"data-slot":"file-tab-viewer","data-mode":B,"data-view":H,className:tK("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",p?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",y),...k,children:[p&&(0,eb.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",j),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===W?(0,eb.jsx)(ZX,{className:"size-3.5"}):"video"===W?(0,eb.jsx)(ZZ,{className:"size-3.5"}):"binary"===W?(0,eb.jsx)(ZG,{className:"size-3.5"}):(0,eb.jsx)(vf,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:X.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:M.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===X.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[Z&&(0,eb.jsx)(c_,{variant:"outline",children:Z}),q&&"code"===H&&(G?(0,eb.jsxs)(c_,{variant:"secondary",children:[(0,eb.jsx)(s5,{className:"size-3"}),M.review]}):(0,eb.jsxs)(c_,{variant:"outline",children:[(0,eb.jsx)(ZY,{className:"size-3"}),M.edit]}))]})]}),(0,eb.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:Y&&!_?(0,eb.jsx)(Jt,{file:e,labels:M,onApprove:()=>D(!0)}):"preview"===H?(0,eb.jsx)(Jr,{file:e,value:V,labels:M,renderPreview:g,className:w}):"hex"===H?(0,eb.jsx)(Je,{file:e,value:V,labels:M}):(0,eb.jsx)(Z8,{file:e,value:V,readOnly:G,onValueChange:function(e){void 0===t&&O(e),r?.(e)},wrapLines:m,className:b})}),(0,eb.jsx)(Ji,{open:T,labels:M,currentView:H,currentMode:B,saving:L,modified:d,canSwitchView:U,canSwitchMode:q&&"code"===H,canSave:K,canOpenHistory:!!(v&&e.path),onOpenChange:R,onToggleView:function(){var e;e="code"===H?"preview":"code",void 0===l&&I(e),c?.(e)},onToggleMode:function(){var e;e="review"===B?"edit":"review",void 0===i&&A(e),o?.(e)},onSave:J,onHistory:()=>{R(!1),v?.(e)}})]})}function Jo(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function Jl(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function Js(e,t,n){let r=[...e],i=r[t],a=r[n];return i&&a&&(r[t]=a,r[n]=i),r}function Jc({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:i,onTabsChange:a,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:d,createActions:u=[],tabActions:f=[],reorderable:h=!0,detachable:p=!1,externalDropTypes:m=[],createLabel:g="New tab",moreLabel:v="More tab actions",closeLabel:x="Close tab",scrollLeftLabel:y="Scroll tabs left",scrollRightLabel:b="Scroll tabs right",tabListLabel:w="Open tabs",emptyContent:j,renderContent:k,showContent:S=!0,className:C,tabListClassName:N,contentClassName:M}){let[E,O]=ew.useState(t),P=ew.useRef(null),A=ew.useRef(null),[z,I]=ew.useState(),[_,D]=ew.useState(void 0),T=ew.useRef(void 0),[R,L]=ew.useState(void 0),[$,F]=ew.useState(!1),V=ew.useRef(void 0),B=ew.useRef(void 0),H=ew.useRef(!1),[W,U]=ew.useState(!1),[q,K]=ew.useState(!1),[G,Y]=ew.useState(),X=e??E,Z=X.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=X.find(e=>e.id===ee&&!e.disabled)??Z;ew.useEffect(()=>{!et&&Z&&void 0===n&&Q(Z.id)},[et,n,Z]);let en=ew.useCallback(t=>{void 0===e&&O(t),a?.(t)},[a,e]),er=ew.useCallback(e=>{T.current=e,D(e)},[]),ei=ew.useCallback(()=>{let e=A.current,t=new Map;if(!e)return t;for(let n of e.querySelectorAll("[data-tab-id]")){let e=n.getBoundingClientRect(),r=n.dataset.tabId;r&&t.set(r,{left:e.left,top:e.top})}return t},[]),ea=ew.useCallback((e,t=!0)=>{t&&(B.current=ei()),V.current=e,L(e)},[ei]),eo=ew.useCallback(()=>{let e=A.current;if(!e){U(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;U(e.scrollLeft>1),K(e.scrollLeft<t-1)},[]);function el(e){let t=A.current;if(!t)return;let n=Math.max(.7*t.clientWidth,160);t.scrollLeft+="left"===e?-n:n,window.requestAnimationFrame(eo)}ew.useEffect(()=>{F(!0)},[]),ew.useEffect(()=>{eo();let e=A.current;if(!e)return;let t=new ResizeObserver(eo);return t.observe(e),window.addEventListener("resize",eo),()=>{t.disconnect(),window.removeEventListener("resize",eo)}},[X.length,eo]),ew.useLayoutEffect(()=>{let e=B.current,t=A.current;if(e&&t)for(let n of(B.current=void 0,t.querySelectorAll("[data-tab-id]"))){let t=n.dataset.tabId;if(!t)continue;let r=e.get(t);if(!r)continue;let i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;1>Math.abs(a)&&1>Math.abs(o)||n.animate([{transform:`translate(${a}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[R]);let es=ew.useCallback(e=>{let t=A.current;if(t)return Array.from(t.querySelectorAll("[data-tab-id]")).find(t=>t.dataset.tabId===e)},[]),ec=ew.useCallback((e,t)=>{let n=V.current??X,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let i=t-e.offsetX,a=i+e.width,o=t>=e.currentX,l=n[r+1],s=n[r-1];if(o&&l&&!l.disabled){let e=es(l.id),t=e?.getBoundingClientRect();t&&a>=t.left+.7*t.width&&ea(Js(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&i<=t.right-.7*t.width&&ea(Js(n,r,r-1))}},[es,X,ea]);function ed(e){if(!d||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function eu(e){let t=A.current;if(!t)return{index:X.length,left:0};let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll("[data-tab-id]"));if(0===r.length)return{index:0,left:t.scrollLeft+8};for(let[i,a]of r.entries()){let r=a.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:i,left:r.left-n.left+t.scrollLeft}}let i=r[r.length-1].getBoundingClientRect();return{index:r.length,left:i.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(_)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=T.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,i=t.dragging||Math.abs(n)>4||Math.abs(r)>4;i&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:i})}function t(e){let t=T.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=X.find(e=>e.id===t.tabId),a=P.current?.getBoundingClientRect(),o=!!a&&(e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=X.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:X,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let a=X.filter(t=>t.id!==e.id);if(en(a),e.id===ee){let e=Jo(a,r);void 0===n&&Q(e),e&&i?.(e)}return!0}(r,e)){I(void 0),er(void 0),ea(void 0,!1);return}let l=V.current;l&&!(l.length===X.length&&l.every((e,t)=>e.id===X[t]?.id))&&(en(l),s?.(l))}I(void 0),er(void 0),ea(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=_?.dragging&&R?R:X,ep=_?.dragging?X.find(e=>e.id===_.tabId):void 0,em=_?.dragging&&ep&&$?(0,t3.createPortal)((0,eb.jsxs)("div",{"data-slot":"multi-tab-drag-preview","aria-hidden":"true",className:"pointer-events-none fixed z-[100] flex h-9 min-w-0 items-center gap-1 rounded-t-lg border border-border bg-background px-2.5 text-foreground shadow-lg",style:{left:_.currentX-_.offsetX,top:_.top,width:_.width},children:[ep.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,eb.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:tK("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,eb.jsxs)("div",{className:"relative flex min-w-0 shrink-0 items-end gap-1 border-b bg-muted/35 px-1.5 pt-1.5",children:[W&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,eb.jsx)(cO,{})}),(0,eb.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:tK("relative flex min-w-0 flex-1 items-end overflow-x-auto [scrollbar-width:none] data-[overflow=both]:[mask-image:linear-gradient(90deg,transparent,black_24px,black_calc(100%-24px),transparent)] data-[overflow=left]:[mask-image:linear-gradient(90deg,transparent,black_24px)] data-[overflow=right]:[mask-image:linear-gradient(90deg,black_calc(100%-24px),transparent)] [&::-webkit-scrollbar]:hidden",N),"data-overflow":W&&q?"both":W?"left":q?"right":void 0,onScroll:eo,onDragOver:function(e){ed(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",Y(eu(e)))},onDragLeave:function(e){if(!ed(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Y(void 0)},onDrop:function(e){if(!ed(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=eu(e);Y(void 0),d?.({tabs:X,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,a=eh[t+1],o=_?.dragging&&z===e.id,s=!r&&!o&&void 0!==a&&a.id!==et?.id&&a.id!==z;return(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();I(e.id),ea(X,!1),er({tabId:e.id,startX:t.clientX,startY:t.clientY,offsetX:t.clientX-n.left,top:n.top,width:n.width,currentX:t.clientX,currentY:t.clientY,dragging:!1})})(e,t),"data-slot":"multi-tab","data-tab-id":e.id,"data-state":r?"active":"inactive","data-dragging":z===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:tK("group/tab relative flex h-9 min-w-0 max-w-52 shrink-0 items-center gap-1 rounded-t-lg border border-b-0 px-2.5 transition-[border-color,background-color,color,box-shadow,outline-color] duration-150 ease-out",h&&!e.disabled&&"cursor-grab active:cursor-grabbing",r?"border-border bg-background text-foreground shadow-[0_-1px_0_var(--background)_inset]":"border-transparent bg-transparent text-muted-foreground hover:bg-background/70 hover:text-foreground",o&&"border-dashed border-border bg-muted/45 text-transparent shadow-none outline outline-1 outline-ring/30 [&_*]:opacity-0",e.disabled&&"pointer-events-none opacity-50"),children:[(0,eb.jsx)("button",{type:"button",role:"tab","aria-label":Jl(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let a;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(a=X.find(e=>e.id===r))&&!a.disabled&&(void 0===n&&Q(r),i?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,eb.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none relative z-10 flex min-w-0 flex-1 items-center gap-1.5",children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,eb.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(Jl(e.title)?`${x}: ${Jl(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=X.findIndex(t=>t.id===e.id),r=X.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=Jo(r,t);void 0===n&&Q(e),e&&i?.(e)}})(e),className:tK("relative z-20 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none group-hover/tab:opacity-100",r&&"opacity-100"),children:(0,eb.jsx)(p6,{className:"size-3.5"})})]}),s&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,eb.jsxs)("span",{"data-slot":"multi-tab-external-insert","aria-hidden":"true",className:"pointer-events-none absolute top-2 bottom-1 z-30 flex w-0 -translate-x-1/2 items-center justify-center",style:{left:G.left},children:[(0,eb.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,eb.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,eb.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[q&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,eb.jsx)(va,{})}),u.length>0?(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,eb.jsx)(s7,{})})}),(0,eb.jsx)(yj,{align:"end",className:"w-52",children:u.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yN,{}),(0,eb.jsxs)(yk,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yM,{children:e.shortcut})]})]},t))})]}):(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...X,e]),e.disabled||(void 0===n&&Q(e.id),i?.(e.id)))},children:(0,eb.jsx)(s7,{})}),f.length>0&&(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,eb.jsx)(s6,{})})}),(0,eb.jsx)(yj,{align:"end",className:"w-52",children:f.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yN,{}),(0,eb.jsxs)(yk,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yM,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,eb.jsx)("div",{"data-slot":"multi-tab-content",className:tK("min-h-0 overflow-hidden",M),children:ef??j??(0,eb.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let Jd=[{policyNumber:3,name:"Allow HTTP Traffic",sourceZone:"Trust",sourceIPs:["192.168.1.0/24","10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["192.168.2.0/24"],tags:["Web Access","Internal"],action:"allow",description:"Permits HTTP traffic from internal network"},{policyNumber:5,name:"Block Suspicious IPs",sourceZone:"Untrust",sourceIPs:["203.0.113.0/24","198.51.100.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Security"],action:"deny",description:"Blocks known malicious IP ranges"},{policyNumber:9,name:"SSH Access Control",sourceZone:"Trust",sourceIPs:["172.16.0.0/12"],destinationZone:"Trust",destinationIPs:["10.50.0.0/16"],tags:["Admin Access","VPN"],action:"allow",description:"Restricted SSH access for admin network"},{policyNumber:12,name:"Database Port Protection",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["10.100.0.0/24"],tags:["Blocking","Database"],action:"deny",description:"Blocks external access to database ports"},{policyNumber:15,name:"API Gateway Access",sourceZone:"Trust",sourceIPs:["192.168.100.0/24","192.168.101.0/24"],destinationZone:"Trust",destinationIPs:["10.200.0.5"],tags:["API","VDI Env"],action:"allow",description:"Allows traffic to API gateway from specific subnets"},{policyNumber:18,name:"Drop Legacy SMB",sourceZone:"Trust",sourceIPs:["Any"],destinationZone:"Trust",destinationIPs:["10.20.0.0/16"],tags:["Legacy","Internal"],action:"drop",description:"Drops SMBv1 probes across workstation networks"},{policyNumber:22,name:"Agent Runtime Mesh",sourceZone:"Trust",sourceIPs:["10.10.4.0/24"],destinationZone:"Trust",destinationIPs:["10.10.8.0/24","10.10.12.0/24"],tags:["Agent","Runtime"],action:"allow",description:"Allows managed agent runtime channels between worker pools"},{policyNumber:27,name:"Block Public Admin Ports",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Admin Access"],action:"deny",description:"Denies public access to SSH, RDP, and database admin ports"},{policyNumber:31,name:"Build Cache Access",sourceZone:"Trust",sourceIPs:["10.30.0.0/16"],destinationZone:"Trust",destinationIPs:["10.60.12.20"],tags:["Build","Internal"],action:"allow",description:"Allows build workers to reach shared cache storage"},{policyNumber:36,name:"Relay Egress",sourceZone:"Trust",sourceIPs:["10.40.0.0/16"],destinationZone:"Untrust",destinationIPs:["198.18.0.0/15"],tags:["Relay","Agent"],action:"allow",description:"Permits relay service egress to managed edge addresses"},{policyNumber:41,name:"Quarantine Subnet",sourceZone:"Quarantine",sourceIPs:["10.250.0.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Security","Blocking"],action:"deny",description:"Blocks quarantined hosts from internal services"},{policyNumber:48,name:"Observability Intake",sourceZone:"Trust",sourceIPs:["10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["10.80.4.10"],tags:["Telemetry","Internal"],action:"allow",description:"Allows metrics and logs to the observability intake"}],Ju=Array.from(new Set(Jd.flatMap(e=>e.tags))).sort(),Jf=[["10.10.4.0/24","Agent workers","Trust","18"],["10.20.0.0/16","Workstations","Trust","41"],["10.250.0.0/24","Quarantine","Quarantine","03"],["198.18.0.0/15","Relay edge","Untrust","12"]],Jh=[["Database Port Protection","2026-06-12","Security"],["Relay Egress","2026-06-28","Network"],["Build Cache Access","2026-07-04","Build"],["Observability Intake","2026-07-18","Ops"]],Jp=[{time:"09:00",p2p:42,direct:12,relay:96},{time:"10:00",p2p:39,direct:12,relay:88},{time:"11:00",p2p:44,direct:14,relay:91},{time:"12:00",p2p:38,direct:12,relay:84},{time:"13:00",p2p:36,direct:11,relay:86},{time:"14:00",p2p:41,direct:13,relay:93}],Jm=[["14:42","Allay 将 Linux-runner-02 加入 Compute 机器组","done"],["14:37","Ops 对 runner 服务发起重启确认","current"],["14:25","UI Polish Agent 访问 D:\\Projects\\Vantaloom-ui","done"],["14:18","Viewer 请求远程 shell 被拒绝","blocked"],["14:07","Observer-01 P2P 心跳恢复","done"],["13:54","Buildbot 读取发布产物目录","done"]],Jg={p2p:{label:"P2P",color:"var(--chart-1)"},direct:{label:"Direct",color:"var(--chart-3)"},relay:{label:"Relay",color:"var(--chart-5)"},cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"}};function Jv({className:e,...t}){return(0,eb.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:tK("mx-auto flex w-full justify-center",e),...t})}function Jx({className:e,...t}){return(0,eb.jsx)("ul",{"data-slot":"pagination-content",className:tK("flex flex-row items-center gap-1",e),...t})}function Jy({...e}){return(0,eb.jsx)("li",{"data-slot":"pagination-item",...e})}function Jb({className:e,isActive:t,size:n="icon",...r}){return(0,eb.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:tK(tG({variant:t?"outline":"ghost",size:n}),e),...r})}function Jw({className:e,previousLabel:t="Previous",...n}){return(0,eb.jsxs)(Jb,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,eb.jsx)(cO,{}),(0,eb.jsx)("span",{className:"hidden sm:block",children:t})]})}function Jj({className:e,nextLabel:t="Next",...n}){return(0,eb.jsxs)(Jb,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,eb.jsx)("span",{className:"hidden sm:block",children:t}),(0,eb.jsx)(va,{})]})}function Jk({className:e,moreLabel:t="More pages",...n}){return(0,eb.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:tK("flex size-8 items-center justify-center",e),...n,children:[(0,eb.jsx)(s6,{className:"size-4"}),(0,eb.jsx)("span",{className:"sr-only",children:t})]})}var JS=[" ","Enter","ArrowUp","ArrowDown"],JC=[" ","Enter"],JN="Select",[JM,JE,JO]=vz(JN),[JP,JA]=tX(JN,[JO,ut]),Jz=ut(),[JI,J_]=JP(JN),[JD,JT]=JP(JN),JR=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:l,onValueChange:s,dir:c,name:d,autoComplete:u,disabled:f,required:h,form:p}=e,m=Jz(t),[g,v]=ew.useState(null),[x,y]=ew.useState(null),[b,w]=ew.useState(!1),j=fb(c),[k,S]=t0({prop:r,defaultProp:i??!1,onChange:a,caller:JN}),[C,N]=t0({prop:o,defaultProp:l,onChange:s,caller:JN}),M=ew.useRef(null),E=!g||p||!!g.closest("form"),[O,P]=ew.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(";");return(0,eb.jsx)(ui,{...m,children:(0,eb.jsxs)(JI,{required:h,scope:t,trigger:g,onTriggerChange:v,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:cR(),value:C,onValueChange:N,open:k,onOpenChange:S,dir:j,triggerPointerDownPosRef:M,disabled:f,children:[(0,eb.jsx)(JM.Provider,{scope:t,children:(0,eb.jsx)(JD,{scope:e.__scopeSelect,onNativeOptionAdd:ew.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:ew.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),E?(0,eb.jsxs)(Qd,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:u,value:C,onChange:e=>N(e.target.value),disabled:f,form:p,children:[void 0===C?(0,eb.jsx)("option",{value:""}):null,Array.from(O)]},A):null]})})};JR.displayName=JN;var JL="SelectTrigger",J$=ew.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Jz(n),o=J_(JL,n),l=o.disabled||r,s=eT(t,o.onTriggerChange),c=JE(n),d=ew.useRef("touch"),[u,f,h]=Qf(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===o.value),r=Qh(t,e,n);void 0!==r&&o.onValueChange(r.value)}),p=e=>{l||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,eb.jsx)(uo,{asChild:!0,...a,children:(0,eb.jsx)(ne.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Qu(o.value)?"":void 0,...i,ref:s,onClick:tZ(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&p(e)}),onPointerDown:tZ(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:tZ(i.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&JS.includes(e.key)&&(p(),e.preventDefault())})})})});J$.displayName=JL;var JF="SelectValue",JV=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...l}=e,s=J_(JF,n),{onValueNodeHasChildrenChange:c}=s,d=void 0!==a,u=eT(t,s.onValueNodeChange);return tJ(()=>{c(d)},[c,d]),(0,eb.jsx)(ne.span,{...l,ref:u,style:{pointerEvents:"none"},children:Qu(s.value)?(0,eb.jsx)(eb.Fragment,{children:o}):a})});JV.displayName=JF;var JB=ew.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,eb.jsx)(ne.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});JB.displayName="SelectIcon";var JH=e=>(0,eb.jsx)(uv,{asChild:!0,...e});JH.displayName="SelectPortal";var JW="SelectContent",JU=ew.forwardRef((e,t)=>{let n=J_(JW,e.__scopeSelect),[r,i]=ew.useState();return(tJ(()=>{i(new DocumentFragment)},[]),n.open)?(0,eb.jsx)(JY,{...e,ref:t}):r?t3.createPortal((0,eb.jsx)(Jq,{scope:e.__scopeSelect,children:(0,eb.jsx)(JM.Slot,{scope:e.__scopeSelect,children:(0,eb.jsx)("div",{children:e.children})})}),r):null});JU.displayName=JW;var[Jq,JK]=JP(JW),JG=t6("SelectContent.RemoveScroll"),JY=ew.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g,...v}=e,x=J_(JW,n),[y,b]=ew.useState(null),[w,j]=ew.useState(null),k=eT(t,e=>b(e)),[S,C]=ew.useState(null),[N,M]=ew.useState(null),E=JE(n),[O,P]=ew.useState(!1),A=ew.useRef(!1);ew.useEffect(()=>{if(y)return pe(y)},[y]),hv();let z=ew.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:"nearest"}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,w]),I=ew.useCallback(()=>z([S,y]),[z,S,y]);ew.useEffect(()=>{O&&I()},[O,I]);let{onOpenChange:_,triggerPointerDownPosRef:D}=x;ew.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||_(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[y,_,D]),ew.useEffect(()=>{let e=()=>_(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[_]);let[T,R]=Qf(e=>{let t=E().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Qh(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),L=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(C(e),r&&(A.current=!0))},[x.value]),$=ew.useCallback(()=>y?.focus(),[y]),F=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&M(e)},[x.value]),V="popper"===r?JZ:JX,B=V===JZ?{side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g}:{};return(0,eb.jsx)(Jq,{scope:n,content:y,viewport:w,onViewportChange:j,itemRefCallback:L,selectedItem:S,onItemLeave:$,itemTextRefCallback:F,focusSelectedItem:I,selectedItemText:N,position:r,isPositioned:O,searchRef:T,children:(0,eb.jsx)(h5,{as:JG,allowPinchZoom:!0,children:(0,eb.jsx)(hd,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tZ(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,eb.jsx)(cJ,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,eb.jsx)(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:tZ(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||R(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});JY.displayName="SelectContentImpl";var JX=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J_(JW,n),o=JK(JW,n),[l,s]=ew.useState(null),[c,d]=ew.useState(null),u=eT(t,e=>d(e)),f=JE(n),h=ew.useRef(!1),p=ew.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:v,focusSelectedItem:x}=o,y=ew.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&c&&m&&g&&v){let e=a.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if("rtl"!==a.dir){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=d+"px"}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=d+"px"}let o=f(),s=window.innerHeight-20,d=m.scrollHeight,u=window.getComputedStyle(c),p=parseInt(u.borderTopWidth,10),x=parseInt(u.paddingTop,10),y=parseInt(u.borderBottomWidth,10),b=p+x+d+parseInt(u.paddingBottom,10)+y,w=Math.min(5*g.offsetHeight,b),j=window.getComputedStyle(m),k=parseInt(j.paddingTop,10),S=parseInt(j.paddingBottom,10),C=e.top+e.height/2-10,N=g.offsetHeight/2,M=p+x+(g.offsetTop+N);if(M<=C){let e=o.length>0&&g===o[o.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-C,N+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=M+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;l.style.top="0px";let t=Math.max(C,p+m.offsetTop+(e?k:0)+N);l.style.height=t+(b-M)+"px",m.scrollTop=M-C+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,l,c,m,g,v,a.dir,r]);tJ(()=>y(),[y]);let[b,w]=ew.useState();tJ(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);let j=ew.useCallback(e=>{e&&!0===p.current&&(y(),x?.(),p.current=!1)},[y,x]);return(0,eb.jsx)(JJ,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:(0,eb.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:(0,eb.jsx)(ne.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});JX.displayName="SelectItemAlignedPosition";var JZ=ew.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:i=10,...a}=e,o=Jz(n);return(0,eb.jsx)(ud,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});JZ.displayName="SelectPopperPosition";var[JJ,JQ]=JP(JW,{}),J0="SelectViewport",J1=ew.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=JK(J0,n),o=JQ(J0,n),l=eT(t,a.onViewportChange),s=ew.useRef(0);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,eb.jsx)(JM.Slot,{scope:n,children:(0,eb.jsx)(ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:tZ(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,i=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(i<r){let a=i+e,o=Math.min(r,a),l=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})});J1.displayName=J0;var J2="SelectGroup",[J5,J4]=JP(J2);ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=cR();return(0,eb.jsx)(J5,{scope:n,id:i,children:(0,eb.jsx)(ne.div,{role:"group","aria-labelledby":i,...r,ref:t})})}).displayName=J2;var J3="SelectLabel";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=J4(J3,n);return(0,eb.jsx)(ne.div,{id:i.id,...r,ref:t})}).displayName=J3;var J6="SelectItem",[J8,J7]=JP(J6),J9=ew.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=J_(J6,n),s=JK(J6,n),c=l.value===r,[d,u]=ew.useState(a??""),[f,h]=ew.useState(!1),p=eT(t,e=>s.itemRefCallback?.(e,r,i)),m=cR(),g=ew.useRef("touch"),v=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(""===r)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,eb.jsx)(J8,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:ew.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,eb.jsx)(JM.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,eb.jsx)(ne.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:p,onFocus:tZ(o.onFocus,()=>h(!0)),onBlur:tZ(o.onBlur,()=>h(!1)),onClick:tZ(o.onClick,()=>{"mouse"!==g.current&&v()}),onPointerUp:tZ(o.onPointerUp,()=>{"mouse"===g.current&&v()}),onPointerDown:tZ(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:tZ(o.onPointerMove,e=>{g.current=e.pointerType,i?s.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tZ(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:tZ(o.onKeyDown,e=>{(s.searchRef?.current===""||" "!==e.key)&&(JC.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});J9.displayName=J6;var Qe="SelectItemText",Qt=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J_(Qe,n),l=JK(Qe,n),s=J7(Qe,n),c=JT(Qe,n),[d,u]=ew.useState(null),f=eT(t,e=>u(e),s.onItemTextChange,e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),h=d?.textContent,p=ew.useMemo(()=>(0,eb.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=c;return tJ(()=>(m(p),()=>g(p)),[m,g,p]),(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(ne.span,{id:s.textId,...a,ref:f}),s.isSelected&&o.valueNode&&!o.valueNodeHasChildren?t3.createPortal(a.children,o.valueNode):null]})});Qt.displayName=Qe;var Qn="SelectItemIndicator",Qr=ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return J7(Qn,n).isSelected?(0,eb.jsx)(ne.span,{"aria-hidden":!0,...r,ref:t}):null});Qr.displayName=Qn;var Qi="SelectScrollUpButton",Qa=ew.forwardRef((e,t)=>{let n=JK(Qi,e.__scopeSelect),r=JQ(Qi,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(Qs,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Qa.displayName=Qi;var Qo="SelectScrollDownButton",Ql=ew.forwardRef((e,t)=>{let n=JK(Qo,e.__scopeSelect),r=JQ(Qo,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(Qs,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Ql.displayName=Qo;var Qs=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=JK("SelectScrollButton",n),o=ew.useRef(null),l=JE(n),s=ew.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return ew.useEffect(()=>()=>s(),[s]),tJ(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,eb.jsx)(ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:tZ(i.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(r,50))}),onPointerMove:tZ(i.onPointerMove,()=>{a.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(r,50))}),onPointerLeave:tZ(i.onPointerLeave,()=>{s()})})});ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,eb.jsx)(ne.div,{"aria-hidden":!0,...r,ref:t})}).displayName="SelectSeparator";var Qc="SelectArrow";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jz(n),a=J_(Qc,n),o=JK(Qc,n);return a.open&&"popper"===o.position?(0,eb.jsx)(uh,{...i,...r,ref:t}):null}).displayName=Qc;var Qd=ew.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=ew.useRef(null),a=eT(r,i),o=t1(t);return ew.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&n){let r=new Event("change",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,eb.jsx)(ne.select,{...n,style:{...ux,...n.style},ref:a,defaultValue:t})});function Qu(e){return""===e||void 0===e}function Qf(e){let t=cY(e),n=ew.useRef(""),r=ew.useRef(0),i=ew.useCallback(e=>{let i=n.current+e;t(i),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),a=ew.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return ew.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Qh(e,t,n){var r,i;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,l=(r=e,i=Math.max(o,0),r.map((e,t)=>r[(i+t)%r.length]));1===a.length&&(l=l.filter(e=>e!==n));let s=l.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return s!==n?s:void 0}function Qp({className:e,size:t="default",children:n,...r}){return(0,eb.jsxs)(J$,{"data-slot":"select-trigger","data-size":t,className:tK("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:line-clamp-1 [&>span]:flex [&>span]:items-center [&>span]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,eb.jsx)(JB,{asChild:!0,children:(0,eb.jsx)(cE,{className:"size-4 text-muted-foreground"})})]})}function Qm({className:e,...t}){return(0,eb.jsx)(Qa,{"data-slot":"select-scroll-up-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(vo,{})})}function Qg({className:e,...t}){return(0,eb.jsx)(Ql,{"data-slot":"select-scroll-down-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(cE,{})})}function Qv({className:e,children:t,position:n="popper",align:r="center",...i}){return(0,eb.jsx)(JH,{children:(0,eb.jsxs)(JU,{"data-slot":"select-content","data-align-trigger":"item-aligned"===n,position:n,align:r,className:tK("vtl-surface-popover relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 overflow-x-hidden overflow-y-auto rounded-[var(--surface-popover-radius)] border duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[align-trigger=true]:animate-none","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...i,children:[(0,eb.jsx)(Qm,{}),(0,eb.jsx)(J1,{"data-position":n,className:tK("p-1","popper"===n&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,eb.jsx)(Qg,{})]})})}function Qx({className:e,children:t,...n}){return(0,eb.jsxs)(J9,{"data-slot":"select-item",className:tK("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,eb.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,eb.jsx)(Qr,{children:(0,eb.jsx)(nv,{})})}),(0,eb.jsx)(Qt,{children:t})]})}function Qy({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qb(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[i,a]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>i[e]),[i]),c=ew.useMemo(()=>[{id:"policyNumber",header:"策略 #",accessorKey:"policyNumber",align:"right",width:84},{id:"name",header:"名称",accessorKey:"name",width:180,className:"font-medium"},{id:"sourceZone",header:"源区域",accessorKey:"sourceZone",width:112,cell:({row:e})=>(0,eb.jsx)(Qk,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,eb.jsx)(Qk,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,eb.jsx)(QS,{action:e.action})}],[]),d=ew.useMemo(()=>{let t=e.trim().toLowerCase();return Jd.filter(e=>{let r=0===t.length||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.sourceIPs.some(e=>e.toLowerCase().includes(t))||e.destinationIPs.some(e=>e.toLowerCase().includes(t)),a="all"===n||e.tags.includes(n),o=!(i.allow||i.drop||i.deny)||i.allow&&"allow"===e.action||i.drop&&"drop"===e.action||i.deny&&"deny"===e.action;return r&&a&&o})},[i,e,n]),u=Math.max(1,Math.ceil(d.length/8)),f=Math.min(o,u),h=d.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[i,e,n]),(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,eb.jsx)(Qy,{title:"防火墙策略"}),(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"新增策略"]})]}),(0,eb.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-[minmax(12rem,1fr)_10rem_auto] items-end gap-3",children:[(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,eb.jsxs)("span",{className:"relative",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,eb.jsxs)(JR,{value:n,onValueChange:r,children:[(0,eb.jsx)(Qp,{className:"w-full",children:(0,eb.jsx)(JV,{placeholder:"全部标签"})}),(0,eb.jsxs)(Qv,{children:[(0,eb.jsx)(Qx,{value:"all",children:"全部标签"}),Ju.map(e=>(0,eb.jsx)(Qx,{value:e,children:e},e))]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,eb.jsxs)(yZ,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),a({allow:!1,drop:!1,deny:!1}),l(1)):a({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,eb.jsx)(yJ,{value:"allow",children:"允许"}),(0,eb.jsx)(yJ,{value:"drop",children:"丢弃"}),(0,eb.jsx)(yJ,{value:"deny",children:"拒绝"}),(0,eb.jsx)(yJ,{value:"clear",children:"全部"})]})]})]}),(0,eb.jsx)(G9,{rows:h,columns:c,rowId:"policyNumber",showHeader:!1,showToolbar:!1,rowHeight:40,className:"min-h-0 flex-1 rounded-lg shadow-none",labels:{noRows:"没有匹配的策略。",selectAllRows:"选择当前页策略",selectRow:e=>`选择第 ${e+1} 条策略`,resizeColumn:"调整列宽",sortAsc:"升序",sortDesc:"降序",sortClear:"取消排序",copyCell:"复制单元格",copied:"已复制"}}),(0,eb.jsx)(Qw,{page:f,totalPages:u,onPageChange:function(e){l(Math.min(u,Math.max(1,e)))}})]})}function Qw({page:e,totalPages:t,onPageChange:n}){let r=ew.useMemo(()=>t<=3?Array.from({length:t},(e,t)=>t+1):e<=2?[1,2,3]:e>=t-1?[t-2,t-1,t]:[e-1,e,e+1],[e,t]),i=r[0]??1,a=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,eb.jsx)(Jv,{className:"mt-3 shrink-0",children:(0,eb.jsxs)(Jx,{className:"gap-2",children:[(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jw,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:tK(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),i>1?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),i>2?(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jk,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),a<t?(0,eb.jsxs)(eb.Fragment,{children:[a<t-1?(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jk,{moreLabel:"更多页"})}):null,(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jj,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:tK(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function Qj({items:e,variant:t}){return(0,eb.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)(c_,{variant:t,children:e},e))})}function Qk({zone:e}){return(0,eb.jsx)(c_,{variant:"Trust"===e?"secondary":"outline",children:e})}function QS({action:e}){return(0,eb.jsx)(c_,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function QC({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,eb.jsx)("table",{"data-slot":"table",className:tK("w-full caption-bottom text-sm",e),...t})})}function QN({className:e,...t}){return(0,eb.jsx)("thead",{"data-slot":"table-header",className:tK("[&_tr]:border-b",e),...t})}function QM({className:e,...t}){return(0,eb.jsx)("tbody",{"data-slot":"table-body",className:tK("[&_tr:last-child]:border-0",e),...t})}function QE({className:e,...t}){return(0,eb.jsx)("tr",{"data-slot":"table-row",className:tK("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function QO({className:e,...t}){return(0,eb.jsx)("th",{"data-slot":"table-head",className:tK("h-9 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function QP({className:e,...t}){return(0,eb.jsx)("td",{"data-slot":"table-cell",className:tK("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function QA({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qz({title:e,headers:t,rows:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsx)(QA,{title:e}),(0,eb.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,eb.jsxs)(QC,{children:[(0,eb.jsx)(QN,{children:(0,eb.jsx)(QE,{children:t.map(e=>(0,eb.jsx)(QO,{children:e},e))})}),(0,eb.jsx)(QM,{children:n.map(e=>(0,eb.jsx)(QE,{children:e.map((e,t)=>(0,eb.jsx)(QP,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function QI(){return(0,eb.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,eb.jsx)(QA,{title:"策略申请"}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(ny,{placeholder:"策略名称"}),(0,eb.jsx)(ny,{placeholder:"负责人"}),(0,eb.jsx)(ny,{placeholder:"源 CIDR"}),(0,eb.jsx)(ny,{placeholder:"目标 CIDR"})]}),(0,eb.jsx)("textarea",{placeholder:"用途",className:"min-h-32 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"}),(0,eb.jsx)("div",{children:(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"提交申请"]})})]})}function Q_(){return(0,eb.jsxs)(UR,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,eb.jsx)("div",{className:"shrink-0 px-3 pt-3",children:(0,eb.jsxs)(Uq,{className:"h-8",children:[(0,eb.jsx)(UK,{value:"policies",children:"防火墙策略"}),(0,eb.jsx)(UK,{value:"ip-addresses",children:"IP 地址"}),(0,eb.jsx)(UK,{value:"renewals",children:"续期"}),(0,eb.jsx)(UK,{value:"policy-request",children:"策略申请"}),(0,eb.jsx)(UK,{value:"user-settings",children:"用户设置"})]})}),(0,eb.jsx)(UG,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qb,{})}),(0,eb.jsx)(UG,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:Jf})}),(0,eb.jsx)(UG,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"续期",headers:["策略","续期时间","负责人"],rows:Jh})}),(0,eb.jsx)(UG,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(QI,{})}),(0,eb.jsx)(UG,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function QD(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function QT(e,t){let n=t.machineId||"local";return QD((await bu(n,e.path)).items)}function QR({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[i,a]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{a(!0);try{let e=await bd();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:QD(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{a(!1)}},[]);return ew.useEffect(()=>{s()},[s]),ew.useEffect(()=>{function e(){s()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[s]),(0,eb.jsx)(KD,{className:e,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:n,defaultExpandedIds:n.map(e=>e.id),loadingIds:i?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:QT,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function QL({open:e,onOpenChange:t,onSelectFile:n}){return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"选择本机可访问文件。"}),(0,eb.jsx)(QR,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}Qd.displayName="SelectBubbleInput";let Q$=eN("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),QF=eN("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);function QV({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:i,onMovePermissionGrantedChange:a}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,eb.jsx)(Q$,{className:"size-4"}):(0,eb.jsx)(QF,{className:"size-4"}),pressed:n,onClick:()=>a(!n)},{key:"add",label:"新建文件窗口",icon:(0,eb.jsx)(s7,{className:"size-4"}),pressed:void 0,onClick:i}];return(0,eb.jsx)("div",{className:tK("right-5 bottom-5 z-50","viewport"===t?"fixed":"absolute"),children:(0,eb.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.pressed&&"border-foreground bg-foreground text-background hover:bg-foreground/90 hover:text-background"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"文件窗口操作","aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}let QB=[];function QH(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function QW(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function QU(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function Qq(e){return e.map(e=>({...e,children:e.children?Qq(e.children):void 0}))}let QK=eN("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),QG=eN("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),QY=eN("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),QX={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function QZ({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:i,labels:a,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:d,onExpandedChange:u,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...QX,...a},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[z,I]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[_,D]=ew.useState(!1),[T,R]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),V=ew.useRef(null),B=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,U=Math.min(o,10),q=W?e:e.slice(0,U),K=E?N:void 0,G=44*q.length+18,Y=Math.min(G,l),X=W&&G>Y,Z=0===e.length?"h-24":W?`${Y}px`:"h-28",J=W&&X?14:0;ew.useEffect(()=>{if(!W){O(!1),I({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{B.current&&(B.current.scrollTop=0)}),I({canScrollUp:!1,canScrollDown:G>Y});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,Y,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),u?.(e)},[H,u]);function ee(e,t=0){let n=e.currentTarget.getBoundingClientRect();return e.clientX>=n.left-t&&e.clientX<=n.right+t&&e.clientY>=n.top-t&&e.clientY<=n.bottom+t}function et(e){if(!W||!B.current)return 0;let t=Array.from(B.current.querySelectorAll('[data-slot="clipboard-stack-card"]'));if(0===t.length)return 0;for(let[n,r]of t.entries()){let t=r.getBoundingClientRect();if(e.clientY<t.top+t.height/2)return n}return t.length}function en(e){return void 0!==S||Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.clip-id")}return ew.useEffect(()=>{if(0===e.length||W)return;let t=window.requestAnimationFrame(()=>{V.current?.matches(":hover")&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))});return()=>window.cancelAnimationFrame(t)},[e.length,Q,W]),ew.useEffect(()=>{if(!W||!X||!K||!B.current)return;let e=q.findIndex(e=>e.id===K);if(e<0)return;let t=B.current,n=44*e-8,r=44*e+(q[e]?.expandedHeight??220)+12,i=t.scrollTop,a=i+t.clientHeight;n<i?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>a&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,X,q,W]),(0,eb.jsxs)("div",{ref:V,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":_,"data-external-dragging":T,"data-expansion-direction":r,className:tK("group/clipboard relative w-80 max-w-full overflow-visible py-2",d),onMouseEnter:function(e){x?.(e),ee(e)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))},onMouseMove:function(e){if(!W){ee(e,12)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0));return}!W||S||ee(e,12)||(M(void 0),A(void 0),Q(!1),D(!0),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onMouseLeave:function(e){y?.(e),S||(M(void 0),A(void 0),D(!0),Q(!1),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onDragEnter:function(e){!s||en(e)||(L.current+=1,R(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(R(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",R(!0),W?A(et(e)):A(0))},onDrop:function(t){if(!s||en(t))return;t.preventDefault(),t.stopPropagation();let n=P??et(t);L.current=0,R(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-header",className:tK("mb-2 flex h-8 items-center gap-2 px-1 text-sm font-medium text-foreground transition-[opacity,transform] duration-200","down-left"===r&&"justify-end",W?"opacity-100":"translate-y-1 opacity-0"),children:[(0,eb.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(QY,{className:"size-3.5"})}),(0,eb.jsx)("span",{children:i??w.title}),(0,eb.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-list",className:tK("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:tK("pointer-events-none absolute top-3 right-[34px] z-50 size-2.5 rounded-full bg-foreground shadow-sm transition-[opacity,transform] duration-200 dark:bg-background",W?"scale-75 opacity-0":"opacity-100")}):null,s&&T?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:tK("pointer-events-none absolute right-0 z-[70] h-14 w-[88%] rounded-xl border bg-background shadow-md shadow-black/10","clipboard-stack-external-ghost"),children:[(0,eb.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,eb.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,eb.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,eb.jsx)("div",{className:"flex h-24 items-center justify-center rounded-xl border border-dashed bg-muted/35 text-sm text-muted-foreground",children:w.empty}):(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:B,className:tK("relative h-full overflow-x-visible",W&&X?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;I({canScrollUp:t.scrollTop>1,canScrollDown:t.scrollTop+t.clientHeight<t.scrollHeight-1})},onDragOver:function(e){W&&S&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},onDrop:function(t){if(!W||!S||void 0===P)return;t.preventDefault(),t.stopPropagation(),F.current=!0;let n=e.findIndex(e=>e.id===S),r=e[n];if(n<0||!r)return;let i=e.filter(e=>e.id!==S),a=Math.max(0,Math.min(P>n?P-1:P,i.length));i.splice(a,0,r),A(void 0),M(void 0),a!==n&&g?.(i,{item:r,fromIndex:n,toIndex:a,items:i})},children:(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&X?`calc(100% - ${J}px)`:void 0,marginLeft:W&&X?`${J}px`:void 0,height:W&&X?G+28:W?G:"100%"},children:[void 0!==P?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-insert-line","aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-[80] flex items-center",style:{top:44*P-2},children:[(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,eb.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,q.map((t,n)=>(0,eb.jsx)(QJ,{item:t,index:n,count:q.length,expanded:W,active:W&&t.id===K,top:W?44*n:void 0,expansionDirection:r,labels:w,onHover:()=>M(t.id),onDuplicate:()=>{let n=e.findIndex(e=>e.id===t.id);n<0||p?.(e,{item:t,index:n,items:e})},onDragOver:e=>{if(W&&S&&S!==t.id){let t=e.currentTarget.getBoundingClientRect();A(e.clientY<t.top+t.height/2?n:n+1)}},onDragStart:e=>{C(e.item.id),M(void 0),F.current=!1,f?.(e)},onDragEnd:t=>{let n=t.nativeEvent.dataTransfer.dropEffect,r=t.item.id,i=e.findIndex(e=>e.id===r),a=c&&!F.current&&"none"!==n&&i>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),a){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:i,items:n})}h?.(t)}},t.id))]})}),X&&z.canScrollUp?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-top","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-[90] h-8 bg-gradient-to-b from-background to-transparent"}):null,X&&z.canScrollDown?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-bottom","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[90] h-8 bg-gradient-to-t from-background to-transparent"}):null]})]})]})}function QJ({item:e,index:t,count:n,expanded:r,active:i,top:a,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:d,onDragStart:u,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?i?n+20:n-t:n+t;return(0,eb.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:tK("absolute right-0 min-h-16 w-full cursor-grab select-none rounded-xl border bg-background p-2.5 text-foreground shadow-sm shadow-black/5 outline-none transition-[top,transform,opacity,box-shadow,border-color] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] active:cursor-grabbing","hover:border-foreground/35 hover:shadow-md hover:shadow-black/10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",r&&"min-h-0 overflow-hidden py-2 transition-[top,transform,max-height,opacity,box-shadow,border-color] duration-300",r&&!i&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?a??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&i?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?i?"translate3d(-10px, -6px, 0) rotate(0deg)":"translate3d(0, 0, 0) rotate(0deg)":`translate3d(${"down-left"===o?0:4*h}px, 0, 0) rotate(${p}deg)`},tabIndex:e.disabled?-1:0,onMouseDown:function(t){1!==t.button||e.disabled||t.preventDefault()},onMouseEnter:s,onFocus:s,onAuxClick:function(t){1!==t.button||e.disabled||(t.preventDefault(),c?.())},onDragOver:d,onDragStart:function(t){for(let[n,r]of(t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",e.title),t.dataTransfer.setData("application/vnd.vantaloom.clip-id",e.id),Object.entries(e.dragData??{})))t.dataTransfer.setData(n,r);u?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-card-media",className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted text-muted-foreground",children:e.icon??(0,eb.jsx)(QY,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,eb.jsx)("p",{className:tK("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-40 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.description}):null,e.content?(0,eb.jsx)("div",{className:tK("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,eb.jsx)("span",{"aria-label":l.dragHandle,className:"mt-1 inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground",children:(0,eb.jsx)(Wo,{className:"size-3.5"})})]})})}function QQ({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let i,a,o;return{id:e.id,title:(i="copy"===(t=e).mode?"复制":"移动",a=t.sources.length,o=t.sources[0],`${i} ${a>1?`${a} 项`:Q1(o?.path??"")}`),description:(n=e).message?n.message:`${n.sources[0]?.machineId??"local"} -> ${n.target.machineId}`,meta:function(e){switch(e.status){case"completed":return"完成";case"failed":return"失败";case"queued":return"排队";default:return`${Math.round(e.progress?.percent??0)}%`}}(e),icon:"completed"===(r=e).status?(0,eb.jsx)(Uc,{className:"size-4"}):"failed"===r.status?(0,eb.jsx)(QG,{className:"size-4"}):"running"===r.status?(0,eb.jsx)(Ud,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,eb.jsx)(s0,{className:"size-4"}):(0,eb.jsx)(QK,{className:"size-4"}),expandedHeight:132,content:(0,eb.jsx)(Q0,{transfer:e})}});return(0,eb.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)]",children:(0,eb.jsx)(QZ,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function Q0({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,eb.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,eb.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,eb.jsx)("span",{className:"truncate",children:Q1(e.target.path)}),(0,eb.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"truncate",children:[Q2(e.progress.bytesDone)," /"," ",Q2(e.progress.bytesTotal)]}),(0,eb.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,eb.jsx)("div",{className:"truncate text-muted-foreground",children:Q1(e.progress.currentPath)}):null]})]})}function Q1(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function Q2(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||0===r?Math.round(n):n.toFixed(1)} ${t[r]}`}let Q5=eN("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function Q4({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:i,onActivate:a,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:d,onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,eb.jsxs)("section",{className:tK("absolute overflow-hidden rounded-xl border bg-card shadow-lg transition-[box-shadow,border-color] duration-150","vtl-file-manager-window",n&&"border-foreground shadow-xl"),style:{left:e.x,top:e.y,width:e.w,height:e.h,zIndex:r},onPointerDown:a,children:[(0,eb.jsxs)("div",{className:"grid h-9 cursor-grab grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-b bg-muted/35 px-2 active:cursor-grabbing",onPointerDown:function(t){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),a();let n=t.clientX,r=t.clientY;function i(t){let i=Math.max(0,e.x+t.clientX-n),a=Math.max(0,e.y+t.clientY-r);s({...e,x:i,y:a})}window.addEventListener("pointermove",i),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",e)})},children:[(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,eb.jsx)(p6,{})}),(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,eb.jsx)(Q5,{})})]}),(0,eb.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,eb.jsx)("div",{className:"w-14"})]}),(0,eb.jsx)(bt,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>d(e),onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>p({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"vtl-file-window-explorer min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0",style:{height:"calc(100% - 2.25rem)",minHeight:0}}),(0,eb.jsx)("button",{type:"button","aria-label":"调整窗口大小",className:"absolute right-0 bottom-0 size-5 cursor-nwse-resize rounded-tl-md border-t border-l bg-background/80",onPointerDown:function(t){t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),a();let n=t.clientX,r=t.clientY;function o(t){let a=Math.max(420,Math.min(Math.max(420,i.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:a,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function Q3({clipboardItems:e=[],onClipboardItemsChange:t}){var n;return n=(0,eb.jsx)(Q6,{clipboardItems:e,onClipboardItemsChange:t,className:"min-h-[calc(100svh-5rem)] p-4 lg:p-6",minBoardHeight:820,actionsPlacement:"viewport"}),(0,eb.jsx)(f5,{children:n})}function Q6({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:i="container"}){let[a,o]=f3(),[l,s]=ew.useState([]),[c,d]=ew.useState(QB),[u,f]=ew.useState(QB[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(QB.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await bu(e,n);s(n=>{var i;return i={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==i.root.id?e:QW(e.path,i.path)?{...e,children:Qq(i.items)}:{...e,children:function(e,t,n,r,i){let a=function(e,t,n){let r=QU(e,n),i=QU(t,n);if(r===i)return[];let a=r.endsWith("/")?r:`${r}/`;return i.startsWith(a)?i.slice(a.length).split("/").filter(Boolean):[]}(t,n,r);if(0===a.length)return Qq(i);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=a[r];if(!l)return Qq(i);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>QW(e.path,s)),d=t[c],u={...d??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(d?.children??[],s,r+1)};if(c<0)return[...t,u];let f=[...t];return f[c]=u,f}(e,t,0)}(e.children,e.path,i.path,e.platform,i.items)})})},[]),C=ew.useCallback(async()=>{let e=Q7((await bx()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>Q7([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{bv({mode:"move",sources:e.sources.map(e=>({machineId:e.machineId,path:e.path})),target:{machineId:e.target.machineId,path:e.target.path}}).then(N).catch(()=>{})},[N]),E=ew.useCallback(()=>{for(let e of c)S(e.machineId,e.rootId,e.path)},[S,c]);function O(e,t){d(n=>n.map(n=>n.id===e?t(n):n))}function P(e){let t=l[0];if(!t&&!e?.rootId)return;w.current+=1;let n=`files-window-${w.current}`,r=a.current?.getBoundingClientRect(),i=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,u=e?.h??460,h=Math.max(0,(i-c)/2),p=Math.max(0,(s-u)/2),m={id:n,title:e?.title??QH(t?.name??"local",t?.path??""),machineId:e?.machineId??t?.machineId??"local",rootId:e?.rootId??t?.id??"local",path:e?.path??t?.path??"",x:e?.x??h+12*w.current,y:e?.y??p+12*w.current,w:c,h:u};d(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}return ew.useEffect(()=>{let e=!0;return(async function(){let t=await bd();if(e&&(s(t.roots),!j.current&&t.roots[0])){j.current=!0;let e=function(e,t=0){return{id:`files-${e.id.replace(/[^a-z0-9_-]/gi,"-")}-${t}`,title:QH(e.name,e.path),machineId:e.machineId,rootId:e.id,path:e.path,x:28+24*t,y:28+24*t,w:720,h:480}}(t.roots[0]);d([e]),f(e.id),S(e.machineId,e.rootId,e.path)}})().catch(()=>{}),C().catch(()=>{}),()=>{e=!1}},[S,C]),ew.useEffect(()=>{if(!h.some(e=>"pending"===e.status||"running"===e.status||"queued"===e.status))return;let e=window.setInterval(async()=>{let e=(await C().catch(()=>h)).filter(e=>"completed"===e.status&&!k.current.has(e.id));if(e.length>0){for(let t of e)k.current.add(t.id);E()}},1e3);return()=>window.clearInterval(e)},[E,C,h]),(0,eb.jsxs)("div",{ref:a,className:tK("relative h-full min-h-0 w-full overflow-hidden rounded-[inherit]",n),onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.file-window")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.file-window");if(t)try{let n=JSON.parse(t),r=a.current?.getBoundingClientRect();e.preventDefault(),e.stopPropagation(),P({...n,x:r?e.clientX-r.left-160:n.x,y:r?e.clientY-r.top-24:n.y})}catch{return}},children:[(0,eb.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,eb.jsx)(Q4,{windowLayout:n,roots:l,active:u===n.id,zIndex:20+r+20*(u===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>d(e=>e.filter(e=>e.id!==n.id)),onMinimize:()=>{t?.([{id:`clip-${n.id}`,title:n.title,description:"文件管理窗口",meta:`${Math.round(n.w)}x${Math.round(n.h)}`,payloads:{"application/vnd.vantaloom.file-window":{...n}},dragData:{"application/vnd.vantaloom.clip-kind":"file-window","application/vnd.vantaloom.file-window":JSON.stringify(n)}},...e.filter(e=>e.id!==`clip-${n.id}`)]),d(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),i=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:i,rootId:e,path:t,title:QH(r?.name??i,t)})),S(i,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{bp({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{bm({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{bg({machineId:n.machineId,paths:e.map(e=>e.path)}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let i=l.find(t=>t.id===e);if(!i)return;let a=t.flatMap(e=>{let t=function e(t,n){for(let r of t){if(r.id===n)return r;let t=r.children?e(r.children,n):void 0;if(t)return t}}(i.children,e);return t?[{machineId:i.machineId,path:t.path,name:t.name}]:[]});if(0===a.length)return;let o={sources:a,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,eb.jsx)(QQ,{transfers:h}),(0,eb.jsx)(QV,{open:m,placement:i,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,eb.jsx)(Q8,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function Q8({move:e,onCancel:t,onConfirm:n}){var r;let i=e?.sources??[],a=Math.max(0,i.length-4);return(0,eb.jsx)(m3,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,eb.jsxs)(gh,{children:[(0,eb.jsxs)(gp,{children:[(0,eb.jsx)(gg,{children:"确认移动"}),(0,eb.jsx)(gv,{children:e?`将 ${1===(r=i).length?r[0]?Q9(r[0]):"0 项":`${r.length} 项`} 移动到 ${Q9(e.target)}`:""})]}),e?(0,eb.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[i.slice(0,4).map(e=>(0,eb.jsx)("span",{className:"truncate",children:Q9(e)},`${e.machineId}:${e.path}`)),a>0?(0,eb.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",a," 项"]}):null]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,eb.jsx)("span",{className:"truncate",children:Q9(e.target)})]})]}):null,(0,eb.jsxs)(gm,{children:[(0,eb.jsx)(gy,{children:"取消"}),(0,eb.jsx)(gx,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function Q7(e){return e.slice(0,10)}function Q9(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function eee({className:e}){return(0,eb.jsx)(Q6,{className:tK("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var eet=["type"],een=["dangerouslySetInnerHTML","ticks","scale"],eer=["id","scale"];function eei(){return(eei=Object.assign.bind()).apply(null,arguments)}function eea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eeo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eea(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eea(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eel(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ees(e){var t=w_(),n=(0,ew.useRef)(null),r=SX(),{type:i}=e,a=eel(e,eet),o=CU(r,"yAxis",i),l=(0,ew.useMemo)(()=>{if(null!=o)return eeo(eeo({},a),{},{type:o})},[o,a]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(_M(l)):n.current!==l&&t(_E({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(_O(n.current)),n.current=null)},[t]),null}function eec(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=wL(Sj),s=SS(),c=w_(),d="yAxis",u=wL(e=>z2(e,t)),f=wL(e=>z1(e,t)),h=wL(e=>z8(e,d,t,s)),p=wL(e=>AM(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!u||N8(i)||(0,ew.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(u.width)!==Math.round(n)&&c(_I({id:t,width:n}))}}},[h,u,c,i,t,r,p]),null==u||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=eel(e,een),{id:y,scale:b}=p,w=eel(p,eer);return ew.createElement(L_,eei({},x,w,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:u.width,height:u.height,className:eH("recharts-".concat(d," ").concat(d),n),viewBox:l,ticks:h,axisType:d,axisId:t}))}var eed={allowDataOverflow:AN.allowDataOverflow,allowDecimals:AN.allowDecimals,allowDuplicatedCategory:AN.allowDuplicatedCategory,angle:AN.angle,axisLine:LE.axisLine,hide:!1,includeHidden:AN.includeHidden,interval:AN.interval,label:!1,minTickGap:AN.minTickGap,mirror:AN.mirror,orientation:AN.orientation,padding:AN.padding,reversed:AN.reversed,scale:AN.scale,tick:AN.tick,tickCount:AN.tickCount,tickLine:LE.tickLine,tickSize:LE.tickSize,type:AN.type,niceTicks:AN.niceTicks,width:AN.width,yAxisId:0},eeu=ew.memo(e=>{var t=Cw(e,eed);return ew.createElement(ew.Fragment,null,ew.createElement(ees,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),ew.createElement(eec,t))},L5);function eef({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===i)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,d=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,eb.jsx)(UR,{value:o.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(Uq,{className:"h-8",children:e.map(e=>(0,eb.jsx)(UK,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,eb.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,eb.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:tK("grid w-full grid-cols-[3.75rem_minmax(0,1fr)] gap-3 px-2 py-2 text-left transition-colors",e.id===c&&"bg-muted"),children:[(0,eb.jsx)(eex,{data:e.data,color:e.color}),(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,eb.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,eb.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:d?.title}),d?.subtitle?(0,eb.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:d.subtitle}):null]}),(0,eb.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:d?.detail})]}),d?(0,eb.jsx)(eeh,{metric:d}):null]})]})]})}function eeh({metric:e}){return"cpu"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:4})]}):"memory"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eeg,{segments:e.composition}),(0,eb.jsx)(eev,{details:e.details,columns:3})]}):"disk"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eep,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:4})]}):"network"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:2})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,eb.jsx)(eep,{panel:e},e.id))}),(0,eb.jsx)(eev,{details:e.details,columns:3})]})}function eep({panel:e,size:t="normal"}){let n={short:"h-[4rem]",normal:"full"===e.span?"h-20":"h-24",large:"h-[17.5rem]",tall:"h-[21.5rem]"}[t];return(0,eb.jsxs)("div",{className:tK("mt-5","full"===e.span&&"col-span-2"),children:[(0,eb.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,eb.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,eb.jsx)(eey,{data:e.data,color:e.color,className:tK("w-full",n)})]})}function eem(){return(0,eb.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{children:"60 秒"}),(0,eb.jsx)("span",{children:"0"})]})}function eeg({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,eb.jsxs)("div",{className:"mt-5",children:[(0,eb.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,eb.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,eb.jsx)("div",{className:tK("h-full border-r border-primary/75 last:border-r-0",0===n?"bg-primary/20":n===t.length-1?"bg-background":"bg-primary/8"),style:{width:`${Math.max(0,e.value)}%`}},`${e.label}-${n}`))})]})}function eev({details:e,columns:t}){return e?.length?(0,eb.jsx)("div",{className:tK("mt-5 grid gap-x-10 gap-y-4",2===t&&"grid-cols-2",3===t&&"grid-cols-3",4===t&&"grid-cols-4"),children:e.map(([e,t])=>(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function eex({data:e,color:t}){return(0,eb.jsx)(eey,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function eey({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:i=!1}){let a=ew.useMemo(()=>(e.length>1?e:[0,0]).map((e,t)=>({index:t,value:Math.max(0,Math.min(100,e))})),[e]),o=ew.useMemo(()=>({value:{label:"Value",color:"danger"===t?"var(--destructive)":"var(--foreground)"}}),[t]);return(0,eb.jsx)(FI,{config:o,className:tK("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:i?96:640,height:i?40:220},children:(0,eb.jsxs)(Lg,{data:a,margin:{top:i?2:6,right:0,bottom:0,left:0},children:[i?null:(0,eb.jsx)(LJ,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,eb.jsx)($i,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,eb.jsx)(eeu,{hide:!0,domain:[0,100]}),i?null:(0,eb.jsx)(FD,{cursor:!1,content:(0,eb.jsx)(FT,{hideLabel:!0,indicator:"line"})}),(0,eb.jsx)(Tb,{dataKey:"value",type:"monotone",fill:"var(--color-value)",fillOpacity:"danger"===t?.16:.12,stroke:"var(--color-value)",strokeWidth:r,isAnimationActive:!1,dot:!1,activeDot:!1})]})})}eeu.displayName="YAxis";let eeb=eN("badge-alert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eew=eN("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),eej={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function eek({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[d,u]=ew.useState({}),f=e.find(e=>e.id===i)??e[0],h=ew.useMemo(()=>{if(!f)return[];let e=[...function(e){let t=new Map,n=new Map;for(let t of e)void 0!==t.pid&&n.set(t.pid,t);for(let i of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let i=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!i||void 0===i.pid||r.has(i.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(eeO(i))?t:e(i,n,r)}(i,n),a=eeO(e),o=t.get(a)??{kind:"group",id:a,name:(r=e,r.appName?.trim()||r.name.trim().replace(/\.(exe|com)$/i,"")||r.id),children:[],status:[],cpu:0,memoryMb:0,diskMbps:0,networkMbps:0};o.children.push(i),o.cpu+=i.cpu,o.memoryMb+=i.memoryMb,o.diskMbps+=i.diskMbps,o.networkMbps+=i.networkMbps,o.status=function(e,t){let n=new Set(e??[]);for(let e of t??[])n.add(e);return Array.from(n)}(o.status,i.status),t.set(a,o)}return Array.from(t.values()).map(e=>({...e,cpu:eeA(Math.min(100,e.cpu)),memoryMb:eeA(e.memoryMb),diskMbps:eeA(e.diskMbps),networkMbps:eeA(e.networkMbps)}))}(f.processes)].sort((e,t)=>eeP(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(eeE(e,0));continue}if(t.push(n),d[n.id])for(let e of[...n.children].sort((e,t)=>eeP(e,t,o,s)))t.push(eeE(e,1))}return t},[f,d,s,o]),p=ew.useMemo(()=>h.map(e=>({memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps})),[h]);function m(e){e===o?c(e=>"asc"===e?"desc":"asc"):(l(e),c("name"===e?"asc":"desc"))}return f?(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,eb.jsx)(UR,{value:f.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(Uq,{className:"h-8",children:e.map(e=>(0,eb.jsx)(UK,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid h-14 shrink-0 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] border-y text-sm",children:[(0,eb.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,eb.jsx)(eeS,{active:"name"===o,direction:s})]}),(0,eb.jsx)("div",{className:"flex items-end px-3 pb-2 text-muted-foreground",children:"状态"}),["cpu","memoryMb","diskMbps","networkMbps"].map(e=>{var t,n;return(0,eb.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,eb.jsx)("span",{className:"text-lg leading-none text-foreground",children:(t=f.totals,"cpu"===(n=e)?`${Math.round(t.cpu)}%`:"memoryMb"===n?`${Math.round(t.memory)}%`:"diskMbps"===n?`${Math.round(t.disk)}%`:"networkMbps"===n?`${Math.round(t.network)}%`:"")}),(0,eb.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[eej[e],(0,eb.jsx)(eeS,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,eb.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,eb.jsxs)("div",{className:tK("grid min-h-9 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] items-center text-sm","group"===e.kind&&"bg-muted/35"),children:[(0,eb.jsx)(eeC,{row:e,expanded:"group"===e.kind&&!!d[e.id],onToggle:()=>{"group"===e.kind&&u(t=>({...t,[e.id]:!t[e.id]}))}}),(0,eb.jsx)(eeN,{platform:f.platform,status:e.status}),(0,eb.jsx)(eeM,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,eb.jsx)(eeM,{value:e.memoryMb,max:eez(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${eeI(t/1024)} GB`:`${eeI(t)} MB`}),(0,eb.jsx)(eeM,{value:e.diskMbps,max:Math.max(1,eez(p,"diskMbps")),label:`${eeI(e.diskMbps)} MB/秒`}),(0,eb.jsx)(eeM,{value:e.networkMbps,max:Math.max(1,eez(p,"networkMbps")),label:`${eeI(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function eeS({active:e,direction:t,className:n}){return e?(0,eb.jsx)("asc"===t?U0:G5,{className:tK("ml-1 size-3",n)}):null}function eeC({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?cE:va;return(0,eb.jsxs)("button",{type:"button","aria-expanded":t,onClick:n,className:"flex h-full min-w-0 items-center gap-2 px-3 text-left outline-none transition-colors hover:bg-muted/55 focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,eb.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,eb.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-3",style:{paddingLeft:e.depth>0?34:void 0},children:[e.depth>0?(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,eb.jsx)("span",{className:tK("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function eeN({platform:e,status:t}){return t?.length?(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,eb.jsx)(eew,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,eb.jsx)(s9,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,eb.jsx)(eeb,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,eb.jsx)("div",{className:"px-3"})}function eeM({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),i=r>.78,a=i?`color-mix(in oklch, var(--destructive) ${Math.round(18+42*r)}%, var(--background))`:`color-mix(in oklch, var(--foreground) ${Math.round(5+20*r)}%, var(--background))`;return(0,eb.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":i?"":void 0,style:{background:a},children:(0,eb.jsx)("span",{className:tK("leading-9",i&&"text-destructive"),children:n})})}function eeE(e,t){return{kind:"process",id:e.id,process:e,depth:t,name:e.appName&&0===t?e.appName:e.name,status:e.status,cpu:e.cpu,memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps}}function eeO(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function eeP(e,t,n,r){let i="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*i:(e[n]-t[n])*i}function eeA(e){return Math.round(10*e)/10}function eez(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function eeI(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function ee_({className:e}){let t=eeT("/api/local/machines/processes");return(0,eb.jsx)(eek,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eeD({className:e}){let t=eeT("/api/local/machines/performance");return(0,eb.jsx)(eef,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eeT(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function i(){if(!r){r=!0;try{let r=await fetch(e,{cache:"no-store"});if(!r.ok)return;let i=await r.json();t&&n(i.machines)}catch{t&&n([])}finally{r=!1}}}i();let a=window.setInterval(i,2e3);return()=>{t=!1,window.clearInterval(a)}},[e]),t}let eeR=eN("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eeL=eN("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ee$={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},eeF=[{id:"powershell",title:"PowerShell",shell:"PowerShell",cwd:"D:\\Projects\\Vantaloom-ui",status:"idle",initialOutput:"PowerShell 7.6.1\r\nPS D:\\Projects\\Vantaloom-ui> "}];function eeV(e,t,n){return e.getPropertyValue(t).trim()||n}function eeB(e,t=!1){let n=getComputedStyle(e),r=eeV(n,"--foreground","#18181b"),i=eeV(n,"--terminal-background",eeV(n,"--background","#ffffff")),a="transparent"===i?eeV(n,"--background","#ffffff"):i,o=eeV(n,"--muted-foreground","#71717a"),l=eeV(n,"--border","#e4e4e7"),s=eeV(n,"--selection","#18181b");return{background:i,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":a,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:eeV(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:eeV(n,"--terminal-red","#bf616a"),green:eeV(n,"--terminal-green","#5e8c61"),yellow:eeV(n,"--terminal-yellow","#b06f3c"),blue:eeV(n,"--terminal-blue","#5e81ac"),magenta:eeV(n,"--terminal-magenta","#b48ead"),cyan:eeV(n,"--terminal-cyan","#4c8da8"),white:i,brightBlack:o,brightRed:eeV(n,"--terminal-bright-red","#d06f79"),brightGreen:eeV(n,"--terminal-bright-green","#6b9a70"),brightYellow:eeV(n,"--terminal-bright-yellow","#c2824b"),brightBlue:eeV(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:eeV(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:eeV(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function eeH(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function eeW({initialOutput:t,data:n,dataKey:r,options:i,readOnly:a=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:d,labels:u,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:ee$.loading,...u}),[u]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(d),j=ew.useRef(i),k=ew.useRef(a),S=ew.useRef(l),C=ew.useRef(!1),N=ew.useRef(void 0),M=ew.useRef(!1),[E,O]=ew.useState(!1);return ew.useEffect(()=>{y.current=s,b.current=c,w.current=d,j.current=i,k.current=a,S.current=l},[l,s,d,c,i,a]),ew.useEffect(()=>{let n,r=!1,i=[];!async function(){var a;let l,s,c,d,u;if(!g.current||M.current)return;M.current=!0;let[{Terminal:f},{FitAddon:h},{SearchAddon:p},{WebLinksAddon:m}]=await Promise.all([e.A(93626),e.A(16118),e.A(24306),e.A(46866)]);if(r||!g.current)return;let N=new f({convertEol:!1,cursorBlink:!0,cursorStyle:"block",drawBoldTextInBrightColors:!1,fontFamily:(l=getComputedStyle(a=g.current),u=(c=eeV(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),d=getComputedStyle(a),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>d.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${u||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:eeB(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function z(){try{E.fit(),b.current?.({cols:N.cols,rows:N.rows})}catch{}}for(let e of(N.loadAddon(E),N.loadAddon(P),N.loadAddon(A),N.open(g.current),v.current=N,x.current=E,O(!0),requestAnimationFrame(z),(n=new ResizeObserver(z)).observe(g.current),i.push(N.onData(e=>{k.current||(S.current&&("\r"===e?N.write("\r\n"):""===e?N.write("\b \b"):N.write(e)),y.current?.(e))})),eeH(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:z,focus:()=>N.focus(),clear:()=>N.clear(),setCursorSuppressed:function(e){let t=g.current;t&&(C.current=e,t.toggleAttribute("data-vtl-terminal-cursor-suppressed",e),N.options.theme=eeB(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let a=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=eeB(t,C.current))});return a.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,a.disconnect(),n?.disconnect(),i))e.dispose();v.current?.dispose(),v.current=null,x.current=void 0,C.current=!1,M.current=!1,O(!1)}},[o,t]),ew.useEffect(()=>{let e=v.current;if(e&&N.current!==r)for(let t of(N.current=r,eeH(n)))e.write(t)},[n,r]),(0,eb.jsxs)("div",{"data-slot":"terminal-tab-surface",className:tK("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,eb.jsx)("div",{ref:g,className:tK("vtl-terminal-xterm size-full overflow-hidden p-1.5 font-mono","[&_.xterm]:h-full [&_.xterm]:p-0 [&_.xterm-viewport]:!bg-transparent","[&_.xterm-screen]:!bg-transparent [&_.xterm-helper-textarea]:!outline-none","[&[data-vtl-terminal-cursor-suppressed]_.xterm-cursor]:!opacity-0","[&_.xterm-viewport::-webkit-scrollbar]:w-2.5 [&_.xterm-viewport::-webkit-scrollbar-track]:bg-transparent","[&_.xterm-viewport::-webkit-scrollbar-thumb]:rounded-full [&_.xterm-viewport::-webkit-scrollbar-thumb]:border-[3px]","[&_.xterm-viewport::-webkit-scrollbar-thumb]:border-transparent [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-border [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-clip-content",h)}),!E&&(0,eb.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function eeU({status:e="idle"}){return"running"===e?(0,eb.jsx)(eeL,{className:"size-3.5 text-foreground"}):"success"===e?(0,eb.jsx)(Uc,{className:"size-3.5 text-foreground"}):"error"===e?(0,eb.jsx)(eeR,{className:"size-3.5 text-destructive"}):(0,eb.jsx)(ye,{className:"size-3.5 text-muted-foreground"})}function eeq({sessions:e,defaultSessions:t=eeF,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:i,onSessionsChange:a,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:d,showTabs:u=!0,allowCreateSession:f=!0,readOnly:h=!1,localEcho:p=!1,terminalOptions:m,labels:g,className:v,tabListClassName:x,terminalClassName:y,...b}){let w=ew.useMemo(()=>({...ee$,...g,status:{...ee$.status,...g?.status}}),[g]),[j,k]=ew.useState(t),S=e??j,C=S[0],[N,M]=ew.useState(r??C?.id),E=n??(S.some(e=>e.id===N)?N:C?.id),O=S.find(e=>e.id===E)??C;function P(t){void 0===e&&k(t),a?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),i?.(e.id,e))}return(0,eb.jsxs)("div",{"data-slot":"terminal-tab-group",className:tK("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",u?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[u&&(0,eb.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:tK("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,eb.jsx)(mH,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:S.map(e=>{let t=e.id===O?.id;return(0,eb.jsxs)("div",{className:tK("group flex h-7 min-w-0 shrink-0 items-center rounded-md border border-transparent ui-text-control","transition-colors hover:bg-background/80",t?"bg-background text-foreground shadow-xs":"text-muted-foreground",e.disabled&&"pointer-events-none opacity-50"),children:[(0,eb.jsxs)("button",{type:"button",role:"tab","aria-selected":t,"aria-controls":`terminal-panel-${e.id}`,disabled:e.disabled,onClick:()=>A(e),className:"flex h-full min-w-0 items-center gap-1.5 rounded-md px-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,eb.jsx)(eeU,{status:e.status}),(0,eb.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,eb.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,eb.jsx)("button",{type:"button","aria-label":w.closeTerminal(e.title),onClick:t=>{t.stopPropagation();l?.(e.id,e);let n=S.filter(t=>t.id!==e.id);if(P(n),e.id===E){let e=n.at(-1);e&&A(e)}},className:"mr-1 grid size-4 place-items-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/20 group-hover:opacity-100",children:(0,eb.jsx)(p6,{className:"size-3"})})]},e.id)})}),f&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":w.newTerminal,onClick:function(){let e=o?.()??{id:`terminal-${Date.now()}`,title:`Terminal ${S.length+1}`,status:"idle",initialOutput:"",closable:!0};P([...S,e]),A(e)},className:"size-7 shrink-0",children:(0,eb.jsx)(s7,{className:"size-3.5"})})]}),(0,eb.jsx)("div",{"data-slot":"terminal-tab-panels",className:"relative min-h-0 overflow-hidden",children:S.map(e=>{let t=e.id===O?.id;return(0,eb.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:tK("absolute inset-0 min-h-0",t?"z-10 opacity-100":"z-0 opacity-0"),children:(0,eb.jsx)(eeW,{initialOutput:e.initialOutput,options:{...m,...e.options},readOnly:h||e.disabled,localEcho:p,autoFocus:t,onData:t=>s?.(e.id,t),onResize:t=>c?.(e.id,t),onReady:t=>d?.(e.id,t),labels:w,terminalClassName:y})},e.id)})})]})}function eeK({className:e,scopeId:t,state:n,onStateChange:r}){let[i,a]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[d,u]=ew.useState("local"),[f,h]=ew.useState(),[p,m]=ew.useState(!1),[g,v]=ew.useState(!1),x=ew.useRef(new Map),y=ew.useRef(new Map),b=ew.useRef(new Map),w=ew.useRef(new Map),j=ew.useRef(new Map),k=ew.useRef(new Map),S=ew.useRef(new Map),C=ew.useRef(new Map),N=ew.useRef(!1),M=ew.useRef(n?.autoStart===!1),E=ew.useRef(n),O=ew.useRef(r),P=Array.isArray(n?.sessionIds)?n.sessionIds.join("\0"):"__all__",A=t?.trim()||void 0,z=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let I=i.find(e=>e.id===d)??i[0],_=I?.shells.find(e=>e.id===f)??I?.shells[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),T=D.join("\0"),R=ew.useCallback((e,t)=>{let n=y.current.get(e);if(t){let t=j.current.get(e);void 0!==t&&(window.clearTimeout(t),j.current.delete(e))}n?.setCursorSuppressed(t)},[]),L=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),R(e,!1)},90);j.current.set(e,n)},[R]),$=ew.useCallback(e=>{let t=w.current.get(e),n=y.current.get(e);if(!t||!n||t.writing)return;if(!t.buffer){w.current.delete(e),L(e);return}void 0!==t.drainTimer&&(window.clearTimeout(t.drainTimer),t.drainTimer=void 0);let r=t.buffer.slice(0,65536);t.buffer=t.buffer.slice(r.length),t.writing=!0,R(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>$(e),0):(w.current.delete(e),L(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),L(e)}},[L,R]),F=ew.useCallback((e,t)=>{if(!t)return;if(!y.current.get(e))return void b.current.set(e,`${b.current.get(e)??""}${t}`);let n=w.current.get(e);(n||(n={buffer:"",writing:!1},w.current.set(e,n)),n.buffer+=t,R(e,!0),n.buffer.length>=65536)?$(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>$(e),8))},[$,R]),V=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?F(e,t.data):"status"===t.type&&t.status&&l(n=>n.map(n=>n.id===e?{...n,status:t.status??n.status,updatedAt:t.createdAt}:n))},[F]),B=ew.useCallback(e=>{if(x.current.has(e))return;let t=new EventSource(function(e,t=0){let n=new URLSearchParams;t>0&&n.set("after",String(t));let r=n.toString();return`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`}(e,k.current.get(e)??0));t.onmessage=t=>{try{V(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[V]),H=ew.useCallback(async()=>{if(I&&!p){M.current=!1,m(!0);try{let e=await Wt({machineId:I.id,scopeId:A,shell:_?.id,cwd:I.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),B(e.id)}catch{return}finally{m(!1)}}},[p,B,I,_,A]);function W(e){let t=S.current.get(e);return t||(t={buffer:"",inFlight:!1},S.current.set(e,t)),t}return ew.useEffect(()=>{let e=!0;return v(!1),async function(){try{let t=E.current,n=t?.sessionIds,r=Array.isArray(n)?new Set(n):void 0,[i,o]=await Promise.all([H9(),We(A)]);if(!e)return;let s=r?o.sessions.filter(e=>r.has(e.id)):o.sessions;N.current=!1,M.current=t?.autoStart===!1,a(i.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let d=i.machines[0];if(d){let e=i.machines.find(e=>e.id===t?.selectedMachineId)??d;u(e.id),h(n=>t?.selectedShellId&&e.shells.some(e=>e.id===t.selectedShellId)?t.selectedShellId:n&&e.shells.some(e=>e.id===n)?n:e.shells[0]?.id)}}finally{e&&v(!0)}}(),()=>{e=!1}},[P,A,z]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:d,selectedShellId:f,autoStart:!M.current})},[s,g,d,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)B(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[B,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===i.length||(N.current=!0,H())},[H,g,i.length,o.length]),ew.useEffect(()=>()=>{for(let e of x.current.values())e.close();for(let e of S.current.values())void 0!==e.timer&&window.clearTimeout(e.timer);for(let e of w.current.values())void 0!==e.drainTimer&&window.clearTimeout(e.drainTimer);for(let[e,t]of j.current)window.clearTimeout(t),R(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[R]),(0,eb.jsxs)("div",{className:tK("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,eb.jsxs)(JR,{value:I?.id,onValueChange:e=>{u(e);let t=i.find(t=>t.id===e);h(t?.shells[0]?.id)},children:[(0,eb.jsxs)(Qp,{size:"sm",className:"max-w-44",children:[(0,eb.jsx)(vb,{className:"size-3.5"}),(0,eb.jsx)(JV,{placeholder:"机器"})]}),(0,eb.jsx)(Qv,{align:"start",children:i.map(e=>(0,eb.jsx)(Qx,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsxs)(JR,{value:_?.id,onValueChange:h,children:[(0,eb.jsx)(Qp,{size:"sm",className:"max-w-44",children:(0,eb.jsx)(JV,{placeholder:"Shell"})}),(0,eb.jsx)(Qv,{align:"start",children:I?.shells.map(e=>(0,eb.jsx)(Qx,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!I||p,onClick:()=>void H(),className:"ml-auto",children:(0,eb.jsx)(s7,{className:"size-4"})})]}),(0,eb.jsx)(eeq,{sessions:o.map(eeG),activeSessionId:s,allowCreateSession:!1,localEcho:!1,labels:{loading:"启动终端...",terminalList:"终端会话",closeTerminal:e=>`关闭 ${e}`},onActiveSessionChange:e=>c(e),onCloseSession:e=>{let t,n,r;return x.current.get(e)?.close(),x.current.delete(e),y.current.delete(e),b.current.delete(e),t=w.current.get(e),t?.drainTimer!==void 0&&window.clearTimeout(t.drainTimer),w.current.delete(e),k.current.delete(e),void 0!==(n=j.current.get(e))&&(window.clearTimeout(n),j.current.delete(e)),r=S.current.get(e),void(r?.timer!==void 0&&window.clearTimeout(r.timer),S.current.delete(e),C.current.delete(e),l(t=>{let n=t.filter(t=>t.id!==e);return 0===n.length&&(M.current=!0),c(t=>t&&t!==e&&n.some(e=>e.id===t)?t:n[0]?.id),n}),Wn(e).catch(()=>{}))},onSessionData:function(e,t){let n=W(e);n.buffer+=t,function e(t){let n=W(t);n.inFlight||void 0!==n.timer||(n.timer=window.setTimeout(()=>{n.timer=void 0,function(t){let n=S.current.get(t);if(!n||n.inFlight)return;let r=n.buffer;if(n.buffer="",!r){void 0===n.timer&&S.current.delete(t);return}n.inFlight=!0,Wr(t,r).catch(()=>{}).finally(()=>{let n=S.current.get(t);n&&(n.inFlight=!1,n.buffer?e(t):void 0===n.timer&&S.current.delete(t))})}(t)},6))}(e)},onSessionResize:function(e,t){let n=`${t.cols}x${t.rows}`;C.current.get(e)!==n&&(C.current.set(e,n),Wi(e,t).then(e=>{l(t=>t.map(t=>t.id===e.id?{...t,...e}:t))}).catch(()=>{}))},onSessionReady:function(e,t){y.current.set(e,t);let n=b.current.get(e);n&&(b.current.delete(e),F(e,n))},className:"min-h-0 rounded-none border-0"})]})}function eeG(e){return{id:e.id,title:e.title,shell:e.machineName,cwd:e.cwd,status:function(e){switch(e){case"running":return"running";case"exited":case"closed":return"success";case"failed":return"error";default:return"idle"}}(e.status),closable:!0,initialOutput:""}}function eeY(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=HK("file-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(KX,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(Ja,{className:`${n} border-0`,file:i??r.file,value:e.defaultValue??r.defaultValue??"",defaultValue:e.defaultValue??r.defaultValue,view:e.defaultView,mode:e.defaultMode,modified:e.modified,onValueChange:n=>t.onTabChange?.({...e,defaultValue:n,modified:!0}),onViewChange:n=>t.onTabChange?.({...e,defaultView:n}),onModeChange:n=>t.onTabChange?.({...e,defaultMode:n}),onSave:t.onSaveFileTab?n=>t.onSaveFileTab?.(e,n):void 0,onHistory:()=>t.onOpenFileHistory?.(e),labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中",history:"历史版本"}})}case"browser-tab-viewer":return(0,eb.jsx)(Ge,{className:`${n} border-0`,defaultUrl:e.defaultUrl??HK("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=HK("diff-tab-viewer");return(0,eb.jsx)(Yu,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=HK("data-table-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(KX,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(G9,{className:`${n} border-0`,file:{name:i?.name??r.file?.name??"data",path:i?.path??r.file?.path,type:eeX(e)},source:void 0!==e.defaultValue?{type:eeX(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,eb.jsx)(eeK,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function eeX(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function eeZ(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e){case"multi-tab-system":{let e=t.nodeId,r=void 0!==t.tabs?t.tabs:[];return(0,eb.jsx)(Jc,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:Hq(n.kind),content:eeY(n,{terminalScopeId:e?`${t.terminalScopeId??`canvas:node:${e}`}:tab:${n.id}`:t.terminalScopeId,terminalState:n.terminal,onTerminalStateChange:r=>e?t.onTabChange?.(e,{...n,terminal:r}):void 0,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length}),onTabChange:n=>{e&&t.onTabChange?.(e,n)},onSaveFileTab:(n,r)=>e?t.onSaveFileTab?.(e,n,r):void 0,onOpenFileHistory:n=>e?t.onOpenFileHistory?.(e,n):void 0})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[fr],createLabel:"打开文件",emptyContent:(0,eb.jsx)(KX,{onChooseFile:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})}),onCreateTab:()=>{t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})},onActiveTabChange:n=>{e&&t.onActiveTabChange?.(e,n)},onTabsChange:n=>{if(!e)return;let i=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,i)},onTabDetach:(n,i)=>{if(!e)return!1;let a=r.find(e=>e.id===n.id);return!!a&&t.onTabDetach?.(e,a,{clientX:i.clientX,clientY:i.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,eb.jsx)(KG,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,eb.jsx)(QR,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,eb.jsx)(ee_,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,eb.jsx)(eeD,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,eb.jsx)("div",{className:`${n} bg-card`,children:(0,eb.jsx)(Q_,{})});case"machine-file-management":return(0,eb.jsx)(eee,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,eb.jsx)(Kw,{className:`${n} vtl-canvas-agent-conversation-node`,composerClassName:"max-w-[42rem]"});case"file-tab-viewer":case"browser-tab-viewer":case"diff-tab-viewer":case"data-table-tab-viewer":case"terminal-tab-group":return eeY(t.tab??HK(e,`${e}-tab`),{terminalState:t.terminalState,terminalScopeId:t.terminalScopeId,onTerminalStateChange:t.onTerminalStateChange,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:t.nodeId}),onTabChange:e=>{t.nodeId&&t.onTabChange?.(t.nodeId,e)},onSaveFileTab:(e,n)=>t.nodeId?t.onSaveFileTab?.(t.nodeId,e,n):void 0,onOpenFileHistory:e=>t.nodeId?t.onOpenFileHistory?.(t.nodeId,e):void 0})}}function eeJ({kind:e,...t}){return eeZ(e,t)}let eeQ="application/vnd.vantaloom.agent-pane-shredder",ee0="application/vnd.vantaloom.agent-pane-cutter",ee1=[{id:"quad",label:"四分",slots:4,icon:(0,eb.jsx)(vy,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,eb.jsx)(K0,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,eb.jsx)(KZ,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,eb.jsx)(nw,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,eb.jsx)(HP,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,eb.jsx)(K0,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,eb.jsx)(KQ,{})},{id:"single",label:"整窗口",slots:1,icon:(0,eb.jsx)(KJ,{})}];function ee2(e,t,n=[50,50]){let r=e?.[t],i=r?.[0],a=r?.[1];return["number"==typeof i&&i>0?i:n[0],"number"==typeof a&&a>0?a:n[1]]}function ee5(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function ee4(e,t){return[e[t[0]]??50,e[t[1]]??50]}function ee3({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,eb.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=ee2(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(i,e),onLayoutChanged:e=>n?.("outer",ee4(e,i)),children:[(0,eb.jsx)(Ul,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=ee2(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(i,e),onLayoutChanged:e=>n?.("outer",ee4(e,i)),children:[(0,eb.jsx)(Ul,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=ee2(t,"outer",[58,42]),i=ee2(t,"left"),a=["left","right"],o=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("left",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:20,children:r[1]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=ee2(t,"outer",[42,58]),i=ee2(t,"right"),a=["left","right"],o=["pane-1","pane-2"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("right",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:20,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=ee2(t,"outer",[58,42]),i=ee2(t,"top"),a=["top","bottom"],o=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("top",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:24,children:r[1]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=ee2(t,"outer",[42,58]),i=ee2(t,"bottom"),a=["top","bottom"],o=["pane-1","pane-2"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("bottom",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:24,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:24,children:r[2]})]})})]})}let i=ee2(t,"outer"),a=ee2(t,"left"),o=ee2(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(l,i),onLayoutChanged:e=>n?.("outer",ee4(e,l)),children:[(0,eb.jsx)(Ul,{id:l[0],defaultSize:i[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(s,a),onLayoutChanged:e=>n?.("left",ee4(e,s)),children:[(0,eb.jsx)(Ul,{id:s[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:s[1],defaultSize:a[1],minSize:20,children:r[2]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:l[1],defaultSize:i[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(c,o),onLayoutChanged:e=>n?.("right",ee4(e,c)),children:[(0,eb.jsx)(Ul,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function ee6({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:i,onAdd:a,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:d,onRequestFileTab:u,onOpenWorkspaceFile:f,onSaveFileTab:h,onOpenFileHistory:p}){let[m,g]=ew.useState();return(0,eb.jsx)("div",{"data-agent-pane":t,className:tK("relative size-full min-h-0 min-w-0 overflow-hidden",n?.kind!=="subagent-conversation-panel"&&"bg-background","vtl-agent-workspace-pane",n?.kind==="subagent-conversation-panel"&&"vtl-agent-workspace-conversation-pane bg-transparent","panel"===m&&"ring-2 ring-foreground/60 ring-inset","shredder"===m&&"ring-2 ring-destructive/70 ring-inset","cutter"===m&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(ee0)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("cutter");return}if(t.includes(eeQ)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("shredder");return}t.includes(UJ)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",g("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||g(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(ee0)){e.preventDefault(),e.stopPropagation(),g(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(eeQ)){e.preventDefault(),e.stopPropagation(),g(void 0),s(t);return}let n=function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),n=r.find(e=>e.id===t),i=n?n.payloads?.[UJ]:void 0;if(n&&i)return{item:n,content:i.content};let a=e.dataTransfer.getData(UJ);if(a)try{let e=JSON.parse(a);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),g(void 0),o(t,n.item,n.content))},children:n?(0,eb.jsx)("div",{className:tK("size-full min-h-0 min-w-0 overflow-hidden rounded-none","vtl-agent-pane-content","subagent-conversation-panel"===n.kind&&"vtl-agent-pane-conversation-content",i&&"pointer-events-none"),children:UZ(n)?eeZ(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{var r;r=n.terminal,((r?.activeSessionId??"")!==(e.activeSessionId??"")||(r?.selectedMachineId??"")!==(e.selectedMachineId??"")||(r?.selectedShellId??"")!==(e.selectedShellId??"")||(r?.autoStart??!0)!==(e.autoStart??!0)||(r?.sessionIds??[]).join("\0")!==e.sessionIds.join("\0"))&&l(t,{...n,terminal:e})},workspaceFolders:d,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>u?.(t,e),onOpenWorkspaceFile:f,onTabsChange:(e,r)=>{l(t,{...n,tabs:r,activeTabId:r.some(e=>e.id===n.activeTabId)?n.activeTabId:r[0]?.id})},onTabChange:(e,r)=>{"multi-tab-system"===n.kind?l(t,{...n,tabs:(n.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):l(t,{...n,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>h?.(t,n,r),onOpenFileHistory:(e,n)=>p?.(t,n),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,eb.jsx)(Kw,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,eb.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:a,children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加"]})})})}function ee8({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索组件..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配组件。"}),(0,eb.jsx)(ml,{heading:"可放入窗口",children:UY.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,eb.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsx)(mc,{children:"添加"})]},e.id))})]})]})})}let ee7=[],ee9="vantaloom:file-system-changed";function ete(e){var t;let n=(t=e?.layoutMode,ee1.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",i=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};let t=e.shell&&"object"==typeof e.shell&&!Array.isArray(e.shell)?e.shell:void 0,n={};for(let e of["agent","panes"]){let r=t?.[e];"number"==typeof r&&Number.isFinite(r)&&r>0&&(n[e]=r)}return{...Object.keys(n).length?{shell:n}:{},outer:ett(e.outer),left:ett(e.left),right:ett(e.right),top:ett(e.top),bottom:ett(e.bottom)}}(e?.sizes),a=Array.from({length:Math.max(4,ee1.find(e=>e.id===n)?.slots??4)},()=>void 0);for(let[t,n]of(e?.panes??[]).entries()){let e=Number.isInteger(n.slot)?n.slot:t;e<0||e>=a.length||(a[e]=function(e,t){var n,r;let i=e.paneId||`${e.kind}-${t+1}`,a=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:i,kind:"subagent-conversation-panel",title:etr(a.title)??"Subagent",subagentId:etr(a.subagentId)??i,events:Array.isArray(a.events)?a.events:[]};if(!UX(e.kind))return;let o=a.tab&&"object"==typeof a.tab?a.tab:void 0,l=Array.isArray(a.tabs)?a.tabs.filter(e=>HU(e?.kind)):void 0,s=UX(e.kind);return{id:i,kind:e.kind,title:etr(a.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:etr(a.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=a.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:etr(r.activeSessionId),selectedMachineId:etr(r.selectedMachineId),selectedShellId:etr(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:i,panes:a}}function ett(e){if(!Array.isArray(e))return;let t=e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0);return t.length?t:void 0}function etn(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function etr(e){return"string"==typeof e&&e.trim()?e:void 0}function eti(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function eta(e){return e.reduce((e,t)=>Math.max(e,eti(t)),0)}function eto({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:i,onOverlayOpenChange:a}){let o=ete(e?.panes),[l,s]=ew.useState(o.layoutMode),[c,d]=ew.useState(o.agentPosition),[u,f]=ew.useState(o.layoutSizes),[h,p]=ew.useState(()=>o.panes),[m,g]=ew.useState(()=>e?.events??[]),[v,x]=ew.useState(""),[y,b]=ew.useState(e?.conversation.status==="working"),[w,j]=ew.useState(e?.conversation.status??"idle"),[k,S]=ew.useState(),[C,N]=ew.useState(),[M,E]=ew.useState(),O=ew.useRef(eta(o.panes)),P=ew.useRef(0),A=ew.useRef(""),z=ee1.find(e=>e.id===l)?.slots??4,I=e?.conversation.settings.folders??ee7,{models:_}=g5(),D=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?_.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[_,e?.conversation.settings.mainModels]),T=y||"working"===w,R=ew.useCallback(async e=>{if("file-tab-viewer"!==e.kind||e.modified||e.file?.readOnly)return e;try{var t,n;let r=await HQ(e);return(t=e,n=r,t.defaultValue!==n.defaultValue||t.title!==n.title||t.file?.size!==n.file?.size||t.file?.mimeType!==n.file?.mimeType||t.file?.previewContent!==n.file?.previewContent||t.file?.src!==n.file?.src||t.file?.truncated!==n.file?.truncated)?r:e}catch{return e}},[]),L=ew.useCallback(async e=>{if(!e||!UZ(e))return e;if("multi-tab-system"===e.kind){var t,n;let r=e.tabs??[],i=await Promise.all(r.map(R));return(t=r,n=i,t.length!==n.length||t.some((e,t)=>e!==n[t]))?{...e,tabs:i}:e}if("file-tab-viewer"===e.kind&&e.tab){let t=await R(e.tab);return t!==e.tab?{...e,title:t.title,tab:t}:e}return e},[R]),$=ew.useCallback(async()=>{var e,t;let n=await Promise.all(h.map(async e=>L(e)));e=h,t=n,(e.length!==t.length||e.some((e,n)=>e!==t[n]))&&p(n)},[h,L]);function F(e){if(!e.length)return;let t=e.map(UQ);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}function V(e,t,n){if(!e||!UZ(e))return e;if("multi-tab-system"===e.kind){var r;let i,a;return{...e,tabs:(r=e.tabs??[],i=r.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}function B(e,t){return e&&UZ(e)?"multi-tab-system"===e.kind?{...e,tabs:(e.tabs??[]).map(e=>e.id===t.id?t:e),activeTabId:t.id}:"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e:e}async function H(e,t,n){try{let r=await HZ(e);p(e=>e.map((e,i)=>i===t?V(e,r,n):e))}catch{US.error("文件预览打开失败")}}function W(e){let t=h.slice(0,z).findIndex(e=>e?.kind==="multi-tab-system");t<0?US.warning("请先放入一个多标签页组件"):H(e,t)}async function U(e,t,n){let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw US.error("文件路径不可用"),Error("file path is unavailable");try{let a=await bh({machineId:i,path:r,content:n}),o={...await HJ(a,{id:t.id,title:t.title,defaultView:t.defaultView,defaultMode:t.defaultMode}),modified:!1};p(t=>t.map((t,n)=>n===e?B(t,o):t)),window.dispatchEvent(new CustomEvent(ee9)),US.success("文件已保存")}catch(e){throw US.error("文件保存失败"),e}}async function q(t){let n=e?.conversation.id,r=M?.tab.file?.path,i=M?.tab.file?.machineId??"local";if(M&&n&&r)try{let e=await Hw(n,{machineId:i,path:r,mutationId:t.mutationId,state:t.state}),a=await HJ(e,{id:M.tab.id,title:`${e.name} @ ${ets(t.mutationId)} ${"before"===t.state?"before":"after"}`,readOnly:!0,defaultView:M.tab.defaultView,defaultMode:"review"});p(e=>e.map((e,t)=>t===M.paneIndex?B(e,a):e)),E(void 0)}catch{US.error("历史版本打开失败")}}function K(e,t,n){let a=h[e];O.current=Math.max(O.current,eti(n)),p(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!a)return n;let r=UQ(a);return[r,...n.filter(e=>e.id!==r.id)]}),i?.(void 0)}function G(e,t){p(n=>n.map((n,r)=>r===e?t:n))}function Y(e){var t=h[e];if(t&&UZ(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])Wn(e).catch(()=>{});p(t=>t.map((t,n)=>n===e?void 0:t))}function X(e){let t=h[e];t&&F([t]),p(t=>t.map((t,n)=>n===e?void 0:t))}async function Z(t,n="chat"){let r=e?.conversation.id,i=v||D[0]?.id;if(r){if(!i)return void US.error("请先在代理模型配置里选择模型");b(!0),j("working");try{let e=await Hx(r,{message:t,modelRef:i,mode:n});g(e.events),j(e.conversation.status)}catch(e){b(!1),j("idle"),US.error(e instanceof Error?e.message:"对话请求失败")}}}async function J(t){let n=e?.conversation.id,r=("string"==typeof t.modelRef?t.modelRef.trim():"")||v||D[0]?.id,i="agent"===t.mode?"agent":"chat";if(n){if(!r)return void US.error("请先在代理模型配置里选择模型");b(!0),j("working");try{let e=await Hy(n,{modelRef:r,mode:i});g(e.events),j(e.conversation.status)}catch(e){b(!1),j("idle"),US.error(e instanceof Error?e.message:"对话重试失败")}}}ew.useEffect(()=>{a?.(void 0!==k||void 0!==C||void 0!==M)},[C,M,a,k]),ew.useEffect(()=>{g(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{b(e?.conversation.status==="working"),j(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{let e=D[0]?.id??"";x(t=>D.some(e=>e.id===t)?t:e)},[D]),ew.useEffect(()=>{let t=ete(e?.panes);s(t.layoutMode),d(t.agentPosition),f(t.layoutSizes),p(t.panes),O.current=eta(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id;if(!n||!T)return;let r=new EventSource(gZ(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return r.addEventListener("detail",e=>{try{let t=Hj(JSON.parse(e.data));g(t.events),j(t.conversation.status),"working"!==t.conversation.status&&(b(!1),r.close())}catch{return}}),r.onerror=()=>{r.close(),void 0===t&&(t=window.setInterval(async()=>{try{let e=await Hf(n);g(e.events),j(e.conversation.status),"working"!==e.conversation.status&&(b(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},350))},()=>{r.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,T]),ew.useEffect(()=>{if(!e?.conversation.id)return;let t=window.setInterval(()=>{$()},3e3);return()=>window.clearInterval(t)},[e?.conversation.id,$]),ew.useEffect(()=>{let e=m.filter(e=>"change"===e.kind).map(e=>`${e.id}:${e.status??""}:${e.isStreaming?"1":"0"}`).join("|");e&&e!==A.current&&(A.current=e,window.dispatchEvent(new CustomEvent(ee9)),$())},[m,$]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{let e;Hv(t,(e=[],h.forEach((t,n)=>{if(t){if(UZ(t))return void e.push({paneId:t.id,slot:n,kind:t.kind,machineId:t.terminal?.selectedMachineId,resourceId:t.terminal?.activeSessionId,props:{title:t.title,tab:t.tab,tabs:t.tabs,activeTabId:t.activeTabId,terminal:t.terminal}});e.push({paneId:t.id,slot:n,kind:t.kind,props:{title:t.title,subagentId:t.subagentId,events:t.events}})}}),{layoutMode:l,agentPosition:c,sizes:u,panes:e}))},300);return()=>window.clearTimeout(n)},[c,e?.conversation.id,l,u,h]);let Q=Array.from({length:z},(r,i)=>(0,eb.jsx)(ee6,{conversationId:e?.conversation.id,index:i,content:h[i],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>S(i),onPanelDrop:K,onContentChange:G,onClear:Y,onCut:X,workspaceFolders:I,onRequestFileTab:(e,t)=>N({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:W,onSaveFileTab:U,onOpenFileHistory:(e,t)=>E({paneIndex:e,tab:t})},i)),ee=h.slice(0,z).some(e=>e?.kind==="subagent-conversation-panel"),et=u.shell?.agent??42,en=u.shell?.panes??58,er=(0,eb.jsx)(Ul,{id:"agent",defaultSize:et,minSize:28,children:(0,eb.jsx)(Kw,{events:e?m:void 0,models:e?D:void 0,modelId:v,running:T,disabled:!!e&&0===D.length,onModelChange:x,onSubmit:e?e=>{Z(e.value,"agent"===e.modeId?"agent":"chat")}:void 0,onOpenFile:function(e){let t=e.path?.trim()||e.name.trim();("diff"===e.kind||"diff"===e.meta)&&e.diff?function(e){let t=h.slice(0,z).findIndex(e=>e?.kind==="multi-tab-system");if(t<0)return US.warning("请先放入一个多标签页组件");let n=e.path?.trim()||e.name.trim(),r={id:function(e,t){let n=0x811c9dc5;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,0x1000193);return`${e}-${(n>>>0).toString(36)}`}("diff",`${e.mutationId??""}|${e.machineId??"local"}|${n}|${e.diff??""}`),kind:"diff-tab-viewer",title:`Diff ${e.name}`,file:{name:e.name,path:n,machineId:e.machineId??"local",kind:"code"},diff:e.diff};p(e=>e.map((e,n)=>n===t?V(e,r):e))}(e):!t||e.meta?.toLowerCase().startsWith("depth")||W({machineId:e.machineId??"local",path:t})},onOpenSubagent:function(e){var t;let n=h.slice(0,z),r=n.findIndex(e=>!e),i=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),a=r>=0?r:i;if(a<0)return void US.warning("请释放一个窗口再选中浏览");P.current+=1;let o={id:t=`subagent-${e.id}-${P.current}`,kind:"subagent-conversation-panel",title:e.title,subagentId:e.id,events:e.events?.length?e.events:[{id:`${t}-status`,kind:"done",title:e.detail??e.status??e.activity??e.title}]};p(e=>e.map((e,t)=>t===a?o:e))},onRetry:J})},"agent-conversation"),ei=(0,eb.jsx)(Ul,{id:"panes",defaultSize:en,minSize:32,children:(0,eb.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":ee?"true":void 0,children:[(0,eb.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3",children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)(UR,{value:l,onValueChange:e=>{let t,n;return t=ee1.find(t=>t.id===e)?.slots??4,void((n=h.slice(t).filter(e=>!!e)).length&&F(n),p(Array.from({length:Math.max(4,t)},(e,n)=>n<t?h[n]:void 0)),s(e))},children:(0,eb.jsx)(Uq,{children:ee1.map(e=>(0,eb.jsx)(UK,{value:e.id,"aria-label":e.label,title:e.label,className:"h-7 w-10 px-0 [&_svg]:size-4",children:e.icon},e.id))})}),(0,eb.jsxs)(yZ,{type:"single",value:c,variant:"outline",size:"sm","aria-label":"Agent 面板位置",onValueChange:e=>{("left"===e||"right"===e)&&d(e)},children:[(0,eb.jsx)(yJ,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(nw,{})}),(0,eb.jsx)(yJ,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(HP,{})})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"剪切窗口内容",title:"拖拽到窗口以剪切到剪切板",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(ee0,"cut")},children:(0,eb.jsx)(ce,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"粉碎窗口内容",title:"拖拽到窗口以清空",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(eeQ,"clear")},children:(0,eb.jsx)(HA,{})})]})}),(0,eb.jsx)("div",{className:"min-h-0 flex-1",children:(0,eb.jsx)(ee3,{mode:l,sizes:u,onSizeGroupChange:function(e,t){let n=etn(t);f(t=>{var r;return(r=t[e],(r?.length??0)===(n?.length??0)&&(r??[]).every((e,t)=>.01>Math.abs(e-(n?.[t]??0))))?t:{...t,[e]:n}})},children:Q},`${e?.conversation.id??"empty"}-${l}`)})]})},"agent-panes");return(0,eb.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace h-full min-h-0 pl-[5.25rem]",children:[(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:{agent:et,panes:en},onLayoutChanged:e=>{let t=e.agent??et,n=e.panes??en;!function(e){let t=etn(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let i="left"===c?{agent:n,panes:r}:{agent:r,panes:n};f(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-i.agent)&&.01>Math.abs((n??0)-i.panes)?e:{...e,shell:{...e.shell,...i}}})}("left"===c?[t,n]:[n,t])},children:["left"===c?er:ei,(0,eb.jsx)(Us,{withHandle:!0}),"left"===c?ei:er]},`${e?.conversation.id??"empty"}-${c}`),(0,eb.jsx)(ee8,{open:void 0!==k,onOpenChange:e=>{e||S(void 0)},onAdd:function(e){var t;let n,r;if(void 0===k)return;O.current+=1;let i=(t=`${e}-${O.current}`,n=UX(e),r="file-tab-viewer"===e?{id:t,kind:e,title:"选择文件"}:HU(e)?HK(e,t):void 0,{id:t,kind:e,title:r?.title??n?.title??"组件",tab:r,tabs:"multi-tab-system"===e?[]:void 0,terminal:"terminal-tab-group"===e?{sessionIds:[],autoStart:!0}:void 0}),a=h[k];a&&F([a]),p(e=>e.map((e,t)=>t===k?i:e)),S(void 0)}}),(0,eb.jsx)(KY,{open:void 0!==C,folders:I,onOpenChange:e=>{e||N(void 0)},onSelectFile:e=>{C&&H(e,C.paneIndex,C.insertIndex),N(void 0)}}),(0,eb.jsx)(etl,{open:void 0!==M,conversationId:e?.conversation.id,tab:M?.tab,onOpenChange:e=>{e||E(void 0)},onSelectVersion:e=>{q(e)}}),(0,eb.jsx)(UP,{position:"top-right"})]})}function etl({open:e,conversationId:t,tab:n,onOpenChange:r,onSelectVersion:i}){let[a,o]=ew.useState([]),[l,s]=ew.useState(!1),c=n?.file?.path,d=n?.file?.machineId??"local";return ew.useEffect(()=>{if(!e||!t||!c)return void o([]);let n=!1;return s(!0),Hb(t,{machineId:d,path:c}).then(e=>{n||o(e.versions)}).catch(()=>{n||o([])}).finally(()=>{n||s(!1)}),()=>{n=!0}},[t,d,e,c]),(0,eb.jsx)(po,{open:e,onOpenChange:r,children:(0,eb.jsxs)(p7,{className:"max-w-xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"历史版本"}),(0,eb.jsx)(mt,{className:"sr-only",children:"浏览当前文件在此 Agent 会话中的修改历史。"}),(0,eb.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:n?.file?.name??n?.title??"文件"}),c?(0,eb.jsxs)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:[d,":",c]}):null]}),(0,eb.jsx)("div",{className:"max-h-[28rem] overflow-auto p-2",children:l?(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"正在读取历史版本"}):0===a.length?(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"还没有记录到这个文件的修改历史"}):(0,eb.jsx)("div",{className:"grid gap-1",children:a.map(e=>{var t;let n;return(0,eb.jsxs)("button",{type:"button",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted/70",onClick:()=>i(e),children:[(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsxs)("span",{className:"block truncate text-sm font-medium",children:[ets(e.mutationId)," ·"," ","before"===e.state?"修改前":"修改后"]}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:Number.isFinite(n=Date.parse(t=e.createdAt))?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(n):t})]}),(0,eb.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,eb.jsxs)("b",{className:"font-medium text-emerald-600",children:["+",e.additions??0]}),(0,eb.jsxs)("b",{className:"font-medium text-rose-600",children:["-",e.deletions??0]})]})]},e.id)})})})]})})}function ets(e){return e.replace(/^mut-/,"").slice(0,16)}let etc=eN("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),etd=eN("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),etu=eN("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),etf=eN("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);function eth({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(),a=ew.useMemo(()=>Ha({onSelect:i}),[]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"canvas-library",definitions:a,initialLayouts:Ho,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,eb.jsx)(etm,{canvas:r,onOpenChange:e=>{e||i(void 0)}})]})}function etp({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}function etm({canvas:e,onOpenChange:t}){return e?(0,eb.jsx)(mQ,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsx)(etg,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,eb.jsx)(etc,{}),badge:e.settings.nodeTemplates.length,content:(0,eb.jsx)(etx,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,eb.jsx)(etf,{}),content:(0,eb.jsx)(etx,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(etx,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,eb.jsx)(etu,{}),content:(0,eb.jsx)(etx,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,eb.jsx)(ZJ,{}),content:(0,eb.jsx)(etx,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,eb.jsx)(B3,{}),content:(0,eb.jsx)(etx,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(etx,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(etx,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function etg({canvas:e}){return(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("button",{type:"button",className:"group relative grid min-h-72 rounded-[2rem] border bg-card p-7 text-left transition-colors hover:bg-muted/35",children:[(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("div",{className:"max-w-2xl",children:[(0,eb.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,eb.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,eb.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,eb.jsx)(etv,{label:"Nodes",value:`${e.nodes}`}),(0,eb.jsx)(etv,{label:"Agent",value:`${e.agents}`}),(0,eb.jsx)(etv,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,eb.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between",children:[(0,eb.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,eb.jsx)(etp,{icon:(0,eb.jsx)(F$,{}),value:e.runtime})]}),(0,eb.jsx)(mT,{items:e.roadmap.map(e=>({id:e.title,title:e.title,status:"running"===e.state?"current":"done"===e.state?"done":"queued"})),viewportClassName:"max-h-64"})]})]})}function etv({label:e,value:t}){return(0,eb.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function etx({title:e,items:t,empty:n="暂无内容"}){return(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,eb.jsxs)("div",{className:tK("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,eb.jsx)(etd,{className:"size-4 text-muted-foreground"}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,eb.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function ety({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索节点..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配节点。"}),(0,eb.jsx)(ml,{heading:"可用节点",children:HB.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,eb.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function etb({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let d=ew.useRef(null),{addPaletteOpen:u,addTemplateNode:f,handleAddPaletteOpenChange:h,handleCanvasAction:p,handleCanvasDragOver:m,handleCanvasDrop:g,handleNodeCanvasConnect:v,handleNodeCanvasEdgeAction:x,handleNodeCanvasNodeAction:y,filePickerDialog:b,renderedCanvasNodes:w}=function({workspaceRef:e,nodes:t,clipboardItems:n,onNodesSet:r,onEdgesSet:i,onSelectedNodeChange:a,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,d]=ew.useState(!1),[u,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,i,a,o,l,s,c,d;return r=e.current,i=r?.querySelector(".react-flow__viewport"),a=r?.getBoundingClientRect(),l="none"!==(o=i?getComputedStyle(i).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,d=l?.f??0,{x:(t-(a?.left??0)-c)/s,y:(n-(a?.top??0)-d)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,i;return n.id===e?(i="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:i}}):n}))},[r]),v=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},activeTabId:t}}:n))},[r]),x=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?function(e,t){let n=e.data??{};if("multi-tab-system"===n.kind){let r=Array.isArray(n.tabs)?n.tabs:[];return{...e,data:{...n,tabs:r.map(e=>e.id===t.id?t:e),activeTabId:t.id}}}return HU(n.kind)?{...e,data:{...n,tab:t}}:e}(n,t):n))},[r]),y=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},terminal:t}}:n))},[r]),b=ew.useCallback((e,t)=>{var n;let i=(n=e.kind,HB.find(e=>e.id===n)?.size??HR({width:480,height:320}));s.current+=1;let o=`${e.kind}-detached-${s.current}`;r(n=>[...n,function({tab:e,nodeId:t,center:n,size:r}){return{id:t,type:"blank",position:HF(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:HL(r)}}({tab:e,nodeId:o,center:t,size:i})]),a(o)},[r,a]),w=ew.useCallback(async(e,n)=>{try{let i,a=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=a?(a.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await H0(e):await HZ(e),s=void 0!==a&&(i=a.data??{},"multi-tab-system"===i.kind||"file-tab-viewer"===i.kind||"data-table-tab-viewer"===i.kind);n?.nodeId&&s&&r(e=>e.map(e=>e.id===n.nodeId?function(e,t,n){let r=e.data??{};if("multi-tab-system"===r.kind){let i,a,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(i=o.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}}return"file-tab-viewer"===r.kind||"data-table-tab-viewer"===r.kind&&"data-table-tab-viewer"===t.kind?{...e,data:{...r,tab:t}}:e}(e,l,n.insertIndex):e)),n?.nodeId&&s||b(l,u??{x:496,y:336})}catch{US.error("文件预览打开失败")}},[b,t,r,u]),j=ew.useCallback(e=>{let n=t.find(e=>"multi-tab-system"===(e.data??{}).kind);w(e,n?{nodeId:n.id}:void 0)},[t,w]),k=ew.useCallback(async(e,t,n)=>{let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw US.error("文件路径不可用"),Error("file path is unavailable");try{let a=await bh({machineId:i,path:r,content:n}),o={...t,title:a.name,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};x(e,o),US.success("文件已保存")}catch(e){throw US.error("文件保存失败"),e}},[x]),S=ew.useCallback((e,t,n)=>{b(t,m(n.clientX,n.clientY))},[b,m]),C=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=n.find(e=>e.id===t),i=r?r.payloads?.[fr]:void 0;if(i)return i;let a=e.dataTransfer.getData(fr);if(a)try{return JSON.parse(a)}catch{return}},[n]),N=ew.useCallback((e,t,n)=>{r(r=>r.map(r=>r.id!==e?r:function(e,t,n){let r=e.data??{},i=Array.isArray(r.tabs)?r.tabs:[],a=new Set(i.map(e=>e.id)),o=n.tab.id,l=2;for(;a.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...i];return s.splice(Math.max(0,Math.min(t,s.length)),0,{...n.tab,id:o}),{...e,data:{...r,tabs:s,activeTabId:o}}}(r,t,n)))},[r]),M=ew.useCallback((e,t,n)=>{let r=C(n);r&&N(e,t,r)},[C,N]),E=ew.useCallback(e=>(function(e,t){for(let n of[...e].reverse()){if("multi-tab-system"!==(n.data??{}).kind)continue;let e=function(e){let t="number"==typeof e.width?e.width:"number"==typeof e.style?.width?e.style.width:"string"==typeof e.style?.width?Number.parseFloat(e.style.width):192,n="number"==typeof e.height?e.height:"number"==typeof e.style?.height?e.style.height:"string"==typeof e.style?.height?Number.parseFloat(e.style.height):112;return{width:Number.isFinite(t)?t:192,height:Number.isFinite(n)?n:112}}(n),r=t.x>=n.position.x&&t.x<=n.position.x+e.width,i=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&i)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let i=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),a=i?.querySelector('[data-slot="multi-tab-list"]');if(!a)return r;let o=Array.from(a.querySelectorAll("[data-tab-id]"));for(let[e,t]of o.entries()){let r=t.getBoundingClientRect();if(n<r.left+r.width/2)return e}return o.length})(e,t,n,r),[e]),P=function({nodes:e,onTabsChange:t,onActiveTabChange:n,onRequestFileTab:r,onOpenWorkspaceFile:i,onTabChange:a,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let d=e.data??{},u=(e.data??{}).kind;return u?{...e,data:{...d,content:(0,eb.jsx)(eeJ,{kind:u,nodeId:e.id,tab:d.tab,tabs:d.tabs,activeTabId:d.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:d.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:i,onTabsChange:t,onTabChange:a,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,i,r,o,a,s,l,t])}({nodes:t,onTabsChange:g,onActiveTabChange:v,onRequestFileTab:p,onOpenWorkspaceFile:j,onTabChange:x,onSaveFileTab:k,onTerminalStateChange:y,onTabDetach:S,onExternalTabDrop:M}),A=ew.useCallback(e=>{s.current+=1;let n=`${e.id}-${t.length+s.current}`;r(t=>[...t,function({template:e,nodeId:t,center:n}){let r={contentScale:2,kind:e.id};return"multi-tab-system"===e.id?r.tabs=[]:HU(e.id)&&(r.tab=HK(e.id,`${t}-tab`)),{id:t,type:"blank",position:HF(n,e.size),data:r,width:e.size.width,height:e.size.height,style:HL(e.size)}}({template:e,nodeId:n,center:u??{x:496,y:336}})]),a(void 0),d(!1),f(void 0)},[t.length,r,a,u]),z=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let i=n.find(e=>e.id===t),o=m(e.clientX,e.clientY),s=C(e),c=s?E(o):void 0;if(s&&c){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=c.data??{},n=Array.isArray(t.tabs)?t.tabs:[],r=O(c.id,e.clientX,n.length);N(c.id,r,s),a(void 0);return}let d=i?i.payloads?.[fn]:void 0;if(!i||!d)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let u=`${d.node.id}-drop-${l.current}`;r(e=>[...e,function({source:e,nodeId:t,center:n}){let r={width:e.width??192,height:e.height??112};return{...e,id:t,position:HF(n,r),style:e.style??HL(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:d.node,nodeId:u,center:o})]),a(u)},[n,E,C,m,O,N,r,a]),I=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[fn,fr].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),_=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),d(!0))},[]),D=ew.useCallback(e=>{i(t=>{if(t.find(t=>t.source===e.source&&t.target===e.target))return t;let n=t.find(t=>t.source===e.target&&t.target===e.source);return n?t.map(e=>e.id===n.id?{...e,data:{...e.data??{},bidirectional:!0}}:e):[...t,{id:`edge-${e.source}-${e.target}-${t.length+1}`,type:"connection",source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:{anchors:[]}}]})},[i]),T=ew.useCallback((e,t,n)=>{"cut-edge"===e?i(e=>e.filter(e=>e.id!==t)):i(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&i.splice(n.anchorIndex??i.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(i[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&i.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:i}}}))},[i]),R=ew.useCallback((e,n,{snappedPosition:l})=>{if("copy"===e)return void r(e=>{let t=e.find(e=>e.id===n);if(!t)return e;let r=`${t.id}-copy-${e.length+1}`;return a(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,d,u,f=t.find(e=>e.id===n);if(!f)return;let h=(e={...f.data??{}},delete e.content,delete e.mode,delete e.onConnectPointerDown,delete e.onSelectNode,delete e.resizing,c=(s=function(e){let t=e.data??{},n=t.tab;if(n?.id&&HU(n.kind))return n;let r=t.kind;if(HU(r))return HK(r,e.id)}(l={...f,selected:!1,data:{...e,resizing:!1}}))?{tab:s,sourceNodeId:f.id}:void 0,d={[fn]:{node:l}},u={"application/vnd.vantaloom.clip-kind":s?"canvas-tab":"canvas-node",[fn]:f.id},c&&(d[fr]=c,u[fr]=JSON.stringify(c)),{id:`clip-${f.id}`,title:s?.title??"画布节点",description:s?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(f.width??192)}x${Math.round(f.height??112)}`,icon:s?Hq(s.kind):(0,eb.jsx)(HI,{className:"size-4"}),dragData:u,payloads:d});o(e=>[h,...e.filter(e=>e.id!==h.id)]),r(e=>e.filter(e=>e.id!==n)),i(e=>e.filter(e=>e.source!==n&&e.target!==n)),a(void 0)}},[t,o,i,r,a]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,eb.jsx)(QL,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){d(e),e||f(void 0)},handleCanvasAction:_,handleCanvasDragOver:I,handleCanvasDrop:z,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:T,handleNodeCanvasNodeAction:R,renderedCanvasNodes:P}}({workspaceRef:d,nodes:e,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,eb.jsxs)("div",{ref:d,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,eb.jsx)(cM,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:HD,edgeTypes:HT,onNodesChange:i,onEdgesChange:a,selectedNodeId:n,onSelectedNodeChange:s,defaultViewport:{x:0,y:0,zoom:.5},labels:{actions:"画布操作",add:"添加节点",select:"普通鼠标",connect:"连接工具",cut:"剪刀工具",drag:"拖拽工具",modeTools:"模式工具",resetZoom:"重置缩放",viewportTools:"视口工具",lockViewport:"锁定视口",visualSnap:"视觉吸附",nodeSnap:"节点吸附",snapTools:"吸附工具",nodeActions:"节点操作",resizeNode:"调整大小",copyNode:"复制节点",cutNode:"剪切节点"},onCanvasAction:p,onNodeCanvasConnect:v,onNodeCanvasEdgeAction:x,onNodeCanvasNodeAction:y}),(0,eb.jsx)(ety,{open:u,onOpenChange:h,onAdd:f}),b,(0,eb.jsx)(UP,{position:"top-right"})]})}function etw({open:e,definitions:t,onOpenChange:n,onAdd:r}){return(0,eb.jsx)(mr,{open:e,onOpenChange:n,title:"添加卡片",description:"搜索并选择要添加到运维面板的卡片。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索可添加卡片..."}),(0,eb.jsxs)(ma,{className:"max-h-[420px]",children:[(0,eb.jsx)(mo,{children:"没有找到可添加的卡片。"}),(0,eb.jsx)(ml,{heading:"运维面板卡片",children:t.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource],onSelect:()=>r(e.id),className:"min-h-14 items-start py-2",children:[(0,eb.jsx)("span",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function etj({open:e,dragMode:t,onOpenChange:n,onAdd:r,onDragModeChange:i}){let a=[{key:"add",label:"添加组件",icon:(0,eb.jsx)(s7,{className:"size-4"}),onClick:r,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,eb.jsx)(s2,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,eb.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[a.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",t.pressed&&"border-foreground bg-foreground text-background shadow-lg ring-1 ring-background/50 hover:bg-foreground hover:text-background dark:bg-primary dark:text-primary-foreground dark:hover:bg-primary",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"仪表盘操作","aria-expanded":e,onClick:()=>n(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function etk({layout:e,layouts:t,cellSize:n,dragMode:r,selected:i,resizing:a,onSelect:o,onMove:l,onCut:s,onCopy:c,onSettingsOpen:d,onResizeStart:u,onResizeEnd:f,children:h}){let[p,m]=ew.useState(!1),g=e.x*(n+12),v=e.y*(n+12),x=e.w*n+(e.w-1)*12,y=e.h*n+(e.h-1)*12;return(0,eb.jsxs)("div",{"data-dashboard-widget":e.id,className:tK("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",r&&"cursor-grab active:cursor-grabbing",p&&"duration-150",i&&!a&&"z-20 shadow-sm",a&&"z-30 transition-none"),style:{left:g,top:v,width:x,height:y},onPointerDown:function(i){if(!r||a)return;let s=i.target;if(s instanceof HTMLElement&&s.closest("[data-dashboard-action]"))return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),o();let c=i.clientX,d=i.clientY;function u(r){let i=fm({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-d)/(n+12))});fp(i,t,e.id)||l(i)}m(!0),window.addEventListener("pointermove",u),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",e),m(!1)})},onClick:()=>{r&&o()},children:[(0,eb.jsx)("div",{className:tK("size-full",r&&"pointer-events-none"),children:h}),i&&r&&!a?(0,eb.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&r&&!a?(0,eb.jsx)(etS,{onSettingsOpen:d,onCut:s,onCopy:c,onResizeStart:u}):null,a?(0,eb.jsx)(etC,{layout:e,layouts:t,cellSize:n,onResize:l,onResizeEnd:f}):null]})}function etS({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,eb.jsx)(cn,{"data-dashboard-action":!0,placement:"inline",size:"sm","aria-label":"组件操作",className:"!absolute top-full left-1/2 z-40 mt-2 -translate-x-1/2 rounded-lg bg-popover/95 p-1 shadow-md",onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,eb.jsxs)(cr,{children:[(0,eb.jsx)(ci,{type:"button","aria-label":"调整大小",onClick:r,children:(0,eb.jsx)(s3,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(mf,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"复制",onClick:n,children:(0,eb.jsx)(s0,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(ce,{className:"size-4"})})]})})}function etC({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:i}){return(0,eb.jsx)("div",{"data-dashboard-action":!0,className:"pointer-events-none absolute inset-1 z-40 border-2 border-foreground",children:[{id:"top-left",className:"top-0 left-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize"},{id:"top",className:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 cursor-ns-resize"},{id:"top-right",className:"top-0 right-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize"},{id:"right",className:"top-1/2 right-0 translate-x-1/2 -translate-y-1/2 cursor-ew-resize"},{id:"bottom-right",className:"right-0 bottom-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize"},{id:"bottom",className:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 cursor-ns-resize"},{id:"bottom-left",className:"bottom-0 left-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize"},{id:"left",className:"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize"}].map(a=>(0,eb.jsx)("button",{type:"button","aria-label":`调整 ${a.id}`,className:tK("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",a.className),onPointerDown:o=>(function(a,o){a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);let l=a.clientX,s=a.clientY;function c(i){let a=Math.round((i.clientX-l)/(n+12)),c=Math.round((i.clientY-s)/(n+12)),d={...e};o.includes("right")&&(d.w=e.w+a),o.includes("bottom")&&(d.h=e.h+c),o.includes("left")&&(d.x=e.x+a,d.w=e.w-a),o.includes("top")&&(d.y=e.y+c,d.h=e.h-c),fp(d=fm(d),t,e.id)||r(d)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),i()})})(o,a.id)},a.id))})}function etN({open:e,layout:t,definition:n,config:r,cellSize:i,onOpenChange:a,onConfigChange:o}){let l=t&&i>0?t.w*i+(t.w-1)*12:320,s=t&&i>0?t.h*i+(t.h-1)*12:180;return(0,eb.jsx)(po,{open:e,onOpenChange:a,children:(0,eb.jsx)(mv,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,eb.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,eb.jsx)(etM,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,eb.jsxs)("div",{className:"animate-in slide-in-from-right-4 flex h-full w-full flex-col border-y-0 border-r-0 bg-background text-foreground shadow-lg duration-300",children:[(0,eb.jsxs)(mx,{className:"border-b",children:[(0,eb.jsx)(my,{children:"卡片设置"}),(0,eb.jsxs)(mb,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,eb.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,eb.jsx)(ny,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,eb.jsx)(ny,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,eb.jsx)(ny,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,eb.jsx)("textarea",{value:r.note,rows:4,className:"min-h-24 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 ui-text-control transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",onChange:e=>o({note:e.currentTarget.value})})]}),(0,eb.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,eb.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,eb.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{children:["类型:",n.id]}),(0,eb.jsxs)("span",{children:["来源:",r.dataSource]}),(0,eb.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function etM({width:e,height:t,className:n,children:r}){let[i,a]=f3(),o=a.width>0&&a.height>0?Math.min(1,(a.width-32)/e,(a.height-32)/t):1;return(0,eb.jsx)("div",{ref:i,className:tK("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,eb.jsx)("div",{className:"animate-in fade-in-0 zoom-in-95 origin-center rounded-lg duration-300",style:{width:e,height:t,transform:`scale(${Math.max(.1,o)})`},children:r})})}function etE(){return ew.useMemo(()=>[{id:"active-runs",title:ez.activeRuns,description:"当前正在执行的 Agent 运行数量。",icon:(0,eb.jsx)(B7,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.activeRuns,dataSource:"本机运行队列",refreshRate:"5s",note:"统计所有未完成的运行。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"18",jellyImage:u4,jellyImagePosition:"center"})},{id:"queue",title:ez.queue,description:"排队等待调度的任务数量。",icon:(0,eb.jsx)(Hz,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.queue,dataSource:"调度器",refreshRate:"5s",note:"用于观察调度压力。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"7",jellyImage:u3,jellyImagePosition:"center"})},{id:"cost",title:ez.cost,description:"今日模型、工具和机器资源消耗。",icon:(0,eb.jsx)(FW,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.cost,dataSource:"用量聚合",refreshRate:"1m",note:"后续可接入工作组账单。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"$42.8",jellyImage:u6,jellyImagePosition:"center"})},{id:"machines-summary",title:ez.machineStatus,description:"工作组内可用机器概况。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"15s",note:"包含本机、直连机器和 P2P 节点。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"2 / 3",jellyImage:u8,jellyImagePosition:"center"})},{id:"resource-trend",title:ez.resourceTrend,description:"CPU 与内存趋势图。",icon:(0,eb.jsx)(FZ,{className:"size-4"}),defaultSize:{w:8,h:4},defaultConfig:{title:ez.resourceTrend,dataSource:"机器遥测",refreshRate:"10s",note:"默认显示最近 6 个采样点。"},render:e=>(0,eb.jsx)(FJ,{title:e.title})},{id:"run-mix",title:ez.runMix,description:"不同类型 Agent 运行的占比。",icon:(0,eb.jsx)(mR,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:{title:ez.runMix,dataSource:"运行记录",refreshRate:"30s",note:"用于快速观察任务类型构成。"},render:e=>(0,eb.jsx)(V3,{title:e.title})},{id:"machine-status",title:ez.machineStatus,description:"各机器 CPU、内存、GPU 与磁盘状态。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:8,h:5},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"10s",note:"用于运维总览的核心资源面板。"},render:e=>(0,eb.jsx)(FG,{title:e.title})},{id:"schedule",title:ez.schedule,description:"维护窗口、提醒和自动化计划。",icon:(0,eb.jsx)(V8,{className:"size-4"}),defaultSize:{w:4,h:5},defaultConfig:{title:ez.schedule,dataSource:"本机日程",refreshRate:"5m",note:"之后可接工作组日程。"},render:e=>(0,eb.jsx)(V9,{title:e.title})}],[])}function etO({clipboardItems:e,onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(!1),[a,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,d]=ew.useState(ff),[u,f]=ew.useState({}),[h,p]=ew.useState(),[m,g]=ew.useState(),[v,x]=ew.useState(),y=ew.useRef(0),b=ew.useRef(0),[w,j]=f3(),k=j.width>0?(j.width-132)/12:96,S=Math.max(9,fh(c)+2),C=S*k+(S-1)*12,N=etE(),M=ew.useMemo(()=>new Map(N.map(e=>[e.id,e])),[N]);function E(e){let t=M.get(e.kind);return u[e.id]??(t?fv(t):void 0)}function O(e){d(t=>{let n=fm(e);return fp(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}ew.useEffect(()=>{n(a||!!v)},[a,n,v]),ew.useEffect(()=>()=>n(!1),[n]),ew.useEffect(()=>{l||(p(void 0),g(void 0))},[l]),ew.useEffect(()=>{if(m)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-dashboard-action]")||(p(m),g(void 0))}},[m]);let P=v?c.find(e=>e.id===v):void 0,A=P?M.get(P.kind):void 0,z=P?E(P):void 0;return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{ref:w,"data-dashboard-board":!0,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",l&&"select-none"),style:{minHeight:C+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.dashboard-widget-kind")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(t){let n=t.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=t.dataTransfer.getData("application/vnd.vantaloom.dashboard-widget-kind");if(!n||!r)return;let i=e.find(e=>e.id===n);if(!i)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move";let a=w.current,o=a?.getBoundingClientRect();!function(e,t){let n=fx(e);if(!n)return;b.current+=1;let r=`${n.kind}-clip-${b.current}`,i=fm({id:r,kind:n.kind,x:t?.x??0,y:t?.y??fh(c),w:n.w,h:n.h}),a=t&&!fp(i,c)?i:fg(c,r,n.kind,n.w,n.h);d(e=>[...e,a]),f(e=>({...e,[r]:{...n.config}})),p(r),g(void 0)}(i,{x:o&&k>0?Math.round((t.clientX-o.left-24)/(k+12)):0,y:o&&k>0?Math.round((t.clientY-o.top-24)/(k+12)):fh(c)})},onPointerDown:e=>{e.target===e.currentTarget&&(p(void 0),l||g(void 0))},children:(0,eb.jsx)("div",{className:"relative",style:{height:C},children:c.map(e=>{let n=N.find(t=>t.id===e.kind);if(!n)return null;let r=E(e);return r?(0,eb.jsx)(etk,{layout:e,layouts:c,cellSize:k,dragMode:l,selected:h===e.id,resizing:m===e.id,onSelect:()=>{l&&p(e.id)},onMove:O,onCut:()=>(function(e){let n=c.find(t=>t.id===e),r=n?M.get(n.kind):void 0,i=n?E(n):void 0;if(!n||!r||!i)return;let a=function({layout:e,definition:t,config:n}){let r={kind:e.kind,w:e.w,h:e.h,config:{...n}};return{id:`clip-${e.id}`,title:n.title||t.title,description:t.description,meta:`${e.w}x${e.h}`,icon:t.icon,dragData:{"application/vnd.vantaloom.clip-kind":"dashboard-widget","application/vnd.vantaloom.dashboard-widget-kind":e.kind,"application/vnd.vantaloom.dashboard-widget-width":String(e.w),"application/vnd.vantaloom.dashboard-widget-height":String(e.h),"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(n)},payloads:{[fi]:r}}}({layout:n,definition:r,config:i});t(e=>[a,...e.filter(e=>e.id!==a.id)]),d(t=>t.filter(t=>t.id!==e)),f(t=>{let n={...t};return delete n[e],n}),p(void 0),g(void 0),x(t=>t===e?void 0:t)})(e.id),onCopy:()=>(function(e){let t=c.find(t=>t.id===e);if(!t)return;y.current+=1;let n=`${e}-copy-${y.current}`,r=fg(c,n,t.kind,t.w,t.h);d(e=>[...e,r]),f(r=>({...r,[n]:r[e]??fv(M.get(t.kind))})),p(n)})(e.id),onSettingsOpen:()=>x(e.id),onResizeStart:()=>{p(void 0),g(e.id)},onResizeEnd:()=>{p(e.id),g(void 0)},children:n.render(r)},e.id):null})})}),(0,eb.jsx)(etj,{open:r,dragMode:l,onOpenChange:i,onAdd:()=>{i(!1),o(!0)},onDragModeChange:s}),(0,eb.jsx)(etw,{open:a,definitions:N,onOpenChange:o,onAdd:function(e){let t=M.get(e);if(!t)return;b.current+=1;let n=`${e}-added-${b.current}`,r=fg(c,n,e,t.defaultSize.w,t.defaultSize.h);d(e=>[...e,r]),f(e=>({...e,[n]:fv(t)})),p(n),g(void 0),o(!1)}}),(0,eb.jsx)(etN,{open:!!(P&&A&&z),layout:P,definition:A,config:z,cellSize:k,onOpenChange:e=>{e||x(void 0)},onConfigChange:e=>{var t;let n,r;P&&(t=P.id,r=(n=c.find(e=>e.id===t))?M.get(n.kind):void 0,n&&r&&f(n=>({...n,[t]:{...n[t]??fv(r),...e}})))}})]})}let etP={delete:"Delete",empty:"Drop here",title:"Trash"};function etA({active:e=!1,items:t=[],labels:n,className:r,onDrop:i,onDelete:a,onItemRestore:o,...l}){let s={...etP,...n},[c,d]=ew.useState(!1),u=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(u.current=0,d(!1))},[e]),(0,eb.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:tK("fixed top-4 left-1/2 z-50 -translate-x-1/2 transition-[opacity,transform] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]",f?"pointer-events-auto translate-y-0 opacity-100":"pointer-events-none -translate-y-5 opacity-0",r),onDragEnter:function(e){e.preventDefault(),u.current+=1,d(!0)},onDragLeave:function(){u.current=Math.max(0,u.current-1),0===u.current&&d(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",d(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),u.current=0,d(!1);let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id")||e.dataTransfer.getData("text/plain"),n=e.dataTransfer.getData("text/plain")||t||"Dropped item",r=e.dataTransfer.getData("application/vnd.vantaloom.clip-kind");t&&i?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,eb.jsx)("div",{className:tK("min-w-12 overflow-hidden rounded-xl border-2 border-background bg-destructive text-destructive-foreground shadow-lg shadow-black/15 transition-[width,min-height,background-color,border-color,padding,box-shadow] duration-300","dark:border-destructive dark:bg-background dark:text-destructive",c||t.length>0?"w-64 border-dashed bg-destructive/12 p-2 text-destructive dark:bg-destructive/8":"flex size-12 items-center justify-center p-0"),children:c||t.length>0?(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-14 items-center justify-center gap-2 rounded-lg border border-dashed border-destructive/55 bg-destructive/8 px-3 text-sm font-medium text-destructive",children:[(0,eb.jsx)(m0,{className:"size-4"}),(0,eb.jsx)("span",{children:s.empty})]}),t.length>0?(0,eb.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,eb.jsxs)("div",{className:"flex h-8 items-center gap-2 rounded-md border border-destructive/25 bg-background/80 px-2 text-foreground",children:[(0,eb.jsx)("button",{type:"button","aria-label":`Restore ${e.title}`,className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",onClick:()=>o?.(e),children:(0,eb.jsx)(p6,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,eb.jsx)("button",{type:"button",className:"h-8 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition-colors hover:bg-destructive/90 dark:border dark:border-destructive dark:bg-background dark:text-destructive dark:hover:bg-destructive/10",onClick:()=>a?.(t),children:s.delete}):null]}):(0,eb.jsx)(m0,{className:"size-5"})})})}function etz({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:i,onDraggingChange:a,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[d,u]=ew.useState(!1);return(ew.useEffect(()=>{u(!0)},[]),d)?(0,t3.createPortal)((0,eb.jsxs)("div",{className:tK("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,eb.jsx)(etA,{active:!e&&void 0!==i,items:e?[]:n,className:tK(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let i=t.find(t=>t.id===e);i&&(s(t=>({...t,[e]:i})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:i.icon}]))},onDelete:e=>{let t=new Set(e.map(e=>e.id));l(e=>e.filter(e=>!t.has(e.id))),s(e=>{let n={...e};for(let e of t)delete n[e];return n})},onItemRestore:e=>{let n=r[e.id];n&&o([n,...t.filter(e=>e.id!==n.id)]),l(t=>t.filter(t=>t.id!==e.id)),s(t=>{let n={...t};return delete n[e.id],n})}}),t.length>0?(0,eb.jsx)("div",{className:tK("pointer-events-auto absolute top-4 right-4 w-80 max-w-[calc(100vw-2rem)] transition-[opacity,transform] duration-200",e&&"pointer-events-none -translate-y-2 opacity-0"),children:(0,eb.jsx)(QZ,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let i,a,l,s,d;return c.current+=1,i=fx(n),a=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[fa],i&&a&&(a[fi]={...i,config:{...i.config}}),l&&a&&(a[fa]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:a,dragData:{...n.dragData,...i?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(i.config)}:{}}},void((d=[...t]).splice(r+1,0,s),o(d))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>a(e.id),onItemDragEnd:()=>a(void 0)})}):null]}),document.body):null}let etI=ew.createContext(96);function et_(e,t){let n=e[t];if(!n)throw Error(`Missing static grid layout: ${t}`);return n}function etD({layouts:e,minRows:t=9,className:n,children:r,...i}){let[a,o]=f3(),l=o.width>0?(o.width-132)/12:96,s=Math.max(t,e.reduce((e,t)=>Math.max(e,t.y+t.h),0)+2),c=s*l+(s-1)*12;return(0,eb.jsx)("div",{ref:a,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",n),style:{minHeight:c+48},...i,children:(0,eb.jsx)("div",{className:"relative",style:{height:c},children:(0,eb.jsx)(etI.Provider,{value:l,children:r})})})}function etT({layout:e,className:t,style:n,...r}){let i=ew.useContext(etI);return(0,eb.jsx)("div",{className:tK("absolute min-w-0",t),style:{left:e.x*(i+12),top:e.y*(i+12),width:e.w*i+(e.w-1)*12,height:e.h*i+(e.h-1)*12,...n},...r})}let etR=[{id:"firewall",x:0,y:0,w:12,h:8}],etL=f4(etR);function et$(){var e;return e=(0,eb.jsx)(etD,{layouts:etR,children:(0,eb.jsx)(etT,{layout:et_(etL,"firewall"),className:"vtl-firewall-card overflow-hidden rounded-xl border bg-card",children:(0,eb.jsx)(Q_,{})})}),(0,eb.jsx)(f5,{children:e})}let etF=eN("chart-area",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]),etV=eN("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),etB=eN("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),etH=eN("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),etW=eN("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),etU=[{id:"run-ui-polish",title:"组件库视觉回归检查",machine:"Studio-PC",agent:"UI Polish",state:"running",started:"14:08",runtime:"22m",progress:68,load:54},{id:"run-runner-build",title:"Linux runner 镜像构建",machine:"Linux-runner-02",agent:"Build Agent",state:"running",started:"14:15",runtime:"15m",progress:41,load:86},{id:"run-access-audit",title:"工作组权限审阅",machine:"Studio-PC",agent:"Access Agent",state:"blocked",started:"14:21",runtime:"9m",progress:37,load:18},{id:"run-docs",title:"发布说明摘要",machine:"MacBook-build",agent:"Docs Agent",state:"queued",started:"等待",runtime:"0m",progress:0,load:0},{id:"run-cache-clean",title:"缓存清理策略验证",machine:"Linux-runner-02",agent:"Ops Sentinel",state:"failed",started:"13:54",runtime:"6m",progress:28,load:12}],etq=[{id:"worker-studio",machine:"Studio-PC",role:"local coordinator",active:3,capacity:6,cpu:42,memory:68},{id:"worker-runner",machine:"Linux-runner-02",role:"gpu worker",active:4,capacity:5,cpu:76,memory:81},{id:"worker-mac",machine:"MacBook-build",role:"build host",active:0,capacity:3,cpu:8,memory:24}],etK=[{id:"confirm-shell",title:"Studio-PC 请求执行发布前文件写入",meta:"UI Polish · apply_patch",tone:"normal"},{id:"confirm-service",title:"Linux-runner-02 请求重启 runner 服务",meta:"Ops Sentinel · Restart-Service",tone:"warning"},{id:"confirm-token",title:"工作组 token 加入新机器",meta:"Access Agent · admin required",tone:"normal"}],etG=[["14:29","Studio-PC","pnpm --filter vantaloom-app lint","完成"],["14:27","Linux-runner-02","docker build agent-runtime","运行中"],["14:22","Studio-PC","apply_patch agent settings","完成"],["14:17","MacBook-build","pnpm typecheck","排队"],["14:03","Linux-runner-02","cache prune dry-run","失败"]],etY={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function etX(e,t,n=42,r){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&u7(r)&&"vtl-jelly-image-card-shadowless"),style:r?u9({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,eb.jsx)(mM,{label:e,value:t,minSize:n})})}function etZ(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let etJ={metrics:{online:2,health:88.4,latency:"38ms",events:17},machines:[{id:"studio",name:"Studio-PC",os:"Windows",status:"online",link:"direct",heartbeat:"3s",cpu:42,memory:68,disk:71,network:24},{id:"runner",name:"Linux-runner-02",os:"Linux",status:"online",link:"p2p",heartbeat:"5s",cpu:76,memory:81,disk:62,network:43},{id:"mac",name:"MacBook-build",os:"macOS",status:"sleeping",link:"direct",heartbeat:"2m",cpu:8,memory:24,disk:48,network:6}],trend:[{time:"09:00",cpu:36,memory:54,network:24},{time:"10:00",cpu:48,memory:61,network:29},{time:"11:00",cpu:44,memory:58,network:34},{time:"12:00",cpu:63,memory:72,network:41},{time:"13:00",cpu:58,memory:69,network:37},{time:"14:00",cpu:71,memory:76,network:46}],networkLinks:[["Studio-PC","Linux-runner-02","P2P","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","12ms","0.0%"],["Linux-runner-02","MacBook-build","Relay fallback","84ms","1.1%"]],events:[["14:31","Linux-runner-02 心跳延迟升高"],["14:28","Studio-PC 完成 2 个工具调用"],["14:19","MacBook-build 进入睡眠状态"],["14:12","工作组权限策略同步完成"],["14:04","P2P 链路切换到备用路径"]],serviceHealth:[{id:"local-service",name:"Local service",state:"正常",samples:[96,98,97,95,96,94,97,98,96,95,97,96]},{id:"agent-runtime",name:"Agent runtime",state:"正常",samples:[91,93,94,90,88,92,94,93,91,89,92,94]},{id:"p2p-mesh",name:"P2P mesh",state:"波动",samples:[78,82,76,73,68,71,74,79,83,80,77,72]},{id:"plugin-bridge",name:"Plugin bridge",state:"告警",samples:[88,86,84,82,79,74,63,54,48,52,67,76]}]},etQ=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,eb.jsx)(B7,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("运行中","运行队列"),render:e=>etX(e.title,"07",44,u4)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,eb.jsx)(Hz,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("排队","调度器"),render:e=>etX(e.title,"04",44,u3)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("待确认","确认队列"),render:e=>etX(e.title,"03",44,u6)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Worker","Agent worker"),render:e=>etX(e.title,"14",44,u8)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,eb.jsx)(etB,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etZ("任务队列","运行队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BU,{items:etU})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etZ("Agent worker","Worker 状态"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BK,{workers:etq})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,eb.jsx)(g8,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:etZ("最近执行","执行日志"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BW,{items:etG})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:etZ("待确认","确认队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BH,{items:etK})]})}],et0=[{id:"metric-runs",kind:"metric-runs",x:0,y:0,w:3,h:2},{id:"metric-queued",kind:"metric-queued",x:3,y:0,w:3,h:2},{id:"metric-blocked",kind:"metric-blocked",x:6,y:0,w:3,h:2},{id:"metric-workers",kind:"metric-workers",x:9,y:0,w:3,h:2},{id:"queue",kind:"queue",x:0,y:2,w:7,h:5},{id:"workers",kind:"workers",x:7,y:2,w:5,h:5},{id:"log",kind:"log",x:0,y:7,w:7,h:4},{id:"confirmations",kind:"confirmations",x:7,y:7,w:5,h:4}];function et1(e=etJ){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("在线机器","机器心跳"),render:t=>etX(t.title,String(e.metrics.online),44,u4)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,eb.jsx)(Uc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("健康度","服务遥测"),render:t=>etX(t.title,`${e.metrics.health}%`,44,u3)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,eb.jsx)(FK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("平均延迟","网络遥测"),render:t=>etX(t.title,e.metrics.latency,44,u6)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("事件","事件流"),render:t=>etX(t.title,String(e.metrics.events),44,u8)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etZ("机器健康矩阵","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:u9({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BZ,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etZ("资源趋势","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B2,{config:etY,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("网络连接","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B1,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("事件流","事件流"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BX,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:etZ("服务健康","服务遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B5,{services:e.serviceHealth})]})}]}let et2=et1(),et5=[{id:"metric-online",kind:"metric-online",x:0,y:0,w:3,h:2},{id:"metric-health",kind:"metric-health",x:3,y:0,w:3,h:2},{id:"metric-latency",kind:"metric-latency",x:6,y:0,w:3,h:2},{id:"metric-events",kind:"metric-events",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:7,h:5},{id:"trend",kind:"trend",x:7,y:2,w:5,h:5},{id:"network",kind:"network",x:0,y:7,w:6,h:4},{id:"events",kind:"events",x:6,y:7,w:6,h:4},{id:"services",kind:"services",x:0,y:11,w:12,h:3}],et4={totals:{machines:4,online:2,runtime:3,tokens:7},machines:[{id:"studio",name:"Studio-PC",role:"本机",group:"Core",os:"Windows 11",runtime:"0.16.4",state:"online",tags:["admin","shell","files","scheduler"],agent:"6/8",cpu:42,memory:68,version:"Agent runtime 0.16.4",admin:"Allay"},{id:"runner",name:"Linux-runner-02",role:"GPU worker",group:"Compute",os:"Ubuntu 24.04",runtime:"0.16.3",state:"online",tags:["gpu","agent","files"],agent:"4/6",cpu:76,memory:81,version:"Agent runtime 0.16.3",admin:"Ops"},{id:"mac",name:"MacBook-build",role:"构建机",group:"Build",os:"macOS 15.4",runtime:"0.15.9",state:"sleeping",tags:["build","readonly"],agent:"0/3",cpu:8,memory:24,version:"Agent runtime 0.15.9",admin:"Allay"},{id:"observer",name:"Observer-01",role:"只读观测节点",group:"Edge",os:"Debian 13",runtime:"0.16.2",state:"warning",tags:["readonly","audit"],agent:"1/2",cpu:18,memory:36,version:"Agent runtime 0.16.2",admin:"Security"}],topology:{nodes:[{id:"studio",label:"Studio-PC",meta:"本机",x:50,y:18},{id:"runner",label:"Linux-runner-02",meta:"GPU worker",x:22,y:60},{id:"mac",label:"MacBook-build",meta:"构建机",x:76,y:58,state:"warning"},{id:"observer",label:"Observer-01",meta:"只读观测",x:50,y:82,state:"warning"}],links:[{id:"sr",from:"studio",to:"runner",kind:"p2p",label:"P2P",meta:"38ms / 0.3%"},{id:"sm",from:"studio",to:"mac",kind:"direct",label:"Direct",meta:"12ms / 0%"},{id:"ro",from:"runner",to:"observer",kind:"relay",label:"Relay",meta:"84ms / 1.1%"},{id:"mo",from:"mac",to:"observer",kind:"down",label:"Down",meta:"lost"}]},pathTotals:{direct:1,p2p:1,relay:1,broken:1},latency:Jp,candidates:[["Studio-PC","Linux-runner-02","P2P","symmetric NAT","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","open port 4178","12ms","0.0%"],["Linux-runner-02","Observer-01","Relay","udp blocked","84ms","1.1%"],["MacBook-build","Observer-01","Interrupted","sleep","-","-"]]};function et3(e=et4){return[{id:"total",title:"机器",description:"工作组机器总数。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("机器","机器组"),render:t=>etX(t.title,String(e.totals.machines),42,u4)},{id:"online",title:"在线",description:"当前在线机器。",icon:(0,eb.jsx)(Uc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("在线","机器心跳"),render:t=>etX(t.title,String(e.totals.online),42,u3)},{id:"runtime",title:"Runtime",description:"可用 runtime 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Runtime","Agent runtime"),render:t=>etX(t.title,String(e.totals.runtime),42,u6)},{id:"tokens",title:"Token",description:"已注册 token 数。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Token","机器注册"),render:t=>etX(t.title,String(e.totals.tokens),42,u8)},{id:"machines",title:"机器组",description:"机器角色、版本和标签。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etZ("机器组","机器组"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bt,{machines:e.machines})]})},{id:"topology",title:"拓扑图",description:"工作组连接拓扑。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:12,h:6},defaultConfig:etZ("拓扑图","网络拓扑"),render:()=>(0,eb.jsx)("section",{className:"size-full rounded-xl border bg-card p-3",children:(0,eb.jsx)(BV,{nodes:e.topology.nodes,links:e.topology.links})})},{id:"direct",title:"直连",description:"直连路径数量。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("直连","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.direct),42,u4)},{id:"p2p",title:"P2P",description:"P2P 路径数量。",icon:(0,eb.jsx)(FK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("P2P","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.p2p),42,u3)},{id:"relay",title:"Relay",description:"Relay 路径数量。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Relay","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.relay),42,u6)},{id:"broken",title:"中断",description:"中断路径数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("中断","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.broken),42,u8)},{id:"trend",title:"延迟",description:"不同路径延迟趋势。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("延迟","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B_,{config:Jg,data:e.latency})]})},{id:"paths",title:"候选路径",description:"可用连接路径候选。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("候选路径","网络候选路径"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BD,{candidates:e.candidates})]})}]}let et6=et3(),et8=[{id:"total",kind:"total",x:0,y:0,w:3,h:2},{id:"online",kind:"online",x:3,y:0,w:3,h:2},{id:"runtime",kind:"runtime",x:6,y:0,w:3,h:2},{id:"tokens",kind:"tokens",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:12,h:4},{id:"topology",kind:"topology",x:0,y:6,w:12,h:6},{id:"direct",kind:"direct",x:0,y:12,w:3,h:2},{id:"p2p",kind:"p2p",x:3,y:12,w:3,h:2},{id:"relay",kind:"relay",x:6,y:12,w:3,h:2},{id:"broken",kind:"broken",x:9,y:12,w:3,h:2},{id:"trend",kind:"trend",x:0,y:14,w:6,h:4},{id:"paths",kind:"paths",x:6,y:14,w:6,h:4}],et7=[{id:"events",title:"日志与审计",description:"审计事件时间线。",icon:(0,eb.jsx)(etB,{className:"size-4"}),defaultSize:{w:8,h:7},defaultConfig:etZ("日志与审计","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bD,{events:Jm})]})},{id:"filters",title:"筛选",description:"审计记录筛选维度。",icon:(0,eb.jsx)(etV,{className:"size-4"}),defaultSize:{w:4,h:3},defaultConfig:etZ("筛选","审计筛选"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(b_,{rows:[["机器","4"],["用户","4"],["Agent","6"],["时间","24h"]]})]})},{id:"risk",title:"拒绝事件",description:"权限拒绝和危险操作数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:etZ("拒绝事件","审计事件"),render:e=>etX(e.title,"05",42,"/themes/jelly/bg5.png")},{id:"trend",title:"事件趋势",description:"审计事件趋势图。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etZ("事件趋势","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(FL,{config:Jg,data:Jp})]})}],et9=[{id:"events",kind:"events",x:0,y:0,w:8,h:7},{id:"filters",kind:"filters",x:8,y:0,w:4,h:3},{id:"risk",kind:"risk",x:8,y:3,w:4,h:4},{id:"trend",kind:"trend",x:0,y:7,w:12,h:4}],ene={totals:{machines:0,online:0,runtime:0,tokens:0},machines:[],topology:{nodes:[],links:[]},pathTotals:{direct:0,p2p:0,relay:0,broken:0},latency:[],candidates:[]},ent={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function enn(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,i=!1;async function a(){if(!i){i=!0;try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let i=await t.json();n&&r(i)}catch{n&&r(t)}finally{i=!1}}}a();let o=window.setInterval(a,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}function enr(e){return(0,eb.jsx)(f5,{children:e})}function eni({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=enn("/api/local/machines/fleet",ene),i=ew.useMemo(()=>et3(r),[r]);return(0,eb.jsx)(mk,{boardId:"machine-group",definitions:i,initialLayouts:et8,clipboardItems:e,actionLabel:"机器组页面卡片操作",paletteGroupTitle:"机器组页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let ena=[{id:"processes",x:0,y:0,w:12,h:8}],eno=f4(ena);function enl(){return enr((0,eb.jsx)(etD,{layouts:ena,children:(0,eb.jsx)(etT,{layout:et_(eno,"processes"),className:"overflow-hidden",children:(0,eb.jsx)(ee_,{})})}))}let ens=[{id:"performance",x:0,y:0,w:12,h:8}],enc=f4(ens);function end(){return enr((0,eb.jsx)(etD,{layouts:ens,children:(0,eb.jsx)(etT,{layout:et_(enc,"performance"),className:"overflow-hidden",children:(0,eb.jsx)(eeD,{})})}))}function enu({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"audit-logs",definitions:et7,initialLayouts:et9,clipboardItems:e,actionLabel:"日志审计页面卡片操作",paletteGroupTitle:"日志审计页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let enf=eN("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),enh=eN("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),enp=eN("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),enm=eN("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),eng=[{id:"dashboard",label:eI.dashboard,icon:(0,eb.jsx)(etV,{})},{id:"canvas",label:eI.canvas,icon:(0,eb.jsx)(HI,{}),badge:"4"},{id:"machines",label:eI.machines,icon:(0,eb.jsx)(Fq,{})},{id:"schedules",label:eI.schedules,icon:(0,eb.jsx)(V8,{})},{id:"settings",label:eI.settings,icon:(0,eb.jsx)(mf,{})}],env=[{id:"dashboard",title:eI.dashboard,description:ez.subtitle,sections:[{id:"main",items:[{id:"overview",label:eI.overview,icon:(0,eb.jsx)(vw,{})},{id:"runs",label:eI.runs,icon:(0,eb.jsx)(B7,{}),badge:"12"},{id:"telemetry",label:eI.telemetry,icon:(0,eb.jsx)(Hz,{})}]}]},{id:"canvas",title:eI.canvas,description:"节点画布、Agent 对话和运行工作区。",sections:[{id:"canvases",title:eI.canvas,items:[{id:"open-recent-canvas",label:eI.canvasRecent,icon:(0,eb.jsx)(HI,{})},{id:"new-canvas",label:eI.canvasNew,icon:(0,eb.jsx)(s7,{})},{id:"all-canvases",label:eI.canvasAll,icon:(0,eb.jsx)(FW,{})}]},{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:eI.conversationRecent,icon:(0,eb.jsx)(enh,{})},{id:"new-agent-conversation",label:eI.conversationNew,icon:(0,eb.jsx)(mR,{})},{id:"all-conversations",label:eI.conversationAll,icon:(0,eb.jsx)(B7,{})}]}]},{id:"machines",title:eI.machines,description:"机器、网络、权限和审计。",sections:[{id:"machines",items:[{id:"machine-group",label:eI.fleet,icon:(0,eb.jsx)(eP,{})},{id:"process-management",label:"进程管理",icon:(0,eb.jsx)(enm,{})},{id:"machine-performance",label:"性能",icon:(0,eb.jsx)(Hz,{})},{id:"machine-firewall",label:"防火墙",icon:(0,eb.jsx)(Q$,{})},{id:"audit-logs",label:"日志与审计",icon:(0,eb.jsx)(enp,{})},{id:"machine-files",label:"文件管理",icon:(0,eb.jsx)(enf,{})}]}]},{id:"schedules",title:eI.schedules,description:"自动化、维护窗口和提醒。",sections:[{id:"plans",items:[{id:"calendar",label:eI.calendar,icon:(0,eb.jsx)(V8,{})},{id:"alerts",label:"提醒",icon:(0,eb.jsx)(V6,{})}]}]},{id:"settings",title:eI.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,eb.jsx)(mf,{})},{id:"card-management",label:"卡片管理",icon:(0,eb.jsx)(etV,{})},{id:"billing",label:eI.billing,icon:(0,eb.jsx)(FW,{})}]}]}],enx=eN("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]);function eny({className:e,divided:t=!0,children:n,...r}){let i=ew.Children.toArray(n).filter(Boolean);return(0,eb.jsx)("div",{"data-slot":"settings-card",className:tK("vtl-surface-card overflow-hidden rounded-[var(--surface-card-radius)] border",e),...r,children:t?i.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e,t<i.length-1&&(0,eb.jsx)(V7,{})]},t)):n})}let enb=[{id:"cards",x:0,y:0,w:12,h:9}],enw=f4(enb),enj=[{id:"machine-workspaces",title:"机器页面",cards:[{id:"process-management",title:"进程管理",description:"机器进程、服务和 Agent worker 进程视图。",icon:(0,eb.jsx)(enm,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器进程"},{id:"machine-performance",title:"性能",description:"CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器遥测"},{id:"firewall",title:"防火墙",description:"防火墙策略、IP 地址、续期和申请视图。",icon:(0,eb.jsx)(Q$,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"防火墙策略"},{id:"file-manager-window",title:"文件管理窗口",description:"可拖拽、缩放和多窗口并存的文件管理组件。",icon:(0,eb.jsx)(enx,{className:"size-4"}),defaultSize:{w:6,h:5},dataSource:"工作区文件"}]}];function enk(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function enS(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function enC(){let e=etE(),[t,n]=ew.useState(),r=ew.useCallback(()=>{},[]),i=ew.useCallback(()=>{},[]),a=ew.useMemo(()=>Ha({onSelect:r}),[r]),o=ew.useMemo(()=>Hl({onSelect:i}),[i]),l=ew.useMemo(()=>[{id:"dashboard",title:"运维总览",cards:e.map(enS)},{id:"runs",title:"运行",cards:etQ.map(enk)},{id:"telemetry",title:"遥测",cards:et2.map(enk)},{id:"all-canvases",title:"浏览所有画布",cards:a.map(enk)},{id:"all-conversations",title:"浏览所有对话",cards:o.map(enk)},{id:"machine-group",title:"机器组",cards:et6.map(enk)},{id:"audit-logs",title:"日志与审计",cards:et7.map(enk)},...enj],[o,a,e]);return(0,eb.jsx)(f5,{children:(0,eb.jsx)("div",{className:"vtl-card-management-page",children:(0,eb.jsx)(etD,{layouts:enb,children:(0,eb.jsx)(etT,{layout:et_(enw,"cards"),children:(0,eb.jsx)(eny,{className:"h-full",divided:!1,children:t?(0,eb.jsx)(enM,{groupTitle:t.groupTitle,card:t.card,onBack:()=>n(void 0)}):(0,eb.jsx)(enN,{groups:l,onSelect:(e,t)=>n({groupTitle:e,card:t})})})})})})})}function enN({groups:e,onSelect:t}){return(0,eb.jsxs)("div",{className:"vtl-card-management-list flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4 px-5 py-4",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"text-base font-semibold",children:"卡片管理"}),(0,eb.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"当前可用卡片按页面分组。"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[(0,eb.jsx)(etV,{className:"size-4"}),(0,eb.jsx)("span",{children:e.reduce((e,t)=>e+t.cards.length,0)})]})]}),(0,eb.jsx)(f1,{className:"min-h-0 flex-1",children:(0,eb.jsx)("div",{className:"space-y-6 px-5 pb-5",children:e.map(e=>(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)("h3",{className:"text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:e.cards.length})]}),(0,eb.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",children:e.cards.map(n=>(0,eb.jsxs)("button",{type:"button",className:tK("group/card flex min-h-20 items-start gap-3 rounded-[var(--surface-card-radius)] border bg-card px-3 py-3 text-left transition-colors","vtl-managed-card-item","hover:border-foreground/35 hover:bg-muted/35 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/25"),onClick:()=>t(e.title,n),children:[(0,eb.jsx)("span",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground transition-colors group-hover/card:text-foreground",children:n.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:n.title}),(0,eb.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[n.defaultSize.w,"x",n.defaultSize.h]})]}),(0,eb.jsx)("span",{className:"mt-1 line-clamp-2 block text-xs leading-5 text-muted-foreground",children:n.description})]})]},`${e.id}-${n.id}`))})]},e.id))})})]})}function enM({groupTitle:e,card:t,onBack:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-3 px-5 py-4",children:[(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"返回卡片管理",onClick:n,children:(0,eb.jsx)(K1,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("h2",{className:"truncate text-base font-semibold",children:t.title})]})]}),(0,eb.jsx)("div",{className:"grid min-h-0 flex-1 place-items-center px-5 pb-5",children:(0,eb.jsx)("div",{className:"w-full max-w-md rounded-[var(--surface-card-radius)] border bg-card p-5",children:(0,eb.jsxs)("div",{className:"flex items-start gap-3",children:[(0,eb.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground",children:t.icon}),(0,eb.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-sm font-medium",children:"编辑页面预留"}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"后续会在这里接入卡片配置、数据源、默认尺寸和可编辑字段。"})]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"默认尺寸"}),(0,eb.jsxs)("div",{className:"mt-1 font-medium text-foreground",children:[t.defaultSize.w,"x",t.defaultSize.h]})]}),(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"数据源"}),(0,eb.jsx)("div",{className:"mt-1 truncate font-medium text-foreground",children:t.dataSource})]})]})]})]})})})]})}let enE=eU("group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",{variants:{variant:{default:"border-transparent",outline:"border-border",muted:"border-transparent bg-muted/50"},size:{default:"gap-2.5 px-3 py-2.5",sm:"gap-2.5 px-3 py-2.5",xs:"gap-2 px-2.5 py-2"}},defaultVariants:{variant:"default",size:"default"}});function enO({className:e,variant:t="default",size:n="default",asChild:r=!1,...i}){return(0,eb.jsx)(r?eF:"div",{"data-slot":"item","data-variant":t,"data-size":n,className:tK(enE({variant:t,size:n,className:e})),...i})}let enP=eU("flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",{variants:{variant:{default:"bg-transparent",icon:"[&_svg:not([class*='size-'])]:size-4",marker:"size-8 rounded-md border bg-background ui-text-kbd font-medium text-muted-foreground [&_svg:not([class*='size-'])]:size-4",image:"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"},align:{auto:"group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start",start:"translate-y-0.5 self-start",center:"self-center"}},defaultVariants:{variant:"default",align:"auto"}});function enA({className:e,variant:t="default",align:n="auto",...r}){return(0,eb.jsx)("div",{"data-slot":"item-media","data-variant":t,"data-align":n,className:tK(enP({variant:t,align:n,className:e})),...r})}function enz({className:e,align:t,...n}){return(0,eb.jsx)("div",{"data-slot":"item-content","data-align":t,className:tK("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none","start"===t&&"self-start","center"===t&&"self-center",e),...n})}function enI({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-title",className:tK("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",e),...t})}function en_({className:e,...t}){return(0,eb.jsx)("p",{"data-slot":"item-description",className:tK("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function enD({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-actions",className:tK("flex items-center gap-2",e),...t})}let enT={back:"Back",search:"Search settings...",welcomeTitle:"Settings",welcomeDescription:"Search or choose a setting to continue.",recommendations:"Recommended",noResults:"No settings found."};function enR(e){return"string"==typeof e||"number"==typeof e?String(e):""}function enL({sections:e,recommendations:t,sectionId:n,defaultSectionId:r,childId:i,defaultChildId:a,onSelectionChange:o,labels:l,welcomeContent:s,className:c,sidebarClassName:d,contentClassName:u}){let f={...enT,...l},[h,p]=ew.useState(r),[m,g]=ew.useState(a),v=n??h,x=i??m,y=e.find(e=>e.id===v),b=y?.children?.find(e=>e.id===x),w=!!y,j=ew.useMemo(()=>e.flatMap(e=>[{value:e.id,label:e.title,description:e.description,icon:e.icon,searchValue:[enR(e.title),enR(e.description),...e.keywords??[]].join(" "),keywords:e.keywords},...(e.children??[]).map(t=>({value:`${e.id}/${t.id}`,label:t.title,description:e.title,icon:t.icon??e.icon,disabled:t.disabled,searchValue:[enR(t.title),enR(t.description),enR(e.title),...t.keywords??[]].join(" "),keywords:[enR(e.title),...t.keywords??[]]}))]),[e]),k=t??e.flatMap(e=>(e.children??[]).slice(0,2).map(t=>({id:`${e.id}-${t.id}`,title:t.title,description:e.title,icon:t.icon,sectionId:e.id,childId:t.id})));function S(e,t){void 0===n&&p(e),void 0===i&&g(t),o?.({sectionId:e,childId:t})}let C=b?.content??y?.content??s??(0,eb.jsxs)("div",{className:"mx-auto flex min-h-[22rem] w-full max-w-2xl flex-col justify-center gap-5 py-12",children:[(0,eb.jsxs)("div",{className:"space-y-2",children:[(0,eb.jsx)("h3",{className:"text-xl font-semibold tracking-normal",children:f.welcomeTitle}),(0,eb.jsx)("p",{className:"max-w-xl text-sm text-muted-foreground",children:f.welcomeDescription})]}),(0,eb.jsx)(enF,{labels:f,options:j,onSelect:(e,t)=>S(e,t)}),k.length>0&&(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsx)("div",{className:"ui-text-kbd font-medium text-muted-foreground",children:f.recommendations}),(0,eb.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:k.map(e=>(0,eb.jsx)(enO,{asChild:!0,variant:"outline",size:"xs",className:"min-h-14 flex-nowrap bg-card text-left hover:bg-muted/60",children:(0,eb.jsxs)("button",{type:"button",onClick:()=>S(e.sectionId,e.childId),children:[e.icon&&(0,eb.jsx)(enA,{variant:"marker",align:"center",children:e.icon}),(0,eb.jsxs)(enz,{className:"min-w-0 gap-0.5",children:[(0,eb.jsx)(enI,{className:"max-w-full truncate",children:e.title}),e.description&&(0,eb.jsx)(en_,{className:"line-clamp-1",children:e.description})]}),(0,eb.jsx)(enD,{className:"ml-auto",children:(0,eb.jsx)(va,{className:"size-4 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/item:opacity-100"})})]})},e.id))})]})]});return(0,eb.jsxs)("div",{"data-slot":"settings-menu-panel",className:tK("vtl-surface-panel grid min-h-[34rem] overflow-hidden rounded-[var(--surface-panel-radius)] border md:grid-cols-[15rem_minmax(0,1fr)]",c),children:[(0,eb.jsx)("aside",{"data-slot":"settings-menu-sidebar",className:tK("min-h-0 border-b bg-muted/20 md:border-r md:border-b-0",d),children:(0,eb.jsx)(f1,{className:"h-full",children:(0,eb.jsx)("div",{className:"space-y-1 p-2",children:w?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(tY,{type:"button",variant:"ghost",className:"mb-1 h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left",onClick:()=>S(void 0,void 0),children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:(0,eb.jsx)(K1,{})}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:f.back})]}),(y?.children??[]).map(e=>(0,eb.jsx)(en$,{title:e.title,icon:e.icon,badge:e.badge,active:e.id===x,disabled:e.disabled,onClick:()=>S(y?.id,e.id)},e.id))]}):e.map(e=>(0,eb.jsx)(en$,{title:e.title,icon:e.icon,badge:e.badge,disabled:e.disabled,onClick:()=>S(e.id,void 0)},e.id))})})}),(0,eb.jsxs)("main",{"data-slot":"settings-menu-content",className:tK("min-w-0 bg-[var(--surface-panel)] p-4 md:p-5",u),children:[y?(0,eb.jsx)("div",{className:"mb-4 flex min-h-8 items-center justify-between gap-4",children:(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"truncate text-lg font-semibold tracking-normal",children:b?.title??y.title}),(b?.description??y.description)&&(0,eb.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:b?.description??y.description})]})}):null,C]})]})}function en$({title:e,icon:t,badge:n,active:r,disabled:i,onClick:a}){return(0,eb.jsxs)(tY,{type:"button",variant:"ghost",disabled:i,onClick:a,className:tK("h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left font-medium",r?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:t}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e}),n&&(0,eb.jsx)(c_,{variant:"outline",className:"h-5 shrink-0 px-1.5 ui-text-kbd",children:n}),(0,eb.jsx)(va,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]})}function enF({labels:e,options:t,onSelect:n}){return(0,eb.jsx)(gW,{options:t,placeholder:e.search,emptyText:e.noResults,className:"w-full",contentClassName:"rounded-lg",onValueChange:e=>{let[t,r]=e.split("/");t&&n(t,r)},renderOption:e=>(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-4",children:e.icon??(0,eb.jsx)(cz,{})}),(0,eb.jsxs)("span",{className:"grid min-w-0 flex-1 gap-0.5",children:[(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.description&&(0,eb.jsx)("span",{className:"truncate text-sm text-muted-foreground",children:e.description})]})]})})}let enV=eU("vtl-surface-card relative w-full rounded-[var(--surface-card-radius)] border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:top-3.5 [&>svg]:left-4 [&>svg~*]:pl-7",{variants:{variant:{default:"border-border",muted:"border-border bg-muted/40",destructive:"border-destructive/35 bg-destructive/10 text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}});function enB({className:e,variant:t,...n}){return(0,eb.jsx)("div",{role:"alert","data-slot":"alert",className:tK(enV({variant:t}),e),...n})}function enH({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-title",className:tK("mb-1 leading-none font-medium",e),...t})}function enW({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-description",className:tK("text-muted-foreground [&_p]:leading-relaxed",e),...t})}let enU=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function enq(e){return{id:e.id,providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:"",models:e.models,selectedModelIds:e.selectedModelIds,loadingModels:!1,saving:!1,error:e.lastError??"",savedKeyAvailable:!0,editing:!1}}function enK(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[i,a]=ew.useState(""),o=ew.useCallback(async()=>{a("");try{let e=await gJ();t(e.routes.map(enq))}catch(e){a(e instanceof Error?e.message:"模型路由读取失败")}finally{r(!1)}},[]);function l(e,n){t(t=>t.map((t,r)=>r===e?n(t):t))}async function s(t){let n=e[t];if(n&&!n.saving){l(t,e=>({...e,saving:!0,error:""}));try{let e=await g0({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>enq(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}async function c(n){let r=e[n];if(r&&!r.saving){if(!r.id)return void t(e=>e.filter((e,t)=>t!==n));l(n,e=>({...e,saving:!0,error:""}));try{await g1(r.id),t(e=>e.filter((e,t)=>t!==n))}catch(e){l(n,t=>({...t,saving:!1,error:e instanceof Error?e.message:"删除失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,eb.jsxs)("div",{className:"grid gap-4",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,eb.jsx)("div",{className:"min-w-0",children:(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:"",editing:!0},...e])},children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加模型路由"]})]}),i?(0,eb.jsxs)(enB,{variant:"destructive",children:[(0,eb.jsx)(eeR,{}),(0,eb.jsx)(enH,{children:"读取失败"}),(0,eb.jsx)(enW,{children:i})]}):null,n?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,eb.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,eb.jsx)(enG,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)},onDelete:()=>{c(t)}},e.id??`draft-${t}`))})]})}function enG({draft:e,onDraftChange:t,onSave:n,onDelete:r}){let i=ew.useRef(e),a=ew.useRef(t),o=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),l=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),s=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function c(n){t({...e,...n})}if(ew.useEffect(()=>{i.current=e,a.current=t},[e,t]),ew.useEffect(()=>{if(!l)return;let e=window.setTimeout(async()=>{let e=i.current;a.current({...e,loadingModels:!0,error:""});try{let t=await gQ({providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:e.apiKey}),n=e.selectedModelIds.filter(e=>t.models.some(t=>t.id===e));a.current({...e,models:t.models,selectedModelIds:n,loadingModels:!1,error:""})}catch(t){a.current({...e,loadingModels:!1,error:t instanceof Error?t.message:"模型拉取失败"})}},650);return()=>window.clearTimeout(e)},[l,o]),!e.editing){let t=e.selectedModelIds.map(t=>e.models.find(e=>e.id===t)?.displayName||t).filter(Boolean),n=enU.find(t=>t.value===e.protocol)?.label??e.protocol;return(0,eb.jsxs)("section",{className:"grid min-h-16 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.providerName}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n})]}),(0,eb.jsx)("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.length>0?t.join(", "):"未选择模型"})]}),(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",onClick:()=>c({editing:!0}),children:[(0,eb.jsx)(mF,{className:"size-4"}),"编辑"]})]})}return(0,eb.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,eb.jsx)(ny,{value:e.providerName,placeholder:"提供商名称",onChange:e=>c({providerName:e.currentTarget.value})}),(0,eb.jsxs)(JR,{value:e.protocol,onValueChange:e=>c({protocol:e}),children:[(0,eb.jsx)(Qp,{className:"w-full",children:(0,eb.jsx)(JV,{})}),(0,eb.jsx)(Qv,{children:enU.map(e=>(0,eb.jsx)(Qx,{value:e.value,children:e.label},e.value))})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,eb.jsx)(ny,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>c({endpointUrl:e.currentTarget.value})}),(0,eb.jsx)(ny,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>c({apiKey:e.currentTarget.value})})]}),(0,eb.jsx)(V7,{}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,eb.jsx)(mE,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,eb.jsx)("div",{className:"grid max-h-48 gap-1 overflow-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.models.map(t=>{let n=e.selectedModelIds.includes(t.id);return(0,eb.jsxs)("label",{className:tK("grid min-h-8 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,eb.jsx)(nx,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void c({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,eb.jsx)("span",{className:"truncate",children:t.displayName||t.id})]},t.id)})}):(0,eb.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,eb.jsxs)(enB,{variant:"destructive",children:[(0,eb.jsx)(eeR,{}),(0,eb.jsx)(enH,{children:"模型路由错误"}),(0,eb.jsx)(enW,{className:"break-words",children:e.error})]}):null,(0,eb.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,eb.jsxs)(tY,{type:"button",variant:"destructive",onClick:r,disabled:e.saving,children:[(0,eb.jsx)(m0,{className:"size-4"}),"删除"]}),(0,eb.jsx)(tY,{type:"button",onClick:n,disabled:!s,children:e.saving?"保存中":"保存"})]})]})}let enY=[{id:"settings",x:0,y:0,w:12,h:8}],enX=f4(enY);function enZ(){return(0,eb.jsx)(f5,{children:(0,eb.jsx)(etD,{layouts:enY,children:(0,eb.jsx)(etT,{layout:et_(enX,"settings"),children:(0,eb.jsx)(enL,{className:"h-full min-h-0",contentClassName:"min-h-0 overflow-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",sections:[{id:"preferences",title:"偏好设置",icon:(0,eb.jsx)(mE,{}),children:[{id:"model-routes",title:"模型路由",icon:(0,eb.jsx)(mE,{}),content:(0,eb.jsx)(enK,{})}]}],defaultSectionId:"preferences",defaultChildId:"model-routes",labels:{back:"返回",search:"搜索设置",welcomeTitle:"偏好设置",welcomeDescription:"",recommendations:"常用",noResults:"没有设置项"}})})})})}let enJ=eN("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),enQ=eN("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var en0=e.i(91e3);let en1=["light","dark","jelly"],en2={light:{label:"Light",icon:enQ,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:enJ,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,eb.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,eb.jsx)("path",{d:"M6.5 11.5C6.5 8 8.7 5.5 12 5.5s5.5 2.5 5.5 6v.6c0 .8-.6 1.4-1.4 1.4H7.9c-.8 0-1.4-.6-1.4-1.4v-.6Z"}),(0,eb.jsx)("path",{d:"M7.8 13.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5"}),(0,eb.jsx)("path",{d:"M9 15.5c0 1.4-1.2 1.4-1.2 2.8 0 .7.3 1.2.8 1.7"}),(0,eb.jsx)("path",{d:"M12 15.5c0 1.6-1.4 1.6-1.4 3.2 0 .7.3 1.2.8 1.8"}),(0,eb.jsx)("path",{d:"M15 15.5c0 1.4 1.2 1.4 1.2 2.8 0 .7-.3 1.2-.8 1.7"})]})},className:"text-primary"}};function en5(){let{resolvedTheme:e,setTheme:t}=(0,Uh.useTheme)(),[n,r]=ew.useState(en0.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(en0.appearanceThemeStorageKey)??en0.defaultAppearanceTheme;r(e),(0,en0.applyAppearanceTheme)({theme:e})},[]);let i=n===en0.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",a=en1.indexOf(i),o=en1[(a+1)%en1.length]??"light",{icon:l,label:s,className:c}=en2[i];function d(e){r(e),window.localStorage.setItem(en0.appearanceThemeStorageKey,e),(0,en0.applyAppearanceTheme)({theme:e})}return(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",className:tK("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${ez.theme}: ${s}`,title:`${ez.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),d(en0.jellyAppearanceTheme);return}d(en0.defaultAppearanceTheme),t(o)},children:(0,eb.jsx)(l,{})})}function en4({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"runtime-operations",definitions:etQ,initialLayouts:et0,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function en3({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=enn("/api/local/machines/telemetry",ent),i=ew.useMemo(()=>et1(r),[r]);return(0,eb.jsx)(mk,{boardId:"telemetry",definitions:i,initialLayouts:et5,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function en6(){let[e,t]=ew.useState("dashboard"),[n,r]=ew.useState(!1),[i,a]=ew.useState(!1),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[d,u]=ew.useState(!1),[f,h]=ew.useState([]),[p,m]=ew.useState([]),[g,v]=ew.useState({}),[x,y]=ew.useState(),[b,w]=ew.useState(HV),[j,k]=ew.useState([]),[S,C]=ew.useState(),N=ew.useCallback(e=>{w(t=>o9(e,t))},[]),M=ew.useCallback(e=>{k(t=>o9(e,t))},[]),E=ew.useCallback(async e=>{c(await Hh(e)),t("new-agent-conversation")},[]),O=ew.useCallback(async()=>{let e=await Hu();e?(c(await Hh(e.conversation.id)),t("new-agent-conversation")):l(!0)},[]);return(0,eb.jsxs)("main",{className:"vtl-app-background relative h-svh overflow-hidden text-foreground",children:[(0,eb.jsx)("div",{className:"pointer-events-none fixed inset-y-0 left-0 z-40 p-3",children:(0,eb.jsx)(uX,{navItems:eng,contents:env,defaultActiveNavId:"dashboard",defaultSelectedItemId:"overview",defaultExpandedItemIds:["runs"],logo:(0,eb.jsx)(nw,{}),account:(0,eb.jsx)(nj,{}),labels:{collapse:"收起菜单",expand:"展开菜单",search:eI.search,account:"账户",hideSidebar:"收起侧边栏",showSidebar:"展开侧边栏"},className:"h-[calc(100svh-1.5rem)] drop-shadow-lg",footer:(0,eb.jsx)(en5,{}),onItemSelect:({item:e})=>{"new-canvas"===e.id?t("new-canvas"):"all-canvases"===e.id?t("all-canvases"):"new-agent-conversation"===e.id?l(!0):"open-recent-conversation"===e.id?O():"all-conversations"===e.id?t("all-conversations"):"overview"===e.id?t("dashboard"):"runs"===e.id?t("runs"):"telemetry"===e.id?t("telemetry"):("machine-group"===e.id||"process-management"===e.id||"machine-performance"===e.id||"machine-firewall"===e.id||"audit-logs"===e.id||"machine-files"===e.id||"preferences"===e.id||"card-management"===e.id)&&t(e.id)}})}),(0,eb.jsxs)("section",{className:tK("h-full min-w-0","dashboard"===e?"overflow-auto pl-[8.5rem]":"overflow-hidden"),children:["runs"===e?(0,eb.jsx)(en4,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"telemetry"===e?(0,eb.jsx)(en3,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-group"===e?(0,eb.jsx)(eni,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"process-management"===e?(0,eb.jsx)(enl,{}):"machine-performance"===e?(0,eb.jsx)(end,{}):"machine-firewall"===e?(0,eb.jsx)(et$,{}):"audit-logs"===e?(0,eb.jsx)(enu,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-files"===e?(0,eb.jsx)(Q3,{clipboardItems:f,onClipboardItemsChange:h}):"preferences"===e?(0,eb.jsx)(enZ,{}):"card-management"===e?(0,eb.jsx)(enC,{}):"new-canvas"===e?(0,eb.jsx)(etb,{nodes:b,edges:j,selectedNodeId:S,clipboardItems:f,onNodesChange:N,onEdgesChange:M,onNodesSet:w,onEdgesSet:k,onSelectedNodeChange:C,onClipboardItemsChange:h}):"all-canvases"===e?(0,eb.jsx)(eth,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"new-agent-conversation"===e?(0,eb.jsx)(eto,{conversation:s,clipboardItems:f,clipboardDraggingId:x,onClipboardItemsChange:h,onClipboardDraggingChange:y,onOverlayOpenChange:a}):"all-conversations"===e?(0,eb.jsx)(HC,{clipboardItems:f,onClipboardItemsChange:h,onOpenConversation:e=>{E(e)},onOverlayOpenChange:u}):(0,eb.jsx)(etO,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:r}),(0,eb.jsx)(etz,{hidden:"dashboard"===e?n||o:"new-agent-conversation"===e?i||o:d,items:f,trashItems:p,draggingId:x,onDraggingChange:y,onItemsChange:h,onTrashItemsChange:m,onTrashClipboardItemsChange:v,trashClipboardItems:g})]}),(0,eb.jsx)(HO,{open:o,onOpenChange:l,onCreated:e=>{c(e),t("new-agent-conversation")}})]})}let en8=ey.default.env.NEXT_PUBLIC_VANTALOOM_AUTH_MODE??"disabled-local";function en7(){let[e,t]=ew.useState("disabled-local"===en8);return e?(0,eb.jsx)(en6,{}):(0,eb.jsx)(nb,{onComplete:()=>t(!0)})}e.s(["default",()=>en7],66204)}]);
49
+ </style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,eb.jsx)("iframe",{title:e,sandbox:"allow-scripts",srcDoc:i,className:tK("size-full border-0 bg-background",n)})}function Je({file:e,value:t,labels:n}){let r=ew.useMemo(()=>{let n=e.bytes??(t?new TextEncoder().encode(t):[]),r=Math.min(n.length,4096),i=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);i.push({offset:e.toString(16).padStart(8,"0"),hex:t.map(e=>e.toString(16).padStart(2,"0")).join(" "),ascii:t.map(e=>e>=32&&e<=126?String.fromCharCode(e):".").join("")})}return i},[e.bytes,t]);return 0===r.length?(0,eb.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:n.noContent}):(0,eb.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,eb.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,eb.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,eb.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function Jt({file:e,labels:t,onApprove:n}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,eb.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,eb.jsx)(ZG,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("h3",{className:"ui-text-body font-medium text-foreground",children:t.binaryTitle}),(0,eb.jsx)("p",{className:"ui-text-body text-muted-foreground",children:t.binaryDescription})]}),(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[Z5(e.size)&&(0,eb.jsx)(c_,{variant:"outline",children:Z5(e.size)}),(0,eb.jsx)(tY,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function Jn({labels:e}){return(0,eb.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:e.unsupportedPreview})}function Jr({file:e,value:t,labels:n,renderPreview:r,className:i}){let a=Z1(e),o=e.src?e.src:t&&"svg"===Z1(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,eb.jsx)("div",{"data-slot":"file-tab-custom-preview",className:tK("size-full",i),children:l}):"html"===a||"richtext"===a?(0,eb.jsx)(Z9,{title:e.name,value:e.previewContent??t,className:i}):"markdown"===a?(0,eb.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:tK("size-full overflow-auto bg-background",i),children:(0,eb.jsx)(Z7,{value:t})}):"svg"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-svg-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-image-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-video-preview",className:tK("grid size-full place-items-center bg-muted/20 p-6",i),children:(0,eb.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,eb.jsx)(Jn,{labels:n})}function Ji({open:e,labels:t,currentView:n,currentMode:r,saving:i,modified:a,canSwitchView:o,canSwitchMode:l,canSave:s,canOpenHistory:c,onOpenChange:d,onToggleView:u,onToggleMode:f,onSave:h,onHistory:p}){let m=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:u,icon:"code"===n?(0,eb.jsx)(K0,{className:"size-4"}):(0,eb.jsx)(vl,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:f,icon:"review"===r?(0,eb.jsx)(ZY,{className:"size-4"}):(0,eb.jsx)(eE,{className:"size-4"})}:void 0,s?{key:"save",label:i?t.saving:t.save,onClick:h,disabled:i||!a,icon:(0,eb.jsx)(ZJ,{className:"size-4"})}:void 0,c?{key:"history",label:t.history,onClick:p,icon:(0,eb.jsx)(B3,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===m.length?null:(0,eb.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[m.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.disabled&&"opacity-45"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>d(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function Ja({file:e,value:t,defaultValue:n,onValueChange:r,mode:i,defaultMode:a="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:d=!1,onSave:u,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,onHistory:v,labels:x,className:y,editorClassName:b,previewClassName:w,headerClassName:j,...k}){var S;let C,N,M=ew.useMemo(()=>({...ZQ,...x}),[x]),[E,O]=ew.useState(n??e.content??""),[P,A]=ew.useState(a),[z,I]=ew.useState(s),[_,D]=ew.useState(!1),[T,R]=ew.useState(!1),[L,$]=ew.useState(!1),F=ew.useRef(null),V=t??E,B=i??P,H=(S=l??z,(C=Z4(e)).includes(S)?S:C[0]),W=Z1(e),U=Z4(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(Z1(e)),K=!!u&&q&&"code"===H&&(d||L),G="review"===B||!0===e.readOnly,Y="binary"===(N=Z1(e))||"image"!==N&&"video"!==N&&!!(e.size&&e.size>h&&!e.content),X=(e.path??e.name).split(/[\\/]+/).filter(Boolean),Z=Z5(e.size??V.length);async function J(){if(u&&!L){$(!0);try{await u(V),R(!1)}catch(e){f?.(e)}finally{$(!1)}}}return ew.useEffect(()=>{void 0===t&&O(n??e.content??""),D(!1),R(!1)},[n,e,t]),ew.useEffect(()=>{if(T)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&F.current?.contains(t)||R(!1)}},[T]),(0,eb.jsxs)("div",{ref:F,"data-slot":"file-tab-viewer","data-mode":B,"data-view":H,className:tK("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",p?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",y),...k,children:[p&&(0,eb.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",j),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===W?(0,eb.jsx)(ZX,{className:"size-3.5"}):"video"===W?(0,eb.jsx)(ZZ,{className:"size-3.5"}):"binary"===W?(0,eb.jsx)(ZG,{className:"size-3.5"}):(0,eb.jsx)(vf,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:X.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:M.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===X.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[Z&&(0,eb.jsx)(c_,{variant:"outline",children:Z}),q&&"code"===H&&(G?(0,eb.jsxs)(c_,{variant:"secondary",children:[(0,eb.jsx)(s5,{className:"size-3"}),M.review]}):(0,eb.jsxs)(c_,{variant:"outline",children:[(0,eb.jsx)(ZY,{className:"size-3"}),M.edit]}))]})]}),(0,eb.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:Y&&!_?(0,eb.jsx)(Jt,{file:e,labels:M,onApprove:()=>D(!0)}):"preview"===H?(0,eb.jsx)(Jr,{file:e,value:V,labels:M,renderPreview:g,className:w}):"hex"===H?(0,eb.jsx)(Je,{file:e,value:V,labels:M}):(0,eb.jsx)(Z8,{file:e,value:V,readOnly:G,onValueChange:function(e){void 0===t&&O(e),r?.(e)},wrapLines:m,className:b})}),(0,eb.jsx)(Ji,{open:T,labels:M,currentView:H,currentMode:B,saving:L,modified:d,canSwitchView:U,canSwitchMode:q&&"code"===H,canSave:K,canOpenHistory:!!(v&&e.path),onOpenChange:R,onToggleView:function(){var e;e="code"===H?"preview":"code",void 0===l&&I(e),c?.(e)},onToggleMode:function(){var e;e="review"===B?"edit":"review",void 0===i&&A(e),o?.(e)},onSave:J,onHistory:()=>{R(!1),v?.(e)}})]})}function Jo(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function Jl(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function Js(e,t,n){let r=[...e],i=r[t],a=r[n];return i&&a&&(r[t]=a,r[n]=i),r}function Jc({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:i,onTabsChange:a,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:d,createActions:u=[],tabActions:f=[],reorderable:h=!0,detachable:p=!1,externalDropTypes:m=[],createLabel:g="New tab",moreLabel:v="More tab actions",closeLabel:x="Close tab",scrollLeftLabel:y="Scroll tabs left",scrollRightLabel:b="Scroll tabs right",tabListLabel:w="Open tabs",emptyContent:j,renderContent:k,showContent:S=!0,className:C,tabListClassName:N,contentClassName:M}){let[E,O]=ew.useState(t),P=ew.useRef(null),A=ew.useRef(null),[z,I]=ew.useState(),[_,D]=ew.useState(void 0),T=ew.useRef(void 0),[R,L]=ew.useState(void 0),[$,F]=ew.useState(!1),V=ew.useRef(void 0),B=ew.useRef(void 0),H=ew.useRef(!1),[W,U]=ew.useState(!1),[q,K]=ew.useState(!1),[G,Y]=ew.useState(),X=e??E,Z=X.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=X.find(e=>e.id===ee&&!e.disabled)??Z;ew.useEffect(()=>{!et&&Z&&void 0===n&&Q(Z.id)},[et,n,Z]);let en=ew.useCallback(t=>{void 0===e&&O(t),a?.(t)},[a,e]),er=ew.useCallback(e=>{T.current=e,D(e)},[]),ei=ew.useCallback(()=>{let e=A.current,t=new Map;if(!e)return t;for(let n of e.querySelectorAll("[data-tab-id]")){let e=n.getBoundingClientRect(),r=n.dataset.tabId;r&&t.set(r,{left:e.left,top:e.top})}return t},[]),ea=ew.useCallback((e,t=!0)=>{t&&(B.current=ei()),V.current=e,L(e)},[ei]),eo=ew.useCallback(()=>{let e=A.current;if(!e){U(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;U(e.scrollLeft>1),K(e.scrollLeft<t-1)},[]);function el(e){let t=A.current;if(!t)return;let n=Math.max(.7*t.clientWidth,160);t.scrollLeft+="left"===e?-n:n,window.requestAnimationFrame(eo)}ew.useEffect(()=>{F(!0)},[]),ew.useEffect(()=>{eo();let e=A.current;if(!e)return;let t=new ResizeObserver(eo);return t.observe(e),window.addEventListener("resize",eo),()=>{t.disconnect(),window.removeEventListener("resize",eo)}},[X.length,eo]),ew.useLayoutEffect(()=>{let e=B.current,t=A.current;if(e&&t)for(let n of(B.current=void 0,t.querySelectorAll("[data-tab-id]"))){let t=n.dataset.tabId;if(!t)continue;let r=e.get(t);if(!r)continue;let i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;1>Math.abs(a)&&1>Math.abs(o)||n.animate([{transform:`translate(${a}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[R]);let es=ew.useCallback(e=>{let t=A.current;if(t)return Array.from(t.querySelectorAll("[data-tab-id]")).find(t=>t.dataset.tabId===e)},[]),ec=ew.useCallback((e,t)=>{let n=V.current??X,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let i=t-e.offsetX,a=i+e.width,o=t>=e.currentX,l=n[r+1],s=n[r-1];if(o&&l&&!l.disabled){let e=es(l.id),t=e?.getBoundingClientRect();t&&a>=t.left+.7*t.width&&ea(Js(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&i<=t.right-.7*t.width&&ea(Js(n,r,r-1))}},[es,X,ea]);function ed(e){if(!d||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function eu(e){let t=A.current;if(!t)return{index:X.length,left:0};let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll("[data-tab-id]"));if(0===r.length)return{index:0,left:t.scrollLeft+8};for(let[i,a]of r.entries()){let r=a.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:i,left:r.left-n.left+t.scrollLeft}}let i=r[r.length-1].getBoundingClientRect();return{index:r.length,left:i.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(_)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=T.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,i=t.dragging||Math.abs(n)>4||Math.abs(r)>4;i&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:i})}function t(e){let t=T.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=X.find(e=>e.id===t.tabId),a=P.current?.getBoundingClientRect(),o=!!a&&(e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=X.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:X,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let a=X.filter(t=>t.id!==e.id);if(en(a),e.id===ee){let e=Jo(a,r);void 0===n&&Q(e),e&&i?.(e)}return!0}(r,e)){I(void 0),er(void 0),ea(void 0,!1);return}let l=V.current;l&&!(l.length===X.length&&l.every((e,t)=>e.id===X[t]?.id))&&(en(l),s?.(l))}I(void 0),er(void 0),ea(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=_?.dragging&&R?R:X,ep=_?.dragging?X.find(e=>e.id===_.tabId):void 0,em=_?.dragging&&ep&&$?(0,t3.createPortal)((0,eb.jsxs)("div",{"data-slot":"multi-tab-drag-preview","aria-hidden":"true",className:"pointer-events-none fixed z-[100] flex h-9 min-w-0 items-center gap-1 rounded-t-lg border border-border bg-background px-2.5 text-foreground shadow-lg",style:{left:_.currentX-_.offsetX,top:_.top,width:_.width},children:[ep.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,eb.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:tK("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,eb.jsxs)("div",{className:"relative flex min-w-0 shrink-0 items-end gap-1 border-b bg-muted/35 px-1.5 pt-1.5",children:[W&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,eb.jsx)(cO,{})}),(0,eb.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:tK("relative flex min-w-0 flex-1 items-end overflow-x-auto [scrollbar-width:none] data-[overflow=both]:[mask-image:linear-gradient(90deg,transparent,black_24px,black_calc(100%-24px),transparent)] data-[overflow=left]:[mask-image:linear-gradient(90deg,transparent,black_24px)] data-[overflow=right]:[mask-image:linear-gradient(90deg,black_calc(100%-24px),transparent)] [&::-webkit-scrollbar]:hidden",N),"data-overflow":W&&q?"both":W?"left":q?"right":void 0,onScroll:eo,onDragOver:function(e){ed(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",Y(eu(e)))},onDragLeave:function(e){if(!ed(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Y(void 0)},onDrop:function(e){if(!ed(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=eu(e);Y(void 0),d?.({tabs:X,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,a=eh[t+1],o=_?.dragging&&z===e.id,s=!r&&!o&&void 0!==a&&a.id!==et?.id&&a.id!==z;return(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();I(e.id),ea(X,!1),er({tabId:e.id,startX:t.clientX,startY:t.clientY,offsetX:t.clientX-n.left,top:n.top,width:n.width,currentX:t.clientX,currentY:t.clientY,dragging:!1})})(e,t),"data-slot":"multi-tab","data-tab-id":e.id,"data-state":r?"active":"inactive","data-dragging":z===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:tK("group/tab relative flex h-9 min-w-0 max-w-52 shrink-0 items-center gap-1 rounded-t-lg border border-b-0 px-2.5 transition-[border-color,background-color,color,box-shadow,outline-color] duration-150 ease-out",h&&!e.disabled&&"cursor-grab active:cursor-grabbing",r?"border-border bg-background text-foreground shadow-[0_-1px_0_var(--background)_inset]":"border-transparent bg-transparent text-muted-foreground hover:bg-background/70 hover:text-foreground",o&&"border-dashed border-border bg-muted/45 text-transparent shadow-none outline outline-1 outline-ring/30 [&_*]:opacity-0",e.disabled&&"pointer-events-none opacity-50"),children:[(0,eb.jsx)("button",{type:"button",role:"tab","aria-label":Jl(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let a;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(a=X.find(e=>e.id===r))&&!a.disabled&&(void 0===n&&Q(r),i?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,eb.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none relative z-10 flex min-w-0 flex-1 items-center gap-1.5",children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,eb.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(Jl(e.title)?`${x}: ${Jl(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=X.findIndex(t=>t.id===e.id),r=X.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=Jo(r,t);void 0===n&&Q(e),e&&i?.(e)}})(e),className:tK("relative z-20 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none group-hover/tab:opacity-100",r&&"opacity-100"),children:(0,eb.jsx)(p6,{className:"size-3.5"})})]}),s&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,eb.jsxs)("span",{"data-slot":"multi-tab-external-insert","aria-hidden":"true",className:"pointer-events-none absolute top-2 bottom-1 z-30 flex w-0 -translate-x-1/2 items-center justify-center",style:{left:G.left},children:[(0,eb.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,eb.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,eb.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[q&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,eb.jsx)(va,{})}),u.length>0?(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,eb.jsx)(s7,{})})}),(0,eb.jsx)(yj,{align:"end",className:"w-52",children:u.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yN,{}),(0,eb.jsxs)(yk,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yM,{children:e.shortcut})]})]},t))})]}):(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...X,e]),e.disabled||(void 0===n&&Q(e.id),i?.(e.id)))},children:(0,eb.jsx)(s7,{})}),f.length>0&&(0,eb.jsxs)(yd,{children:[(0,eb.jsx)(yf,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,eb.jsx)(s6,{})})}),(0,eb.jsx)(yj,{align:"end",className:"w-52",children:f.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yN,{}),(0,eb.jsxs)(yk,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yM,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,eb.jsx)("div",{"data-slot":"multi-tab-content",className:tK("min-h-0 overflow-hidden",M),children:ef??j??(0,eb.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let Jd=[{policyNumber:3,name:"Allow HTTP Traffic",sourceZone:"Trust",sourceIPs:["192.168.1.0/24","10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["192.168.2.0/24"],tags:["Web Access","Internal"],action:"allow",description:"Permits HTTP traffic from internal network"},{policyNumber:5,name:"Block Suspicious IPs",sourceZone:"Untrust",sourceIPs:["203.0.113.0/24","198.51.100.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Security"],action:"deny",description:"Blocks known malicious IP ranges"},{policyNumber:9,name:"SSH Access Control",sourceZone:"Trust",sourceIPs:["172.16.0.0/12"],destinationZone:"Trust",destinationIPs:["10.50.0.0/16"],tags:["Admin Access","VPN"],action:"allow",description:"Restricted SSH access for admin network"},{policyNumber:12,name:"Database Port Protection",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["10.100.0.0/24"],tags:["Blocking","Database"],action:"deny",description:"Blocks external access to database ports"},{policyNumber:15,name:"API Gateway Access",sourceZone:"Trust",sourceIPs:["192.168.100.0/24","192.168.101.0/24"],destinationZone:"Trust",destinationIPs:["10.200.0.5"],tags:["API","VDI Env"],action:"allow",description:"Allows traffic to API gateway from specific subnets"},{policyNumber:18,name:"Drop Legacy SMB",sourceZone:"Trust",sourceIPs:["Any"],destinationZone:"Trust",destinationIPs:["10.20.0.0/16"],tags:["Legacy","Internal"],action:"drop",description:"Drops SMBv1 probes across workstation networks"},{policyNumber:22,name:"Agent Runtime Mesh",sourceZone:"Trust",sourceIPs:["10.10.4.0/24"],destinationZone:"Trust",destinationIPs:["10.10.8.0/24","10.10.12.0/24"],tags:["Agent","Runtime"],action:"allow",description:"Allows managed agent runtime channels between worker pools"},{policyNumber:27,name:"Block Public Admin Ports",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Admin Access"],action:"deny",description:"Denies public access to SSH, RDP, and database admin ports"},{policyNumber:31,name:"Build Cache Access",sourceZone:"Trust",sourceIPs:["10.30.0.0/16"],destinationZone:"Trust",destinationIPs:["10.60.12.20"],tags:["Build","Internal"],action:"allow",description:"Allows build workers to reach shared cache storage"},{policyNumber:36,name:"Relay Egress",sourceZone:"Trust",sourceIPs:["10.40.0.0/16"],destinationZone:"Untrust",destinationIPs:["198.18.0.0/15"],tags:["Relay","Agent"],action:"allow",description:"Permits relay service egress to managed edge addresses"},{policyNumber:41,name:"Quarantine Subnet",sourceZone:"Quarantine",sourceIPs:["10.250.0.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Security","Blocking"],action:"deny",description:"Blocks quarantined hosts from internal services"},{policyNumber:48,name:"Observability Intake",sourceZone:"Trust",sourceIPs:["10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["10.80.4.10"],tags:["Telemetry","Internal"],action:"allow",description:"Allows metrics and logs to the observability intake"}],Ju=Array.from(new Set(Jd.flatMap(e=>e.tags))).sort(),Jf=[["10.10.4.0/24","Agent workers","Trust","18"],["10.20.0.0/16","Workstations","Trust","41"],["10.250.0.0/24","Quarantine","Quarantine","03"],["198.18.0.0/15","Relay edge","Untrust","12"]],Jh=[["Database Port Protection","2026-06-12","Security"],["Relay Egress","2026-06-28","Network"],["Build Cache Access","2026-07-04","Build"],["Observability Intake","2026-07-18","Ops"]],Jp=[{time:"09:00",p2p:42,direct:12,relay:96},{time:"10:00",p2p:39,direct:12,relay:88},{time:"11:00",p2p:44,direct:14,relay:91},{time:"12:00",p2p:38,direct:12,relay:84},{time:"13:00",p2p:36,direct:11,relay:86},{time:"14:00",p2p:41,direct:13,relay:93}],Jm=[["14:42","Allay 将 Linux-runner-02 加入 Compute 机器组","done"],["14:37","Ops 对 runner 服务发起重启确认","current"],["14:25","UI Polish Agent 访问 D:\\Projects\\Vantaloom-ui","done"],["14:18","Viewer 请求远程 shell 被拒绝","blocked"],["14:07","Observer-01 P2P 心跳恢复","done"],["13:54","Buildbot 读取发布产物目录","done"]],Jg={p2p:{label:"P2P",color:"var(--chart-1)"},direct:{label:"Direct",color:"var(--chart-3)"},relay:{label:"Relay",color:"var(--chart-5)"},cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"}};function Jv({className:e,...t}){return(0,eb.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:tK("mx-auto flex w-full justify-center",e),...t})}function Jx({className:e,...t}){return(0,eb.jsx)("ul",{"data-slot":"pagination-content",className:tK("flex flex-row items-center gap-1",e),...t})}function Jy({...e}){return(0,eb.jsx)("li",{"data-slot":"pagination-item",...e})}function Jb({className:e,isActive:t,size:n="icon",...r}){return(0,eb.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:tK(tG({variant:t?"outline":"ghost",size:n}),e),...r})}function Jw({className:e,previousLabel:t="Previous",...n}){return(0,eb.jsxs)(Jb,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,eb.jsx)(cO,{}),(0,eb.jsx)("span",{className:"hidden sm:block",children:t})]})}function Jj({className:e,nextLabel:t="Next",...n}){return(0,eb.jsxs)(Jb,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,eb.jsx)("span",{className:"hidden sm:block",children:t}),(0,eb.jsx)(va,{})]})}function Jk({className:e,moreLabel:t="More pages",...n}){return(0,eb.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:tK("flex size-8 items-center justify-center",e),...n,children:[(0,eb.jsx)(s6,{className:"size-4"}),(0,eb.jsx)("span",{className:"sr-only",children:t})]})}var JS=[" ","Enter","ArrowUp","ArrowDown"],JC=[" ","Enter"],JN="Select",[JM,JE,JO]=vz(JN),[JP,JA]=tX(JN,[JO,ut]),Jz=ut(),[JI,J_]=JP(JN),[JD,JT]=JP(JN),JR=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:l,onValueChange:s,dir:c,name:d,autoComplete:u,disabled:f,required:h,form:p}=e,m=Jz(t),[g,v]=ew.useState(null),[x,y]=ew.useState(null),[b,w]=ew.useState(!1),j=fb(c),[k,S]=t0({prop:r,defaultProp:i??!1,onChange:a,caller:JN}),[C,N]=t0({prop:o,defaultProp:l,onChange:s,caller:JN}),M=ew.useRef(null),E=!g||p||!!g.closest("form"),[O,P]=ew.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(";");return(0,eb.jsx)(ui,{...m,children:(0,eb.jsxs)(JI,{required:h,scope:t,trigger:g,onTriggerChange:v,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:cR(),value:C,onValueChange:N,open:k,onOpenChange:S,dir:j,triggerPointerDownPosRef:M,disabled:f,children:[(0,eb.jsx)(JM.Provider,{scope:t,children:(0,eb.jsx)(JD,{scope:e.__scopeSelect,onNativeOptionAdd:ew.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:ew.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),E?(0,eb.jsxs)(Qd,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:u,value:C,onChange:e=>N(e.target.value),disabled:f,form:p,children:[void 0===C?(0,eb.jsx)("option",{value:""}):null,Array.from(O)]},A):null]})})};JR.displayName=JN;var JL="SelectTrigger",J$=ew.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Jz(n),o=J_(JL,n),l=o.disabled||r,s=eT(t,o.onTriggerChange),c=JE(n),d=ew.useRef("touch"),[u,f,h]=Qf(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===o.value),r=Qh(t,e,n);void 0!==r&&o.onValueChange(r.value)}),p=e=>{l||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,eb.jsx)(uo,{asChild:!0,...a,children:(0,eb.jsx)(ne.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Qu(o.value)?"":void 0,...i,ref:s,onClick:tZ(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&p(e)}),onPointerDown:tZ(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:tZ(i.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&JS.includes(e.key)&&(p(),e.preventDefault())})})})});J$.displayName=JL;var JF="SelectValue",JV=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...l}=e,s=J_(JF,n),{onValueNodeHasChildrenChange:c}=s,d=void 0!==a,u=eT(t,s.onValueNodeChange);return tJ(()=>{c(d)},[c,d]),(0,eb.jsx)(ne.span,{...l,ref:u,style:{pointerEvents:"none"},children:Qu(s.value)?(0,eb.jsx)(eb.Fragment,{children:o}):a})});JV.displayName=JF;var JB=ew.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,eb.jsx)(ne.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});JB.displayName="SelectIcon";var JH=e=>(0,eb.jsx)(uv,{asChild:!0,...e});JH.displayName="SelectPortal";var JW="SelectContent",JU=ew.forwardRef((e,t)=>{let n=J_(JW,e.__scopeSelect),[r,i]=ew.useState();return(tJ(()=>{i(new DocumentFragment)},[]),n.open)?(0,eb.jsx)(JY,{...e,ref:t}):r?t3.createPortal((0,eb.jsx)(Jq,{scope:e.__scopeSelect,children:(0,eb.jsx)(JM.Slot,{scope:e.__scopeSelect,children:(0,eb.jsx)("div",{children:e.children})})}),r):null});JU.displayName=JW;var[Jq,JK]=JP(JW),JG=t6("SelectContent.RemoveScroll"),JY=ew.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g,...v}=e,x=J_(JW,n),[y,b]=ew.useState(null),[w,j]=ew.useState(null),k=eT(t,e=>b(e)),[S,C]=ew.useState(null),[N,M]=ew.useState(null),E=JE(n),[O,P]=ew.useState(!1),A=ew.useRef(!1);ew.useEffect(()=>{if(y)return pe(y)},[y]),hv();let z=ew.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:"nearest"}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,w]),I=ew.useCallback(()=>z([S,y]),[z,S,y]);ew.useEffect(()=>{O&&I()},[O,I]);let{onOpenChange:_,triggerPointerDownPosRef:D}=x;ew.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||_(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[y,_,D]),ew.useEffect(()=>{let e=()=>_(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[_]);let[T,R]=Qf(e=>{let t=E().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Qh(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),L=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(C(e),r&&(A.current=!0))},[x.value]),$=ew.useCallback(()=>y?.focus(),[y]),F=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&M(e)},[x.value]),V="popper"===r?JZ:JX,B=V===JZ?{side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g}:{};return(0,eb.jsx)(Jq,{scope:n,content:y,viewport:w,onViewportChange:j,itemRefCallback:L,selectedItem:S,onItemLeave:$,itemTextRefCallback:F,focusSelectedItem:I,selectedItemText:N,position:r,isPositioned:O,searchRef:T,children:(0,eb.jsx)(h5,{as:JG,allowPinchZoom:!0,children:(0,eb.jsx)(hd,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tZ(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,eb.jsx)(cJ,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,eb.jsx)(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:tZ(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||R(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});JY.displayName="SelectContentImpl";var JX=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J_(JW,n),o=JK(JW,n),[l,s]=ew.useState(null),[c,d]=ew.useState(null),u=eT(t,e=>d(e)),f=JE(n),h=ew.useRef(!1),p=ew.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:v,focusSelectedItem:x}=o,y=ew.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&c&&m&&g&&v){let e=a.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if("rtl"!==a.dir){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=d+"px"}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=d+"px"}let o=f(),s=window.innerHeight-20,d=m.scrollHeight,u=window.getComputedStyle(c),p=parseInt(u.borderTopWidth,10),x=parseInt(u.paddingTop,10),y=parseInt(u.borderBottomWidth,10),b=p+x+d+parseInt(u.paddingBottom,10)+y,w=Math.min(5*g.offsetHeight,b),j=window.getComputedStyle(m),k=parseInt(j.paddingTop,10),S=parseInt(j.paddingBottom,10),C=e.top+e.height/2-10,N=g.offsetHeight/2,M=p+x+(g.offsetTop+N);if(M<=C){let e=o.length>0&&g===o[o.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-C,N+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=M+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;l.style.top="0px";let t=Math.max(C,p+m.offsetTop+(e?k:0)+N);l.style.height=t+(b-M)+"px",m.scrollTop=M-C+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,l,c,m,g,v,a.dir,r]);tJ(()=>y(),[y]);let[b,w]=ew.useState();tJ(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);let j=ew.useCallback(e=>{e&&!0===p.current&&(y(),x?.(),p.current=!1)},[y,x]);return(0,eb.jsx)(JJ,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:(0,eb.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:(0,eb.jsx)(ne.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});JX.displayName="SelectItemAlignedPosition";var JZ=ew.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:i=10,...a}=e,o=Jz(n);return(0,eb.jsx)(ud,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});JZ.displayName="SelectPopperPosition";var[JJ,JQ]=JP(JW,{}),J0="SelectViewport",J1=ew.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=JK(J0,n),o=JQ(J0,n),l=eT(t,a.onViewportChange),s=ew.useRef(0);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,eb.jsx)(JM.Slot,{scope:n,children:(0,eb.jsx)(ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:tZ(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,i=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(i<r){let a=i+e,o=Math.min(r,a),l=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})});J1.displayName=J0;var J2="SelectGroup",[J5,J4]=JP(J2);ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=cR();return(0,eb.jsx)(J5,{scope:n,id:i,children:(0,eb.jsx)(ne.div,{role:"group","aria-labelledby":i,...r,ref:t})})}).displayName=J2;var J3="SelectLabel";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=J4(J3,n);return(0,eb.jsx)(ne.div,{id:i.id,...r,ref:t})}).displayName=J3;var J6="SelectItem",[J8,J7]=JP(J6),J9=ew.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=J_(J6,n),s=JK(J6,n),c=l.value===r,[d,u]=ew.useState(a??""),[f,h]=ew.useState(!1),p=eT(t,e=>s.itemRefCallback?.(e,r,i)),m=cR(),g=ew.useRef("touch"),v=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(""===r)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,eb.jsx)(J8,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:ew.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,eb.jsx)(JM.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,eb.jsx)(ne.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:p,onFocus:tZ(o.onFocus,()=>h(!0)),onBlur:tZ(o.onBlur,()=>h(!1)),onClick:tZ(o.onClick,()=>{"mouse"!==g.current&&v()}),onPointerUp:tZ(o.onPointerUp,()=>{"mouse"===g.current&&v()}),onPointerDown:tZ(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:tZ(o.onPointerMove,e=>{g.current=e.pointerType,i?s.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tZ(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:tZ(o.onKeyDown,e=>{(s.searchRef?.current===""||" "!==e.key)&&(JC.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});J9.displayName=J6;var Qe="SelectItemText",Qt=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J_(Qe,n),l=JK(Qe,n),s=J7(Qe,n),c=JT(Qe,n),[d,u]=ew.useState(null),f=eT(t,e=>u(e),s.onItemTextChange,e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),h=d?.textContent,p=ew.useMemo(()=>(0,eb.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=c;return tJ(()=>(m(p),()=>g(p)),[m,g,p]),(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(ne.span,{id:s.textId,...a,ref:f}),s.isSelected&&o.valueNode&&!o.valueNodeHasChildren?t3.createPortal(a.children,o.valueNode):null]})});Qt.displayName=Qe;var Qn="SelectItemIndicator",Qr=ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return J7(Qn,n).isSelected?(0,eb.jsx)(ne.span,{"aria-hidden":!0,...r,ref:t}):null});Qr.displayName=Qn;var Qi="SelectScrollUpButton",Qa=ew.forwardRef((e,t)=>{let n=JK(Qi,e.__scopeSelect),r=JQ(Qi,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(Qs,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Qa.displayName=Qi;var Qo="SelectScrollDownButton",Ql=ew.forwardRef((e,t)=>{let n=JK(Qo,e.__scopeSelect),r=JQ(Qo,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(Qs,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Ql.displayName=Qo;var Qs=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=JK("SelectScrollButton",n),o=ew.useRef(null),l=JE(n),s=ew.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return ew.useEffect(()=>()=>s(),[s]),tJ(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,eb.jsx)(ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:tZ(i.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(r,50))}),onPointerMove:tZ(i.onPointerMove,()=>{a.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(r,50))}),onPointerLeave:tZ(i.onPointerLeave,()=>{s()})})});ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,eb.jsx)(ne.div,{"aria-hidden":!0,...r,ref:t})}).displayName="SelectSeparator";var Qc="SelectArrow";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jz(n),a=J_(Qc,n),o=JK(Qc,n);return a.open&&"popper"===o.position?(0,eb.jsx)(uh,{...i,...r,ref:t}):null}).displayName=Qc;var Qd=ew.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=ew.useRef(null),a=eT(r,i),o=t1(t);return ew.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&n){let r=new Event("change",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,eb.jsx)(ne.select,{...n,style:{...ux,...n.style},ref:a,defaultValue:t})});function Qu(e){return""===e||void 0===e}function Qf(e){let t=cY(e),n=ew.useRef(""),r=ew.useRef(0),i=ew.useCallback(e=>{let i=n.current+e;t(i),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),a=ew.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return ew.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Qh(e,t,n){var r,i;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,l=(r=e,i=Math.max(o,0),r.map((e,t)=>r[(i+t)%r.length]));1===a.length&&(l=l.filter(e=>e!==n));let s=l.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return s!==n?s:void 0}function Qp({className:e,size:t="default",children:n,...r}){return(0,eb.jsxs)(J$,{"data-slot":"select-trigger","data-size":t,className:tK("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:line-clamp-1 [&>span]:flex [&>span]:items-center [&>span]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,eb.jsx)(JB,{asChild:!0,children:(0,eb.jsx)(cE,{className:"size-4 text-muted-foreground"})})]})}function Qm({className:e,...t}){return(0,eb.jsx)(Qa,{"data-slot":"select-scroll-up-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(vo,{})})}function Qg({className:e,...t}){return(0,eb.jsx)(Ql,{"data-slot":"select-scroll-down-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(cE,{})})}function Qv({className:e,children:t,position:n="popper",align:r="center",...i}){return(0,eb.jsx)(JH,{children:(0,eb.jsxs)(JU,{"data-slot":"select-content","data-align-trigger":"item-aligned"===n,position:n,align:r,className:tK("vtl-surface-popover relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 overflow-x-hidden overflow-y-auto rounded-[var(--surface-popover-radius)] border duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[align-trigger=true]:animate-none","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...i,children:[(0,eb.jsx)(Qm,{}),(0,eb.jsx)(J1,{"data-position":n,className:tK("p-1","popper"===n&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,eb.jsx)(Qg,{})]})})}function Qx({className:e,children:t,...n}){return(0,eb.jsxs)(J9,{"data-slot":"select-item",className:tK("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,eb.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,eb.jsx)(Qr,{children:(0,eb.jsx)(nv,{})})}),(0,eb.jsx)(Qt,{children:t})]})}function Qy({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qb(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[i,a]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>i[e]),[i]),c=ew.useMemo(()=>[{id:"policyNumber",header:"策略 #",accessorKey:"policyNumber",align:"right",width:84},{id:"name",header:"名称",accessorKey:"name",width:180,className:"font-medium"},{id:"sourceZone",header:"源区域",accessorKey:"sourceZone",width:112,cell:({row:e})=>(0,eb.jsx)(Qk,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,eb.jsx)(Qk,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,eb.jsx)(Qj,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,eb.jsx)(QS,{action:e.action})}],[]),d=ew.useMemo(()=>{let t=e.trim().toLowerCase();return Jd.filter(e=>{let r=0===t.length||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.sourceIPs.some(e=>e.toLowerCase().includes(t))||e.destinationIPs.some(e=>e.toLowerCase().includes(t)),a="all"===n||e.tags.includes(n),o=!(i.allow||i.drop||i.deny)||i.allow&&"allow"===e.action||i.drop&&"drop"===e.action||i.deny&&"deny"===e.action;return r&&a&&o})},[i,e,n]),u=Math.max(1,Math.ceil(d.length/8)),f=Math.min(o,u),h=d.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[i,e,n]),(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,eb.jsx)(Qy,{title:"防火墙策略"}),(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"新增策略"]})]}),(0,eb.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-[minmax(12rem,1fr)_10rem_auto] items-end gap-3",children:[(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,eb.jsxs)("span",{className:"relative",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,eb.jsxs)(JR,{value:n,onValueChange:r,children:[(0,eb.jsx)(Qp,{className:"w-full",children:(0,eb.jsx)(JV,{placeholder:"全部标签"})}),(0,eb.jsxs)(Qv,{children:[(0,eb.jsx)(Qx,{value:"all",children:"全部标签"}),Ju.map(e=>(0,eb.jsx)(Qx,{value:e,children:e},e))]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,eb.jsxs)(yZ,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),a({allow:!1,drop:!1,deny:!1}),l(1)):a({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,eb.jsx)(yJ,{value:"allow",children:"允许"}),(0,eb.jsx)(yJ,{value:"drop",children:"丢弃"}),(0,eb.jsx)(yJ,{value:"deny",children:"拒绝"}),(0,eb.jsx)(yJ,{value:"clear",children:"全部"})]})]})]}),(0,eb.jsx)(G9,{rows:h,columns:c,rowId:"policyNumber",showHeader:!1,showToolbar:!1,rowHeight:40,className:"min-h-0 flex-1 rounded-lg shadow-none",labels:{noRows:"没有匹配的策略。",selectAllRows:"选择当前页策略",selectRow:e=>`选择第 ${e+1} 条策略`,resizeColumn:"调整列宽",sortAsc:"升序",sortDesc:"降序",sortClear:"取消排序",copyCell:"复制单元格",copied:"已复制"}}),(0,eb.jsx)(Qw,{page:f,totalPages:u,onPageChange:function(e){l(Math.min(u,Math.max(1,e)))}})]})}function Qw({page:e,totalPages:t,onPageChange:n}){let r=ew.useMemo(()=>t<=3?Array.from({length:t},(e,t)=>t+1):e<=2?[1,2,3]:e>=t-1?[t-2,t-1,t]:[e-1,e,e+1],[e,t]),i=r[0]??1,a=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,eb.jsx)(Jv,{className:"mt-3 shrink-0",children:(0,eb.jsxs)(Jx,{className:"gap-2",children:[(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jw,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:tK(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),i>1?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),i>2?(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jk,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),a<t?(0,eb.jsxs)(eb.Fragment,{children:[a<t-1?(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jk,{moreLabel:"更多页"})}):null,(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jb,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,eb.jsx)(Jy,{children:(0,eb.jsx)(Jj,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:tK(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function Qj({items:e,variant:t}){return(0,eb.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)(c_,{variant:t,children:e},e))})}function Qk({zone:e}){return(0,eb.jsx)(c_,{variant:"Trust"===e?"secondary":"outline",children:e})}function QS({action:e}){return(0,eb.jsx)(c_,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function QC({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,eb.jsx)("table",{"data-slot":"table",className:tK("w-full caption-bottom text-sm",e),...t})})}function QN({className:e,...t}){return(0,eb.jsx)("thead",{"data-slot":"table-header",className:tK("[&_tr]:border-b",e),...t})}function QM({className:e,...t}){return(0,eb.jsx)("tbody",{"data-slot":"table-body",className:tK("[&_tr:last-child]:border-0",e),...t})}function QE({className:e,...t}){return(0,eb.jsx)("tr",{"data-slot":"table-row",className:tK("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function QO({className:e,...t}){return(0,eb.jsx)("th",{"data-slot":"table-head",className:tK("h-9 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function QP({className:e,...t}){return(0,eb.jsx)("td",{"data-slot":"table-cell",className:tK("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function QA({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qz({title:e,headers:t,rows:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsx)(QA,{title:e}),(0,eb.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,eb.jsxs)(QC,{children:[(0,eb.jsx)(QN,{children:(0,eb.jsx)(QE,{children:t.map(e=>(0,eb.jsx)(QO,{children:e},e))})}),(0,eb.jsx)(QM,{children:n.map(e=>(0,eb.jsx)(QE,{children:e.map((e,t)=>(0,eb.jsx)(QP,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function QI(){return(0,eb.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,eb.jsx)(QA,{title:"策略申请"}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(ny,{placeholder:"策略名称"}),(0,eb.jsx)(ny,{placeholder:"负责人"}),(0,eb.jsx)(ny,{placeholder:"源 CIDR"}),(0,eb.jsx)(ny,{placeholder:"目标 CIDR"})]}),(0,eb.jsx)("textarea",{placeholder:"用途",className:"min-h-32 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"}),(0,eb.jsx)("div",{children:(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"提交申请"]})})]})}function Q_(){return(0,eb.jsxs)(UR,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,eb.jsx)("div",{className:"shrink-0 px-3 pt-3",children:(0,eb.jsxs)(Uq,{className:"h-8",children:[(0,eb.jsx)(UK,{value:"policies",children:"防火墙策略"}),(0,eb.jsx)(UK,{value:"ip-addresses",children:"IP 地址"}),(0,eb.jsx)(UK,{value:"renewals",children:"续期"}),(0,eb.jsx)(UK,{value:"policy-request",children:"策略申请"}),(0,eb.jsx)(UK,{value:"user-settings",children:"用户设置"})]})}),(0,eb.jsx)(UG,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qb,{})}),(0,eb.jsx)(UG,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:Jf})}),(0,eb.jsx)(UG,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"续期",headers:["策略","续期时间","负责人"],rows:Jh})}),(0,eb.jsx)(UG,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(QI,{})}),(0,eb.jsx)(UG,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qz,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function QD(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function QT(e,t){let n=t.machineId||"local";return QD((await bu(n,e.path)).items)}function QR({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[i,a]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{a(!0);try{let e=await bd();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:QD(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{a(!1)}},[]);return ew.useEffect(()=>{s()},[s]),ew.useEffect(()=>{function e(){s()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[s]),(0,eb.jsx)(KD,{className:e,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:n,defaultExpandedIds:n.map(e=>e.id),loadingIds:i?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:QT,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function QL({open:e,onOpenChange:t,onSelectFile:n}){return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"选择本机可访问文件。"}),(0,eb.jsx)(QR,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}Qd.displayName="SelectBubbleInput";let Q$=eN("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),QF=eN("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);function QV({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:i,onMovePermissionGrantedChange:a}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,eb.jsx)(Q$,{className:"size-4"}):(0,eb.jsx)(QF,{className:"size-4"}),pressed:n,onClick:()=>a(!n)},{key:"add",label:"新建文件窗口",icon:(0,eb.jsx)(s7,{className:"size-4"}),pressed:void 0,onClick:i}];return(0,eb.jsx)("div",{className:tK("right-5 bottom-5 z-50","viewport"===t?"fixed":"absolute"),children:(0,eb.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.pressed&&"border-foreground bg-foreground text-background hover:bg-foreground/90 hover:text-background"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"文件窗口操作","aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}let QB=[];function QH(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function QW(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function QU(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function Qq(e){return e.map(e=>({...e,children:e.children?Qq(e.children):void 0}))}let QK=eN("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),QG=eN("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),QY=eN("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),QX={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function QZ({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:i,labels:a,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:d,onExpandedChange:u,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...QX,...a},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[z,I]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[_,D]=ew.useState(!1),[T,R]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),V=ew.useRef(null),B=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,U=Math.min(o,10),q=W?e:e.slice(0,U),K=E?N:void 0,G=44*q.length+18,Y=Math.min(G,l),X=W&&G>Y,Z=0===e.length?"h-24":W?`${Y}px`:"h-28",J=W&&X?14:0;ew.useEffect(()=>{if(!W){O(!1),I({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{B.current&&(B.current.scrollTop=0)}),I({canScrollUp:!1,canScrollDown:G>Y});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,Y,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),u?.(e)},[H,u]);function ee(e,t=0){let n=e.currentTarget.getBoundingClientRect();return e.clientX>=n.left-t&&e.clientX<=n.right+t&&e.clientY>=n.top-t&&e.clientY<=n.bottom+t}function et(e){if(!W||!B.current)return 0;let t=Array.from(B.current.querySelectorAll('[data-slot="clipboard-stack-card"]'));if(0===t.length)return 0;for(let[n,r]of t.entries()){let t=r.getBoundingClientRect();if(e.clientY<t.top+t.height/2)return n}return t.length}function en(e){return void 0!==S||Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.clip-id")}return ew.useEffect(()=>{if(0===e.length||W)return;let t=window.requestAnimationFrame(()=>{V.current?.matches(":hover")&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))});return()=>window.cancelAnimationFrame(t)},[e.length,Q,W]),ew.useEffect(()=>{if(!W||!X||!K||!B.current)return;let e=q.findIndex(e=>e.id===K);if(e<0)return;let t=B.current,n=44*e-8,r=44*e+(q[e]?.expandedHeight??220)+12,i=t.scrollTop,a=i+t.clientHeight;n<i?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>a&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,X,q,W]),(0,eb.jsxs)("div",{ref:V,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":_,"data-external-dragging":T,"data-expansion-direction":r,className:tK("group/clipboard relative w-80 max-w-full overflow-visible py-2",d),onMouseEnter:function(e){x?.(e),ee(e)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))},onMouseMove:function(e){if(!W){ee(e,12)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0));return}!W||S||ee(e,12)||(M(void 0),A(void 0),Q(!1),D(!0),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onMouseLeave:function(e){y?.(e),S||(M(void 0),A(void 0),D(!0),Q(!1),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onDragEnter:function(e){!s||en(e)||(L.current+=1,R(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(R(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",R(!0),W?A(et(e)):A(0))},onDrop:function(t){if(!s||en(t))return;t.preventDefault(),t.stopPropagation();let n=P??et(t);L.current=0,R(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-header",className:tK("mb-2 flex h-8 items-center gap-2 px-1 text-sm font-medium text-foreground transition-[opacity,transform] duration-200","down-left"===r&&"justify-end",W?"opacity-100":"translate-y-1 opacity-0"),children:[(0,eb.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(QY,{className:"size-3.5"})}),(0,eb.jsx)("span",{children:i??w.title}),(0,eb.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-list",className:tK("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:tK("pointer-events-none absolute top-3 right-[34px] z-50 size-2.5 rounded-full bg-foreground shadow-sm transition-[opacity,transform] duration-200 dark:bg-background",W?"scale-75 opacity-0":"opacity-100")}):null,s&&T?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:tK("pointer-events-none absolute right-0 z-[70] h-14 w-[88%] rounded-xl border bg-background shadow-md shadow-black/10","clipboard-stack-external-ghost"),children:[(0,eb.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,eb.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,eb.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,eb.jsx)("div",{className:"flex h-24 items-center justify-center rounded-xl border border-dashed bg-muted/35 text-sm text-muted-foreground",children:w.empty}):(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:B,className:tK("relative h-full overflow-x-visible",W&&X?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;I({canScrollUp:t.scrollTop>1,canScrollDown:t.scrollTop+t.clientHeight<t.scrollHeight-1})},onDragOver:function(e){W&&S&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},onDrop:function(t){if(!W||!S||void 0===P)return;t.preventDefault(),t.stopPropagation(),F.current=!0;let n=e.findIndex(e=>e.id===S),r=e[n];if(n<0||!r)return;let i=e.filter(e=>e.id!==S),a=Math.max(0,Math.min(P>n?P-1:P,i.length));i.splice(a,0,r),A(void 0),M(void 0),a!==n&&g?.(i,{item:r,fromIndex:n,toIndex:a,items:i})},children:(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&X?`calc(100% - ${J}px)`:void 0,marginLeft:W&&X?`${J}px`:void 0,height:W&&X?G+28:W?G:"100%"},children:[void 0!==P?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-insert-line","aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-[80] flex items-center",style:{top:44*P-2},children:[(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,eb.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,q.map((t,n)=>(0,eb.jsx)(QJ,{item:t,index:n,count:q.length,expanded:W,active:W&&t.id===K,top:W?44*n:void 0,expansionDirection:r,labels:w,onHover:()=>M(t.id),onDuplicate:()=>{let n=e.findIndex(e=>e.id===t.id);n<0||p?.(e,{item:t,index:n,items:e})},onDragOver:e=>{if(W&&S&&S!==t.id){let t=e.currentTarget.getBoundingClientRect();A(e.clientY<t.top+t.height/2?n:n+1)}},onDragStart:e=>{C(e.item.id),M(void 0),F.current=!1,f?.(e)},onDragEnd:t=>{let n=t.nativeEvent.dataTransfer.dropEffect,r=t.item.id,i=e.findIndex(e=>e.id===r),a=c&&!F.current&&"none"!==n&&i>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),a){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:i,items:n})}h?.(t)}},t.id))]})}),X&&z.canScrollUp?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-top","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-[90] h-8 bg-gradient-to-b from-background to-transparent"}):null,X&&z.canScrollDown?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-bottom","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[90] h-8 bg-gradient-to-t from-background to-transparent"}):null]})]})]})}function QJ({item:e,index:t,count:n,expanded:r,active:i,top:a,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:d,onDragStart:u,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?i?n+20:n-t:n+t;return(0,eb.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:tK("absolute right-0 min-h-16 w-full cursor-grab select-none rounded-xl border bg-background p-2.5 text-foreground shadow-sm shadow-black/5 outline-none transition-[top,transform,opacity,box-shadow,border-color] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] active:cursor-grabbing","hover:border-foreground/35 hover:shadow-md hover:shadow-black/10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",r&&"min-h-0 overflow-hidden py-2 transition-[top,transform,max-height,opacity,box-shadow,border-color] duration-300",r&&!i&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?a??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&i?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?i?"translate3d(-10px, -6px, 0) rotate(0deg)":"translate3d(0, 0, 0) rotate(0deg)":`translate3d(${"down-left"===o?0:4*h}px, 0, 0) rotate(${p}deg)`},tabIndex:e.disabled?-1:0,onMouseDown:function(t){1!==t.button||e.disabled||t.preventDefault()},onMouseEnter:s,onFocus:s,onAuxClick:function(t){1!==t.button||e.disabled||(t.preventDefault(),c?.())},onDragOver:d,onDragStart:function(t){for(let[n,r]of(t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",e.title),t.dataTransfer.setData("application/vnd.vantaloom.clip-id",e.id),Object.entries(e.dragData??{})))t.dataTransfer.setData(n,r);u?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-card-media",className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted text-muted-foreground",children:e.icon??(0,eb.jsx)(QY,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,eb.jsx)("p",{className:tK("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-40 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.description}):null,e.content?(0,eb.jsx)("div",{className:tK("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,eb.jsx)("span",{"aria-label":l.dragHandle,className:"mt-1 inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground",children:(0,eb.jsx)(Wo,{className:"size-3.5"})})]})})}function QQ({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let i,a,o;return{id:e.id,title:(i="copy"===(t=e).mode?"复制":"移动",a=t.sources.length,o=t.sources[0],`${i} ${a>1?`${a} 项`:Q1(o?.path??"")}`),description:(n=e).message?n.message:`${n.sources[0]?.machineId??"local"} -> ${n.target.machineId}`,meta:function(e){switch(e.status){case"completed":return"完成";case"failed":return"失败";case"queued":return"排队";default:return`${Math.round(e.progress?.percent??0)}%`}}(e),icon:"completed"===(r=e).status?(0,eb.jsx)(Uc,{className:"size-4"}):"failed"===r.status?(0,eb.jsx)(QG,{className:"size-4"}):"running"===r.status?(0,eb.jsx)(Ud,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,eb.jsx)(s0,{className:"size-4"}):(0,eb.jsx)(QK,{className:"size-4"}),expandedHeight:132,content:(0,eb.jsx)(Q0,{transfer:e})}});return(0,eb.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)]",children:(0,eb.jsx)(QZ,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function Q0({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,eb.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,eb.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,eb.jsx)("span",{className:"truncate",children:Q1(e.target.path)}),(0,eb.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"truncate",children:[Q2(e.progress.bytesDone)," /"," ",Q2(e.progress.bytesTotal)]}),(0,eb.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,eb.jsx)("div",{className:"truncate text-muted-foreground",children:Q1(e.progress.currentPath)}):null]})]})}function Q1(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function Q2(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||0===r?Math.round(n):n.toFixed(1)} ${t[r]}`}let Q5=eN("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function Q4({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:i,onActivate:a,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:d,onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,eb.jsxs)("section",{className:tK("absolute overflow-hidden rounded-xl border bg-card shadow-lg transition-[box-shadow,border-color] duration-150","vtl-file-manager-window",n&&"border-foreground shadow-xl"),style:{left:e.x,top:e.y,width:e.w,height:e.h,zIndex:r},onPointerDown:a,children:[(0,eb.jsxs)("div",{className:"grid h-9 cursor-grab grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-b bg-muted/35 px-2 active:cursor-grabbing",onPointerDown:function(t){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),a();let n=t.clientX,r=t.clientY;function i(t){let i=Math.max(0,e.x+t.clientX-n),a=Math.max(0,e.y+t.clientY-r);s({...e,x:i,y:a})}window.addEventListener("pointermove",i),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",e)})},children:[(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,eb.jsx)(p6,{})}),(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,eb.jsx)(Q5,{})})]}),(0,eb.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,eb.jsx)("div",{className:"w-14"})]}),(0,eb.jsx)(bt,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>d(e),onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>p({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"vtl-file-window-explorer min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0",style:{height:"calc(100% - 2.25rem)",minHeight:0}}),(0,eb.jsx)("button",{type:"button","aria-label":"调整窗口大小",className:"absolute right-0 bottom-0 size-5 cursor-nwse-resize rounded-tl-md border-t border-l bg-background/80",onPointerDown:function(t){t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),a();let n=t.clientX,r=t.clientY;function o(t){let a=Math.max(420,Math.min(Math.max(420,i.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:a,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function Q3({clipboardItems:e=[],onClipboardItemsChange:t}){var n;return n=(0,eb.jsx)(Q6,{clipboardItems:e,onClipboardItemsChange:t,className:"min-h-[calc(100svh-5rem)] p-4 lg:p-6",minBoardHeight:820,actionsPlacement:"viewport"}),(0,eb.jsx)(f5,{children:n})}function Q6({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:i="container"}){let[a,o]=f3(),[l,s]=ew.useState([]),[c,d]=ew.useState(QB),[u,f]=ew.useState(QB[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(QB.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await bu(e,n);s(n=>{var i;return i={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==i.root.id?e:QW(e.path,i.path)?{...e,children:Qq(i.items)}:{...e,children:function(e,t,n,r,i){let a=function(e,t,n){let r=QU(e,n),i=QU(t,n);if(r===i)return[];let a=r.endsWith("/")?r:`${r}/`;return i.startsWith(a)?i.slice(a.length).split("/").filter(Boolean):[]}(t,n,r);if(0===a.length)return Qq(i);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=a[r];if(!l)return Qq(i);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>QW(e.path,s)),d=t[c],u={...d??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(d?.children??[],s,r+1)};if(c<0)return[...t,u];let f=[...t];return f[c]=u,f}(e,t,0)}(e.children,e.path,i.path,e.platform,i.items)})})},[]),C=ew.useCallback(async()=>{let e=Q7((await bx()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>Q7([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{bv({mode:"move",sources:e.sources.map(e=>({machineId:e.machineId,path:e.path})),target:{machineId:e.target.machineId,path:e.target.path}}).then(N).catch(()=>{})},[N]),E=ew.useCallback(()=>{for(let e of c)S(e.machineId,e.rootId,e.path)},[S,c]);function O(e,t){d(n=>n.map(n=>n.id===e?t(n):n))}function P(e){let t=l[0];if(!t&&!e?.rootId)return;w.current+=1;let n=`files-window-${w.current}`,r=a.current?.getBoundingClientRect(),i=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,u=e?.h??460,h=Math.max(0,(i-c)/2),p=Math.max(0,(s-u)/2),m={id:n,title:e?.title??QH(t?.name??"local",t?.path??""),machineId:e?.machineId??t?.machineId??"local",rootId:e?.rootId??t?.id??"local",path:e?.path??t?.path??"",x:e?.x??h+12*w.current,y:e?.y??p+12*w.current,w:c,h:u};d(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}return ew.useEffect(()=>{let e=!0;return(async function(){let t=await bd();if(e&&(s(t.roots),!j.current&&t.roots[0])){j.current=!0;let e=function(e,t=0){return{id:`files-${e.id.replace(/[^a-z0-9_-]/gi,"-")}-${t}`,title:QH(e.name,e.path),machineId:e.machineId,rootId:e.id,path:e.path,x:28+24*t,y:28+24*t,w:720,h:480}}(t.roots[0]);d([e]),f(e.id),S(e.machineId,e.rootId,e.path)}})().catch(()=>{}),C().catch(()=>{}),()=>{e=!1}},[S,C]),ew.useEffect(()=>{if(!h.some(e=>"pending"===e.status||"running"===e.status||"queued"===e.status))return;let e=window.setInterval(async()=>{let e=(await C().catch(()=>h)).filter(e=>"completed"===e.status&&!k.current.has(e.id));if(e.length>0){for(let t of e)k.current.add(t.id);E()}},1e3);return()=>window.clearInterval(e)},[E,C,h]),(0,eb.jsxs)("div",{ref:a,className:tK("relative h-full min-h-0 w-full overflow-hidden rounded-[inherit]",n),onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.file-window")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.file-window");if(t)try{let n=JSON.parse(t),r=a.current?.getBoundingClientRect();e.preventDefault(),e.stopPropagation(),P({...n,x:r?e.clientX-r.left-160:n.x,y:r?e.clientY-r.top-24:n.y})}catch{return}},children:[(0,eb.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,eb.jsx)(Q4,{windowLayout:n,roots:l,active:u===n.id,zIndex:20+r+20*(u===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>d(e=>e.filter(e=>e.id!==n.id)),onMinimize:()=>{t?.([{id:`clip-${n.id}`,title:n.title,description:"文件管理窗口",meta:`${Math.round(n.w)}x${Math.round(n.h)}`,payloads:{"application/vnd.vantaloom.file-window":{...n}},dragData:{"application/vnd.vantaloom.clip-kind":"file-window","application/vnd.vantaloom.file-window":JSON.stringify(n)}},...e.filter(e=>e.id!==`clip-${n.id}`)]),d(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),i=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:i,rootId:e,path:t,title:QH(r?.name??i,t)})),S(i,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{bp({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{bm({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{bg({machineId:n.machineId,paths:e.map(e=>e.path)}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let i=l.find(t=>t.id===e);if(!i)return;let a=t.flatMap(e=>{let t=function e(t,n){for(let r of t){if(r.id===n)return r;let t=r.children?e(r.children,n):void 0;if(t)return t}}(i.children,e);return t?[{machineId:i.machineId,path:t.path,name:t.name}]:[]});if(0===a.length)return;let o={sources:a,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,eb.jsx)(QQ,{transfers:h}),(0,eb.jsx)(QV,{open:m,placement:i,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,eb.jsx)(Q8,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function Q8({move:e,onCancel:t,onConfirm:n}){var r;let i=e?.sources??[],a=Math.max(0,i.length-4);return(0,eb.jsx)(m3,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,eb.jsxs)(gh,{children:[(0,eb.jsxs)(gp,{children:[(0,eb.jsx)(gg,{children:"确认移动"}),(0,eb.jsx)(gv,{children:e?`将 ${1===(r=i).length?r[0]?Q9(r[0]):"0 项":`${r.length} 项`} 移动到 ${Q9(e.target)}`:""})]}),e?(0,eb.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[i.slice(0,4).map(e=>(0,eb.jsx)("span",{className:"truncate",children:Q9(e)},`${e.machineId}:${e.path}`)),a>0?(0,eb.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",a," 项"]}):null]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,eb.jsx)("span",{className:"truncate",children:Q9(e.target)})]})]}):null,(0,eb.jsxs)(gm,{children:[(0,eb.jsx)(gy,{children:"取消"}),(0,eb.jsx)(gx,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function Q7(e){return e.slice(0,10)}function Q9(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function eee({className:e}){return(0,eb.jsx)(Q6,{className:tK("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var eet=["type"],een=["dangerouslySetInnerHTML","ticks","scale"],eer=["id","scale"];function eei(){return(eei=Object.assign.bind()).apply(null,arguments)}function eea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eeo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eea(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eea(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eel(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ees(e){var t=w_(),n=(0,ew.useRef)(null),r=SX(),{type:i}=e,a=eel(e,eet),o=CU(r,"yAxis",i),l=(0,ew.useMemo)(()=>{if(null!=o)return eeo(eeo({},a),{},{type:o})},[o,a]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(_M(l)):n.current!==l&&t(_E({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(_O(n.current)),n.current=null)},[t]),null}function eec(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=wL(Sj),s=SS(),c=w_(),d="yAxis",u=wL(e=>z2(e,t)),f=wL(e=>z1(e,t)),h=wL(e=>z8(e,d,t,s)),p=wL(e=>AM(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!u||N8(i)||(0,ew.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(u.width)!==Math.round(n)&&c(_I({id:t,width:n}))}}},[h,u,c,i,t,r,p]),null==u||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=eel(e,een),{id:y,scale:b}=p,w=eel(p,eer);return ew.createElement(L_,eei({},x,w,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:u.width,height:u.height,className:eH("recharts-".concat(d," ").concat(d),n),viewBox:l,ticks:h,axisType:d,axisId:t}))}var eed={allowDataOverflow:AN.allowDataOverflow,allowDecimals:AN.allowDecimals,allowDuplicatedCategory:AN.allowDuplicatedCategory,angle:AN.angle,axisLine:LE.axisLine,hide:!1,includeHidden:AN.includeHidden,interval:AN.interval,label:!1,minTickGap:AN.minTickGap,mirror:AN.mirror,orientation:AN.orientation,padding:AN.padding,reversed:AN.reversed,scale:AN.scale,tick:AN.tick,tickCount:AN.tickCount,tickLine:LE.tickLine,tickSize:LE.tickSize,type:AN.type,niceTicks:AN.niceTicks,width:AN.width,yAxisId:0},eeu=ew.memo(e=>{var t=Cw(e,eed);return ew.createElement(ew.Fragment,null,ew.createElement(ees,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),ew.createElement(eec,t))},L5);function eef({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===i)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,d=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,eb.jsx)(UR,{value:o.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(Uq,{className:"h-8",children:e.map(e=>(0,eb.jsx)(UK,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,eb.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,eb.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:tK("grid w-full grid-cols-[3.75rem_minmax(0,1fr)] gap-3 px-2 py-2 text-left transition-colors",e.id===c&&"bg-muted"),children:[(0,eb.jsx)(eex,{data:e.data,color:e.color}),(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,eb.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,eb.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:d?.title}),d?.subtitle?(0,eb.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:d.subtitle}):null]}),(0,eb.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:d?.detail})]}),d?(0,eb.jsx)(eeh,{metric:d}):null]})]})]})}function eeh({metric:e}){return"cpu"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:4})]}):"memory"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eeg,{segments:e.composition}),(0,eb.jsx)(eev,{details:e.details,columns:3})]}):"disk"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eep,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:4})]}):"network"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(eep,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,eb.jsx)(eem,{}),(0,eb.jsx)(eev,{details:e.details,columns:2})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,eb.jsx)(eep,{panel:e},e.id))}),(0,eb.jsx)(eev,{details:e.details,columns:3})]})}function eep({panel:e,size:t="normal"}){let n={short:"h-[4rem]",normal:"full"===e.span?"h-20":"h-24",large:"h-[17.5rem]",tall:"h-[21.5rem]"}[t];return(0,eb.jsxs)("div",{className:tK("mt-5","full"===e.span&&"col-span-2"),children:[(0,eb.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,eb.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,eb.jsx)(eey,{data:e.data,color:e.color,className:tK("w-full",n)})]})}function eem(){return(0,eb.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{children:"60 秒"}),(0,eb.jsx)("span",{children:"0"})]})}function eeg({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,eb.jsxs)("div",{className:"mt-5",children:[(0,eb.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,eb.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,eb.jsx)("div",{className:tK("h-full border-r border-primary/75 last:border-r-0",0===n?"bg-primary/20":n===t.length-1?"bg-background":"bg-primary/8"),style:{width:`${Math.max(0,e.value)}%`}},`${e.label}-${n}`))})]})}function eev({details:e,columns:t}){return e?.length?(0,eb.jsx)("div",{className:tK("mt-5 grid gap-x-10 gap-y-4",2===t&&"grid-cols-2",3===t&&"grid-cols-3",4===t&&"grid-cols-4"),children:e.map(([e,t])=>(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function eex({data:e,color:t}){return(0,eb.jsx)(eey,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function eey({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:i=!1}){let a=ew.useMemo(()=>(e.length>1?e:[0,0]).map((e,t)=>({index:t,value:Math.max(0,Math.min(100,e))})),[e]),o=ew.useMemo(()=>({value:{label:"Value",color:"danger"===t?"var(--destructive)":"var(--foreground)"}}),[t]);return(0,eb.jsx)(FI,{config:o,className:tK("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:i?96:640,height:i?40:220},children:(0,eb.jsxs)(Lg,{data:a,margin:{top:i?2:6,right:0,bottom:0,left:0},children:[i?null:(0,eb.jsx)(LJ,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,eb.jsx)($i,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,eb.jsx)(eeu,{hide:!0,domain:[0,100]}),i?null:(0,eb.jsx)(FD,{cursor:!1,content:(0,eb.jsx)(FT,{hideLabel:!0,indicator:"line"})}),(0,eb.jsx)(Tb,{dataKey:"value",type:"monotone",fill:"var(--color-value)",fillOpacity:"danger"===t?.16:.12,stroke:"var(--color-value)",strokeWidth:r,isAnimationActive:!1,dot:!1,activeDot:!1})]})})}eeu.displayName="YAxis";let eeb=eN("badge-alert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eew=eN("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),eej={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function eek({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[d,u]=ew.useState({}),f=e.find(e=>e.id===i)??e[0],h=ew.useMemo(()=>{if(!f)return[];let e=[...function(e){let t=new Map,n=new Map;for(let t of e)void 0!==t.pid&&n.set(t.pid,t);for(let i of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let i=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!i||void 0===i.pid||r.has(i.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(eeO(i))?t:e(i,n,r)}(i,n),a=eeO(e),o=t.get(a)??{kind:"group",id:a,name:(r=e,r.appName?.trim()||r.name.trim().replace(/\.(exe|com)$/i,"")||r.id),children:[],status:[],cpu:0,memoryMb:0,diskMbps:0,networkMbps:0};o.children.push(i),o.cpu+=i.cpu,o.memoryMb+=i.memoryMb,o.diskMbps+=i.diskMbps,o.networkMbps+=i.networkMbps,o.status=function(e,t){let n=new Set(e??[]);for(let e of t??[])n.add(e);return Array.from(n)}(o.status,i.status),t.set(a,o)}return Array.from(t.values()).map(e=>({...e,cpu:eeA(Math.min(100,e.cpu)),memoryMb:eeA(e.memoryMb),diskMbps:eeA(e.diskMbps),networkMbps:eeA(e.networkMbps)}))}(f.processes)].sort((e,t)=>eeP(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(eeE(e,0));continue}if(t.push(n),d[n.id])for(let e of[...n.children].sort((e,t)=>eeP(e,t,o,s)))t.push(eeE(e,1))}return t},[f,d,s,o]),p=ew.useMemo(()=>h.map(e=>({memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps})),[h]);function m(e){e===o?c(e=>"asc"===e?"desc":"asc"):(l(e),c("name"===e?"asc":"desc"))}return f?(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,eb.jsx)(UR,{value:f.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(Uq,{className:"h-8",children:e.map(e=>(0,eb.jsx)(UK,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid h-14 shrink-0 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] border-y text-sm",children:[(0,eb.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,eb.jsx)(eeS,{active:"name"===o,direction:s})]}),(0,eb.jsx)("div",{className:"flex items-end px-3 pb-2 text-muted-foreground",children:"状态"}),["cpu","memoryMb","diskMbps","networkMbps"].map(e=>{var t,n;return(0,eb.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,eb.jsx)("span",{className:"text-lg leading-none text-foreground",children:(t=f.totals,"cpu"===(n=e)?`${Math.round(t.cpu)}%`:"memoryMb"===n?`${Math.round(t.memory)}%`:"diskMbps"===n?`${Math.round(t.disk)}%`:"networkMbps"===n?`${Math.round(t.network)}%`:"")}),(0,eb.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[eej[e],(0,eb.jsx)(eeS,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,eb.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,eb.jsxs)("div",{className:tK("grid min-h-9 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] items-center text-sm","group"===e.kind&&"bg-muted/35"),children:[(0,eb.jsx)(eeC,{row:e,expanded:"group"===e.kind&&!!d[e.id],onToggle:()=>{"group"===e.kind&&u(t=>({...t,[e.id]:!t[e.id]}))}}),(0,eb.jsx)(eeN,{platform:f.platform,status:e.status}),(0,eb.jsx)(eeM,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,eb.jsx)(eeM,{value:e.memoryMb,max:eez(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${eeI(t/1024)} GB`:`${eeI(t)} MB`}),(0,eb.jsx)(eeM,{value:e.diskMbps,max:Math.max(1,eez(p,"diskMbps")),label:`${eeI(e.diskMbps)} MB/秒`}),(0,eb.jsx)(eeM,{value:e.networkMbps,max:Math.max(1,eez(p,"networkMbps")),label:`${eeI(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function eeS({active:e,direction:t,className:n}){return e?(0,eb.jsx)("asc"===t?U0:G5,{className:tK("ml-1 size-3",n)}):null}function eeC({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?cE:va;return(0,eb.jsxs)("button",{type:"button","aria-expanded":t,onClick:n,className:"flex h-full min-w-0 items-center gap-2 px-3 text-left outline-none transition-colors hover:bg-muted/55 focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,eb.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,eb.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-3",style:{paddingLeft:e.depth>0?34:void 0},children:[e.depth>0?(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,eb.jsx)("span",{className:tK("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function eeN({platform:e,status:t}){return t?.length?(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,eb.jsx)(eew,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,eb.jsx)(s9,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,eb.jsx)(eeb,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,eb.jsx)("div",{className:"px-3"})}function eeM({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),i=r>.78,a=i?`color-mix(in oklch, var(--destructive) ${Math.round(18+42*r)}%, var(--background))`:`color-mix(in oklch, var(--foreground) ${Math.round(5+20*r)}%, var(--background))`;return(0,eb.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":i?"":void 0,style:{background:a},children:(0,eb.jsx)("span",{className:tK("leading-9",i&&"text-destructive"),children:n})})}function eeE(e,t){return{kind:"process",id:e.id,process:e,depth:t,name:e.appName&&0===t?e.appName:e.name,status:e.status,cpu:e.cpu,memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps}}function eeO(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function eeP(e,t,n,r){let i="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*i:(e[n]-t[n])*i}function eeA(e){return Math.round(10*e)/10}function eez(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function eeI(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function ee_({className:e}){let t=eeT("/api/local/machines/processes");return(0,eb.jsx)(eek,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eeD({className:e}){let t=eeT("/api/local/machines/performance");return(0,eb.jsx)(eef,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eeT(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function i(){if(!r){r=!0;try{let r=await fetch(e,{cache:"no-store"});if(!r.ok)return;let i=await r.json();t&&n(i.machines)}catch{t&&n([])}finally{r=!1}}}i();let a=window.setInterval(i,2e3);return()=>{t=!1,window.clearInterval(a)}},[e]),t}let eeR=eN("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eeL=eN("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ee$={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},eeF=[{id:"powershell",title:"PowerShell",shell:"PowerShell",cwd:"D:\\Projects\\Vantaloom-ui",status:"idle",initialOutput:"PowerShell 7.6.1\r\nPS D:\\Projects\\Vantaloom-ui> "}];function eeV(e,t,n){return e.getPropertyValue(t).trim()||n}function eeB(e,t=!1){let n=getComputedStyle(e),r=eeV(n,"--foreground","#18181b"),i=eeV(n,"--terminal-background",eeV(n,"--background","#ffffff")),a="transparent"===i?eeV(n,"--background","#ffffff"):i,o=eeV(n,"--muted-foreground","#71717a"),l=eeV(n,"--border","#e4e4e7"),s=eeV(n,"--selection","#18181b");return{background:i,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":a,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:eeV(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:eeV(n,"--terminal-red","#bf616a"),green:eeV(n,"--terminal-green","#5e8c61"),yellow:eeV(n,"--terminal-yellow","#b06f3c"),blue:eeV(n,"--terminal-blue","#5e81ac"),magenta:eeV(n,"--terminal-magenta","#b48ead"),cyan:eeV(n,"--terminal-cyan","#4c8da8"),white:i,brightBlack:o,brightRed:eeV(n,"--terminal-bright-red","#d06f79"),brightGreen:eeV(n,"--terminal-bright-green","#6b9a70"),brightYellow:eeV(n,"--terminal-bright-yellow","#c2824b"),brightBlue:eeV(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:eeV(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:eeV(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function eeH(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function eeW({initialOutput:t,data:n,dataKey:r,options:i,readOnly:a=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:d,labels:u,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:ee$.loading,...u}),[u]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(d),j=ew.useRef(i),k=ew.useRef(a),S=ew.useRef(l),C=ew.useRef(!1),N=ew.useRef(void 0),M=ew.useRef(!1),[E,O]=ew.useState(!1);return ew.useEffect(()=>{y.current=s,b.current=c,w.current=d,j.current=i,k.current=a,S.current=l},[l,s,d,c,i,a]),ew.useEffect(()=>{let n,r=!1,i=[];!async function(){var a;let l,s,c,d,u;if(!g.current||M.current)return;M.current=!0;let[{Terminal:f},{FitAddon:h},{SearchAddon:p},{WebLinksAddon:m}]=await Promise.all([e.A(93626),e.A(16118),e.A(24306),e.A(46866)]);if(r||!g.current)return;let N=new f({convertEol:!1,cursorBlink:!0,cursorStyle:"block",drawBoldTextInBrightColors:!1,fontFamily:(l=getComputedStyle(a=g.current),u=(c=eeV(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),d=getComputedStyle(a),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>d.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${u||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:eeB(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function z(){try{E.fit(),b.current?.({cols:N.cols,rows:N.rows})}catch{}}for(let e of(N.loadAddon(E),N.loadAddon(P),N.loadAddon(A),N.open(g.current),v.current=N,x.current=E,O(!0),requestAnimationFrame(z),(n=new ResizeObserver(z)).observe(g.current),i.push(N.onData(e=>{k.current||(S.current&&("\r"===e?N.write("\r\n"):""===e?N.write("\b \b"):N.write(e)),y.current?.(e))})),eeH(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:z,focus:()=>N.focus(),clear:()=>N.clear(),setCursorSuppressed:function(e){let t=g.current;t&&(C.current=e,t.toggleAttribute("data-vtl-terminal-cursor-suppressed",e),N.options.theme=eeB(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let a=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=eeB(t,C.current))});return a.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,a.disconnect(),n?.disconnect(),i))e.dispose();v.current?.dispose(),v.current=null,x.current=void 0,C.current=!1,M.current=!1,O(!1)}},[o,t]),ew.useEffect(()=>{let e=v.current;if(e&&N.current!==r)for(let t of(N.current=r,eeH(n)))e.write(t)},[n,r]),(0,eb.jsxs)("div",{"data-slot":"terminal-tab-surface",className:tK("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,eb.jsx)("div",{ref:g,className:tK("vtl-terminal-xterm size-full overflow-hidden p-1.5 font-mono","[&_.xterm]:h-full [&_.xterm]:p-0 [&_.xterm-viewport]:!bg-transparent","[&_.xterm-screen]:!bg-transparent [&_.xterm-helper-textarea]:!outline-none","[&[data-vtl-terminal-cursor-suppressed]_.xterm-cursor]:!opacity-0","[&_.xterm-viewport::-webkit-scrollbar]:w-2.5 [&_.xterm-viewport::-webkit-scrollbar-track]:bg-transparent","[&_.xterm-viewport::-webkit-scrollbar-thumb]:rounded-full [&_.xterm-viewport::-webkit-scrollbar-thumb]:border-[3px]","[&_.xterm-viewport::-webkit-scrollbar-thumb]:border-transparent [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-border [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-clip-content",h)}),!E&&(0,eb.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function eeU({status:e="idle"}){return"running"===e?(0,eb.jsx)(eeL,{className:"size-3.5 text-foreground"}):"success"===e?(0,eb.jsx)(Uc,{className:"size-3.5 text-foreground"}):"error"===e?(0,eb.jsx)(eeR,{className:"size-3.5 text-destructive"}):(0,eb.jsx)(ye,{className:"size-3.5 text-muted-foreground"})}function eeq({sessions:e,defaultSessions:t=eeF,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:i,onSessionsChange:a,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:d,showTabs:u=!0,allowCreateSession:f=!0,readOnly:h=!1,localEcho:p=!1,terminalOptions:m,labels:g,className:v,tabListClassName:x,terminalClassName:y,...b}){let w=ew.useMemo(()=>({...ee$,...g,status:{...ee$.status,...g?.status}}),[g]),[j,k]=ew.useState(t),S=e??j,C=S[0],[N,M]=ew.useState(r??C?.id),E=n??(S.some(e=>e.id===N)?N:C?.id),O=S.find(e=>e.id===E)??C;function P(t){void 0===e&&k(t),a?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),i?.(e.id,e))}return(0,eb.jsxs)("div",{"data-slot":"terminal-tab-group",className:tK("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",u?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[u&&(0,eb.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:tK("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,eb.jsx)(mH,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:S.map(e=>{let t=e.id===O?.id;return(0,eb.jsxs)("div",{className:tK("group flex h-7 min-w-0 shrink-0 items-center rounded-md border border-transparent ui-text-control","transition-colors hover:bg-background/80",t?"bg-background text-foreground shadow-xs":"text-muted-foreground",e.disabled&&"pointer-events-none opacity-50"),children:[(0,eb.jsxs)("button",{type:"button",role:"tab","aria-selected":t,"aria-controls":`terminal-panel-${e.id}`,disabled:e.disabled,onClick:()=>A(e),className:"flex h-full min-w-0 items-center gap-1.5 rounded-md px-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,eb.jsx)(eeU,{status:e.status}),(0,eb.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,eb.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,eb.jsx)("button",{type:"button","aria-label":w.closeTerminal(e.title),onClick:t=>{t.stopPropagation();l?.(e.id,e);let n=S.filter(t=>t.id!==e.id);if(P(n),e.id===E){let e=n.at(-1);e&&A(e)}},className:"mr-1 grid size-4 place-items-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/20 group-hover:opacity-100",children:(0,eb.jsx)(p6,{className:"size-3"})})]},e.id)})}),f&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":w.newTerminal,onClick:function(){let e=o?.()??{id:`terminal-${Date.now()}`,title:`Terminal ${S.length+1}`,status:"idle",initialOutput:"",closable:!0};P([...S,e]),A(e)},className:"size-7 shrink-0",children:(0,eb.jsx)(s7,{className:"size-3.5"})})]}),(0,eb.jsx)("div",{"data-slot":"terminal-tab-panels",className:"relative min-h-0 overflow-hidden",children:S.map(e=>{let t=e.id===O?.id;return(0,eb.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:tK("absolute inset-0 min-h-0",t?"z-10 opacity-100":"z-0 opacity-0"),children:(0,eb.jsx)(eeW,{initialOutput:e.initialOutput,options:{...m,...e.options},readOnly:h||e.disabled,localEcho:p,autoFocus:t,onData:t=>s?.(e.id,t),onResize:t=>c?.(e.id,t),onReady:t=>d?.(e.id,t),labels:w,terminalClassName:y})},e.id)})})]})}function eeK({className:e,scopeId:t,state:n,onStateChange:r}){let[i,a]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[d,u]=ew.useState("local"),[f,h]=ew.useState(),[p,m]=ew.useState(!1),[g,v]=ew.useState(!1),x=ew.useRef(new Map),y=ew.useRef(new Map),b=ew.useRef(new Map),w=ew.useRef(new Map),j=ew.useRef(new Map),k=ew.useRef(new Map),S=ew.useRef(new Map),C=ew.useRef(new Map),N=ew.useRef(!1),M=ew.useRef(n?.autoStart===!1),E=ew.useRef(n),O=ew.useRef(r),P=Array.isArray(n?.sessionIds)?n.sessionIds.join("\0"):"__all__",A=t?.trim()||void 0,z=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let I=i.find(e=>e.id===d)??i[0],_=I?.shells.find(e=>e.id===f)??I?.shells[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),T=D.join("\0"),R=ew.useCallback((e,t)=>{let n=y.current.get(e);if(t){let t=j.current.get(e);void 0!==t&&(window.clearTimeout(t),j.current.delete(e))}n?.setCursorSuppressed(t)},[]),L=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),R(e,!1)},90);j.current.set(e,n)},[R]),$=ew.useCallback(e=>{let t=w.current.get(e),n=y.current.get(e);if(!t||!n||t.writing)return;if(!t.buffer){w.current.delete(e),L(e);return}void 0!==t.drainTimer&&(window.clearTimeout(t.drainTimer),t.drainTimer=void 0);let r=t.buffer.slice(0,65536);t.buffer=t.buffer.slice(r.length),t.writing=!0,R(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>$(e),0):(w.current.delete(e),L(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),L(e)}},[L,R]),F=ew.useCallback((e,t)=>{if(!t)return;if(!y.current.get(e))return void b.current.set(e,`${b.current.get(e)??""}${t}`);let n=w.current.get(e);(n||(n={buffer:"",writing:!1},w.current.set(e,n)),n.buffer+=t,R(e,!0),n.buffer.length>=65536)?$(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>$(e),8))},[$,R]),V=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?F(e,t.data):"status"===t.type&&t.status&&l(n=>n.map(n=>n.id===e?{...n,status:t.status??n.status,updatedAt:t.createdAt}:n))},[F]),B=ew.useCallback(e=>{if(x.current.has(e))return;let t=new EventSource(function(e,t=0){let n=new URLSearchParams;t>0&&n.set("after",String(t));let r=n.toString();return`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`}(e,k.current.get(e)??0));t.onmessage=t=>{try{V(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[V]),H=ew.useCallback(async()=>{if(I&&!p){M.current=!1,m(!0);try{let e=await Wt({machineId:I.id,scopeId:A,shell:_?.id,cwd:I.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),B(e.id)}catch{return}finally{m(!1)}}},[p,B,I,_,A]);function W(e){let t=S.current.get(e);return t||(t={buffer:"",inFlight:!1},S.current.set(e,t)),t}return ew.useEffect(()=>{let e=!0;return v(!1),async function(){try{let t=E.current,n=t?.sessionIds,r=Array.isArray(n)?new Set(n):void 0,[i,o]=await Promise.all([H9(),We(A)]);if(!e)return;let s=r?o.sessions.filter(e=>r.has(e.id)):o.sessions;N.current=!1,M.current=t?.autoStart===!1,a(i.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let d=i.machines[0];if(d){let e=i.machines.find(e=>e.id===t?.selectedMachineId)??d;u(e.id),h(n=>t?.selectedShellId&&e.shells.some(e=>e.id===t.selectedShellId)?t.selectedShellId:n&&e.shells.some(e=>e.id===n)?n:e.shells[0]?.id)}}finally{e&&v(!0)}}(),()=>{e=!1}},[P,A,z]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:d,selectedShellId:f,autoStart:!M.current})},[s,g,d,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)B(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[B,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===i.length||(N.current=!0,H())},[H,g,i.length,o.length]),ew.useEffect(()=>()=>{for(let e of x.current.values())e.close();for(let e of S.current.values())void 0!==e.timer&&window.clearTimeout(e.timer);for(let e of w.current.values())void 0!==e.drainTimer&&window.clearTimeout(e.drainTimer);for(let[e,t]of j.current)window.clearTimeout(t),R(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[R]),(0,eb.jsxs)("div",{className:tK("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,eb.jsxs)(JR,{value:I?.id,onValueChange:e=>{u(e);let t=i.find(t=>t.id===e);h(t?.shells[0]?.id)},children:[(0,eb.jsxs)(Qp,{size:"sm",className:"max-w-44",children:[(0,eb.jsx)(vb,{className:"size-3.5"}),(0,eb.jsx)(JV,{placeholder:"机器"})]}),(0,eb.jsx)(Qv,{align:"start",children:i.map(e=>(0,eb.jsx)(Qx,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsxs)(JR,{value:_?.id,onValueChange:h,children:[(0,eb.jsx)(Qp,{size:"sm",className:"max-w-44",children:(0,eb.jsx)(JV,{placeholder:"Shell"})}),(0,eb.jsx)(Qv,{align:"start",children:I?.shells.map(e=>(0,eb.jsx)(Qx,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!I||p,onClick:()=>void H(),className:"ml-auto",children:(0,eb.jsx)(s7,{className:"size-4"})})]}),(0,eb.jsx)(eeq,{sessions:o.map(eeG),activeSessionId:s,allowCreateSession:!1,localEcho:!1,labels:{loading:"启动终端...",terminalList:"终端会话",closeTerminal:e=>`关闭 ${e}`},onActiveSessionChange:e=>c(e),onCloseSession:e=>{let t,n,r;return x.current.get(e)?.close(),x.current.delete(e),y.current.delete(e),b.current.delete(e),t=w.current.get(e),t?.drainTimer!==void 0&&window.clearTimeout(t.drainTimer),w.current.delete(e),k.current.delete(e),void 0!==(n=j.current.get(e))&&(window.clearTimeout(n),j.current.delete(e)),r=S.current.get(e),void(r?.timer!==void 0&&window.clearTimeout(r.timer),S.current.delete(e),C.current.delete(e),l(t=>{let n=t.filter(t=>t.id!==e);return 0===n.length&&(M.current=!0),c(t=>t&&t!==e&&n.some(e=>e.id===t)?t:n[0]?.id),n}),Wn(e).catch(()=>{}))},onSessionData:function(e,t){let n=W(e);n.buffer+=t,function e(t){let n=W(t);n.inFlight||void 0!==n.timer||(n.timer=window.setTimeout(()=>{n.timer=void 0,function(t){let n=S.current.get(t);if(!n||n.inFlight)return;let r=n.buffer;if(n.buffer="",!r){void 0===n.timer&&S.current.delete(t);return}n.inFlight=!0,Wr(t,r).catch(()=>{}).finally(()=>{let n=S.current.get(t);n&&(n.inFlight=!1,n.buffer?e(t):void 0===n.timer&&S.current.delete(t))})}(t)},6))}(e)},onSessionResize:function(e,t){let n=`${t.cols}x${t.rows}`;C.current.get(e)!==n&&(C.current.set(e,n),Wi(e,t).then(e=>{l(t=>t.map(t=>t.id===e.id?{...t,...e}:t))}).catch(()=>{}))},onSessionReady:function(e,t){y.current.set(e,t);let n=b.current.get(e);n&&(b.current.delete(e),F(e,n))},className:"min-h-0 rounded-none border-0"})]})}function eeG(e){return{id:e.id,title:e.title,shell:e.machineName,cwd:e.cwd,status:function(e){switch(e){case"running":return"running";case"exited":case"closed":return"success";case"failed":return"error";default:return"idle"}}(e.status),closable:!0,initialOutput:""}}function eeY(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=HK("file-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(KX,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(Ja,{className:`${n} border-0`,file:i??r.file,value:e.defaultValue??r.defaultValue??"",defaultValue:e.defaultValue??r.defaultValue,view:e.defaultView,mode:e.defaultMode,modified:e.modified,onValueChange:n=>t.onTabChange?.({...e,defaultValue:n,modified:!0}),onViewChange:n=>t.onTabChange?.({...e,defaultView:n}),onModeChange:n=>t.onTabChange?.({...e,defaultMode:n}),onSave:t.onSaveFileTab?n=>t.onSaveFileTab?.(e,n):void 0,onHistory:()=>t.onOpenFileHistory?.(e),labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中",history:"历史版本"}})}case"browser-tab-viewer":return(0,eb.jsx)(Ge,{className:`${n} border-0`,defaultUrl:e.defaultUrl??HK("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=HK("diff-tab-viewer");return(0,eb.jsx)(Yu,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=HK("data-table-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(KX,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(G9,{className:`${n} border-0`,file:{name:i?.name??r.file?.name??"data",path:i?.path??r.file?.path,type:eeX(e)},source:void 0!==e.defaultValue?{type:eeX(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,eb.jsx)(eeK,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function eeX(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function eeZ(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e){case"multi-tab-system":{let e=t.nodeId,r=void 0!==t.tabs?t.tabs:[];return(0,eb.jsx)(Jc,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:Hq(n.kind),content:eeY(n,{terminalScopeId:e?`${t.terminalScopeId??`canvas:node:${e}`}:tab:${n.id}`:t.terminalScopeId,terminalState:n.terminal,onTerminalStateChange:r=>e?t.onTabChange?.(e,{...n,terminal:r}):void 0,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length}),onTabChange:n=>{e&&t.onTabChange?.(e,n)},onSaveFileTab:(n,r)=>e?t.onSaveFileTab?.(e,n,r):void 0,onOpenFileHistory:n=>e?t.onOpenFileHistory?.(e,n):void 0})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[fr],createLabel:"打开文件",emptyContent:(0,eb.jsx)(KX,{onChooseFile:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})}),onCreateTab:()=>{t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})},onActiveTabChange:n=>{e&&t.onActiveTabChange?.(e,n)},onTabsChange:n=>{if(!e)return;let i=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,i)},onTabDetach:(n,i)=>{if(!e)return!1;let a=r.find(e=>e.id===n.id);return!!a&&t.onTabDetach?.(e,a,{clientX:i.clientX,clientY:i.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,eb.jsx)(KG,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,eb.jsx)(QR,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,eb.jsx)(ee_,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,eb.jsx)(eeD,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,eb.jsx)("div",{className:`${n} bg-card`,children:(0,eb.jsx)(Q_,{})});case"machine-file-management":return(0,eb.jsx)(eee,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,eb.jsx)(Kw,{className:`${n} vtl-canvas-agent-conversation-node`,composerClassName:"max-w-[42rem]"});case"file-tab-viewer":case"browser-tab-viewer":case"diff-tab-viewer":case"data-table-tab-viewer":case"terminal-tab-group":return eeY(t.tab??HK(e,`${e}-tab`),{terminalState:t.terminalState,terminalScopeId:t.terminalScopeId,onTerminalStateChange:t.onTerminalStateChange,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:t.nodeId}),onTabChange:e=>{t.nodeId&&t.onTabChange?.(t.nodeId,e)},onSaveFileTab:(e,n)=>t.nodeId?t.onSaveFileTab?.(t.nodeId,e,n):void 0,onOpenFileHistory:e=>t.nodeId?t.onOpenFileHistory?.(t.nodeId,e):void 0})}}function eeJ({kind:e,...t}){return eeZ(e,t)}let eeQ="application/vnd.vantaloom.agent-pane-shredder",ee0="application/vnd.vantaloom.agent-pane-cutter",ee1=[{id:"quad",label:"四分",slots:4,icon:(0,eb.jsx)(vy,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,eb.jsx)(K0,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,eb.jsx)(KZ,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,eb.jsx)(nw,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,eb.jsx)(HP,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,eb.jsx)(K0,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,eb.jsx)(KQ,{})},{id:"single",label:"整窗口",slots:1,icon:(0,eb.jsx)(KJ,{})}];function ee2(e,t,n=[50,50]){let r=e?.[t],i=r?.[0],a=r?.[1];return["number"==typeof i&&i>0?i:n[0],"number"==typeof a&&a>0?a:n[1]]}function ee5(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function ee4(e,t){return[e[t[0]]??50,e[t[1]]??50]}function ee3({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,eb.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=ee2(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(i,e),onLayoutChanged:e=>n?.("outer",ee4(e,i)),children:[(0,eb.jsx)(Ul,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=ee2(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(i,e),onLayoutChanged:e=>n?.("outer",ee4(e,i)),children:[(0,eb.jsx)(Ul,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=ee2(t,"outer",[58,42]),i=ee2(t,"left"),a=["left","right"],o=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("left",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:20,children:r[1]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=ee2(t,"outer",[42,58]),i=ee2(t,"right"),a=["left","right"],o=["pane-1","pane-2"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("right",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:20,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=ee2(t,"outer",[58,42]),i=ee2(t,"top"),a=["top","bottom"],o=["pane-0","pane-1"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("top",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:24,children:r[1]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=ee2(t,"outer",[42,58]),i=ee2(t,"bottom"),a=["top","bottom"],o=["pane-1","pane-2"];return(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(a,e),onLayoutChanged:e=>n?.("outer",ee4(e,a)),children:[(0,eb.jsx)(Ul,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(o,i),onLayoutChanged:e=>n?.("bottom",ee4(e,o)),children:[(0,eb.jsx)(Ul,{id:o[0],defaultSize:i[0],minSize:24,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:o[1],defaultSize:i[1],minSize:24,children:r[2]})]})})]})}let i=ee2(t,"outer"),a=ee2(t,"left"),o=ee2(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:ee5(l,i),onLayoutChanged:e=>n?.("outer",ee4(e,l)),children:[(0,eb.jsx)(Ul,{id:l[0],defaultSize:i[0],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(s,a),onLayoutChanged:e=>n?.("left",ee4(e,s)),children:[(0,eb.jsx)(Ul,{id:s[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:s[1],defaultSize:a[1],minSize:20,children:r[2]})]})}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:l[1],defaultSize:i[1],minSize:24,children:(0,eb.jsxs)(Uo,{direction:"vertical",defaultLayout:ee5(c,o),onLayoutChanged:e=>n?.("right",ee4(e,c)),children:[(0,eb.jsx)(Ul,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,eb.jsx)(Us,{withHandle:!0}),(0,eb.jsx)(Ul,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function ee6({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:i,onAdd:a,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:d,onRequestFileTab:u,onOpenWorkspaceFile:f,onSaveFileTab:h,onOpenFileHistory:p}){let[m,g]=ew.useState();return(0,eb.jsx)("div",{"data-agent-pane":t,className:tK("relative size-full min-h-0 min-w-0 overflow-hidden",n?.kind!=="subagent-conversation-panel"&&"bg-background","vtl-agent-workspace-pane",n?.kind==="subagent-conversation-panel"&&"vtl-agent-workspace-conversation-pane bg-transparent","panel"===m&&"ring-2 ring-foreground/60 ring-inset","shredder"===m&&"ring-2 ring-destructive/70 ring-inset","cutter"===m&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(ee0)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("cutter");return}if(t.includes(eeQ)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("shredder");return}t.includes(UJ)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",g("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||g(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(ee0)){e.preventDefault(),e.stopPropagation(),g(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(eeQ)){e.preventDefault(),e.stopPropagation(),g(void 0),s(t);return}let n=function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),n=r.find(e=>e.id===t),i=n?n.payloads?.[UJ]:void 0;if(n&&i)return{item:n,content:i.content};let a=e.dataTransfer.getData(UJ);if(a)try{let e=JSON.parse(a);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),g(void 0),o(t,n.item,n.content))},children:n?(0,eb.jsx)("div",{className:tK("size-full min-h-0 min-w-0 overflow-hidden rounded-none","vtl-agent-pane-content","subagent-conversation-panel"===n.kind&&"vtl-agent-pane-conversation-content",i&&"pointer-events-none"),children:UZ(n)?eeZ(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{var r;r=n.terminal,((r?.activeSessionId??"")!==(e.activeSessionId??"")||(r?.selectedMachineId??"")!==(e.selectedMachineId??"")||(r?.selectedShellId??"")!==(e.selectedShellId??"")||(r?.autoStart??!0)!==(e.autoStart??!0)||(r?.sessionIds??[]).join("\0")!==e.sessionIds.join("\0"))&&l(t,{...n,terminal:e})},workspaceFolders:d,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>u?.(t,e),onOpenWorkspaceFile:f,onTabsChange:(e,r)=>{l(t,{...n,tabs:r,activeTabId:r.some(e=>e.id===n.activeTabId)?n.activeTabId:r[0]?.id})},onTabChange:(e,r)=>{"multi-tab-system"===n.kind?l(t,{...n,tabs:(n.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):l(t,{...n,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>h?.(t,n,r),onOpenFileHistory:(e,n)=>p?.(t,n),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,eb.jsx)(Kw,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,eb.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:a,children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加"]})})})}function ee8({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索组件..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配组件。"}),(0,eb.jsx)(ml,{heading:"可放入窗口",children:UY.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,eb.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsx)(mc,{children:"添加"})]},e.id))})]})]})})}let ee7=[],ee9="vantaloom:file-system-changed";function ete(e){var t;let n=(t=e?.layoutMode,ee1.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",i=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};let t=e.shell&&"object"==typeof e.shell&&!Array.isArray(e.shell)?e.shell:void 0,n={};for(let e of["agent","panes"]){let r=t?.[e];"number"==typeof r&&Number.isFinite(r)&&r>0&&(n[e]=r)}return{...Object.keys(n).length?{shell:n}:{},outer:ett(e.outer),left:ett(e.left),right:ett(e.right),top:ett(e.top),bottom:ett(e.bottom)}}(e?.sizes),a=Array.from({length:Math.max(4,ee1.find(e=>e.id===n)?.slots??4)},()=>void 0);for(let[t,n]of(e?.panes??[]).entries()){let e=Number.isInteger(n.slot)?n.slot:t;e<0||e>=a.length||(a[e]=function(e,t){var n,r;let i=e.paneId||`${e.kind}-${t+1}`,a=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:i,kind:"subagent-conversation-panel",title:etr(a.title)??"Subagent",subagentId:etr(a.subagentId)??i,events:Array.isArray(a.events)?a.events:[]};if(!UX(e.kind))return;let o=a.tab&&"object"==typeof a.tab?a.tab:void 0,l=Array.isArray(a.tabs)?a.tabs.filter(e=>HU(e?.kind)):void 0,s=UX(e.kind);return{id:i,kind:e.kind,title:etr(a.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:etr(a.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=a.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:etr(r.activeSessionId),selectedMachineId:etr(r.selectedMachineId),selectedShellId:etr(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:i,panes:a}}function ett(e){if(!Array.isArray(e))return;let t=e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0);return t.length?t:void 0}function etn(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function etr(e){return"string"==typeof e&&e.trim()?e:void 0}function eti(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function eta(e){return e.reduce((e,t)=>Math.max(e,eti(t)),0)}function eto({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:i,onOverlayOpenChange:a}){let o=ete(e?.panes),[l,s]=ew.useState(o.layoutMode),[c,d]=ew.useState(o.agentPosition),[u,f]=ew.useState(o.layoutSizes),[h,p]=ew.useState(()=>o.panes),[m,g]=ew.useState(()=>e?.events??[]),[v,x]=ew.useState(""),[y,b]=ew.useState(e?.conversation.status==="working"),[w,j]=ew.useState(e?.conversation.status??"idle"),[k,S]=ew.useState(),[C,N]=ew.useState(),[M,E]=ew.useState(),O=ew.useRef(eta(o.panes)),P=ew.useRef(0),A=ew.useRef(""),z=ee1.find(e=>e.id===l)?.slots??4,I=e?.conversation.settings.folders??ee7,{models:_}=g5(),D=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?_.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[_,e?.conversation.settings.mainModels]),T=y||"working"===w,R=ew.useCallback(async e=>{if("file-tab-viewer"!==e.kind||e.modified||e.file?.readOnly)return e;try{var t,n;let r=await HQ(e);return(t=e,n=r,t.defaultValue!==n.defaultValue||t.title!==n.title||t.file?.size!==n.file?.size||t.file?.mimeType!==n.file?.mimeType||t.file?.previewContent!==n.file?.previewContent||t.file?.src!==n.file?.src||t.file?.truncated!==n.file?.truncated)?r:e}catch{return e}},[]),L=ew.useCallback(async e=>{if(!e||!UZ(e))return e;if("multi-tab-system"===e.kind){var t,n;let r=e.tabs??[],i=await Promise.all(r.map(R));return(t=r,n=i,t.length!==n.length||t.some((e,t)=>e!==n[t]))?{...e,tabs:i}:e}if("file-tab-viewer"===e.kind&&e.tab){let t=await R(e.tab);return t!==e.tab?{...e,title:t.title,tab:t}:e}return e},[R]),$=ew.useCallback(async()=>{var e,t;let n=await Promise.all(h.map(async e=>L(e)));e=h,t=n,(e.length!==t.length||e.some((e,n)=>e!==t[n]))&&p(n)},[h,L]);function F(e){if(!e.length)return;let t=e.map(UQ);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}function V(e,t,n){if(!e||!UZ(e))return e;if("multi-tab-system"===e.kind){var r;let i,a;return{...e,tabs:(r=e.tabs??[],i=r.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}function B(e,t){return e&&UZ(e)?"multi-tab-system"===e.kind?{...e,tabs:(e.tabs??[]).map(e=>e.id===t.id?t:e),activeTabId:t.id}:"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e:e}async function H(e,t,n){try{let r=await HZ(e);p(e=>e.map((e,i)=>i===t?V(e,r,n):e))}catch{US.error("文件预览打开失败")}}function W(e){let t=h.slice(0,z).findIndex(e=>e?.kind==="multi-tab-system");t<0?US.warning("请先放入一个多标签页组件"):H(e,t)}async function U(e,t,n){let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw US.error("文件路径不可用"),Error("file path is unavailable");try{let a=await bh({machineId:i,path:r,content:n}),o={...await HJ(a,{id:t.id,title:t.title,defaultView:t.defaultView,defaultMode:t.defaultMode}),modified:!1};p(t=>t.map((t,n)=>n===e?B(t,o):t)),window.dispatchEvent(new CustomEvent(ee9)),US.success("文件已保存")}catch(e){throw US.error("文件保存失败"),e}}async function q(t){let n=e?.conversation.id,r=M?.tab.file?.path,i=M?.tab.file?.machineId??"local";if(M&&n&&r)try{let e=await Hw(n,{machineId:i,path:r,mutationId:t.mutationId,state:t.state}),a=await HJ(e,{id:M.tab.id,title:`${e.name} @ ${ets(t.mutationId)} ${"before"===t.state?"before":"after"}`,readOnly:!0,defaultView:M.tab.defaultView,defaultMode:"review"});p(e=>e.map((e,t)=>t===M.paneIndex?B(e,a):e)),E(void 0)}catch{US.error("历史版本打开失败")}}function K(e,t,n){let a=h[e];O.current=Math.max(O.current,eti(n)),p(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!a)return n;let r=UQ(a);return[r,...n.filter(e=>e.id!==r.id)]}),i?.(void 0)}function G(e,t){p(n=>n.map((n,r)=>r===e?t:n))}function Y(e){var t=h[e];if(t&&UZ(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])Wn(e).catch(()=>{});p(t=>t.map((t,n)=>n===e?void 0:t))}function X(e){let t=h[e];t&&F([t]),p(t=>t.map((t,n)=>n===e?void 0:t))}async function Z(t,n="chat"){let r=e?.conversation.id,i=v||D[0]?.id;if(r){if(!i)return void US.error("请先在代理模型配置里选择模型");b(!0),j("working");try{let e=await Hx(r,{message:t,modelRef:i,mode:n});g(e.events),j(e.conversation.status)}catch(e){b(!1),j("idle"),US.error(e instanceof Error?e.message:"对话请求失败")}}}async function J(t){let n=e?.conversation.id,r=("string"==typeof t.modelRef?t.modelRef.trim():"")||v||D[0]?.id,i="agent"===t.mode?"agent":"chat";if(n){if(!r)return void US.error("请先在代理模型配置里选择模型");b(!0),j("working"),g(e=>e.map(e=>e.id===t.id?{...e,status:"retried"}:e));try{let e=await Hy(n,{modelRef:r,mode:i,retryEventId:t.id});g(e.events),j(e.conversation.status)}catch(e){g(e=>e.map(e=>e.id===t.id?t:e)),b(!1),j("idle"),US.error(e instanceof Error?e.message:"对话重试失败")}}}ew.useEffect(()=>{a?.(void 0!==k||void 0!==C||void 0!==M)},[C,M,a,k]),ew.useEffect(()=>{g(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{b(e?.conversation.status==="working"),j(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{let e=D[0]?.id??"";x(t=>D.some(e=>e.id===t)?t:e)},[D]),ew.useEffect(()=>{let t=ete(e?.panes);s(t.layoutMode),d(t.agentPosition),f(t.layoutSizes),p(t.panes),O.current=eta(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id;if(!n||!T)return;let r=new EventSource(gZ(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return r.addEventListener("detail",e=>{try{let t=Hj(JSON.parse(e.data));g(t.events),j(t.conversation.status),"working"!==t.conversation.status&&(b(!1),r.close())}catch{return}}),r.onerror=()=>{r.close(),void 0===t&&(t=window.setInterval(async()=>{try{let e=await Hf(n);g(e.events),j(e.conversation.status),"working"!==e.conversation.status&&(b(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},350))},()=>{r.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,T]),ew.useEffect(()=>{if(!e?.conversation.id)return;let t=window.setInterval(()=>{$()},3e3);return()=>window.clearInterval(t)},[e?.conversation.id,$]),ew.useEffect(()=>{let e=m.filter(e=>"change"===e.kind).map(e=>`${e.id}:${e.status??""}:${e.isStreaming?"1":"0"}`).join("|");e&&e!==A.current&&(A.current=e,window.dispatchEvent(new CustomEvent(ee9)),$())},[m,$]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{let e;Hv(t,(e=[],h.forEach((t,n)=>{if(t){if(UZ(t))return void e.push({paneId:t.id,slot:n,kind:t.kind,machineId:t.terminal?.selectedMachineId,resourceId:t.terminal?.activeSessionId,props:{title:t.title,tab:t.tab,tabs:t.tabs,activeTabId:t.activeTabId,terminal:t.terminal}});e.push({paneId:t.id,slot:n,kind:t.kind,props:{title:t.title,subagentId:t.subagentId,events:t.events}})}}),{layoutMode:l,agentPosition:c,sizes:u,panes:e}))},300);return()=>window.clearTimeout(n)},[c,e?.conversation.id,l,u,h]);let Q=Array.from({length:z},(r,i)=>(0,eb.jsx)(ee6,{conversationId:e?.conversation.id,index:i,content:h[i],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>S(i),onPanelDrop:K,onContentChange:G,onClear:Y,onCut:X,workspaceFolders:I,onRequestFileTab:(e,t)=>N({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:W,onSaveFileTab:U,onOpenFileHistory:(e,t)=>E({paneIndex:e,tab:t})},i)),ee=h.slice(0,z).some(e=>e?.kind==="subagent-conversation-panel"),et=u.shell?.agent??42,en=u.shell?.panes??58,er=(0,eb.jsx)(Ul,{id:"agent",defaultSize:et,minSize:28,children:(0,eb.jsx)(Kw,{events:e?m:void 0,models:e?D:void 0,modelId:v,running:T,disabled:!!e&&0===D.length,onModelChange:x,onSubmit:e?e=>{Z(e.value,"agent"===e.modeId?"agent":"chat")}:void 0,onOpenFile:function(e){let t=e.path?.trim()||e.name.trim();("diff"===e.kind||"diff"===e.meta)&&e.diff?function(e){let t=h.slice(0,z).findIndex(e=>e?.kind==="multi-tab-system");if(t<0)return US.warning("请先放入一个多标签页组件");let n=e.path?.trim()||e.name.trim(),r={id:function(e,t){let n=0x811c9dc5;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,0x1000193);return`${e}-${(n>>>0).toString(36)}`}("diff",`${e.mutationId??""}|${e.machineId??"local"}|${n}|${e.diff??""}`),kind:"diff-tab-viewer",title:`Diff ${e.name}`,file:{name:e.name,path:n,machineId:e.machineId??"local",kind:"code"},diff:e.diff};p(e=>e.map((e,n)=>n===t?V(e,r):e))}(e):!t||e.meta?.toLowerCase().startsWith("depth")||W({machineId:e.machineId??"local",path:t})},onOpenSubagent:function(e){var t;let n=h.slice(0,z),r=n.findIndex(e=>!e),i=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),a=r>=0?r:i;if(a<0)return void US.warning("请释放一个窗口再选中浏览");P.current+=1;let o={id:t=`subagent-${e.id}-${P.current}`,kind:"subagent-conversation-panel",title:e.title,subagentId:e.id,events:e.events?.length?e.events:[{id:`${t}-status`,kind:"done",title:e.detail??e.status??e.activity??e.title}]};p(e=>e.map((e,t)=>t===a?o:e))},onRetry:J})},"agent-conversation"),ei=(0,eb.jsx)(Ul,{id:"panes",defaultSize:en,minSize:32,children:(0,eb.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":ee?"true":void 0,children:[(0,eb.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3",children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)(UR,{value:l,onValueChange:e=>{let t,n;return t=ee1.find(t=>t.id===e)?.slots??4,void((n=h.slice(t).filter(e=>!!e)).length&&F(n),p(Array.from({length:Math.max(4,t)},(e,n)=>n<t?h[n]:void 0)),s(e))},children:(0,eb.jsx)(Uq,{children:ee1.map(e=>(0,eb.jsx)(UK,{value:e.id,"aria-label":e.label,title:e.label,className:"h-7 w-10 px-0 [&_svg]:size-4",children:e.icon},e.id))})}),(0,eb.jsxs)(yZ,{type:"single",value:c,variant:"outline",size:"sm","aria-label":"Agent 面板位置",onValueChange:e=>{("left"===e||"right"===e)&&d(e)},children:[(0,eb.jsx)(yJ,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(nw,{})}),(0,eb.jsx)(yJ,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(HP,{})})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"剪切窗口内容",title:"拖拽到窗口以剪切到剪切板",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(ee0,"cut")},children:(0,eb.jsx)(ce,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"粉碎窗口内容",title:"拖拽到窗口以清空",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(eeQ,"clear")},children:(0,eb.jsx)(HA,{})})]})}),(0,eb.jsx)("div",{className:"min-h-0 flex-1",children:(0,eb.jsx)(ee3,{mode:l,sizes:u,onSizeGroupChange:function(e,t){let n=etn(t);f(t=>{var r;return(r=t[e],(r?.length??0)===(n?.length??0)&&(r??[]).every((e,t)=>.01>Math.abs(e-(n?.[t]??0))))?t:{...t,[e]:n}})},children:Q},`${e?.conversation.id??"empty"}-${l}`)})]})},"agent-panes");return(0,eb.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace h-full min-h-0 pl-[5.25rem]",children:[(0,eb.jsxs)(Uo,{direction:"horizontal",defaultLayout:{agent:et,panes:en},onLayoutChanged:e=>{let t=e.agent??et,n=e.panes??en;!function(e){let t=etn(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let i="left"===c?{agent:n,panes:r}:{agent:r,panes:n};f(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-i.agent)&&.01>Math.abs((n??0)-i.panes)?e:{...e,shell:{...e.shell,...i}}})}("left"===c?[t,n]:[n,t])},children:["left"===c?er:ei,(0,eb.jsx)(Us,{withHandle:!0}),"left"===c?ei:er]},`${e?.conversation.id??"empty"}-${c}`),(0,eb.jsx)(ee8,{open:void 0!==k,onOpenChange:e=>{e||S(void 0)},onAdd:function(e){var t;let n,r;if(void 0===k)return;O.current+=1;let i=(t=`${e}-${O.current}`,n=UX(e),r="file-tab-viewer"===e?{id:t,kind:e,title:"选择文件"}:HU(e)?HK(e,t):void 0,{id:t,kind:e,title:r?.title??n?.title??"组件",tab:r,tabs:"multi-tab-system"===e?[]:void 0,terminal:"terminal-tab-group"===e?{sessionIds:[],autoStart:!0}:void 0}),a=h[k];a&&F([a]),p(e=>e.map((e,t)=>t===k?i:e)),S(void 0)}}),(0,eb.jsx)(KY,{open:void 0!==C,folders:I,onOpenChange:e=>{e||N(void 0)},onSelectFile:e=>{C&&H(e,C.paneIndex,C.insertIndex),N(void 0)}}),(0,eb.jsx)(etl,{open:void 0!==M,conversationId:e?.conversation.id,tab:M?.tab,onOpenChange:e=>{e||E(void 0)},onSelectVersion:e=>{q(e)}}),(0,eb.jsx)(UP,{position:"top-right"})]})}function etl({open:e,conversationId:t,tab:n,onOpenChange:r,onSelectVersion:i}){let[a,o]=ew.useState([]),[l,s]=ew.useState(!1),c=n?.file?.path,d=n?.file?.machineId??"local";return ew.useEffect(()=>{if(!e||!t||!c)return void o([]);let n=!1;return s(!0),Hb(t,{machineId:d,path:c}).then(e=>{n||o(e.versions)}).catch(()=>{n||o([])}).finally(()=>{n||s(!1)}),()=>{n=!0}},[t,d,e,c]),(0,eb.jsx)(po,{open:e,onOpenChange:r,children:(0,eb.jsxs)(p7,{className:"max-w-xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"历史版本"}),(0,eb.jsx)(mt,{className:"sr-only",children:"浏览当前文件在此 Agent 会话中的修改历史。"}),(0,eb.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:n?.file?.name??n?.title??"文件"}),c?(0,eb.jsxs)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:[d,":",c]}):null]}),(0,eb.jsx)("div",{className:"max-h-[28rem] overflow-auto p-2",children:l?(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"正在读取历史版本"}):0===a.length?(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"还没有记录到这个文件的修改历史"}):(0,eb.jsx)("div",{className:"grid gap-1",children:a.map(e=>{var t;let n;return(0,eb.jsxs)("button",{type:"button",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted/70",onClick:()=>i(e),children:[(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsxs)("span",{className:"block truncate text-sm font-medium",children:[ets(e.mutationId)," ·"," ","before"===e.state?"修改前":"修改后"]}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:Number.isFinite(n=Date.parse(t=e.createdAt))?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(n):t})]}),(0,eb.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,eb.jsxs)("b",{className:"font-medium text-emerald-600",children:["+",e.additions??0]}),(0,eb.jsxs)("b",{className:"font-medium text-rose-600",children:["-",e.deletions??0]})]})]},e.id)})})})]})})}function ets(e){return e.replace(/^mut-/,"").slice(0,16)}let etc=eN("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),etd=eN("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),etu=eN("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),etf=eN("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);function eth({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(),a=ew.useMemo(()=>Ha({onSelect:i}),[]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"canvas-library",definitions:a,initialLayouts:Ho,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,eb.jsx)(etm,{canvas:r,onOpenChange:e=>{e||i(void 0)}})]})}function etp({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}function etm({canvas:e,onOpenChange:t}){return e?(0,eb.jsx)(mQ,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsx)(etg,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,eb.jsx)(etc,{}),badge:e.settings.nodeTemplates.length,content:(0,eb.jsx)(etx,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,eb.jsx)(etf,{}),content:(0,eb.jsx)(etx,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(etx,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,eb.jsx)(etu,{}),content:(0,eb.jsx)(etx,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,eb.jsx)(ZJ,{}),content:(0,eb.jsx)(etx,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,eb.jsx)(B3,{}),content:(0,eb.jsx)(etx,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(etx,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(etx,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function etg({canvas:e}){return(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("button",{type:"button",className:"group relative grid min-h-72 rounded-[2rem] border bg-card p-7 text-left transition-colors hover:bg-muted/35",children:[(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("div",{className:"max-w-2xl",children:[(0,eb.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,eb.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,eb.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,eb.jsx)(etv,{label:"Nodes",value:`${e.nodes}`}),(0,eb.jsx)(etv,{label:"Agent",value:`${e.agents}`}),(0,eb.jsx)(etv,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,eb.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between",children:[(0,eb.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,eb.jsx)(etp,{icon:(0,eb.jsx)(F$,{}),value:e.runtime})]}),(0,eb.jsx)(mT,{items:e.roadmap.map(e=>({id:e.title,title:e.title,status:"running"===e.state?"current":"done"===e.state?"done":"queued"})),viewportClassName:"max-h-64"})]})]})}function etv({label:e,value:t}){return(0,eb.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function etx({title:e,items:t,empty:n="暂无内容"}){return(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,eb.jsxs)("div",{className:tK("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,eb.jsx)(etd,{className:"size-4 text-muted-foreground"}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,eb.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function ety({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索节点..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配节点。"}),(0,eb.jsx)(ml,{heading:"可用节点",children:HB.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,eb.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function etb({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let d=ew.useRef(null),{addPaletteOpen:u,addTemplateNode:f,handleAddPaletteOpenChange:h,handleCanvasAction:p,handleCanvasDragOver:m,handleCanvasDrop:g,handleNodeCanvasConnect:v,handleNodeCanvasEdgeAction:x,handleNodeCanvasNodeAction:y,filePickerDialog:b,renderedCanvasNodes:w}=function({workspaceRef:e,nodes:t,clipboardItems:n,onNodesSet:r,onEdgesSet:i,onSelectedNodeChange:a,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,d]=ew.useState(!1),[u,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,i,a,o,l,s,c,d;return r=e.current,i=r?.querySelector(".react-flow__viewport"),a=r?.getBoundingClientRect(),l="none"!==(o=i?getComputedStyle(i).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,d=l?.f??0,{x:(t-(a?.left??0)-c)/s,y:(n-(a?.top??0)-d)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,i;return n.id===e?(i="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:i}}):n}))},[r]),v=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},activeTabId:t}}:n))},[r]),x=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?function(e,t){let n=e.data??{};if("multi-tab-system"===n.kind){let r=Array.isArray(n.tabs)?n.tabs:[];return{...e,data:{...n,tabs:r.map(e=>e.id===t.id?t:e),activeTabId:t.id}}}return HU(n.kind)?{...e,data:{...n,tab:t}}:e}(n,t):n))},[r]),y=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},terminal:t}}:n))},[r]),b=ew.useCallback((e,t)=>{var n;let i=(n=e.kind,HB.find(e=>e.id===n)?.size??HR({width:480,height:320}));s.current+=1;let o=`${e.kind}-detached-${s.current}`;r(n=>[...n,function({tab:e,nodeId:t,center:n,size:r}){return{id:t,type:"blank",position:HF(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:HL(r)}}({tab:e,nodeId:o,center:t,size:i})]),a(o)},[r,a]),w=ew.useCallback(async(e,n)=>{try{let i,a=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=a?(a.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await H0(e):await HZ(e),s=void 0!==a&&(i=a.data??{},"multi-tab-system"===i.kind||"file-tab-viewer"===i.kind||"data-table-tab-viewer"===i.kind);n?.nodeId&&s&&r(e=>e.map(e=>e.id===n.nodeId?function(e,t,n){let r=e.data??{};if("multi-tab-system"===r.kind){let i,a,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(i=o.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}}return"file-tab-viewer"===r.kind||"data-table-tab-viewer"===r.kind&&"data-table-tab-viewer"===t.kind?{...e,data:{...r,tab:t}}:e}(e,l,n.insertIndex):e)),n?.nodeId&&s||b(l,u??{x:496,y:336})}catch{US.error("文件预览打开失败")}},[b,t,r,u]),j=ew.useCallback(e=>{let n=t.find(e=>"multi-tab-system"===(e.data??{}).kind);w(e,n?{nodeId:n.id}:void 0)},[t,w]),k=ew.useCallback(async(e,t,n)=>{let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw US.error("文件路径不可用"),Error("file path is unavailable");try{let a=await bh({machineId:i,path:r,content:n}),o={...t,title:a.name,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};x(e,o),US.success("文件已保存")}catch(e){throw US.error("文件保存失败"),e}},[x]),S=ew.useCallback((e,t,n)=>{b(t,m(n.clientX,n.clientY))},[b,m]),C=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=n.find(e=>e.id===t),i=r?r.payloads?.[fr]:void 0;if(i)return i;let a=e.dataTransfer.getData(fr);if(a)try{return JSON.parse(a)}catch{return}},[n]),N=ew.useCallback((e,t,n)=>{r(r=>r.map(r=>r.id!==e?r:function(e,t,n){let r=e.data??{},i=Array.isArray(r.tabs)?r.tabs:[],a=new Set(i.map(e=>e.id)),o=n.tab.id,l=2;for(;a.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...i];return s.splice(Math.max(0,Math.min(t,s.length)),0,{...n.tab,id:o}),{...e,data:{...r,tabs:s,activeTabId:o}}}(r,t,n)))},[r]),M=ew.useCallback((e,t,n)=>{let r=C(n);r&&N(e,t,r)},[C,N]),E=ew.useCallback(e=>(function(e,t){for(let n of[...e].reverse()){if("multi-tab-system"!==(n.data??{}).kind)continue;let e=function(e){let t="number"==typeof e.width?e.width:"number"==typeof e.style?.width?e.style.width:"string"==typeof e.style?.width?Number.parseFloat(e.style.width):192,n="number"==typeof e.height?e.height:"number"==typeof e.style?.height?e.style.height:"string"==typeof e.style?.height?Number.parseFloat(e.style.height):112;return{width:Number.isFinite(t)?t:192,height:Number.isFinite(n)?n:112}}(n),r=t.x>=n.position.x&&t.x<=n.position.x+e.width,i=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&i)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let i=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),a=i?.querySelector('[data-slot="multi-tab-list"]');if(!a)return r;let o=Array.from(a.querySelectorAll("[data-tab-id]"));for(let[e,t]of o.entries()){let r=t.getBoundingClientRect();if(n<r.left+r.width/2)return e}return o.length})(e,t,n,r),[e]),P=function({nodes:e,onTabsChange:t,onActiveTabChange:n,onRequestFileTab:r,onOpenWorkspaceFile:i,onTabChange:a,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let d=e.data??{},u=(e.data??{}).kind;return u?{...e,data:{...d,content:(0,eb.jsx)(eeJ,{kind:u,nodeId:e.id,tab:d.tab,tabs:d.tabs,activeTabId:d.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:d.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:i,onTabsChange:t,onTabChange:a,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,i,r,o,a,s,l,t])}({nodes:t,onTabsChange:g,onActiveTabChange:v,onRequestFileTab:p,onOpenWorkspaceFile:j,onTabChange:x,onSaveFileTab:k,onTerminalStateChange:y,onTabDetach:S,onExternalTabDrop:M}),A=ew.useCallback(e=>{s.current+=1;let n=`${e.id}-${t.length+s.current}`;r(t=>[...t,function({template:e,nodeId:t,center:n}){let r={contentScale:2,kind:e.id};return"multi-tab-system"===e.id?r.tabs=[]:HU(e.id)&&(r.tab=HK(e.id,`${t}-tab`)),{id:t,type:"blank",position:HF(n,e.size),data:r,width:e.size.width,height:e.size.height,style:HL(e.size)}}({template:e,nodeId:n,center:u??{x:496,y:336}})]),a(void 0),d(!1),f(void 0)},[t.length,r,a,u]),z=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let i=n.find(e=>e.id===t),o=m(e.clientX,e.clientY),s=C(e),c=s?E(o):void 0;if(s&&c){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=c.data??{},n=Array.isArray(t.tabs)?t.tabs:[],r=O(c.id,e.clientX,n.length);N(c.id,r,s),a(void 0);return}let d=i?i.payloads?.[fn]:void 0;if(!i||!d)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let u=`${d.node.id}-drop-${l.current}`;r(e=>[...e,function({source:e,nodeId:t,center:n}){let r={width:e.width??192,height:e.height??112};return{...e,id:t,position:HF(n,r),style:e.style??HL(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:d.node,nodeId:u,center:o})]),a(u)},[n,E,C,m,O,N,r,a]),I=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[fn,fr].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),_=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),d(!0))},[]),D=ew.useCallback(e=>{i(t=>{if(t.find(t=>t.source===e.source&&t.target===e.target))return t;let n=t.find(t=>t.source===e.target&&t.target===e.source);return n?t.map(e=>e.id===n.id?{...e,data:{...e.data??{},bidirectional:!0}}:e):[...t,{id:`edge-${e.source}-${e.target}-${t.length+1}`,type:"connection",source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:{anchors:[]}}]})},[i]),T=ew.useCallback((e,t,n)=>{"cut-edge"===e?i(e=>e.filter(e=>e.id!==t)):i(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&i.splice(n.anchorIndex??i.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(i[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&i.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:i}}}))},[i]),R=ew.useCallback((e,n,{snappedPosition:l})=>{if("copy"===e)return void r(e=>{let t=e.find(e=>e.id===n);if(!t)return e;let r=`${t.id}-copy-${e.length+1}`;return a(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,d,u,f=t.find(e=>e.id===n);if(!f)return;let h=(e={...f.data??{}},delete e.content,delete e.mode,delete e.onConnectPointerDown,delete e.onSelectNode,delete e.resizing,c=(s=function(e){let t=e.data??{},n=t.tab;if(n?.id&&HU(n.kind))return n;let r=t.kind;if(HU(r))return HK(r,e.id)}(l={...f,selected:!1,data:{...e,resizing:!1}}))?{tab:s,sourceNodeId:f.id}:void 0,d={[fn]:{node:l}},u={"application/vnd.vantaloom.clip-kind":s?"canvas-tab":"canvas-node",[fn]:f.id},c&&(d[fr]=c,u[fr]=JSON.stringify(c)),{id:`clip-${f.id}`,title:s?.title??"画布节点",description:s?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(f.width??192)}x${Math.round(f.height??112)}`,icon:s?Hq(s.kind):(0,eb.jsx)(HI,{className:"size-4"}),dragData:u,payloads:d});o(e=>[h,...e.filter(e=>e.id!==h.id)]),r(e=>e.filter(e=>e.id!==n)),i(e=>e.filter(e=>e.source!==n&&e.target!==n)),a(void 0)}},[t,o,i,r,a]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,eb.jsx)(QL,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){d(e),e||f(void 0)},handleCanvasAction:_,handleCanvasDragOver:I,handleCanvasDrop:z,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:T,handleNodeCanvasNodeAction:R,renderedCanvasNodes:P}}({workspaceRef:d,nodes:e,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,eb.jsxs)("div",{ref:d,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,eb.jsx)(cM,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:HD,edgeTypes:HT,onNodesChange:i,onEdgesChange:a,selectedNodeId:n,onSelectedNodeChange:s,defaultViewport:{x:0,y:0,zoom:.5},labels:{actions:"画布操作",add:"添加节点",select:"普通鼠标",connect:"连接工具",cut:"剪刀工具",drag:"拖拽工具",modeTools:"模式工具",resetZoom:"重置缩放",viewportTools:"视口工具",lockViewport:"锁定视口",visualSnap:"视觉吸附",nodeSnap:"节点吸附",snapTools:"吸附工具",nodeActions:"节点操作",resizeNode:"调整大小",copyNode:"复制节点",cutNode:"剪切节点"},onCanvasAction:p,onNodeCanvasConnect:v,onNodeCanvasEdgeAction:x,onNodeCanvasNodeAction:y}),(0,eb.jsx)(ety,{open:u,onOpenChange:h,onAdd:f}),b,(0,eb.jsx)(UP,{position:"top-right"})]})}function etw({open:e,definitions:t,onOpenChange:n,onAdd:r}){return(0,eb.jsx)(mr,{open:e,onOpenChange:n,title:"添加卡片",description:"搜索并选择要添加到运维面板的卡片。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索可添加卡片..."}),(0,eb.jsxs)(ma,{className:"max-h-[420px]",children:[(0,eb.jsx)(mo,{children:"没有找到可添加的卡片。"}),(0,eb.jsx)(ml,{heading:"运维面板卡片",children:t.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource],onSelect:()=>r(e.id),className:"min-h-14 items-start py-2",children:[(0,eb.jsx)("span",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function etj({open:e,dragMode:t,onOpenChange:n,onAdd:r,onDragModeChange:i}){let a=[{key:"add",label:"添加组件",icon:(0,eb.jsx)(s7,{className:"size-4"}),onClick:r,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,eb.jsx)(s2,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,eb.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[a.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",t.pressed&&"border-foreground bg-foreground text-background shadow-lg ring-1 ring-background/50 hover:bg-foreground hover:text-background dark:bg-primary dark:text-primary-foreground dark:hover:bg-primary",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"仪表盘操作","aria-expanded":e,onClick:()=>n(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function etk({layout:e,layouts:t,cellSize:n,dragMode:r,selected:i,resizing:a,onSelect:o,onMove:l,onCut:s,onCopy:c,onSettingsOpen:d,onResizeStart:u,onResizeEnd:f,children:h}){let[p,m]=ew.useState(!1),g=e.x*(n+12),v=e.y*(n+12),x=e.w*n+(e.w-1)*12,y=e.h*n+(e.h-1)*12;return(0,eb.jsxs)("div",{"data-dashboard-widget":e.id,className:tK("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",r&&"cursor-grab active:cursor-grabbing",p&&"duration-150",i&&!a&&"z-20 shadow-sm",a&&"z-30 transition-none"),style:{left:g,top:v,width:x,height:y},onPointerDown:function(i){if(!r||a)return;let s=i.target;if(s instanceof HTMLElement&&s.closest("[data-dashboard-action]"))return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),o();let c=i.clientX,d=i.clientY;function u(r){let i=fm({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-d)/(n+12))});fp(i,t,e.id)||l(i)}m(!0),window.addEventListener("pointermove",u),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",e),m(!1)})},onClick:()=>{r&&o()},children:[(0,eb.jsx)("div",{className:tK("size-full",r&&"pointer-events-none"),children:h}),i&&r&&!a?(0,eb.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&r&&!a?(0,eb.jsx)(etS,{onSettingsOpen:d,onCut:s,onCopy:c,onResizeStart:u}):null,a?(0,eb.jsx)(etC,{layout:e,layouts:t,cellSize:n,onResize:l,onResizeEnd:f}):null]})}function etS({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,eb.jsx)(cn,{"data-dashboard-action":!0,placement:"inline",size:"sm","aria-label":"组件操作",className:"!absolute top-full left-1/2 z-40 mt-2 -translate-x-1/2 rounded-lg bg-popover/95 p-1 shadow-md",onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,eb.jsxs)(cr,{children:[(0,eb.jsx)(ci,{type:"button","aria-label":"调整大小",onClick:r,children:(0,eb.jsx)(s3,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(mf,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"复制",onClick:n,children:(0,eb.jsx)(s0,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(ce,{className:"size-4"})})]})})}function etC({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:i}){return(0,eb.jsx)("div",{"data-dashboard-action":!0,className:"pointer-events-none absolute inset-1 z-40 border-2 border-foreground",children:[{id:"top-left",className:"top-0 left-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize"},{id:"top",className:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 cursor-ns-resize"},{id:"top-right",className:"top-0 right-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize"},{id:"right",className:"top-1/2 right-0 translate-x-1/2 -translate-y-1/2 cursor-ew-resize"},{id:"bottom-right",className:"right-0 bottom-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize"},{id:"bottom",className:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 cursor-ns-resize"},{id:"bottom-left",className:"bottom-0 left-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize"},{id:"left",className:"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize"}].map(a=>(0,eb.jsx)("button",{type:"button","aria-label":`调整 ${a.id}`,className:tK("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",a.className),onPointerDown:o=>(function(a,o){a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);let l=a.clientX,s=a.clientY;function c(i){let a=Math.round((i.clientX-l)/(n+12)),c=Math.round((i.clientY-s)/(n+12)),d={...e};o.includes("right")&&(d.w=e.w+a),o.includes("bottom")&&(d.h=e.h+c),o.includes("left")&&(d.x=e.x+a,d.w=e.w-a),o.includes("top")&&(d.y=e.y+c,d.h=e.h-c),fp(d=fm(d),t,e.id)||r(d)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),i()})})(o,a.id)},a.id))})}function etN({open:e,layout:t,definition:n,config:r,cellSize:i,onOpenChange:a,onConfigChange:o}){let l=t&&i>0?t.w*i+(t.w-1)*12:320,s=t&&i>0?t.h*i+(t.h-1)*12:180;return(0,eb.jsx)(po,{open:e,onOpenChange:a,children:(0,eb.jsx)(mv,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,eb.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,eb.jsx)(etM,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,eb.jsxs)("div",{className:"animate-in slide-in-from-right-4 flex h-full w-full flex-col border-y-0 border-r-0 bg-background text-foreground shadow-lg duration-300",children:[(0,eb.jsxs)(mx,{className:"border-b",children:[(0,eb.jsx)(my,{children:"卡片设置"}),(0,eb.jsxs)(mb,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,eb.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,eb.jsx)(ny,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,eb.jsx)(ny,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,eb.jsx)(ny,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,eb.jsx)("textarea",{value:r.note,rows:4,className:"min-h-24 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 ui-text-control transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",onChange:e=>o({note:e.currentTarget.value})})]}),(0,eb.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,eb.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,eb.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{children:["类型:",n.id]}),(0,eb.jsxs)("span",{children:["来源:",r.dataSource]}),(0,eb.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function etM({width:e,height:t,className:n,children:r}){let[i,a]=f3(),o=a.width>0&&a.height>0?Math.min(1,(a.width-32)/e,(a.height-32)/t):1;return(0,eb.jsx)("div",{ref:i,className:tK("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,eb.jsx)("div",{className:"animate-in fade-in-0 zoom-in-95 origin-center rounded-lg duration-300",style:{width:e,height:t,transform:`scale(${Math.max(.1,o)})`},children:r})})}function etE(){return ew.useMemo(()=>[{id:"active-runs",title:ez.activeRuns,description:"当前正在执行的 Agent 运行数量。",icon:(0,eb.jsx)(B7,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.activeRuns,dataSource:"本机运行队列",refreshRate:"5s",note:"统计所有未完成的运行。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"18",jellyImage:u4,jellyImagePosition:"center"})},{id:"queue",title:ez.queue,description:"排队等待调度的任务数量。",icon:(0,eb.jsx)(Hz,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.queue,dataSource:"调度器",refreshRate:"5s",note:"用于观察调度压力。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"7",jellyImage:u3,jellyImagePosition:"center"})},{id:"cost",title:ez.cost,description:"今日模型、工具和机器资源消耗。",icon:(0,eb.jsx)(FW,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.cost,dataSource:"用量聚合",refreshRate:"1m",note:"后续可接入工作组账单。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"$42.8",jellyImage:u6,jellyImagePosition:"center"})},{id:"machines-summary",title:ez.machineStatus,description:"工作组内可用机器概况。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"15s",note:"包含本机、直连机器和 P2P 节点。"},render:e=>(0,eb.jsx)(FX,{label:e.title,value:"2 / 3",jellyImage:u8,jellyImagePosition:"center"})},{id:"resource-trend",title:ez.resourceTrend,description:"CPU 与内存趋势图。",icon:(0,eb.jsx)(FZ,{className:"size-4"}),defaultSize:{w:8,h:4},defaultConfig:{title:ez.resourceTrend,dataSource:"机器遥测",refreshRate:"10s",note:"默认显示最近 6 个采样点。"},render:e=>(0,eb.jsx)(FJ,{title:e.title})},{id:"run-mix",title:ez.runMix,description:"不同类型 Agent 运行的占比。",icon:(0,eb.jsx)(mR,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:{title:ez.runMix,dataSource:"运行记录",refreshRate:"30s",note:"用于快速观察任务类型构成。"},render:e=>(0,eb.jsx)(V3,{title:e.title})},{id:"machine-status",title:ez.machineStatus,description:"各机器 CPU、内存、GPU 与磁盘状态。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:8,h:5},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"10s",note:"用于运维总览的核心资源面板。"},render:e=>(0,eb.jsx)(FG,{title:e.title})},{id:"schedule",title:ez.schedule,description:"维护窗口、提醒和自动化计划。",icon:(0,eb.jsx)(V8,{className:"size-4"}),defaultSize:{w:4,h:5},defaultConfig:{title:ez.schedule,dataSource:"本机日程",refreshRate:"5m",note:"之后可接工作组日程。"},render:e=>(0,eb.jsx)(V9,{title:e.title})}],[])}function etO({clipboardItems:e,onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(!1),[a,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,d]=ew.useState(ff),[u,f]=ew.useState({}),[h,p]=ew.useState(),[m,g]=ew.useState(),[v,x]=ew.useState(),y=ew.useRef(0),b=ew.useRef(0),[w,j]=f3(),k=j.width>0?(j.width-132)/12:96,S=Math.max(9,fh(c)+2),C=S*k+(S-1)*12,N=etE(),M=ew.useMemo(()=>new Map(N.map(e=>[e.id,e])),[N]);function E(e){let t=M.get(e.kind);return u[e.id]??(t?fv(t):void 0)}function O(e){d(t=>{let n=fm(e);return fp(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}ew.useEffect(()=>{n(a||!!v)},[a,n,v]),ew.useEffect(()=>()=>n(!1),[n]),ew.useEffect(()=>{l||(p(void 0),g(void 0))},[l]),ew.useEffect(()=>{if(m)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-dashboard-action]")||(p(m),g(void 0))}},[m]);let P=v?c.find(e=>e.id===v):void 0,A=P?M.get(P.kind):void 0,z=P?E(P):void 0;return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{ref:w,"data-dashboard-board":!0,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",l&&"select-none"),style:{minHeight:C+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.dashboard-widget-kind")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(t){let n=t.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=t.dataTransfer.getData("application/vnd.vantaloom.dashboard-widget-kind");if(!n||!r)return;let i=e.find(e=>e.id===n);if(!i)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move";let a=w.current,o=a?.getBoundingClientRect();!function(e,t){let n=fx(e);if(!n)return;b.current+=1;let r=`${n.kind}-clip-${b.current}`,i=fm({id:r,kind:n.kind,x:t?.x??0,y:t?.y??fh(c),w:n.w,h:n.h}),a=t&&!fp(i,c)?i:fg(c,r,n.kind,n.w,n.h);d(e=>[...e,a]),f(e=>({...e,[r]:{...n.config}})),p(r),g(void 0)}(i,{x:o&&k>0?Math.round((t.clientX-o.left-24)/(k+12)):0,y:o&&k>0?Math.round((t.clientY-o.top-24)/(k+12)):fh(c)})},onPointerDown:e=>{e.target===e.currentTarget&&(p(void 0),l||g(void 0))},children:(0,eb.jsx)("div",{className:"relative",style:{height:C},children:c.map(e=>{let n=N.find(t=>t.id===e.kind);if(!n)return null;let r=E(e);return r?(0,eb.jsx)(etk,{layout:e,layouts:c,cellSize:k,dragMode:l,selected:h===e.id,resizing:m===e.id,onSelect:()=>{l&&p(e.id)},onMove:O,onCut:()=>(function(e){let n=c.find(t=>t.id===e),r=n?M.get(n.kind):void 0,i=n?E(n):void 0;if(!n||!r||!i)return;let a=function({layout:e,definition:t,config:n}){let r={kind:e.kind,w:e.w,h:e.h,config:{...n}};return{id:`clip-${e.id}`,title:n.title||t.title,description:t.description,meta:`${e.w}x${e.h}`,icon:t.icon,dragData:{"application/vnd.vantaloom.clip-kind":"dashboard-widget","application/vnd.vantaloom.dashboard-widget-kind":e.kind,"application/vnd.vantaloom.dashboard-widget-width":String(e.w),"application/vnd.vantaloom.dashboard-widget-height":String(e.h),"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(n)},payloads:{[fi]:r}}}({layout:n,definition:r,config:i});t(e=>[a,...e.filter(e=>e.id!==a.id)]),d(t=>t.filter(t=>t.id!==e)),f(t=>{let n={...t};return delete n[e],n}),p(void 0),g(void 0),x(t=>t===e?void 0:t)})(e.id),onCopy:()=>(function(e){let t=c.find(t=>t.id===e);if(!t)return;y.current+=1;let n=`${e}-copy-${y.current}`,r=fg(c,n,t.kind,t.w,t.h);d(e=>[...e,r]),f(r=>({...r,[n]:r[e]??fv(M.get(t.kind))})),p(n)})(e.id),onSettingsOpen:()=>x(e.id),onResizeStart:()=>{p(void 0),g(e.id)},onResizeEnd:()=>{p(e.id),g(void 0)},children:n.render(r)},e.id):null})})}),(0,eb.jsx)(etj,{open:r,dragMode:l,onOpenChange:i,onAdd:()=>{i(!1),o(!0)},onDragModeChange:s}),(0,eb.jsx)(etw,{open:a,definitions:N,onOpenChange:o,onAdd:function(e){let t=M.get(e);if(!t)return;b.current+=1;let n=`${e}-added-${b.current}`,r=fg(c,n,e,t.defaultSize.w,t.defaultSize.h);d(e=>[...e,r]),f(e=>({...e,[n]:fv(t)})),p(n),g(void 0),o(!1)}}),(0,eb.jsx)(etN,{open:!!(P&&A&&z),layout:P,definition:A,config:z,cellSize:k,onOpenChange:e=>{e||x(void 0)},onConfigChange:e=>{var t;let n,r;P&&(t=P.id,r=(n=c.find(e=>e.id===t))?M.get(n.kind):void 0,n&&r&&f(n=>({...n,[t]:{...n[t]??fv(r),...e}})))}})]})}let etP={delete:"Delete",empty:"Drop here",title:"Trash"};function etA({active:e=!1,items:t=[],labels:n,className:r,onDrop:i,onDelete:a,onItemRestore:o,...l}){let s={...etP,...n},[c,d]=ew.useState(!1),u=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(u.current=0,d(!1))},[e]),(0,eb.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:tK("fixed top-4 left-1/2 z-50 -translate-x-1/2 transition-[opacity,transform] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]",f?"pointer-events-auto translate-y-0 opacity-100":"pointer-events-none -translate-y-5 opacity-0",r),onDragEnter:function(e){e.preventDefault(),u.current+=1,d(!0)},onDragLeave:function(){u.current=Math.max(0,u.current-1),0===u.current&&d(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",d(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),u.current=0,d(!1);let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id")||e.dataTransfer.getData("text/plain"),n=e.dataTransfer.getData("text/plain")||t||"Dropped item",r=e.dataTransfer.getData("application/vnd.vantaloom.clip-kind");t&&i?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,eb.jsx)("div",{className:tK("min-w-12 overflow-hidden rounded-xl border-2 border-background bg-destructive text-destructive-foreground shadow-lg shadow-black/15 transition-[width,min-height,background-color,border-color,padding,box-shadow] duration-300","dark:border-destructive dark:bg-background dark:text-destructive",c||t.length>0?"w-64 border-dashed bg-destructive/12 p-2 text-destructive dark:bg-destructive/8":"flex size-12 items-center justify-center p-0"),children:c||t.length>0?(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-14 items-center justify-center gap-2 rounded-lg border border-dashed border-destructive/55 bg-destructive/8 px-3 text-sm font-medium text-destructive",children:[(0,eb.jsx)(m0,{className:"size-4"}),(0,eb.jsx)("span",{children:s.empty})]}),t.length>0?(0,eb.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,eb.jsxs)("div",{className:"flex h-8 items-center gap-2 rounded-md border border-destructive/25 bg-background/80 px-2 text-foreground",children:[(0,eb.jsx)("button",{type:"button","aria-label":`Restore ${e.title}`,className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",onClick:()=>o?.(e),children:(0,eb.jsx)(p6,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,eb.jsx)("button",{type:"button",className:"h-8 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition-colors hover:bg-destructive/90 dark:border dark:border-destructive dark:bg-background dark:text-destructive dark:hover:bg-destructive/10",onClick:()=>a?.(t),children:s.delete}):null]}):(0,eb.jsx)(m0,{className:"size-5"})})})}function etz({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:i,onDraggingChange:a,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[d,u]=ew.useState(!1);return(ew.useEffect(()=>{u(!0)},[]),d)?(0,t3.createPortal)((0,eb.jsxs)("div",{className:tK("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,eb.jsx)(etA,{active:!e&&void 0!==i,items:e?[]:n,className:tK(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let i=t.find(t=>t.id===e);i&&(s(t=>({...t,[e]:i})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:i.icon}]))},onDelete:e=>{let t=new Set(e.map(e=>e.id));l(e=>e.filter(e=>!t.has(e.id))),s(e=>{let n={...e};for(let e of t)delete n[e];return n})},onItemRestore:e=>{let n=r[e.id];n&&o([n,...t.filter(e=>e.id!==n.id)]),l(t=>t.filter(t=>t.id!==e.id)),s(t=>{let n={...t};return delete n[e.id],n})}}),t.length>0?(0,eb.jsx)("div",{className:tK("pointer-events-auto absolute top-4 right-4 w-80 max-w-[calc(100vw-2rem)] transition-[opacity,transform] duration-200",e&&"pointer-events-none -translate-y-2 opacity-0"),children:(0,eb.jsx)(QZ,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let i,a,l,s,d;return c.current+=1,i=fx(n),a=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[fa],i&&a&&(a[fi]={...i,config:{...i.config}}),l&&a&&(a[fa]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:a,dragData:{...n.dragData,...i?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(i.config)}:{}}},void((d=[...t]).splice(r+1,0,s),o(d))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>a(e.id),onItemDragEnd:()=>a(void 0)})}):null]}),document.body):null}let etI=ew.createContext(96);function et_(e,t){let n=e[t];if(!n)throw Error(`Missing static grid layout: ${t}`);return n}function etD({layouts:e,minRows:t=9,className:n,children:r,...i}){let[a,o]=f3(),l=o.width>0?(o.width-132)/12:96,s=Math.max(t,e.reduce((e,t)=>Math.max(e,t.y+t.h),0)+2),c=s*l+(s-1)*12;return(0,eb.jsx)("div",{ref:a,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",n),style:{minHeight:c+48},...i,children:(0,eb.jsx)("div",{className:"relative",style:{height:c},children:(0,eb.jsx)(etI.Provider,{value:l,children:r})})})}function etT({layout:e,className:t,style:n,...r}){let i=ew.useContext(etI);return(0,eb.jsx)("div",{className:tK("absolute min-w-0",t),style:{left:e.x*(i+12),top:e.y*(i+12),width:e.w*i+(e.w-1)*12,height:e.h*i+(e.h-1)*12,...n},...r})}let etR=[{id:"firewall",x:0,y:0,w:12,h:8}],etL=f4(etR);function et$(){var e;return e=(0,eb.jsx)(etD,{layouts:etR,children:(0,eb.jsx)(etT,{layout:et_(etL,"firewall"),className:"vtl-firewall-card overflow-hidden rounded-xl border bg-card",children:(0,eb.jsx)(Q_,{})})}),(0,eb.jsx)(f5,{children:e})}let etF=eN("chart-area",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]),etV=eN("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),etB=eN("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),etH=eN("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),etW=eN("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),etU=[{id:"run-ui-polish",title:"组件库视觉回归检查",machine:"Studio-PC",agent:"UI Polish",state:"running",started:"14:08",runtime:"22m",progress:68,load:54},{id:"run-runner-build",title:"Linux runner 镜像构建",machine:"Linux-runner-02",agent:"Build Agent",state:"running",started:"14:15",runtime:"15m",progress:41,load:86},{id:"run-access-audit",title:"工作组权限审阅",machine:"Studio-PC",agent:"Access Agent",state:"blocked",started:"14:21",runtime:"9m",progress:37,load:18},{id:"run-docs",title:"发布说明摘要",machine:"MacBook-build",agent:"Docs Agent",state:"queued",started:"等待",runtime:"0m",progress:0,load:0},{id:"run-cache-clean",title:"缓存清理策略验证",machine:"Linux-runner-02",agent:"Ops Sentinel",state:"failed",started:"13:54",runtime:"6m",progress:28,load:12}],etq=[{id:"worker-studio",machine:"Studio-PC",role:"local coordinator",active:3,capacity:6,cpu:42,memory:68},{id:"worker-runner",machine:"Linux-runner-02",role:"gpu worker",active:4,capacity:5,cpu:76,memory:81},{id:"worker-mac",machine:"MacBook-build",role:"build host",active:0,capacity:3,cpu:8,memory:24}],etK=[{id:"confirm-shell",title:"Studio-PC 请求执行发布前文件写入",meta:"UI Polish · apply_patch",tone:"normal"},{id:"confirm-service",title:"Linux-runner-02 请求重启 runner 服务",meta:"Ops Sentinel · Restart-Service",tone:"warning"},{id:"confirm-token",title:"工作组 token 加入新机器",meta:"Access Agent · admin required",tone:"normal"}],etG=[["14:29","Studio-PC","pnpm --filter vantaloom-app lint","完成"],["14:27","Linux-runner-02","docker build agent-runtime","运行中"],["14:22","Studio-PC","apply_patch agent settings","完成"],["14:17","MacBook-build","pnpm typecheck","排队"],["14:03","Linux-runner-02","cache prune dry-run","失败"]],etY={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function etX(e,t,n=42,r){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&u7(r)&&"vtl-jelly-image-card-shadowless"),style:r?u9({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,eb.jsx)(mM,{label:e,value:t,minSize:n})})}function etZ(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let etJ={metrics:{online:2,health:88.4,latency:"38ms",events:17},machines:[{id:"studio",name:"Studio-PC",os:"Windows",status:"online",link:"direct",heartbeat:"3s",cpu:42,memory:68,disk:71,network:24},{id:"runner",name:"Linux-runner-02",os:"Linux",status:"online",link:"p2p",heartbeat:"5s",cpu:76,memory:81,disk:62,network:43},{id:"mac",name:"MacBook-build",os:"macOS",status:"sleeping",link:"direct",heartbeat:"2m",cpu:8,memory:24,disk:48,network:6}],trend:[{time:"09:00",cpu:36,memory:54,network:24},{time:"10:00",cpu:48,memory:61,network:29},{time:"11:00",cpu:44,memory:58,network:34},{time:"12:00",cpu:63,memory:72,network:41},{time:"13:00",cpu:58,memory:69,network:37},{time:"14:00",cpu:71,memory:76,network:46}],networkLinks:[["Studio-PC","Linux-runner-02","P2P","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","12ms","0.0%"],["Linux-runner-02","MacBook-build","Relay fallback","84ms","1.1%"]],events:[["14:31","Linux-runner-02 心跳延迟升高"],["14:28","Studio-PC 完成 2 个工具调用"],["14:19","MacBook-build 进入睡眠状态"],["14:12","工作组权限策略同步完成"],["14:04","P2P 链路切换到备用路径"]],serviceHealth:[{id:"local-service",name:"Local service",state:"正常",samples:[96,98,97,95,96,94,97,98,96,95,97,96]},{id:"agent-runtime",name:"Agent runtime",state:"正常",samples:[91,93,94,90,88,92,94,93,91,89,92,94]},{id:"p2p-mesh",name:"P2P mesh",state:"波动",samples:[78,82,76,73,68,71,74,79,83,80,77,72]},{id:"plugin-bridge",name:"Plugin bridge",state:"告警",samples:[88,86,84,82,79,74,63,54,48,52,67,76]}]},etQ=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,eb.jsx)(B7,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("运行中","运行队列"),render:e=>etX(e.title,"07",44,u4)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,eb.jsx)(Hz,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("排队","调度器"),render:e=>etX(e.title,"04",44,u3)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("待确认","确认队列"),render:e=>etX(e.title,"03",44,u6)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Worker","Agent worker"),render:e=>etX(e.title,"14",44,u8)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,eb.jsx)(etB,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etZ("任务队列","运行队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BU,{items:etU})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etZ("Agent worker","Worker 状态"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BK,{workers:etq})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,eb.jsx)(g8,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:etZ("最近执行","执行日志"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BW,{items:etG})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:etZ("待确认","确认队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BH,{items:etK})]})}],et0=[{id:"metric-runs",kind:"metric-runs",x:0,y:0,w:3,h:2},{id:"metric-queued",kind:"metric-queued",x:3,y:0,w:3,h:2},{id:"metric-blocked",kind:"metric-blocked",x:6,y:0,w:3,h:2},{id:"metric-workers",kind:"metric-workers",x:9,y:0,w:3,h:2},{id:"queue",kind:"queue",x:0,y:2,w:7,h:5},{id:"workers",kind:"workers",x:7,y:2,w:5,h:5},{id:"log",kind:"log",x:0,y:7,w:7,h:4},{id:"confirmations",kind:"confirmations",x:7,y:7,w:5,h:4}];function et1(e=etJ){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("在线机器","机器心跳"),render:t=>etX(t.title,String(e.metrics.online),44,u4)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,eb.jsx)(Uc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("健康度","服务遥测"),render:t=>etX(t.title,`${e.metrics.health}%`,44,u3)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,eb.jsx)(FK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("平均延迟","网络遥测"),render:t=>etX(t.title,e.metrics.latency,44,u6)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("事件","事件流"),render:t=>etX(t.title,String(e.metrics.events),44,u8)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etZ("机器健康矩阵","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:u9({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BZ,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etZ("资源趋势","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B2,{config:etY,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("网络连接","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B1,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,eb.jsx)(V6,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("事件流","事件流"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BX,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:etZ("服务健康","服务遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B5,{services:e.serviceHealth})]})}]}let et2=et1(),et5=[{id:"metric-online",kind:"metric-online",x:0,y:0,w:3,h:2},{id:"metric-health",kind:"metric-health",x:3,y:0,w:3,h:2},{id:"metric-latency",kind:"metric-latency",x:6,y:0,w:3,h:2},{id:"metric-events",kind:"metric-events",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:7,h:5},{id:"trend",kind:"trend",x:7,y:2,w:5,h:5},{id:"network",kind:"network",x:0,y:7,w:6,h:4},{id:"events",kind:"events",x:6,y:7,w:6,h:4},{id:"services",kind:"services",x:0,y:11,w:12,h:3}],et4={totals:{machines:4,online:2,runtime:3,tokens:7},machines:[{id:"studio",name:"Studio-PC",role:"本机",group:"Core",os:"Windows 11",runtime:"0.16.4",state:"online",tags:["admin","shell","files","scheduler"],agent:"6/8",cpu:42,memory:68,version:"Agent runtime 0.16.4",admin:"Allay"},{id:"runner",name:"Linux-runner-02",role:"GPU worker",group:"Compute",os:"Ubuntu 24.04",runtime:"0.16.3",state:"online",tags:["gpu","agent","files"],agent:"4/6",cpu:76,memory:81,version:"Agent runtime 0.16.3",admin:"Ops"},{id:"mac",name:"MacBook-build",role:"构建机",group:"Build",os:"macOS 15.4",runtime:"0.15.9",state:"sleeping",tags:["build","readonly"],agent:"0/3",cpu:8,memory:24,version:"Agent runtime 0.15.9",admin:"Allay"},{id:"observer",name:"Observer-01",role:"只读观测节点",group:"Edge",os:"Debian 13",runtime:"0.16.2",state:"warning",tags:["readonly","audit"],agent:"1/2",cpu:18,memory:36,version:"Agent runtime 0.16.2",admin:"Security"}],topology:{nodes:[{id:"studio",label:"Studio-PC",meta:"本机",x:50,y:18},{id:"runner",label:"Linux-runner-02",meta:"GPU worker",x:22,y:60},{id:"mac",label:"MacBook-build",meta:"构建机",x:76,y:58,state:"warning"},{id:"observer",label:"Observer-01",meta:"只读观测",x:50,y:82,state:"warning"}],links:[{id:"sr",from:"studio",to:"runner",kind:"p2p",label:"P2P",meta:"38ms / 0.3%"},{id:"sm",from:"studio",to:"mac",kind:"direct",label:"Direct",meta:"12ms / 0%"},{id:"ro",from:"runner",to:"observer",kind:"relay",label:"Relay",meta:"84ms / 1.1%"},{id:"mo",from:"mac",to:"observer",kind:"down",label:"Down",meta:"lost"}]},pathTotals:{direct:1,p2p:1,relay:1,broken:1},latency:Jp,candidates:[["Studio-PC","Linux-runner-02","P2P","symmetric NAT","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","open port 4178","12ms","0.0%"],["Linux-runner-02","Observer-01","Relay","udp blocked","84ms","1.1%"],["MacBook-build","Observer-01","Interrupted","sleep","-","-"]]};function et3(e=et4){return[{id:"total",title:"机器",description:"工作组机器总数。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("机器","机器组"),render:t=>etX(t.title,String(e.totals.machines),42,u4)},{id:"online",title:"在线",description:"当前在线机器。",icon:(0,eb.jsx)(Uc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("在线","机器心跳"),render:t=>etX(t.title,String(e.totals.online),42,u3)},{id:"runtime",title:"Runtime",description:"可用 runtime 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Runtime","Agent runtime"),render:t=>etX(t.title,String(e.totals.runtime),42,u6)},{id:"tokens",title:"Token",description:"已注册 token 数。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Token","机器注册"),render:t=>etX(t.title,String(e.totals.tokens),42,u8)},{id:"machines",title:"机器组",description:"机器角色、版本和标签。",icon:(0,eb.jsx)(Fq,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etZ("机器组","机器组"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bt,{machines:e.machines})]})},{id:"topology",title:"拓扑图",description:"工作组连接拓扑。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:12,h:6},defaultConfig:etZ("拓扑图","网络拓扑"),render:()=>(0,eb.jsx)("section",{className:"size-full rounded-xl border bg-card p-3",children:(0,eb.jsx)(BV,{nodes:e.topology.nodes,links:e.topology.links})})},{id:"direct",title:"直连",description:"直连路径数量。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("直连","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.direct),42,u4)},{id:"p2p",title:"P2P",description:"P2P 路径数量。",icon:(0,eb.jsx)(FK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("P2P","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.p2p),42,u3)},{id:"relay",title:"Relay",description:"Relay 路径数量。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("Relay","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.relay),42,u6)},{id:"broken",title:"中断",description:"中断路径数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etZ("中断","网络拓扑"),render:t=>etX(t.title,String(e.pathTotals.broken),42,u8)},{id:"trend",title:"延迟",description:"不同路径延迟趋势。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("延迟","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(B_,{config:Jg,data:e.latency})]})},{id:"paths",title:"候选路径",description:"可用连接路径候选。",icon:(0,eb.jsx)(etH,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etZ("候选路径","网络候选路径"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BD,{candidates:e.candidates})]})}]}let et6=et3(),et8=[{id:"total",kind:"total",x:0,y:0,w:3,h:2},{id:"online",kind:"online",x:3,y:0,w:3,h:2},{id:"runtime",kind:"runtime",x:6,y:0,w:3,h:2},{id:"tokens",kind:"tokens",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:12,h:4},{id:"topology",kind:"topology",x:0,y:6,w:12,h:6},{id:"direct",kind:"direct",x:0,y:12,w:3,h:2},{id:"p2p",kind:"p2p",x:3,y:12,w:3,h:2},{id:"relay",kind:"relay",x:6,y:12,w:3,h:2},{id:"broken",kind:"broken",x:9,y:12,w:3,h:2},{id:"trend",kind:"trend",x:0,y:14,w:6,h:4},{id:"paths",kind:"paths",x:6,y:14,w:6,h:4}],et7=[{id:"events",title:"日志与审计",description:"审计事件时间线。",icon:(0,eb.jsx)(etB,{className:"size-4"}),defaultSize:{w:8,h:7},defaultConfig:etZ("日志与审计","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bD,{events:Jm})]})},{id:"filters",title:"筛选",description:"审计记录筛选维度。",icon:(0,eb.jsx)(etV,{className:"size-4"}),defaultSize:{w:4,h:3},defaultConfig:etZ("筛选","审计筛选"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(b_,{rows:[["机器","4"],["用户","4"],["Agent","6"],["时间","24h"]]})]})},{id:"risk",title:"拒绝事件",description:"权限拒绝和危险操作数量。",icon:(0,eb.jsx)(etW,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:etZ("拒绝事件","审计事件"),render:e=>etX(e.title,"05",42,"/themes/jelly/bg5.png")},{id:"trend",title:"事件趋势",description:"审计事件趋势图。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etZ("事件趋势","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(FL,{config:Jg,data:Jp})]})}],et9=[{id:"events",kind:"events",x:0,y:0,w:8,h:7},{id:"filters",kind:"filters",x:8,y:0,w:4,h:3},{id:"risk",kind:"risk",x:8,y:3,w:4,h:4},{id:"trend",kind:"trend",x:0,y:7,w:12,h:4}],ene={totals:{machines:0,online:0,runtime:0,tokens:0},machines:[],topology:{nodes:[],links:[]},pathTotals:{direct:0,p2p:0,relay:0,broken:0},latency:[],candidates:[]},ent={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function enn(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,i=!1;async function a(){if(!i){i=!0;try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let i=await t.json();n&&r(i)}catch{n&&r(t)}finally{i=!1}}}a();let o=window.setInterval(a,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}function enr(e){return(0,eb.jsx)(f5,{children:e})}function eni({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=enn("/api/local/machines/fleet",ene),i=ew.useMemo(()=>et3(r),[r]);return(0,eb.jsx)(mk,{boardId:"machine-group",definitions:i,initialLayouts:et8,clipboardItems:e,actionLabel:"机器组页面卡片操作",paletteGroupTitle:"机器组页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let ena=[{id:"processes",x:0,y:0,w:12,h:8}],eno=f4(ena);function enl(){return enr((0,eb.jsx)(etD,{layouts:ena,children:(0,eb.jsx)(etT,{layout:et_(eno,"processes"),className:"overflow-hidden",children:(0,eb.jsx)(ee_,{})})}))}let ens=[{id:"performance",x:0,y:0,w:12,h:8}],enc=f4(ens);function end(){return enr((0,eb.jsx)(etD,{layouts:ens,children:(0,eb.jsx)(etT,{layout:et_(enc,"performance"),className:"overflow-hidden",children:(0,eb.jsx)(eeD,{})})}))}function enu({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"audit-logs",definitions:et7,initialLayouts:et9,clipboardItems:e,actionLabel:"日志审计页面卡片操作",paletteGroupTitle:"日志审计页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let enf=eN("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),enh=eN("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),enp=eN("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),enm=eN("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),eng=[{id:"dashboard",label:eI.dashboard,icon:(0,eb.jsx)(etV,{})},{id:"canvas",label:eI.canvas,icon:(0,eb.jsx)(HI,{}),badge:"4"},{id:"machines",label:eI.machines,icon:(0,eb.jsx)(Fq,{})},{id:"schedules",label:eI.schedules,icon:(0,eb.jsx)(V8,{})},{id:"settings",label:eI.settings,icon:(0,eb.jsx)(mf,{})}],env=[{id:"dashboard",title:eI.dashboard,description:ez.subtitle,sections:[{id:"main",items:[{id:"overview",label:eI.overview,icon:(0,eb.jsx)(vw,{})},{id:"runs",label:eI.runs,icon:(0,eb.jsx)(B7,{}),badge:"12"},{id:"telemetry",label:eI.telemetry,icon:(0,eb.jsx)(Hz,{})}]}]},{id:"canvas",title:eI.canvas,description:"节点画布、Agent 对话和运行工作区。",sections:[{id:"canvases",title:eI.canvas,items:[{id:"open-recent-canvas",label:eI.canvasRecent,icon:(0,eb.jsx)(HI,{})},{id:"new-canvas",label:eI.canvasNew,icon:(0,eb.jsx)(s7,{})},{id:"all-canvases",label:eI.canvasAll,icon:(0,eb.jsx)(FW,{})}]},{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:eI.conversationRecent,icon:(0,eb.jsx)(enh,{})},{id:"new-agent-conversation",label:eI.conversationNew,icon:(0,eb.jsx)(mR,{})},{id:"all-conversations",label:eI.conversationAll,icon:(0,eb.jsx)(B7,{})}]}]},{id:"machines",title:eI.machines,description:"机器、网络、权限和审计。",sections:[{id:"machines",items:[{id:"machine-group",label:eI.fleet,icon:(0,eb.jsx)(eP,{})},{id:"process-management",label:"进程管理",icon:(0,eb.jsx)(enm,{})},{id:"machine-performance",label:"性能",icon:(0,eb.jsx)(Hz,{})},{id:"machine-firewall",label:"防火墙",icon:(0,eb.jsx)(Q$,{})},{id:"audit-logs",label:"日志与审计",icon:(0,eb.jsx)(enp,{})},{id:"machine-files",label:"文件管理",icon:(0,eb.jsx)(enf,{})}]}]},{id:"schedules",title:eI.schedules,description:"自动化、维护窗口和提醒。",sections:[{id:"plans",items:[{id:"calendar",label:eI.calendar,icon:(0,eb.jsx)(V8,{})},{id:"alerts",label:"提醒",icon:(0,eb.jsx)(V6,{})}]}]},{id:"settings",title:eI.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,eb.jsx)(mf,{})},{id:"card-management",label:"卡片管理",icon:(0,eb.jsx)(etV,{})},{id:"billing",label:eI.billing,icon:(0,eb.jsx)(FW,{})}]}]}],enx=eN("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]);function eny({className:e,divided:t=!0,children:n,...r}){let i=ew.Children.toArray(n).filter(Boolean);return(0,eb.jsx)("div",{"data-slot":"settings-card",className:tK("vtl-surface-card overflow-hidden rounded-[var(--surface-card-radius)] border",e),...r,children:t?i.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e,t<i.length-1&&(0,eb.jsx)(V7,{})]},t)):n})}let enb=[{id:"cards",x:0,y:0,w:12,h:9}],enw=f4(enb),enj=[{id:"machine-workspaces",title:"机器页面",cards:[{id:"process-management",title:"进程管理",description:"机器进程、服务和 Agent worker 进程视图。",icon:(0,eb.jsx)(enm,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器进程"},{id:"machine-performance",title:"性能",description:"CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(etF,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器遥测"},{id:"firewall",title:"防火墙",description:"防火墙策略、IP 地址、续期和申请视图。",icon:(0,eb.jsx)(Q$,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"防火墙策略"},{id:"file-manager-window",title:"文件管理窗口",description:"可拖拽、缩放和多窗口并存的文件管理组件。",icon:(0,eb.jsx)(enx,{className:"size-4"}),defaultSize:{w:6,h:5},dataSource:"工作区文件"}]}];function enk(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function enS(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function enC(){let e=etE(),[t,n]=ew.useState(),r=ew.useCallback(()=>{},[]),i=ew.useCallback(()=>{},[]),a=ew.useMemo(()=>Ha({onSelect:r}),[r]),o=ew.useMemo(()=>Hl({onSelect:i}),[i]),l=ew.useMemo(()=>[{id:"dashboard",title:"运维总览",cards:e.map(enS)},{id:"runs",title:"运行",cards:etQ.map(enk)},{id:"telemetry",title:"遥测",cards:et2.map(enk)},{id:"all-canvases",title:"浏览所有画布",cards:a.map(enk)},{id:"all-conversations",title:"浏览所有对话",cards:o.map(enk)},{id:"machine-group",title:"机器组",cards:et6.map(enk)},{id:"audit-logs",title:"日志与审计",cards:et7.map(enk)},...enj],[o,a,e]);return(0,eb.jsx)(f5,{children:(0,eb.jsx)("div",{className:"vtl-card-management-page",children:(0,eb.jsx)(etD,{layouts:enb,children:(0,eb.jsx)(etT,{layout:et_(enw,"cards"),children:(0,eb.jsx)(eny,{className:"h-full",divided:!1,children:t?(0,eb.jsx)(enM,{groupTitle:t.groupTitle,card:t.card,onBack:()=>n(void 0)}):(0,eb.jsx)(enN,{groups:l,onSelect:(e,t)=>n({groupTitle:e,card:t})})})})})})})}function enN({groups:e,onSelect:t}){return(0,eb.jsxs)("div",{className:"vtl-card-management-list flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4 px-5 py-4",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"text-base font-semibold",children:"卡片管理"}),(0,eb.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"当前可用卡片按页面分组。"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[(0,eb.jsx)(etV,{className:"size-4"}),(0,eb.jsx)("span",{children:e.reduce((e,t)=>e+t.cards.length,0)})]})]}),(0,eb.jsx)(f1,{className:"min-h-0 flex-1",children:(0,eb.jsx)("div",{className:"space-y-6 px-5 pb-5",children:e.map(e=>(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)("h3",{className:"text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:e.cards.length})]}),(0,eb.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",children:e.cards.map(n=>(0,eb.jsxs)("button",{type:"button",className:tK("group/card flex min-h-20 items-start gap-3 rounded-[var(--surface-card-radius)] border bg-card px-3 py-3 text-left transition-colors","vtl-managed-card-item","hover:border-foreground/35 hover:bg-muted/35 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/25"),onClick:()=>t(e.title,n),children:[(0,eb.jsx)("span",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground transition-colors group-hover/card:text-foreground",children:n.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:n.title}),(0,eb.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[n.defaultSize.w,"x",n.defaultSize.h]})]}),(0,eb.jsx)("span",{className:"mt-1 line-clamp-2 block text-xs leading-5 text-muted-foreground",children:n.description})]})]},`${e.id}-${n.id}`))})]},e.id))})})]})}function enM({groupTitle:e,card:t,onBack:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-3 px-5 py-4",children:[(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"返回卡片管理",onClick:n,children:(0,eb.jsx)(K1,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("h2",{className:"truncate text-base font-semibold",children:t.title})]})]}),(0,eb.jsx)("div",{className:"grid min-h-0 flex-1 place-items-center px-5 pb-5",children:(0,eb.jsx)("div",{className:"w-full max-w-md rounded-[var(--surface-card-radius)] border bg-card p-5",children:(0,eb.jsxs)("div",{className:"flex items-start gap-3",children:[(0,eb.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground",children:t.icon}),(0,eb.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-sm font-medium",children:"编辑页面预留"}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"后续会在这里接入卡片配置、数据源、默认尺寸和可编辑字段。"})]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"默认尺寸"}),(0,eb.jsxs)("div",{className:"mt-1 font-medium text-foreground",children:[t.defaultSize.w,"x",t.defaultSize.h]})]}),(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"数据源"}),(0,eb.jsx)("div",{className:"mt-1 truncate font-medium text-foreground",children:t.dataSource})]})]})]})]})})})]})}let enE=eU("group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",{variants:{variant:{default:"border-transparent",outline:"border-border",muted:"border-transparent bg-muted/50"},size:{default:"gap-2.5 px-3 py-2.5",sm:"gap-2.5 px-3 py-2.5",xs:"gap-2 px-2.5 py-2"}},defaultVariants:{variant:"default",size:"default"}});function enO({className:e,variant:t="default",size:n="default",asChild:r=!1,...i}){return(0,eb.jsx)(r?eF:"div",{"data-slot":"item","data-variant":t,"data-size":n,className:tK(enE({variant:t,size:n,className:e})),...i})}let enP=eU("flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",{variants:{variant:{default:"bg-transparent",icon:"[&_svg:not([class*='size-'])]:size-4",marker:"size-8 rounded-md border bg-background ui-text-kbd font-medium text-muted-foreground [&_svg:not([class*='size-'])]:size-4",image:"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"},align:{auto:"group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start",start:"translate-y-0.5 self-start",center:"self-center"}},defaultVariants:{variant:"default",align:"auto"}});function enA({className:e,variant:t="default",align:n="auto",...r}){return(0,eb.jsx)("div",{"data-slot":"item-media","data-variant":t,"data-align":n,className:tK(enP({variant:t,align:n,className:e})),...r})}function enz({className:e,align:t,...n}){return(0,eb.jsx)("div",{"data-slot":"item-content","data-align":t,className:tK("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none","start"===t&&"self-start","center"===t&&"self-center",e),...n})}function enI({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-title",className:tK("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",e),...t})}function en_({className:e,...t}){return(0,eb.jsx)("p",{"data-slot":"item-description",className:tK("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function enD({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-actions",className:tK("flex items-center gap-2",e),...t})}let enT={back:"Back",search:"Search settings...",welcomeTitle:"Settings",welcomeDescription:"Search or choose a setting to continue.",recommendations:"Recommended",noResults:"No settings found."};function enR(e){return"string"==typeof e||"number"==typeof e?String(e):""}function enL({sections:e,recommendations:t,sectionId:n,defaultSectionId:r,childId:i,defaultChildId:a,onSelectionChange:o,labels:l,welcomeContent:s,className:c,sidebarClassName:d,contentClassName:u}){let f={...enT,...l},[h,p]=ew.useState(r),[m,g]=ew.useState(a),v=n??h,x=i??m,y=e.find(e=>e.id===v),b=y?.children?.find(e=>e.id===x),w=!!y,j=ew.useMemo(()=>e.flatMap(e=>[{value:e.id,label:e.title,description:e.description,icon:e.icon,searchValue:[enR(e.title),enR(e.description),...e.keywords??[]].join(" "),keywords:e.keywords},...(e.children??[]).map(t=>({value:`${e.id}/${t.id}`,label:t.title,description:e.title,icon:t.icon??e.icon,disabled:t.disabled,searchValue:[enR(t.title),enR(t.description),enR(e.title),...t.keywords??[]].join(" "),keywords:[enR(e.title),...t.keywords??[]]}))]),[e]),k=t??e.flatMap(e=>(e.children??[]).slice(0,2).map(t=>({id:`${e.id}-${t.id}`,title:t.title,description:e.title,icon:t.icon,sectionId:e.id,childId:t.id})));function S(e,t){void 0===n&&p(e),void 0===i&&g(t),o?.({sectionId:e,childId:t})}let C=b?.content??y?.content??s??(0,eb.jsxs)("div",{className:"mx-auto flex min-h-[22rem] w-full max-w-2xl flex-col justify-center gap-5 py-12",children:[(0,eb.jsxs)("div",{className:"space-y-2",children:[(0,eb.jsx)("h3",{className:"text-xl font-semibold tracking-normal",children:f.welcomeTitle}),(0,eb.jsx)("p",{className:"max-w-xl text-sm text-muted-foreground",children:f.welcomeDescription})]}),(0,eb.jsx)(enF,{labels:f,options:j,onSelect:(e,t)=>S(e,t)}),k.length>0&&(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsx)("div",{className:"ui-text-kbd font-medium text-muted-foreground",children:f.recommendations}),(0,eb.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:k.map(e=>(0,eb.jsx)(enO,{asChild:!0,variant:"outline",size:"xs",className:"min-h-14 flex-nowrap bg-card text-left hover:bg-muted/60",children:(0,eb.jsxs)("button",{type:"button",onClick:()=>S(e.sectionId,e.childId),children:[e.icon&&(0,eb.jsx)(enA,{variant:"marker",align:"center",children:e.icon}),(0,eb.jsxs)(enz,{className:"min-w-0 gap-0.5",children:[(0,eb.jsx)(enI,{className:"max-w-full truncate",children:e.title}),e.description&&(0,eb.jsx)(en_,{className:"line-clamp-1",children:e.description})]}),(0,eb.jsx)(enD,{className:"ml-auto",children:(0,eb.jsx)(va,{className:"size-4 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/item:opacity-100"})})]})},e.id))})]})]});return(0,eb.jsxs)("div",{"data-slot":"settings-menu-panel",className:tK("vtl-surface-panel grid min-h-[34rem] overflow-hidden rounded-[var(--surface-panel-radius)] border md:grid-cols-[15rem_minmax(0,1fr)]",c),children:[(0,eb.jsx)("aside",{"data-slot":"settings-menu-sidebar",className:tK("min-h-0 border-b bg-muted/20 md:border-r md:border-b-0",d),children:(0,eb.jsx)(f1,{className:"h-full",children:(0,eb.jsx)("div",{className:"space-y-1 p-2",children:w?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(tY,{type:"button",variant:"ghost",className:"mb-1 h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left",onClick:()=>S(void 0,void 0),children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:(0,eb.jsx)(K1,{})}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:f.back})]}),(y?.children??[]).map(e=>(0,eb.jsx)(en$,{title:e.title,icon:e.icon,badge:e.badge,active:e.id===x,disabled:e.disabled,onClick:()=>S(y?.id,e.id)},e.id))]}):e.map(e=>(0,eb.jsx)(en$,{title:e.title,icon:e.icon,badge:e.badge,disabled:e.disabled,onClick:()=>S(e.id,void 0)},e.id))})})}),(0,eb.jsxs)("main",{"data-slot":"settings-menu-content",className:tK("min-w-0 bg-[var(--surface-panel)] p-4 md:p-5",u),children:[y?(0,eb.jsx)("div",{className:"mb-4 flex min-h-8 items-center justify-between gap-4",children:(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"truncate text-lg font-semibold tracking-normal",children:b?.title??y.title}),(b?.description??y.description)&&(0,eb.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:b?.description??y.description})]})}):null,C]})]})}function en$({title:e,icon:t,badge:n,active:r,disabled:i,onClick:a}){return(0,eb.jsxs)(tY,{type:"button",variant:"ghost",disabled:i,onClick:a,className:tK("h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left font-medium",r?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:t}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e}),n&&(0,eb.jsx)(c_,{variant:"outline",className:"h-5 shrink-0 px-1.5 ui-text-kbd",children:n}),(0,eb.jsx)(va,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]})}function enF({labels:e,options:t,onSelect:n}){return(0,eb.jsx)(gW,{options:t,placeholder:e.search,emptyText:e.noResults,className:"w-full",contentClassName:"rounded-lg",onValueChange:e=>{let[t,r]=e.split("/");t&&n(t,r)},renderOption:e=>(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-4",children:e.icon??(0,eb.jsx)(cz,{})}),(0,eb.jsxs)("span",{className:"grid min-w-0 flex-1 gap-0.5",children:[(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.description&&(0,eb.jsx)("span",{className:"truncate text-sm text-muted-foreground",children:e.description})]})]})})}let enV=eU("vtl-surface-card relative w-full rounded-[var(--surface-card-radius)] border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:top-3.5 [&>svg]:left-4 [&>svg~*]:pl-7",{variants:{variant:{default:"border-border",muted:"border-border bg-muted/40",destructive:"border-destructive/35 bg-destructive/10 text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}});function enB({className:e,variant:t,...n}){return(0,eb.jsx)("div",{role:"alert","data-slot":"alert",className:tK(enV({variant:t}),e),...n})}function enH({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-title",className:tK("mb-1 leading-none font-medium",e),...t})}function enW({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-description",className:tK("text-muted-foreground [&_p]:leading-relaxed",e),...t})}let enU=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function enq(e){return{id:e.id,providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:"",models:e.models,selectedModelIds:e.selectedModelIds,loadingModels:!1,saving:!1,error:e.lastError??"",savedKeyAvailable:!0,editing:!1}}function enK(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[i,a]=ew.useState(""),o=ew.useCallback(async()=>{a("");try{let e=await gJ();t(e.routes.map(enq))}catch(e){a(e instanceof Error?e.message:"模型路由读取失败")}finally{r(!1)}},[]);function l(e,n){t(t=>t.map((t,r)=>r===e?n(t):t))}async function s(t){let n=e[t];if(n&&!n.saving){l(t,e=>({...e,saving:!0,error:""}));try{let e=await g0({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>enq(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}async function c(n){let r=e[n];if(r&&!r.saving){if(!r.id)return void t(e=>e.filter((e,t)=>t!==n));l(n,e=>({...e,saving:!0,error:""}));try{await g1(r.id),t(e=>e.filter((e,t)=>t!==n))}catch(e){l(n,t=>({...t,saving:!1,error:e instanceof Error?e.message:"删除失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,eb.jsxs)("div",{className:"grid gap-4",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,eb.jsx)("div",{className:"min-w-0",children:(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:"",editing:!0},...e])},children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加模型路由"]})]}),i?(0,eb.jsxs)(enB,{variant:"destructive",children:[(0,eb.jsx)(eeR,{}),(0,eb.jsx)(enH,{children:"读取失败"}),(0,eb.jsx)(enW,{children:i})]}):null,n?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,eb.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,eb.jsx)(enG,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)},onDelete:()=>{c(t)}},e.id??`draft-${t}`))})]})}function enG({draft:e,onDraftChange:t,onSave:n,onDelete:r}){let i=ew.useRef(e),a=ew.useRef(t),o=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),l=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),s=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function c(n){t({...e,...n})}if(ew.useEffect(()=>{i.current=e,a.current=t},[e,t]),ew.useEffect(()=>{if(!l)return;let e=window.setTimeout(async()=>{let e=i.current;a.current({...e,loadingModels:!0,error:""});try{let t=await gQ({providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:e.apiKey}),n=e.selectedModelIds.filter(e=>t.models.some(t=>t.id===e));a.current({...e,models:t.models,selectedModelIds:n,loadingModels:!1,error:""})}catch(t){a.current({...e,loadingModels:!1,error:t instanceof Error?t.message:"模型拉取失败"})}},650);return()=>window.clearTimeout(e)},[l,o]),!e.editing){let t=e.selectedModelIds.map(t=>e.models.find(e=>e.id===t)?.displayName||t).filter(Boolean),n=enU.find(t=>t.value===e.protocol)?.label??e.protocol;return(0,eb.jsxs)("section",{className:"grid min-h-16 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.providerName}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n})]}),(0,eb.jsx)("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.length>0?t.join(", "):"未选择模型"})]}),(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",onClick:()=>c({editing:!0}),children:[(0,eb.jsx)(mF,{className:"size-4"}),"编辑"]})]})}return(0,eb.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,eb.jsx)(ny,{value:e.providerName,placeholder:"提供商名称",onChange:e=>c({providerName:e.currentTarget.value})}),(0,eb.jsxs)(JR,{value:e.protocol,onValueChange:e=>c({protocol:e}),children:[(0,eb.jsx)(Qp,{className:"w-full",children:(0,eb.jsx)(JV,{})}),(0,eb.jsx)(Qv,{children:enU.map(e=>(0,eb.jsx)(Qx,{value:e.value,children:e.label},e.value))})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,eb.jsx)(ny,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>c({endpointUrl:e.currentTarget.value})}),(0,eb.jsx)(ny,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>c({apiKey:e.currentTarget.value})})]}),(0,eb.jsx)(V7,{}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,eb.jsx)(mE,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,eb.jsx)("div",{className:"grid max-h-48 gap-1 overflow-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.models.map(t=>{let n=e.selectedModelIds.includes(t.id);return(0,eb.jsxs)("label",{className:tK("grid min-h-8 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,eb.jsx)(nx,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void c({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,eb.jsx)("span",{className:"truncate",children:t.displayName||t.id})]},t.id)})}):(0,eb.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,eb.jsxs)(enB,{variant:"destructive",children:[(0,eb.jsx)(eeR,{}),(0,eb.jsx)(enH,{children:"模型路由错误"}),(0,eb.jsx)(enW,{className:"break-words",children:e.error})]}):null,(0,eb.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,eb.jsxs)(tY,{type:"button",variant:"destructive",onClick:r,disabled:e.saving,children:[(0,eb.jsx)(m0,{className:"size-4"}),"删除"]}),(0,eb.jsx)(tY,{type:"button",onClick:n,disabled:!s,children:e.saving?"保存中":"保存"})]})]})}let enY=[{id:"settings",x:0,y:0,w:12,h:8}],enX=f4(enY);function enZ(){return(0,eb.jsx)(f5,{children:(0,eb.jsx)(etD,{layouts:enY,children:(0,eb.jsx)(etT,{layout:et_(enX,"settings"),children:(0,eb.jsx)(enL,{className:"h-full min-h-0",contentClassName:"min-h-0 overflow-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",sections:[{id:"preferences",title:"偏好设置",icon:(0,eb.jsx)(mE,{}),children:[{id:"model-routes",title:"模型路由",icon:(0,eb.jsx)(mE,{}),content:(0,eb.jsx)(enK,{})}]}],defaultSectionId:"preferences",defaultChildId:"model-routes",labels:{back:"返回",search:"搜索设置",welcomeTitle:"偏好设置",welcomeDescription:"",recommendations:"常用",noResults:"没有设置项"}})})})})}let enJ=eN("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),enQ=eN("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var en0=e.i(91e3);let en1=["light","dark","jelly"],en2={light:{label:"Light",icon:enQ,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:enJ,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,eb.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,eb.jsx)("path",{d:"M6.5 11.5C6.5 8 8.7 5.5 12 5.5s5.5 2.5 5.5 6v.6c0 .8-.6 1.4-1.4 1.4H7.9c-.8 0-1.4-.6-1.4-1.4v-.6Z"}),(0,eb.jsx)("path",{d:"M7.8 13.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5"}),(0,eb.jsx)("path",{d:"M9 15.5c0 1.4-1.2 1.4-1.2 2.8 0 .7.3 1.2.8 1.7"}),(0,eb.jsx)("path",{d:"M12 15.5c0 1.6-1.4 1.6-1.4 3.2 0 .7.3 1.2.8 1.8"}),(0,eb.jsx)("path",{d:"M15 15.5c0 1.4 1.2 1.4 1.2 2.8 0 .7-.3 1.2-.8 1.7"})]})},className:"text-primary"}};function en5(){let{resolvedTheme:e,setTheme:t}=(0,Uh.useTheme)(),[n,r]=ew.useState(en0.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(en0.appearanceThemeStorageKey)??en0.defaultAppearanceTheme;r(e),(0,en0.applyAppearanceTheme)({theme:e})},[]);let i=n===en0.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",a=en1.indexOf(i),o=en1[(a+1)%en1.length]??"light",{icon:l,label:s,className:c}=en2[i];function d(e){r(e),window.localStorage.setItem(en0.appearanceThemeStorageKey,e),(0,en0.applyAppearanceTheme)({theme:e})}return(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",className:tK("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${ez.theme}: ${s}`,title:`${ez.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),d(en0.jellyAppearanceTheme);return}d(en0.defaultAppearanceTheme),t(o)},children:(0,eb.jsx)(l,{})})}function en4({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"runtime-operations",definitions:etQ,initialLayouts:et0,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function en3({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=enn("/api/local/machines/telemetry",ent),i=ew.useMemo(()=>et1(r),[r]);return(0,eb.jsx)(mk,{boardId:"telemetry",definitions:i,initialLayouts:et5,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function en6(){let[e,t]=ew.useState("dashboard"),[n,r]=ew.useState(!1),[i,a]=ew.useState(!1),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[d,u]=ew.useState(!1),[f,h]=ew.useState([]),[p,m]=ew.useState([]),[g,v]=ew.useState({}),[x,y]=ew.useState(),[b,w]=ew.useState(HV),[j,k]=ew.useState([]),[S,C]=ew.useState(),N=ew.useCallback(e=>{w(t=>o9(e,t))},[]),M=ew.useCallback(e=>{k(t=>o9(e,t))},[]),E=ew.useCallback(async e=>{c(await Hh(e)),t("new-agent-conversation")},[]),O=ew.useCallback(async()=>{let e=await Hu();e?(c(await Hh(e.conversation.id)),t("new-agent-conversation")):l(!0)},[]);return(0,eb.jsxs)("main",{className:"vtl-app-background relative h-svh overflow-hidden text-foreground",children:[(0,eb.jsx)("div",{className:"pointer-events-none fixed inset-y-0 left-0 z-40 p-3",children:(0,eb.jsx)(uX,{navItems:eng,contents:env,defaultActiveNavId:"dashboard",defaultSelectedItemId:"overview",defaultExpandedItemIds:["runs"],logo:(0,eb.jsx)(nw,{}),account:(0,eb.jsx)(nj,{}),labels:{collapse:"收起菜单",expand:"展开菜单",search:eI.search,account:"账户",hideSidebar:"收起侧边栏",showSidebar:"展开侧边栏"},className:"h-[calc(100svh-1.5rem)] drop-shadow-lg",footer:(0,eb.jsx)(en5,{}),onItemSelect:({item:e})=>{"new-canvas"===e.id?t("new-canvas"):"all-canvases"===e.id?t("all-canvases"):"new-agent-conversation"===e.id?l(!0):"open-recent-conversation"===e.id?O():"all-conversations"===e.id?t("all-conversations"):"overview"===e.id?t("dashboard"):"runs"===e.id?t("runs"):"telemetry"===e.id?t("telemetry"):("machine-group"===e.id||"process-management"===e.id||"machine-performance"===e.id||"machine-firewall"===e.id||"audit-logs"===e.id||"machine-files"===e.id||"preferences"===e.id||"card-management"===e.id)&&t(e.id)}})}),(0,eb.jsxs)("section",{className:tK("h-full min-w-0","dashboard"===e?"overflow-auto pl-[8.5rem]":"overflow-hidden"),children:["runs"===e?(0,eb.jsx)(en4,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"telemetry"===e?(0,eb.jsx)(en3,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-group"===e?(0,eb.jsx)(eni,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"process-management"===e?(0,eb.jsx)(enl,{}):"machine-performance"===e?(0,eb.jsx)(end,{}):"machine-firewall"===e?(0,eb.jsx)(et$,{}):"audit-logs"===e?(0,eb.jsx)(enu,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-files"===e?(0,eb.jsx)(Q3,{clipboardItems:f,onClipboardItemsChange:h}):"preferences"===e?(0,eb.jsx)(enZ,{}):"card-management"===e?(0,eb.jsx)(enC,{}):"new-canvas"===e?(0,eb.jsx)(etb,{nodes:b,edges:j,selectedNodeId:S,clipboardItems:f,onNodesChange:N,onEdgesChange:M,onNodesSet:w,onEdgesSet:k,onSelectedNodeChange:C,onClipboardItemsChange:h}):"all-canvases"===e?(0,eb.jsx)(eth,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"new-agent-conversation"===e?(0,eb.jsx)(eto,{conversation:s,clipboardItems:f,clipboardDraggingId:x,onClipboardItemsChange:h,onClipboardDraggingChange:y,onOverlayOpenChange:a}):"all-conversations"===e?(0,eb.jsx)(HC,{clipboardItems:f,onClipboardItemsChange:h,onOpenConversation:e=>{E(e)},onOverlayOpenChange:u}):(0,eb.jsx)(etO,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:r}),(0,eb.jsx)(etz,{hidden:"dashboard"===e?n||o:"new-agent-conversation"===e?i||o:d,items:f,trashItems:p,draggingId:x,onDraggingChange:y,onItemsChange:h,onTrashItemsChange:m,onTrashClipboardItemsChange:v,trashClipboardItems:g})]}),(0,eb.jsx)(HO,{open:o,onOpenChange:l,onCreated:e=>{c(e),t("new-agent-conversation")}})]})}let en8=ey.default.env.NEXT_PUBLIC_VANTALOOM_AUTH_MODE??"disabled-local";function en7(){let[e,t]=ew.useState("disabled-local"===en8);return e?(0,eb.jsx)(en6,{}):(0,eb.jsx)(nb,{onComplete:()=>t(!0)})}e.s(["default",()=>en7],66204)}]);