From c749c3839c5965743c4d529d226d6efedf0b6bdc Mon Sep 17 00:00:00 2001 From: evanlowe <62918515+evanlowe@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:32:08 +0800 Subject: [PATCH] fix(studio): preserve runtime network selection on update --- frontend/src/App.tsx | 1 + frontend/src/adk/client.ts | 3 +- frontend/tests/agentWorkspace.test.mjs | 2 + frontend/tests/deploymentConfigUi.test.mjs | 5 +++ tests/cli/test_studio_rbac.py | 17 +++++++ veadk/cli/cli_frontend.py | 45 +++++++++++++++++++ ...tor-BoKmmyZA.js => CodeEditor-Cv1wH8op.js} | 2 +- ...xl.js => MarkdownPromptEditor-DYqOUnwy.js} | 2 +- .../{index-DDW_pglp.js => index-C5keL_KS.js} | 10 ++--- veadk/webui/index.html | 2 +- 10 files changed, 80 insertions(+), 9 deletions(-) rename veadk/webui/assets/{CodeEditor-BoKmmyZA.js => CodeEditor-Cv1wH8op.js} (99%) rename veadk/webui/assets/{MarkdownPromptEditor-BZqRO5xl.js => MarkdownPromptEditor-DYqOUnwy.js} (99%) rename veadk/webui/assets/{index-DDW_pglp.js => index-C5keL_KS.js} (99%) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ce63ee73..2b44f954 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -4337,6 +4337,7 @@ export default function App() { ...nextDraft, deployment: { ...(nextDraft.deployment ?? { feishuEnabled: false }), + network: capability.runtime.network, envValues: { ...runtimeEnvValues, ...(nextDraft.deployment?.envValues ?? {}), diff --git a/frontend/src/adk/client.ts b/frontend/src/adk/client.ts index 2ba3d6d0..e8a3d948 100644 --- a/frontend/src/adk/client.ts +++ b/frontend/src/adk/client.ts @@ -18,7 +18,7 @@ import { TRANSFER_REQUEST_TIMEOUT_MS, } from "./timeout"; import type { AgentProject } from "../create/project"; -import type { AgentDraft } from "../create/types"; +import type { AgentDraft, NetworkConfig } from "../create/types"; import type { IssueFeedbackReport } from "./issueFeedback"; /** An ADK event as serialised over `/run_sse` (camelCase, by_alias=True). */ @@ -2469,6 +2469,7 @@ export interface RuntimeUpdateCapability { region: string; currentVersion?: number | null; envs: { key: string; value: string }[]; + network: NetworkConfig; }; agent?: { appName: string; diff --git a/frontend/tests/agentWorkspace.test.mjs b/frontend/tests/agentWorkspace.test.mjs index 73674eea..f82dd116 100644 --- a/frontend/tests/agentWorkspace.test.mjs +++ b/frontend/tests/agentWorkspace.test.mjs @@ -425,6 +425,7 @@ test("runtime refresh preserves agent order and detail loading uses an overlay", test("runtime updates use the Agent selected in management instead of the active chat connection", () => { assert.match(clientSource, /export interface RuntimeUpdateCapability/); assert.match(clientSource, /envs: \{ key: string; value: string \}\[\]/); + assert.match(clientSource, /network: NetworkConfig/); assert.match(clientSource, /agent\?:\s*\{[\s\S]*?\}\s*\| null/); assert.match(clientSource, /export async function getRuntimeUpdateCapability/); assert.match(clientSource, /\/web\/runtime-update-capability\?\$\{params\.toString\(\)\}/); @@ -453,6 +454,7 @@ test("runtime updates use the Agent selected in management instead of the active handler, /envValues:\s*\{[\s\S]*?\.\.\.runtimeEnvValues,[\s\S]*?\.\.\.\(nextDraft\.deployment\?\.envValues \?\? \{\}\)/, ); + assert.match(handler, /network:\s*capability\.runtime\.network/); }); test("runtime update capability checks ignore aborted and stale selections", () => { diff --git a/frontend/tests/deploymentConfigUi.test.mjs b/frontend/tests/deploymentConfigUi.test.mjs index c697f55a..1356bf7d 100644 --- a/frontend/tests/deploymentConfigUi.test.mjs +++ b/frontend/tests/deploymentConfigUi.test.mjs @@ -401,6 +401,11 @@ test("requires explicit confirmation before starting deployment", () => { /disabled=\{deploying \|\| isRuntimeUpdate \|\| !onNetworkChange\}/, ); assert.match(projectPreviewSource, /现有 Runtime 的区域与网络模式保持不变。/); + assert.match(projectPreviewSource, /const networkMode = network\?\.mode \?\? "public"/); + assert.match( + projectPreviewSource, + /checked=\{networkMode === mode\}[\s\S]*?disabled=\{deploying \|\| isRuntimeUpdate \|\| !onNetworkChange\}/, + ); }); test("creates feedback evaluation sets by default and sends the deployment choice", () => { diff --git a/tests/cli/test_studio_rbac.py b/tests/cli/test_studio_rbac.py index 66b57a95..2f0ad5c0 100644 --- a/tests/cli/test_studio_rbac.py +++ b/tests/cli/test_studio_rbac.py @@ -901,6 +901,17 @@ def test_runtime_update_capability_supports_owned_unmanaged_runtime( _runtime("runtime-unmanaged", "developer", managed=False) ) runtime.current_version_number = 7 + runtime.network_configurations.append( + SimpleNamespace( + endpoint="https://runtime.internal.example.com", + network_type="private", + vpc_configuration=SimpleNamespace( + vpc_id="vpc-existing", + subnet_ids=["subnet-a", "subnet-b"], + enable_shared_internet_access=True, + ), + ) + ) requested_paths: list[str] = [] def get_runtime(_self: Any, request: Any) -> SimpleNamespace: @@ -1003,6 +1014,12 @@ async def request( "currentVersion": 7, "managed": False, "envs": [], + "network": { + "mode": "both", + "vpcId": "vpc-existing", + "subnetIds": "subnet-a,subnet-b", + "enableSharedInternetAccess": True, + }, }, "agent": { "appName": "selected-agent", diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index 42520982..a6c1c87b 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -5268,6 +5268,50 @@ async def _runtime_json_request( raise RuntimeError("Runtime returned an invalid JSON response") return data + def _runtime_network_payload(runtime: Any) -> dict[str, Any]: + network_configurations = list( + getattr(runtime, "network_configurations", None) or [] + ) + network_types = { + str(getattr(item, "network_type", "") or "").strip().lower() + for item in network_configurations + } + private_network = next( + ( + item + for item in network_configurations + if str(getattr(item, "network_type", "") or "").strip().lower() + == "private" + ), + None, + ) + mode = ( + "both" + if "public" in network_types and private_network is not None + else "private" + if private_network is not None + else "public" + ) + payload: dict[str, Any] = {"mode": mode} + vpc_configuration = getattr(private_network, "vpc_configuration", None) + if vpc_configuration is None: + return payload + + vpc_id = str(getattr(vpc_configuration, "vpc_id", "") or "").strip() + if vpc_id: + payload["vpcId"] = vpc_id + subnet_ids = getattr(vpc_configuration, "subnet_ids", None) or [] + if subnet_ids: + payload["subnetIds"] = ",".join(str(item) for item in subnet_ids) + shared_internet = getattr( + vpc_configuration, + "enable_shared_internet_access", + None, + ) + if shared_internet is not None: + payload["enableSharedInternetAccess"] = bool(shared_internet) + return payload + def _runtime_update_payload(runtime: Any, region: str) -> dict[str, Any]: tags = _runtime_tags(runtime) return { @@ -5285,6 +5329,7 @@ def _runtime_update_payload(runtime: Any, region: str) -> dict[str, Any]: for item in (getattr(runtime, "envs", None) or []) if getattr(item, "key", None) ], + "network": _runtime_network_payload(runtime), } def _runtime_update_result( diff --git a/veadk/webui/assets/CodeEditor-BoKmmyZA.js b/veadk/webui/assets/CodeEditor-Cv1wH8op.js similarity index 99% rename from veadk/webui/assets/CodeEditor-BoKmmyZA.js rename to veadk/webui/assets/CodeEditor-Cv1wH8op.js index 9114f6aa..382ac323 100644 --- a/veadk/webui/assets/CodeEditor-BoKmmyZA.js +++ b/veadk/webui/assets/CodeEditor-Cv1wH8op.js @@ -1,4 +1,4 @@ -import{L as xe,D as sf}from"./index-DDW_pglp.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO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4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A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#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` +import{L as xe,D as sf}from"./index-C5keL_KS.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO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uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o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#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2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,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=n),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new le(n,r)),n=[],r=-1);return r>-1&&t.push(new le(n,r)),t}}class Ot extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?n.push(l):l.decompose(e-o,t-o,n,h)}o=a+1}}replace(e,t,n){if([e,t]=Vi(this,e,t),n.lines=s&&t<=l){let a=o.replace(e-s,t-s,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Ot(c,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=n),eo&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ot))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let u of e)n+=u.lines;if(n<32){let u=[];for(let d of e)d.flatten(u);return new le(u,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ot)for(let m of u.children)O(m);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof le&&a&&(d=c[c.length-1])instanceof le&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new le(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>r&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ot.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ot(l,t)}}D.empty=new le([""],0);function Vg(i){let e=-1;for(let t of i)e+=t.length+1;return e}function zr(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s=t&&(a>n&&(l=l.slice(0,n-r)),r0?1:(e instanceof le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof le?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof le){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof le?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Sf{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new gn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},gn.prototype[Symbol.iterator]=Sf.prototype[Symbol.iterator]=bf.prototype[Symbol.iterator]=function(){return this});let Yg=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Vi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function de(i,e,t=!0,n=!0){return Eg(i,e,t,n)}function Lg(i){return i>=56320&&i<57344}function Dg(i){return i>=55296&&i<56320}function Re(i,e){let t=i.charCodeAt(e);if(!Dg(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Lg(n)?(t-55296<<10)+(n-56320)+65536:t}function oa(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ft(i){return i<65536?1:2}const Jo=/\r\n?|\n/;var Se=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Se||(Se={}));class Qt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(n!=Se.Simple&&h>=e&&(n==Se.TrackDel&&re||n==Se.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qt(e)}static create(e){return new Qt(e)}}class ce extends Qt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return el(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return tl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&Bt(n,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;of||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?D.of(u.split(n||Jo)):u:D.empty,m=d.length;if(O==f&&m==0)return;Oo&&ke(r,O-o,-1),ke(r,f-O,m),Bt(s,r,d),o=f}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function Bt(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,h,s,c,O),r=h,s=c}}}function tl(i,e,t,n=!1){let r=[],s=n?[]:null,o=new Xn(i),l=new Xn(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ke(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>h),s.forward2(a),o.forward(a)}}}}class Xn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?D.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Lt(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,n,r){return new Lt(e,t,n,r)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;rr.from-s.from),t=e.indexOf(n);for(let r=1;rs.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function xf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let la=0;class C{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=la++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new C(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:aa),!!e.static,e.enables)}of(e){return new _r([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function aa(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class _r{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=la++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:((t=e[O.id])!==null&&t!==void 0?t:1)&1||c.push(e[O.id]);return{create(O){return O.values[o]=n(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||il(O,c)){let u=n(O);if(l?!Zh(u,O.values[o],r):!r(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let m=es(f,d);if(this.dependencies.every(g=>g instanceof C?f.facet(g)===O.facet(g):g instanceof ye?f.field(g,!1)==O.field(g,!1):!0)||(l?Zh(u=n(O),m,r):r(u=n(O),m)))return O.values[o]=m,0}else u=n(O);return O.values[o]=u,1}}}get extension(){return this}}function Zh(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let h=[];for(let c=0;cn===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let s=n.facet(ur),o=r.facet(ur),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(n.values[t]=l.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const ai={lowest:4,low:3,default:2,high:1,highest:0};function on(i){return e=>new kf(e,i)}const _t={highest:on(ai.highest),high:on(ai.high),default:on(ai.default),low:on(ai.low),lowest:on(ai.lowest)};class kf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Xs{of(e){return new nl(this,e)}reconfigure(e){return Xs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class nl{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class Jr{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let f of Gg(e,t,o))f instanceof ye?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of r)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=n==null?void 0:n.config.facets;for(let f in s){let u=s[f],d=u[0].facet,m=c&&c[f]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,aa(m,u))a.push(n.facet(d));else{let g=d.combine(u.map(Q=>Q.value));a.push(n&&d.compare(g,n.facet(d))?n.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(Q=>g.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(g=>Bg(g,d,u))}}let O=h.map(f=>f(l));return new Jr(e,o,O,l,a,s)}}function Gg(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=n[a].indexOf(o);h>-1&&n[a].splice(h,1),o instanceof nl&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof nl){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof kf)s(o.inner,o.prec);else if(o instanceof ye)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _r)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,ai.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ai.default),n.reduce((o,l)=>o.concat(l))}function Qn(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function es(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Pf=C.define(),rl=C.define({combine:i=>i.some(e=>e),static:!0}),$f=C.define({combine:i=>i.length?i[0]:void 0,static:!0}),wf=C.define(),vf=C.define(),Tf=C.define(),Xf=C.define({combine:i=>i.length?i[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ig}}class Ig{of(e){return new bt(this,e)}}class Ug{constructor(e){this.map=e}of(e){return new W(this,e)}}class W{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new W(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ug(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}}W.reconfigure=W.define();W.appendConfig=W.define();class he{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xf(n,t.newLength),s.some(l=>l.type==he.time)||(this.annotations=s.concat(he.time.of(Date.now())))}static create(e,t,n,r,s,o){return new he(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(he.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}he.time=bt.define();he.userEvent=bt.define();he.addToHistory=bt.define();he.remote=bt.define();function Ng(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n=i[n]))s=i[n++],o=i[n++];else if(r=0;r--){let s=n[r](i);s instanceof he?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof he?i=s[0]:i=Rf(e,Ai(s),!1)}return i}function Hg(i){let e=i.startState,t=e.facet(Tf),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=Cf(n,sl(e,s,i.changes.newLength),!0))}return n==i?i:he.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const Kg=[];function Ai(i){return i==null?Kg:Array.isArray(i)?i:[i]}var te=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(te||(te={}));const Jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ol;try{ol=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function e0(i){if(ol)return ol.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Jg.test(t)))return!0}return!1}function t0(i){return e=>{if(!/\S/.test(e))return te.Space;if(e0(e))return te.Word;for(let t=0;t-1)return te.Word;return te.Other}}class Y{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(W.reconfigure)?(t=null,n=l.value):l.is(W.appendConfig)&&(t=null,n=Ai(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Jr.resolve(n,r,this),s=new Y(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(rl)?e.newSelection:e.newSelection.asSingle();new Y(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Ai(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return Y.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Jr.resolve(e.extensions||[],new Map),n=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(Y.lineSeparator)||Jo)),r=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return xf(r,n.length),t.staticFacet(rl)||(r=r.asSingle()),new Y(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Y.tabSize)}get lineBreak(){return this.facet(Y.lineSeparator)||` diff --git a/veadk/webui/assets/MarkdownPromptEditor-BZqRO5xl.js b/veadk/webui/assets/MarkdownPromptEditor-DYqOUnwy.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-BZqRO5xl.js rename to veadk/webui/assets/MarkdownPromptEditor-DYqOUnwy.js index e34b051e..d27e856e 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-BZqRO5xl.js +++ b/veadk/webui/assets/MarkdownPromptEditor-DYqOUnwy.js @@ -1,4 +1,4 @@ -var px=Object.defineProperty;var mx=(t,e,n)=>e in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-DDW_pglp.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-C5keL_KS.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ni.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-DYqOUnwy.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); var HG=Object.defineProperty;var hC=e=>{throw TypeError(e)};var zG=(e,t,n)=>t in e?HG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pC=(e,t,n)=>zG(e,typeof t!="symbol"?t+"":t,n),mC=(e,t,n)=>t.has(e)||hC("Cannot "+n);var Ci=(e,t,n)=>(mC(e,t,"read from private field"),n?n.call(e):t.get(e)),gC=(e,t,n)=>t.has(e)?hC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),kE=(e,t,n,s)=>(mC(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function VG(e,t){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Nl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vD={exports:{}},Sx={};/** * @license React * react-jsx-runtime.production.js @@ -1067,7 +1067,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=nb(t),s=Zu(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=nb(t),s=Zu(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Rke(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ike||null,prettyErrors:t}}function Oke(e,t={}){const{lineCounter:n,prettyErrors:s}=Rke(t),i=new jke(n==null?void 0:n.addNewLine),r=new Nke(t);let a=null;for(const l of r.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new pp(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(a.errors.forEach(y3(e,n)),a.warnings.forEach(y3(e,n))),a}function Mke(e,t,n){let s;const i=Oke(e,n);if(!i)return null;if(i.warnings.forEach(r=>gH(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function Lke(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Ag(e)&&!s?e.toString(n):new Rg(e,s,n).toString(n)}const GH=new Set(["local","sqlite","mysql","postgresql"]),KH=new Set(["local","opensearch","redis","viking","openviking","mem0"]),qH=new Set(["opensearch","viking","context_search"]),YH=new Set(["apmplus","cozeloop","tls"]),WH=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Dke=new Set(MU.map(e=>e.id)),Pke=new Set(["llm","sequential","parallel","loop","a2a"]);function It(e,t=""){return typeof e=="string"?e:t}function Kr(e){return e===!0}function Qp(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Bke(e){return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function XH(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:It(t.name),description:It(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function Zd(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function QH(e){return typeof e=="string"&&Pke.has(e)?e:"llm"}function ZH(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function JH(e){const t=e&&typeof e=="object"?e:{};return{enabled:Kr(t.enabled),registrySpaceId:It(t.registrySpaceId),registryTopK:It(t.registryTopK),registryRegion:It(t.registryRegion),registryEndpoint:It(t.registryEndpoint)}}function ez(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},s=n.memory&&typeof n.memory=="object"?n.memory:{},i=JH(n.a2aRegistry),r=QH(n.agentType),a=i.enabled&&r==="llm"?"a2a":r;return{...Si(),name:It(n.name),description:It(n.description),instruction:It(n.instruction),agentType:a,maxIterations:ZH(n.maxIterations),a2aUrl:It(n.a2aUrl),modelName:It(n.modelName),modelProvider:It(n.modelProvider),modelApiBase:It(n.modelApiBase),builtinTools:Qp(n.builtinTools).filter(l=>WH.has(l)),customTools:XH(n.customTools),memory:{shortTerm:Kr(s.shortTerm),longTerm:Kr(s.longTerm)},shortTermBackend:Zd(n.shortTermBackend,GH,"local"),longTermBackend:Zd(n.longTermBackend,KH,"local"),autoSaveSession:Kr(n.autoSaveSession),knowledgebase:Kr(n.knowledgebase),knowledgebaseBackend:Zd(n.knowledgebaseBackend,qH,uu),knowledgebaseIndex:It(n.knowledgebaseIndex),tracing:Kr(n.tracing),tracingExporters:Qp(n.tracingExporters).filter(l=>YH.has(l)),a2aRegistry:a==="a2a"?{...i,enabled:!0}:i,subAgents:ez(n.subAgents),selectedSkills:tz(n)}}):[]}function tz(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const s=n&&typeof n=="object"?n:{},i=It(s.source),r=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=It(s.name)||It(s.slug)||It(s.skillName)||It(s.skillId)||"skill",l=It(s.folder)||a,c=It(s.description);if(r==="skillhub"){const f=It(s.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:It(s.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(s.localFiles)?s.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=It(m.path),v=It(m.content);return b?{path:b,content:v}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:r,folder:l,name:a,description:c,localFiles:h});continue}const u=It(s.skillSpaceId),d=It(s.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:It(s.skillSpaceName),skillId:d,version:It(s.version)})}return t}function p2(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},s=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=Bke(s.envValues),r=JH(t.a2aRegistry),a=QH(t.agentType),l=r.enabled&&a==="llm"?"a2a":a,c=Array.isArray(t.mcpTools)?t.mcpTools.map(u=>{const d=u&&typeof u=="object"?u:{},f=d.transport==="stdio"?"stdio":"http";return{name:It(d.name),transport:f,url:It(d.url),authToken:It(d.authToken),authTokenEnv:It(d.authTokenEnv),command:It(d.command),args:Qp(d.args)}}).filter(u=>u.transport==="http"?!!u.url:!!u.command):[];return{...Si(),name:It(t.name)||"my_agent",description:It(t.description),instruction:It(t.instruction)||"You are a helpful assistant.",agentType:l,maxIterations:ZH(t.maxIterations),a2aUrl:It(t.a2aUrl),modelName:It(t.modelName),modelProvider:It(t.modelProvider),modelApiBase:It(t.modelApiBase),builtinTools:Qp(t.builtinTools).filter(u=>WH.has(u)),customTools:XH(t.customTools),mcpTools:c,a2aRegistry:l==="a2a"?{...r,enabled:!0}:r,memory:{shortTerm:Kr(n.shortTerm),longTerm:Kr(n.longTerm)},shortTermBackend:Zd(t.shortTermBackend,GH,"local"),longTermBackend:Zd(t.longTermBackend,KH,"local"),autoSaveSession:Kr(t.autoSaveSession),knowledgebase:Kr(t.knowledgebase),knowledgebaseBackend:Zd(t.knowledgebaseBackend,qH,uu),knowledgebaseIndex:It(t.knowledgebaseIndex),tracing:Kr(t.tracing),tracingExporters:Qp(t.tracingExporters).filter(u=>YH.has(u)),deployment:{feishuEnabled:Kr(s.feishuEnabled),...Object.keys(i).length>0?{envValues:i}:{}},subAgents:ez(t.subAgents),selectedSkills:tz(t)}}function nz(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>Dke.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:uu,knowledgebaseIndex:"",subAgents:e.subAgents.map(nz)}}const Uke=/^[A-Za-z_][A-Za-z0-9_]*$/,m2=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function _3(e,t){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||t}function Fke(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n+=1;return`${e}_${n}`}function sz(e){var n,s,i;const t=(n=e.authTokenEnv)==null?void 0:n.trim();return t&&Uke.test(t)?t:((i=(s=e.authToken)==null?void 0:s.trim().match(m2))==null?void 0:i[1])??""}function $ke(e){if(e.authToken)return e.authToken;const t=sz(e);return t?`\${${t}}`:""}function Hke(e,t){if(!t){const s={...e};return delete s.authToken,delete s.authTokenEnv,s}const n=t.trim().match(m2);if(n){const s={...e,authTokenEnv:n[1]};return delete s.authToken,s}return{...e,authToken:t}}function zke(e){if(!e.trim())return!1;try{return!new URL(e).pathname.replace(/\/+$/,"").endsWith("/mcp")}catch{return!1}}function Y1(e){const t=new Set,n={},s=i=>{var u;const r=_3(i.name,"AGENT"),a=(u=i.mcpTools)==null?void 0:u.map((d,f)=>{var y,x;const h=((y=d.authToken)==null?void 0:y.trim())??"",p=((x=h.match(m2))==null?void 0:x[1])??"";let b=sz(d);if(!b&&h){const E=_3(d.name,`TOOL_${f+1}`);b=Fke(`MCP_${r}_${E}_AUTH_TOKEN`,t)}b&&t.add(b),b&&h&&!p&&(n[b]=h);const v={...d};return delete v.authToken,b?v.authTokenEnv=b:delete v.authTokenEnv,v}),l=i.subAgents.map(s),c=i.workflow?{...i.workflow,nodes:i.workflow.nodes.map(d=>({...d,agent:s(d.agent)}))}:void 0;return{...i,subAgents:l,...a?{mcpTools:a}:{},...c?{workflow:c}:{}}};return{draft:s(e),envValues:n}}function iz(e){var n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x,E,w,_,S,k;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const T={enabled:!0};(s=e.a2aRegistry.registrySpaceId)!=null&&s.trim()&&(T.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),T.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||_a.topK,T.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||_a.region,T.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||_a.endpoint,t.a2aRegistry=T}return t}if(t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(l=e.modelName)!=null&&l.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(T=>({name:T.name,description:T.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(T=>{var I,j,O,z;const C={name:T.name,transport:T.transport};return(I=T.url)!=null&&I.trim()&&(C.url=T.url.trim()),(j=T.authTokenEnv)!=null&&j.trim()&&(C.authTokenEnv=T.authTokenEnv.trim()),(O=T.command)!=null&&O.trim()&&(C.command=T.command.trim()),(z=T.args)!=null&&z.length&&(C.args=T.args),C})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"viking",(b=e.knowledgebaseIndex)!=null&&b.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((v=e.tracingExporters)!=null&&v.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled||Object.keys(((x=e.deployment)==null?void 0:x.envValues)??{}).length>0){const T={feishuEnabled:!!((E=e.deployment)!=null&&E.feishuEnabled)};Object.keys(((w=e.deployment)==null?void 0:w.envValues)??{}).length>0&&(T.envValues={...(_=e.deployment)==null?void 0:_.envValues}),t.deployment=T}return(S=e.selectedSkills)!=null&&S.length&&(t.selectedSkills=e.selectedSkills.map(T=>{const C={source:T.source,name:T.name,folder:T.folder};return T.description&&(C.description=T.description),T.source==="skillhub"?(C.slug=T.slug,C.namespace=T.namespace??"public"):T.source==="local"?C.localFiles=T.localFiles??[]:(C.skillSpaceId=T.skillSpaceId,C.skillSpaceName=T.skillSpaceName,C.skillId=T.skillId,T.version&&(C.version=T.version)),C})),(k=e.subAgents)!=null&&k.length&&(t.subAgents=e.subAgents.map(iz)),t}function Vke(e){var i;const t=Y1(e),n={...((i=t.draft.deployment)==null?void 0:i.envValues)??{},...t.envValues},s={...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}};return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+Lke(iz(s))}function Gke(e){const t=Mke(e);return p2(t)}const Kke=[{kind:"custom",icon:Nee,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:oee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:see,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Tee,title:"工作流",desc:"敬请期待",disabled:!0}];function qke({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=Kke.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(Gke(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(aH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(See,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Yke="modulepreload",Wke=function(e){return"/"+e},N3={},Qc=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=Wke(c),c in N3)return;N3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Yke,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function W1(e,t){return t[e.key]??e.defaultValue??""}function rz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Xke(e,t){return rz([{env:e}]).specs.map(s=>({...s,value:W1(s,t)}))}function az(e,t){const n=new Map;for(const s of e){const i=W1(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function T3(e,t){return e.find(n=>n.required&&!W1(n,t).trim())}function g2(e,t){if(e.format!=="json")return;const n=W1(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function oz(e,t){for(const n of e){const s=g2(n,t);if(s)return{spec:n,error:s}}}function Qke(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function Zke(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}const k3=new Set;let gx={enabled:!1},Zn,Rf=null,A3=null,Dd="",mN="unknown",lz="unknown",Hm=[];function Jke(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function eAe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,Jke(n)]))}function tAe(e){return{}}function nAe(){return new Date().toISOString().slice(0,10)}function sAe(e){if(!e)return!0;if(e.dedupeKey){if(k3.has(e.dedupeKey))return!1;k3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${nAe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function cz(e){if(Rf){try{Rf("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Hm=[...Hm.slice(-49),e]}function iAe(){if(!Rf)return;const e=Hm;Hm=[];for(const t of e)cz(t)}function rAe(e){if(gx=e,Zn=e.studio,!e.enabled||!e.apmplus||A3)return;const t=e.apmplus;A3=Qc(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Dd||void 0}),s("start"),Rf=s,iAe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),gx={enabled:!1},Hm=[]})}function ch(e,t={},n,s){if(!gx.enabled||!gx.apmplus||!sAe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Dd,user_role:mN,user_source:lz}:{};cz({name:e,categories:eAe({studio_deploy_id:Zn==null?void 0:Zn.deployId,user_pool_id:Zn==null?void 0:Zn.userPoolId,vefaas_application_id:Zn==null?void 0:Zn.applicationId,vefaas_function_id:Zn==null?void 0:Zn.functionId,studio_region:Zn==null?void 0:Zn.region,studio_project:Zn==null?void 0:Zn.project,studio_version:Zn==null?void 0:Zn.version,...i,...t}),metrics:tAe()})}function aAe(e){if(Dd=e.userId.trim(),!!Dd){if(mN=e.role??"unknown",lz=e.local?"local":"sso",Rf)try{Rf("config",{userId:Dd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}ch("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(Zn==null?void 0:Zn.deployId)??"",Dd,mN].join(":")})}}function uz(e){return{deploy_source:e.source,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function oAe(e){ch("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function lAe(e){ch("studio_agent_deploy_succeeded",{...uz(e),runtime_id:e.runtimeId})}function cAe(e){ch("studio_agent_deploy_failed",{...uz(e),failed_phase:e.phase,error_kind:Zke(e.error,e.phase)})}function uAe(e){ch("studio_sandbox_create_succeeded",{sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function dAe(e){ch("studio_sandbox_create_failed",{sandbox_kind:e.kind,sandbox_source:e.source,error_kind:Qke(e.error)})}const fAe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function hAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function vs(e,t){e.push(t&255,t>>>8&255)}function fr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const C3=2048,Tw=20,I3=0;function pAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=hAe(b),y=b.length,x=[];fr(x,67324752),vs(x,Tw),vs(x,C3),vs(x,I3),vs(x,0),vs(x,0),fr(x,v),fr(x,y),fr(x,y),vs(x,m.length),vs(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];fr(m,33639248),vs(m,Tw),vs(m,Tw),vs(m,C3),vs(m,I3),vs(m,0),vs(m,0),fr(m,p.crc),fr(m,p.size),fr(m,p.size),vs(m,p.nameBytes.length),vs(m,0),vs(m,0),vs(m,0),vs(m,0),fr(m,0),fr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];fr(c,101010256),vs(c,0),vs(c,0),vs(c,s.length),vs(c,s.length),fr(c,l),fr(c,r),vs(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const mAe=g.lazy(()=>Qc(()=>import("./CodeEditor-BoKmmyZA.js"),[]));function gAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function bAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function dz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>gAe(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return bAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(dR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const _=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!_,children:[o.jsx(Ql,{className:_?"":"is-open","aria-hidden":"true"}),o.jsx(lB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!_&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return mi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(xk,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(ki,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(dR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(mAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function yAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(xk,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(dz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function bx({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(fn,{className:"spin"}):o.jsx(yee,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(cee,{}):o.jsx(Gc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(Ia,{}):o.jsx(Xx,{})})]})]})}const xAe=5e4;function EAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` +`+Lke(iz(s))}function Gke(e){const t=Mke(e);return p2(t)}const Kke=[{kind:"custom",icon:Nee,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:oee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:see,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Tee,title:"工作流",desc:"敬请期待",disabled:!0}];function qke({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=Kke.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(Gke(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(aH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(See,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Yke="modulepreload",Wke=function(e){return"/"+e},N3={},Qc=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=Wke(c),c in N3)return;N3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Yke,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function W1(e,t){return t[e.key]??e.defaultValue??""}function rz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Xke(e,t){return rz([{env:e}]).specs.map(s=>({...s,value:W1(s,t)}))}function az(e,t){const n=new Map;for(const s of e){const i=W1(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function T3(e,t){return e.find(n=>n.required&&!W1(n,t).trim())}function g2(e,t){if(e.format!=="json")return;const n=W1(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function oz(e,t){for(const n of e){const s=g2(n,t);if(s)return{spec:n,error:s}}}function Qke(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function Zke(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}const k3=new Set;let gx={enabled:!1},Zn,Rf=null,A3=null,Dd="",mN="unknown",lz="unknown",Hm=[];function Jke(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function eAe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,Jke(n)]))}function tAe(e){return{}}function nAe(){return new Date().toISOString().slice(0,10)}function sAe(e){if(!e)return!0;if(e.dedupeKey){if(k3.has(e.dedupeKey))return!1;k3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${nAe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function cz(e){if(Rf){try{Rf("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Hm=[...Hm.slice(-49),e]}function iAe(){if(!Rf)return;const e=Hm;Hm=[];for(const t of e)cz(t)}function rAe(e){if(gx=e,Zn=e.studio,!e.enabled||!e.apmplus||A3)return;const t=e.apmplus;A3=Qc(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Dd||void 0}),s("start"),Rf=s,iAe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),gx={enabled:!1},Hm=[]})}function ch(e,t={},n,s){if(!gx.enabled||!gx.apmplus||!sAe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Dd,user_role:mN,user_source:lz}:{};cz({name:e,categories:eAe({studio_deploy_id:Zn==null?void 0:Zn.deployId,user_pool_id:Zn==null?void 0:Zn.userPoolId,vefaas_application_id:Zn==null?void 0:Zn.applicationId,vefaas_function_id:Zn==null?void 0:Zn.functionId,studio_region:Zn==null?void 0:Zn.region,studio_project:Zn==null?void 0:Zn.project,studio_version:Zn==null?void 0:Zn.version,...i,...t}),metrics:tAe()})}function aAe(e){if(Dd=e.userId.trim(),!!Dd){if(mN=e.role??"unknown",lz=e.local?"local":"sso",Rf)try{Rf("config",{userId:Dd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}ch("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(Zn==null?void 0:Zn.deployId)??"",Dd,mN].join(":")})}}function uz(e){return{deploy_source:e.source,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function oAe(e){ch("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function lAe(e){ch("studio_agent_deploy_succeeded",{...uz(e),runtime_id:e.runtimeId})}function cAe(e){ch("studio_agent_deploy_failed",{...uz(e),failed_phase:e.phase,error_kind:Zke(e.error,e.phase)})}function uAe(e){ch("studio_sandbox_create_succeeded",{sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function dAe(e){ch("studio_sandbox_create_failed",{sandbox_kind:e.kind,sandbox_source:e.source,error_kind:Qke(e.error)})}const fAe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function hAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function vs(e,t){e.push(t&255,t>>>8&255)}function fr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const C3=2048,Tw=20,I3=0;function pAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=hAe(b),y=b.length,x=[];fr(x,67324752),vs(x,Tw),vs(x,C3),vs(x,I3),vs(x,0),vs(x,0),fr(x,v),fr(x,y),fr(x,y),vs(x,m.length),vs(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];fr(m,33639248),vs(m,Tw),vs(m,Tw),vs(m,C3),vs(m,I3),vs(m,0),vs(m,0),fr(m,p.crc),fr(m,p.size),fr(m,p.size),vs(m,p.nameBytes.length),vs(m,0),vs(m,0),vs(m,0),vs(m,0),fr(m,0),fr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];fr(c,101010256),vs(c,0),vs(c,0),vs(c,s.length),vs(c,s.length),fr(c,l),fr(c,r),vs(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const mAe=g.lazy(()=>Qc(()=>import("./CodeEditor-Cv1wH8op.js"),[]));function gAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function bAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function dz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>gAe(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return bAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(dR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const _=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!_,children:[o.jsx(Ql,{className:_?"":"is-open","aria-hidden":"true"}),o.jsx(lB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!_&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return mi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(xk,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(ki,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(dR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(mAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function yAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(xk,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(dz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function bx({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(fn,{className:"spin"}):o.jsx(yee,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(cee,{}):o.jsx(Gc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(Ia,{}):o.jsx(Xx,{})})]})]})}const xAe=5e4;function EAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` `),s=t.split(` `),i=Math.min(n.length,s.length,260);for(let r=i;r>0;r-=1){const a=n.slice(-r).join(` `),l=s.slice(0,r).join(` @@ -1076,12 +1076,12 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus ${c}`:e}}return`${e} ${t}`}function vAe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const s=n.indexOf(` `);return s>=0&&(n=n.slice(s+1)),{text:n,omitted:!0}}function j3(e,t,n=xAe){const s=EAe((e==null?void 0:e.text)??"",t.text??""),i=vAe(s,n),r=i.text?i.text.split(` -`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}or.registerLanguage("python",fF);or.registerLanguage("typescript",_F);or.registerLanguage("javascript",aF);or.registerLanguage("json",oF);or.registerLanguage("yaml",NF);or.registerLanguage("markdown",dF);or.registerLanguage("bash",eF);or.registerLanguage("ini",tF);or.registerLanguage("dockerfile",mye);or.registerLanguage("makefile",uF);const wAe=g.lazy(()=>Qc(()=>import("./CodeEditor-BoKmmyZA.js"),[])),fl=()=>{};function SAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?mi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(wee,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(ki,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function fz({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(_=>_.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(aB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:_=>{u.current[E]=_},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(Ia,{"aria-hidden":"true"})]},x.value)})})]})}function _Ae({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),VB(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(fz,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(fn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const NAe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],TAe={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},R3={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function O3(e){return e.replace(/&/g,"&").replace(//g,">")}function kAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(R3[n])return R3[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return TAe[i]??null}function AAe(e,t){try{const n=kAe(t);return n&&or.getLanguage(n)?or.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?or.highlightAuto(e).value:O3(e)}catch{return O3(e)}}const CAe=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],IAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],jAe={phase:"update",label:"更新实例配置"},RAe={phase:"evaluation",label:"创建评测集"};function OAe(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function MAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function LAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function DAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function PAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function BAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[mi.createPortal(e,n.left),mi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function X1({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:_,onNetworkChange:S,deployRegion:k="cn-beijing",onDeployRegionChange:T,deploymentTelemetrySource:C="unknown",onBack:I,backLabel:j="返回配置",onExportYaml:O,deploymentPrimaryPane:z,deployDisabled:D=!1}){var Un,Fn,gn;const F=typeof l=="function",A=f.includes("更新"),M=OAe(s),[P,$]=g.useState(((Fn=(Un=e==null?void 0:e.files)==null?void 0:Un[0])==null?void 0:Fn.path)??null),[R,Y]=g.useState(new Set),[J,U]=g.useState(!1),[te,K]=g.useState(""),[V,W]=g.useState(!1),[q,ue]=g.useState(!1),[me,_e]=g.useState(!1),[de,ge]=g.useState(!1),[Me,ve]=g.useState(null),[ae,ke]=g.useState(null),[Se,Ze]=g.useState({}),[Le,Ve]=g.useState(null),[Ne,Fe]=g.useState(!1),[De,qe]=g.useState([]),[Q,oe]=g.useState(!1),ne=g.useId(),[be,Ue]=g.useState("api_key"),[Ke,xt]=g.useState(""),[ct,on]=g.useState("1"),[Mt,Nt]=g.useState(M?"1":"5"),[Pt,Ge]=g.useState(!0),[Vt,it]=g.useState(null),at=g.useRef(!0),We=MAe(ct,Mt),St=!A&&We.valid&&(We.min!==1||We.max!==5),xe=z?IAe:CAe,Xe=St?[...xe,jAe]:xe,Et=Pt?[...Xe,RAe]:Xe;g.useEffect(()=>{if(!h){it(null);return}it(document.getElementById(h))},[h]);const nn=le=>o.jsxs("div",{className:"pp-network-region",onKeyDown:Ie=>{Ie.key==="Escape"&&oe(!1)},children:[le&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":Q,"aria-describedby":A?ne:void 0,disabled:V||A||!T,onClick:()=>oe(Ie=>!Ie),children:[o.jsx("span",{children:k==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(aB,{className:`pp-region-chevron${Q?" is-open":""}`})]}),Q&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>oe(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(Ie=>{const pe=Ie.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":pe,className:`pp-region-option${pe?" is-selected":""}`,onClick:()=>{T==null||T(Ie.value),oe(!1)},children:[o.jsx("span",{children:Ie.label}),pe&&o.jsx(Ia,{"aria-hidden":"true"})]},Ie.value)})})]}),A&&o.jsx("span",{id:ne,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(at.current=!0,()=>{at.current=!1}),[]),g.useEffect(()=>{on("1"),Nt(M?"1":"5")},[M]),g.useEffect(()=>{if(!me)return;const le=document.body.style.overflow;document.body.style.overflow="hidden";const Ie=pe=>{pe.key==="Escape"&&_e(!1)};return window.addEventListener("keydown",Ie),()=>{document.body.style.overflow=le,window.removeEventListener("keydown",Ie)}},[me]);const Bn=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:LAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const ot=e.files.find(le=>le.path===P)??null,mt=(_==null?void 0:_.mode)??"public",hn=()=>({source:C,action:p?"update":"create",region:k,networkType:mt,feishuEnabled:v}),Xt=Xke(v?[...x,...$h]:x,E),Tt=Xt.length+De.length;function sn(le){Y(Ie=>{const pe=new Set(Ie);return pe.has(le)?pe.delete(le):pe.add(le),pe})}function rs(le,Ie){l&&(l({...e,files:le}),Ie!==void 0&&$(Ie))}function As(le){ot&&rs(e.files.map(Ie=>Ie.path===ot.path?{...Ie,content:le}:Ie))}function kn(){const le=te.trim();if(U(!1),K(""),!!le){if(e.files.some(Ie=>Ie.path===le)){$(le);return}rs([...e.files,{path:le,content:""}],le)}}function Gn(){if(!ot)return;const le=window.prompt("重命名文件",ot.path),Ie=le==null?void 0:le.trim();!Ie||Ie===ot.path||e.files.some(pe=>pe.path===Ie)||rs(e.files.map(pe=>pe.path===ot.path?{...pe,path:Ie}:pe),Ie)}function pn(){var Ie;if(!ot)return;const le=e.files.filter(pe=>pe.path!==ot.path);rs(le,((Ie=le[0])==null?void 0:Ie.path)??null)}function mn(le,Ie){qe(pe=>pe.map(et=>et.id===le?{...et,...Ie}:et))}function Kn(le){qe(Ie=>Ie.filter(pe=>pe.id!==le))}function $s(){qe(le=>[...le,PAe()])}function gi(le){S&&S(le==="public"?void 0:{..._??{mode:le},mode:le})}function bs(le){S==null||S({..._??{mode:"private"},...le})}function Qs(){const le=new Map(De.map(pe=>({key:pe.key.trim(),value:pe.value})).filter(pe=>pe.key.length>0).map(pe=>[pe.key,pe.value])),Ie=v?[...x,...$h]:x;for(const pe of az(Ie,E))le.set(pe.key,pe.value);return[...le].map(([pe,et])=>({key:pe,value:et}))}async function An(){if(!(!y||V||de)){ve(null),ge(!0);try{await y(!v)}catch(le){at.current&&ve(`更新飞书配置失败:${le instanceof Error?le.message:String(le)}`)}finally{at.current&&ge(!1)}}}async function as(){var pe;if(!c||V||D)return;if(!We.valid){ve(We.error);return}if(!A&&be==="user_pool"&&!Ke){ve("请选择用于 Runtime 鉴权的用户池。");return}if(mt!=="public"&&!((pe=_==null?void 0:_.vpcId)!=null&&pe.trim())){ve("使用 VPC 网络时,请填写 VPC ID。");return}const le=T3(x,E);if(le){const et=x.find(nt=>nt.key===le.key);ve(`请返回配置页填写 ${(et==null?void 0:et.comment)||(et==null?void 0:et.key)}(${et==null?void 0:et.key})。`);return}const Ie=oz(x,E);if(Ie){ve(`${Ie.spec.comment||Ie.spec.key}:${Ie.error}`);return}if(v){const et=T3($h,E);if(et){const nt=$h.find(ut=>ut.key===et.key);ve(`启用飞书后,请填写${(nt==null?void 0:nt.comment)||(nt==null?void 0:nt.key)}。`);return}}ue(!0)}async function qn(){var cs;if(!c||V)return;if(!We.valid){ue(!1),ve(We.error);return}ue(!1);const le=Qs();at.current&&(ve(null),ke(null),Ze({}),Ve(null),W(!0));const Ie=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let pe=(i==null?void 0:i.trim())||e.name||"生成中…";const et=Date.now(),nt={id:Ie,runtimeName:pe,runtimeId:p,region:k,startedAt:et,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:St?{min:We.min,max:We.max}:void 0,createEvaluationSets:Pt};b==null||b(nt),m==null||m(nt);let ut,_t=nt.phase??"prepare";const In=Bt=>ut?{...ut,status:Bt,updatedAt:Date.now()}:void 0,bn=Bt=>{const kt=In(Bt);return kt?{buildLog:kt}:{}},ls=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),js=Bt=>{if(_t!=="build")return;const kt=["","----- 构建失败 -----",Bt].join(` +`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}or.registerLanguage("python",fF);or.registerLanguage("typescript",_F);or.registerLanguage("javascript",aF);or.registerLanguage("json",oF);or.registerLanguage("yaml",NF);or.registerLanguage("markdown",dF);or.registerLanguage("bash",eF);or.registerLanguage("ini",tF);or.registerLanguage("dockerfile",mye);or.registerLanguage("makefile",uF);const wAe=g.lazy(()=>Qc(()=>import("./CodeEditor-Cv1wH8op.js"),[])),fl=()=>{};function SAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?mi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(wee,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(ki,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function fz({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(_=>_.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(aB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:_=>{u.current[E]=_},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(Ia,{"aria-hidden":"true"})]},x.value)})})]})}function _Ae({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),VB(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(fz,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(fn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const NAe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],TAe={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},R3={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function O3(e){return e.replace(/&/g,"&").replace(//g,">")}function kAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(R3[n])return R3[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return TAe[i]??null}function AAe(e,t){try{const n=kAe(t);return n&&or.getLanguage(n)?or.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?or.highlightAuto(e).value:O3(e)}catch{return O3(e)}}const CAe=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],IAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],jAe={phase:"update",label:"更新实例配置"},RAe={phase:"evaluation",label:"创建评测集"};function OAe(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function MAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function LAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function DAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function PAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function BAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[mi.createPortal(e,n.left),mi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function X1({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:_,onNetworkChange:S,deployRegion:k="cn-beijing",onDeployRegionChange:T,deploymentTelemetrySource:C="unknown",onBack:I,backLabel:j="返回配置",onExportYaml:O,deploymentPrimaryPane:z,deployDisabled:D=!1}){var Un,Fn,gn;const F=typeof l=="function",A=f.includes("更新"),M=OAe(s),[P,$]=g.useState(((Fn=(Un=e==null?void 0:e.files)==null?void 0:Un[0])==null?void 0:Fn.path)??null),[R,Y]=g.useState(new Set),[J,U]=g.useState(!1),[te,K]=g.useState(""),[V,W]=g.useState(!1),[q,ue]=g.useState(!1),[me,_e]=g.useState(!1),[de,ge]=g.useState(!1),[Me,ve]=g.useState(null),[ae,ke]=g.useState(null),[Se,Ze]=g.useState({}),[Le,Ve]=g.useState(null),[Ne,Fe]=g.useState(!1),[De,qe]=g.useState([]),[Q,oe]=g.useState(!1),ne=g.useId(),[be,Ue]=g.useState("api_key"),[Ke,xt]=g.useState(""),[ct,on]=g.useState("1"),[Mt,Nt]=g.useState(M?"1":"5"),[Pt,Ge]=g.useState(!0),[Vt,it]=g.useState(null),at=g.useRef(!0),We=MAe(ct,Mt),St=!A&&We.valid&&(We.min!==1||We.max!==5),xe=z?IAe:CAe,Xe=St?[...xe,jAe]:xe,Et=Pt?[...Xe,RAe]:Xe;g.useEffect(()=>{if(!h){it(null);return}it(document.getElementById(h))},[h]);const nn=le=>o.jsxs("div",{className:"pp-network-region",onKeyDown:Ie=>{Ie.key==="Escape"&&oe(!1)},children:[le&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":Q,"aria-describedby":A?ne:void 0,disabled:V||A||!T,onClick:()=>oe(Ie=>!Ie),children:[o.jsx("span",{children:k==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(aB,{className:`pp-region-chevron${Q?" is-open":""}`})]}),Q&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>oe(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(Ie=>{const pe=Ie.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":pe,className:`pp-region-option${pe?" is-selected":""}`,onClick:()=>{T==null||T(Ie.value),oe(!1)},children:[o.jsx("span",{children:Ie.label}),pe&&o.jsx(Ia,{"aria-hidden":"true"})]},Ie.value)})})]}),A&&o.jsx("span",{id:ne,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(at.current=!0,()=>{at.current=!1}),[]),g.useEffect(()=>{on("1"),Nt(M?"1":"5")},[M]),g.useEffect(()=>{if(!me)return;const le=document.body.style.overflow;document.body.style.overflow="hidden";const Ie=pe=>{pe.key==="Escape"&&_e(!1)};return window.addEventListener("keydown",Ie),()=>{document.body.style.overflow=le,window.removeEventListener("keydown",Ie)}},[me]);const Bn=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:LAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const ot=e.files.find(le=>le.path===P)??null,mt=(_==null?void 0:_.mode)??"public",hn=()=>({source:C,action:p?"update":"create",region:k,networkType:mt,feishuEnabled:v}),Xt=Xke(v?[...x,...$h]:x,E),Tt=Xt.length+De.length;function sn(le){Y(Ie=>{const pe=new Set(Ie);return pe.has(le)?pe.delete(le):pe.add(le),pe})}function rs(le,Ie){l&&(l({...e,files:le}),Ie!==void 0&&$(Ie))}function As(le){ot&&rs(e.files.map(Ie=>Ie.path===ot.path?{...Ie,content:le}:Ie))}function kn(){const le=te.trim();if(U(!1),K(""),!!le){if(e.files.some(Ie=>Ie.path===le)){$(le);return}rs([...e.files,{path:le,content:""}],le)}}function Gn(){if(!ot)return;const le=window.prompt("重命名文件",ot.path),Ie=le==null?void 0:le.trim();!Ie||Ie===ot.path||e.files.some(pe=>pe.path===Ie)||rs(e.files.map(pe=>pe.path===ot.path?{...pe,path:Ie}:pe),Ie)}function pn(){var Ie;if(!ot)return;const le=e.files.filter(pe=>pe.path!==ot.path);rs(le,((Ie=le[0])==null?void 0:Ie.path)??null)}function mn(le,Ie){qe(pe=>pe.map(et=>et.id===le?{...et,...Ie}:et))}function Kn(le){qe(Ie=>Ie.filter(pe=>pe.id!==le))}function $s(){qe(le=>[...le,PAe()])}function gi(le){S&&S(le==="public"?void 0:{..._??{mode:le},mode:le})}function bs(le){S==null||S({..._??{mode:"private"},...le})}function Qs(){const le=new Map(De.map(pe=>({key:pe.key.trim(),value:pe.value})).filter(pe=>pe.key.length>0).map(pe=>[pe.key,pe.value])),Ie=v?[...x,...$h]:x;for(const pe of az(Ie,E))le.set(pe.key,pe.value);return[...le].map(([pe,et])=>({key:pe,value:et}))}async function An(){if(!(!y||V||de)){ve(null),ge(!0);try{await y(!v)}catch(le){at.current&&ve(`更新飞书配置失败:${le instanceof Error?le.message:String(le)}`)}finally{at.current&&ge(!1)}}}async function as(){var pe;if(!c||V||D)return;if(!We.valid){ve(We.error);return}if(!A&&be==="user_pool"&&!Ke){ve("请选择用于 Runtime 鉴权的用户池。");return}if(mt!=="public"&&!((pe=_==null?void 0:_.vpcId)!=null&&pe.trim())){ve("使用 VPC 网络时,请填写 VPC ID。");return}const le=T3(x,E);if(le){const et=x.find(nt=>nt.key===le.key);ve(`请返回配置页填写 ${(et==null?void 0:et.comment)||(et==null?void 0:et.key)}(${et==null?void 0:et.key})。`);return}const Ie=oz(x,E);if(Ie){ve(`${Ie.spec.comment||Ie.spec.key}:${Ie.error}`);return}if(v){const et=T3($h,E);if(et){const nt=$h.find(ut=>ut.key===et.key);ve(`启用飞书后,请填写${(nt==null?void 0:nt.comment)||(nt==null?void 0:nt.key)}。`);return}}ue(!0)}async function qn(){var cs;if(!c||V)return;if(!We.valid){ue(!1),ve(We.error);return}ue(!1);const le=Qs();at.current&&(ve(null),ke(null),Ze({}),Ve(null),W(!0));const Ie=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let pe=(i==null?void 0:i.trim())||e.name||"生成中…";const et=Date.now(),nt={id:Ie,runtimeName:pe,runtimeId:p,region:k,startedAt:et,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:St?{min:We.min,max:We.max}:void 0,createEvaluationSets:Pt};b==null||b(nt),m==null||m(nt);let ut,_t=nt.phase??"prepare";const In=Bt=>ut?{...ut,status:Bt,updatedAt:Date.now()}:void 0,bn=Bt=>{const kt=In(Bt);return kt?{buildLog:kt}:{}},ls=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),js=Bt=>{if(_t!=="build")return;const kt=["","----- 构建失败 -----",Bt].join(` `);return ut=j3(ut,{source:"code-pipeline",status:"error",text:kt,lineCount:kt.split(` `).length,truncated:!1,updatedAt:Date.now()}),ut};try{const Bt=await c(e,kt=>{var Yn;kt.runtimeName&&(pe=kt.runtimeName),_t=kt.phase,kt.buildLog?ut=j3(ut,kt.buildLog):kt.phase==="build"&&!ut&&(ut=ls()),at.current&&(Ze(Rs=>({...Rs,[kt.phase]:kt})),Ve(kt.phase)),b==null||b({id:Ie,runtimeName:pe,runtimeId:p,region:k,startedAt:et,status:"running",phase:kt.phase,label:((Yn=Et.find(Rs=>Rs.phase===kt.phase))==null?void 0:Yn.label)??kt.phase,message:kt.message,pct:kt.pct,...ut?{buildLog:ut}:{}})},{taskId:Ie,sessionStorage:M?"in-memory":"persistent",minInstance:We.min,maxInstance:We.max,...A?{}:{authentication:be==="user_pool"?{type:"user_pool",userPoolUid:Ke}:{type:"api_key"}},createEvaluationSets:Pt,...v?{im:{feishu:{enabled:!0}}}:{},envs:le});at.current&&(ke(Bt),Ve(null)),lAe({...hn(),runtimeId:Bt.runtimeId||p||""}),b==null||b({id:Ie,runtimeName:Bt.agentName||pe,runtimeId:Bt.runtimeId||p,region:Bt.region||k,startedAt:et,status:"success",phase:"complete",label:"部署完成",message:(cs=Bt.warnings)==null?void 0:cs.join(";"),...bn("complete")});try{await(d==null?void 0:d(Bt))}catch(kt){if(!(kt instanceof Er))throw kt;b==null||b({id:Ie,runtimeName:Bt.agentName||pe,runtimeId:Bt.runtimeId||p,region:Bt.region||k,startedAt:et,status:"success",phase:"complete",label:"部署完成,暂未连接",message:kt.message,...bn("complete")})}}catch(Bt){const kt=Bt instanceof Error?Bt.message:String(Bt);if(Bt instanceof DOMException&&Bt.name==="AbortError"){at.current&&(ve(null),Ve(null)),b==null||b({id:Ie,runtimeName:pe,runtimeId:p,region:k,startedAt:et,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...bn("complete")});return}at.current&&ve(kt);const Yn=js(kt),Rs=!!Yn;cAe({...hn(),phase:_t,error:Bt}),b==null||b({id:Ie,runtimeName:pe,runtimeId:p,region:k,startedAt:et,status:"error",phase:_t,label:"部署失败",message:Rs?"构建镜像失败,详见构建日志。":kt,...Yn?{buildLog:Yn}:bn("complete"),retry:as})}finally{at.current&&W(!1)}}function os(){ue(!1)}async function Cs(){if(!(!ae||Ne)){Fe(!0),ve(null);try{const{addConnection:le,addRuntimeConnection:Ie,remoteAppId:pe,loadConnections:et}=await Qc(async()=>{const{addConnection:_t,addRuntimeConnection:In,remoteAppId:bn,loadConnections:ls}=await Promise.resolve().then(()=>PL);return{addConnection:_t,addRuntimeConnection:In,remoteAppId:bn,loadConnections:ls}},void 0),{probeRuntimeApps:nt}=await Qc(async()=>{const{probeRuntimeApps:_t}=await Promise.resolve().then(()=>ate);return{probeRuntimeApps:_t}},void 0);let ut;if(ae.runtimeId){const _t=ae.region??k,In=await nt(ae.runtimeId,_t,{retryProbe:!0})??[];ut=Ie(ae.runtimeId,ae.agentName,_t,In,In.length>0?{[In[0]]:ae.agentName}:void 0,ae.version)}else ut=await le(ae.agentName,ae.url,ae.apikey,"");if(ut.apps.length===0)ve("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const _t={[ut.apps[0]]:ae.agentName},In={...ut,appLabels:{...ut.appLabels??{},..._t}},ls=et().map(cs=>cs.id===ut.id?In:cs);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(ls));const{registerConnections:js}=await Qc(async()=>{const{registerConnections:cs}=await Promise.resolve().then(()=>PL);return{registerConnections:cs}},void 0);if(js(ls),u){const cs=pe(ut.id,ut.apps[0]);u(cs,ae.agentName)}else alert(`🎉 Agent "${ae.agentName}" 已添加到左上角下拉列表!`)}}catch(le){ve(`添加 Agent 失败:${le instanceof Error?le.message:String(le)}`)}finally{Fe(!1)}}}function Is(){const le=pAe(e.files),Ie=URL.createObjectURL(le),pe=document.createElement("a");pe.href=Ie,pe.download=`${e.name||"project"}.zip`,document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),URL.revokeObjectURL(Ie)}const un=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[O&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:O,children:[o.jsx(KJ,{className:"pp-ic"}),"导出 YAML"]}),F&&l&&o.jsx(yAe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:Is,children:[o.jsx(Qx,{className:"pp-ic"}),"下载源代码"]})]});function Cn(le,Ie,pe){return DAe(le).map(et=>{const nt=pe?`${pe}/${et.name}`:et.name,ut=et.path!==void 0,_t={paddingLeft:8+Ie*14};if(ut){const bn=et.path===P;return o.jsxs("button",{type:"button",className:`pp-row pp-file${bn?" pp-active":""}`,style:_t,onClick:()=>$(et.path),title:et.path,children:[o.jsx(WJ,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:et.name})]},nt)}const In=R.has(nt);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:_t,onClick:()=>sn(nt),children:[o.jsx(Ql,{className:`pp-ic pp-chevron${In?"":" pp-open"}`}),o.jsx(lB,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:et.name})]}),!In&&Cn(et,Ie+1,nt)]},nt)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${z?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(BAe,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[I&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:I,children:[o.jsx(bk,{className:"pp-ic"}),j]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",i||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!z&&o.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:o.jsxs("div",{className:`pp-release-preview${t?" is-embedded":""}`,children:[o.jsxs("div",{className:"pp-flow-thumbnail",children:[s&&o.jsx(Rm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:fl,onAdd:fl,onInsert:fl,onDelete:fl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>_e(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(Gc,{"aria-hidden":!0})})]}),t&&un,!t&&o.jsxs("div",{className:"pp-release-info",children:[o.jsx("div",{className:"pp-release-card-head",children:"Agent 概览"}),o.jsxs("div",{className:"pp-release-info-body",children:[o.jsxs("div",{className:"pp-release-info-main",children:[o.jsx("h2",{children:i||e.name||"未命名 Agent"}),(s==null?void 0:s.description)&&o.jsx("p",{className:"pp-release-description",title:s.description,children:s.description}),o.jsxs("dl",{className:"pp-release-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent 数量"}),o.jsx("dd",{children:r??1})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:a.modelName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"描述"}),o.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"系统提示词"}),o.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化选项"}),o.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),un]})]})]})}),o.jsxs("div",{className:"pp-files-area",children:[o.jsxs("div",{className:"pp-sidebar",children:[o.jsxs("div",{className:"pp-sidebar-head",children:[o.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),F&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{U(!0),K("")},children:o.jsx(qJ,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[J&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:te,onChange:le=>K(le.target.value),onBlur:kn,onKeyDown:le=>{le.key==="Enter"&&kn(),le.key==="Escape"&&(U(!1),K(""))}}),e.files.length===0&&!J?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):Cn(Bn,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:ot==null?void 0:ot.path,children:(ot==null?void 0:ot.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:F&&ot&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:Gn,children:o.jsx(pee,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:pn,children:o.jsx(Zl,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:ot==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):F?o.jsx("div",{className:"pp-codemirror",children:o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(wAe,{value:ot.content,path:ot.path,onChange:As})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:AAe(ot.content,ot.path)}})})]})]}),c&&o.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[o.jsx("div",{className:"pp-config-head",children:o.jsx("div",{className:"pp-config-title",children:"部署配置"})}),o.jsxs("div",{className:"pp-config-scroll",children:[z,!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),nn(!1)]}),!z&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),A?o.jsx("p",{className:"pp-config-note pp-auth-preserved-note",children:"更新时保持现有 Runtime 的鉴权方式不变。"}):o.jsxs("div",{className:"pp-auth-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"鉴权方式"}),o.jsx(fz,{ariaLabel:"部署鉴权方式",value:be,placeholder:"请选择鉴权方式",options:NAe,disabled:V,onChange:le=>{ve(null),Ue(le)}})]}),be==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(_Ae,{value:Ke,disabled:V,onChange:le=>{ve(null),xt(le)}})]})]})]}),!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"消息渠道"}),o.jsx("div",{className:`pp-channel-card${v?" is-flipped":""}`,children:o.jsxs("div",{className:"pp-channel-card-inner",children:[o.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":v,"aria-hidden":v,tabIndex:v?-1:0,onClick:()=>void An(),disabled:v||V||de||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:KA,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:de?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),o.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!v,children:[o.jsxs("div",{className:"pp-channel-card-head",children:[o.jsx("strong",{children:"飞书配置"}),o.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:v?0:-1,onClick:()=>void An(),disabled:!v||V||de||!y,children:de?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:$h.map(le=>o.jsxs("label",{children:[o.jsxs("span",{children:[le.comment||le.key,le.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:le.key.includes("SECRET")?"password":"text",value:E[le.key]??"",placeholder:le.placeholder,tabIndex:v?0:-1,disabled:!v||V||!w,autoComplete:"off",onChange:Ie=>w==null?void 0:w(le.key,Ie.currentTarget.value)})]},le.key))})]})]})})]}),!A&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"实例设置"}),o.jsxs("div",{className:"pp-instance-fields",children:[o.jsxs("label",{htmlFor:"runtime-min-instance",children:[o.jsx("span",{children:"最小实例数"}),o.jsx("input",{id:"runtime-min-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:ct,disabled:V,"aria-invalid":!We.valid,onChange:le=>on(le.currentTarget.value)})]}),o.jsxs("label",{htmlFor:"runtime-max-instance",children:[o.jsx("span",{children:"最大实例数"}),o.jsx("input",{id:"runtime-max-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:Mt,disabled:V,"aria-invalid":!We.valid,onChange:le=>Nt(le.currentTarget.value)})]})]}),M&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!We.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:We.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),z&&nn(!0),A&&o.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),o.jsxs("div",{className:"pp-network-layout",children:[o.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(le=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:le,checked:mt===le,onChange:()=>gi(le),disabled:V||A||!S}),o.jsx("span",{children:le==="public"?"公网":le==="private"?"VPC":"公网 + VPC"})]},le))}),mt!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:V||A,onChange:le=>bs({vpcId:le.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:V||A,onChange:le=>bs({subnetIds:le.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:V||A,onChange:le=>bs({enableSharedInternetAccess:le.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"评测集"}),o.jsxs("label",{className:"pp-evaluation-set-option",children:[o.jsx("input",{type:"checkbox",checked:Pt,disabled:V,onChange:le=>Ge(le.currentTarget.checked)}),o.jsxs("span",{children:[o.jsx("strong",{children:"自动创建评测集"}),o.jsx("small",{children:"部署成功后,自动创建 Good Case 和 Bad Case 评测集。"})]})]})]}),o.jsxs("section",{className:"pp-config-section pp-env-section",children:[o.jsx("div",{className:"pp-env-head",children:o.jsxs("div",{children:[o.jsxs("div",{className:"pp-config-label",children:["环境变量",o.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[Tt," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]})}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:$s,disabled:V,children:[o.jsx(Ni,{className:"pp-ic"}),"添加变量"]}),(Xt.length>0||De.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[Xt.length>0&&o.jsxs("div",{className:"pp-env-group",children:[o.jsxs("div",{className:"pp-env-group-head",children:[o.jsx("span",{children:"组件自动生成"}),o.jsxs("small",{children:[Xt.length," 项"]})]}),Xt.map(le=>{const Ie=le.key.startsWith("ENABLE_"),pe=g2(le,E),et=le.multiline||le.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${et?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${le.key} 环境变量名`,"aria-disabled":V,children:[o.jsx("span",{title:le.key,children:le.key}),(le.help||le.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":le.help||le.comment,"aria-label":`${le.key}说明:${le.help||le.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:le.help||le.comment})]}),le.link&&o.jsx("a",{className:"pp-env-link",href:le.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${le.link.label}`,"aria-label":`${le.key}:打开 OpenViking ${le.link.label}`,children:o.jsx(xm,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[et?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:le.value,placeholder:le.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:V||!Ie&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!pe,"aria-label":`${le.key} 环境变量值`,onChange:nt=>w==null?void 0:w(le.key,nt.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:"text",value:le.value,placeholder:le.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:V||!Ie&&!w,autoComplete:"off","aria-invalid":!!pe,"aria-label":`${le.key} 环境变量值`,onChange:nt=>w==null?void 0:w(le.key,nt.currentTarget.value)}),pe&&o.jsx("span",{className:"pp-env-error",children:pe})]}),o.jsx("span",{className:"pp-env-source",children:Ie?"自动":"同步"})]},le.key)})]}),De.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[De.length," 项"]})]}),De.map(le=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:le.key,placeholder:"名称",disabled:V,autoComplete:"off",onChange:Ie=>mn(le.id,{key:Ie.currentTarget.value})}),o.jsx("input",{type:"text",value:le.value,placeholder:"值",disabled:V,autoComplete:"off",onChange:Ie=>mn(le.id,{value:Ie.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:V,onClick:()=>Kn(le.id),children:o.jsx(ki,{className:"pp-ic"})})]},le.id))]})]}),(V||ae||Object.keys(Se).length>0)&&o.jsxs("section",{className:"pp-config-section pp-progress-section",children:[o.jsx("div",{className:"pp-config-label",children:"部署进度"}),o.jsx("ol",{className:"pp-steps",children:Et.map((le,Ie)=>{const pe=Le?Et.findIndex(_t=>_t.phase===Le):-1,et=!!Me&&(pe===-1?Ie===0:Ie===pe);let nt;ae?nt="done":et?nt="failed":pe===-1?nt=V?"active":"pending":Iele.phase===Le))==null?void 0:gn.label)??Le}阶段):`:""}${Me}`,onRetry:as,retryLabel:A?"重试更新":"重试部署"}),ae&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:A?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[ae.warnings&&ae.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:ae.warnings.map(le=>o.jsx("span",{children:le},le))}),ae.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:ae.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:ae.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:ae.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Cs,disabled:Ne,children:[Ne?o.jsx(fn,{className:"pp-ic spin"}):o.jsx(dB,{className:"pp-ic"}),Ne?"连接中…":"立即对话"]}),ae.consoleUrl&&o.jsxs("a",{href:ae.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(xm,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${Vt?" is-external":""}`,children:Vt?mi.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:as,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Me?`重试${f}`:f}),Vt):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:as,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Me?`重试${f}`:f})})]})]}),me&&s&&mi.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:le=>{le.target===le.currentTarget&&_e(!1)},children:o.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"执行流程"}),o.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),o.jsx("button",{type:"button",onClick:()=>_e(!1),"aria-label":"关闭执行流程预览",children:o.jsx(ki,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(Rm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:fl,onAdd:fl,onInsert:fl,onDelete:fl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(SAe,{open:q,isUpdate:A,onCancel:os,onConfirm:()=>void qn()})]})}const M3="dogfooding",kw="dogfooding",Aw="dogfooding_b";let UAe=0;const Cw=()=>++UAe;function L3(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function FAe(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function D3(e){const t=[],n=FAe(e);t.push(n);const s=n.indexOf("{"),i=n.lastIndexOf("}");s>=0&&i>s&&t.push(n.slice(s,i+1));for(const r of t)try{const a=JSON.parse(r);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await r1(p2(a))}catch{}return null}function $Ae({userId:e,onBack:t,onCreate:n,onAgentAdded:s,onDeploymentTaskChange:i}){const[r,a]=g.useState([{id:Cw(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(null),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),[E,w]=g.useState(null),[_,S]=g.useState(!1),[k,T]=g.useState(!1),[C,I]=g.useState({}),j=g.useRef(null),O=g.useRef(null),z=g.useRef(null),D=g.useRef(null),F=g.useRef(null);g.useEffect(()=>{const K=D.current;K&&K.scrollTo({top:K.scrollHeight,behavior:"smooth"})},[r,u]),g.useEffect(()=>{const K=F.current;K&&(K.style.height="auto",K.style.height=Math.min(K.scrollHeight,160)+"px")},[l]);const A=K=>a(V=>[...V,{id:Cw(),role:"assistant",text:K}]);async function M(){if(j.current)return j.current;const K=await Uy(M3,e);return j.current=K,K}async function P(K,V){if(V.current)return V.current;const W=await Uy(K,e);return V.current=W,W}async function $(K,V){if(!C[K])try{const W=await Lk(V);I(q=>({...q,[K]:W.model||V}))}catch{I(W=>({...W,[K]:V}))}}async function R(K,V,W){const q=await P(K,V);let ue=va();for await(const _e of Em({appName:K,userId:e,sessionId:q,text:W}))ue=pf(ue,_e);const me=L3(ue).trim();return{project:await D3(me),finalText:me}}const Y=async(K,V,W)=>ug(K.name,K.files,{region:"cn-beijing",projectName:"default"},{...W,onStage:V}),J=async()=>{const K=l.trim();if(!(!K||u)){if(a(V=>[...V,{id:Cw(),role:"user",text:K}]),c(""),h(null),d(!0),b){x(null),w(null),S(!0),T(!0),$("a",kw),$("b",Aw);const V=R(kw,O,K).then(({project:q})=>(x(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>S(!1)),W=R(Aw,z,K).then(({project:q})=>(w(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>T(!1));try{const[q,ue]=await Promise.all([V,W]),me=[q?`方案 A:${q.name}`:null,ue?`方案 B:${ue.name}`:null].filter(Boolean);me.length?A(`已生成两个方案(${me.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const V=await M();let W=va();for await(const me of Em({appName:M3,userId:e,sessionId:V,text:K}))W=pf(W,me);const q=L3(W).trim(),ue=await D3(q);ue?(m(ue),A(`已生成项目:${ue.name}(${ue.files.length} 个文件),可在右侧预览和编辑。`)):A(q||"(助手没有返回内容,请再描述一下你的需求。)")}catch(V){const W=V instanceof Error?V.message:String(V);h(W),A(`抱歉,调用智能构建助手失败:${W}`)}finally{d(!1)}}},U=K=>{const V=K==="a"?y:E;if(!V)return;m(V),v(!1),x(null),w(null),S(!1),T(!1);const W=K==="a"?"A":"B",q=K==="a"?C.a:C.b;A(`已采用方案 ${W}(${q??(K==="a"?kw:Aw)}),可继续编辑。`)},te=K=>{K.key==="Enter"&&!K.shiftKey&&!K.nativeEvent.isComposing&&(K.preventDefault(),J())};return o.jsx("div",{className:"ic-root",children:o.jsxs("div",{className:"ic-body",children:[o.jsxs("div",{className:"ic-chat",children:[o.jsxs("div",{className:"ic-transcript",ref:D,children:[o.jsx(Io,{initial:!1,children:r.map(K=>o.jsxs(ts.div,{className:`ic-turn ic-turn--${K.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[K.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(su,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:K.role==="assistant"?o.jsx(nh,{text:K.text}):K.text})]},K.id))}),u&&o.jsxs(ts.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[o.jsx("div",{className:"ic-avatar",children:o.jsx(su,{className:"ic-avatar-icon"})}),o.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"})]})]})]}),f&&o.jsxs("div",{className:"ic-error",children:[o.jsx(yk,{className:"ic-error-icon"}),f]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:F,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:l,onChange:K=>c(K.target.value),onKeyDown:te,disabled:u}),o.jsx("button",{className:"ic-send",onClick:()=>void J(),disabled:!l.trim()||u,title:"发送 (Enter)",children:o.jsx(xee,{className:"ic-send-icon"})})]}),o.jsxs("div",{className:"ic-composer-foot",children:[o.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[o.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:b,disabled:u,onChange:K=>v(K.target.checked)}),o.jsx("span",{className:"ic-ab-track",children:o.jsx("span",{className:"ic-ab-thumb"})}),o.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),o.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),o.jsx("aside",{className:"ic-preview",children:b?o.jsxs("div",{className:"ic-compare",children:[o.jsx(P3,{side:"a",project:y,loading:_,model:C.a,onAdopt:()=>U("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(P3,{side:"b",project:E,loading:k,model:C.b,onAdopt:()=>U("b")})]}):p?o.jsx(X1,{project:p,onChange:m,onDeploy:Y,onAgentAdded:s,onDeploymentTaskChange:i,deploymentTelemetrySource:"intelligent_create"}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(QJ,{className:"ic-preview-empty-glyph"}),o.jsx(iu,{className:"ic-preview-empty-spark"})]}),o.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),o.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function P3({side:e,project:t,loading:n,model:s,onAdopt:i}){const r=e==="a"?"方案 A":"方案 B";return o.jsxs("div",{className:"ic-pane",children:[o.jsxs("div",{className:"ic-pane-head",children:[o.jsxs("div",{className:"ic-pane-title",children:[o.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:r}),s&&o.jsx("span",{className:"ic-pane-model",children:s})]}),o.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${r}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),o.jsx("div",{className:"ic-pane-body",children:n?o.jsxs("div",{className:"ic-pane-loading",children:[o.jsx(fn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(X1,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var HAe=Object.defineProperty,b2=(e,t)=>HAe(e,"name",{value:t,configurable:!0});function gN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}b2(gN,"setRef");function hz(...e){return t=>{let n=!1;const s=e.map(i=>{const r=gN(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;izAe(e,"name",{value:t,configurable:!0});function Of(e){const t=g.forwardRef((n,s)=>{let{children:i,...r}=n,a=null,l=!1;const c=[];bN(i)&&typeof sb=="function"&&(i=sb(i._payload)),g.Children.forEach(i,h=>{var p;if(bz(h)){l=!0;const m=h;let b="child"in m.props?m.props.child:m.props.children;bN(b)&&typeof sb=="function"&&(b=sb(b._payload)),a=GAe(m,b),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=g.cloneElement(a,void 0,c):!l&&g.Children.count(i)===1&&g.isValidElement(i)&&(a=i);const u=a?gz(a):void 0,d=lr(s,u);if(!a){if(i||i===0)throw new Error(l?YAe(e):qAe(e));return i}const f=mz(r,a.props??{});return a.type!==g.Fragment&&(f.ref=s?d:u),g.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Ma(Of,"createSlot");var pz=Symbol.for("radix.slottable");function VAe(e){const t=Ma(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=pz,t}Ma(VAe,"createSlottable");var GAe=Ma((e,t)=>{if("child"in e.props){const n=e.props.child;return g.isValidElement(n)?g.cloneElement(n,void 0,e.props.children(n.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function mz(e,t){const n={...t};for(const s in t){const i=e[s],r=t[s];/^on[A-Z]/.test(s)?i&&r?n[s]=(...l)=>{const c=r(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...r}:s==="className"&&(n[s]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}Ma(mz,"mergeProps");function gz(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ma(gz,"getElementRef");function bz(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pz}Ma(bz,"isSlottable");var KAe=Symbol.for("react.lazy");function bN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===KAe&&"_payload"in e&&yz(e._payload)}Ma(bN,"isLazyComponent");function yz(e){return typeof e=="object"&&e!==null&&"then"in e}Ma(yz,"isPromiseLike");var qAe=Ma(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),YAe=Ma(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),sb=Df[" use ".trim().toString()],WAe=Object.defineProperty,XAe=(e,t)=>WAe(e,"name",{value:t,configurable:!0}),QAe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sa=QAe.reduce((e,t)=>{const n=Of(`Primitive.${t}`),s=g.forwardRef((i,r)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function ZAe(e,t){e&&mi.flushSync(()=>e.dispatchEvent(t))}XAe(ZAe,"dispatchDiscreteCustomEvent");var JAe=Object.defineProperty,Qr=(e,t)=>JAe(e,"name",{value:t,configurable:!0});function e2e(e,t){const n=g.createContext(t);n.displayName=e+"Context";const s=Qr(r=>{const{children:a,...l}=r,c=g.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function i(r,a={}){const{optional:l=!1}=a,c=g.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return Qr(i,"useContext"),[s,i]}Qr(e2e,"createContext");function lc(e,t=[]){let n=[];function s(r,a){const l=g.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=Qr(f=>{var y;const{scope:h,children:p,...m}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useMemo(()=>m,Object.values(m));return o.jsx(b.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useContext(b);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return Qr(d,"useContext"),[u,d]}Qr(s,"createContext");const i=Qr(()=>{const r=n.map(a=>g.createContext(a));return Qr(function(l){const c=(l==null?void 0:l[e])||r;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[s,xz(i,...t)]}Qr(lc,"createContextScope");function xz(...e){const t=e[0];if(e.length===1)return t;const n=Qr(()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Qr(function(r){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Qr(xz,"composeContextScopes");var t2e=Object.defineProperty,fi=(e,t)=>t2e(e,"name",{value:t,configurable:!0});function Ez(e){const t=e+"CollectionProvider",[n,s]=lc(t),[i,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=fi(b=>{const{scope:v,children:y}=b,x=g.useRef(null),E=g.useRef(new Map).current;return o.jsx(i,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Of(l),u=g.forwardRef((b,v)=>{const{scope:y,children:x}=b,E=r(l,y),w=lr(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Of(d),p=g.forwardRef((b,v)=>{const{scope:y,children:x,...E}=b,w=g.useRef(null),_=lr(v,w),S=r(d,y);return g.useEffect(()=>(S.itemMap.set(w,{ref:w,...E}),()=>void S.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:_,children:x})});p.displayName=d;function m(b){const v=r(e+"CollectionConsumer",b);return g.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((S,k)=>E.indexOf(S.ref.current)-E.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return fi(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,s]}fi(Ez,"createCollection");var B3=new WeakMap,zs,mr,Iw=(mr=class extends Map{constructor(n){super(n);gC(this,zs);kE(this,zs,[...super.keys()]),B3.set(this,!0)}set(n,s){return B3.get(this)&&(this.has(n)?Ci(this,zs)[Ci(this,zs).indexOf(n)]=n:Ci(this,zs).push(n)),super.set(n,s),this}insert(n,s,i){const r=this.has(s),a=Ci(this,zs).length,l=y2(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(s,i),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...Ci(this,zs)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,s){const i=this.indexOf(n);if(i===-1)return;let r=i+s;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return r;i++}}findIndex(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return i;i++}return-1}filter(n,s){const i=[];let r=0;for(const a of this)Reflect.apply(n,s,[a,r,this])&&i.push(a),r++;return new mr(i)}map(n,s){const i=[];let r=0;for(const a of this)i.push([a[0],Reflect.apply(n,s,[a,r,this])]),r++;return new mr(i)}reduce(...n){const[s,i]=n;let r=0,a=i??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(s,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[s,i]=n;let r=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?r=l:r=Reflect.apply(s,this,[r,l,a,this])}return r}toSorted(n){const s=[...this.entries()].sort(n);return new mr(s)}toReversed(){const n=new mr;for(let s=this.size-1;s>=0;s--){const i=this.keyAt(s),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new mr(s)}slice(n,s){const i=new mr;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),s!==void 0&&s>0&&(r=s-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,s){let i=0;for(const r of this){if(!Reflect.apply(n,s,[r,i,this]))return!1;i++}return!0}some(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return!0;i++}return!1}},zs=new WeakMap,fi(mr,"OrderedDict"),mr);function Xb(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=vz(e,t);return n===-1?void 0:e[n]}fi(Xb,"at");function vz(e,t){const n=e.length,s=y2(t),i=s>=0?s:n+s;return i<0||i>=n?-1:i}fi(vz,"toSafeIndex");function y2(e){return e!==e||e===0?0:Math.trunc(e)}fi(y2,"toSafeInteger");function n2e(e){const t=e+"CollectionProvider",[n,s]=lc(t),[i,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Iw,setItemMap:fi(()=>{},"setItemMap")}),a=fi(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=fi(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=fi(E=>{const{scope:w,children:_,state:S}=E,k=g.useRef(null),[T,C]=g.useState(null),I=lr(k,C),[j,O]=S;return g.useEffect(()=>{if(!T)return;const z=_z(()=>{});return z.observe(T,{childList:!0,subtree:!0}),()=>{z.disconnect()}},[T]),o.jsx(i,{scope:w,itemMap:j,setItemMap:O,collectionRef:I,collectionRefObject:k,collectionElement:T,children:_})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Of(u),f=g.forwardRef((E,w)=>{const{scope:_,children:S}=E,k=r(u,_),T=lr(w,k.collectionRef);return o.jsx(d,{ref:T,children:S})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Of(h),b=g.forwardRef((E,w)=>{const{scope:_,children:S,...k}=E,T=g.useRef(null),[C,I]=g.useState(null),j=lr(w,T,I),O=r(h,_),{setItemMap:z}=O,D=g.useRef(k);wz(D.current,k)||(D.current=k);const F=D.current;return g.useEffect(()=>{const A=F;return z(M=>C?M.has(C)?M.set(C,{...A,element:C}).toSorted(yN):(M.set(C,{...A,element:C}),M.toSorted(yN)):M),()=>{z(M=>!C||!M.has(C)?M:(M.delete(C),new Iw(M)))}},[C,F,z]),o.jsx(m,{[p]:"",ref:j,children:S})});b.displayName=h;function v(){return g.useState(new Iw)}fi(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return fi(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:s,useCollection:y,useInitCollection:v}]}fi(n2e,"createCollection");function wz(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}fi(wz,"shallowEqual");function Sz(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}fi(Sz,"isElementPreceding");function yN(e,t){return!e[1].element||!t[1].element?0:Sz(e[1].element,t[1].element)?-1:1}fi(yN,"sortByDocumentPosition");function _z(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}fi(_z,"getChildListObserver");var s2e=Object.defineProperty,uh=(e,t)=>s2e(e,"name",{value:t,configurable:!0}),Nz=!!(typeof window<"u"&&window.document&&window.document.createElement);function qi(e,t,{checkForDefaultPrevented:n=!0}={}){return uh(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}uh(qi,"composeEventHandlers");function i2e(e){var t;if(!Nz)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}uh(i2e,"getOwnerWindow");function xN(e){if(!Nz)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}uh(xN,"getOwnerDocument");function Tz(e,t=!1){const{activeElement:n}=xN(e);if(!(n!=null&&n.nodeName))return null;if(kz(n)&&n.contentDocument)return Tz(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const i=xN(n).getElementById(s);if(i)return i}}return n}uh(Tz,"getActiveElement");function kz(e){return e.tagName==="IFRAME"}uh(kz,"isFrame");var hu=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},r2e=Object.defineProperty,a2e=(e,t)=>r2e(e,"name",{value:t,configurable:!0}),U3=Df[" useEffectEvent ".trim().toString()],F3=Df[" useInsertionEffect ".trim().toString()];function Az(e){if(typeof U3=="function")return U3(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof F3=="function"?F3(()=>{t.current=e}):hu(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}a2e(Az,"useEffectEvent");var o2e=Object.defineProperty,Mg=(e,t)=>o2e(e,"name",{value:t,configurable:!0}),l2e=Df[" useInsertionEffect ".trim().toString()]||hu;function Au({prop:e,defaultProp:t,onChange:n=Mg(()=>{},"onChange"),caller:s}){const[i,r,a]=Cz({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=g.useCallback(d=>{var f;if(l){const h=Iz(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Mg(Au,"useControllableState");function Cz({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),r=g.useRef(t);return l2e(()=>{r.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=r.current)==null||a.call(r,n),i.current=n)},[n,i]),[n,s,r]}Mg(Cz,"useUncontrolledState");function Iz(e){return typeof e=="function"}Mg(Iz,"isFunction");var $3=Symbol("RADIX:SYNC_STATE");function c2e(e,t,n,s){const{prop:i,defaultProp:r,onChange:a,caller:l}=t,c=i!==void 0,u=Az(a),d=[{...n,state:r}];s&&d.push(s);const[f,h]=g.useReducer((v,y)=>{if(y.type===$3)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),p=f.state,m=g.useRef(p);g.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const b=g.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return g.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:$3,state:i})},[i,f.state,c]),[b,h]}Mg(c2e,"useControllableStateReducer");var u2e=Object.defineProperty,Wo=(e,t)=>u2e(e,"name",{value:t,configurable:!0});function jz(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}Wo(jz,"useStateMachine");var Rz=Wo(e=>{const{present:t,children:n}=e,s=Oz(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),r=Mz(s.ref,Lz(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:r}):null},"Presence");function Oz(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),r=g.useRef("none"),a=g.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=jz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{c==="mounted"?(r.current=a.current??ld(s.current),a.current=void 0):r.current="none"},[c]),hu(()=>{const d=s.current,f=i.current;if(f!==e){const p=r.current,m=ld(d);e?(a.current=m,u("MOUNT")):m==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),hu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Wo(m=>{const v=ld(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Wo(m=>{m.target===t&&(r.current=ld(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,a.current=ld(f)}else s.current=null;n(d)},[])}}Wo(Oz,"usePresence");function EN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Wo(EN,"setRef");function Mz(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const s=t.current;let i=!1;const r=s.map(a=>{const l=EN(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;ad2e(e,"name",{value:t,configurable:!0}),h2e=Df[" useId ".trim().toString()]||(()=>{}),p2e=0;function Dz(e){const[t,n]=g.useState(h2e());return hu(()=>{e||n(s=>s??String(p2e++))},[e]),e||(t?`radix-${t}`:"")}f2e(Dz,"useId");var m2e=Object.defineProperty,g2e=(e,t)=>m2e(e,"name",{value:t,configurable:!0}),b2e=g.createContext(void 0);function Q1(e){const t=g.useContext(b2e);return e||t||"ltr"}g2e(Q1,"useDirection");var y2e=Object.defineProperty,x2e=(e,t)=>y2e(e,"name",{value:t,configurable:!0});function Pz(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}x2e(Pz,"useCallbackRef");var E2e=Object.defineProperty,v2e=(e,t)=>E2e(e,"name",{value:t,configurable:!0});function x2(e){const[t,n]=g.useState(void 0);return hu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let a,l;if("borderBoxSize"in r){const c=r.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}v2e(x2,"useSize");var w2e=Object.defineProperty,Xo=(e,t)=>w2e(e,"name",{value:t,configurable:!0}),E2="Checkbox",[S2e,oMe]=lc(E2),[_2e,v2]=S2e(E2);function Bz(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Au({prop:n,defaultProp:i??!1,onChange:c,caller:E2}),[m,b]=g.useState(null),[v,y]=g.useState(null),x=g.useRef(!1),[E,w]=g.useReducer(k=>k+1,0),_=m?!!a||!!m.closest("form"):!0,S={checked:h,disabled:r,setChecked:p,control:m,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:Uo(i)?!1:i,isFormControl:_,bubbleInput:v,setBubbleInput:y};return o.jsx(_2e,{scope:t,...S,children:Uz(f)?f(S):s})}Xo(Bz,"CheckboxProvider");var N2e="CheckboxTrigger",T2e=g.forwardRef(Xo(function({__scopeCheckbox:t,onKeyDown:n,onClick:s,...i},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:b,bubbleInput:v}=v2(N2e,t),y=lr(r,f),x=g.useRef(u);return g.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=Xo(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(sa.button,{type:"button",role:"checkbox","aria-checked":Uo(u)?"mixed":u,"aria-required":d,"data-state":w2(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:qi(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:qi(s,E=>{m(),h(w=>Uo(w)?!0:!w),v&&b&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),k2e=g.forwardRef(Xo(function(t,n){const{__scopeCheckbox:s,name:i,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(Bz,{__scopeCheckbox:s,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(T2e,{...h,ref:n,__scopeCheckbox:s}),p&&o.jsx(j2e,{__scopeCheckbox:s})]})})},"Checkbox")),A2e="CheckboxIndicator",C2e=g.forwardRef(Xo(function(t,n){const{__scopeCheckbox:s,forceMount:i,...r}=t,a=v2(A2e,s);return o.jsx(Rz,{present:i||Uo(a.checked)||a.checked===!0,children:o.jsx(sa.span,{"data-state":w2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),I2e="CheckboxBubbleInput",j2e=g.forwardRef(Xo(function({__scopeCheckbox:t,onClick:n,...s},i){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=v2(I2e,t),y=lr(i,v),x=x2(r),E=g.useRef(!1),w=g.useRef(c),_=g.useRef(l);g.useEffect(()=>{const k=b;if(!k)return;const T=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(T,"checked").set,j=l!==_.current;_.current=l;const O=w.current!==c;w.current=c;const z=!(j&&a.current);if(O&&I){E.current=!j;const D=new Event("click",{bubbles:z});k.indeterminate=Uo(c),I.call(k,Uo(c)?!1:c),k.dispatchEvent(D),E.current=!1}},[b,c,a,l]);const S=g.useRef(Uo(c)?!1:c);return o.jsx(sa.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??S.current,required:d,disabled:f,name:h,value:p,form:m,...s,tabIndex:-1,ref:y,onClick:qi(n,k=>{E.current&&k.stopPropagation()}),style:{...s.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Uz(e){return typeof e=="function"}Xo(Uz,"isFunction");function Uo(e){return e==="indeterminate"}Xo(Uo,"isIndeterminate");function w2(e){return Uo(e)?"indeterminate":e?"checked":"unchecked"}Xo(w2,"getState");var R2e=Object.defineProperty,S2=(e,t)=>R2e(e,"name",{value:t,configurable:!0}),jw=!1;function Fz(){const[e,t]=g.useState(jw);return g.useEffect(()=>{jw||(jw=!0,t(!0))},[]),e}S2(Fz,"useIsHydrated");var $z=Df[" useSyncExternalStore ".trim().toString()];function Hz(){return()=>{}}S2(Hz,"subscribe");function zz(){return $z(Hz,()=>!0,()=>!1)}S2(zz,"useIsHydratedModern");var O2e=typeof $z=="function"?zz:Fz,M2e=Object.defineProperty,Cu=(e,t)=>M2e(e,"name",{value:t,configurable:!0}),Rw="rovingFocusGroup.onEntryFocus",L2e={bubbles:!1,cancelable:!0},Z1="RovingFocusGroup",[vN,Vz,D2e]=Ez(Z1),[P2e,J1]=lc(Z1,[D2e]),[B2e,U2e]=P2e(Z1),F2e=g.forwardRef(Cu(function(t,n){return o.jsx(vN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(vN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx($2e,{...t,ref:n})})})},"RovingFocusGroup")),$2e=g.forwardRef(Cu(function(t,n){const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=g.useRef(null),m=lr(n,p),b=Q1(a),[v,y]=Au({prop:l,defaultProp:c??null,onChange:u,caller:Z1}),[x,E]=g.useState(!1),w=Pz(d),_=Vz(s),S=g.useRef(!1),[k,T]=g.useState(0);return g.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(Rw,w),()=>C.removeEventListener(Rw,w)},[w]),o.jsx(B2e,{scope:s,orientation:i,dir:b,loop:r,currentTabStopId:v,onItemFocus:g.useCallback(C=>y(C),[y]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>T(C=>C-1),[]),children:o.jsx(sa.div,{tabIndex:x||k===0?-1:0,"data-orientation":i,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:qi(t.onMouseDown,()=>{S.current=!0}),onFocus:qi(t.onFocus,C=>{const I=!S.current;if(C.target===C.currentTarget&&I&&!x){const j=new CustomEvent(Rw,L2e);if(C.currentTarget.dispatchEvent(j),!j.defaultPrevented){const O=_().filter(M=>M.focusable),z=O.find(M=>M.active),D=O.find(M=>M.id===v),A=[z,D,...O].filter(Boolean).map(M=>M.ref.current);_2(A,f)}}S.current=!1}),onBlur:qi(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),H2e="RovingFocusGroupItem",z2e=g.forwardRef(Cu(function(t,n){const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=Dz(),d=a||u,f=U2e(H2e,s),h=f.currentTabStopId===d,p=Vz(s),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=f,y=O2e();return hu(()=>{if(!(!y||!i))return m(),()=>b()},[y,i,m,b]),g.useEffect(()=>{if(!(y||!i))return m(),()=>b()},[y,i,m,b]),o.jsx(vN.ItemSlot,{scope:s,id:d,focusable:i,active:r,children:o.jsx(sa.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:qi(t.onMouseDown,x=>{i?f.onItemFocus(d):x.preventDefault()}),onFocus:qi(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:qi(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=Kz(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let _=p().filter(S=>S.focusable).map(S=>S.ref.current);if(E==="last")_.reverse();else if(E==="prev"||E==="next"){E==="prev"&&_.reverse();const S=_.indexOf(x.currentTarget);_=f.loop?qz(_,S+1):_.slice(S+1)}setTimeout(()=>_2(_))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),V2e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Cu(Gz,"getDirectionAwareKey");function Kz(e,t,n){const s=Gz(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return V2e[s]}Cu(Kz,"getFocusIntent");function _2(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}Cu(_2,"focusFirst");function qz(e,t){return e.map((n,s)=>e[(t+s)%e.length])}Cu(qz,"wrapArray");var Yz=F2e,Wz=z2e,G2e=Object.defineProperty,Mi=(e,t)=>G2e(e,"name",{value:t,configurable:!0}),Xz="Radio",[K2e,Qz]=lc(Xz),[q2e,eE]=K2e(Xz);function Zz(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:i,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=g.useState(null),[p,m]=g.useState(null),b=g.useRef(!1),[v,y]=g.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:i,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Mi(()=>l==null?void 0:l(),"onCheck")};return o.jsx(q2e,{scope:t,...E,children:Jz(d)?d(E):s})}Mi(Zz,"RadioProvider");var Y2e="RadioTrigger",W2e=g.forwardRef(Mi(function({__scopeRadio:t,onClick:n,...s},i){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=eE(Y2e,t),m=lr(i,c);return o.jsx(sa.button,{type:"button",role:"radio","aria-checked":r,"data-state":N2(r),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:m,onClick:qi(n,b=>{r||(f(),u()),p&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),X2e="RadioIndicator",Q2e=g.forwardRef(Mi(function(t,n){const{__scopeRadio:s,forceMount:i,...r}=t,a=eE(X2e,s);return o.jsx(Rz,{present:i||a.checked,children:o.jsx(sa.span,{"data-state":N2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),Z2e="RadioBubbleInput",J2e=g.forwardRef(Mi(function({__scopeRadio:t,onClick:n,...s},i){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:b}=eE(Z2e,t),v=lr(i,p),y=x2(r),x=g.useRef(!1),E=g.useRef(a),w=g.useRef(b);g.useEffect(()=>{const S=h;if(!S)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,I=b!==w.current;w.current=b;const j=E.current!==a;E.current=a;const O=!(I&&m.current);if(j&&C){x.current=!I;const z=new Event("click",{bubbles:O});C.call(S,a),S.dispatchEvent(z),x.current=!1}},[h,a,m,b]);const _=g.useRef(a);return o.jsx(sa.input,{type:"radio","aria-hidden":!0,defaultChecked:_.current,required:l,disabled:c,name:u,value:d,form:f,...s,tabIndex:-1,ref:v,onClick:qi(n,S=>{x.current&&S.stopPropagation()}),style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function Jz(e){return typeof e=="function"}Mi(Jz,"isFunction");function N2(e){return e?"checked":"unchecked"}Mi(N2,"getState");var eCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],T2="RadioGroup",[tCe,lMe]=lc(T2,[J1,Qz]),eV=J1(),tE=Qz(),[nCe,sCe]=tCe(T2),iCe=g.forwardRef(Mi(function(t,n){const{__scopeRadioGroup:s,name:i,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,b=eV(s),v=Q1(f),[y,x]=Au({prop:l,defaultProp:a??null,onChange:p,caller:T2}),[E,w]=g.useState(null),_=lr(n,w),S=g.useRef(y);return g.useEffect(()=>{const k=r?E==null?void 0:E.ownerDocument.getElementById(r):E==null?void 0:E.closest("form");if(k instanceof HTMLFormElement){const T=Mi(()=>x(S.current),"reset");return k.addEventListener("reset",T),()=>k.removeEventListener("reset",T)}},[E,r,x]),o.jsx(nCe,{scope:s,name:i,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(Yz,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(sa.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:_})})})},"RadioGroup")),rCe="RadioGroupItemProvider",aCe="RadioGroupItemTrigger";function tV(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:i,internal_do_not_use_render:r}=e,a=sCe(rCe,t),l=tE(t),c=a.disabled||s;return o.jsx(Zz,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:r,children:i})}Mi(tV,"RadioGroupItemProvider");var oCe=g.forwardRef(Mi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=eV(s),a=tE(s),{checked:l,disabled:c}=eE(aCe,a.__scopeRadio),u=g.useRef(null),d=lr(n,u),f=g.useRef(!1);return g.useEffect(()=>{const h=Mi(m=>{eCe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Mi(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(Wz,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(W2e,{...a,...i,ref:d,onKeyDown:qi(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:qi(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),lCe=g.forwardRef(Mi(function(t,n){const{__scopeRadioGroup:s,value:i,disabled:r,...a}=t;return o.jsx(tV,{__scopeRadioGroup:s,value:i,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(oCe,{...a,ref:n,__scopeRadioGroup:s}),l&&o.jsx(cCe,{__scopeRadioGroup:s})]})})},"RadioGroupItem")),cCe=g.forwardRef(Mi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=tE(s);return o.jsx(J2e,{...r,...i,ref:n})},"RadioGroupItemBubbleInput")),uCe=g.forwardRef(Mi(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=tE(s);return o.jsx(Q2e,{...r,...i,ref:n})},"RadioGroupIndicator")),dCe=Object.defineProperty,fCe=(e,t)=>dCe(e,"name",{value:t,configurable:!0}),hCe="Toggle",pCe=g.forwardRef(fCe(function(t,n){const{pressed:s,defaultPressed:i,onPressedChange:r,...a}=t,[l,c]=Au({prop:s,onChange:r,defaultProp:i??!1,caller:hCe});return o.jsx(sa.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:qi(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),mCe=Object.defineProperty,Jl=(e,t)=>mCe(e,"name",{value:t,configurable:!0}),dh="ToggleGroup",[nV,cMe]=lc(dh,[J1]),sV=J1(),gCe=g.forwardRef(Jl(function(t,n){const{type:s,...i}=t;if(s==="single"){const r=i;return o.jsx(bCe,{role:"radiogroup",...r,ref:n})}if(s==="multiple"){const r=i;return o.jsx(yCe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${dh}\``)},"ToggleGroup")),[iV,rV]=nV(dh),bCe=g.forwardRef(Jl(function(t,n){const{value:s,defaultValue:i,onValueChange:r=Jl(()=>{},"onValueChange"),...a}=t,[l,c]=Au({prop:s,defaultProp:i??"",onChange:r,caller:dh});return o.jsx(iV,{scope:t.__scopeToggleGroup,type:"single",value:g.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:g.useCallback(()=>c(""),[c]),children:o.jsx(aV,{...a,ref:n})})},"ToggleGroupImplSingle")),yCe=g.forwardRef(Jl(function(t,n){const{value:s,defaultValue:i,onValueChange:r=Jl(()=>{},"onValueChange"),...a}=t,[l,c]=Au({prop:s,defaultProp:i??[],onChange:r,caller:dh}),u=g.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=g.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(iV,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(aV,{...a,ref:n})})},"ToggleGroupImplMultiple")),[xCe,ECe]=nV(dh),aV=g.forwardRef(Jl(function(t,n){const{__scopeToggleGroup:s,disabled:i=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=sV(s),f=Q1(l),h={dir:f,...u};return o.jsx(xCe,{scope:s,rovingFocus:r,disabled:i,children:r?o.jsx(Yz,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(sa.div,{...h,ref:n})}):o.jsx(sa.div,{...h,ref:n})})},"ToggleGroupImpl")),wN="ToggleGroupItem",vCe=g.forwardRef(Jl(function(t,n){const s=rV(wN,t.__scopeToggleGroup),i=ECe(wN,t.__scopeToggleGroup),r=sV(t.__scopeToggleGroup),a=s.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=g.useRef(null);return i.rovingFocus?o.jsx(Wz,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(H3,{...c,ref:n})}):o.jsx(H3,{...c,ref:n})},"ToggleGroupItem")),H3=g.forwardRef(Jl(function(t,n){const{__scopeToggleGroup:s,value:i,...r}=t,a=rV(wN,s),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(pCe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl"));const wCe="_Container_1tuad_1",SCe="_Checkbox_1tuad_22",_Ce="_CheckMark_1tuad_92",NCe="_Label_1tuad_162",ib={Container:wCe,Checkbox:SCe,CheckMark:_Ce,Label:NCe},oV=({className:e,label:t,id:n,disabled:s,orientation:i="left",...r})=>{const a=g.useId(),l=n??a;return o.jsxs("div",{"data-disabled":s?"":void 0,"data-has-label":t?"":void 0,"data-orientation":i,className:ra(e,ib.Container),children:[o.jsx(k2e,{className:ib.Checkbox,id:l,disabled:s,...r,children:o.jsx(C2e,{className:ib.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:ib.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},TCe="_RadioGroup_onrfm_1",kCe="_RadioLabel_onrfm_9",ACe="_RadioIndicatorWrapper_onrfm_26",CCe="_RadioItem_onrfm_43",ICe="_RadioIndicator_onrfm_26",mp={RadioGroup:TCe,RadioLabel:kCe,RadioIndicatorWrapper:ACe,RadioItem:CCe,RadioIndicator:ICe},lV=g.createContext(null),jCe=()=>{const e=g.use(lV);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},SN=({onChange:e,children:t,className:n,direction:s="row",disabled:i=!1,...r})=>{const a=g.useMemo(()=>({disabled:i,direction:s}),[i,s]);return o.jsx(lV,{value:a,children:o.jsx(iCe,{className:ra(mp.RadioGroup,n),"data-direction":s,onValueChange:e,disabled:i,...r,children:t})})},RCe=({value:e,disabled:t=!1,required:n,children:s,className:i,block:r=!1,...a})=>{const{disabled:l}=jCe(),c=l||t,u=g.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ra(mp.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:mp.RadioIndicatorWrapper,children:o.jsx(lCe,{id:d,value:e,disabled:c,required:n,className:mp.RadioItem,children:o.jsx(uCe,{className:mp.RadioIndicator})})}),s]})})};SN.Item=RCe;function OCe({className:e,...t}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),o.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const cd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:OCe},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:ZJ},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:vee},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Sk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:Zx}},MCe=[cd.llm,cd.sequential,cd.parallel,cd.loop,cd.a2a];function cV(e){return cd[e??"llm"]}const uV=e=>e==="sequential"||e==="parallel"||e==="loop",nE=e=>e==="a2a";function ec(e){return e.trimEnd().replace(/[。.]+$/,"")}function yx(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(s=>s==null?void 0:s.toLocaleLowerCase().includes(n)):!0}function xc(e,t){return e[t]|e[t+1]<<8}function Ju(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function LCe(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function dV(e,t={}){let s=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(Ju(e,u)===101010256){s=u;break}if(s<0)throw new Error("无效的 zip:找不到 EOCD");const i=xc(e,s+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=Ju(e,s+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=xc(e,v+26),E=xc(e,v+28),w=v+30+x+E,_=e.subarray(w,w+f);let S;if(d===0)S=_;else if(d===8)S=await LCe(_);else{r+=46+p+m+b;continue}l.push({name:y,text:a.decode(S)}),r+=46+p+m+b}return l}const DCe="/skillhub/v1/skills";async function PCe(e,t="public"){const n=e.trim(),s=`${DCe}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,i=await fetch(s,{headers:{accept:"application/json"},signal:Ln(void 0,rc)});if(!i.ok)throw new Error(`搜索失败 (${i.status})`);return((await i.json()).Skills??[]).map(a=>{var l;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((l=a.Metadata)==null?void 0:l.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function BCe({selected:e,onChange:t}){const[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(!1),h=b=>e.some(v=>v.source==="skillhub"&&v.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},m=async b=>{l(!0),u(null),f(!0);try{const v=await PCe(b);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return g.useEffect(()=>{const b=n.trim();if(!b){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(b),300);return()=>clearTimeout(v)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(Dy,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?o.jsx(fn,{className:"cw-i cw-spin"}):o.jsx(Dy,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(fn,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const v=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(b),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(Ia,{className:"cw-i cw-i-sm"}):o.jsx(Ni,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const _N=/(^|\/)skill\.md$/i;function UCe(e){const t=(e??"").replace(/\r\n?/g,` `).split(` `);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function $Ce(...e){var t;for(const n of e){const s=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(s)return s.slice(0,64)}return"local-skill"}function HCe(e,t){return t.trim()||e}function fV(e){const t=e.map(s=>({path:s.path.replace(/\\/g,"/").replace(/^\.\//,""),text:s.text})).filter(s=>s.path.length>0&&!s.path.endsWith("/")),n=new Set(t.map(s=>s.path.split("/")[0]));if(n.size===1&&t.every(s=>s.path.includes("/"))){const s=[...n][0]+"/";return t.map(i=>({path:i.path.slice(s.length),text:i.text}))}return t}function zCe(e){const t=new Map,n=new Set;for(const s of e)if(_N.test("/"+s.path)){const i=s.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const s of e){const i=s.path.split("/");let r="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=_N.test("/"+s.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?s.path.slice(r.length+1):s.path,c=t.get(r)||[];c.push({path:l,text:s.text}),t.set(r,c)}return t}function VCe(e,t,n){const s=`${n}${e?"/"+e:""}`,i=t.find(c=>_N.test("/"+c.path));if(!i)return{hit:null,error:`${s} 缺少 SKILL.md`};const r=UCe(i.text),a=$Ce(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${s} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${s} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:HCe(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function GCe(e){const t=new Uint8Array(await e.arrayBuffer()),s=(await dV(t)).map(i=>({path:i.name,text:i.text}));return hV(fV(s),e.name)}async function KCe(e,t=new Map){const n=[];for(let s=0;se.file(t,n))}async function YCe(e){const t=e.createReader(),n=[];for(;;){const s=await new Promise((i,r)=>t.readEntries(i,r));if(s.length===0)return n;n.push(...s)}}async function pV(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await qCe(e),path:n}];if(!e.isDirectory)return[];const s=await YCe(e);return(await Promise.all(s.map(i=>pV(i,n)))).flat()}function WCe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(!1),d=g.useRef(0),f=E=>e.some(w=>w.source==="local"&&w.folder===E),h=E=>{E.localFiles&&(f(E.folder||E.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(E.folder||E.name)))):t([...e,{source:"local",folder:E.folder||E.name,name:E.name,description:E.description,localFiles:E.localFiles}]))},p=g.useRef([]),m=g.useRef(e);g.useEffect(()=>{p.current=i},[i]),g.useEffect(()=>{m.current=e},[e]);const b=E=>{const w=new Set([...p.current.map(T=>T.folder||T.name),...m.current.filter(T=>T.source==="local").map(T=>T.folder)]),_=[],S=[];for(const T of E.hits){const C=T.folder||T.name;if(w.has(C)){_.push(T.name);continue}w.add(C),S.push(T)}r(T=>[...T,...S]);const k=[...E.errors];if(_.length>0&&k.push(`已跳过重复技能:${_.join("、")}`),s(k),S.length===1&&E.errors.length===0&&_.length===0){const T=S[0];T.localFiles&&t([...m.current,{source:"local",folder:T.folder||T.name,name:T.name,description:T.description,localFiles:T.localFiles}])}},v=E=>{E.preventDefault(),d.current+=1,u(!0)},y=E=>{E.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async E=>{if(E.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(E.dataTransfer.items).map(_=>{var S;return(S=_.webkitGetAsEntry)==null?void 0:S.call(_)}).filter(_=>_!==null);if(w.length===0){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const _=(await Promise.all(w.map(T=>pV(T)))).flat(),S=w.some(T=>T.isDirectory);if(!S&&_.length===1&&_[0].file.name.toLowerCase().endsWith(".zip")){b(await GCe(_[0].file));return}if(!S){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const k=new Map(_.map(({file:T,path:C})=>[T,C]));b(await KCe(_.map(({file:T})=>T),k))}catch(_){s([`读取失败:${_ instanceof Error?_.message:String(_)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:v,onDragOver:E=>E.preventDefault(),onDragLeave:y,onDrop:E=>void x(E),children:[o.jsx(vk,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(E=>{var _;const w=f(E.folder||E.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Ia,{className:"cw-i cw-i-sm"}):o.jsx(Ni,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:E.name}),E.description&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((_=E.localFiles)==null?void 0:_.length)??0," 个文件"]})]})]},E.id)})})]})}function XCe(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function QCe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(""),[c,u]=g.useState(!0),[d,f]=g.useState(!1),[h,p]=g.useState(null);g.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const x=await LU();y||(s(x),x.length>0&&l(x[0].id))}catch(x){y||p(x instanceof Error?x.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),g.useEffect(()=>{if(!a){r([]);return}const y=n.find(E=>E.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const E=await DU(a,y==null?void 0:y.region);x||r(E)}catch(E){x||p(E instanceof Error?E.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(y=>y.id===a),b=(y,x)=>e.some(E=>E.source==="skillspace"&&E.skillId===y&&(E.version||"")===x),v=y=>{if(m)if(b(y.skillId,y.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===y.skillId&&(x.version||"")===y.version)));else{const x=tfe(m,y);t([...e,{source:"skillspace",folder:x.folder||y.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return o.jsx("div",{className:"cw-skillspace",children:c?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(fn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:h})]}):n.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:y=>l(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>o.jsxs("option",{value:y.id,children:[y.name||y.id,y.description?` — ${ec(y.description)}`:""]},y.id))}),m&&o.jsxs(o.Fragment,{children:[m.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:m.region,children:XCe(m.region)}),o.jsx("a",{href:nfe(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(xm,{className:"cw-i cw-i-sm"})})]})]}),d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(fn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):i.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:i.map(y=>{const x=b(y.skillId,y.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>v(y),"aria-pressed":x,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?o.jsx(Ia,{className:"cw-i cw-i-sm"}):o.jsx(Ni,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(y.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx($J,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function ZCe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Ln(void 0,rc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function JCe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await ZCe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function eIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Ln(void 0,rc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function tIe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await eIe(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const z3=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Ow(e){let t=0;for(let n=0;n>>0;return z3[t%z3.length]}function nIe(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,s=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):s.push(u);const i=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>r(f,d+1))}),a=s.sort(i).map(u=>r(u,0)),l=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:l,total:c-l||1}}function sIe(e,t){const n=[],s=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(s)};return e.forEach(s),n}function V3(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const iIe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function G3(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const s=String(n);return{key:iIe(t),value:s,long:s.length>80||s.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function mV({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let _;if(t)_=a8(t,n);else if(e)_=$y(e,n,s);else{u("缺少调用链路来源");return}_.then(S=>{l(S),p(S.length?S.reduce((k,T)=>k.start_time<=T.start_time?k:T).span_id:null)}).catch(S=>u(S instanceof Error?S.message:String(S)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>nIe(a??[]),[a]),y=g.useMemo(()=>sIe(m,d),[m,d]),x=(a==null?void 0:a.find(_=>_.span_id===h))??null,E=v/1e6,w=_=>f(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(ki,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(fn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(_=>{const S=_.span,k=(S.start_time-b)/v*100,T=Math.max((S.end_time-S.start_time)/v*100,.6),C=_.children.length>0;return o.jsxs("button",{className:`trace-row ${h===S.span_id?"active":""}`,onClick:()=>p(S.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:_.depth*14},children:[o.jsx("span",{className:`trace-caret ${C?"":"hidden"} ${d.has(S.span_id)?"":"open"}`,onClick:I=>{I.stopPropagation(),C&&w(S.span_id)},children:o.jsx(Ql,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:Ow(S.name)}}),o.jsx("span",{className:"trace-name",title:S.name,children:S.name})]}),o.jsx("span",{className:"trace-dur",children:V3(S.end_time-S.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${k}%`,width:`${T}%`,background:Ow(S.name)}})})]},S.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:Ow(x.name)}}),V3(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:G3(x).filter(_=>!_.long).map(_=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:_.key}),o.jsx("span",{className:"td-val",children:_.value})]},_.key))}),G3(x).filter(_=>_.long).map(_=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:_.key}),o.jsx("pre",{className:"td-pre",children:_.value})]},_.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const rIe=g.lazy(()=>Qc(()=>import("./MarkdownPromptEditor-BZqRO5xl.js"),__vite__mapDeps([0,1]))),NN="veadk.generatedAgentTestRuns",K3=4;function k2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(NN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function gV(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(NN,JSON.stringify(t)):window.sessionStorage.removeItem(NN)}catch{}}function aIe(e){gV([...k2(),e])}function Xh(e){gV(k2().filter(t=>t!==e))}function oIe(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const lIe=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Eee,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:ic,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:zJ},{id:"tools",label:"工具",hint:"可调用的能力",icon:fB},{id:"skills",label:"技能",hint:"声明式技能",icon:iu},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Ab},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:cB},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:PJ},{id:"review",label:"完成",hint:"预览并创建",icon:bee}];function cIe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function q3({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function bV({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function yV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const uIe={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},Y3={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},xV="REGISTRY_SPACE_ID",dIe=OU.filter(e=>e.key!==xV);function EV(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||_a.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||_a.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||_a.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function fIe({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(oV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function Mw({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function hIe(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Qh({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=g2(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(xm,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:hIe(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function Lw(e){return e.name.trim()||"未命名智能体中心"}function Dw(e){return e.name.trim()||e.id||"未命名知识库"}function pIe({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||_a.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let C=!1;return c(!0),d(null),JCe({region:i}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[i,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?Lw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",_=l&&r.length===0,S=g.useMemo(()=>r.filter(C=>yx(b,[Lw(C),C.id,C.projectName])),[b,r]),k=!!(e&&!x&&yx(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const C=j=>{const O=j.target;O instanceof Node&&y.current&&!y.current.contains(O)&&m(!1)},I=j=>{j.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const T=C=>{s(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:_,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(bV,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[k&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>T(e),children:"已选择的智能体中心"}),S.map(C=>{const I=Lw(C),j=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":j,className:`cw-a2a-space-option ${j?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>T(C.id),children:I},C.id)}),!k&&S.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(C=>C+1),children:l?o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(yV,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function mIe({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let S=!1;return r(!0),l(null),tIe().then(k=>{S||s(k)}).catch(k=>{S||(s([]),l(k instanceof Error?k.message:"加载失败"))}).finally(()=>{S||r(!1)}),()=>{S=!0}},[c]);const b=!e||n.some(S=>S.id===e.trim()),v=n.find(S=>S.id===e.trim()),y=v?Dw(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(S=>yx(h,[Dw(S),S.id,S.description,S.projectName])),[n,h]),w=!!(e&&!b&&yx(h,[e]));g.useEffect(()=>{if(!d)return;const S=T=>{const C=T.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},k=T=>{T.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",k)}},[d]);const _=S=>{t(S),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(S=>!S)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(bV,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:S=>p(S.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>_(e),children:e}),E.map(S=>{const k=Dw(S),T=S.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":T,className:`cw-a2a-space-option ${T?"is-selected":""}`,title:`${k} (${S.id})`,onClick:()=>_(S.id),children:k},S.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(S=>S+1),children:i?o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(yV,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function gIe({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(Io,{initial:!1,children:e.map((r,a)=>o.jsxs(ts.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(Zl,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),zke(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(ic,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:$ke(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?Hke(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(Ni,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function vV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function bIe({s:e,onRemove:t}){let n=iu,s="火山 Find Skill 技能广场";return e.source==="local"?(n=vk,s="本地"):e.source==="skillspace"&&(n=vV,s="AgentKit Skills 中心"),o.jsxs(ts.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${ec(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(ki,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Pw=[{id:"local",label:"本地文件",icon:vk},{id:"skillspace",label:"AgentKit Skills 中心",icon:vV},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Zx}];function yIe({selected:e,onChange:t}){const[n,s]=g.useState("local"),[i,r]=g.useState(!1),a=Pw.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>Bw(u)!==c));return g.useEffect(()=>{if(!i)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(Ni,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Io,{initial:!1,children:e.map(c=>o.jsx(bIe,{s:c,onRemove:()=>l(Bw(c))},Bw(c)))})})]}),o.jsx(Io,{children:i&&o.jsx(ts.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(ts.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>r(!1),children:o.jsx(ki,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Pw.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Pw.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>s(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx(BCe,{selected:e,onChange:t}),n==="local"&&o.jsx(WCe,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(QCe,{selected:e,onChange:t})]})]})]})})})]})}function Bw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function rb({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(ts.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function xIe(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function ab(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Lg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Lg(r[s],i,n),{...e,subAgents:r}}function EIe(e,t){return Lg(e,t,n=>({...n,subAgents:[...n.subAgents,Si()]}))}function vIe(e,t,n){return Lg(e,t,s=>{const i=s.subAgents.slice();return i.splice(n,0,Si()),{...s,subAgents:i}})}function wIe(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Lg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const TN=e=>!nE(e.agentType),W3=3;function SIe(e,t,n=!1){var i;if(nE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=zl(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":uV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function wV(e,t,n=[]){const s=[],i=nE(e.agentType),r=SIe(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:cV(e.agentType).label,problem:r}),TN(e)&&e.subAgents.forEach((a,l)=>s.push(...wV(a,t,[...n,l]))),s}function _Ie(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function SV(e){return 1+e.subAgents.reduce((t,n)=>t+SV(n),0)}function _V(e){const t=Y1(e),n=[],s={...t.envValues},i=a=>{var l,c,u,d;for(const f of a.builtinTools??[]){const h=wu.find(p=>p.id===f);h&&n.push({env:h.env})}for(const f of a.mcpTools??[])f.authTokenEnv&&n.push({env:[{key:f.authTokenEnv,required:!1,comment:`${f.name.trim()||"MCP"} Bearer Token`}]});if((l=a.a2aRegistry)!=null&&l.enabled&&(n.push({env:OU}),Object.assign(s,EV(a.a2aRegistry,{includeDefaults:!0}))),a.memory.shortTerm&&n.push({env:((c=D_.find(f=>f.id===(a.shortTermBackend??"local")))==null?void 0:c.env)??[]}),a.memory.longTerm&&n.push({env:((u=P_.find(f=>f.id===(a.longTermBackend??"local")))==null?void 0:u.env)??[]}),a.knowledgebase&&n.push({env:((d=B_.find(f=>f.id===(a.knowledgebaseBackend??uu)))==null?void 0:d.env)??[]}),a.tracing)for(const f of a.tracingExporters??[]){const h=Yde.find(p=>p.id===f);h&&n.push({env:h.env,enableFlag:h.enableFlag})}a.subAgents.forEach(i)};i(t.draft);const r=rz(n);return{specs:r.specs,fixedValues:{...r.fixedValues,...s}}}function NV(e){var n;return{...Y1(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function kN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=kN(s);if(i)return i}return""}function TV(e){var s,i;const t=_V(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...NV(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(az(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function NIe(e){return JSON.stringify(TV(e))}function xx(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Pd(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function TIe({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===xx(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),_=x.description.trim(),S=x.instruction.trim(),k=Pd(x),T=!!(w&&_&&S&&n.findIndex(P=>Pd(P)===k)!==E),C=!w||!_||!S||T,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==xx(s,x)),j=x.phase==="starting",O=x.phase==="ready"&&!I,z=j||x.phase==="sending",D=O&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=z||x.configOpen||C,A=w?_?S?T?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",M=j?"正在启动":I?"应用配置并重启":O||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(q3,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(bx,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):j?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(fn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:O?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(bx,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(XA,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(iH,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[O||I||x.phase==="error"?o.jsx(gee,{className:"cw-i"}):o.jsx(cIe,{className:"cw-i cw-debug-run-icon"}),M]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(q3,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:kV.map(P=>o.jsx(oV,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{QA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(fn,{className:"cw-i cw-spin"}):o.jsx(iB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(Ni,{className:"cw-i"}),"添加对照组"]})]})]})}const ob=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],kV=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function kIe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function AIe({mode:e,busy:t,onChange:n,assistant:s}){const i=ob.findIndex(l=>l.id===e),r=ob[i-1],a=ob[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:ob.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function CIe({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var _s,ii,jr,Rr,cc,Pi,ju,Da,re,Gt,jn,Be,Kt,us;const[h,p]=g.useState(()=>s??Si()),[m,b]=g.useState(""),[v,y]=g.useState(!1),[x,E]=g.useState(!1),[w,_]=g.useState(null),S=m.trim(),k=S.length>0&&S.length{O.current=d},[d]),g.useEffect(()=>{var ie;I!==C.current&&(C.current=I,(ie=O.current)==null||ie.call(O,h,j))},[h,j,I]);const[z,D]=g.useState("build"),[F,A]=g.useState(!1),[M,P]=g.useState(0),[$,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState((a==null?void 0:a.region)??l),K=(i==null?void 0:i.generatedAgentTestRun)===!0,V=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,q]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:kN(s??Si()),description:(s??Si()).description,instruction:(s??Si()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ue,me]=g.useState("baseline"),_e=g.useRef(1),de=g.useRef(!1),ge=g.useRef(new Map),[Me,ve]=g.useState(0),[ae,ke]=g.useState(""),[Se,Ze]=g.useState(null),[Le,Ve]=g.useState(!1),[Ne,Fe]=g.useState(!1),De=g.useRef(null),[qe,Q]=g.useState(""),[oe,ne]=g.useState(!1),[be,Ue]=g.useState(!1),[Ke,xt]=g.useState([]),ct=g.useRef(null),on=g.useRef({});async function Mt(){const ie=new Set([...ge.current.values()].map(({run:$e})=>$e.runId)),ye=k2().filter($e=>!ie.has($e));ye.length&&await Promise.all(ye.map(async $e=>{try{await id($e),Xh($e)}catch(tt){console.warn("清理遗留调试运行失败",tt)}}))}g.useEffect(()=>(Mt(),()=>{for(const{run:ie}of ge.current.values())id(ie.runId).then(()=>Xh(ie.runId)).catch(ye=>console.warn("清理调试运行失败",ye));ge.current.clear()}),[]),g.useEffect(()=>()=>{var ie;(ie=De.current)==null||ie.call(De,!1),De.current=null},[]);const Nt=g.useRef(null);Nt.current||(Nt.current=({meta:ie,children:ye})=>o.jsxs("section",{ref:$e=>{on.current[ie.id]=$e},id:`cw-sec-${ie.id}`,"data-step-id":ie.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:ie.label})}),o.jsx("div",{className:"cw-sec-body",children:ye})]}));const Pt=xIe(h,Ke)?Ke:[],Ge=ab(h,Pt),Vt=Pt.length===0,it=`cw-model-advanced-${Pt.join("-")||"root"}`,at=`cw-a2a-registry-advanced-${Pt.join("-")||"root"}`,We=ie=>p(ye=>Lg(ye,Pt,$e=>({...$e,...ie}))),St=(ie,ye)=>p($e=>{var tt;return{...$e,deployment:{...$e.deployment??{feishuEnabled:!1},envValues:{...((tt=$e.deployment)==null?void 0:tt.envValues)??{},[ie]:ye}}}}),xe=ie=>We({a2aRegistry:{...Ge.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...ie}}),Xe=(ie,ye)=>{if(!(ie in Y3))return;const $e=Y3[ie];xe({[$e]:ye}),St(ie,ye)},Et=ie=>{if(!(Vt&&ie==="a2a")){if(ie==="a2a"){We({agentType:ie,a2aRegistry:{...Ge.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}We({agentType:ie,a2aRegistry:Ge.a2aRegistry?{...Ge.a2aRegistry,enabled:!1}:void 0})}},nn=(ie,ye)=>{p(ie),ye&&xt(ye)},Bn=async()=>{const ie=m.trim();if(!(!ie||v)&&!(ie.length{const ye=ab(h,ie);if(!TN(ye)||ie.length>=W3)return;const $e=EIe(h,ie),tt=ab($e,ie).subAgents.length-1;nn($e,[...ie,tt])},mt=(ie,ye)=>{const $e=ab(h,ie);if(!TN($e)||ie.length>=W3)return;const tt=Math.max(0,Math.min(ye,$e.subAgents.length)),yn=vIe(h,ie,tt);nn(yn,[...ie,tt])},hn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(Si()),xt([]),A(!1))},Xt=ie=>{if(ie.length===0){hn();return}nn(wIe(h,ie),ie.slice(0,-1))},Tt=Ge.builtinTools??[],sn=Ge.mcpTools??[],rs=Ge.selectedSkills??[],As=ie=>We({builtinTools:Tt.includes(ie)?Tt.filter(ye=>ye!==ie):[...Tt,ie]}),kn=uV(Ge.agentType),Gn=nE(Ge.agentType),pn=g.useMemo(()=>K$(h),[h]),mn=Gn?null:zl(Ge.name)??(pn.has(Ge.name)?"Agent 名称在当前结构中必须唯一":null),Kn=mn!==null,$s=!Gn&&Ge.description.trim().length===0,gi=Ge.instruction.trim().length===0,bs=Gn&&!((_s=Ge.a2aRegistry)!=null&&_s.registrySpaceId.trim()),Qs=ie=>F&&ie?`is-error cw-error-shake-${M%2}`:"",An=g.useMemo(()=>wV(h,pn),[h,pn]),as=An.length===0,qn=g.useMemo(()=>NIe(h),[h]),os=W.find(ie=>ie.id===ue)??W[0],Cs=g.useMemo(()=>_V(h),[h]),Is=ie=>{var ye;(ye=on.current[ie])==null||ye.scrollIntoView({behavior:"smooth",block:"start"})},un=()=>as?!0:(A(!0),P(ie=>ie+1),An[0]&&(xt(An[0].path),window.requestAnimationFrame(()=>Is(An[0].problem==="缺少子 Agent"?"type":"basic"))),!1),Cn=async()=>{Ze(null);const ie=[...ge.current.values()];ge.current.clear(),ve(0),q(ye=>ye.map($e=>({...$e,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(ie.map(async({run:ye})=>{try{await id(ye.runId),Xh(ye.runId)}catch($e){console.warn("清理调试运行失败",$e)}}))},Un=async ie=>{const ye=ge.current.get(ie);if(ye){ge.current.delete(ie),ve(ge.current.size);try{await id(ye.run.runId),Xh(ye.run.runId)}catch($e){console.warn("清理调试运行失败",$e)}}},Fn=ie=>{const ye=ge.current.get(ie),$e=W.find(tt=>tt.id===ie);!ye||!$e||Ze({runId:ye.run.runId,sessionId:ye.sessionId,variantName:$e.name})},gn=ie=>{const ye=De.current;De.current=null,ye==null||ye(ie)},le=()=>{Ne||(Ve(!1),gn(!1))},Ie=async()=>{if(!Ne){Fe(!0);try{await Cn(),Ve(!1),gn(!0)}finally{Fe(!1)}}},pe=async()=>z!=="validate"||Me===0?!0:De.current?!1:new Promise(ie=>{De.current=ie,Ve(!0)}),et=async ie=>{var $e;if(!await pe())return;if(Q(""),!un()){D("build");return}const ye=oz(Cs.specs,(($e=h.deployment)==null?void 0:$e.envValues)??{});if(ye){Q(`${ye.spec.comment||ye.spec.key}:${ye.error}`),D("build");return}J(!0);try{const tt=ie?W.find(Rn=>Rn.id===ie):os;tt&&me(tt.id);const yn=tt?{...h,modelName:tt.modelName||h.modelName,description:tt.description,instruction:tt.instruction}:h,ys=await r1(NV(yn));yn!==h&&p(yn),R(ys),D("publish")}catch(tt){Q(tt instanceof Error?tt.message:String(tt))}finally{J(!1)}},nt=async ie=>{if(!K||Y||!un())return;const ye=W.find(rn=>rn.id===ie);if(!ye||ye.phase==="starting"||ye.phase==="sending")return;const $e=ye.modelName.trim(),tt=ye.description.trim(),yn=ye.instruction.trim(),ys=Pd(ye),Rn=W.findIndex(rn=>rn.id===ie),ri=W.findIndex(rn=>Pd(rn)===ys);if(!$e||!tt||!yn||ri!==Rn)return;const Wn=xx(qn,ye);q(rn=>rn.map(Zs=>Zs.id===ie?{...Zs,configOpen:!1,phase:"starting",messages:[],error:null}:Zs)),ke("");let Jt=null;try{await Un(ie),await Mt();const rn={...h,modelName:ye.modelName||h.modelName,description:ye.description,instruction:ye.instruction};Jt=await i8(TV(rn),a?{runtimeId:a.runtimeId,region:a.region}:void 0),aIe(Jt.runId);const Zs=await r8(Jt.runId,"test_user");ge.current.set(ie,{run:Jt,sessionId:Zs}),ve(ge.current.size),q(Bi=>Bi.map(el=>el.id===ie?{...el,phase:"ready",runtimeSnapshot:Wn}:el))}catch(rn){if(Jt)try{await id(Jt.runId),Xh(Jt.runId)}catch(Zs){console.warn("清理调试运行失败",Zs)}q(Zs=>Zs.map(Bi=>Bi.id===ie?{...Bi,phase:"error",runtimeSnapshot:"",error:rn instanceof Error?rn.message:String(rn)}:Bi))}},ut=async()=>{const ie=ae.trim(),ye=W.filter(tt=>tt.phase==="ready"&&tt.runtimeSnapshot===xx(qn,tt)&&ge.current.has(tt.id));if(!ie||ye.length===0)return;ke("");const $e=new Set(ye.map(tt=>tt.id));q(tt=>tt.map(yn=>$e.has(yn.id)?{...yn,phase:"sending",messages:[...yn.messages,{role:"user",content:ie},{role:"assistant",content:"",blocks:[]}]}:yn)),await Promise.all(ye.map(async tt=>{const yn=ge.current.get(tt.id);if(yn)try{let ys=va();for await(const Rn of o8({runId:yn.run.runId,userId:"test_user",sessionId:yn.sessionId,text:ie})){const ri=Rn.error||Rn.errorMessage||Rn.error_message;if(ri||(ys=pf(ys,Rn)),q(Wn=>Wn.map(Jt=>{if(Jt.id!==tt.id)return Jt;const rn=[...Jt.messages],Zs={...rn[rn.length-1]};return ri?Zs.error=String(ri):(Zs.content=ys.blocks.filter(Bi=>Bi.kind==="text").map(Bi=>Bi.text).join(""),Zs.blocks=ys.blocks),rn[rn.length-1]=Zs,{...Jt,messages:rn}})),ri)break}}catch(ys){q(Rn=>Rn.map(ri=>{if(ri.id!==tt.id)return ri;const Wn=[...ri.messages],Jt={...Wn[Wn.length-1]};return Jt.error=ys instanceof Error?ys.message:String(ys),Wn[Wn.length-1]=Jt,{...ri,messages:Wn}}))}finally{q(ys=>ys.map(Rn=>Rn.id===tt.id?{...Rn,phase:"ready"}:Rn))}}))},_t=()=>{q(ie=>{if(ie.length>=3)return ie;const ye=_e.current++,$e=`variant-${ye}`;return[...ie,{id:$e,name:`对照组 ${ye}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},In=async ie=>{await Un(ie),q(ye=>ye.filter($e=>$e.id!==ie)),ue===ie&&me("baseline")},bn=(ie,ye)=>q($e=>$e.map(tt=>tt.id===ie?{...tt,...ye}:tt)),ls=(ie,ye,$e)=>{ie==="baseline"&&ye==="modelName"&&(de.current=!0),bn(ie,{[ye]:$e}),!(ue!==ie||ie==="baseline")&&me("baseline")},js=ie=>{const ye=W.find(Wn=>Wn.id===ie);if(!ye)return;const $e=ye.modelName.trim(),tt=ye.description.trim(),yn=ye.instruction.trim(),ys=Pd(ye),Rn=W.findIndex(Wn=>Wn.id===ie),ri=W.findIndex(Wn=>Pd(Wn)===ys);if(!(!$e||!tt||!yn||ri!==Rn)){if(ie==="baseline"){bn(ie,{configOpen:!1});return}nt(ie)}},cs=async(ie,ye,$e)=>{var ys;const tt=(ys=h.deployment)==null?void 0:ys.network,yn=tt&&tt.mode&&tt.mode!=="public"?{mode:tt.mode,vpc_id:tt.vpcId,subnet_ids:tt.subnetIds,enable_shared_internet_access:tt.enableSharedInternetAccess}:void 0;return ug(ie.name,ie.files,{region:(a==null?void 0:a.region)??U,projectName:"default",network:yn},{...$e,onStage:ye,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Bt=()=>{un()&&(q(ie=>ie.map(ye=>ye.id==="baseline"&&!ge.current.has(ye.id)?{...ye,modelName:de.current?ye.modelName:kN(h),description:h.description,instruction:h.instruction}:ye)),D("validate"))},kt=async ie=>{if(ie==="publish"){if(!un())return;$?D("publish"):et();return}if(ie==="validate"){Bt();return}await pe()&&D(ie)},Yn=Nt.current,Rs=ie=>lIe.find(ye=>ye.id===ie),La=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Io,{initial:!1,mode:"wait",children:x?o.jsxs(ts.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(ts.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:ie=>{ie.preventDefault(),Bn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!k,"aria-describedby":k?"ai-requirement-error":void 0,onChange:ie=>b(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&(ie.preventDefault(),Bn())}}),o.jsx("button",{type:"submit",disabled:v||!S||!!k,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),k&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:k})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${z}`,children:[o.jsx(kIe,{mode:z}),qe&&o.jsx(bx,{className:"cw-workspace-alert",message:qe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[z==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(Rm,{draft:h,direction:"horizontal",selectedPath:Pt,onSelect:xt,onAdd:ot,onInsert:mt,onDelete:Xt}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:ct,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(Yn,{meta:Rs("type"),children:[o.jsx(SN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:Ge.agentType??"llm",onChange:Et,children:MCe.map(ie=>{const ye=(Ge.agentType??"llm")===ie.id,$e=Vt&&ie.id==="a2a",tt=$e?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":ie.id,className:`cw-agent-type-option ${ye?"is-on":""} ${$e?"is-disabled":""}`,tabIndex:$e?0:void 0,"aria-describedby":tt,children:[o.jsx(SN.Item,{value:ie.id,disabled:$e,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:uIe[ie.id]})})}),$e&&o.jsx("span",{id:tt,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},ie.id)})}),F&&kn&&Ge.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:_Ie({name:Ge.name.trim()||"未命名",typeLabel:cV(Ge.agentType).label})})]}),o.jsx(Yn,{meta:Rs("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Gn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Vt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Qs(Kn)}`,value:Ge.name,placeholder:"assistant",onChange:ie=>We({name:ie.target.value})}),F&&mn?o.jsx("span",{className:"cw-error-text",children:mn}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Vt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Qs($s)}`,value:Ge.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:ie=>We({description:ie.target.value})}),F&&$s?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Vt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),kn?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),Ge.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:Ge.maxIterations??3,onChange:ie=>We({maxIterations:Math.max(1,Number(ie.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Gn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(pIe,{value:((ii=Ge.a2aRegistry)==null?void 0:ii.registrySpaceId)??"",region:((jr=Ge.a2aRegistry)==null?void 0:jr.registryRegion)||_a.region,invalid:F&&bs,onChange:ie=>Xe(xV,ie)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":be,"aria-controls":at,onClick:()=>Ue(ie=>!ie),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${be?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Io,{initial:!1,children:be&&o.jsx(ts.div,{id:at,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:o.jsx(Qh,{env:dIe,values:EV(Ge.a2aRegistry,{includeDefaults:!1}),onChange:Xe})})}),F&&bs&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(rIe,{value:Ge.instruction,invalid:gi,onChange:ie=>We({instruction:ie})})}),F&&gi?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!kn&&!Gn&&o.jsxs(o.Fragment,{children:[o.jsx(Yn,{meta:Rs("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:Ge.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:ie=>We({modelName:ie.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":oe,"aria-controls":it,onClick:()=>ne(ie=>!ie),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${oe?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Io,{initial:!1,children:oe&&o.jsxs(ts.div,{id:it,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:Ge.modelProvider??"",placeholder:"openai",onChange:ie=>We({modelProvider:ie.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:Ge.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:ie=>We({modelApiBase:ie.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(Yn,{meta:Rs("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(fIe,{items:MU,selected:Tt,onToggle:As,scrollRows:6})}),o.jsx(Io,{initial:!1,children:Tt.includes("run_code")&&o.jsxs(ts.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(Qh,{env:((Rr=wu.find(ie=>ie.id==="run_code"))==null?void 0:Rr.env)??[],values:((cc=h.deployment)==null?void 0:cc.envValues)??{},onChange:St})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(gIe,{tools:sn,onChange:ie=>We({mcpTools:ie})})]})]})}),o.jsx(Yn,{meta:Rs("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(yIe,{selected:rs,onChange:ie=>We({selectedSkills:ie})})})}),o.jsx(Yn,{meta:Rs("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(rb,{checked:Ge.knowledgebase,onChange:ie=>We({knowledgebase:ie}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Ab}),Ge.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(Mw,{options:B_,value:Ge.knowledgebaseBackend,onChange:ie=>We({knowledgebaseBackend:ie,knowledgebaseIndex:ie==="viking"?Ge.knowledgebaseIndex:""})}),(Ge.knowledgebaseBackend??uu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(mIe,{value:Ge.knowledgebaseIndex??"",onChange:ie=>We({knowledgebaseIndex:ie})})]}),o.jsx(Qh,{env:((Pi=B_.find(ie=>ie.id===(Ge.knowledgebaseBackend??uu)))==null?void 0:Pi.env)??[],values:((ju=h.deployment)==null?void 0:ju.envValues)??{},onChange:St})]})]})}),Vt&&o.jsx(Yn,{meta:Rs("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(rb,{checked:Ge.memory.shortTerm,onChange:ie=>We({memory:{...Ge.memory,shortTerm:ie}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:cB}),Ge.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(Mw,{options:D_,value:Ge.shortTermBackend,onChange:ie=>We({shortTermBackend:ie})}),o.jsx(Qh,{env:((Da=D_.find(ie=>ie.id===(Ge.shortTermBackend??"local")))==null?void 0:Da.env)??[],values:((re=h.deployment)==null?void 0:re.envValues)??{},onChange:St})]}),o.jsx(rb,{checked:Ge.memory.longTerm,onChange:ie=>We({memory:{...Ge.memory,longTerm:ie}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Ab}),Ge.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(Mw,{options:P_,value:Ge.longTermBackend,onChange:ie=>We({longTermBackend:ie})}),o.jsx(Qh,{env:((Gt=P_.find(ie=>ie.id===(Ge.longTermBackend??"local")))==null?void 0:Gt.env)??[],values:((jn=h.deployment)==null?void 0:jn.envValues)??{},onChange:St}),o.jsx(rb,{checked:!!Ge.autoSaveSession,onChange:ie=>We({autoSaveSession:ie}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Ab})]})]})})]})]})})})})})]})}),z==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(TIe,{enabled:K,disabledReason:V,variants:W,draftSnapshot:qn,input:ae,onInput:ke,onSend:ut,onStartVariant:nt,onDeployVariant:ie=>void et(ie),onAddVariant:_t,onRemoveVariant:In,onToggleConfig:ie=>{const ye=W.find($e=>$e.id===ie);ye&&bn(ie,{configOpen:!ye.configOpen})},onCompleteConfig:js,onConfigChange:ls,onOpenTrace:Fn})})}),z==="publish"&&o.jsx("div",{className:"cw-preview-body",children:$?o.jsx(X1,{embedded:!0,project:$,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:SV(h),releaseConfiguration:os?{modelName:os.modelName||h.modelName||"默认模型",description:os.description,instruction:os.instruction,optimizations:os.optimizations.flatMap(ie=>{const ye=kV.find($e=>$e.id===ie);return ye?[ye.label]:[]})}:void 0,onChange:R,onDeploy:cs,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((Be=h.deployment)!=null&&Be.feishuEnabled),onFeishuEnabledChange:ie=>{const ye={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:ie}};p(ye)},deploymentEnv:Cs.specs,deploymentEnvValues:{...(Kt=h.deployment)==null?void 0:Kt.envValues,...Cs.fixedValues},onDeploymentEnvChange:St,network:(us=h.deployment)==null?void 0:us.network,onNetworkChange:ie=>p(ye=>({...ye,deployment:{...ye.deployment??{feishuEnabled:!1},network:ie}})),deployRegion:U,onDeployRegionChange:te,deploymentTelemetrySource:"custom_create",onExportYaml:()=>oIe(`${h.name||"agent"}.yaml`,Vke(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(fn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(AIe,{mode:z,busy:Y,onChange:kt,assistant:z==="build"?La:void 0}),Se&&o.jsx(mV,{testRunId:Se.runId,sessionId:Se.sessionId,title:`调用链路 · ${Se.variantName}`,onClose:()=>Ze(null)}),Le&&o.jsx(BA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:Ne?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:Ne,onCancel:le,onConfirm:()=>void Ie()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:ie=>ie.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function xo(e){return{...Si(),...e}}const IIe=[{id:"support",icon:tee,draft:xo({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:UJ,draft:xo({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:nee,draft:xo({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:xk,draft:xo({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:lee,draft:xo({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:_ee,draft:xo({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[xo({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),xo({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),xo({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function jIe(e){const t=[];return e.tools.length&&t.push({icon:fB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:BJ,label:"记忆"}),e.knowledgebase&&t.push({icon:DJ,label:"知识库"}),e.tracing&&t.push({icon:LJ,label:"观测"}),e.subAgents.length&&t.push({icon:dee,label:`子Agent ${e.subAgents.length}`}),t}function RIe({onBack:e,onCreate:t}){const[n,s]=g.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(MIe,{template:n,onBack:()=>s(null),onCreate:t}):o.jsx(OIe,{onPick:s})})}function OIe({onPick:e}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:IIe.map((t,n)=>o.jsxs(ts.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:ec(t.draft.description)})]},t.id))})]})}function MIe({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=jIe(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(bk,{className:"icon"})," 返回模板列表"]}),o.jsxs(ts.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:ec(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:LIe(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:ec(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(Ql,{className:"icon"})]})]})]})}function LIe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const DIe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:uB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:sB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Sk}];let AN=0;function Uw(){return AN+=1,`node_${AN}`}function Fw(e,t,n){const s=Si();return{id:e,type:"agentNode",position:t,data:{agent:{...s,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function PIe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Ri,{type:"target",position:Ye.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(su,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Ri,{type:"source",position:Ye.Right,className:"wfb-handle"})]})}const BIe={agentNode:PIe},X3={type:"smoothstep",markerEnd:{type:yf.ArrowClosed,width:16,height:16}};function UIe({onBack:e,onCreate:t}){const n=g.useRef(null),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState("sequential"),u=g.useMemo(()=>{AN=0;const A=Uw();return Fw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=J9([u]),[p,m,b]=eU([]),[v,y]=g.useState(u.id),x=d.find(A=>A.id===v)??null,E=s.trim()||"workflow_agent",w=g.useMemo(()=>K$({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),_=zl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),S=x?zl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=d.length>0&&_===null&&d.every(A=>zl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),T=g.useCallback(A=>m(M=>k9({...A,...X3},M)),[m]),C=g.useCallback(()=>{const A=Uw(),M=d.length*28,P=Fw(A,{x:80+M,y:120+M});f($=>$.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},j=g.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),O=g.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),$=Uw(),R=Fw($,P);f(Y=>Y.concat(R)),y($)},[f]),z=g.useCallback(A=>{v&&f(M=>M.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=g.useCallback(()=>{v&&(f(A=>A.filter(M=>M.id!==v)),m(A=>A.filter(M=>M.source!==v&&M.target!==v)),y(null))},[v,f,m]),F=g.useCallback(()=>{if(!k)return;const A=d.map(P=>P.data.agent),M={...Si(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(M)},[k,d,p,E,r,l,t]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:s,onChange:A=>i(A.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:DIe.map(({type:A,label:M,desc:P,Icon:$})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx($,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:M}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(eee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(su,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(Ni,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!k,type:"button",children:[o.jsx(iu,{className:"icon"}),"创建工作流"]}),o.jsxs(Z9,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:b,onConnect:T,onInit:A=>n.current=A,nodeTypes:BIe,defaultEdgeOptions:X3,onDrop:O,onDragOver:j,onNodeClick:(A,M)=>y(M.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(nU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(iU,{showInteractive:!1}),o.jsx(nce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:D,title:"删除节点",children:o.jsx(Zl,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${S?"wfb-input--error":""}`,value:x.data.agent.name,onChange:A=>z({name:A.target.value}),placeholder:"agent_name"}),S?o.jsx("span",{className:"wfb-field-error",children:S}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:A=>z({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:A=>z({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:A=>z({tools:A.target.value.split(",").map(M=>M.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(su,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function FIe(e){return o.jsx(iA,{children:o.jsx(UIe,{...e})})}const Q3=50*1024*1024,CN=800,$Ie={name:"code_package",files:[]};function HIe(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function zIe(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function VIe(e){const t=e.flatMap(a=>{const l=zIe(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>CN)throw new Error(`代码包文件数不能超过 ${CN} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function GIe({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,initialDeployRegion:r="cn-beijing"}){const a=g.useRef(null),l=g.useRef(0),[c,u]=g.useState(null),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(""),[w,_]=g.useState(r),[S,k]=g.useState();g.useEffect(()=>()=>{l.current+=1},[]);async function T(O){const z=++l.current;if(E(""),!O.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(O.size>Q3){E("代码包不能超过 50 MB。");return}b(!0);try{const D=await dV(new Uint8Array(await O.arrayBuffer()),{maxEntries:CN,maxUncompressedBytes:Q3}),F=VIe(D);if(z!==l.current)return;f(O.name),u({name:HIe(O.name),files:F})}catch(D){if(z!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{z===l.current&&b(!1)}}function C(O){var D;const z=(D=O.currentTarget.files)==null?void 0:D[0];O.currentTarget.value="",z&&T(z)}function I(O){var D;O.preventDefault(),y(!1);const z=(D=O.dataTransfer.files)==null?void 0:D[0];z&&T(z)}async function j(O,z,D){const F=S&&S.mode!=="public"?{mode:S.mode,vpc_id:S.vpcId,subnet_ids:S.subnetIds,enable_shared_internet_access:S.enableSharedInternetAccess}:void 0;return ug(O.name,O.files,{region:w,projectName:"default",network:F},{...D,onStage:z})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(X1,{project:c??$Ie,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:j,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:S,onNetworkChange:k,deployRegion:w,onDeployRegionChange:_,deploymentTelemetrySource:"code_package",onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:O=>{O.preventDefault(),y(!0)},onDragOver:O=>O.preventDefault(),onDragLeave:O=>{O.currentTarget.contains(O.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var O;m||(O=a.current)==null||O.click()},onKeyDown:O=>{var z;!m&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),(z=a.current)==null||z.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:O=>{O.stopPropagation(),p(!0)},onKeyDown:O=>O.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(dz,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const AV=1;function Ex(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KIe(e){return Ex(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&Ex(e.draft)}function sE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function qIe(e){var s;const t=Y1(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function CV(e){return{...e,draft:qIe(e.draft)}}function YIe(e){const t=Array.isArray(e)?e:Ex(e)&&e.version===AV?e.drafts:void 0;if(!Array.isArray(t)||!t.every(KIe))throw Ex(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(CV)}function WIe(e,t){if(!t)return[];const n=e.getItem(sE(t));if(!n)return[];try{return YIe(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function Z3(e,t,n){if(!t)return;const s={version:AV,drafts:n.map(CV)};try{e.setItem(sE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const XIe="/web/skill-creator";class A2 extends Error{constructor(n,s){super(n);pC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function Iu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function ps(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function IV(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function Dg(e,t){return fetch(_n(`${XIe}${e}`),{...t,headers:Jx({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function C2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=Iu(await e.json(),"错误响应");return ps(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function I2(e,t){if(!e.ok)throw new A2(await C2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function QIe(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function ZIe(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function JIe(e){return Array.isArray(e)?e.map((t,n)=>{const s=Iu(t,`文件 ${n+1}`),i=ps(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=IV(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function eje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function tje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=Iu(t,`活动 ${n+1}`),i=ps(s,"id"),r=ps(s,"kind"),a=ps(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=ps(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=ps(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function nje(e,t){const n=Iu(e,`候选方案 ${t+1}`),s=ps(n,"id","candidate_id","candidateId"),i=ps(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:ps(n,"modelLabel","model_label")??i,status:QIe(n.status),stage:ZIe(n.stage),name:ps(n,"name","skill_name","skillName"),description:ps(n,"description"),skillMd:ps(n,"skillMd","skill_md"),files:JIe(n.files),activities:tje(n.activities),validation:eje(n.validation),durationMs:IV(n,"elapsedMs","elapsed_ms"),error:ps(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:ps(n,"skill_id","skillId"),version:ps(n,"version")}}function IN(e,t=""){const n=Iu(e,"Skill 创建任务"),s=ps(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(nje):[],r=ps(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:ps(n,"prompt")??t,status:r,candidates:i}}async function sje(e,t){const n=await Dg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new A2(await C2(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=IN(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Iu(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(ps(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=IN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function mV({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let _;if(t)_=a8(t,n);else if(e)_=$y(e,n,s);else{u("缺少调用链路来源");return}_.then(S=>{l(S),p(S.length?S.reduce((k,T)=>k.start_time<=T.start_time?k:T).span_id:null)}).catch(S=>u(S instanceof Error?S.message:String(S)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>nIe(a??[]),[a]),y=g.useMemo(()=>sIe(m,d),[m,d]),x=(a==null?void 0:a.find(_=>_.span_id===h))??null,E=v/1e6,w=_=>f(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(ki,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(fn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(_=>{const S=_.span,k=(S.start_time-b)/v*100,T=Math.max((S.end_time-S.start_time)/v*100,.6),C=_.children.length>0;return o.jsxs("button",{className:`trace-row ${h===S.span_id?"active":""}`,onClick:()=>p(S.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:_.depth*14},children:[o.jsx("span",{className:`trace-caret ${C?"":"hidden"} ${d.has(S.span_id)?"":"open"}`,onClick:I=>{I.stopPropagation(),C&&w(S.span_id)},children:o.jsx(Ql,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:Ow(S.name)}}),o.jsx("span",{className:"trace-name",title:S.name,children:S.name})]}),o.jsx("span",{className:"trace-dur",children:V3(S.end_time-S.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${k}%`,width:`${T}%`,background:Ow(S.name)}})})]},S.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:Ow(x.name)}}),V3(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:G3(x).filter(_=>!_.long).map(_=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:_.key}),o.jsx("span",{className:"td-val",children:_.value})]},_.key))}),G3(x).filter(_=>_.long).map(_=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:_.key}),o.jsx("pre",{className:"td-pre",children:_.value})]},_.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const rIe=g.lazy(()=>Qc(()=>import("./MarkdownPromptEditor-DYqOUnwy.js"),__vite__mapDeps([0,1]))),NN="veadk.generatedAgentTestRuns",K3=4;function k2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(NN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function gV(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(NN,JSON.stringify(t)):window.sessionStorage.removeItem(NN)}catch{}}function aIe(e){gV([...k2(),e])}function Xh(e){gV(k2().filter(t=>t!==e))}function oIe(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const lIe=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Eee,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:ic,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:zJ},{id:"tools",label:"工具",hint:"可调用的能力",icon:fB},{id:"skills",label:"技能",hint:"声明式技能",icon:iu},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Ab},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:cB},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:PJ},{id:"review",label:"完成",hint:"预览并创建",icon:bee}];function cIe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function q3({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function bV({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function yV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const uIe={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},Y3={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},xV="REGISTRY_SPACE_ID",dIe=OU.filter(e=>e.key!==xV);function EV(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||_a.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||_a.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||_a.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function fIe({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(oV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function Mw({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function hIe(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Qh({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=g2(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(xm,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:hIe(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function Lw(e){return e.name.trim()||"未命名智能体中心"}function Dw(e){return e.name.trim()||e.id||"未命名知识库"}function pIe({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||_a.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let C=!1;return c(!0),d(null),JCe({region:i}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[i,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?Lw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",_=l&&r.length===0,S=g.useMemo(()=>r.filter(C=>yx(b,[Lw(C),C.id,C.projectName])),[b,r]),k=!!(e&&!x&&yx(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const C=j=>{const O=j.target;O instanceof Node&&y.current&&!y.current.contains(O)&&m(!1)},I=j=>{j.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const T=C=>{s(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:_,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(bV,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[k&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>T(e),children:"已选择的智能体中心"}),S.map(C=>{const I=Lw(C),j=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":j,className:`cw-a2a-space-option ${j?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>T(C.id),children:I},C.id)}),!k&&S.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(C=>C+1),children:l?o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(yV,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function mIe({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let S=!1;return r(!0),l(null),tIe().then(k=>{S||s(k)}).catch(k=>{S||(s([]),l(k instanceof Error?k.message:"加载失败"))}).finally(()=>{S||r(!1)}),()=>{S=!0}},[c]);const b=!e||n.some(S=>S.id===e.trim()),v=n.find(S=>S.id===e.trim()),y=v?Dw(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(S=>yx(h,[Dw(S),S.id,S.description,S.projectName])),[n,h]),w=!!(e&&!b&&yx(h,[e]));g.useEffect(()=>{if(!d)return;const S=T=>{const C=T.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},k=T=>{T.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",k)}},[d]);const _=S=>{t(S),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(S=>!S)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(bV,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:S=>p(S.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>_(e),children:e}),E.map(S=>{const k=Dw(S),T=S.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":T,className:`cw-a2a-space-option ${T?"is-selected":""}`,title:`${k} (${S.id})`,onClick:()=>_(S.id),children:k},S.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(S=>S+1),children:i?o.jsx(fn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(yV,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function gIe({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(Io,{initial:!1,children:e.map((r,a)=>o.jsxs(ts.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(Zl,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),zke(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(ic,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:$ke(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?Hke(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(Ni,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function vV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function bIe({s:e,onRemove:t}){let n=iu,s="火山 Find Skill 技能广场";return e.source==="local"?(n=vk,s="本地"):e.source==="skillspace"&&(n=vV,s="AgentKit Skills 中心"),o.jsxs(ts.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${ec(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(ki,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Pw=[{id:"local",label:"本地文件",icon:vk},{id:"skillspace",label:"AgentKit Skills 中心",icon:vV},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Zx}];function yIe({selected:e,onChange:t}){const[n,s]=g.useState("local"),[i,r]=g.useState(!1),a=Pw.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>Bw(u)!==c));return g.useEffect(()=>{if(!i)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(Ni,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Io,{initial:!1,children:e.map(c=>o.jsx(bIe,{s:c,onRemove:()=>l(Bw(c))},Bw(c)))})})]}),o.jsx(Io,{children:i&&o.jsx(ts.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(ts.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>r(!1),children:o.jsx(ki,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Pw.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Pw.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>s(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx(BCe,{selected:e,onChange:t}),n==="local"&&o.jsx(WCe,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(QCe,{selected:e,onChange:t})]})]})]})})})]})}function Bw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function rb({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(ts.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function xIe(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function ab(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Lg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Lg(r[s],i,n),{...e,subAgents:r}}function EIe(e,t){return Lg(e,t,n=>({...n,subAgents:[...n.subAgents,Si()]}))}function vIe(e,t,n){return Lg(e,t,s=>{const i=s.subAgents.slice();return i.splice(n,0,Si()),{...s,subAgents:i}})}function wIe(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Lg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const TN=e=>!nE(e.agentType),W3=3;function SIe(e,t,n=!1){var i;if(nE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=zl(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":uV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function wV(e,t,n=[]){const s=[],i=nE(e.agentType),r=SIe(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:cV(e.agentType).label,problem:r}),TN(e)&&e.subAgents.forEach((a,l)=>s.push(...wV(a,t,[...n,l]))),s}function _Ie(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function SV(e){return 1+e.subAgents.reduce((t,n)=>t+SV(n),0)}function _V(e){const t=Y1(e),n=[],s={...t.envValues},i=a=>{var l,c,u,d;for(const f of a.builtinTools??[]){const h=wu.find(p=>p.id===f);h&&n.push({env:h.env})}for(const f of a.mcpTools??[])f.authTokenEnv&&n.push({env:[{key:f.authTokenEnv,required:!1,comment:`${f.name.trim()||"MCP"} Bearer Token`}]});if((l=a.a2aRegistry)!=null&&l.enabled&&(n.push({env:OU}),Object.assign(s,EV(a.a2aRegistry,{includeDefaults:!0}))),a.memory.shortTerm&&n.push({env:((c=D_.find(f=>f.id===(a.shortTermBackend??"local")))==null?void 0:c.env)??[]}),a.memory.longTerm&&n.push({env:((u=P_.find(f=>f.id===(a.longTermBackend??"local")))==null?void 0:u.env)??[]}),a.knowledgebase&&n.push({env:((d=B_.find(f=>f.id===(a.knowledgebaseBackend??uu)))==null?void 0:d.env)??[]}),a.tracing)for(const f of a.tracingExporters??[]){const h=Yde.find(p=>p.id===f);h&&n.push({env:h.env,enableFlag:h.enableFlag})}a.subAgents.forEach(i)};i(t.draft);const r=rz(n);return{specs:r.specs,fixedValues:{...r.fixedValues,...s}}}function NV(e){var n;return{...Y1(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function kN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=kN(s);if(i)return i}return""}function TV(e){var s,i;const t=_V(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...NV(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(az(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function NIe(e){return JSON.stringify(TV(e))}function xx(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Pd(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function TIe({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===xx(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),_=x.description.trim(),S=x.instruction.trim(),k=Pd(x),T=!!(w&&_&&S&&n.findIndex(P=>Pd(P)===k)!==E),C=!w||!_||!S||T,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==xx(s,x)),j=x.phase==="starting",O=x.phase==="ready"&&!I,z=j||x.phase==="sending",D=O&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=z||x.configOpen||C,A=w?_?S?T?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",M=j?"正在启动":I?"应用配置并重启":O||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(q3,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(bx,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):j?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(fn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:O?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(bx,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(XA,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(iH,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[O||I||x.phase==="error"?o.jsx(gee,{className:"cw-i"}):o.jsx(cIe,{className:"cw-i cw-debug-run-icon"}),M]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(q3,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:kV.map(P=>o.jsx(oV,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{QA(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(fn,{className:"cw-i cw-spin"}):o.jsx(iB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(Ni,{className:"cw-i"}),"添加对照组"]})]})]})}const ob=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],kV=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function kIe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function AIe({mode:e,busy:t,onChange:n,assistant:s}){const i=ob.findIndex(l=>l.id===e),r=ob[i-1],a=ob[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:ob.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function CIe({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var _s,ii,jr,Rr,cc,Pi,ju,Da,re,Gt,jn,Be,Kt,us;const[h,p]=g.useState(()=>s??Si()),[m,b]=g.useState(""),[v,y]=g.useState(!1),[x,E]=g.useState(!1),[w,_]=g.useState(null),S=m.trim(),k=S.length>0&&S.length{O.current=d},[d]),g.useEffect(()=>{var ie;I!==C.current&&(C.current=I,(ie=O.current)==null||ie.call(O,h,j))},[h,j,I]);const[z,D]=g.useState("build"),[F,A]=g.useState(!1),[M,P]=g.useState(0),[$,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState((a==null?void 0:a.region)??l),K=(i==null?void 0:i.generatedAgentTestRun)===!0,V=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,q]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:kN(s??Si()),description:(s??Si()).description,instruction:(s??Si()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ue,me]=g.useState("baseline"),_e=g.useRef(1),de=g.useRef(!1),ge=g.useRef(new Map),[Me,ve]=g.useState(0),[ae,ke]=g.useState(""),[Se,Ze]=g.useState(null),[Le,Ve]=g.useState(!1),[Ne,Fe]=g.useState(!1),De=g.useRef(null),[qe,Q]=g.useState(""),[oe,ne]=g.useState(!1),[be,Ue]=g.useState(!1),[Ke,xt]=g.useState([]),ct=g.useRef(null),on=g.useRef({});async function Mt(){const ie=new Set([...ge.current.values()].map(({run:$e})=>$e.runId)),ye=k2().filter($e=>!ie.has($e));ye.length&&await Promise.all(ye.map(async $e=>{try{await id($e),Xh($e)}catch(tt){console.warn("清理遗留调试运行失败",tt)}}))}g.useEffect(()=>(Mt(),()=>{for(const{run:ie}of ge.current.values())id(ie.runId).then(()=>Xh(ie.runId)).catch(ye=>console.warn("清理调试运行失败",ye));ge.current.clear()}),[]),g.useEffect(()=>()=>{var ie;(ie=De.current)==null||ie.call(De,!1),De.current=null},[]);const Nt=g.useRef(null);Nt.current||(Nt.current=({meta:ie,children:ye})=>o.jsxs("section",{ref:$e=>{on.current[ie.id]=$e},id:`cw-sec-${ie.id}`,"data-step-id":ie.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:ie.label})}),o.jsx("div",{className:"cw-sec-body",children:ye})]}));const Pt=xIe(h,Ke)?Ke:[],Ge=ab(h,Pt),Vt=Pt.length===0,it=`cw-model-advanced-${Pt.join("-")||"root"}`,at=`cw-a2a-registry-advanced-${Pt.join("-")||"root"}`,We=ie=>p(ye=>Lg(ye,Pt,$e=>({...$e,...ie}))),St=(ie,ye)=>p($e=>{var tt;return{...$e,deployment:{...$e.deployment??{feishuEnabled:!1},envValues:{...((tt=$e.deployment)==null?void 0:tt.envValues)??{},[ie]:ye}}}}),xe=ie=>We({a2aRegistry:{...Ge.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...ie}}),Xe=(ie,ye)=>{if(!(ie in Y3))return;const $e=Y3[ie];xe({[$e]:ye}),St(ie,ye)},Et=ie=>{if(!(Vt&&ie==="a2a")){if(ie==="a2a"){We({agentType:ie,a2aRegistry:{...Ge.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}We({agentType:ie,a2aRegistry:Ge.a2aRegistry?{...Ge.a2aRegistry,enabled:!1}:void 0})}},nn=(ie,ye)=>{p(ie),ye&&xt(ye)},Bn=async()=>{const ie=m.trim();if(!(!ie||v)&&!(ie.length{const ye=ab(h,ie);if(!TN(ye)||ie.length>=W3)return;const $e=EIe(h,ie),tt=ab($e,ie).subAgents.length-1;nn($e,[...ie,tt])},mt=(ie,ye)=>{const $e=ab(h,ie);if(!TN($e)||ie.length>=W3)return;const tt=Math.max(0,Math.min(ye,$e.subAgents.length)),yn=vIe(h,ie,tt);nn(yn,[...ie,tt])},hn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(Si()),xt([]),A(!1))},Xt=ie=>{if(ie.length===0){hn();return}nn(wIe(h,ie),ie.slice(0,-1))},Tt=Ge.builtinTools??[],sn=Ge.mcpTools??[],rs=Ge.selectedSkills??[],As=ie=>We({builtinTools:Tt.includes(ie)?Tt.filter(ye=>ye!==ie):[...Tt,ie]}),kn=uV(Ge.agentType),Gn=nE(Ge.agentType),pn=g.useMemo(()=>K$(h),[h]),mn=Gn?null:zl(Ge.name)??(pn.has(Ge.name)?"Agent 名称在当前结构中必须唯一":null),Kn=mn!==null,$s=!Gn&&Ge.description.trim().length===0,gi=Ge.instruction.trim().length===0,bs=Gn&&!((_s=Ge.a2aRegistry)!=null&&_s.registrySpaceId.trim()),Qs=ie=>F&&ie?`is-error cw-error-shake-${M%2}`:"",An=g.useMemo(()=>wV(h,pn),[h,pn]),as=An.length===0,qn=g.useMemo(()=>NIe(h),[h]),os=W.find(ie=>ie.id===ue)??W[0],Cs=g.useMemo(()=>_V(h),[h]),Is=ie=>{var ye;(ye=on.current[ie])==null||ye.scrollIntoView({behavior:"smooth",block:"start"})},un=()=>as?!0:(A(!0),P(ie=>ie+1),An[0]&&(xt(An[0].path),window.requestAnimationFrame(()=>Is(An[0].problem==="缺少子 Agent"?"type":"basic"))),!1),Cn=async()=>{Ze(null);const ie=[...ge.current.values()];ge.current.clear(),ve(0),q(ye=>ye.map($e=>({...$e,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(ie.map(async({run:ye})=>{try{await id(ye.runId),Xh(ye.runId)}catch($e){console.warn("清理调试运行失败",$e)}}))},Un=async ie=>{const ye=ge.current.get(ie);if(ye){ge.current.delete(ie),ve(ge.current.size);try{await id(ye.run.runId),Xh(ye.run.runId)}catch($e){console.warn("清理调试运行失败",$e)}}},Fn=ie=>{const ye=ge.current.get(ie),$e=W.find(tt=>tt.id===ie);!ye||!$e||Ze({runId:ye.run.runId,sessionId:ye.sessionId,variantName:$e.name})},gn=ie=>{const ye=De.current;De.current=null,ye==null||ye(ie)},le=()=>{Ne||(Ve(!1),gn(!1))},Ie=async()=>{if(!Ne){Fe(!0);try{await Cn(),Ve(!1),gn(!0)}finally{Fe(!1)}}},pe=async()=>z!=="validate"||Me===0?!0:De.current?!1:new Promise(ie=>{De.current=ie,Ve(!0)}),et=async ie=>{var $e;if(!await pe())return;if(Q(""),!un()){D("build");return}const ye=oz(Cs.specs,(($e=h.deployment)==null?void 0:$e.envValues)??{});if(ye){Q(`${ye.spec.comment||ye.spec.key}:${ye.error}`),D("build");return}J(!0);try{const tt=ie?W.find(Rn=>Rn.id===ie):os;tt&&me(tt.id);const yn=tt?{...h,modelName:tt.modelName||h.modelName,description:tt.description,instruction:tt.instruction}:h,ys=await r1(NV(yn));yn!==h&&p(yn),R(ys),D("publish")}catch(tt){Q(tt instanceof Error?tt.message:String(tt))}finally{J(!1)}},nt=async ie=>{if(!K||Y||!un())return;const ye=W.find(rn=>rn.id===ie);if(!ye||ye.phase==="starting"||ye.phase==="sending")return;const $e=ye.modelName.trim(),tt=ye.description.trim(),yn=ye.instruction.trim(),ys=Pd(ye),Rn=W.findIndex(rn=>rn.id===ie),ri=W.findIndex(rn=>Pd(rn)===ys);if(!$e||!tt||!yn||ri!==Rn)return;const Wn=xx(qn,ye);q(rn=>rn.map(Zs=>Zs.id===ie?{...Zs,configOpen:!1,phase:"starting",messages:[],error:null}:Zs)),ke("");let Jt=null;try{await Un(ie),await Mt();const rn={...h,modelName:ye.modelName||h.modelName,description:ye.description,instruction:ye.instruction};Jt=await i8(TV(rn),a?{runtimeId:a.runtimeId,region:a.region}:void 0),aIe(Jt.runId);const Zs=await r8(Jt.runId,"test_user");ge.current.set(ie,{run:Jt,sessionId:Zs}),ve(ge.current.size),q(Bi=>Bi.map(el=>el.id===ie?{...el,phase:"ready",runtimeSnapshot:Wn}:el))}catch(rn){if(Jt)try{await id(Jt.runId),Xh(Jt.runId)}catch(Zs){console.warn("清理调试运行失败",Zs)}q(Zs=>Zs.map(Bi=>Bi.id===ie?{...Bi,phase:"error",runtimeSnapshot:"",error:rn instanceof Error?rn.message:String(rn)}:Bi))}},ut=async()=>{const ie=ae.trim(),ye=W.filter(tt=>tt.phase==="ready"&&tt.runtimeSnapshot===xx(qn,tt)&&ge.current.has(tt.id));if(!ie||ye.length===0)return;ke("");const $e=new Set(ye.map(tt=>tt.id));q(tt=>tt.map(yn=>$e.has(yn.id)?{...yn,phase:"sending",messages:[...yn.messages,{role:"user",content:ie},{role:"assistant",content:"",blocks:[]}]}:yn)),await Promise.all(ye.map(async tt=>{const yn=ge.current.get(tt.id);if(yn)try{let ys=va();for await(const Rn of o8({runId:yn.run.runId,userId:"test_user",sessionId:yn.sessionId,text:ie})){const ri=Rn.error||Rn.errorMessage||Rn.error_message;if(ri||(ys=pf(ys,Rn)),q(Wn=>Wn.map(Jt=>{if(Jt.id!==tt.id)return Jt;const rn=[...Jt.messages],Zs={...rn[rn.length-1]};return ri?Zs.error=String(ri):(Zs.content=ys.blocks.filter(Bi=>Bi.kind==="text").map(Bi=>Bi.text).join(""),Zs.blocks=ys.blocks),rn[rn.length-1]=Zs,{...Jt,messages:rn}})),ri)break}}catch(ys){q(Rn=>Rn.map(ri=>{if(ri.id!==tt.id)return ri;const Wn=[...ri.messages],Jt={...Wn[Wn.length-1]};return Jt.error=ys instanceof Error?ys.message:String(ys),Wn[Wn.length-1]=Jt,{...ri,messages:Wn}}))}finally{q(ys=>ys.map(Rn=>Rn.id===tt.id?{...Rn,phase:"ready"}:Rn))}}))},_t=()=>{q(ie=>{if(ie.length>=3)return ie;const ye=_e.current++,$e=`variant-${ye}`;return[...ie,{id:$e,name:`对照组 ${ye}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},In=async ie=>{await Un(ie),q(ye=>ye.filter($e=>$e.id!==ie)),ue===ie&&me("baseline")},bn=(ie,ye)=>q($e=>$e.map(tt=>tt.id===ie?{...tt,...ye}:tt)),ls=(ie,ye,$e)=>{ie==="baseline"&&ye==="modelName"&&(de.current=!0),bn(ie,{[ye]:$e}),!(ue!==ie||ie==="baseline")&&me("baseline")},js=ie=>{const ye=W.find(Wn=>Wn.id===ie);if(!ye)return;const $e=ye.modelName.trim(),tt=ye.description.trim(),yn=ye.instruction.trim(),ys=Pd(ye),Rn=W.findIndex(Wn=>Wn.id===ie),ri=W.findIndex(Wn=>Pd(Wn)===ys);if(!(!$e||!tt||!yn||ri!==Rn)){if(ie==="baseline"){bn(ie,{configOpen:!1});return}nt(ie)}},cs=async(ie,ye,$e)=>{var ys;const tt=(ys=h.deployment)==null?void 0:ys.network,yn=tt&&tt.mode&&tt.mode!=="public"?{mode:tt.mode,vpc_id:tt.vpcId,subnet_ids:tt.subnetIds,enable_shared_internet_access:tt.enableSharedInternetAccess}:void 0;return ug(ie.name,ie.files,{region:(a==null?void 0:a.region)??U,projectName:"default",network:yn},{...$e,onStage:ye,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Bt=()=>{un()&&(q(ie=>ie.map(ye=>ye.id==="baseline"&&!ge.current.has(ye.id)?{...ye,modelName:de.current?ye.modelName:kN(h),description:h.description,instruction:h.instruction}:ye)),D("validate"))},kt=async ie=>{if(ie==="publish"){if(!un())return;$?D("publish"):et();return}if(ie==="validate"){Bt();return}await pe()&&D(ie)},Yn=Nt.current,Rs=ie=>lIe.find(ye=>ye.id===ie),La=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Io,{initial:!1,mode:"wait",children:x?o.jsxs(ts.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(ts.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:ie=>{ie.preventDefault(),Bn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!k,"aria-describedby":k?"ai-requirement-error":void 0,onChange:ie=>b(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&(ie.preventDefault(),Bn())}}),o.jsx("button",{type:"submit",disabled:v||!S||!!k,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),k&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:k})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${z}`,children:[o.jsx(kIe,{mode:z}),qe&&o.jsx(bx,{className:"cw-workspace-alert",message:qe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[z==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(Rm,{draft:h,direction:"horizontal",selectedPath:Pt,onSelect:xt,onAdd:ot,onInsert:mt,onDelete:Xt}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:ct,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(Yn,{meta:Rs("type"),children:[o.jsx(SN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:Ge.agentType??"llm",onChange:Et,children:MCe.map(ie=>{const ye=(Ge.agentType??"llm")===ie.id,$e=Vt&&ie.id==="a2a",tt=$e?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":ie.id,className:`cw-agent-type-option ${ye?"is-on":""} ${$e?"is-disabled":""}`,tabIndex:$e?0:void 0,"aria-describedby":tt,children:[o.jsx(SN.Item,{value:ie.id,disabled:$e,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:uIe[ie.id]})})}),$e&&o.jsx("span",{id:tt,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},ie.id)})}),F&&kn&&Ge.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:_Ie({name:Ge.name.trim()||"未命名",typeLabel:cV(Ge.agentType).label})})]}),o.jsx(Yn,{meta:Rs("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Gn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Vt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Qs(Kn)}`,value:Ge.name,placeholder:"assistant",onChange:ie=>We({name:ie.target.value})}),F&&mn?o.jsx("span",{className:"cw-error-text",children:mn}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Vt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Qs($s)}`,value:Ge.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:ie=>We({description:ie.target.value})}),F&&$s?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Vt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),kn?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),Ge.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:Ge.maxIterations??3,onChange:ie=>We({maxIterations:Math.max(1,Number(ie.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Gn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(pIe,{value:((ii=Ge.a2aRegistry)==null?void 0:ii.registrySpaceId)??"",region:((jr=Ge.a2aRegistry)==null?void 0:jr.registryRegion)||_a.region,invalid:F&&bs,onChange:ie=>Xe(xV,ie)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":be,"aria-controls":at,onClick:()=>Ue(ie=>!ie),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${be?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Io,{initial:!1,children:be&&o.jsx(ts.div,{id:at,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:o.jsx(Qh,{env:dIe,values:EV(Ge.a2aRegistry,{includeDefaults:!1}),onChange:Xe})})}),F&&bs&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(rIe,{value:Ge.instruction,invalid:gi,onChange:ie=>We({instruction:ie})})}),F&&gi?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!kn&&!Gn&&o.jsxs(o.Fragment,{children:[o.jsx(Yn,{meta:Rs("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:Ge.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:ie=>We({modelName:ie.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":oe,"aria-controls":it,onClick:()=>ne(ie=>!ie),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${oe?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Io,{initial:!1,children:oe&&o.jsxs(ts.div,{id:it,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:Ge.modelProvider??"",placeholder:"openai",onChange:ie=>We({modelProvider:ie.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:Ge.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:ie=>We({modelApiBase:ie.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(Yn,{meta:Rs("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(fIe,{items:MU,selected:Tt,onToggle:As,scrollRows:6})}),o.jsx(Io,{initial:!1,children:Tt.includes("run_code")&&o.jsxs(ts.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(Qh,{env:((Rr=wu.find(ie=>ie.id==="run_code"))==null?void 0:Rr.env)??[],values:((cc=h.deployment)==null?void 0:cc.envValues)??{},onChange:St})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(gIe,{tools:sn,onChange:ie=>We({mcpTools:ie})})]})]})}),o.jsx(Yn,{meta:Rs("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(yIe,{selected:rs,onChange:ie=>We({selectedSkills:ie})})})}),o.jsx(Yn,{meta:Rs("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(rb,{checked:Ge.knowledgebase,onChange:ie=>We({knowledgebase:ie}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Ab}),Ge.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(Mw,{options:B_,value:Ge.knowledgebaseBackend,onChange:ie=>We({knowledgebaseBackend:ie,knowledgebaseIndex:ie==="viking"?Ge.knowledgebaseIndex:""})}),(Ge.knowledgebaseBackend??uu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(mIe,{value:Ge.knowledgebaseIndex??"",onChange:ie=>We({knowledgebaseIndex:ie})})]}),o.jsx(Qh,{env:((Pi=B_.find(ie=>ie.id===(Ge.knowledgebaseBackend??uu)))==null?void 0:Pi.env)??[],values:((ju=h.deployment)==null?void 0:ju.envValues)??{},onChange:St})]})]})}),Vt&&o.jsx(Yn,{meta:Rs("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(rb,{checked:Ge.memory.shortTerm,onChange:ie=>We({memory:{...Ge.memory,shortTerm:ie}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:cB}),Ge.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(Mw,{options:D_,value:Ge.shortTermBackend,onChange:ie=>We({shortTermBackend:ie})}),o.jsx(Qh,{env:((Da=D_.find(ie=>ie.id===(Ge.shortTermBackend??"local")))==null?void 0:Da.env)??[],values:((re=h.deployment)==null?void 0:re.envValues)??{},onChange:St})]}),o.jsx(rb,{checked:Ge.memory.longTerm,onChange:ie=>We({memory:{...Ge.memory,longTerm:ie}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Ab}),Ge.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(Mw,{options:P_,value:Ge.longTermBackend,onChange:ie=>We({longTermBackend:ie})}),o.jsx(Qh,{env:((Gt=P_.find(ie=>ie.id===(Ge.longTermBackend??"local")))==null?void 0:Gt.env)??[],values:((jn=h.deployment)==null?void 0:jn.envValues)??{},onChange:St}),o.jsx(rb,{checked:!!Ge.autoSaveSession,onChange:ie=>We({autoSaveSession:ie}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Ab})]})]})})]})]})})})})})]})}),z==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(TIe,{enabled:K,disabledReason:V,variants:W,draftSnapshot:qn,input:ae,onInput:ke,onSend:ut,onStartVariant:nt,onDeployVariant:ie=>void et(ie),onAddVariant:_t,onRemoveVariant:In,onToggleConfig:ie=>{const ye=W.find($e=>$e.id===ie);ye&&bn(ie,{configOpen:!ye.configOpen})},onCompleteConfig:js,onConfigChange:ls,onOpenTrace:Fn})})}),z==="publish"&&o.jsx("div",{className:"cw-preview-body",children:$?o.jsx(X1,{embedded:!0,project:$,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:SV(h),releaseConfiguration:os?{modelName:os.modelName||h.modelName||"默认模型",description:os.description,instruction:os.instruction,optimizations:os.optimizations.flatMap(ie=>{const ye=kV.find($e=>$e.id===ie);return ye?[ye.label]:[]})}:void 0,onChange:R,onDeploy:cs,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((Be=h.deployment)!=null&&Be.feishuEnabled),onFeishuEnabledChange:ie=>{const ye={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:ie}};p(ye)},deploymentEnv:Cs.specs,deploymentEnvValues:{...(Kt=h.deployment)==null?void 0:Kt.envValues,...Cs.fixedValues},onDeploymentEnvChange:St,network:(us=h.deployment)==null?void 0:us.network,onNetworkChange:ie=>p(ye=>({...ye,deployment:{...ye.deployment??{feishuEnabled:!1},network:ie}})),deployRegion:U,onDeployRegionChange:te,deploymentTelemetrySource:"custom_create",onExportYaml:()=>oIe(`${h.name||"agent"}.yaml`,Vke(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(fn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(AIe,{mode:z,busy:Y,onChange:kt,assistant:z==="build"?La:void 0}),Se&&o.jsx(mV,{testRunId:Se.runId,sessionId:Se.sessionId,title:`调用链路 · ${Se.variantName}`,onClose:()=>Ze(null)}),Le&&o.jsx(BA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:Ne?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:Ne,onCancel:le,onConfirm:()=>void Ie()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:ie=>ie.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function xo(e){return{...Si(),...e}}const IIe=[{id:"support",icon:tee,draft:xo({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:UJ,draft:xo({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:nee,draft:xo({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:xk,draft:xo({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:lee,draft:xo({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:_ee,draft:xo({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[xo({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),xo({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),xo({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function jIe(e){const t=[];return e.tools.length&&t.push({icon:fB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:BJ,label:"记忆"}),e.knowledgebase&&t.push({icon:DJ,label:"知识库"}),e.tracing&&t.push({icon:LJ,label:"观测"}),e.subAgents.length&&t.push({icon:dee,label:`子Agent ${e.subAgents.length}`}),t}function RIe({onBack:e,onCreate:t}){const[n,s]=g.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(MIe,{template:n,onBack:()=>s(null),onCreate:t}):o.jsx(OIe,{onPick:s})})}function OIe({onPick:e}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:IIe.map((t,n)=>o.jsxs(ts.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:ec(t.draft.description)})]},t.id))})]})}function MIe({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=jIe(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(bk,{className:"icon"})," 返回模板列表"]}),o.jsxs(ts.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:ec(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:LIe(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:ec(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(Ql,{className:"icon"})]})]})]})}function LIe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const DIe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:uB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:sB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Sk}];let AN=0;function Uw(){return AN+=1,`node_${AN}`}function Fw(e,t,n){const s=Si();return{id:e,type:"agentNode",position:t,data:{agent:{...s,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function PIe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Ri,{type:"target",position:Ye.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(su,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Ri,{type:"source",position:Ye.Right,className:"wfb-handle"})]})}const BIe={agentNode:PIe},X3={type:"smoothstep",markerEnd:{type:yf.ArrowClosed,width:16,height:16}};function UIe({onBack:e,onCreate:t}){const n=g.useRef(null),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState("sequential"),u=g.useMemo(()=>{AN=0;const A=Uw();return Fw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=J9([u]),[p,m,b]=eU([]),[v,y]=g.useState(u.id),x=d.find(A=>A.id===v)??null,E=s.trim()||"workflow_agent",w=g.useMemo(()=>K$({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),_=zl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),S=x?zl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=d.length>0&&_===null&&d.every(A=>zl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),T=g.useCallback(A=>m(M=>k9({...A,...X3},M)),[m]),C=g.useCallback(()=>{const A=Uw(),M=d.length*28,P=Fw(A,{x:80+M,y:120+M});f($=>$.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},j=g.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),O=g.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),$=Uw(),R=Fw($,P);f(Y=>Y.concat(R)),y($)},[f]),z=g.useCallback(A=>{v&&f(M=>M.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=g.useCallback(()=>{v&&(f(A=>A.filter(M=>M.id!==v)),m(A=>A.filter(M=>M.source!==v&&M.target!==v)),y(null))},[v,f,m]),F=g.useCallback(()=>{if(!k)return;const A=d.map(P=>P.data.agent),M={...Si(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(M)},[k,d,p,E,r,l,t]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:s,onChange:A=>i(A.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:DIe.map(({type:A,label:M,desc:P,Icon:$})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx($,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:M}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(eee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(su,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(Ni,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!k,type:"button",children:[o.jsx(iu,{className:"icon"}),"创建工作流"]}),o.jsxs(Z9,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:b,onConnect:T,onInit:A=>n.current=A,nodeTypes:BIe,defaultEdgeOptions:X3,onDrop:O,onDragOver:j,onNodeClick:(A,M)=>y(M.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(nU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(iU,{showInteractive:!1}),o.jsx(nce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:D,title:"删除节点",children:o.jsx(Zl,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${S?"wfb-input--error":""}`,value:x.data.agent.name,onChange:A=>z({name:A.target.value}),placeholder:"agent_name"}),S?o.jsx("span",{className:"wfb-field-error",children:S}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:A=>z({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:A=>z({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:A=>z({tools:A.target.value.split(",").map(M=>M.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(su,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function FIe(e){return o.jsx(iA,{children:o.jsx(UIe,{...e})})}const Q3=50*1024*1024,CN=800,$Ie={name:"code_package",files:[]};function HIe(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function zIe(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function VIe(e){const t=e.flatMap(a=>{const l=zIe(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>CN)throw new Error(`代码包文件数不能超过 ${CN} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function GIe({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,initialDeployRegion:r="cn-beijing"}){const a=g.useRef(null),l=g.useRef(0),[c,u]=g.useState(null),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(""),[w,_]=g.useState(r),[S,k]=g.useState();g.useEffect(()=>()=>{l.current+=1},[]);async function T(O){const z=++l.current;if(E(""),!O.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(O.size>Q3){E("代码包不能超过 50 MB。");return}b(!0);try{const D=await dV(new Uint8Array(await O.arrayBuffer()),{maxEntries:CN,maxUncompressedBytes:Q3}),F=VIe(D);if(z!==l.current)return;f(O.name),u({name:HIe(O.name),files:F})}catch(D){if(z!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{z===l.current&&b(!1)}}function C(O){var D;const z=(D=O.currentTarget.files)==null?void 0:D[0];O.currentTarget.value="",z&&T(z)}function I(O){var D;O.preventDefault(),y(!1);const z=(D=O.dataTransfer.files)==null?void 0:D[0];z&&T(z)}async function j(O,z,D){const F=S&&S.mode!=="public"?{mode:S.mode,vpc_id:S.vpcId,subnet_ids:S.subnetIds,enable_shared_internet_access:S.enableSharedInternetAccess}:void 0;return ug(O.name,O.files,{region:w,projectName:"default",network:F},{...D,onStage:z})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(X1,{project:c??$Ie,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:j,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:S,onNetworkChange:k,deployRegion:w,onDeployRegionChange:_,deploymentTelemetrySource:"code_package",onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:O=>{O.preventDefault(),y(!0)},onDragOver:O=>O.preventDefault(),onDragLeave:O=>{O.currentTarget.contains(O.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var O;m||(O=a.current)==null||O.click()},onKeyDown:O=>{var z;!m&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),(z=a.current)==null||z.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:O=>{O.stopPropagation(),p(!0)},onKeyDown:O=>O.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(dz,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const AV=1;function Ex(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KIe(e){return Ex(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&Ex(e.draft)}function sE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function qIe(e){var s;const t=Y1(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function CV(e){return{...e,draft:qIe(e.draft)}}function YIe(e){const t=Array.isArray(e)?e:Ex(e)&&e.version===AV?e.drafts:void 0;if(!Array.isArray(t)||!t.every(KIe))throw Ex(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(CV)}function WIe(e,t){if(!t)return[];const n=e.getItem(sE(t));if(!n)return[];try{return YIe(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function Z3(e,t,n){if(!t)return;const s={version:AV,drafts:n.map(CV)};try{e.setItem(sE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const XIe="/web/skill-creator";class A2 extends Error{constructor(n,s){super(n);pC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function Iu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function ps(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function IV(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function Dg(e,t){return fetch(_n(`${XIe}${e}`),{...t,headers:Jx({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function C2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=Iu(await e.json(),"错误响应");return ps(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function I2(e,t){if(!e.ok)throw new A2(await C2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function QIe(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function ZIe(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function JIe(e){return Array.isArray(e)?e.map((t,n)=>{const s=Iu(t,`文件 ${n+1}`),i=ps(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=IV(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function eje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function tje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=Iu(t,`活动 ${n+1}`),i=ps(s,"id"),r=ps(s,"kind"),a=ps(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=ps(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=ps(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function nje(e,t){const n=Iu(e,`候选方案 ${t+1}`),s=ps(n,"id","candidate_id","candidateId"),i=ps(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:ps(n,"modelLabel","model_label")??i,status:QIe(n.status),stage:ZIe(n.stage),name:ps(n,"name","skill_name","skillName"),description:ps(n,"description"),skillMd:ps(n,"skillMd","skill_md"),files:JIe(n.files),activities:tje(n.activities),validation:eje(n.validation),durationMs:IV(n,"elapsedMs","elapsed_ms"),error:ps(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:ps(n,"skill_id","skillId"),version:ps(n,"version")}}function IN(e,t=""){const n=Iu(e,"Skill 创建任务"),s=ps(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(nje):[],r=ps(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:ps(n,"prompt")??t,status:r,candidates:i}}async function sje(e,t){const n=await Dg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new A2(await C2(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=IN(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Iu(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(ps(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=IN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` `);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!l)throw new Error("创建 Skill 任务失败:服务端未返回任务");return l}async function ije(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`);return IN(await I2(t,"读取 Skill 任务失败"))}async function rje(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await I2(t,"清理 Skill 任务失败")}async function aje(e,t){var l;const n=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await C2(n,"下载 Skill 失败"));const i=((l=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:l[1])??"skill.zip",r=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=r,a.download=i,a.click(),URL.revokeObjectURL(r)}async function oje(e,t,n){const s=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=Iu(await I2(s,"添加到 AgentKit 失败"),"发布结果"),r=ps(i,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:ps(i,"name"),version:ps(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:ps(i,"message")}}const lje=()=>{};function cje(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function uje({activities:e}){const t=g.useMemo(()=>e.filter(n=>n.kind!=="status").map(cje),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(XA,{blocks:t,onAction:lje})})}const J3={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},eD=12e4;function dje({status:e}){return e==="succeeded"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):o.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function fje(){return o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),o.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function hje(){return o.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:o.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function pje({candidate:e}){var c,u;const[t,n]=g.useState("SKILL.md"),s=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!s?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=i.find(d=>d.path===t)??i[0],a=(c=e.skillMd)==null?void 0:c.slice(0,eD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>eD;return i.length===0?null:o.jsxs("div",{className:"skill-files",children:[o.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>o.jsx("button",{type:"button",role:"tab","aria-selected":(r==null?void 0:r.path)===d.path,className:(r==null?void 0:r.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(r!=null&&r.path.endsWith("SKILL.md"))?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"skill-files__content",children:o.jsx("code",{children:a})}),l?o.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):o.jsx("div",{className:"skill-files__unavailable",children:r?`${r.path} · ${r.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function mje({label:e,jobId:t,candidate:n,selected:s,publishing:i,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=g.useState("conversation"),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState(""),[_,S]=g.useState(""),k=g.useRef(null),T=g.useRef(null),C=n.status==="queued"||n.status==="running",I=n.status==="succeeded",j=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${s?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),s?o.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[o.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[o.jsx("span",{className:"skill-candidate__status-icon",children:o.jsx(dje,{status:n.status})}),C?o.jsx(Na,{duration:2.2,spread:16,children:J3[n.stage]}):o.jsx("span",{children:J3[n.stage]}),n.durationMs!==void 0&&I?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(uje,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?o.jsx("div",{className:"skill-candidate__view-actions",children:o.jsxs("button",{ref:k,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var O;return(O=T.current)==null?void 0:O.focus()})},children:[o.jsx(fje,{}),"查看 Skill"]})}):null]}):o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[o.jsx("div",{className:"skill-candidate__preview-nav",children:o.jsxs("button",{ref:T,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var O;return(O=k.current)==null?void 0:O.focus()})},children:[o.jsx(hje,{}),"返回对话"]})}),o.jsxs("div",{className:"skill-candidate__result",children:[o.jsxs("div",{className:"skill-candidate__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Skill"}),o.jsx("strong",{children:n.name??"未命名 Skill"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"文件"}),o.jsx("strong",{children:n.files.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"校验"}),o.jsx("strong",{className:(j==null?void 0:j.valid)===!1?"is-invalid":"is-valid",children:(j==null?void 0:j.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,j&&(j.errors.length>0||j.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...j.errors,...j.warnings].map((O,z)=>o.jsx("div",{children:O},`${O}-${z}`))]}):null,o.jsx(pje,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":s,onClick:l,children:s?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),aje(t,n.id).catch(O=>{v(O instanceof Error?O.message:String(O))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!s||i||r||n.published,title:s?void 0:"请先采用此方案",onClick:()=>h(O=>!O),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),b?o.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&s&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:O=>{O.preventDefault();const z=y.split(",").map(D=>D.trim()).filter(Boolean);c({skillSpaceIds:z,...E.trim()?{projectName:E.trim()}:{},..._.trim()?{skillId:_.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:O=>x(O.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),o.jsxs("div",{className:"skill-publish-form__optional",children:[o.jsxs("label",{children:[o.jsx("span",{children:"项目名称(可选)"}),o.jsx("input",{value:E,onChange:O=>w(O.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:_,onChange:O=>S(O.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const tD=new Set(["completed"]),lb=1100,gje=3e4;function bje(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function yje({initialJob:e}){const[t,n]=g.useState(e),[s,i]=g.useState(""),[r,a]=g.useState(!1),[l,c]=g.useState(),[u,d]=g.useState(),[f,h]=g.useState(()=>new Set),[p,m]=g.useState({});g.useEffect(()=>{n(e),i(""),a(!1)},[e]),g.useEffect(()=>{if(tD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+gje,w=async()=>{try{const _=await ije(e.id);y||(n({..._,prompt:_.prompt||e.prompt}),i(""),tD.has(_.status)||(x=window.setTimeout(w,lb)))}catch(_){if(!y){const S=_ instanceof A2?_:void 0;if((S==null?void 0:S.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const b=ZA.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??bje(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await oje(t.id,y.id,x),h(E=>new Set(E).add(y.id))}catch(E){m(w=>({...w,[y.id]:E instanceof Error?E.message:String(E)}))}finally{d(void 0)}}return o.jsxs("section",{className:"skill-workspace",children:[o.jsx("header",{className:"skill-workspace__intro",children:o.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),s?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",s,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:b.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(mje,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:w,selected:l===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:_=>void v(y,_)},`${y.model}-${y.id}`)})})]})}function xje(e){return Object.prototype.toString.call(e)==="[object Object]"}function nD(e){return xje(e)||Array.isArray(e)}function Eje(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function j2(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const i=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return i!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!nD(l)||!nD(c)?l===c:j2(l,c)})}function sD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function vje(e,t){if(e.length!==t.length)return!1;const n=sD(e),s=sD(t);return n.every((i,r)=>{const a=s[r];return j2(i,a)})}function R2(e){return typeof e=="number"}function jN(e){return typeof e=="string"}function iE(e){return typeof e=="boolean"}function iD(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ss(e){return Math.abs(e)}function O2(e){return Math.sign(e)}function Zp(e,t){return Ss(e-t)}function wje(e,t){if(e===0||t===0||Ss(e)<=Ss(t))return 0;const n=Zp(Ss(e),Ss(t));return Ss(n/e)}function Sje(e){return Math.round(e*100)/100}function zm(e){return Vm(e).map(Number)}function ka(e){return e[Pg(e)]}function Pg(e){return Math.max(0,e.length-1)}function M2(e,t){return t===Pg(e)}function rD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Vm(e){return Object.keys(e)}function jV(e,t){return[e,t].reduce((n,s)=>(Vm(s).forEach(i=>{const r=n[i],a=s[i],l=iD(r)&&iD(a);n[i]=l?jV(r,a):a}),n),{})}function RN(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function _je(e,t){const n={start:s,center:i,end:r};function s(){return 0}function i(c){return r(c)/2}function r(c){return t-c}function a(c,u){return jN(e)?n[e](c):e(t,c,u)}return{measure:a}}function Gm(){let e=[];function t(i,r,a,l={passive:!0}){let c;if("addEventListener"in i)i.addEventListener(r,a,l),c=()=>i.removeEventListener(r,a,l);else{const u=i;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),s}function n(){e=e.filter(i=>i())}const s={add:t,clear:n};return s}function Nje(e,t,n,s){const i=Gm(),r=1e3/60;let a=null,l=0,c=0;function u(){i.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),i.clear()}function f(v){if(!c)return;a||(a=v,n(),n());const y=v-a;for(a=v,l+=y;l>=r;)n(),l-=r;const x=l/r;s(x),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),a=null,l=0,c=0}function m(){a=null,l=0}return{init:u,destroy:d,start:h,stop:p,update:n,render:s}}function Tje(e,t){const n=t==="rtl",s=e==="y",i=s?"y":"x",r=s?"x":"y",a=!s&&n?-1:1,l=d(),c=f();function u(m){const{height:b,width:v}=m;return s?b:v}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:i,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function pu(e=0,t=0){const n=Ss(e-t);function s(u){return ut}function r(u){return s(u)||i(u)}function a(u){return r(u)?s(u)?e:t:u}function l(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:a,reachedAny:r,reachedMax:i,reachedMin:s,removeOffset:l}}function RV(e,t,n){const{constrain:s}=pu(0,e),i=e+1;let r=a(t);function a(h){return n?Ss((i+h)%i):s(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return RV(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function kje(e,t,n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x){const{cross:E,direction:w}=e,_=["INPUT","SELECT","TEXTAREA"],S={passive:!1},k=Gm(),T=Gm(),C=pu(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},j={mouse:500,touch:600},O=m?43:25;let z=!1,D=0,F=0,A=!1,M=!1,P=!1,$=!1;function R(de){if(!x)return;function ge(ve){(iE(x)||x(de,ve))&&V(ve)}const Me=t;k.add(Me,"dragstart",ve=>ve.preventDefault(),S).add(Me,"touchmove",()=>{},S).add(Me,"touchend",()=>{}).add(Me,"touchstart",ge).add(Me,"mousedown",ge).add(Me,"touchcancel",q).add(Me,"contextmenu",q).add(Me,"click",ue,!0)}function Y(){k.clear(),T.clear()}function J(){const de=$?n:t;T.add(de,"touchmove",W,S).add(de,"touchend",q).add(de,"mousemove",W,S).add(de,"mouseup",q)}function U(de){const ge=de.nodeName||"";return _.includes(ge)}function te(){return(m?j:I)[$?"mouse":"touch"]}function K(de,ge){const Me=f.add(O2(de)*-1),ve=d.byDistance(de,!m).distance;return m||Ss(de)=2,!(ge&&de.button!==0)&&(U(de.target)||(A=!0,r.pointerDown(de),u.useFriction(0).useDuration(0),i.set(a),J(),D=r.readPoint(de),F=r.readPoint(de,E),h.emit("pointerDown")))}function W(de){if(!RN(de,s)&&de.touches.length>=2)return q(de);const Me=r.readPoint(de),ve=r.readPoint(de,E),ae=Zp(Me,D),ke=Zp(ve,F);if(!M&&!$&&(!de.cancelable||(M=ae>ke,!M)))return q(de);const Se=r.pointerMove(de);ae>b&&(P=!0),u.useFriction(.3).useDuration(.75),l.start(),i.add(w(Se)),de.preventDefault()}function q(de){const Me=d.byDistance(0,!1).index!==f.get(),ve=r.pointerUp(de)*te(),ae=K(w(ve),Me),ke=wje(ve,ae),Se=O-10*ke,Ze=y+ke/50;M=!1,A=!1,T.clear(),u.useDuration(Se).useFriction(Ze),c.distance(ae,!m),$=!1,h.emit("pointerUp")}function ue(de){P&&(de.stopPropagation(),de.preventDefault(),P=!1)}function me(){return A}return{init:R,destroy:Y,pointerDown:me}}function Aje(e,t){let s,i;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(RN(f,t)?f:f.touches[0])[m]}function l(f){return s=f,i=f,a(f)}function c(f){const h=a(f)-a(i),p=r(f)-r(s)>170;return i=f,p&&(s=f),h}function u(f){if(!s||!i)return 0;const h=a(i)-a(s),p=r(f)-r(s),m=r(f)-r(i)>170,b=h/p;return p&&!m&&Ss(b)>.1?b:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function Cje(){function e(n){const{offsetTop:s,offsetLeft:i,offsetWidth:r,offsetHeight:a}=n;return{top:s,right:i+r,bottom:s+a,left:i,width:r,height:a}}return{measure:e}}function Ije(e){function t(s){return e*(s/100)}return{measure:t}}function jje(e,t,n,s,i,r,a){const l=[e].concat(s);let c,u,d=[],f=!1;function h(v){return i.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=s.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,_=s.indexOf(E.target),S=w?u:d[_],k=h(w?e:s[_]);if(Ss(k-S)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(iE(r)||r(v,x))&&y(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function m(){f=!0,c&&c.disconnect()}return{init:p,destroy:m}}function Rje(e,t,n,s,i,r){let a=0,l=0,c=i,u=r,d=e.get(),f=0;function h(){const S=s.get()-e.get(),k=!c;let T=0;return k?(a=0,n.set(s),e.set(s),T=S):(n.set(e),a+=S/c,a*=u,d+=a,e.add(a),T=d-f),l=O2(T),f=d,_}function p(){const S=s.get()-t.get();return Ss(S)<.001}function m(){return c}function b(){return l}function v(){return a}function y(){return E(i)}function x(){return w(r)}function E(S){return c=S,_}function w(S){return u=S,_}const _={direction:b,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return _}function Oje(e,t,n,s,i){const r=i.measure(10),a=i.measure(50),l=pu(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(p){if(!u())return;const m=e.reachedMin(t.get())?"min":"max",b=Ss(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(b/a);n.subtract(v*y),!p&&Ss(v){const{min:v,max:y}=r,x=r.constrain(m),E=!b,w=M2(n,b);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+i)return[r.max];if(s==="keepSnaps")return a;const{min:m,max:b}=l;return a.slice(m,b)}return{snapsContained:c,scrollContainLimit:l}}function Lje(e,t,n){const s=t[0],i=n?s-e:ka(t);return{limit:pu(i,s)}}function Dje(e,t,n,s){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=pu(r,a);function u(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function d(h){if(!u(h))return;const p=e*(h*-1);s.forEach(m=>m.add(p))}return{loop:d}}function Pje(e){const{max:t,length:n}=e;function s(r){const a=r-t;return n?a/-n:0}return{get:s}}function Bje(e,t,n,s,i){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=i,c=f().map(t.measure),u=h(),d=p();function f(){return l(s).map(b=>ka(b)[a]-b[0][r]).map(Ss)}function h(){return s.map(b=>n[r]-b[r]).map(b=>-Ss(b))}function p(){return l(u).map(b=>b[0]).map((b,v)=>b+c[v])}return{snaps:u,snapsAligned:d}}function Uje(e,t,n,s,i,r){const{groupSlides:a}=i,{min:l,max:c}=s,u=d();function d(){const h=a(r),p=!e||t==="keepSnaps";return n.length===1?[r]:p?h:h.slice(l,c).map((m,b,v)=>{const y=!b,x=M2(v,b);if(y){const E=ka(v[0])+1;return rD(E)}if(x){const E=Pg(r)-ka(v)[0]+1;return rD(E,ka(v)[0])}return m})}return{slideRegistry:u}}function Fje(e,t,n,s,i){const{reachedAny:r,removeOffset:a,constrain:l}=s;function c(m){return m.concat().sort((b,v)=>Ss(b)-Ss(v))[0]}function u(m){const b=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-b,0),index:E})).sort((x,E)=>Ss(x.diff)-Ss(E.diff)),{index:y}=v[0];return{index:y,distance:b}}function d(m,b){const v=[m,m+n,m-n];if(!e)return m;if(!b)return c(v);const y=v.filter(x=>O2(x)===b);return y.length?c(y):ka(v)-n}function f(m,b){const v=t[m]-i.get(),y=d(v,b);return{index:m,distance:y}}function h(m,b){const v=i.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!b||E)return{index:y,distance:m};const w=t[y]-x,_=m+d(w,0);return{index:y,distance:_}}return{byDistance:h,byIndex:f,shortcut:d}}function $je(e,t,n,s,i,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),a.emit("select"))}function c(f,h){const p=i.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=i.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function Hje(e,t,n,s,i,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(b){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(b));R2(x)&&(i.useDuration(0),s.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((b,v)=>{r.add(b,"focus",y=>{(iE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function gp(e){let t=e;function n(){return t}function s(c){t=a(c)}function i(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return R2(c)?c:c.get()}return{get:n,set:s,add:i,subtract:r}}function OV(e,t){const n=e.scroll==="x"?a:l,s=t.style;let i=null,r=!1;function a(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(r)return;const p=Sje(e.direction(h));p!==i&&(s.transform=n(p),i=p)}function u(h){r=!h}function d(){r||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function zje(e,t,n,s,i,r,a,l,c){const d=zm(i),f=zm(i).reverse(),h=y().concat(x());function p(k,T){return k.reduce((C,I)=>C-i[I],T)}function m(k,T){return k.reduce((C,I)=>p(C,T)>0?C.concat([I]):C,[])}function b(k){return r.map((T,C)=>({start:T-s[C]+.5+k,end:T+t-.5+k}))}function v(k,T,C){const I=b(T);return k.map(j=>{const O=C?0:-n,z=C?n:0,D=C?"end":"start",F=I[j][D];return{index:j,loopPoint:F,slideLocation:gp(-1),translate:OV(e,c[j]),target:()=>l.get()>F?O:z}})}function y(){const k=a[0],T=m(f,k);return v(T,n,!1)}function x(){const k=t-a[0]-1,T=m(d,k);return v(T,-n,!0)}function E(){return h.every(({index:k})=>{const T=d.filter(C=>C!==k);return p(T,t)<=.1})}function w(){h.forEach(k=>{const{target:T,translate:C,slideLocation:I}=k,j=T();j!==I.get()&&(C.to(j),I.set(j))})}function _(){h.forEach(k=>k.translate.clear())}return{canLoop:E,clear:_,loop:w,loopPoints:h}}function Vje(e,t,n){let s,i=!1;function r(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{i||(iE(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function a(){s&&s.disconnect(),i=!0}return{init:r,destroy:a}}function Gje(e,t,n,s){const i={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(b=>{const v=t.indexOf(b.target);i[v]=b}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return Vm(i).reduce((b,v)=>{const y=parseInt(v),{isIntersecting:x}=i[y];return(m&&x||!m&&!x)&&b.push(y),b},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const b=f(m);return m&&(r=b),m||(a=b),b}return{init:u,destroy:d,get:h}}function Kje(e,t,n,s,i,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&i,d=m(),f=b(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return Ss(t[l]-x[l])}function b(){if(!u)return 0;const x=r.getComputedStyle(ka(s));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const _=!E,S=M2(w,E);return _?h[E]+d:S?h[E]+f:w[E+1][l]-x[l]}).map(Ss)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function qje(e,t,n,s,i,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=R2(n);function p(y,x){return zm(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?zm(y).reduce((x,E,w)=>{const _=ka(x)||0,S=_===0,k=E===Pg(y),T=i[u]-r[_][u],C=i[u]-r[E][d],I=!s&&S?f(a):0,j=!s&&k?f(l):0,O=Ss(C-j-(T+I));return w&&O>t+c&&x.push(E),k&&x.push(y.length),x},[]).map((x,E,w)=>{const _=Math.max(w[E-1]||0);return y.slice(_,x)}):[]}function b(y){return h?p(y,n):m(y)}return{groupSlides:b}}function Yje(e,t,n,s,i,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:b,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:_,watchFocus:S}=r,k=2,T=Cje(),C=T.measure(t),I=n.map(T.measure),j=Tje(c,u),O=j.measureSize(C),z=Ije(O),D=_je(l,O),F=!f&&!!x,A=f||!!x,{slideSizes:M,slideSizesWithGaps:P,startGap:$,endGap:R}=Kje(j,C,I,n,A,i),Y=qje(j,O,v,f,C,I,$,R,k),{snaps:J,snapsAligned:U}=Bje(j,D,C,I,Y),te=-ka(J)+ka(P),{snapsContained:K,scrollContainLimit:V}=Mje(O,te,U,x,k),W=F?K:U,{limit:q}=Lje(te,W,f),ue=RV(Pg(W),d,f),me=ue.clone(),_e=zm(n),de=({dragHandler:Ue,scrollBody:Ke,scrollBounds:xt,options:{loop:ct}})=>{ct||xt.constrain(Ue.pointerDown()),Ke.seek()},ge=({scrollBody:Ue,translate:Ke,location:xt,offsetLocation:ct,previousLocation:on,scrollLooper:Mt,slideLooper:Nt,dragHandler:Pt,animation:Ge,eventHandler:Vt,scrollBounds:it,options:{loop:at}},We)=>{const St=Ue.settled(),xe=!it.shouldConstrain(),Xe=at?St:St&&xe,Et=Xe&&!Pt.pointerDown();Et&&Ge.stop();const nn=xt.get()*We+on.get()*(1-We);ct.set(nn),at&&(Mt.loop(Ue.direction()),Nt.loop()),Ke.to(ct.get()),Et&&Vt.emit("settle"),Xe||Vt.emit("scroll")},Me=Nje(s,i,()=>de(be),Ue=>ge(be,Ue)),ve=.68,ae=W[ue.get()],ke=gp(ae),Se=gp(ae),Ze=gp(ae),Le=gp(ae),Ve=Rje(ke,Ze,Se,Le,h,ve),Ne=Fje(f,W,te,q,Le),Fe=$je(Me,ue,me,Ve,Ne,Le,a),De=Pje(q),qe=Gm(),Q=Gje(t,n,a,b),{slideRegistry:oe}=Uje(F,x,W,V,Y,_e),ne=Hje(e,n,oe,Fe,Ve,qe,a,S),be={ownerDocument:s,ownerWindow:i,eventHandler:a,containerRect:C,slideRects:I,animation:Me,axis:j,dragHandler:kje(j,e,s,i,Le,Aje(j,i),ke,Me,Fe,Ve,Ne,ue,a,z,p,m,y,ve,_),eventStore:qe,percentOfView:z,index:ue,indexPrevious:me,limit:q,location:ke,offsetLocation:Ze,previousLocation:Se,options:r,resizeHandler:jje(t,a,i,n,j,E,T),scrollBody:Ve,scrollBounds:Oje(q,Ze,Le,Ve,z),scrollLooper:Dje(te,q,Ze,[ke,Ze,Se,Le]),scrollProgress:De,scrollSnapList:W.map(De.get),scrollSnaps:W,scrollTarget:Ne,scrollTo:Fe,slideLooper:zje(j,O,te,M,P,J,W,Ze,n),slideFocus:ne,slidesHandler:Vje(t,a,w),slidesInView:Q,slideIndexes:_e,slideRegistry:oe,slidesToScroll:Y,target:Le,translate:OV(j,t)};return be}function Wje(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function i(u){return s(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=s(u).concat([d]),c}function a(u,d){return e[u]=s(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:i,off:a,on:r,clear:l};return c}const Xje={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function Qje(e){function t(r,a){return jV(r,a||{})}function n(r){const a=r.breakpoints||{},l=Vm(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function s(r){return r.map(a=>Vm(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function Zje(e){let t=[];function n(r,a){return t=a.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(r,e)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(r=>r.destroy())}return{init:n,destroy:s}}function vx(e,t,n){const s=e.ownerDocument,i=s.defaultView,r=Qje(i),a=Zje(r),l=Gm(),c=Wje(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,b=j;let v=!1,y,x=u(Xje,vx.globalOptions),E=u(x),w=[],_,S,k;function T(){const{container:_e,slides:de}=E;S=(jN(_e)?e.querySelector(_e):_e)||e.children[0];const Me=jN(de)?S.querySelectorAll(de):de;k=[].slice.call(Me||S.children)}function C(_e){const de=Yje(e,S,k,s,i,_e,c);if(_e.loop&&!de.slideLooper.canLoop()){const ge=Object.assign({},_e,{loop:!1});return C(ge)}return de}function I(_e,de){v||(x=u(x,_e),E=d(x),w=de||w,T(),y=C(E),f([x,...w.map(({options:ge})=>ge)]).forEach(ge=>l.add(ge,"change",j)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(me),y.eventHandler.init(me),y.resizeHandler.init(me),y.slidesHandler.init(me),y.options.loop&&y.slideLooper.loop(),S.offsetParent&&k.length&&y.dragHandler.init(me),_=a.init(me,w)))}function j(_e,de){const ge=Y();O(),I(u({startIndex:ge},_e),de),c.emit("reInit")}function O(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),a.destroy(),l.clear()}function z(){v||(v=!0,l.clear(),O(),c.emit("destroy"),c.clear())}function D(_e,de,ge){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(de===!0?0:E.duration),y.scrollTo.index(_e,ge||0))}function F(_e){const de=y.index.add(1).get();D(de,_e,-1)}function A(_e){const de=y.index.add(-1).get();D(de,_e,1)}function M(){return y.index.add(1).get()!==Y()}function P(){return y.index.add(-1).get()!==Y()}function $(){return y.scrollSnapList}function R(){return y.scrollProgress.get(y.offsetLocation.get())}function Y(){return y.index.get()}function J(){return y.indexPrevious.get()}function U(){return y.slidesInView.get()}function te(){return y.slidesInView.get(!1)}function K(){return _}function V(){return y}function W(){return e}function q(){return S}function ue(){return k}const me={canScrollNext:M,canScrollPrev:P,containerNode:q,internalEngine:V,destroy:z,off:p,on:h,emit:m,plugins:K,previousScrollSnap:J,reInit:b,rootNode:W,scrollNext:F,scrollPrev:A,scrollProgress:R,scrollSnapList:$,scrollTo:D,selectedScrollSnap:Y,slideNodes:ue,slidesInView:U,slidesNotInView:te};return I(t,n),setTimeout(()=>c.emit("init"),0),me}vx.globalOptions=void 0;function L2(e={},t=[]){const n=g.useRef(e),s=g.useRef(t),[i,r]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{i&&i.reInit(n.current,s.current)},[i]);return g.useEffect(()=>{j2(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{vje(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(Eje()&&a){vx.globalOptions=L2.globalOptions;const u=vx(a,n.current,s.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,i]}L2.globalOptions=void 0;const MV=g.createContext(null);function Bg(...e){return e.filter(Boolean).join(" ")}function rE(){const e=g.useContext(MV);if(!e)throw new Error("useCarousel must be used within a ");return e}function Jje({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:i,children:r,...a}){const[l,c]=L2({...t,axis:e==="horizontal"?"x":"y"},s),[u,d]=g.useState(!1),[f,h]=g.useState(!1),p=g.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=g.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),b=g.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=g.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),b())},[b,m]);return g.useEffect(()=>{c&&n&&n(c)},[c,n]),g.useEffect(()=>{if(c)return p(c),c.on("reInit",p),c.on("select",p),()=>{c.off("reInit",p),c.off("select",p)}},[c,p]),o.jsx(MV.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:s,setApi:n,scrollPrev:m,scrollNext:b,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Bg("ui-carousel",i),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function eRe({className:e,...t}){const{carouselRef:n,orientation:s}=rE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Bg("ui-carousel__track",s==="vertical"?"is-vertical":void 0,e),...t})})}function tRe({className:e,...t}){const{orientation:n}=rE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Bg("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function LV({direction:e}){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:e==="left"?"m10 3.75-4.25 4.25L10 12.25":"m6 3.75 4.25 4.25L6 12.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function nRe({className:e,...t}){const{orientation:n,scrollPrev:s,canScrollPrev:i}=rE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Bg("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"上一张",...t,children:o.jsx(LV,{direction:"left"})})}function sRe({className:e,...t}){const{orientation:n,scrollNext:s,canScrollNext:i}=rE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Bg("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"下一张",...t,children:o.jsx(LV,{direction:"right"})})}const aD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function iRe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function rRe({kind:e}){return e==="agents"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M43 27.5V33.5H22V38.5M43 33.5H64V38.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"33",y:"6.5",width:"20",height:"21",rx:"6"}),o.jsx("rect",{x:"9",y:"38.5",width:"26",height:"19",rx:"6"}),o.jsx("rect",{x:"51",y:"38.5",width:"26",height:"19",rx:"6"})]}),o.jsxs("g",{className:"new-chat-feature-card__illustration-details",children:[o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"40",cy:"14.5",r:"1.25"}),o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"46",cy:"14.5",r:"1.25"}),o.jsx("path",{d:"M39.5 21h7M17 46.5h10M17 51.5h7M59 46.5h10M59 51.5h7"})]})]}):e==="build"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M26.5 39H36M50 39h9.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"5.5",y:"7.5",width:"75",height:"49",rx:"7.5"}),o.jsx("rect",{x:"12.5",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"36",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"59.5",y:"31.5",width:"14",height:"15",rx:"4"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M6 20.5h74M13.5 14h.01m6 0h.01m6 0h.01M17 39h5m18.5 0h5m18-1 2.5 2.5 4-5"})})]}):e==="search"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"7.5",y:"9.5",width:"41",height:"16",rx:"5"}),o.jsx("rect",{x:"7.5",y:"35.5",width:"34",height:"18",rx:"5"}),o.jsx("circle",{cx:"61",cy:"33",r:"10.5"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M14.5 16h21M14.5 21h14M14.5 42.5h17M14.5 47.5h11M68.5 40.5 77 49"})})]}):o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"8.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"8.5",y:"35.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"35.5",width:"29",height:"21",rx:"6"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M23 13.5v9m-4.5-4.5h9M56.5 14.5h13M56.5 21.5h13M16.5 42.5h13M16.5 49.5h9M56.5 42.5h13M56.5 49.5h13"})})]})}function aRe(){const[e,t]=g.useState(),[n,s]=g.useState(!1),[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!0);return g.useEffect(()=>{if(!c)return;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>l(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),g.useEffect(()=>{if(!c||!e||n||i||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,i,n,a,c]),c?o.jsxs(Jje,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(nRe,{"aria-label":"上一张新特性"}),o.jsx(eRe,{children:aD.map((d,f)=>o.jsx(tRe,{"aria-label":`${f+1} / ${aD.length}`,children:o.jsxs("article",{className:"new-chat-feature-card",children:[o.jsxs("div",{className:"new-chat-feature-card__copy",children:[o.jsx("strong",{children:d.title}),o.jsx("span",{children:d.description})]}),o.jsx(rRe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(iRe,{})}),o.jsx(sRe,{"aria-label":"下一张新特性"})]}):null}const oRe=3*60*1e3,lRe=3e3,cRe=10*60*1e3,wx="veadk.studio.pending-update",oD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],uRe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function dRe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function fRe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function hRe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(wx);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(wx),null}function $w(e,t){window.localStorage.setItem(wx,JSON.stringify({targetVersion:e,startedAt:t}))}function cb(){window.localStorage.removeItem(wx)}function lD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),o.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),o.jsx("path",{d:"M12 7.8v7.7"}),o.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function pRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function mRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function cD({lines:e,phase:t,copyState:n,onCopy:s}){const i=g.useRef(null),r=g.useRef(!0);return g.useEffect(()=>{const a=i.current;a&&r.current&&(a.scrollTop=a.scrollHeight)},[e]),o.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[o.jsxs("div",{className:"studio-update-log-header",children:[o.jsxs("span",{children:[o.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",o.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),o.jsx("button",{type:"button",onClick:s,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:i,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const l=a.currentTarget;r.current=l.scrollHeight-l.scrollTop-l.clientHeight<24},children:e.length?e.map((a,l)=>o.jsx("div",{children:a},`${l}-${a}`)):o.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function gRe({variant:e="default"}){var D,F;const[t]=g.useState(hRe),[n,s]=g.useState(null),[i,r]=g.useState(t?"submitting":"idle"),[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState((t==null?void 0:t.targetVersion)??""),[h,p]=g.useState(!1),[m,b]=g.useState("idle"),[v,y]=g.useState(0),x=g.useRef(null),E=g.useRef((t==null?void 0:t.targetVersion)??""),w=g.useRef((t==null?void 0:t.startedAt)??0);g.useEffect(()=>{if(!h)return;const A=P=>{var $;P.target instanceof Node&&!(($=x.current)!=null&&$.contains(P.target))&&p(!1)},M=P=>{P.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",M),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",M)}},[h]);const _=g.useCallback(async()=>{const A=await WB(E.current||void 0,w.current||void 0);return s(A),A},[]);if(g.useEffect(()=>{let A=!0;const M=()=>{_().catch(()=>{A&&s($=>$)})};M();const P=window.setInterval(M,oRe);return()=>{A=!1,window.clearInterval(P)}},[_]),g.useEffect(()=>{if(i!=="submitting")return;const A=window.setInterval(()=>{_().then(M=>{const P=E.current;if(P&&fRe(M.currentVersion,P)||!P&&!M.available&&M.latestVersion){window.clearInterval(A),cb(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(M.state==="error"){window.clearInterval(A),cb(),r("error"),u(M.message||"Studio 更新失败");return}Date.now()-w.current>cRe&&(window.clearInterval(A),cb(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},lRe);return()=>window.clearInterval(A)},[i,_]),g.useEffect(()=>{i!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),$w(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[i,n]),g.useEffect(()=>{if(i!=="submitting"){y(0);return}const A=()=>{const P=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-P)/1e3)))};A();const M=window.setInterval(A,1e3);return()=>window.clearInterval(M)},[i]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||i!=="idle"))return null;const k=n.releases??[],T=d||((D=k[0])==null?void 0:D.version)||n.latestVersion,C=k.find(A=>A.version===T),I=async()=>{E.current=T,w.current=Date.now(),$w(T,w.current),r("submitting"),u(""),b("idle");try{const A=await XB(T);E.current=A.version,$w(A.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(A){if(A instanceof TypeError){u("连接已切换,正在确认新版本状态");return}cb(),r("error");const M=A instanceof Error?A.message:"Studio 更新失败";try{const P=await _();u(P.message||M)}catch{u(M)}}},j=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` `).filter(Boolean),O=async()=>{try{await navigator.clipboard.writeText(j.join(` `)),b("copied")}catch{b("error")}},z=()=>{var A;p(!1),b("idle"),u(""),f(E.current||((A=k[0])==null?void 0:A.version)||""),r("confirm")};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:e==="feature-link"?"welcome-feature-link studio-update-trigger--feature":`studio-update-trigger is-${i}`,title:i==="submitting"?"正在更新 Studio":i==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var A;i==="published"?window.location.reload():(i==="submitting"||i==="error"||(f(((A=k[0])==null?void 0:A.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(lD,{className:"studio-update-icon"}),i==="submitting"?o.jsx(Na,{as:"span",children:"正在更新"}):i==="published"?o.jsx("span",{children:"刷新使用新版"}):i==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&i!=="idle"&&o.jsx("div",{className:"confirm-scrim",role:"presentation",children:o.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[o.jsx("div",{className:"studio-update-dialog-mark",children:o.jsx(lD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:i==="error"?"Studio 更新失败":i==="submitting"?"正在更新 Studio":i==="published"?"Studio 更新完成":"发现新版本"}),i==="error"?o.jsxs("div",{className:"studio-update-error-panel",children:[o.jsx("p",{className:"confirm-text studio-update-error",children:c}),o.jsxs("dl",{className:"studio-update-error-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"失败阶段"}),o.jsx("dd",{children:uRe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx(cD,{lines:j,phase:"error",copyState:m,onCopy:()=>void O()}),n.consoleUrl&&o.jsxs("a",{className:"studio-update-console-link",href:n.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",o.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):i==="submitting"||i==="published"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"studio-update-progress-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"目标版本"}),o.jsx("strong",{children:E.current||T})]}),o.jsxs("div",{children:[o.jsx("span",{children:i==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:i==="published"?"已完成":dRe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:oD.map((A,M)=>{const P=oD.findIndex(Y=>Y.id===n.progressStage),$=i==="published"||Mvoid O()}),o.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),o.jsxs("div",{className:"studio-update-field",ref:x,children:[o.jsx("span",{children:"选择版本"}),o.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":h,onClick:()=>p(A=>!A),onKeyDown:A=>{(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0))},children:[o.jsx("span",{children:T}),o.jsx(pRe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:k.map(A=>{const M=A.version===T;return o.jsxs("button",{type:"button",role:"option","aria-selected":M,className:`studio-update-version-option${M?" is-selected":""}`,onClick:()=>{f(A.version),p(!1)},children:[o.jsx("span",{children:A.version}),M&&o.jsx(mRe,{})]},A.version)})})]}),o.jsxs("dl",{className:"studio-update-versions",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:n.currentVersion})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"目标版本"}),o.jsx("dd",{children:T})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Commit"}),o.jsx("dd",{children:((C==null?void 0:C.gitSha)||n.latestGitSha).slice(0,8)})]})]}),o.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[o.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),C!=null&&C.changelog.length?o.jsx("ul",{children:C.changelog.map(A=>o.jsx("li",{children:A},A))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),i==="confirm"&&(r("idle"),u(""))},children:i==="submitting"?"后台运行":i==="confirm"?"取消":"关闭"}),i==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void I(),children:"立即更新"}),i==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:z,children:"重新尝试"})]})]})})]})}const bRe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function yRe({canUpdate:e=!1}){return o.jsxs("div",{className:"welcome-feature-pill",children:[o.jsx("span",{children:"焕然一新"}),o.jsx("span",{className:"welcome-feature-divider","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"welcome-feature-link","aria-describedby":"welcome-feature-popover",children:"查看新特性"}),o.jsxs("section",{id:"welcome-feature-popover",className:"welcome-feature-popover",role:"tooltip",children:[o.jsx("strong",{children:"本次更新"}),o.jsx("ul",{children:bRe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(gRe,{variant:"feature-link"})]})}const xRe=1e4;async function DV(e){const t=await fetch(_n(e),{headers:Jx({Accept:"application/json"}),signal:Ln(void 0,xRe)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function ERe(){return DV("/web/sandbox/capabilities")}async function vRe(){return DV("/web/skill-creator/capabilities")}const wRe="我的智能体";function SRe({open:e,state:t,agentKind:n="codex",error:s,onCancel:i,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?wRe:`我的 ${a}`,c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1),h=g.useRef(i),[p,m]=g.useState(l);if(h.current=i,g.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var _,S;(_=u.current)==null||_.focus(),(S=u.current)==null||S.select()}),w=_=>{var C;if(_.key==="Escape"){_.preventDefault(),h.current();return}if(_.key!=="Tab")return;const S=(C=c.current)==null?void 0:C.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(S!=null&&S.length))return;const k=S[0],T=S[S.length-1];_.shiftKey&&document.activeElement===k?(_.preventDefault(),T.focus()):!_.shiftKey&&document.activeElement===T&&(_.preventDefault(),k.focus())};return window.addEventListener("keydown",w),()=>{window.cancelAnimationFrame(E),document.body.style.overflow=x,window.removeEventListener("keydown",w)}},[l,e]),!e)return null;const b=t==="loading",v=p.trim(),y=b?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return mi.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!b&&i()},children:o.jsxs("form",{ref:c,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":t==="confirm"?void 0:"sandbox-dialog-description",onSubmit:x=>{x.preventDefault(),!b&&!f.current&&v&&r(v)},children:[o.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[o.jsx("span",{className:"sandbox-dialog-orbit"}),o.jsx("span",{className:"sandbox-dialog-icon",children:b?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Um,{kind:n})})]}),o.jsxs("div",{className:"sandbox-dialog-copy",children:[o.jsx("h2",{id:"sandbox-dialog-title",children:y}),t==="error"?o.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:s||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):b?o.jsxs("p",{id:"sandbox-dialog-description","aria-live":"polite",children:["正在创建并等待 ",a," 智能体就绪,这通常需要半分钟"]}):null,o.jsxs("label",{className:"sandbox-dialog-field",children:[o.jsxs("span",{className:"sandbox-dialog-field-label",children:[o.jsx("span",{children:"智能体名称"}),o.jsxs("span",{"aria-hidden":"true",children:[p.length,"/",YL]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:YL,disabled:b,placeholder:l,autoComplete:"off",onChange:x=>m(x.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:x=>{const{nativeEvent:E}=x;x.key==="Enter"&&(f.current||E.isComposing||E.keyCode===229)&&x.preventDefault()}})]})]}),o.jsxs("footer",{className:"sandbox-dialog-actions",children:[o.jsx("button",{ref:d,type:"button",onClick:i,children:b?"取消创建":"取消"}),!b&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function _Re({agentName:e,onExit:t}){return o.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[o.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),o.jsxs("span",{className:"sandbox-session-warning-copy",children:["当前您在使用 ",e," 智能体"]}),o.jsx("button",{type:"button",onClick:t,children:"退出内置智能体"})]})}function NRe({activity:e,time:t}){var n;return o.jsxs("aside",{className:"sandbox-activity-record",role:"status","aria-label":"Sandbox 操作记录",children:[o.jsxs("div",{className:"sandbox-activity-summary",children:[o.jsx("span",{className:"sandbox-activity-dot","aria-hidden":"true"}),o.jsx("span",{className:"sandbox-activity-label",children:"操作记录"}),o.jsx("strong",{children:e.title}),t?o.jsx("time",{children:t}):null]}),(n=e.details)!=null&&n.length?o.jsx("dl",{className:"sandbox-activity-details",children:e.details.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{title:s.value,children:s.code?o.jsx("code",{children:s.value}):s.value})]},`${s.label}:${s.value}`))}):null]})}function TRe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function kRe({usage:e}){const t=[["Total",e.totalTokens],["Input",e.inputTokens],...e.cachedInputTokens>0?[["Cached input",e.cachedInputTokens]]:[],["Output",e.outputTokens],...e.reasoningOutputTokens>0?[["Reasoning output",e.reasoningOutputTokens]]:[]];return o.jsx("div",{className:"sandbox-token-usage","aria-label":"Codex Token 用量",children:t.map(([n,s])=>o.jsxs("span",{title:`${n}: ${s.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:TRe(s)})]},n))})}function PV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function BV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function D2(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function Qb(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function ARe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function CRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function IRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function jRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function RRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function ORe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function MRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function ON(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function LRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function Fo(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function Ug({open:e,title:t,subtitle:n,icon:s,className:i="",onClose:r,children:a}){const l=g.useId(),c=g.useRef(null),u=g.useRef(null),d=g.useRef(r);return d.current=r,g.useEffect(()=>{var p;if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const f=document.body.style.overflow;document.body.style.overflow="hidden",(p=c.current)==null||p.focus();const h=m=>{var E;if(m.key==="Escape"){m.preventDefault(),d.current();return}if(m.key!=="Tab")return;const b=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((b==null?void 0:b.querySelectorAll('button:not(:disabled), input:not(:disabled), iframe, [tabindex]:not([tabindex="-1"])'))??[]);if(v.length===0)return;const y=v[0],x=v[v.length-1];m.shiftKey&&document.activeElement===y?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{var m;document.body.style.overflow=f,window.removeEventListener("keydown",h),(m=u.current)==null||m.focus()}},[e]),e?mi.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${i}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"sandbox-control-head",children:[o.jsx("span",{className:"sandbox-control-head-icon","aria-hidden":"true",children:s}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:t}),o.jsx("p",{children:n})]}),o.jsx("button",{ref:c,type:"button",className:"sandbox-control-close","aria-label":`关闭${t}`,onClick:r,children:o.jsx(MRe,{})})]}),a]})}),document.body):null}function DRe({open:e,kind:t,launch:n,loading:s,error:i,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Ug,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(PV,{}):o.jsx(BV,{}),className:`sandbox-tool-dialog sandbox-tool-dialog--${t}`,onClose:a,children:[o.jsx("div",{className:"sandbox-tool-toolbar",children:o.jsxs("span",{children:[o.jsx("i",{className:s?"is-loading":n?"is-ready":""}),s?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Fo,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:i}),o.jsx("button",{type:"button",onClick:r,children:"重试"})]}):n?o.jsx("iframe",{src:n.url,title:c,allow:"clipboard-read; clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"}):null})]})}function PRe({open:e,threads:t,currentThreadId:n,loading:s,error:i,onSelect:r,onClose:a}){return o.jsx(Ug,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(LRe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Fo,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:i})]}):t.length===0?o.jsx("div",{className:"sandbox-control-state",children:o.jsx("strong",{children:"暂无可恢复的对话"})}):t.map(l=>{const c=l.id===n,u=l.name||l.preview||`Thread ${l.id.slice(0,8)}`;return o.jsxs("button",{type:"button",className:c?"is-active":"",disabled:c,onClick:()=>r(l.id),children:[o.jsxs("span",{children:[o.jsx("strong",{children:u}),o.jsx("small",{children:l.preview||l.cwd||l.id})]}),o.jsx("time",{children:l.updatedAt?new Date(l.updatedAt*1e3).toLocaleString():""}),o.jsx(ON,{})]},l.id)})})})}const BRe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],URe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],FRe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function $Re({open:e,value:t,busy:n,error:s,onSave:i,onClose:r}){const[a,l]=g.useState(t);return g.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Ug,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(D2,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(Hw,{label:"沙箱模式",choices:BRe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(Hw,{label:"审批策略",choices:URe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(Hw,{label:"审批方式",choices:FRe,value:a.approvalsReviewer,disabled:n,onChange:c=>l(u=>({...u,approvalsReviewer:c}))}),o.jsxs("label",{className:`sandbox-network-toggle${a.sandboxMode==="danger-full-access"?" is-disabled":""}`,children:[o.jsxs("span",{children:[o.jsx("strong",{children:"允许网络访问"}),o.jsx("small",{children:"控制 workspace-write 与只读模式中的外部网络访问。"})]}),o.jsx("input",{type:"checkbox",checked:a.networkAccess,disabled:n||a.sandboxMode==="danger-full-access",onChange:c=>l(u=>({...u,networkAccess:c.target.checked}))})]}),a.sandboxMode==="danger-full-access"?o.jsx("div",{className:"sandbox-control-note is-danger",children:"完全访问会关闭文件系统与网络隔离,请只在可信任务中使用。"}):null,s?o.jsx("div",{className:"sandbox-control-error",children:s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:n,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:n,onClick:()=>i(a),children:[n?o.jsx(Fo,{className:"spin"}):null,"保存权限"]})]})]})}function Hw({label:e,choices:t,value:n,disabled:s,onChange:i}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:s,role:"radiogroup","aria-label":e,children:[o.jsx("legend",{children:e}),o.jsx("div",{className:"sandbox-choice-list",children:t.map(r=>o.jsxs("button",{type:"button",role:"radio",className:`${n===r.value?"is-active":""}${r.danger?" is-danger":""}`.trim(),"aria-checked":n===r.value,onClick:()=>i(r.value),onKeyDown:a=>{var d,f;const l=t.findIndex(h=>h.value===r.value);let c=l;if(a.key==="ArrowRight"||a.key==="ArrowDown")c=(l+1)%t.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")c=(l-1+t.length)%t.length;else if(a.key==="Home")c=0;else if(a.key==="End")c=t.length-1;else return;a.preventDefault(),i(t[c].value);const u=(d=a.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="radio"]');(f=u==null?void 0:u[c])==null||f.focus()},children:[o.jsx("i",{}),o.jsxs("span",{children:[o.jsx("strong",{children:r.label}),o.jsx("small",{children:r.detail})]})]},r.value))})]})}function HRe({open:e,cwd:t,locked:n,busy:s,error:i,browse:r,onSave:a,onClose:l}){const[c,u]=g.useState(t||"/"),[d,f]=g.useState(null),[h,p]=g.useState(!1),[m,b]=g.useState("");g.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),b("");try{const x=await r(y);f(x),u(x.path)}catch(x){b(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Ug,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(Qb,{}),className:"sandbox-workspace-dialog",onClose:l,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsxs("label",{className:"sandbox-workspace-input",children:[o.jsx("span",{children:"绝对路径"}),o.jsxs("div",{children:[o.jsx("input",{value:c,disabled:s||n,spellCheck:!1,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.startsWith("/")&&(y.preventDefault(),v(c))}}),o.jsx("button",{type:"button",disabled:s||h||!c.startsWith("/"),onClick:()=>void v(c),children:"浏览"})]})]}),o.jsxs("div",{className:"sandbox-directory-browser",children:[o.jsxs("div",{className:"sandbox-directory-head",children:[o.jsx("span",{title:d==null?void 0:d.path,children:(d==null?void 0:d.path)??c}),h?o.jsx(Fo,{className:"spin"}):null]}),o.jsxs("div",{className:"sandbox-directory-list",children:[d!=null&&d.parent?o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(d.parent??"/"),children:[o.jsx(Qb,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(ON,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(Qb,{}),o.jsx("span",{children:y.name}),o.jsx(ON,{})]},y.path)),!h&&(d==null?void 0:d.directories.length)===0?o.jsx("div",{className:"sandbox-directory-empty",children:"当前目录没有子目录"}):null]})]}),n?o.jsx("div",{className:"sandbox-control-note",children:"当前对话已经开始,工作空间已锁定。新建 Sandbox 会话后可重新选择。"}):null,m||i?o.jsx("div",{className:"sandbox-control-error",children:m||i}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:s,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:s||n||!c.startsWith("/"),onClick:()=>a(c),children:[s?o.jsx(Fo,{className:"spin"}):null,"使用此目录"]})]})]})}function zRe({approval:e,busy:t,error:n,onDecision:s}){var a;const i=(a=e==null?void 0:e.command)==null?void 0:a.trim(),r=(e==null?void 0:e.changes)===void 0?"":JSON.stringify(e.changes,null,2);return o.jsxs(Ug,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(D2,{}),className:"sandbox-approval-dialog",onClose:()=>{t||s("cancel")},children:[o.jsxs("div",{className:"sandbox-control-body",children:[e!=null&&e.reason?o.jsx("div",{className:"sandbox-approval-reason",children:e.reason}):null,i?o.jsx("pre",{children:i}):null,r?o.jsx("pre",{children:r}):null,e!=null&&e.cwd?o.jsxs("div",{className:"sandbox-approval-meta",children:["执行目录 ",o.jsx("code",{children:e.cwd})]}):null,n?o.jsx("div",{className:"sandbox-control-error",children:n}):null]}),o.jsxs("footer",{className:"sandbox-control-actions sandbox-approval-actions",children:[o.jsx("button",{type:"button",disabled:t,onClick:()=>s("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>s("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>s("acceptForSession"),children:[t?o.jsx(Fo,{className:"spin"}):null,"本会话允许"]})]})]})}const VRe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function uD(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function GRe({session:e,onBack:t,onOpen:n,onDelete:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=VRe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(b){f(b instanceof Error?b.message:String(b))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await s()}catch(b){f(b instanceof Error?b.message:String(b)),r(!1)}finally{u(!1)}}};return o.jsxs("section",{className:"sandbox-agent-details",children:[o.jsxs("header",{className:"sandbox-agent-details-header",children:[o.jsxs("button",{type:"button",className:"sandbox-agent-back",onClick:t,children:[o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"返回智能体"]}),o.jsxs("div",{children:[o.jsx("h1",{children:e.displayName||`${h} 智能体`}),o.jsxs("p",{children:[h," AgentKit Session 详情"]})]})]}),d?o.jsx("div",{className:"sandbox-agent-detail-error",role:"alert",children:d}):null,o.jsxs("div",{className:"sandbox-agent-detail-panel",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"智能体类型"}),o.jsx("dd",{children:h})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:D1(e.status)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建人"}),o.jsx("dd",{children:e.createdBy||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具类型"}),o.jsx("dd",{children:e.toolType||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:uD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:uD(e.expireAt)})]}),o.jsxs("div",{className:"is-wide",children:[o.jsx("dt",{children:"Session ID"}),o.jsx("dd",{children:e.id})]})]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"sandbox-agent-delete",disabled:a||c,onClick:()=>r(!0),children:"删除智能体"}),o.jsx("button",{type:"button",className:"sandbox-agent-open",disabled:a||c,"aria-busy":a||void 0,onClick:()=>void p(),children:a?"打开中…":"打开智能体"})]})]}),i?o.jsx("div",{className:"confirm-scrim",onClick:()=>!c&&r(!1),children:o.jsxs("div",{className:"confirm-box",role:"alertdialog","aria-modal":"true","aria-labelledby":"sandbox-agent-delete-title",onClick:b=>b.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"sandbox-agent-delete-title",children:"删除智能体?"}),o.jsxs("div",{className:"confirm-text",children:["将删除“",e.displayName||`${h} 智能体`,"”及其 AgentKit Session,此操作无法撤销。"]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",disabled:c,onClick:()=>r(!1),children:"取消"}),o.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",disabled:c,onClick:()=>void m(),children:c?"删除中…":"确认删除"})]})]})}):null]})}const KRe="_SegmentedControl_1sl7d_1",qRe="_SegmentedControlOption_1sl7d_140",YRe="_SegmentedControlThumb_1sl7d_219",MN={SegmentedControl:KRe,SegmentedControlOption:qRe,SegmentedControlThumb:YRe},Zb=({value:e,onChange:t,children:n,block:s,pill:i=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=g.useRef(null),f=g.useRef(null),h=g.useCallback(m=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let E=Math.floor(y.clientWidth);const w=y.offsetLeft;if(x-(E+w)<2&&(E=E-1),v.style.width=`${Math.floor(E)}px`,v.style.transform=`translateX(${w}px)`,b.scrollWidth>x){const _=x*.15,S=b.scrollLeft,k=y.offsetLeft,T=k+E;(kS+x-_)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);LSe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const b=m.style.transition;m.style.transition="",h(!1),m.style.transition=b}}),g.useLayoutEffect(()=>{const m=d.current,b=f.current;!m||!b||(h(!!b.style.transition),b.style.transition||oN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,i]);const p=m=>{m&&t&&t(m)};return o.jsxs(gCe,{ref:d,className:ra(MN.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":s?"":void 0,"data-pill":i?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:MN.SegmentedControlThumb,ref:f}),n]})},WRe=({children:e,...t})=>o.jsx(vCe,{className:MN.SegmentedControlOption,...t,onPointerEnter:L$,children:o.jsx("span",{className:"relative",children:e})});Zb.Option=WRe;function XRe({workspace:e,onBack:t}){const[n,s]=g.useState("main"),[i,r]=g.useState(""),[a,l]=g.useState(!1),[c,u]=g.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";g.useEffect(()=>{s("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(s("terminal"),!(i||a)){l(!0),u("");try{const h=await tn.launchAgentTerminal(e.kind,e.session.id);r(h.url)}catch(h){u(h instanceof Error?h.message:String(h))}finally{l(!1)}}};return o.jsxs("section",{className:"sandbox-agent-workspace",children:[o.jsxs("header",{children:[o.jsxs("div",{className:"sandbox-agent-workspace-title",children:[o.jsx("button",{type:"button",onClick:t,"aria-label":"返回智能体列表",children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.session.displayName||`${d} 智能体`}),o.jsxs("p",{children:[o.jsxs("span",{children:["创建人 ",e.session.createdBy||"未知"]}),o.jsx("span",{className:"sandbox-agent-workspace-status","data-ready":e.session.status.toLowerCase()==="ready"||void 0,children:D1(e.session.status)})]})]})]}),o.jsxs(Zb,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():s("main")},children:[o.jsx(Zb.Option,{value:"main",children:"主界面"}),o.jsx(Zb.Option,{value:"terminal",children:"终端"})]})]}),o.jsx("div",{className:"sandbox-agent-workspace-surface",children:n==="main"?o.jsx("iframe",{src:e.webuiUrl,title:`${d} 主界面`,allow:"clipboard-read; clipboard-write"}):a?o.jsx("div",{className:"sandbox-agent-workspace-state",role:"status",children:"正在打开终端…"}):c?o.jsxs("div",{className:"sandbox-agent-workspace-state is-error",role:"alert",children:[o.jsx("p",{children:c}),o.jsx("button",{type:"button",onClick:()=>void f(),children:"重新尝试"})]}):i?o.jsx("iframe",{src:i,title:`${d} 终端`}):null})]})}const aE=[{name:"model",usage:"/model [model]",description:"显示或切换当前对话模型",keywords:["模型","switch"]},{name:"models",usage:"/models",description:"列出 app-server 可用模型",keywords:["模型列表","list"]},{name:"skill",usage:"/skill",description:"浏览并调用当前工作区可用的 Skill",keywords:["技能","workflow"]},{name:"skills",usage:"/skills",description:"浏览并调用当前工作区可用的 Skills",keywords:["技能列表","workflow","list"]},{name:"new",usage:"/new",description:"开始一个新对话",keywords:["新建","对话"]},{name:"resume",usage:"/resume [thread]",description:"打开历史会话或恢复指定 thread",keywords:["历史","恢复","session"]},{name:"fork",usage:"/fork",description:"从当前上下文分叉一个新对话",keywords:["分叉","branch"]},{name:"compact",usage:"/compact",description:"压缩当前对话上下文",keywords:["压缩","上下文"]},{name:"archive",usage:"/archive",description:"归档当前对话并新建对话",keywords:["归档","关闭"]},{name:"status",usage:"/status",description:"显示当前连接、thread、模型与 token 状态",keywords:["状态","连接","token"]},{name:"clear",usage:"/clear",description:"清空当前视图并开始新对话",keywords:["清空","重置"]},{name:"help",usage:"/help",description:"显示 Sandbox 支持的快捷命令",keywords:["帮助","命令"]}];function QRe(e){var n;const t=e.trim().match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(t)return{name:t[1].toLocaleLowerCase(),argument:((n=t[2])==null?void 0:n.trim())??""}}function ZRe(e){const t=e.toLocaleLowerCase();return aE.filter(n=>!t||[n.name,n.description,...n.keywords].some(s=>s.toLocaleLowerCase().includes(t))).sort((n,s)=>dD(n,t)-dD(s,t)).slice(0,12)}function dD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:aE.indexOf(e)}function JRe(e,t){const n=t.toLocaleLowerCase();return e.filter(s=>!n||`${s.id} ${s.displayName} ${s.description}`.toLocaleLowerCase().includes(n)).sort((s,i)=>{if(!n)return Number(i.isDefault)-Number(s.isDefault);const r=s.id.toLocaleLowerCase(),a=i.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,s.displayName)-l(a,i.displayName)}).slice(0,12)}function eOe(){return aE.map(e=>({label:e.usage,value:e.description}))}function tOe(e,t){return e.map(n=>{const s=n.displayName.trim(),i=s&&s!==n.id?`${s} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${i} — ${n.description}`:i,code:!1}})}function nOe(e){const t=[{label:"Thread",value:e.threadId,code:!0},{label:"工作空间",value:e.cwd||"未设置",code:!!e.cwd}];return e.model&&t.push({label:"模型",value:e.model,code:!0}),t.push({label:"状态",value:e.busy?"运行中":"空闲"}),e.threadTotal&&t.push({label:"累计 Token",value:e.threadTotal.totalTokens.toLocaleString()}),e.modelContextWindow!==void 0&&t.push({label:"上下文窗口",value:e.modelContextWindow.toLocaleString()}),t}function sOe(e){return e.messages.map(t=>{var s;const n=[];return t.role==="user"&&((s=t.skillNames)!=null&&s.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(i=>({name:i,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function iOe({appName:e,value:t,onChange:n,onSubmit:s,disabled:i,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:b,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const _=g.useRef(null),S=g.useRef(null),k=g.useRef(null),T=g.useRef(null),[C,I]=g.useState(!1),[j,O]=g.useState(0),[z,D]=g.useState(!1);g.useLayoutEffect(()=>{const V=_.current;V&&(V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,200)}px`)},[t]);const F=g.useMemo(()=>{if(!t.startsWith("/")||t.includes(` @@ -1092,4 +1092,4 @@ ${E}`:E),(w=n.current)==null||w.focus()},y=async E=>{if(E.preventDefault(),!(u|| `),output:Z.filter(we=>we.role==="assistant").map(Ic).filter(Boolean).join(` -`),toolCalls:Z.flatMap(yR),trace:ce})},rC=async(L,B,Z="")=>{var st,lt,Re,dt,Dt,ds,Qi,ft;const ce=(st=L.meta)==null?void 0:st.eventId,we=a;if(!ce||!we||!Xi)return;const Ce=Ic(L),Qe=(lt=L.meta)==null?void 0:lt.feedback,He={...Qe,rating:B,syncStatus:"syncing",updatedAt:Date.now()/1e3};xt(we,ht=>ht.map(wt=>{var pt;return((pt=wt.meta)==null?void 0:pt.eventId)===ce?{...wt,meta:{...wt.meta,feedback:He}}:wt})),_t(ht=>new Set(ht).add(ce)),wn!=null&&wn.runtimeId&&ho&&jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Re=L.meta)==null?void 0:Re.invocationId,rating:B,input:Z,output:Ce,createdAt:(dt=L.meta)!=null&&dt.ts?new Date(L.meta.ts*1e3).toISOString():void 0});try{const ht=await NB({appName:n,userId:Be,sessionId:we,eventId:ce,rating:B});xt(we,wt=>wt.map(pt=>{var an;return((an=pt.meta)==null?void 0:an.eventId)===ce?{...pt,meta:{...pt.meta,feedback:ht}}:pt})),r(wt=>wt.map(pt=>pt.id===we?{...pt,state:{...pt.state??{},[`veadk_feedback:${ce}`]:ht}}:pt)),wn!=null&&wn.runtimeId&&ho&&(jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Dt=L.meta)==null?void 0:Dt.invocationId,rating:ht.rating,input:Z,output:Ce,createdAt:(ds=L.meta)!=null&&ds.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),AB({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,pageSize:100}))}catch(ht){xt(we,wt=>wt.map(pt=>{var an;return((an=pt.meta)==null?void 0:an.eventId)===ce?{...pt,meta:{...pt.meta,feedback:Qe}}:pt})),wn!=null&&wn.runtimeId&&ho&&jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Qi=L.meta)==null?void 0:Qi.invocationId,rating:(Qe==null?void 0:Qe.rating)??null,input:Z,output:Ce,createdAt:(ft=L.meta)!=null&&ft.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),le.current===we&&pe(ht instanceof Error?ht.message:String(ht))}finally{_t(ht=>{const wt=new Set(ht);return wt.delete(ce),wt})}},r0=async L=>{wh(ya());let B=We.current.get(L);B||(B=await zw(L),We.current.set(L,B)),at(B),As(Z=>Z+1),s(L),Wi(null),Ui(""),Ai(""),xs(!1),Qt(!1),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),rl()},DG=async L=>{await r0(L)},PG=L=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}xs(!1),Qt(!1),pE(L),oi(null),Lt(null),$n(!0),pe("")},aC=async(L,B=!1)=>{if(L.runtime)try{const Z=await Kb(L.runtime.runtimeId,L.name,L.runtime.region,L.runtime.currentVersion);await r0(Z)}catch(Z){const ce=Z instanceof Error?Z.message:String(Z);if(pe(ce),B)throw new Error(ce)}},BG=L=>{L.runtime&&(Wi(L),Ui(""),Ai(""),xs(!1),Qt(!0),pe(""))},UG=L=>{if(!Pr){pe("当前账号没有创建智能体的权限。");return}W2(L,!0)},NE=()=>{js(null),p&&fo(),le.current="",l(""),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),Ui(""),Ai(""),xs(!0),Dr(null),pe("")},FG=()=>{js(null),p&&fo(),le.current="",l(""),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr("catalog"),pe("")},$G=async L=>{if(Lr(""),Jg(""),L.runtimeId&&L.id.startsWith("detail:")){try{const B=await Kb(L.runtimeId,L.label,L.region??"cn-beijing",L.currentVersion);await r0(B)}catch(B){pe(B instanceof Error?B.message:String(B))}return}await r0(L.id)},TE=xn!=null&&xn.runtime?sl.find(L=>{var B;return L.runtimeId===((B=xn.runtime)==null?void 0:B.runtimeId)}):void 0,ol=xn!=null&&xn.runtime?{id:`detail:${xn.runtime.runtimeId}`,label:xn.name,app:xn.appName??xn.name,remote:!0,runtimeApp:TE==null?void 0:TE.apps[0],runtimeId:xn.runtime.runtimeId,region:xn.runtime.region,currentVersion:xn.runtime.currentVersion,canDelete:xn.runtime.canDelete}:null,oC=ls!==null?"feedback":fc?"applications":Je?"search":nl||On||Ze||Ve?"agents":a||co||xh||Xg||Qg?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Fte,{branding:Wn,access:ye,features:yn,sessions:i,currentSessionId:a,activePage:oC,streamingSids:qn,onNewChat:SG,onSearch:()=>{js(null),p&&fo(),Lt(null),ai(!1),Os(!1),$n(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),rt(!0),pe("")},onQuickCreate:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}p&&fo(),le.current="",l(""),ai(!1),Os(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),Lt(null),oi(null),pE("cn-beijing"),$n(!0),pe("")},onSkillCenter:()=>{p&&fo(),Lt(null),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),ai(!0),pe("")},onAddAgent:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}p&&fo(),le.current="",Lt(null),ai(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),l(""),$n(!1),Os(!0),pe("")},onMyAgents:NE,onApplications:FG,onIssueFeedback:()=>{ls===null&&(js(oC??(p?"sandbox":a?"conversation":"workspace")),pe(""))},onPickSession:L=>{js(null),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),pe(""),_h(L)},onDeleteSession:_G,userInfo:us,version:rn,onLogout:cG}),(()=>{const L=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(_Re,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:rl}),p?o.jsx(iOe,{appName:n,value:on,onChange:Mt,onSubmit:B=>void vG(B),disabled:!1,busy:y||Xn.commandBusy,attachments:ot,onAddFiles:xG,onRemoveAttachment:EG,actions:{onOpenTerminal:()=>void _E("terminal"),onOpenBrowser:()=>void _E("browser"),onOpenPermissions:()=>{S(""),T(!0)},onOpenWorkspace:()=>{S(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:K||y},models:Xn.models,modelsLoading:Xn.modelsLoading,modelsLoaded:Xn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Xn.loadModels(),skills:Xn.skills,skillsLoading:Xn.skillsLoading,skillsLoaded:Xn.skillsLoaded,selectedSkills:Xn.selectedSkills,onRequestSkills:()=>void Xn.loadSkills(),onSelectedSkillsChange:Xn.setSelectedSkills}):o.jsx(_Te,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?iC(n):"Agent",value:on,onChange:Mt,onSubmit:()=>{if(!p&&Nt==="skill-create"){const we=on.trim();if(!we||Et)return;const Ce={id:`pending-${Date.now()}`,prompt:we,status:"provisioning",candidates:ZA.map((He,st)=>({id:`pending-${st}`,model:He,modelLabel:He,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};nn(!0);const Qe=++Bn.current;pe(""),Xe(Ce),Mt(""),sje(we,He=>{Bn.current===Qe&&Xe(He)}).then(He=>{Bn.current===Qe&&Xe(He)}).catch(He=>{Bn.current===Qe&&(Xe(null),Mt(we),pe(He instanceof Error?He.message:String(He)))}).finally(()=>{Bn.current===Qe&&nn(!1)});return}const B=on;if(Mt(""),p){X2(B);return}const Z=ot,ce=hn;mt([]),Xt(Va()),Z2(B,Z,ce),Eo(Z)},disabled:p?!1:!Be||Nt==="temporary"||Nt==="agent"&&!n,busy:p?y:Nt==="skill-create"?Et:Ru,showMeta:Ke.length>0&&!p,attachments:p?[]:ot,skills:p?[]:hh,agents:p?[]:Yg,invocation:p?Va():hn,capabilitiesLoading:!p&&kn,allowAttachments:!p,onInvocationChange:Xt,onAddFiles:IG,onRemoveAttachment:lE,newChatMode:p?"agent":Nt,newChatTask:p?null:Ge,newChatLayout:!p&&Ke.length===0&&xe===null,showAgentPicker:!p&&Ke.length===0&&xe===null&&Nt==="agent",agentPickerDisabled:!Be||Ru,selectedRuntimeId:Xi==null?void 0:Xi.runtimeId,runtimeScope:ye.capabilities.runtimeScope,onSelectRuntime:async B=>{var Z;await aC({id:B.runtimeId,name:B.name,description:((Z=B.description)==null?void 0:Z.trim())||"暂无描述",createdAt:B.createdAt??"",specificationLabel:"地域",specification:B.region==="cn-shanghai"?"上海":"北京",isMine:B.isMine,runtime:{runtimeId:B.runtimeId,region:B.region,currentVersion:B.currentVersion,canDelete:B.canDelete}},!0)},onSelectSandboxSession:SE,showModeSelector:!1,temporaryEnabled:St&&it.temporaryEnabled,skillCreateEnabled:St&&it.skillCreateEnabled,harnessEnabled:St&&it.harnessEnabled,builtinTools:St?it.builtinTools:[],onModeChange:B=>{if(!(B==="temporary"&&!it.temporaryEnabled||B==="skill-create"&&!it.skillCreateEnabled)){if(B==="temporary"){Vt(null),Pt(B),W2();return}if(Pt(B),B!=="agent"&&Vt(null),pe(""),B==="skill-create"){Xt(Va());const Z=a&&Ue.length===0&&ot.length>0?a:"";ph(ot),mt([]),Z&&(le.current="",l(""),gh(Z))}}},onTaskChange:Vt})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Ie&&o.jsx("div",{className:"error",role:"alert",children:Ie}),et&&o.jsx("div",{className:"error",role:"alert",children:et}),Fg&&o.jsxs("div",{className:"session-loading",children:[o.jsx(fn,{className:"icon spin"})," 加载会话…"]}),dn&&!nC&&!eC&&!tC&&!Je&&!xh&&al===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:TG,children:[o.jsx(bk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),ls!==null?o.jsx(bOe,{initialModule:COe(ls),onSubmit:LG}):fc==="coding-agents"?o.jsx(MNe,{onBack:()=>Dr("catalog")}):fc==="feishu"?o.jsx(gNe,{onBack:()=>Dr("catalog")}):fc&&fc!=="catalog"?o.jsx(lNe,{automation:fc,onBack:()=>Dr("catalog")}):fc==="catalog"?o.jsx(sNe,{onOpen:Dr}):Ve?o.jsx(XRe,{workspace:Ve,onBack:NE}):Ze?o.jsx(GRe,{session:Ze,onBack:NE,onOpen:()=>SE(Ze),onDelete:()=>pG(Ze)}):nl?o.jsx(j_e,{canCreate:Pr,runtimeScope:ye.capabilities.runtimeScope,onCreateAgent:PG,onUseAgent:aC,onViewAgentDetails:BG,onCreateSandboxAgent:UG,onUseSandboxAgent:SE,onViewSandboxAgentDetails:hG,sandboxRefreshKey:ke,connectedRuntimeId:Th,hiddenRuntimeIds:ZV,drafts:Lu,deploymentTasks:bh,draftDeploymentTaskIds:cE,onViewDeploymentTask:xE,onEditDraft:B=>{xs(!1),oi(B.draft),he(B.id),Te.current=B,la(B.deploymentTarget??null),Ui(""),Ai(""),Lt("custom"),pe("")},onDeleteDraft:B=>V2([B])}):nC?o.jsx(xSe,{agents:ol?[ol]:OG,drafts:Lu,agentOrder:Eh,selectedAgentId:n,agentInfo:Tt,agentInfoAgentId:n,loadingAgentInfo:kn,canCreate:Pr,canUpdate:Pr||J2,loadingAgents:WV,agentsError:XV,deploymentTasks:bh,focusedDeploymentTaskId:H2,focusedAgentId:(ol==null?void 0:ol.id)??z2,focusedAgentSection:VV,focusedCaseKind:GV,feedbackCasePreview:qV,detailOnly:!0,onRetryAgents:()=>void bE(),onAgentOrderChange:tG,onDeleteAgents:nG,onDeleteDrafts:V2,onSelectAgent:DG,onTalkAgent:$G,onOpenFeedbackCase:B=>void NG(B),onFeedbackCasesDeleted:kG,onCreateAgent:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}Qt(!1),$n(!0),Lt(null),oi(null),la(null),pE("cn-beijing"),he(""),Te.current=null,Ui(""),Ai(""),pe("")},onUpdateAgent:(B,Z)=>{var Qe,He;if(!J2&&!Pr){pe("当前账号没有管理 Agent 的权限。");return}if(!Z.canUpdate){pe(Z.reason||"当前 Runtime 不支持原地更新。");return}if(!Z.runtime.runtimeId){pe("仅支持更新已部署的云端智能体。");return}if(!Z.runtime.region){pe("Runtime 缺少地域信息,无法更新。");return}if(!((Qe=Z.agent)!=null&&Qe.appName)){pe("Runtime 缺少智能体名称,无法更新。");return}const ce=Object.fromEntries(Z.runtime.envs.map(({key:st,value:lt})=>[st,lt])),we={...B,deployment:{...B.deployment??{feishuEnabled:!1},envValues:{...ce,...((He=B.deployment)==null?void 0:He.envValues)??{}}}};Qt(!1),oi(we);const Ce=`runtime-${Z.runtime.runtimeId}`;he(Ce),Te.current=Lu.find(st=>st.id===Ce)??null,Ui(""),Ai(""),la({runtimeId:Z.runtime.runtimeId,name:Z.runtime.name||Z.agent.name||B.name,region:Z.runtime.region,appName:Z.agent.appName,currentVersion:Z.runtime.currentVersion}),Lt("custom"),pe("")},onEditDraft:B=>{Qt(!1),oi(B.draft),he(B.id),Te.current=B,la(B.deploymentTarget??null),Ui(""),Ai(""),Lt("custom"),pe("")}},(ol==null?void 0:ol.id)??"workspace"):eC?o.jsx(aH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:MOe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{$n(!1),oi(null),Lt("menu")}},{key:"package",icon:LOe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{$n(!1),oi(null),Lt("package")}},{key:"migration",icon:DOe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):Je?o.jsx(jte,{userId:Be,appId:n,agentInfo:Tt,capabilitiesLoading:kn,agentLabel:iC,onOpenSession:uG}):tC?o.jsx(Xwe,{onAdded:B=>{wh(ya()),Os(!1),s(B)},onCancel:()=>Os(!1)}):xh?o.jsx(Kwe,{}):al!==null&&!uE?o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[o.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):al==="menu"?o.jsx(qke,{onSelect:B=>{oi(null),la(null),Ui(""),Ai(""),he(B==="custom"?`draft-${Date.now().toString(36)}`:""),Te.current=null,Lt(B)},onImport:B=>{oi(B),la(null),Ui(""),Ai(""),he(`draft-${Date.now().toString(36)}`),Te.current=null,Lt("custom")}}):al==="intelligent"?o.jsx($Ae,{userId:Be,onBack:()=>Lt("menu"),onCreate:s0,onAgentAdded:yE,onDeploymentTaskChange:Mu}):al==="custom"?o.jsx(CIe,{initialDraft:fE??void 0,onBack:()=>Lt("menu"),onCreate:s0,onAgentAdded:yE,features:yn,onDeploymentTaskChange:Mu,deploymentTarget:Pu??void 0,initialDeployRegion:t0,onDraftChange:(B,Z)=>{se&&(Z?eG(se,B,Pu??void 0):G2(se))},onDiscard:se?()=>{G2(se),he(""),Te.current=null,oi(null),la(null),Ui(""),Ai(n),Lt(null),$n(!1),Qt(!0),pe("")}:void 0,onDeploymentStarted:K2,onDeploymentComplete:q2},se||"custom"):al==="template"?o.jsx(RIe,{onBack:()=>Lt("menu"),onCreate:s0}):al==="workflow"?o.jsx(FIe,{onBack:()=>Lt("menu"),onCreate:s0}):al==="package"?o.jsx(GIe,{onBack:()=>{Lt(null),$n(!0)},onAgentAdded:yE,onDeploymentTaskChange:Mu,onDeploymentStarted:K2,onDeploymentComplete:q2,initialDeployRegion:t0}):Ke.length===0&&xe?o.jsx(yje,{initialJob:xe}):Ke.length===0&&!St?o.jsxs("div",{className:"session-loading",children:[o.jsx(fn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):Ke.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(yRe,{canUpdate:ye.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":Nt==="skill-create"?"想创建一个什么 Skill?":Rs})]}),L]}),o.jsx(aRe,{})]},`welcome-${it.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${oE?" is-streaming":""}`,ref:Sh,onScroll:sG,onWheel:iG,onTouchMove:rG,children:Ke.map((B,Z)=>{var ft,ht,wt,pt,an,Es,Fi;const ce=Z===Ke.length-1;if(B.role==="system")return B.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(NRe,{activity:B.activity,time:PN((ft=B.meta)==null?void 0:ft.ts)})},B.activity.id):null;if(B.role==="user"){const Mn=B.blocks.map(en=>en.kind==="text"?en.text:"").join(""),Ha=B.blocks.flatMap(en=>en.kind==="attachment"?en.files:[]),li=B.blocks.find(en=>en.kind==="invocation");return o.jsxs(ts.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(li==null?void 0:li.kind)==="invocation"&&o.jsx(B1,{value:li.value}),Ha.length>0&&o.jsx(U1,{appName:n,items:Ha}),Mn&&o.jsx("div",{className:"bubble",children:o.jsx(nh,{text:Mn})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((ht=B.meta)==null?void 0:ht.ts)&&o.jsx("span",{className:"meta-text",children:PN(B.meta.ts)}),o.jsx(pD,{text:Mn})]})]},Z)}const we=((wt=B.meta)==null?void 0:wt.author)??"",Ce=we&&Hs?DN(Hs,we):void 0,Qe=!!(we&&dc.length>0&&!dc.includes(we)),He=(Ce==null?void 0:Ce.name)||we,st=(Ce==null?void 0:Ce.description)||(Qe?"正在执行主 Agent 移交的任务。":"");if(B.blocks.length>0&&B.blocks.every(Mn=>Mn.kind==="agent-transfer"))return null;const lt=B.blocks.length===0,Re=((an=(pt=B.meta)==null?void 0:pt.feedback)==null?void 0:an.rating)??null,dt=((Es=B.meta)==null?void 0:Es.eventId)??"",Dt=ut.has(dt),ds=!!(Xi&&dt&&Ic(B)),Qi=ds?hD(Ke,Z):"";return o.jsxs(ts.div,{ref:Mn=>{dt&&(Mn?EE.current.set(dt,Mn):EE.current.delete(dt))},className:["turn turn--assistant",Qe?"turn--subagent":"",vh&&vh===dt?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Qe&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(HJ,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:He})]}),o.jsx("p",{className:"subagent-run-description",title:st,children:st})]}),lt?ce&&Mr?o.jsx(iH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(XA,{appName:n,blocks:B.blocks,streaming:ce&&(Mr||zg),onStreamFrame:ce?aG:void 0,onAction:jG,onAuth:RG,onArtifactDownload:(Mn,Ha)=>jB(n,Be,a,Mn,Ha),onArtifactPreview:(Mn,Ha)=>OB(n,Be,a,Mn,Ha)}),!(ce&&Mr)&&!FOe(B)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(ce&&Mr)&&!$Oe(B)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Fi=B.meta)!=null&&Fi.sandboxUsage)?o.jsx(kRe,{usage:B.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[ds&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Re==="good","aria-busy":Dt,title:Re==="good"?"取消点赞":"赞",disabled:Dt,onClick:()=>void rC(B,Re==="good"?null:"good",Qi),children:o.jsx(Ote,{className:"icon",filled:Re==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Re==="bad","aria-busy":Dt,title:Re==="bad"?"取消点踩":"踩",disabled:Dt,onClick:()=>void rC(B,Re==="bad"?null:"bad",Qi),children:o.jsx(Mte,{className:"icon",filled:Re==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>bn({turn:B,input:hD(Ke,Z)}),children:o.jsx(u8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var Mn;Yn((Mn=B.meta)!=null&&Mn.ts?B.meta.ts*1e3:Date.now()),Bt(!0)},children:o.jsx(POe,{})})]}),o.jsx(pD,{text:Ic(B)})]}),B.meta&&o.jsx("span",{className:"meta-text",children:BOe(B.meta)})]})]})]},Z)})}),!p&&o.jsx(dfe,{appName:n,info:Tt,loading:kn,activeAgent:Gg,seenAgents:Kg,execPath:qg,capabilities:pn,capabilityLoading:Kn,capabilityMutating:Qs,builtinTools:gi,onAddCapability:AG,onRemoveCapability:B=>void CG(B)}),o.jsx("div",{className:"conversation-composer-slot",children:L})]})]})})})(),In&&a&&o.jsx(fOe,{onClose:()=>bn(null),onSubmit:MG}),cs&&a&&o.jsx(mV,{appName:n,sessionId:a,endTimeMs:kt,onClose:()=>Bt(!1)}),o.jsx(SRe,{open:W,state:ue,agentKind:ge,error:_e,onCancel:dG,onConfirm:L=>void fG(L)}),p?o.jsxs(o.Fragment,{children:[o.jsx(DRe,{open:j!==null,kind:j??"terminal",launch:z,loading:F,error:M,onReload:()=>{j&&_E(j)},onClose:()=>{O(null),D(null),A(!1),P("")}}),o.jsx($Re,{open:k,value:p.permissions,busy:E||y,error:_,onSave:L=>void mG(L),onClose:()=>{E||(T(!1),S(""))}}),o.jsx(HRe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:_,browse:gG,onSave:L=>void bG(L),onClose:()=>{E||(I(!1),S(""))}}),o.jsx(PRe,{open:Xn.threadsOpen,threads:Xn.threads,currentThreadId:p.threadId,loading:Xn.threadsLoading,error:Xn.threadsError,onSelect:L=>void Xn.resumeThread(L),onClose:Xn.closeThreads}),o.jsx(zRe,{approval:$,busy:Y,error:U,onDecision:L=>void yG(L)})]}):null,o.jsx(lOe,{open:jr,checking:cc,error:ju,onLogin:()=>void oG()}),JV&&o.jsx("div",{className:"confirm-scrim",onClick:()=>mE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:L=>L.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>mE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{oi(null),Lt("menu"),mE(!1)},children:"确定返回"})]})]})})]})}const ED="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(ED)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(ED,String(t))}catch{}window.location.reload()}});(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||$Y.createRoot(document.getElementById("root")).render(o.jsx(Ot.StrictMode,{children:o.jsx(ZY,{reducedMotion:"user",children:o.jsx(jJ,{maskOpacity:.9,children:o.jsx(XOe,{})})})}));export{x2 as $,gbe as A,bbe as B,$7 as C,o as D,gt as E,Pn as F,Ht as G,eMe as H,Wz as I,O0e as J,mi as K,g as L,k1 as M,Tr as N,tMe as O,Rz as P,$p as Q,Ot as R,du as S,gCe as T,Pz as U,Li as V,lr as W,Au as X,Q1 as Y,Dz as Z,hu as _,sa as a,I7 as a0,Yz as b,vCe as c,HM as d,Tf as e,qi as f,nMe as g,Ez as h,lc as i,J1 as j,Of as k,VAe as l,cMe as m,gA as n,yme as o,ZAe as p,Lm as q,Zt as r,L0e as s,H0e as t,Eme as u,Mf as v,Hbe as w,S0e as x,_0e as y,Xbe as z}; +`),toolCalls:Z.flatMap(yR),trace:ce})},rC=async(L,B,Z="")=>{var st,lt,Re,dt,Dt,ds,Qi,ft;const ce=(st=L.meta)==null?void 0:st.eventId,we=a;if(!ce||!we||!Xi)return;const Ce=Ic(L),Qe=(lt=L.meta)==null?void 0:lt.feedback,He={...Qe,rating:B,syncStatus:"syncing",updatedAt:Date.now()/1e3};xt(we,ht=>ht.map(wt=>{var pt;return((pt=wt.meta)==null?void 0:pt.eventId)===ce?{...wt,meta:{...wt.meta,feedback:He}}:wt})),_t(ht=>new Set(ht).add(ce)),wn!=null&&wn.runtimeId&&ho&&jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Re=L.meta)==null?void 0:Re.invocationId,rating:B,input:Z,output:Ce,createdAt:(dt=L.meta)!=null&&dt.ts?new Date(L.meta.ts*1e3).toISOString():void 0});try{const ht=await NB({appName:n,userId:Be,sessionId:we,eventId:ce,rating:B});xt(we,wt=>wt.map(pt=>{var an;return((an=pt.meta)==null?void 0:an.eventId)===ce?{...pt,meta:{...pt.meta,feedback:ht}}:pt})),r(wt=>wt.map(pt=>pt.id===we?{...pt,state:{...pt.state??{},[`veadk_feedback:${ce}`]:ht}}:pt)),wn!=null&&wn.runtimeId&&ho&&(jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Dt=L.meta)==null?void 0:Dt.invocationId,rating:ht.rating,input:Z,output:Ce,createdAt:(ds=L.meta)!=null&&ds.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),AB({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,pageSize:100}))}catch(ht){xt(we,wt=>wt.map(pt=>{var an;return((an=pt.meta)==null?void 0:an.eventId)===ce?{...pt,meta:{...pt.meta,feedback:Qe}}:pt})),wn!=null&&wn.runtimeId&&ho&&jb({runtimeId:wn.runtimeId,region:wn.region??"cn-beijing",appName:ho,userId:Be,sessionId:we,messageId:ce,invocationId:(Qi=L.meta)==null?void 0:Qi.invocationId,rating:(Qe==null?void 0:Qe.rating)??null,input:Z,output:Ce,createdAt:(ft=L.meta)!=null&&ft.ts?new Date(L.meta.ts*1e3).toISOString():void 0}),le.current===we&&pe(ht instanceof Error?ht.message:String(ht))}finally{_t(ht=>{const wt=new Set(ht);return wt.delete(ce),wt})}},r0=async L=>{wh(ya());let B=We.current.get(L);B||(B=await zw(L),We.current.set(L,B)),at(B),As(Z=>Z+1),s(L),Wi(null),Ui(""),Ai(""),xs(!1),Qt(!1),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),rl()},DG=async L=>{await r0(L)},PG=L=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}xs(!1),Qt(!1),pE(L),oi(null),Lt(null),$n(!0),pe("")},aC=async(L,B=!1)=>{if(L.runtime)try{const Z=await Kb(L.runtime.runtimeId,L.name,L.runtime.region,L.runtime.currentVersion);await r0(Z)}catch(Z){const ce=Z instanceof Error?Z.message:String(Z);if(pe(ce),B)throw new Error(ce)}},BG=L=>{L.runtime&&(Wi(L),Ui(""),Ai(""),xs(!1),Qt(!0),pe(""))},UG=L=>{if(!Pr){pe("当前账号没有创建智能体的权限。");return}W2(L,!0)},NE=()=>{js(null),p&&fo(),le.current="",l(""),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),Ui(""),Ai(""),xs(!0),Dr(null),pe("")},FG=()=>{js(null),p&&fo(),le.current="",l(""),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr("catalog"),pe("")},$G=async L=>{if(Lr(""),Jg(""),L.runtimeId&&L.id.startsWith("detail:")){try{const B=await Kb(L.runtimeId,L.label,L.region??"cn-beijing",L.currentVersion);await r0(B)}catch(B){pe(B instanceof Error?B.message:String(B))}return}await r0(L.id)},TE=xn!=null&&xn.runtime?sl.find(L=>{var B;return L.runtimeId===((B=xn.runtime)==null?void 0:B.runtimeId)}):void 0,ol=xn!=null&&xn.runtime?{id:`detail:${xn.runtime.runtimeId}`,label:xn.name,app:xn.appName??xn.name,remote:!0,runtimeApp:TE==null?void 0:TE.apps[0],runtimeId:xn.runtime.runtimeId,region:xn.runtime.region,currentVersion:xn.runtime.currentVersion,canDelete:xn.runtime.canDelete}:null,oC=ls!==null?"feedback":fc?"applications":Je?"search":nl||On||Ze||Ve?"agents":a||co||xh||Xg||Qg?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Fte,{branding:Wn,access:ye,features:yn,sessions:i,currentSessionId:a,activePage:oC,streamingSids:qn,onNewChat:SG,onSearch:()=>{js(null),p&&fo(),Lt(null),ai(!1),Os(!1),$n(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),rt(!0),pe("")},onQuickCreate:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}p&&fo(),le.current="",l(""),ai(!1),Os(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),Lt(null),oi(null),pE("cn-beijing"),$n(!0),pe("")},onSkillCenter:()=>{p&&fo(),Lt(null),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),ai(!0),pe("")},onAddAgent:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}p&&fo(),le.current="",Lt(null),ai(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),l(""),$n(!1),Os(!0),pe("")},onMyAgents:NE,onApplications:FG,onIssueFeedback:()=>{ls===null&&(js(oC??(p?"sandbox":a?"conversation":"workspace")),pe(""))},onPickSession:L=>{js(null),Lt(null),ai(!1),Os(!1),$n(!1),rt(!1),Qt(!1),Wi(null),Le(null),Ne(null),xs(!1),Dr(null),pe(""),_h(L)},onDeleteSession:_G,userInfo:us,version:rn,onLogout:cG}),(()=>{const L=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(_Re,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:rl}),p?o.jsx(iOe,{appName:n,value:on,onChange:Mt,onSubmit:B=>void vG(B),disabled:!1,busy:y||Xn.commandBusy,attachments:ot,onAddFiles:xG,onRemoveAttachment:EG,actions:{onOpenTerminal:()=>void _E("terminal"),onOpenBrowser:()=>void _E("browser"),onOpenPermissions:()=>{S(""),T(!0)},onOpenWorkspace:()=>{S(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:K||y},models:Xn.models,modelsLoading:Xn.modelsLoading,modelsLoaded:Xn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Xn.loadModels(),skills:Xn.skills,skillsLoading:Xn.skillsLoading,skillsLoaded:Xn.skillsLoaded,selectedSkills:Xn.selectedSkills,onRequestSkills:()=>void Xn.loadSkills(),onSelectedSkillsChange:Xn.setSelectedSkills}):o.jsx(_Te,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?iC(n):"Agent",value:on,onChange:Mt,onSubmit:()=>{if(!p&&Nt==="skill-create"){const we=on.trim();if(!we||Et)return;const Ce={id:`pending-${Date.now()}`,prompt:we,status:"provisioning",candidates:ZA.map((He,st)=>({id:`pending-${st}`,model:He,modelLabel:He,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};nn(!0);const Qe=++Bn.current;pe(""),Xe(Ce),Mt(""),sje(we,He=>{Bn.current===Qe&&Xe(He)}).then(He=>{Bn.current===Qe&&Xe(He)}).catch(He=>{Bn.current===Qe&&(Xe(null),Mt(we),pe(He instanceof Error?He.message:String(He)))}).finally(()=>{Bn.current===Qe&&nn(!1)});return}const B=on;if(Mt(""),p){X2(B);return}const Z=ot,ce=hn;mt([]),Xt(Va()),Z2(B,Z,ce),Eo(Z)},disabled:p?!1:!Be||Nt==="temporary"||Nt==="agent"&&!n,busy:p?y:Nt==="skill-create"?Et:Ru,showMeta:Ke.length>0&&!p,attachments:p?[]:ot,skills:p?[]:hh,agents:p?[]:Yg,invocation:p?Va():hn,capabilitiesLoading:!p&&kn,allowAttachments:!p,onInvocationChange:Xt,onAddFiles:IG,onRemoveAttachment:lE,newChatMode:p?"agent":Nt,newChatTask:p?null:Ge,newChatLayout:!p&&Ke.length===0&&xe===null,showAgentPicker:!p&&Ke.length===0&&xe===null&&Nt==="agent",agentPickerDisabled:!Be||Ru,selectedRuntimeId:Xi==null?void 0:Xi.runtimeId,runtimeScope:ye.capabilities.runtimeScope,onSelectRuntime:async B=>{var Z;await aC({id:B.runtimeId,name:B.name,description:((Z=B.description)==null?void 0:Z.trim())||"暂无描述",createdAt:B.createdAt??"",specificationLabel:"地域",specification:B.region==="cn-shanghai"?"上海":"北京",isMine:B.isMine,runtime:{runtimeId:B.runtimeId,region:B.region,currentVersion:B.currentVersion,canDelete:B.canDelete}},!0)},onSelectSandboxSession:SE,showModeSelector:!1,temporaryEnabled:St&&it.temporaryEnabled,skillCreateEnabled:St&&it.skillCreateEnabled,harnessEnabled:St&&it.harnessEnabled,builtinTools:St?it.builtinTools:[],onModeChange:B=>{if(!(B==="temporary"&&!it.temporaryEnabled||B==="skill-create"&&!it.skillCreateEnabled)){if(B==="temporary"){Vt(null),Pt(B),W2();return}if(Pt(B),B!=="agent"&&Vt(null),pe(""),B==="skill-create"){Xt(Va());const Z=a&&Ue.length===0&&ot.length>0?a:"";ph(ot),mt([]),Z&&(le.current="",l(""),gh(Z))}}},onTaskChange:Vt})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Ie&&o.jsx("div",{className:"error",role:"alert",children:Ie}),et&&o.jsx("div",{className:"error",role:"alert",children:et}),Fg&&o.jsxs("div",{className:"session-loading",children:[o.jsx(fn,{className:"icon spin"})," 加载会话…"]}),dn&&!nC&&!eC&&!tC&&!Je&&!xh&&al===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:TG,children:[o.jsx(bk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),ls!==null?o.jsx(bOe,{initialModule:COe(ls),onSubmit:LG}):fc==="coding-agents"?o.jsx(MNe,{onBack:()=>Dr("catalog")}):fc==="feishu"?o.jsx(gNe,{onBack:()=>Dr("catalog")}):fc&&fc!=="catalog"?o.jsx(lNe,{automation:fc,onBack:()=>Dr("catalog")}):fc==="catalog"?o.jsx(sNe,{onOpen:Dr}):Ve?o.jsx(XRe,{workspace:Ve,onBack:NE}):Ze?o.jsx(GRe,{session:Ze,onBack:NE,onOpen:()=>SE(Ze),onDelete:()=>pG(Ze)}):nl?o.jsx(j_e,{canCreate:Pr,runtimeScope:ye.capabilities.runtimeScope,onCreateAgent:PG,onUseAgent:aC,onViewAgentDetails:BG,onCreateSandboxAgent:UG,onUseSandboxAgent:SE,onViewSandboxAgentDetails:hG,sandboxRefreshKey:ke,connectedRuntimeId:Th,hiddenRuntimeIds:ZV,drafts:Lu,deploymentTasks:bh,draftDeploymentTaskIds:cE,onViewDeploymentTask:xE,onEditDraft:B=>{xs(!1),oi(B.draft),he(B.id),Te.current=B,la(B.deploymentTarget??null),Ui(""),Ai(""),Lt("custom"),pe("")},onDeleteDraft:B=>V2([B])}):nC?o.jsx(xSe,{agents:ol?[ol]:OG,drafts:Lu,agentOrder:Eh,selectedAgentId:n,agentInfo:Tt,agentInfoAgentId:n,loadingAgentInfo:kn,canCreate:Pr,canUpdate:Pr||J2,loadingAgents:WV,agentsError:XV,deploymentTasks:bh,focusedDeploymentTaskId:H2,focusedAgentId:(ol==null?void 0:ol.id)??z2,focusedAgentSection:VV,focusedCaseKind:GV,feedbackCasePreview:qV,detailOnly:!0,onRetryAgents:()=>void bE(),onAgentOrderChange:tG,onDeleteAgents:nG,onDeleteDrafts:V2,onSelectAgent:DG,onTalkAgent:$G,onOpenFeedbackCase:B=>void NG(B),onFeedbackCasesDeleted:kG,onCreateAgent:()=>{if(!Pr){pe("当前账号没有添加 Agent 的权限。");return}Qt(!1),$n(!0),Lt(null),oi(null),la(null),pE("cn-beijing"),he(""),Te.current=null,Ui(""),Ai(""),pe("")},onUpdateAgent:(B,Z)=>{var Qe,He;if(!J2&&!Pr){pe("当前账号没有管理 Agent 的权限。");return}if(!Z.canUpdate){pe(Z.reason||"当前 Runtime 不支持原地更新。");return}if(!Z.runtime.runtimeId){pe("仅支持更新已部署的云端智能体。");return}if(!Z.runtime.region){pe("Runtime 缺少地域信息,无法更新。");return}if(!((Qe=Z.agent)!=null&&Qe.appName)){pe("Runtime 缺少智能体名称,无法更新。");return}const ce=Object.fromEntries(Z.runtime.envs.map(({key:st,value:lt})=>[st,lt])),we={...B,deployment:{...B.deployment??{feishuEnabled:!1},network:Z.runtime.network,envValues:{...ce,...((He=B.deployment)==null?void 0:He.envValues)??{}}}};Qt(!1),oi(we);const Ce=`runtime-${Z.runtime.runtimeId}`;he(Ce),Te.current=Lu.find(st=>st.id===Ce)??null,Ui(""),Ai(""),la({runtimeId:Z.runtime.runtimeId,name:Z.runtime.name||Z.agent.name||B.name,region:Z.runtime.region,appName:Z.agent.appName,currentVersion:Z.runtime.currentVersion}),Lt("custom"),pe("")},onEditDraft:B=>{Qt(!1),oi(B.draft),he(B.id),Te.current=B,la(B.deploymentTarget??null),Ui(""),Ai(""),Lt("custom"),pe("")}},(ol==null?void 0:ol.id)??"workspace"):eC?o.jsx(aH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:MOe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{$n(!1),oi(null),Lt("menu")}},{key:"package",icon:LOe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{$n(!1),oi(null),Lt("package")}},{key:"migration",icon:DOe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):Je?o.jsx(jte,{userId:Be,appId:n,agentInfo:Tt,capabilitiesLoading:kn,agentLabel:iC,onOpenSession:uG}):tC?o.jsx(Xwe,{onAdded:B=>{wh(ya()),Os(!1),s(B)},onCancel:()=>Os(!1)}):xh?o.jsx(Kwe,{}):al!==null&&!uE?o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[o.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):al==="menu"?o.jsx(qke,{onSelect:B=>{oi(null),la(null),Ui(""),Ai(""),he(B==="custom"?`draft-${Date.now().toString(36)}`:""),Te.current=null,Lt(B)},onImport:B=>{oi(B),la(null),Ui(""),Ai(""),he(`draft-${Date.now().toString(36)}`),Te.current=null,Lt("custom")}}):al==="intelligent"?o.jsx($Ae,{userId:Be,onBack:()=>Lt("menu"),onCreate:s0,onAgentAdded:yE,onDeploymentTaskChange:Mu}):al==="custom"?o.jsx(CIe,{initialDraft:fE??void 0,onBack:()=>Lt("menu"),onCreate:s0,onAgentAdded:yE,features:yn,onDeploymentTaskChange:Mu,deploymentTarget:Pu??void 0,initialDeployRegion:t0,onDraftChange:(B,Z)=>{se&&(Z?eG(se,B,Pu??void 0):G2(se))},onDiscard:se?()=>{G2(se),he(""),Te.current=null,oi(null),la(null),Ui(""),Ai(n),Lt(null),$n(!1),Qt(!0),pe("")}:void 0,onDeploymentStarted:K2,onDeploymentComplete:q2},se||"custom"):al==="template"?o.jsx(RIe,{onBack:()=>Lt("menu"),onCreate:s0}):al==="workflow"?o.jsx(FIe,{onBack:()=>Lt("menu"),onCreate:s0}):al==="package"?o.jsx(GIe,{onBack:()=>{Lt(null),$n(!0)},onAgentAdded:yE,onDeploymentTaskChange:Mu,onDeploymentStarted:K2,onDeploymentComplete:q2,initialDeployRegion:t0}):Ke.length===0&&xe?o.jsx(yje,{initialJob:xe}):Ke.length===0&&!St?o.jsxs("div",{className:"session-loading",children:[o.jsx(fn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):Ke.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(yRe,{canUpdate:ye.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":Nt==="skill-create"?"想创建一个什么 Skill?":Rs})]}),L]}),o.jsx(aRe,{})]},`welcome-${it.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${oE?" is-streaming":""}`,ref:Sh,onScroll:sG,onWheel:iG,onTouchMove:rG,children:Ke.map((B,Z)=>{var ft,ht,wt,pt,an,Es,Fi;const ce=Z===Ke.length-1;if(B.role==="system")return B.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(NRe,{activity:B.activity,time:PN((ft=B.meta)==null?void 0:ft.ts)})},B.activity.id):null;if(B.role==="user"){const Mn=B.blocks.map(en=>en.kind==="text"?en.text:"").join(""),Ha=B.blocks.flatMap(en=>en.kind==="attachment"?en.files:[]),li=B.blocks.find(en=>en.kind==="invocation");return o.jsxs(ts.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(li==null?void 0:li.kind)==="invocation"&&o.jsx(B1,{value:li.value}),Ha.length>0&&o.jsx(U1,{appName:n,items:Ha}),Mn&&o.jsx("div",{className:"bubble",children:o.jsx(nh,{text:Mn})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((ht=B.meta)==null?void 0:ht.ts)&&o.jsx("span",{className:"meta-text",children:PN(B.meta.ts)}),o.jsx(pD,{text:Mn})]})]},Z)}const we=((wt=B.meta)==null?void 0:wt.author)??"",Ce=we&&Hs?DN(Hs,we):void 0,Qe=!!(we&&dc.length>0&&!dc.includes(we)),He=(Ce==null?void 0:Ce.name)||we,st=(Ce==null?void 0:Ce.description)||(Qe?"正在执行主 Agent 移交的任务。":"");if(B.blocks.length>0&&B.blocks.every(Mn=>Mn.kind==="agent-transfer"))return null;const lt=B.blocks.length===0,Re=((an=(pt=B.meta)==null?void 0:pt.feedback)==null?void 0:an.rating)??null,dt=((Es=B.meta)==null?void 0:Es.eventId)??"",Dt=ut.has(dt),ds=!!(Xi&&dt&&Ic(B)),Qi=ds?hD(Ke,Z):"";return o.jsxs(ts.div,{ref:Mn=>{dt&&(Mn?EE.current.set(dt,Mn):EE.current.delete(dt))},className:["turn turn--assistant",Qe?"turn--subagent":"",vh&&vh===dt?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Qe&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(HJ,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:He})]}),o.jsx("p",{className:"subagent-run-description",title:st,children:st})]}),lt?ce&&Mr?o.jsx(iH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(XA,{appName:n,blocks:B.blocks,streaming:ce&&(Mr||zg),onStreamFrame:ce?aG:void 0,onAction:jG,onAuth:RG,onArtifactDownload:(Mn,Ha)=>jB(n,Be,a,Mn,Ha),onArtifactPreview:(Mn,Ha)=>OB(n,Be,a,Mn,Ha)}),!(ce&&Mr)&&!FOe(B)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(ce&&Mr)&&!$Oe(B)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Fi=B.meta)!=null&&Fi.sandboxUsage)?o.jsx(kRe,{usage:B.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[ds&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Re==="good","aria-busy":Dt,title:Re==="good"?"取消点赞":"赞",disabled:Dt,onClick:()=>void rC(B,Re==="good"?null:"good",Qi),children:o.jsx(Ote,{className:"icon",filled:Re==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Re==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Re==="bad","aria-busy":Dt,title:Re==="bad"?"取消点踩":"踩",disabled:Dt,onClick:()=>void rC(B,Re==="bad"?null:"bad",Qi),children:o.jsx(Mte,{className:"icon",filled:Re==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>bn({turn:B,input:hD(Ke,Z)}),children:o.jsx(u8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var Mn;Yn((Mn=B.meta)!=null&&Mn.ts?B.meta.ts*1e3:Date.now()),Bt(!0)},children:o.jsx(POe,{})})]}),o.jsx(pD,{text:Ic(B)})]}),B.meta&&o.jsx("span",{className:"meta-text",children:BOe(B.meta)})]})]})]},Z)})}),!p&&o.jsx(dfe,{appName:n,info:Tt,loading:kn,activeAgent:Gg,seenAgents:Kg,execPath:qg,capabilities:pn,capabilityLoading:Kn,capabilityMutating:Qs,builtinTools:gi,onAddCapability:AG,onRemoveCapability:B=>void CG(B)}),o.jsx("div",{className:"conversation-composer-slot",children:L})]})]})})})(),In&&a&&o.jsx(fOe,{onClose:()=>bn(null),onSubmit:MG}),cs&&a&&o.jsx(mV,{appName:n,sessionId:a,endTimeMs:kt,onClose:()=>Bt(!1)}),o.jsx(SRe,{open:W,state:ue,agentKind:ge,error:_e,onCancel:dG,onConfirm:L=>void fG(L)}),p?o.jsxs(o.Fragment,{children:[o.jsx(DRe,{open:j!==null,kind:j??"terminal",launch:z,loading:F,error:M,onReload:()=>{j&&_E(j)},onClose:()=>{O(null),D(null),A(!1),P("")}}),o.jsx($Re,{open:k,value:p.permissions,busy:E||y,error:_,onSave:L=>void mG(L),onClose:()=>{E||(T(!1),S(""))}}),o.jsx(HRe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:_,browse:gG,onSave:L=>void bG(L),onClose:()=>{E||(I(!1),S(""))}}),o.jsx(PRe,{open:Xn.threadsOpen,threads:Xn.threads,currentThreadId:p.threadId,loading:Xn.threadsLoading,error:Xn.threadsError,onSelect:L=>void Xn.resumeThread(L),onClose:Xn.closeThreads}),o.jsx(zRe,{approval:$,busy:Y,error:U,onDecision:L=>void yG(L)})]}):null,o.jsx(lOe,{open:jr,checking:cc,error:ju,onLogin:()=>void oG()}),JV&&o.jsx("div",{className:"confirm-scrim",onClick:()=>mE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:L=>L.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>mE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{oi(null),Lt("menu"),mE(!1)},children:"确定返回"})]})]})})]})}const ED="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(ED)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(ED,String(t))}catch{}window.location.reload()}});(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||$Y.createRoot(document.getElementById("root")).render(o.jsx(Ot.StrictMode,{children:o.jsx(ZY,{reducedMotion:"user",children:o.jsx(jJ,{maskOpacity:.9,children:o.jsx(XOe,{})})})}));export{x2 as $,gbe as A,bbe as B,$7 as C,o as D,gt as E,Pn as F,Ht as G,eMe as H,Wz as I,O0e as J,mi as K,g as L,k1 as M,Tr as N,tMe as O,Rz as P,$p as Q,Ot as R,du as S,gCe as T,Pz as U,Li as V,lr as W,Au as X,Q1 as Y,Dz as Z,hu as _,sa as a,I7 as a0,Yz as b,vCe as c,HM as d,Tf as e,qi as f,nMe as g,Ez as h,lc as i,J1 as j,Of as k,VAe as l,cMe as m,gA as n,yme as o,ZAe as p,Lm as q,Zt as r,L0e as s,H0e as t,Eme as u,Mf as v,Hbe as w,S0e as x,_0e as y,Xbe as z}; diff --git a/veadk/webui/index.html b/veadk/webui/index.html index 55248f14..2ad2d89f 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,7 +5,7 @@ VeADK Studio - +